Пример #1
0
 /**
  * Get a link that changes the sort order, and indicates the current sort state.
  * @param $name internal name used for this type of sorting.
  * @param $currentsort the current sort order -1, 0, 1 for descending, none, ascending.
  * @param $title the link text.
  * @param $defaultreverse whether the default sort order for this column is descending, rather than ascending.
  * @return string HTML fragment.
  */
 protected function make_sort_link($sort, $title, $tip, $defaultreverse = false)
 {
     $currentsort = $this->qbank->get_primary_sort_order($sort);
     $newsortreverse = $defaultreverse;
     if ($currentsort) {
         $newsortreverse = $currentsort > 0;
     }
     if (!$tip) {
         $tip = $title;
     }
     if ($newsortreverse) {
         $tip = get_string('sortbyxreverse', '', $tip);
     } else {
         $tip = get_string('sortbyx', '', $tip);
     }
     $link = '<a href="' . $this->qbank->new_sort_url($sort, $newsortreverse) . '" title="' . $tip . '">';
     $link .= $title;
     if ($currentsort) {
         $link .= $this->get_sort_icon($currentsort < 0);
     }
     $link .= '</a>';
     return $link;
 }