From 3e6adcd69cd5495e4a565331a6c77d6cc7aba655 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Thu, 16 Feb 2017 13:42:03 +0800 Subject: [PATCH] MDL-40759 icons: Rename activity_icon image_icon is a better name because there are some valid uses for these other than for activity icons. E.g. Old JS code that is not worth re-writing. --- admin/tool/recyclebin/index.php | 2 +- backup/moodle2/backup_activity_task.class.php | 2 +- backup/moodle2/restore_activity_task.class.php | 2 +- backup/util/ui/renderer.php | 2 +- blocks/activity_modules/block_activity_modules.php | 2 +- blocks/course_overview/renderer.php | 2 +- blocks/feedback/block_feedback.php | 2 +- calendar/lib.php | 4 ++-- lib/outputcomponents.php | 2 +- lib/outputrenderers.php | 10 +++++----- lib/upgrade.txt | 2 +- lib/weblib.php | 2 +- mod/assign/feedback/editpdf/classes/renderer.php | 6 +++--- mod/assign/lib.php | 2 +- mod/feedback/lib.php | 2 +- mod/forum/lib.php | 2 +- mod/quiz/classes/output/edit_renderer.php | 4 ++-- mod/quiz/lib.php | 2 +- mod/workshop/lib.php | 4 ++-- question/type/ddmarker/renderer.php | 2 +- report/outline/locallib.php | 2 +- report/progress/index.php | 2 +- 22 files changed, 31 insertions(+), 31 deletions(-) diff --git a/admin/tool/recyclebin/index.php b/admin/tool/recyclebin/index.php index ce2cc0a8a89e0..c894017098491 100644 --- a/admin/tool/recyclebin/index.php +++ b/admin/tool/recyclebin/index.php @@ -187,7 +187,7 @@ if (isset($modules[$item->module])) { $mod = $modules[$item->module]; $modname = get_string('modulename', $mod->name); - $name = $OUTPUT->activity_icon('icon', $modname, $mod->name) . $name; + $name = $OUTPUT->image_icon('icon', $modname, $mod->name) . $name; } } diff --git a/backup/moodle2/backup_activity_task.class.php b/backup/moodle2/backup_activity_task.class.php index cd93be0e08c3e..b1da9bb506431 100644 --- a/backup/moodle2/backup_activity_task.class.php +++ b/backup/moodle2/backup_activity_task.class.php @@ -271,7 +271,7 @@ protected function define_settings() { // - section_included setting (if exists) $settingname = $settingprefix . 'included'; $activity_included = new backup_activity_generic_setting($settingname, base_setting::IS_BOOLEAN, true); - $activity_included->get_ui()->set_icon(new activity_icon('icon', get_string('pluginname', $this->modulename), + $activity_included->get_ui()->set_icon(new image_icon('icon', get_string('pluginname', $this->modulename), $this->modulename, array('class' => 'iconlarge icon-post'))); $this->add_setting($activity_included); // Look for "activities" root setting diff --git a/backup/moodle2/restore_activity_task.class.php b/backup/moodle2/restore_activity_task.class.php index 56b0b98d5479a..a1b9b8bd1f592 100644 --- a/backup/moodle2/restore_activity_task.class.php +++ b/backup/moodle2/restore_activity_task.class.php @@ -287,7 +287,7 @@ protected function define_settings() { // - section_included setting (if exists) $settingname = $settingprefix . 'included'; $activity_included = new restore_activity_generic_setting($settingname, base_setting::IS_BOOLEAN, true); - $activity_included->get_ui()->set_icon(new activity_icon('icon', get_string('pluginname', $this->modulename), + $activity_included->get_ui()->set_icon(new image_icon('icon', get_string('pluginname', $this->modulename), $this->modulename, array('class' => 'iconlarge icon-post'))); $this->add_setting($activity_included); // Look for "activities" root setting diff --git a/backup/util/ui/renderer.php b/backup/util/ui/renderer.php index 77f179c706172..b4855bb68445e 100644 --- a/backup/util/ui/renderer.php +++ b/backup/util/ui/renderer.php @@ -171,7 +171,7 @@ public function backup_details($details, $nextstageurl) { $table->data = array(); } $name = get_string('pluginname', $activity->modulename); - $icon = new activity_icon('icon', $name, $activity->modulename, array('class' => 'iconlarge icon-pre')); + $icon = new image_icon('icon', $name, $activity->modulename, array('class' => 'iconlarge icon-pre')); $table->data[] = array( $this->output->render($icon).$name, $activity->title, diff --git a/blocks/activity_modules/block_activity_modules.php b/blocks/activity_modules/block_activity_modules.php index 3b8268c4285ae..af67de2048b55 100644 --- a/blocks/activity_modules/block_activity_modules.php +++ b/blocks/activity_modules/block_activity_modules.php @@ -78,7 +78,7 @@ function get_content() { $icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon')); $this->content->items[] = ''.$icon.$modfullname.''; } else { - $icon = $OUTPUT->activity_icon('icon', get_string('pluginname', $modname), $modname); + $icon = $OUTPUT->image_icon('icon', get_string('pluginname', $modname), $modname); $this->content->items[] = ''.$icon.$modfullname.''; } } diff --git a/blocks/course_overview/renderer.php b/blocks/course_overview/renderer.php index 14f5e17bf00cb..22f974ccb0da5 100644 --- a/blocks/course_overview/renderer.php +++ b/blocks/course_overview/renderer.php @@ -175,7 +175,7 @@ protected function activity_display($cid, $overview) { $output .= html_writer::start_tag('div', array('class' => 'activity_overview')); $url = new moodle_url("/mod/$module/index.php", array('id' => $cid)); $modulename = get_string('modulename', $module); - $icontext = html_writer::link($url, $this->output->activity_icon('icon', $modulename, 'mod_'.$module, array('class'=>'iconlarge'))); + $icontext = html_writer::link($url, $this->output->image_icon('icon', $modulename, 'mod_'.$module, array('class'=>'iconlarge'))); if (get_string_manager()->string_exists("activityoverview", $module)) { $icontext .= get_string("activityoverview", $module); } else { diff --git a/blocks/feedback/block_feedback.php b/blocks/feedback/block_feedback.php index 52cc19a8fd604..b10163aedc9a9 100644 --- a/blocks/feedback/block_feedback.php +++ b/blocks/feedback/block_feedback.php @@ -53,7 +53,7 @@ function get_content() { $courseid = SITEID; } - $icon = $OUTPUT->activity_icon('icon', get_string('pluginname', 'mod_feedback'), 'mod_feedback'); + $icon = $OUTPUT->image_icon('icon', get_string('pluginname', 'mod_feedback'), 'mod_feedback'); if (empty($this->instance->pageid)) { $this->instance->pageid = SITEID; diff --git a/calendar/lib.php b/calendar/lib.php index 583419da92289..199cd65aa4889 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -397,7 +397,7 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea if ($component == 'moodle') { $popupcontent .= $OUTPUT->pix_icon($popupicon, $popupalt, $component); } else { - $popupcontent .= $OUTPUT->activity_icon($popupicon, $popupalt, $component); + $popupcontent .= $OUTPUT->image_icon($popupicon, $popupalt, $component); } // Show ical source if needed. if (!empty($event->subscription) && $CFG->calendar_showicalsource) { @@ -693,7 +693,7 @@ function calendar_add_event_metadata($event) { } else { $eventtype = ''; } - $event->icon = $OUTPUT->activity_icon('icon', $event->modulename, $eventtype); + $event->icon = $OUTPUT->image_icon('icon', $event->modulename, $eventtype); $event->referer = ''.$event->name.''; $event->courselink = calendar_get_courselink($module->course); diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index a28b763e1e17c..33b4c9ff2a10c 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -727,7 +727,7 @@ public function export_for_pix() { * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @package core */ -class activity_icon extends pix_icon { +class image_icon extends pix_icon { } /** diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 181cb1c2793e6..d33dda1d03b29 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -2029,10 +2029,10 @@ public function doc_link($path, $text = '', $forcepopup = false) { } /** - * Return HTML for an activity_icon. + * Return HTML for an image_icon. * * Theme developers: DO NOT OVERRIDE! Please override function - * {@link core_renderer::render_activity_icon()} instead. + * {@link core_renderer::render_image_icon()} instead. * * @param string $pix short pix name * @param string $alt mandatory alt attribute @@ -2040,8 +2040,8 @@ public function doc_link($path, $text = '', $forcepopup = false) { * @param array $attributes htm lattributes * @return string HTML fragment */ - public function activity_icon($pix, $alt, $component='moodle', array $attributes = null) { - $icon = new activity_icon($pix, $alt, $component, $attributes); + public function image_icon($pix, $alt, $component='moodle', array $attributes = null) { + $icon = new image_icon($pix, $alt, $component, $attributes); return $this->render($icon); } @@ -2051,7 +2051,7 @@ public function activity_icon($pix, $alt, $component='moodle', array $attributes * @param pix_icon $icon * @return string HTML fragment */ - protected function render_activity_icon(activity_icon $icon) { + protected function render_image_icon(image_icon $icon) { global $PAGE; $system = \core\output\icon_system::instance(\core\output\icon_system::STANDARD); diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 6f5a37bf01d91..824cf3426513f 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -7,7 +7,7 @@ information provided here is intended especially for developers. to be performed after the form's definition was set. This is useful for intermediate subclasses. * $OUTPUT->pix_url() has been deprecated because it is was used mostly to manually generate image tags for icons. Use pix_icon instead. For other valid use cases use $OUTPUT->image_url(). -* Activity icons have been split from standard icons. Use $OUTPUT->activity_icon instead of $OUTPUT->pix_icon for these +* Activity icons have been split from standard icons. Use $OUTPUT->image_icon instead of $OUTPUT->pix_icon for these type of icons (the coloured main icon for each activity). * YUI module moodle-core-formautosubmit has been removed, use jquery .change() instead (see lib/templates/url_select.mustache for an example) diff --git a/lib/weblib.php b/lib/weblib.php index fd886002c67a8..147816f6f6f69 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2574,7 +2574,7 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid $class = 'activity '.$mod->modname; $class .= ($cmid == $mod->id) ? ' selected' : ''; $menu[] = '
  • '. - $OUTPUT->activity_icon('icon', '', $mod->modname). + $OUTPUT->image_icon('icon', '', $mod->modname). ''.$mod->name.'
  • '; } diff --git a/mod/assign/feedback/editpdf/classes/renderer.php b/mod/assign/feedback/editpdf/classes/renderer.php index 9b29adf1122ff..967606ef2dd7c 100644 --- a/mod/assign/feedback/editpdf/classes/renderer.php +++ b/mod/assign/feedback/editpdf/classes/renderer.php @@ -84,7 +84,7 @@ private function render_toolbar_button($icon, $tool, $accesskey = null, $disable } $iconalt = get_string('toolbarbutton', 'assignfeedback_editpdf', $alttext); - $iconhtml = $this->activity_icon($icon, $iconalt, 'assignfeedback_editpdf'); + $iconhtml = $this->image_icon($icon, $iconalt, 'assignfeedback_editpdf'); $iconparams = array('data-tool'=>$tool, 'class'=>$tool . 'button'); if ($disabled) { $iconparams['disabled'] = 'true'; @@ -139,14 +139,14 @@ public function render_assignfeedback_editpdf_widget(assignfeedback_editpdf_widg } $iconalt = get_string('navigateprevious', 'assignfeedback_editpdf'); - $iconhtml = $this->activity_icon($nav_prev, $iconalt, 'assignfeedback_editpdf'); + $iconhtml = $this->image_icon($nav_prev, $iconalt, 'assignfeedback_editpdf'); $navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true', 'class'=>'navigate-previous-button', 'accesskey' => $this->get_shortcut('navigate-previous-button'))); $navigation1 .= html_writer::tag('select', null, array('disabled'=>'true', 'aria-label' => get_string('gotopage', 'assignfeedback_editpdf'), 'class'=>'navigate-page-select', 'accesskey' => $this->get_shortcut('navigate-page-select'))); $iconalt = get_string('navigatenext', 'assignfeedback_editpdf'); - $iconhtml = $this->activity_icon($nav_next, $iconalt, 'assignfeedback_editpdf'); + $iconhtml = $this->image_icon($nav_next, $iconalt, 'assignfeedback_editpdf'); $navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true', 'class'=>'navigate-next-button', 'accesskey' => $this->get_shortcut('navigate-next-button'))); diff --git a/mod/assign/lib.php b/mod/assign/lib.php index 5a9f8e6ed8fae..37af5b764f667 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -1074,7 +1074,7 @@ function assign_print_recent_mod_activity($activity, $courseid, $detail, $modnam if ($detail) { $modname = $modnames[$activity->type]; echo '
    '; - echo $OUTPUT->activity_icon('icon', $modname, 'assign'); + echo $OUTPUT->image_icon('icon', $modname, 'assign'); echo ''; echo $activity->name; echo ''; diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php index f195516abd953..385c102aef4ae 100644 --- a/mod/feedback/lib.php +++ b/mod/feedback/lib.php @@ -492,7 +492,7 @@ function feedback_print_recent_mod_activity($activity, $courseid, $detail, $modn if ($detail) { $modname = $modnames[$activity->type]; echo '
    '; - echo $OUTPUT->activity_icon('icon', $modname, $activity->type); + echo $OUTPUT->image_icon('icon', $modname, $activity->type); echo "wwwroot/mod/feedback/view.php?id={$activity->cmid}\">{$activity->name}"; echo '
    '; } diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 49ef349a8e312..8276c8fce0894 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -5997,7 +5997,7 @@ function forum_print_recent_mod_activity($activity, $courseid, $detail, $modname $output .= html_writer::start_div($class); if ($detail) { $aname = s($activity->name); - $output .= $OUTPUT->activity_icon('icon', $aname, $activity->type); + $output .= $OUTPUT->image_icon('icon', $aname, $activity->type); } $discussionurl = new moodle_url('/mod/forum/discuss.php', ['d' => $content->discussion]); $discussionurl->set_anchor('p' . $activity->content->id); diff --git a/mod/quiz/classes/output/edit_renderer.php b/mod/quiz/classes/output/edit_renderer.php index 988c58ba55345..60c9c427550a7 100644 --- a/mod/quiz/classes/output/edit_renderer.php +++ b/mod/quiz/classes/output/edit_renderer.php @@ -765,11 +765,11 @@ public function page_split_join_button($structure, $slot) { if ($insertpagebreak) { $title = get_string('addpagebreak', 'quiz'); - $image = $this->activity_icon('e/insert_page_break', $title); + $image = $this->image_icon('e/insert_page_break', $title); $action = 'addpagebreak'; } else { $title = get_string('removepagebreak', 'quiz'); - $image = $this->activity_icon('e/remove_page_break', $title); + $image = $this->image_icon('e/remove_page_break', $title); $action = 'removepagebreak'; } diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 483afac1b9b87..b91c369719eea 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -988,7 +988,7 @@ function quiz_print_recent_mod_activity($activity, $courseid, $detail, $modnames if ($detail) { $modname = $modnames[$activity->type]; echo '
    '; - echo $OUTPUT->activity_icon('icon', $modname, $activity->type); + echo $OUTPUT->image_icon('icon', $modname, $activity->type); echo '' . $activity->name . ''; echo '
    '; diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index 93d5b13736d69..2a24779d7c6c0 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -928,7 +928,7 @@ function workshop_print_recent_mod_activity($activity, $courseid, $detail, $modn echo html_writer::start_tag('h4', array('class'=>'workshop')); $url = new moodle_url('/mod/workshop/view.php', array('id'=>$activity->cmid)); $name = s($activity->name); - echo $OUTPUT->activity_icon('icon', $name, $activity->type); + echo $OUTPUT->image_icon('icon', $name, $activity->type); echo ' ' . $modnames[$activity->type]; echo html_writer::link($url, $name, array('class'=>'name', 'style'=>'margin-left: 5px')); echo html_writer::end_tag('h4'); @@ -965,7 +965,7 @@ function workshop_print_recent_mod_activity($activity, $courseid, $detail, $modn echo html_writer::start_tag('h4', array('class'=>'workshop')); $url = new moodle_url('/mod/workshop/view.php', array('id'=>$activity->cmid)); $name = s($activity->name); - echo $OUTPUT->activity_icon('icon', $name, $activity->type); + echo $OUTPUT->image_icon('icon', $name, $activity->type); echo ' ' . $modnames[$activity->type]; echo html_writer::link($url, $name, array('class'=>'name', 'style'=>'margin-left: 5px')); echo html_writer::end_tag('h4'); diff --git a/question/type/ddmarker/renderer.php b/question/type/ddmarker/renderer.php index 0b67e286a57e6..45e119bc7e227 100644 --- a/question/type/ddmarker/renderer.php +++ b/question/type/ddmarker/renderer.php @@ -69,7 +69,7 @@ public function formulation_and_controls(question_attempt $qa, $classes[] = 'dragno'.$drag->noofdrags; } $targeticonhtml = - $OUTPUT->activity_icon('crosshairs', '', $componentname, array('class' => 'target')); + $OUTPUT->image_icon('crosshairs', '', $componentname, array('class' => 'target')); $markertextattrs = array('class' => 'markertext'); $markertext = html_writer::tag('span', $drag->text, $markertextattrs); diff --git a/report/outline/locallib.php b/report/outline/locallib.php index 08363d91bb5b4..9d734b7073b7f 100644 --- a/report/outline/locallib.php +++ b/report/outline/locallib.php @@ -31,7 +31,7 @@ function report_outline_print_row($mod, $instance, $result) { global $OUTPUT, $CFG; - $image = $OUTPUT->activity_icon('icon', $mod->modfullname, $mod->modname); + $image = $OUTPUT->image_icon('icon', $mod->modfullname, $mod->modname); echo ""; echo "$image"; diff --git a/report/progress/index.php b/report/progress/index.php index 8901e918846f2..c97d4a68228b8 100644 --- a/report/progress/index.php +++ b/report/progress/index.php @@ -326,7 +326,7 @@ function csv_quote($value) { '/view.php?id='.$activity->id.'" title="' . s($displayname) . '">'. '
    '.$shortenedname.'
    '. '
    '. - $OUTPUT->activity_icon('icon', get_string('modulename', $activity->modname), $activity->modname) . + $OUTPUT->image_icon('icon', get_string('modulename', $activity->modname), $activity->modname) . '
    '. ''; if ($activity->completionexpected) {