From 2b931458ad07e6e97399f44694798af8be10c07c Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 20 Dec 2016 16:08:21 +0800 Subject: [PATCH] MDL-40759 plugins: Add font icon mapping to all plugins --- admin/tool/lp/lib.php | 9 +++++++++ admin/tool/recyclebin/lib.php | 9 +++++++++ admin/tool/usertours/lib.php | 11 +++++++++++ enrol/guest/lib.php | 10 ++++++++++ enrol/manual/lib.php | 1 + enrol/self/lib.php | 10 ++++++++++ lib/editor/atto/plugins/collapse/lib.php | 3 +++ mod/book/lib.php | 16 ++++++++++++++++ mod/book/view.php | 8 ++++---- mod/choice/lib.php | 10 ++++++++++ mod/feedback/lib.php | 10 ++++++++++ mod/forum/lib.php | 5 ++++- mod/glossary/lib.php | 9 +++++++++ mod/lesson/lib.php | 9 +++++++++ mod/lti/lib.php | 9 +++++++++ mod/quiz/lib.php | 9 +++++++++ mod/wiki/lib.php | 9 +++++++++ mod/workshop/lib.php | 12 ++++++++++++ question/type/ddmarker/lib.php | 10 ++++++++++ 19 files changed, 164 insertions(+), 5 deletions(-) diff --git a/admin/tool/lp/lib.php b/admin/tool/lp/lib.php index ff5880e5d5b77..c68729b6c9561 100644 --- a/admin/tool/lp/lib.php +++ b/admin/tool/lp/lib.php @@ -208,3 +208,12 @@ function tool_lp_coursemodule_edit_post_actions($data, $course) { return $data; } + +/** + * Map icons for font-awesome themes. + */ +function tool_lp_get_fontawesome_icon_map() { + return [ + 'tool_lp:url' => 'fa-external-link' + ]; +} diff --git a/admin/tool/recyclebin/lib.php b/admin/tool/recyclebin/lib.php index d4e748bd1b623..93cad35ae3eed 100644 --- a/admin/tool/recyclebin/lib.php +++ b/admin/tool/recyclebin/lib.php @@ -197,3 +197,12 @@ function tool_recyclebin_pre_course_category_delete($category) { $categorybin = new \tool_recyclebin\category_bin($category->id); $categorybin->delete_all_items(); } + +/** + * Map icons for font-awesome themes. + */ +function tool_recyclebin_get_fontawesome_icon_map() { + return [ + 'tool_recyclebin:trash' => 'fa-trash' + ]; +} diff --git a/admin/tool/usertours/lib.php b/admin/tool/usertours/lib.php index cd3c867b994bc..f2777034309da 100644 --- a/admin/tool/usertours/lib.php +++ b/admin/tool/usertours/lib.php @@ -74,3 +74,14 @@ function tool_usertours_extend_navigation_user() { function tool_usertours_before_footer() { \tool_usertours\helper::bootstrap(); } + +/** + * Map icons for font-awesome themes. + */ +function tool_usertours_get_fontawesome_icon_map() { + return [ + 'tool_usertours:t/export' => 'fa-download', + 'tool_usertours:i/reload' => 'fa-refresh', + 'tool_usertours:filler' => 'fa-spacer', + ]; +} diff --git a/enrol/guest/lib.php b/enrol/guest/lib.php index 696ae6bee839f..fd8ffbda59b29 100644 --- a/enrol/guest/lib.php +++ b/enrol/guest/lib.php @@ -480,3 +480,13 @@ public function edit_instance_validation($data, $files, $instance, $context) { } + +/** + * Get icon mapping for font-awesome. + */ +function enrol_guest_get_fontawesome_icon_map() { + return [ + 'enrol_guest:withpassword' => 'fa-key', + 'enrol_guest:withoutpassword' => 'fa-unlock-alt', + ]; +} diff --git a/enrol/manual/lib.php b/enrol/manual/lib.php index f41dae344ce3a..743cfd730bc16 100644 --- a/enrol/manual/lib.php +++ b/enrol/manual/lib.php @@ -730,3 +730,4 @@ public function edit_instance_validation($data, $files, $instance, $context) { } } + diff --git a/enrol/self/lib.php b/enrol/self/lib.php index c128fa3c44bde..aeb92468fa3c0 100644 --- a/enrol/self/lib.php +++ b/enrol/self/lib.php @@ -1053,3 +1053,13 @@ public function get_welcome_email_contact($sendoption, $context) { return $contact; } } + +/** + * Get icon mapping for font-awesome. + */ +function enrol_self_get_fontawesome_icon_map() { + return [ + 'enrol_self:withkey' => 'fa-key', + 'enrol_self:withoutkey' => 'fa-unlock-alt', + ]; +} diff --git a/lib/editor/atto/plugins/collapse/lib.php b/lib/editor/atto/plugins/collapse/lib.php index 76517f5b337bb..9788eb1ba1667 100644 --- a/lib/editor/atto/plugins/collapse/lib.php +++ b/lib/editor/atto/plugins/collapse/lib.php @@ -43,6 +43,9 @@ function atto_collapse_params_for_js($elementid, $options, $fpoptions) { return $params; } +/** + * Map icons for font-awesome themes. + */ function atto_collapse_get_fontawesome_icon_map() { return [ 'atto_collapse:icon' => 'fa-level-down' diff --git a/mod/book/lib.php b/mod/book/lib.php index 6ed3c833f9366..6c732ed2f5c0a 100644 --- a/mod/book/lib.php +++ b/mod/book/lib.php @@ -670,3 +670,19 @@ function book_check_updates_since(cm_info $cm, $from, $filter = array()) { return $updates; } + +/** + * Get icon mapping for font-awesome. + */ +function mod_book_get_fontawesome_icon_map() { + return [ + 'mod_book:chapter' => 'fa-bookmark-o', + 'mod_book:nav_prev' => 'fa-arrow-left', + 'mod_book:nav_prev_dis' => 'fa-angle-left', + 'mod_book:nav-sep' => 'fa-minus', + 'mod_book:add' => 'fa-plus', + 'mod_book:nav_next' => 'fa-arrow-right', + 'mod_book:nav_next_dis' => 'fa-angle-right', + 'mod_book:nav_exit' => 'fa-arrow-up', + ]; +} diff --git a/mod/book/view.php b/mod/book/view.php index f1a1c4b5bc579..5edc062cd9c37 100644 --- a/mod/book/view.php +++ b/mod/book/view.php @@ -161,7 +161,7 @@ if ($book->navstyle == 1) { $chnavigation .= '' . - '' . $navprevtitle . ''; + $OUTPUT->pix_icon($navprevicon, $navprevtitle, 'mod_book') . ''; } else { $chnavigation .= '' . @@ -170,7 +170,7 @@ } } else { if ($book->navstyle == 1) { - $chnavigation .= ''; + $chnavigation .= $OUTPUT->pix_icon($navprevdisicon, '', 'mod_book'); } } if ($nextid) { @@ -178,7 +178,7 @@ if ($book->navstyle == 1) { $chnavigation .= '' . - '' . $navnexttitle . ''; + $OUTPUT->pix_icon($navnexticon, $navnexttitle, 'mod_book') . ''; } else { $chnavigation .= ' ' . @@ -191,7 +191,7 @@ $returnurl = course_get_url($course, $sec); if ($book->navstyle == 1) { $chnavigation .= '' . - '' . $navexit . ''; + $OUTPUT->pix_icon('nav_exit', $navexit, 'mod_book') . ''; } else { $chnavigation .= ' ' . '' . $navexit . ' ' . $OUTPUT->uarrow() . ''; diff --git a/mod/choice/lib.php b/mod/choice/lib.php index 15ed6f5f22a84..ce22fa7f9148b 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -1167,3 +1167,13 @@ function choice_check_updates_since(cm_info $cm, $from, $filter = array()) { return $updates; } + +/** + * Get icon mapping for font-awesome. + */ +function mod_choice_get_fontawesome_icon_map() { + return [ + 'mod_choice:row' => 'fa-info', + 'mod_choice:column' => 'fa-columns', + ]; +} diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php index 1ecbc4cccae61..933616f87a4d0 100644 --- a/mod/feedback/lib.php +++ b/mod/feedback/lib.php @@ -3316,3 +3316,13 @@ function feedback_can_view_analysis($feedback, $context, $courseid = false) { return feedback_is_already_submitted($feedback->id, $courseid); } + +/** + * Get icon mapping for font-awesome. + */ +function mod_feedback_get_fontawesome_icon_map() { + return [ + 'mod_feedback:required' => 'fa-exclamation-circle', + 'mod_feedback:notrequired' => 'fa-spacer', + ]; +} diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 25b20a2913952..c7d6249fbcb7d 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -8079,7 +8079,10 @@ function forum_check_updates_since(cm_info $cm, $from, $filter = array()) { return $updates; } -function forum_get_fontawesome_icon_map() { +/** + * Get icon mapping for font-awesome. + */ +function mod_forum_get_fontawesome_icon_map() { return [ 'mod_forum:i/pinned' => 'fa-map-pin', 'mod_forum:t/selected' => 'fa-check', diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 4483ea47342ce..efd323b80c5e2 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -4154,3 +4154,12 @@ function glossary_check_updates_since(cm_info $cm, $from, $filter = array()) { return $updates; } + +/** + * Get icon mapping for font-awesome. + */ +function forum_get_fontawesome_icon_map() { + return [ + 'mod_glossary:export' => 'fa-download' + ]; +} diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index 93179073bdfc8..8010325d08620 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -1480,3 +1480,12 @@ function lesson_update_media_file($lessonid, $context, $draftitemid) { $DB->set_field('lesson', 'mediafile', '', array('id' => $lessonid)); } } + +/** + * Get icon mapping for font-awesome. + */ +function mod_lesson_get_fontawesome_icon_map() { + return [ + 'mod_lesson:e/copy' => 'fa-clone', + ]; +} diff --git a/mod/lti/lib.php b/mod/lti/lib.php index 5603817f49b94..5fbbf42b37a0d 100644 --- a/mod/lti/lib.php +++ b/mod/lti/lib.php @@ -587,3 +587,12 @@ function lti_check_updates_since(cm_info $cm, $from, $filter = array()) { return $updates; } + +/** + * Get icon mapping for font-awesome. + */ +function mod_lti_get_fontawesome_icon_map() { + return [ + 'mod_lti:warning' => 'fa-exclamation', + ]; +} diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index d3148b67cfece..55b65073f2a2a 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -2051,3 +2051,12 @@ function quiz_check_updates_since(cm_info $cm, $from, $filter = array()) { return $updates; } + +/** + * Get icon mapping for font-awesome. + */ +function mod_quiz_get_fontawesome_icon_map() { + return [ + 'mod_quiz:navflagged' => 'fa-flag', + ]; +} diff --git a/mod/wiki/lib.php b/mod/wiki/lib.php index 94ff17884607e..8a5cbf064484b 100644 --- a/mod/wiki/lib.php +++ b/mod/wiki/lib.php @@ -779,3 +779,12 @@ function wiki_check_updates_since(cm_info $cm, $from, $filter = array()) { } return $updates; } + +/** + * Get icon mapping for font-awesome. + */ +function mod_wiki_get_fontawesome_icon_map() { + return [ + 'mod_wiki:attachment' => 'fa-paperclip', + ]; +} diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index bcc02c9feb55a..e6612c8bcddf1 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -1846,3 +1846,15 @@ function workshop_reset_userdata(stdClass $data) { return $status; } + +/** + * Get icon mapping for font-awesome. + */ +function mod_workshop_get_fontawesome_icon_map() { + return [ + 'mod_workshop:userplan/task-info' => 'fa-info', + 'mod_workshop:userplan/task-todo' => 'fa-square-o', + 'mod_workshop:userplan/task-done' => 'fa-check', + 'mod_workshop:userplan/task-fail' => 'fa-remove', + ]; +} diff --git a/question/type/ddmarker/lib.php b/question/type/ddmarker/lib.php index 04e0f30a73a1b..6a9a21ca9b8f8 100644 --- a/question/type/ddmarker/lib.php +++ b/question/type/ddmarker/lib.php @@ -41,3 +41,13 @@ function qtype_ddmarker_pluginfile($course, $cm, $context, $filearea, $args, $fo require_once($CFG->libdir . '/questionlib.php'); question_pluginfile($course, $context, 'qtype_ddmarker', $filearea, $args, $forcedownload, $options); } + +/** + * Get icon mapping for font-awesome. + */ +function qtype_ddmarker_get_fontawesome_icon_map() { + return [ + 'qtype_ddmarker:crosshairs' => 'fa-crosshairs', + 'qtype_ddmarker:grid' => 'fa-th', + ]; +}