Hi,
Here is a list of some enhancements for the main survey page built by Function priorities_get_set_priorities()

  • use drupal_set_message for clearer information and consistency;
  • add a link to edit the survey if the user can do this;
  • add a link to the "surveys list page";
  • use an undored list;

This new code is below :


function priorities_get_set_priorities($survey) {
  $output = '';
  if ($survey['status'] == 3) {
    // For consistency and clearer information we use drupal_set_message and we leave the function here.
    drupal_set_message(t('Sorry, this survey is disabled, you cannot set priorities anymore, nor see its results.') . l(t(' Back to the surveys list'), 'priorities') . '.', 'warning', FALSE);
    return $output;
  }
  else {
    // If available we add the description of the survey.
    $output .= '<div id="priorities-description">' . (empty($survey['description']) ? '' : check_markup($survey['description'], FILTER_FORMAT_DEFAULT, FALSE)) . '</div>';
    // Add an unordered list instead of an html list. OK this is mostly cosmetic!
    $output .= '<ul>';
    if ($survey['status'] < 2 && priorities_set_access($survey)) {
      $output .= '<li>' . l(variable_get('priorities_set_title', t('Set priorities to answer this survey')), 'priorities/' . $survey['survey_name'] . '/set') . '</li>';
    }

    if (in_array($survey['status'], array(0, 2)) && priorities_get_access($survey)) {
      $output .= '<li>' . l(variable_get('priorities_get_title', t('Get results for this survey')), 'priorities/' . $survey['survey_name'] . '/results') . '</li>';
    }
  }

  // If the user can edit this survey, then we add a link here for convenience.
  if (user_access('administer priorities')) {
    $output .= '<li>' . l('Edit this survey', 'admin/settings/priorities/' . $survey['survey_name']) . '</li>';
  }
  // End of the unordered list.
  $output .= '</ul>';

  // For convenience we add a link to the surveys list.
  $output .= l(t('Back to the surveys list'), 'priorities');

  return $output;
}


Comments

gibus’s picture

Status: Active » Fixed

OK, this has been commited in version 6.x-2.18.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.