Skip to content

Commit

Permalink
MDL-40759 icons: convert uses of pix_url to pix_icon
Browse files Browse the repository at this point in the history
Also change filepicker to use scaled svgs instead of sets of custom pngs. The svgs are taken from font-awesome.
  • Loading branch information
Damyon Wiese committed Mar 17, 2017
1 parent 7cf6ef7 commit 663640f
Show file tree
Hide file tree
Showing 612 changed files with 535 additions and 624 deletions.
8 changes: 4 additions & 4 deletions admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion admin/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')));
Expand Down
2 changes: 1 addition & 1 deletion admin/mnet/access_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
} 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";
}
Expand Down
6 changes: 3 additions & 3 deletions admin/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion admin/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ public function plugins_control_panel(core_plugin_manager $pluginman, array $opt
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;
Expand Down
4 changes: 2 additions & 2 deletions admin/repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ function repository_action_url($repository) {

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;
Expand Down
3 changes: 1 addition & 2 deletions admin/roles/classes/capability_table_with_risks.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ protected function add_row_cells($capability) {
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')));

Expand Down
10 changes: 6 additions & 4 deletions admin/roles/classes/permissions_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ protected function add_row_cells($capability) {
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);
}
Expand All @@ -105,9 +106,10 @@ protected function add_row_cells($capability) {
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);
}
Expand Down
4 changes: 2 additions & 2 deletions admin/roles/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@
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();
}
6 changes: 2 additions & 4 deletions admin/roles/usersroles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
Expand Down
15 changes: 3 additions & 12 deletions admin/tool/availabilityconditions/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,9 @@

// 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));
}
Expand Down
14 changes: 7 additions & 7 deletions admin/tool/log/classes/setting_managestores.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ public function output_html($data, $query = '') {
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 {
Expand All @@ -188,7 +188,7 @@ public function output_html($data, $query = '') {
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).
Expand All @@ -197,16 +197,16 @@ public function output_html($data, $query = '') {
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;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/templates/comment_area.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/templates/user_evidence_list_page.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/templates/user_evidence_page.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/recyclebin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
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;
}
}

Expand Down
6 changes: 3 additions & 3 deletions admin/tool/unsuproles/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@
$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();
Expand All @@ -116,4 +116,4 @@
echo html_writer::table($table);
}

echo $OUTPUT->footer();
echo $OUTPUT->footer();
4 changes: 1 addition & 3 deletions admin/tool/usertours/classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ protected function print_tour_list() {
$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');
Expand Down
Loading

0 comments on commit 663640f

Please sign in to comment.