/** * Builds the course or platform admin icons to edit a category * @param Category $cat category * @param Category $selectcat id of selected category */ public static function build_edit_icons_cat($cat, $selectcat) { $show_message = $cat->show_message_resource_delete($cat->get_course_code()); $grade_model_id = $selectcat->get_grade_model_id(); $selectcat = $selectcat->get_id(); $modify_icons = null; if ($show_message === false) { $visibility_icon = $cat->is_visible() == 0 ? 'invisible' : 'visible'; $visibility_command = $cat->is_visible() == 0 ? 'set_visible' : 'set_invisible'; $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' . Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>'; if (!api_is_allowed_to_edit(null, true)) { $modify_icons .= Display::url(Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_SMALL), 'personal_stats.php?' . http_build_query(['selectcat' => $cat->get_id()]) . '&' . api_get_cidreq(), ['class' => 'ajax', 'data-title' => get_lang('FlatView')]); } if (api_is_allowed_to_edit(null, true)) { // Locking button if (api_get_setting('gradebook_locking_enabled') == 'true') { if ($cat->is_locked()) { if (api_is_platform_admin()) { $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' . Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; } else { $modify_icons .= ' <a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>'; } $modify_icons .= ' <a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; } else { $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' . Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons .= ' <a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; } } if (empty($grade_model_id) || $grade_model_id == -1) { if ($cat->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_cat.php?' . 'editcat=' . $cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session=' . $cat->get_session_id() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; } } $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' . $cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session=' . $cat->get_session_id() . '">' . Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' . $cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session=' . $cat->get_session_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_SMALL) . '</a>'; $modify_icons .= ' <a href="' . api_get_self() . '?visiblecat=' . $cat->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&cidReq=' . $cat->get_course_code() . '&id_session=' . $cat->get_session_id() . '">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; //no move ability for root categories if ($cat->is_movable()) { /* $modify_icons .= ' <a href="' . api_get_self() . '?movecat=' . $cat->get_id() . '&selectcat=' . $selectcat . ' &cidReq='.$cat->get_course_code().'"> <img src="../img/icons/22/move.png" border="0" title="' . get_lang('Move') . '" alt="" /></a>'; */ } else { //$modify_icons .= ' <img src="../img/deplacer_fichier_na.gif" border="0" title="' . get_lang('Move') . '" alt="" />'; } if ($cat->is_locked() && !api_is_platform_admin()) { $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL); } else { $modify_icons .= ' <a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $cat->get_course_code() . '&id_session=' . $cat->get_session_id() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>'; } } return $modify_icons; } }