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.
This commit is contained in:
@@ -187,7 +187,7 @@ foreach ($items as $item) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ abstract class backup_activity_task extends backup_task {
|
||||
// - 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
|
||||
|
||||
@@ -287,7 +287,7 @@ abstract class restore_activity_task extends restore_task {
|
||||
// - 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
|
||||
|
||||
@@ -171,7 +171,7 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
$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,
|
||||
|
||||
@@ -78,7 +78,7 @@ class block_activity_modules extends block_list {
|
||||
$icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon'));
|
||||
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/resources.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
|
||||
} else {
|
||||
$icon = $OUTPUT->activity_icon('icon', get_string('pluginname', $modname), $modname);
|
||||
$icon = $OUTPUT->image_icon('icon', get_string('pluginname', $modname), $modname);
|
||||
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class block_course_overview_renderer extends plugin_renderer_base {
|
||||
$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 {
|
||||
|
||||
@@ -53,7 +53,7 @@ class block_feedback extends block_list {
|
||||
$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;
|
||||
|
||||
+2
-2
@@ -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 = '<a href="'.$CFG->wwwroot.'/mod/'.$event->modulename.'/view.php?id='.$module->id.'">'.$event->name.'</a>';
|
||||
$event->courselink = calendar_get_courselink($module->course);
|
||||
|
||||
@@ -727,7 +727,7 @@ class pix_icon implements renderable, templatable {
|
||||
* @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 {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2029,10 +2029,10 @@ class core_renderer extends renderer_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 @@ class core_renderer extends renderer_base {
|
||||
* @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 @@ class core_renderer extends renderer_base {
|
||||
* @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);
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
+1
-1
@@ -2574,7 +2574,7 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid
|
||||
$class = 'activity '.$mod->modname;
|
||||
$class .= ($cmid == $mod->id) ? ' selected' : '';
|
||||
$menu[] = '<li class="'.$class.'">'.
|
||||
$OUTPUT->activity_icon('icon', '', $mod->modname).
|
||||
$OUTPUT->image_icon('icon', '', $mod->modname).
|
||||
'<a href="'.$CFG->wwwroot.'/mod/'.$url.'">'.$mod->name.'</a></li>';
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class assignfeedback_editpdf_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$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 @@ class assignfeedback_editpdf_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
$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')));
|
||||
|
||||
|
||||
+1
-1
@@ -1074,7 +1074,7 @@ function assign_print_recent_mod_activity($activity, $courseid, $detail, $modnam
|
||||
if ($detail) {
|
||||
$modname = $modnames[$activity->type];
|
||||
echo '<div class="title">';
|
||||
echo $OUTPUT->activity_icon('icon', $modname, 'assign');
|
||||
echo $OUTPUT->image_icon('icon', $modname, 'assign');
|
||||
echo '<a href="' . $CFG->wwwroot . '/mod/assign/view.php?id=' . $activity->cmid . '">';
|
||||
echo $activity->name;
|
||||
echo '</a>';
|
||||
|
||||
@@ -492,7 +492,7 @@ function feedback_print_recent_mod_activity($activity, $courseid, $detail, $modn
|
||||
if ($detail) {
|
||||
$modname = $modnames[$activity->type];
|
||||
echo '<div class="title">';
|
||||
echo $OUTPUT->activity_icon('icon', $modname, $activity->type);
|
||||
echo $OUTPUT->image_icon('icon', $modname, $activity->type);
|
||||
echo "<a href=\"$CFG->wwwroot/mod/feedback/view.php?id={$activity->cmid}\">{$activity->name}</a>";
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -765,11 +765,11 @@ class edit_renderer extends \plugin_renderer_base {
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -988,7 +988,7 @@ function quiz_print_recent_mod_activity($activity, $courseid, $detail, $modnames
|
||||
if ($detail) {
|
||||
$modname = $modnames[$activity->type];
|
||||
echo '<div class="title">';
|
||||
echo $OUTPUT->activity_icon('icon', $modname, $activity->type);
|
||||
echo $OUTPUT->image_icon('icon', $modname, $activity->type);
|
||||
echo '<a href="' . $CFG->wwwroot . '/mod/quiz/view.php?id=' .
|
||||
$activity->cmid . '">' . $activity->name . '</a>';
|
||||
echo '</div>';
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -69,7 +69,7 @@ class qtype_ddmarker_renderer extends qtype_ddtoimage_renderer_base {
|
||||
$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);
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once($CFG->dirroot.'/course/lib.php');
|
||||
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 "<tr>";
|
||||
echo "<td valign=\"top\">$image</td>";
|
||||
|
||||
@@ -326,7 +326,7 @@ foreach($activities as $activity) {
|
||||
'/view.php?id='.$activity->id.'" title="' . s($displayname) . '">'.
|
||||
'<div class="rotated-text-container"><span class="rotated-text">'.$shortenedname.'</span></div>'.
|
||||
'<div class="modicon">'.
|
||||
$OUTPUT->activity_icon('icon', get_string('modulename', $activity->modname), $activity->modname) .
|
||||
$OUTPUT->image_icon('icon', get_string('modulename', $activity->modname), $activity->modname) .
|
||||
'</div>'.
|
||||
'</a>';
|
||||
if ($activity->completionexpected) {
|
||||
|
||||
Reference in New Issue
Block a user