Commit 663640f5 authored by Damyon Wiese's avatar Damyon Wiese
Browse files

MDL-40759 icons: convert uses of pix_url to pix_icon

Also change filepicker to use scaled svgs instead of sets of custom pngs. The svgs are taken from font-awesome.
parent 7cf6ef7b
......@@ -168,10 +168,10 @@
$visible = '';
} else if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strhide.'">'.
'<img src="'.$OUTPUT->pix_url('t/hide') . '" class="iconsmall" alt="'.$strhide.'" /></a>';
$OUTPUT->pix_icon('t/hide', $strhide) . '</a>';
} else {
$visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strshow.'">'.
'<img src="'.$OUTPUT->pix_url('t/show') . '" class="iconsmall" alt="'.$strshow.'" /></a>';
$OUTPUT->pix_icon('t/show', $strshow) . '</a>';
$class = 'dimmed_text';
}
......@@ -186,10 +186,10 @@
$undeletable = '';
} else if (in_array($blockname, $undeletableblocktypes)) {
$undeletable = '<a href="blocks.php?unprotect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strunprotect.'">'.
'<img src="'.$OUTPUT->pix_url('t/unlock') . '" class="iconsmall" alt="'.$strunprotect.'" /></a>';
$OUTPUT->pix_icon('t/unlock', $strunprotect) . '</a>';
} else {
$undeletable = '<a href="blocks.php?protect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strprotect.'">'.
'<img src="'.$OUTPUT->pix_url('t/lock') . '" class="iconsmall" alt="'.$strprotect.'" /></a>';
$OUTPUT->pix_icon('t/lock', $strprotect) . '</a>';
}
$row = array(
......
......@@ -218,7 +218,7 @@ function get_table_row(\core\plugininfo\filter $plugininfo, $state, $isfirstrow,
// Re-order.
$updown = '';
$spacer = '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" />';
$spacer = $OUTPUT->spacer();
if ($state->active != TEXTFILTER_DISABLED) {
if (!$isfirstrow) {
$updown .= $OUTPUT->action_icon(filters_action_url($filter, 'up'), new pix_icon('t/up', get_string('up'), '', array('class' => 'iconsmall')));
......
......@@ -150,7 +150,7 @@ foreach ($columns as $column) {
} else {
$columndir = $dir == "ASC" ? "DESC" : "ASC";
$columnicon = $dir == "ASC" ? "down" : "up";
$columnicon = " <img src=\"" . $OUTPUT->pix_url('t/' . $columnicon) . "\" alt=\"\" />";
$columnicon = " " . $OUTPUT->pix_icon('t/' . $columnicon, get_string('sort'));
}
$headings[$column] = "<a href=\"?sort=$column&amp;dir=$columndir&amp;\">".$string[$column]."</a>$columnicon";
}
......
......@@ -94,7 +94,7 @@
$missing = true;
} else {
// took out hspace="\10\", because it does not validate. don't know what to replace with.
$icon = "<img src=\"" . $OUTPUT->pix_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";
$icon = "<img src=\"" . $OUTPUT->image_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";
$strmodulename = $icon.' '.get_string('modulename', $module->name);
$missing = false;
}
......@@ -130,11 +130,11 @@
$class = '';
} else if ($module->visible) {
$visible = "<a href=\"modules.php?hide=$module->name&amp;sesskey=".sesskey()."\" title=\"$strhide\">".
"<img src=\"" . $OUTPUT->pix_url('t/hide') . "\" class=\"iconsmall\" alt=\"$strhide\" /></a>";
$OUTPUT->pix_icon('t/hide', $strhide) . '</a>';
$class = '';
} else {
$visible = "<a href=\"modules.php?show=$module->name&amp;sesskey=".sesskey()."\" title=\"$strshow\">".
"<img src=\"" . $OUTPUT->pix_url('t/show') . "\" class=\"iconsmall\" alt=\"$strshow\" /></a>";
$OUTPUT->pix_icon('t/show', $strshow) . '</a>';
$class = 'dimmed_text';
}
if ($module->name == "forum") {
......
......@@ -1615,7 +1615,7 @@ class core_admin_renderer extends plugin_renderer_base {
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'icon pluginicon'));
} else {
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
$icon = $this->output->spacer('spacer');
}
$status = $plugin->get_status();
$row->attributes['class'] .= ' status-'.$status;
......
......@@ -370,14 +370,14 @@ if (($action == 'edit') || ($action == 'new')) {
if ($updowncount > 1) {
$updown .= "<a href=\"$sesskeyurl&amp;action=moveup&amp;repos=".$typename."\">";
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/up') . "\" alt=\"up\" /></a>&nbsp;";
$updown .= $OUTPUT->pix_icon('t/up', get_string('moveup')) . "</a>&nbsp;";
}
else {
$updown .= $spacer;
}
if ($updowncount < $totalrepositorytypes) {
$updown .= "<a href=\"$sesskeyurl&amp;action=movedown&amp;repos=".$typename."\">";
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/down') . "\" alt=\"down\" /></a>";
$updown .= $OUTPUT->pix_icon('t/down', get_string('movedown')) . "</a>&nbsp;";
}
else {
$updown .= $spacer;
......
......@@ -183,8 +183,7 @@ abstract class core_role_capability_table_with_risks extends core_role_capabilit
public function get_risk_icon($type) {
global $OUTPUT;
$iconurl = $OUTPUT->pix_url('i/' . str_replace('risk', 'risk_', $type));
$text = '<img src="' . $iconurl . '" alt="' . get_string($type . 'short', 'admin') . '" />';
$text = $OUTPUT->pix_icon('i/' . str_replace('risk', 'risk_', $type), get_string($type . 'short', 'admin'));
$action = new popup_action('click', $this->risksurl, 'docspopup');
$riskicon = $OUTPUT->action_link($this->risksurl, $text, $action, array('title'=>get_string($type, 'admin')));
......
......@@ -93,9 +93,10 @@ class core_role_permissions_table extends core_role_capability_table_base {
foreach ($roles as $id => $name) {
if (isset($needed[$id])) {
$templatecontext = array("rolename" => $name, "roleid" => $id, "action" => "prevent", "spanclass" => "allowed",
"linkclass" => "preventlink", "adminurl" => $adminurl->out(), "imageurl" => "");
"linkclass" => "preventlink", "adminurl" => $adminurl->out(), "icon" => "", "iconalt" => "");
if (isset($overridableroles[$id]) and ($allowoverrides or ($allowsafeoverrides and is_safe_capability($capability)))) {
$templatecontext['imageurl'] = $renderer->pix_url('t/delete');
$templatecontext['icon'] = 't/delete';
$templatecontext['iconalt'] = get_string('delete');
}
$neededroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
}
......@@ -105,9 +106,10 @@ class core_role_permissions_table extends core_role_capability_table_base {
if (isset($forbidden[$id]) and ($allowoverrides or ($allowsafeoverrides and is_safe_capability($capability)))) {
$templatecontext = array("rolename" => $name, "roleid" => $id, "action" => "unprohibit",
"spanclass" => "forbidden", "linkclass" => "unprohibitlink", "adminurl" => $adminurl->out(),
"imageurl" => "");
"icon" => "", "iconalt" => "");
if (isset($overridableroles[$id]) and prohibit_is_removable($id, $context, $capability->name)) {
$templatecontext['imageurl'] = $renderer->pix_url('t/delete');
$templatecontext['icon'] = 't/delete';
$templatecontext['iconalt'] = get_string('delete');
}
$forbiddenroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
}
......
......@@ -216,9 +216,9 @@ die;
function get_action_icon($url, $icon, $alt, $tooltip) {
global $OUTPUT;
return '<a title="' . $tooltip . '" href="'. $url . '">' .
'<img src="' . $OUTPUT->pix_url('t/' . $icon) . '" class="iconsmall" alt="' . $alt . '" /></a> ';
$OUTPUT->pix_icon('t/' . $icon, $alt) . '</a> ';
}
function get_spacer() {
global $OUTPUT;
return '<img src="' . $OUTPUT->pix_url('spacer') . '" class="iconsmall" alt="" /> ';
return $OUTPUT->spacer();
}
......@@ -193,10 +193,8 @@ function print_report_tree($contextid, $contexts, $systemcontext, $fullname, $al
$strgoto = get_string('gotoassignroles', 'core_role', $a);
$strcheck = get_string('checkuserspermissionshere', 'core_role', $a);
}
echo ' <a title="' . $strgoto . '" href="' . $raurl . '"><img class="iconsmall" src="' .
$OUTPUT->pix_url('t/edit') . '" alt="' . $stredit . '" /></a> ';
echo ' <a title="' . $strcheck . '" href="' . $churl . '"><img class="iconsmall" src="' .
$OUTPUT->pix_url('t/preview') . '" alt="' . $strcheckpermissions . '" /></a> ';
echo ' <a title="' . $strgoto . '" href="' . $raurl . '">' . $OUTPUT->pix_icon('t/edit', 'core', $stredit) . '</a> ';
echo ' <a title="' . $strcheck . '" href="' . $churl . '">' . $OUTPUT->pix_icon('t/preview', 'core', $strcheckpermissions) . '</a> ';
echo "</p>\n";
}
}
......
......@@ -103,18 +103,9 @@ foreach ($plugins as $plugin => $name) {
// Make enable control. This is a POST request (using a form control rather
// than just a link) because it makes a database change.
$enablecontrol = html_writer::tag('form', html_writer::div(
html_writer::empty_tag('input', array('type' => 'hidden',
'name' => 'sesskey', 'value' => sesskey())) .
html_writer::empty_tag('input', array('type' => 'hidden',
'name' => 'plugin', 'value' => $plugin)) .
html_writer::empty_tag('input', array('type' => 'hidden',
'name' => 'action', 'value' => $enabledaction)) .
html_writer::empty_tag('input', array('type' => 'image',
'src' => $OUTPUT->pix_url('t/' . $enabledaction), 'alt' => $enabledstr,
'title' => $enabledstr))
), array(
'method' => 'post', 'action' => './'));
$params = array('sesskey' => sesskey(), 'plugin' => $plugin, 'action' => $enabledaction);
$url = new moodle_url('/' . $CFG->admin . '/tool/availabilityconditions/', $params);
$enablecontrol = html_writer::link($url, $OUTPUT->pix_icon('t/' . $enabledaction, $enabledstr));
$table->add_data(array($namespan, $version, $enablecontrol));
}
......
......@@ -169,14 +169,14 @@ class tool_log_setting_managestores extends admin_setting {
if (isset($enabled[$store])) {
$aurl = new moodle_url($url, array('action' => 'disable', 'store' => $store));
$hideshow = "<a href=\"$aurl\">";
$hideshow .= "<img src=\"" . $OUTPUT->pix_url('t/hide') . "\" class=\"iconsmall\" alt=\"$strdisable\" /></a>";
$hideshow .= $OUTPUT->pix_icon('t/hide', $strdisable) . '</a>';
$isenabled = true;
$displayname = "<span>$name</span>";
} else {
if (isset($available[$store])) {
$aurl = new moodle_url($url, array('action' => 'enable', 'store' => $store));
$hideshow = "<a href=\"$aurl\">";
$hideshow .= "<img src=\"" . $OUTPUT->pix_url('t/show') . "\" class=\"iconsmall\" alt=\"$strenable\" /></a>";
$hideshow .= $OUTPUT->pix_icon('t/show', $strenable) . '</a>';
$isenabled = false;
$displayname = "<span class=\"dimmed_text\">$name</span>";
} else {
......@@ -188,7 +188,7 @@ class tool_log_setting_managestores extends admin_setting {
if ($PAGE->theme->resolve_image_location('icon', $store, false)) {
$icon = $OUTPUT->pix_icon('icon', '', $store, array('class' => 'icon pluginicon'));
} else {
$icon = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
$icon = $OUTPUT->spacer();
}
// Up/down link (only if store is enabled).
......@@ -197,16 +197,16 @@ class tool_log_setting_managestores extends admin_setting {
if ($updowncount > 1) {
$aurl = new moodle_url($url, array('action' => 'up', 'store' => $store));
$updown .= "<a href=\"$aurl\">";
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/up') . "\" alt=\"$strup\" class=\"iconsmall\" /></a>&nbsp;";
$updown .= $OUTPUT->pix_icon('t/up', $strup) . '</a>&nbsp;';
} else {
$updown .= "<img src=\"" . $OUTPUT->pix_url('spacer') . "\" class=\"iconsmall\" alt=\"\" />&nbsp;";
$updown .= $OUTPUT->spacer();
}
if ($updowncount < $storecount) {
$aurl = new moodle_url($url, array('action' => 'down', 'store' => $store));
$updown .= "<a href=\"$aurl\">";
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/down') . "\" alt=\"$strdown\" class=\"iconsmall\" /></a>";
$updown .= $OUTPUT->pix_icon('t/down', $strdown) . '</a>&nbsp;';
} else {
$updown .= "<img src=\"" . $OUTPUT->pix_url('spacer') . "\" class=\"iconsmall\" alt=\"\" />";
$updown .= $OUTPUT->spacer();
}
++$updowncount;
}
......
......@@ -55,7 +55,7 @@
<div class="mdl-left">
{{^notoggle}}
<a href="#" class="comment-link" id="comment-link-{{cid}}">
<img src="{{{collapsediconurl}}}" id="comment-img-{{cid}}" alt="{{linktext}}" title="{{linktext}}"><span id="comment-link-text-{{cid}}">{{linktext}}
{{#pix}}{{collapsediconkey}}, {{linktext}}{{/pix}}<span id="comment-link-text-{{cid}}">{{linktext}}
{{#displaytotalcount}}
({{count}})
{{/displaytotalcount}}</span>
......
......@@ -64,7 +64,7 @@
<li>{{#pix}}url, tool_lp{{/pix}} <a href="{{url}}" title="{{url}}">{{urlshort}}</a></li>
{{/url}}
{{#files}}
<li><img src="{{iconurl}}" alt=""> <a href="{{url}}" title="{{filename}}">{{filenameshort}}</a></li>
<li>{{#pix}}{{icon}}{{/pix}} <a href="{{url}}" title="{{filename}}">{{filenameshort}}</a></li>
{{/files}}
</ul>
{{/hasurlorfiles}}
......
......@@ -57,7 +57,7 @@
<li>{{#pix}}url, tool_lp{{/pix}} <a href="{{url}}" title="{{url}}">{{urlshort}}</a></li>
{{/url}}
{{#files}}
<li><img src="{{iconurl}}" alt=""> <a href="{{url}}">{{filename}}</a></li>
<li>{{#pix}}{{icon}}{{/pix}} <a href="{{url}}">{{filename}}</a></li>
{{/files}}
</ul>
</div>
......
......@@ -187,7 +187,7 @@ foreach ($items as $item) {
if (isset($modules[$item->module])) {
$mod = $modules[$item->module];
$modname = get_string('modulename', $mod->name);
$name = '<img src="' . $OUTPUT->pix_url('icon', $mod->name) . '" class="icon" alt="' . $modname . '" /> ' . $name;
$name = $OUTPUT->activity_icon('icon', $modname, $mod->name) . $name;
}
}
......
......@@ -102,9 +102,9 @@ if (!$problems) {
$count = $problem->racount;
$edit = array();
$aurl = new moodle_url('/admin/roles/define.php', array('roleid'=>$problem->roleid, 'action'=>'edit'));
$edit[] = html_writer::link($aurl, html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/edit'), 'alt'=>get_string('edit'), 'class'=>'smallicon')));
$edit[] = html_writer::link($aurl, $OUTPUT->pix_icon('t/edit', 'core', get_string('edit')));
$aurl = new moodle_url($PAGE->url, array('roleid'=>$problem->roleid, 'contextlevel'=>$problem->contextlevel, 'action'=>'delete'));
$edit[] = html_writer::link($aurl, html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/delete'), 'alt'=>get_string('delete'), 'class'=>'smallicon')));
$edit[] = html_writer::link($aurl, $OUTPUT->pix_icon('t/delete', 'core', get_string('delete')));
$data[] = array($levelname, $rolename, $count, implode('&nbsp;', $edit));
}
$table = new html_table();
......@@ -116,4 +116,4 @@ if (!$problems) {
echo html_writer::table($table);
}
echo $OUTPUT->footer();
\ No newline at end of file
echo $OUTPUT->footer();
......@@ -276,9 +276,7 @@ class manager {
$linkproperties = $config->linkproperties;
$linkproperties['href'] = $config->link;
$action .= \html_writer::start_tag('a', $linkproperties);
$action .= \html_writer::img(
$OUTPUT->pix_url($config->img, 'tool_usertours'),
$config->title);
$action .= $OUTPUT->pix_icon($config->img, $config->title, 'tool_usertours');
$action .= \html_writer::div($config->title);
$action .= \html_writer::end_tag('a');
$action .= \html_writer::end_tag('li');
......
......@@ -187,7 +187,7 @@
} else {
$columnicon = ($dir == "ASC") ? "sort_asc" : "sort_desc";
}
$columnicon = "<img class='iconsort' src=\"" . $OUTPUT->pix_url('t/' . $columnicon) . "\" alt=\"\" />";
$columnicon = $OUTPUT->pix_icon('t/' . $columnicon, '', 'core', ['class' => 'iconsort']);
}
$$column = "<a href=\"user.php?sort=$column&amp;dir=$columndir\">".$string[$column]."</a>$columnicon";
......@@ -298,7 +298,8 @@
if (is_mnet_remote_user($user) or $user->id == $USER->id or is_siteadmin($user)) {
// no deleting of self, mnet accounts or admins allowed
} else {
$buttons[] = html_writer::link(new moodle_url($returnurl, array('delete'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/delete'), 'alt'=>$strdelete, 'class'=>'iconsmall')), array('title'=>$strdelete));
$url = new moodle_url($returnurl, array('delete'=>$user->id, 'sesskey'=>sesskey()));
$buttons[] = html_writer::link($url, $OUTPUT->pix_icon('t/delete', $strdelete));
}
}
......@@ -315,17 +316,20 @@
} else {
if ($user->suspended) {
$buttons[] = html_writer::link(new moodle_url($returnurl, array('unsuspend'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/show'), 'alt'=>$strunsuspend, 'class'=>'iconsmall')), array('title'=>$strunsuspend));
$url = new moodle_url($returnurl, array('unsuspend'=>$user->id, 'sesskey'=>sesskey()));
$buttons[] = html_writer::link($url, $OUTPUT->pix_icon('t/show', $strunsuspend));
} else {
if ($user->id == $USER->id or is_siteadmin($user)) {
// no suspending of admins or self!
} else {
$buttons[] = html_writer::link(new moodle_url($returnurl, array('suspend'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/hide'), 'alt'=>$strsuspend, 'class'=>'iconsmall')), array('title'=>$strsuspend));
$url = new moodle_url($returnurl, array('suspend'=>$user->id, 'sesskey'=>sesskey()));
$buttons[] = html_writer::link($url, $OUTPUT->pix_icon('t/hide', $strsuspend));
}
}
if (login_is_lockedout($user)) {
$buttons[] = html_writer::link(new moodle_url($returnurl, array('unlock'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/unlock'), 'alt'=>$strunlock, 'class'=>'iconsmall')), array('title'=>$strunlock));
$url = new moodle_url($returnurl, array('unlock'=>$user->id, 'sesskey'=>sesskey()));
$buttons[] = html_writer::link($url, $OUTPUT->pix_icon('t/unlock', $strunlock));
}
}
}
......@@ -334,7 +338,8 @@
if (has_capability('moodle/user:update', $sitecontext)) {
// prevent editing of admins by non-admins
if (is_siteadmin($USER) or !is_siteadmin($user)) {
$buttons[] = html_writer::link(new moodle_url($securewwwroot.'/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id)), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/edit'), 'alt'=>$stredit, 'class'=>'iconsmall')), array('title'=>$stredit));
$url = new moodle_url($securewwwroot.'/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id));
$buttons[] = html_writer::link($url, $OUTPUT->pix_icon('t/edit', $stredit));
}
}
......
......@@ -113,7 +113,13 @@ foreach ($columns as $column) {
$columndir = 'asc';
} else {
$columndir = ($dir == 'asc') ? 'desc' : 'asc';
$columnicon = ' <img src="'.$OUTPUT->pix_url('t/'.($dir == 'asc' ? 'down' : 'up' )).'" alt="" />';
$icon = 't/down';
$iconstr = 'movedown';
if ($dir != 'asc') {
$icon = 't/up';
$iconstr = 'moveup';
}
$columnicon = ' ' . $OUTPUT->pix_icon($icon, get_string($iconstr));
}
$table->head[] = '<a href="user_bulk_cohortadd.php?sort='.$column.'&amp;dir='.$columndir.'">'.$strtitle.'</a>'.$columnicon;
$table->align[] = 'left';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment