/**
  * Generate name column
  * @param GradebookItem $item
  * @param string $type simple|detail
  * @return string
  */
 private function build_name_link($item, $type = 'detail')
 {
     $view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
     $categoryId = $item->getCategory()->get_id();
     switch ($item->get_item_type()) {
         // category
         case 'C':
             $prms_uri = '?selectcat=' . $item->get_id() . '&view=' . $view;
             if (isset($_GET['isStudentView'])) {
                 if (isset($is_student) || isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview') {
                     $prms_uri = $prms_uri . '&isStudentView=' . Security::remove_XSS($_GET['isStudentView']);
                 }
             }
             $cat = new Category();
             $show_message = $cat->show_message_resource_delete($item->get_course_code());
             return '&nbsp;<a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . $prms_uri . '">' . $item->get_name() . '</a>' . ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']' . $show_message : '');
             // evaluation
         // evaluation
         case 'E':
             $cat = new Category();
             $course_id = CourseManager::get_course_by_category($categoryId);
             $show_message = $cat->show_message_resource_delete($course_id);
             // course/platform admin can go to the view_results page
             if (api_is_allowed_to_edit() && $show_message === false) {
                 if ($item->get_type() == 'presence') {
                     return '&nbsp;' . '<a href="gradebook_view_result.php?cidReq=' . $course_id . '&amp;selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
                 } else {
                     $extra = Display::label(get_lang('Evaluation'));
                     if ($type == 'simple') {
                         $extra = '';
                     }
                     return '&nbsp;' . '<a href="gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>&nbsp;' . $extra;
                 }
             } elseif (ScoreDisplay::instance()->is_custom() && $show_message === false) {
                 // students can go to the statistics page (if custom display enabled)
                 return '&nbsp;' . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
             } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay::instance()->is_custom()) {
                 return '&nbsp;' . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
             } else {
                 return '[' . get_lang('Evaluation') . ']&nbsp;&nbsp;' . $item->get_name() . $show_message;
             }
         case 'L':
             // link
             $cat = new Category();
             $course_id = CourseManager::get_course_by_category($categoryId);
             $show_message = $cat->show_message_resource_delete($course_id);
             $url = $item->get_link();
             if (isset($url) && $show_message === false) {
                 $text = '&nbsp;<a href="' . $item->get_link() . '">' . $item->get_name() . '</a>';
             } else {
                 $text = $item->get_name();
             }
             $extra = Display::label($item->get_type_name(), 'info');
             if ($type == 'simple') {
                 $extra = '';
             }
             $text .= "&nbsp;" . $extra . $show_message;
             $cc = $this->currentcat->get_course_code();
             if (empty($cc)) {
                 $text .= '&nbsp;[<a href="' . api_get_path(REL_COURSE_PATH) . $item->get_course_code() . '/">' . $item->get_course_code() . '</a>]';
             }
             return $text;
     }
 }
 /**
  * @param GradebookItem $item1
  * @param GradebookItem $item2
  * @return int
  */
 public function sort_by_id($item1, $item2)
 {
     return api_strnatcmp($item1->get_id(), $item2->get_id());
 }