From c0945d073072d4528eb72646979f002e94d77261 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Tue, 14 Nov 2023 14:21:34 +0100 Subject: [PATCH] Display: Partial convert of gradebook icons to MDI --- public/main/gradebook/lib/GradebookUtils.php | 116 +++----------- .../gradebook/lib/fe/displaygradebook.php | 149 +++++------------- .../gradebook/lib/fe/gradebooktable.class.php | 3 +- 3 files changed, 65 insertions(+), 203 deletions(-) diff --git a/public/main/gradebook/lib/GradebookUtils.php b/public/main/gradebook/lib/GradebookUtils.php index 0dc9ccb93c..43e3b080a2 100644 --- a/public/main/gradebook/lib/GradebookUtils.php +++ b/public/main/gradebook/lib/GradebookUtils.php @@ -2,6 +2,7 @@ /* For licensing terms, see /license.txt */ +use Chamilo\CoreBundle\Component\Utils\ActionIcon; use Chamilo\CoreBundle\Entity\Session; /** @@ -242,12 +243,7 @@ class GradebookUtils if (!api_is_allowed_to_edit(null, true)) { $modify_icons .= Display::url( - Display::return_icon( - 'statistics.png', - get_lang('List View'), - '', - ICON_SIZE_SMALL - ), + Display::getMdiIcon('chart-box', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('List View')), 'personal_stats.php?'.http_build_query([ 'selectcat' => $cat->get_id(), ]).'&'.api_get_cidreq(), @@ -269,54 +265,34 @@ class GradebookUtils if ($cat->is_locked()) { if (api_is_platform_admin()) { $modify_icons .= ' '. - Display::return_icon('lock.png', get_lang('Unlock evaluation.'), '', ICON_SIZE_SMALL).''; + Display::getMdiIcon(ActionIcon::LOCK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Unlock evaluation.')).''; } else { $modify_icons .= ' '. - Display::return_icon('lock_na.png', get_lang('This assessment has been locked. You cannot unlock it. If you really need to unlock it, please contact the platform administrator, explaining the reason why you would need to do that (it might otherwise be considered as fraud attempt).'), '', ICON_SIZE_SMALL).''; + Display::getMdiIcon(ActionIcon::LOCK, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('This assessment has been locked. You cannot unlock it. If you really need to unlock it).')).''; } - $modify_icons .= ' '.Display::return_icon('pdf.png', get_lang('Export to PDF'), '', ICON_SIZE_SMALL).''; + $modify_icons .= ' '.Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Export to PDF')).''; } else { $modify_icons .= ' '. - Display::return_icon('unlock.png', get_lang('Lock evaluation'), '', ICON_SIZE_SMALL).''; + Display::getMdiIcon(ActionIcon::UNLOCK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Lock evaluation')).''; $modify_icons .= ' '. - Display::return_icon('pdf_na.png', get_lang('Export to PDF'), '', ICON_SIZE_SMALL).''; + Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('Export to PDF')).''; } } if (empty($grade_model_id) || -1 == $grade_model_id) { if ($cat->is_locked() && !api_is_platform_admin()) { - $modify_icons .= Display::return_icon( - 'edit_na.png', - get_lang('Edit'), - '', - ICON_SIZE_SMALL - ); + $modify_icons .= Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('Edit')); } else { $modify_icons .= ''. - Display::return_icon( - 'edit.png', - get_lang('Edit'), - '', - ICON_SIZE_SMALL - ).''; + Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')).''; } } $modify_icons .= ''. - Display::return_icon( - 'percentage.png', - get_lang('Weight in Report'), - '', - ICON_SIZE_SMALL - ).''; + Display::getMdiIcon('percent-box', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Weight in Report')).''; $modify_icons .= ''. - Display::return_icon( - 'statistics.png', - get_lang('List View'), - '', - ICON_SIZE_SMALL - ).''; + Display::getMdiIcon('format-list-text', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('List View')).''; $modify_icons .= ' '. Display::return_icon( $visibility_icon.'.png', @@ -326,20 +302,10 @@ class GradebookUtils ).''; if ($cat->is_locked() && !api_is_platform_admin()) { - $modify_icons .= Display::return_icon( - 'delete_na.png', - get_lang('Delete all'), - '', - ICON_SIZE_SMALL - ); + $modify_icons .= Display::getMdiIcon(ActionIcons::DELETE, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('Delete all')); } else { $modify_icons .= ' '. - Display::return_icon( - 'delete.png', - get_lang('Delete all'), - '', - ICON_SIZE_SMALL - ). + Display::getMdiIcon(ActionItems::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete all')). ''; } } @@ -366,20 +332,10 @@ class GradebookUtils $visibility_icon = 0 == $eval->is_visible() ? 'invisible' : 'visible'; $visibility_command = 0 == $eval->is_visible() ? 'set_visible' : 'set_invisible'; if ($is_locked && !api_is_platform_admin()) { - $modify_icons = Display::return_icon( - 'edit_na.png', - get_lang('Edit'), - '', - ICON_SIZE_SMALL - ); + $modify_icons = Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('Edit')); } else { $modify_icons = ''. - Display::return_icon( - 'edit.png', - get_lang('Edit'), - '', - ICON_SIZE_SMALL - ). + Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')). ''; } @@ -413,20 +369,10 @@ class GradebookUtils if ($is_locked && !api_is_platform_admin()) { $modify_icons .= ' '. - Display::return_icon( - 'delete_na.png', - get_lang('Delete'), - '', - ICON_SIZE_SMALL - ); + Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('Delete')); } else { $modify_icons .= ' '. - Display::return_icon( - 'delete.png', - get_lang('Delete'), - '', - ICON_SIZE_SMALL - ). + Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')). ''; } @@ -459,20 +405,10 @@ class GradebookUtils $visibility_command = 0 == $link->is_visible() ? 'set_visible' : 'set_invisible'; if ($is_locked && !api_is_platform_admin()) { - $modify_icons = Display::return_icon( - 'edit_na.png', - get_lang('Edit'), - '', - ICON_SIZE_SMALL - ); + $modify_icons = Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('Edit')); } else { $modify_icons = ''. - Display::return_icon( - 'edit.png', - get_lang('Edit'), - '', - ICON_SIZE_SMALL - ). + Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')). ''; } $modify_icons .= ' '. @@ -504,23 +440,13 @@ class GradebookUtils //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 .= ' '. - Display::return_icon( - 'delete_na.png', - get_lang('Delete'), - '', - ICON_SIZE_SMALL - ); + Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('Delete')); } else { $modify_icons .= '  '. - Display::return_icon( - 'delete.png', - get_lang('Delete'), - '', - ICON_SIZE_SMALL - ). + Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')). ''; } diff --git a/public/main/gradebook/lib/fe/displaygradebook.php b/public/main/gradebook/lib/fe/displaygradebook.php index f4080c7051..71ce345b07 100644 --- a/public/main/gradebook/lib/fe/displaygradebook.php +++ b/public/main/gradebook/lib/fe/displaygradebook.php @@ -2,6 +2,8 @@ /* For licensing terms, see /license.txt */ +use Chamilo\CoreBundle\Component\Utils\ActionIcon; + /** * Class DisplayGradebook. */ @@ -20,36 +22,36 @@ class DisplayGradebook if (api_is_allowed_to_edit(null, true)) { if ('statistics' !== $page) { $links[] = ''. - Display::return_icon('back.png', get_lang('Assessment home'), '', ICON_SIZE_MEDIUM) + Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Assessment home')) .''; if ('view_result' === $page) { if ((null != $evalobj->get_course_code()) && !$evalobj->has_results()) { $links[] = ' - '.Display::return_icon('evaluation_rate.png', get_lang('Grade learners'), '', ICON_SIZE_MEDIUM).''; + '.Display::getMdiIcon(ActionIcon::GRADE, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Grade learners')).''; } if (api_is_platform_admin() || false == $evalobj->is_locked()) { $links[] = ''. - Display::return_icon('import_evaluation.png', get_lang('Import marks'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::ARCHIVE_IMPORT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Import marks')).''; } if ($evalobj->has_results()) { $links[] = ''. - Display::return_icon('export_evaluation.png', get_lang('PDF Report'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('PDF Report')).''; if (api_is_platform_admin() || false == $evalobj->is_locked()) { $links[] = ''. - Display::return_icon('edit.png', get_lang('Grade learners'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Grade learners')).''; $links[] = ''. - Display::return_icon('delete.png', get_lang('Delete marks'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Delete marks')).''; } } $links[] = ''. - Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::PRINT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Print')).''; } } else { $links[] = ' '. - Display::return_icon('back.png', get_lang('Assessment home'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Assessment home')).''; } } @@ -111,12 +113,7 @@ class DisplayGradebook if ('statistics' != $page) { if (api_is_allowed_to_edit(null, true)) { $links[] = ' '. - Display::return_icon( - 'statistics.png', - get_lang('Graphical view'), - '', - ICON_SIZE_MEDIUM - ).''; + Display::getMdiIcon('chart-box', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Graphical view')).''; } } @@ -142,7 +139,7 @@ class DisplayGradebook $url = 'gradebook_flatview.php'; } $header .= ''. - Display::return_icon('back.png', get_lang('Assessment home'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Assessment home')).''; $pageNum = isset($_GET['flatviewlist_page_nr']) ? (int) $_GET['flatviewlist_page_nr'] : null; $perPage = isset($_GET['flatviewlist_per_page']) ? (int) $_GET['flatviewlist_per_page'] : null; @@ -155,12 +152,7 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon( - 'export_csv.png', - get_lang('CSV export'), - '', - ICON_SIZE_MEDIUM - ), + Display::getMdiIcon(ActionIcon::EXPORT_CSV, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('CSV export')), $exportCsvUrl ); @@ -171,12 +163,7 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon( - 'export_excel.png', - get_lang('Excel export'), - '', - ICON_SIZE_MEDIUM - ), + Display::getMdiIcon(ActionIcon::EXPORT_SPREADSHEET, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Excel export')), $exportXlsUrl ); @@ -187,12 +174,7 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon( - 'export_doc.png', - get_lang('Export as .doc'), - '', - ICON_SIZE_MEDIUM - ), + Display::getMdiIcon(ActionIcon::EXPORT_DOC, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export as .doc')), $exportDocUrl ); @@ -202,12 +184,7 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon( - 'printer.png', - get_lang('Print'), - '', - ICON_SIZE_MEDIUM - ), + Display::getMdiIcon(ActionIcon::PRINT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Print')), $exportPrintUrl, ['target' => '_blank'] ); @@ -221,12 +198,7 @@ class DisplayGradebook ]); $header .= Display::url( - Display::return_icon( - 'pdf.png', - get_lang('Export to PDF'), - '', - ICON_SIZE_MEDIUM - ), + Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export to PDF')), $exportPdfUrl ); @@ -344,11 +316,12 @@ class DisplayGradebook $header .= ''; if ('0' == !$selectcat) { $header .= ''. - Display::return_icon( - 'back.png', - get_lang('Back to').' '.get_lang('Main folder'), - '', - ICON_SIZE_MEDIUM + Display::getMdiIcon( + ActionIcon::BACK, + 'ch-tool-icon', + null, + ICON_SIZE_MEDIUM, + get_lang('Back to').' '.get_lang('Main folder') ). ''; } @@ -384,7 +357,7 @@ class DisplayGradebook ) { $header .= ' - '.Display::return_icon('pdf.png', get_lang('Export to PDF'), [], ICON_SIZE_MEDIUM).' + '.Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export to PDF')).' '.get_lang('Export to PDF').''; } $header .= ''; @@ -408,55 +381,37 @@ class DisplayGradebook } if ($show_add_link && !$message_resource) { $actionsLeft .= ''. - Display::return_icon('new_evaluation.png', get_lang('Add classroom activity'), '', - ICON_SIZE_MEDIUM).''; + Display::getMdiIcon('table-plus', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add classroom activity')).''; $cats = Category::load($selectcat); if (null != $cats[0]->get_course_code() && !$message_resource) { $actionsLeft .= ''. - Display::return_icon('new_online_evaluation.png', get_lang('Add online activity'), '', - ICON_SIZE_MEDIUM).''; + Display::getMdiIcon('link-plus', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add online activity')).''; } else { $actionsLeft .= ''. - Display::return_icon('new_online_evaluation.png', get_lang('Add online activity'), '', - ICON_SIZE_MEDIUM).''; + Display::getMdiIcon('link-plus', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add online activity')).''; } } } if ((empty($grade_model_id) || -1 == $grade_model_id) && $accessToEdit) { $actionsLeft .= ''. - Display::return_icon( - 'new_folder.png', - get_lang('Add assessment'), - [], - ICON_SIZE_MEDIUM - ).''; + Display::getMdiIcon(ActionIcon::FOLDER_CREATE, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add assessment')).''; } if ('0' != $selectcat && $accessToRead) { if (!$message_resource) { $actionsLeft .= ''. - Display::return_icon('statistics.png', get_lang('List View'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon('chart-box', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('List View')).''; if (1 == $my_category['generate_certificates']) { $actionsLeft .= Display::url( - Display::return_icon( - 'certificate_list.png', - get_lang('See list of learner certificates'), - '', - ICON_SIZE_MEDIUM - ), + Display::getMdiIcon('format-list-text', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('See list of learner certificates')), "gradebook_display_certificate.php?$my_api_cidreq&cat_id=".$selectcat ); } $actionsLeft .= Display::url( - Display::return_icon( - 'user.png', - get_lang('Students list report'), - '', - ICON_SIZE_MEDIUM - ), + Display::getMdiIcon('account', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Students list report')), "gradebook_display_summary.php?$my_api_cidreq&selectcat=".$selectcat ); @@ -473,7 +428,7 @@ class DisplayGradebook if ($accessToEdit) { $actionsRight = ''. - Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Edit')).''; if ('true' == api_get_plugin_setting('customcertificate', 'enable_plugin_customcertificate') && 1 == api_get_course_setting('customcertificate_course_enable') @@ -482,40 +437,25 @@ class DisplayGradebook WEB_PLUGIN_PATH ).'customcertificate/src/index.php?'. $my_api_cidreq.'&origin=gradebook&selectcat='.$catobj->get_id().'">'. - Display::return_icon( - 'certificate.png', - get_lang('Attach certificate'), - '', - ICON_SIZE_MEDIUM - ).''; + Display::getMdiIcon('certificate', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Attach certificate')).''; } else { $actionsRight .= ''. - Display::return_icon( - 'certificate.png', - get_lang('Attach certificate'), - '', - ICON_SIZE_MEDIUM - ).''; + Display::getMdiIcon('certificate', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Attach certificate')).''; } if (empty($categories)) { $actionsRight .= ''. - Display::return_icon( - 'percentage.png', - get_lang('Weight in Report'), - '', - ICON_SIZE_MEDIUM - ).''; + Display::getMdiIcon('percent-box', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Weight in Report')).''; } $score_display_custom = api_get_setting('gradebook_score_display_custom'); if ('true' == api_get_setting('teachers_can_change_score_settings') && 'true' == $score_display_custom ) { $actionsRight .= ''. - Display::return_icon('ranking.png', get_lang('Skills ranking'), '', ICON_SIZE_MEDIUM).''; + Display::getMdiIcon('podium', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Skills ranking')).''; } } } @@ -531,12 +471,7 @@ class DisplayGradebook if ($isDrhOfCourse) { $actionsLeft .= ''. - Display::return_icon( - 'statistics.png', - get_lang('List View'), - '', - ICON_SIZE_MEDIUM - ). + Display::getMdiIcon('chart-box', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('List View')). ''; } @@ -570,7 +505,7 @@ class DisplayGradebook $min_certification = get_lang('Minimum certification score').' : '.$min_certification; $edit_icon = ''. - Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).''; + Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Edit')).''; $msg = $weight.' - '.$min_certification.$edit_icon; //@todo show description @@ -621,12 +556,12 @@ class DisplayGradebook $header = '
'; if ($is_course_admin) { - $header .= ''.Display::return_icon('statistics.png', get_lang('List View'), '', ICON_SIZE_MEDIUM).''; - $header .= ''.Display::return_icon('settings.png', get_lang('Skills ranking'), '', ICON_SIZE_MEDIUM).''; + $header .= ''.Display::getMdiIcon('chart-box', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('List View')).''; + $header .= ''.Display::getMdiIcon('cog', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Skills ranking')).''; } elseif (!(isset($_GET['studentoverview']))) { - $header .= ''.Display::return_icon('view_list.gif', get_lang('List View')).' '.get_lang('List View').''; + $header .= ''.Display::getMdiIcon('format-list-text', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('List View')).' '.get_lang('List View').''; } else { - $header .= ''.Display::return_icon('pdf.png', get_lang('Export to PDF'), '', ICON_SIZE_MEDIUM).''; + $header .= ''.Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Export to PDF')).''; } $header .= '
'; echo $header; diff --git a/public/main/gradebook/lib/fe/gradebooktable.class.php b/public/main/gradebook/lib/fe/gradebooktable.class.php index a722ed28ba..41431cf0a0 100644 --- a/public/main/gradebook/lib/fe/gradebooktable.class.php +++ b/public/main/gradebook/lib/fe/gradebooktable.class.php @@ -2,6 +2,7 @@ /* For licensing terms, see license.txt */ +use Chamilo\CoreBundle\Component\Utils\ActionIcon; use ChamiloSession as Session; use CpChart\Cache as pCache; use CpChart\Data as pData; @@ -960,7 +961,7 @@ class GradebookTable extends SortableTable $warning_message = sprintf(get_lang('The sum of all weights of activities must be %s'), $weight_category); $modify_icons = ''. - Display::return_icon('edit.png', $warning_message, [], ICON_SIZE_SMALL).''; + Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'), ['alt' => $warning_message]); $warning_message .= $modify_icons; echo Display::return_message($warning_message, 'warning', false); }