Ejemplo n.º 1
0
 /**
  * Builds the course or platform admin icons to edit a link
  * @param AbstractLink $link
  * @param int $selectcat id of selected category
  */
 public static function build_edit_icons_link($link, $selectcat)
 {
     $cat = new Category();
     $message_link = $cat->show_message_resource_delete($link->get_course_code());
     $is_locked = $link->is_locked();
     $modify_icons = null;
     if (!api_is_allowed_to_edit(null, true)) {
         return null;
     }
     if ($message_link === false) {
         $visibility_icon = $link->is_visible() == 0 ? 'invisible' : 'visible';
         $visibility_command = $link->is_visible() == 0 ? 'set_visible' : 'set_invisible';
         if ($is_locked && !api_is_platform_admin()) {
             $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
         } else {
             $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&cidReq=' . $link->get_course_code() . '&id_session=' . $link->get_session_id() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
         }
         //$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?movelink=' . $link->get_id() . '&selectcat=' . $selectcat . '"><img src="../img/deplacer_fichier.gif" border="0" title="' . get_lang('Move') . '" alt="" /></a>';
         $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session=' . $link->get_session_id() . ' ">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
         $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $link->get_course_code() . '&id_session=' . $link->get_session_id() . '">' . Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
         //If a work is added in a gradebook you can only delete the link in the work tool
         if ($is_locked && !api_is_platform_admin()) {
             $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
         } else {
             $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $link->get_course_code() . '&id_session=' . $link->get_session_id() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
         }
         return $modify_icons;
     }
 }