Skip to content

Commit

Permalink
MDL-19690 - lots more $CFG->pixpath to $OUTPUT->old_icon_url
Browse files Browse the repository at this point in the history
and $CFG->modpixpath to $OUTPUT->mod_icon_url
  • Loading branch information
tjhunt committed Jul 2, 2009
1 parent c8873c4 commit e63f88c
Show file tree
Hide file tree
Showing 29 changed files with 78 additions and 80 deletions.
2 changes: 1 addition & 1 deletion admin/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings)

// Re-order
$updown = '';
$spacer = '<img src="' . $CFG->pixpath . '/spacer.gif" class="iconsmall" alt="" /> ';
$spacer = '<img src="' . $OUTPUT->old_icon_url('spacer') . '" class="iconsmall" alt="" /> ';
if ($filterinfo->active != TEXTFILTER_DISABLED) {
if (!$isfirstrow) {
$updown .= action_icon(action_url($filter, 'up'), 'up', get_string('up'));
Expand Down
2 changes: 0 additions & 2 deletions admin/generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,6 @@ class generator_web extends generator {

public function setup() {
global $CFG;
$CFG->pixpath = $CFG->wwwroot. '/pix';
$this->mform = new generator_form();

$this->do_generation = optional_param('do_generation', false, PARAM_BOOL);
Expand Down Expand Up @@ -1249,7 +1248,6 @@ function get_data() {
class generator_form extends moodleform {
function definition() {
global $generator, $CFG;
$CFG->pixpath = $CFG->wwwroot. '/pix';

$mform =& $this->_form;
$mform->addElement('hidden', 'do_generation', 1);
Expand Down
2 changes: 1 addition & 1 deletion admin/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
foreach ($modulebyname as $modulename => $module) {

// took out hspace="\10\", because it does not validate. don't know what to replace with.
$icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" class=\"icon\" alt=\"\" />";
$icon = "<img src=\"" . $OUTPUT->mod_icon_url('icon', $module->name) . "\" class=\"icon\" alt=\"\" />";

$delete = "<a href=\"modules.php?delete=$module->name&amp;sesskey=".sesskey()."\">$strdelete</a>";

Expand Down
6 changes: 3 additions & 3 deletions admin/qtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
$rowclass = 'dimmed_text';
}
} else {
$icons = '<img src="' . $CFG->pixpath . '/spacer.gif" alt="" class="spacer" />';
$icons = '<img src="' . $OUTPUT->old_icon_url('spacer') . '" alt="" class="spacer" />';
}

// Move icons.
Expand Down Expand Up @@ -275,14 +275,14 @@ function enable_disable_button($qtypename, $createable) {
}

function icon_html($action, $qtypename, $icon, $alt, $tip) {
global $CFG;
global $OUTPUT;
if ($tip) {
$tip = 'title="' . $tip . '" ';
}
$html = ' <form action="' . admin_url('qtypes.php') . '" method="post"><div>';
$html .= '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
$html .= '<input type="image" name="' . $action . '" value="' . $qtypename .
'" src="' . $CFG->pixpath . '/' . $icon . '" alt="' . $alt . '" ' . $tip . '/>';
'" src="' . $OUTPUT->old_icon_url($icon) . '" alt="' . $alt . '" ' . $tip . '/>';
$html .= '</div></form>';
return $html;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/user/user_bulk_display.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function sort_compare($a, $b) {
$columndir = 'asc';
} else {
$columndir = $dir == 'asc' ? 'desc' : 'asc';
$columnicon = ' <img src="'.$CFG->pixpath.'/t/'.($dir == 'asc' ? 'down' : 'up' ).'.gif" alt="" />';
$columnicon = ' <img src="'.$OUTPUT->old_icon_url('t/'.($dir == 'asc' ? 'down' : 'up' )).'f" alt="" />';
}
$table->head[] = '<a href="user_bulk_display.php?sort='.$column.'&amp;dir='.$columndir.'">'.$strtitle.'</a>'.$columnicon;
$table->align[] = 'left';
Expand Down
2 changes: 1 addition & 1 deletion admin/user/user_bulk_enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function sort_compare($a, $b) {
$columndir = 'asc';
} else {
$columndir = ($dir == 'asc') ? 'desc' : 'asc';
$columnicon = ' <img src="'.$CFG->pixpath.'/t/'.($dir == 'asc' ? 'down' : 'up' ).'.gif" alt="" />';
$columnicon = ' <img src="'.$OUTPUT->old_icon_url('t/'.($dir == 'asc' ? 'down' : 'up' )).'" alt="" />';
}
$table->head[] = '<a href="user_bulk_enrol.php?sort='.$column.'&amp;dir='.$columndir.'">'.$strtitle.'</a>'.$columnicon;
$table->align[] = 'left';
Expand Down
4 changes: 2 additions & 2 deletions blocks/activity_modules/block_activity_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function init() {
}

function get_content() {
global $CFG, $DB;
global $CFG, $DB, $OUTPUT;

if($this->content !== NULL) {
return $this->content;
Expand Down Expand Up @@ -37,7 +37,7 @@ function get_content() {
foreach ($modfullnames as $modname => $modfullname) {
if ($modname != 'label') {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$modfullname.'</a>';
$this->content->icons[] = '<img src="'.$CFG->modpixpath.'/'.$modname.'/icon.gif" class="icon" alt="" />';
$this->content->icons[] = '<img src="'.$OUTPUT->mod_icon_url('icon', $modname) . '" class="icon" alt="" />';
}
}

Expand Down
12 changes: 6 additions & 6 deletions blocks/site_main_menu/block_site_main_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ function get_content() {
' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$instancename.'</a>';
//Accessibility: incidental image - should be empty Alt text
if (!empty($cm->icon)) {
$icon = $CFG->pixpath.'/'.$cm->icon;
$icon = $OUTPUT->old_icon_url($cm->icon);
} else {
$icon = $CFG->modpixpath.'/'.$cm->modname.'/icon.gif';
$icon = $OUTPUT->mod_icon_url('icon', $cm->modname);
}
$this->content->icons[] = '<img src="'.$icon.'" class="icon" alt="" />';
}
Expand Down Expand Up @@ -110,7 +110,7 @@ function get_content() {
continue;
}
$this->content->items[] = '<a title="'.$strmovefull.'" href="'.$CFG->wwwroot.'/course/mod.php?moveto='.$mod->id.'&amp;sesskey='.sesskey().'">'.
'<img style="height:16px; width:80px; border:0px" src="'.$CFG->pixpath.'/movehere.gif" alt="'.$strmovehere.'" /></a>';
'<img style="height:16px; width:80px; border:0px" src="'.$OUTPUT->old_icon_url('movehere') . '" alt="'.$strmovehere.'" /></a>';
$this->content->icons[] = '';
}
$instancename = $modinfo->cms[$modnumber]->name;
Expand All @@ -122,9 +122,9 @@ function get_content() {
$extra = '';
}
if (!empty($modinfo->cms[$modnumber]->icon)) {
$icon = $CFG->pixpath.'/'.$modinfo->cms[$modnumber]->icon;
$icon = $OUTPUT->old_icon_url($modinfo->cms[$modnumber]->icon);
} else {
$icon = $CFG->modpixpath.'/'.$mod->modname.'/icon.gif';
$icon = $OUTPUT->mod_icon_url('icon', $mod->modname);
}

if ($mod->modname == 'label') {
Expand All @@ -142,7 +142,7 @@ function get_content() {

if ($ismoving) {
$this->content->items[] = '<a title="'.$strmovefull.'" href="'.$CFG->wwwroot.'/course/mod.php?movetosection='.$section->id.'&amp;sesskey='.sesskey().'">'.
'<img style="height:16px; width:80px; border:0px" src="'.$CFG->pixpath.'/movehere.gif" alt="'.$strmovehere.'" /></a>';
'<img style="height:16px; width:80px; border:0px" src="'.$OUTPUT->old_icon_url('movehere') . '" alt="'.$strmovehere.'" /></a>';
$this->content->icons[] = '';
}

Expand Down
12 changes: 6 additions & 6 deletions blocks/social_activities/block_social_activities.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ function get_content() {
' href="'.$CFG->wwwroot.'/mod/'.$cm->modname.'/view.php?id='.$cm->id.'">'.$instancename.'</a>';
//Accessibility: incidental image - should be empty Alt text
if (!empty($cm->icon)) {
$icon = $CFG->pixpath.'/'.$cm->icon;
$icon = $OUTPUT->old_icon_url($cm->icon);
} else {
$icon = $CFG->modpixpath.'/'.$cm->modname.'/icon.gif';
$icon = $OUTPUT->mod_icon_url('icon', $cm->modname);
}
$this->content->icons[] = '<img src="'.$icon.'" class="icon" alt="" />';
}
Expand Down Expand Up @@ -119,7 +119,7 @@ function get_content() {
continue;
}
$this->content->items[] = '<a title="'.$strmovefull.'" href="'.$CFG->wwwroot.'/course/mod.php?moveto='.$mod->id.'&amp;sesskey='.sesskey().'">'.
'<img style="height:16px; width:80px; border:0px" src="'.$CFG->pixpath.'/movehere.gif" alt="'.$strmovehere.'" /></a>';
'<img style="height:16px; width:80px; border:0px" src="'.$OUTPUT->old_icon_url('movehere') . '" alt="'.$strmovehere.'" /></a>';
$this->content->icons[] = '';
}
$instancename = $modinfo->cms[$modnumber]->name;
Expand All @@ -131,9 +131,9 @@ function get_content() {
$extra = '';
}
if (!empty($modinfo->cms[$modnumber]->icon)) {
$icon = $CFG->pixpath.'/'.$modinfo->cms[$modnumber]->icon;
$icon = $OUTPUT->old_icon_url($modinfo->cms[$modnumber]->icon);
} else {
$icon = $CFG->modpixpath.'/'.$mod->modname.'/icon.gif';
$icon = $OUTPUT->mod_icon_url('icon', $mod->modname);
}

if ($mod->modname == 'label') {
Expand All @@ -151,7 +151,7 @@ function get_content() {

if ($ismoving) {
$this->content->items[] = '<a title="'.$strmovefull.'" href="'.$CFG->wwwroot.'/course/mod.php?movetosection='.$section->id.'&amp;sesskey='.sesskey().'">'.
'<img style="height:16px; width:80px; border:0px" src="'.$CFG->pixpath.'/movehere.gif" alt="'.$strmovehere.'" /></a>';
'<img style="height:16px; width:80px; border:0px" src="'.$OUTPUT->old_icon_url('movehere') . '" alt="'.$strmovehere.'" /></a>';
$this->content->icons[] = '';
}

Expand Down
4 changes: 2 additions & 2 deletions calendar/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
}
$event = $events[$eventid];
if(!empty($event->modulename)) {
$popupicon = $CFG->modpixpath.'/'.$event->modulename.'/icon.gif';
$popupicon = $OUTPUT->mod_icon_url('icon', $event->modulename) . '';
$popupalt = $event->modulename;

} else if ($event->courseid == SITEID) { // Site event
Expand Down Expand Up @@ -484,7 +484,7 @@ function calendar_add_event_metadata($event) {

$modulename = get_string('modulename', $event->modulename);
$eventtype = get_string($event->eventtype, $event->modulename);
$icon = $CFG->modpixpath.'/'.$event->modulename.'/icon.gif';
$icon = $OUTPUT->mod_icon_url('icon', $event->modulename) . '';

$event->icon = '<img height="16" width="16" src="'.$icon.'" alt="'.$eventtype.'" title="'.$modulename.'" style="vertical-align: middle;" />';
$event->referer = '<a href="'.$CFG->wwwroot.'/mod/'.$event->modulename.'/view.php?id='.$module->id.'">'.$event->name.'</a>';
Expand Down
14 changes: 7 additions & 7 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ function set_section_visible($courseid, $sectionnumber, $visibility) {
* Prints a section full of activity modules
*/
function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%", $hidecompletion=false) {
global $CFG, $USER, $DB, $PAGE;
global $CFG, $USER, $DB, $PAGE, $OUTPUT;

static $initialised;

Expand Down Expand Up @@ -1296,7 +1296,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
if ($ismoving) {
echo '<a title="'.$strmovefull.'"'.
' href="'.$CFG->wwwroot.'/course/mod.php?moveto='.$mod->id.'&amp;sesskey='.sesskey().'">'.
'<img class="movetarget" src="'.$CFG->pixpath.'/movehere.gif" '.
'<img class="movetarget" src="'.$OUTPUT->old_icon_url('movehere') . '" '.
' alt="'.$strmovehere.'" /></a><br />
';
}
Expand Down Expand Up @@ -1337,7 +1337,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$icon = "$CFG->pixpath/".$customicon;
}
} else {
$icon = "$CFG->modpixpath/$mod->modname/icon.gif";
$icon = "" . $OUTPUT->mod_icon_url('icon', $mod->modname) . "";
}

//Accessibility: for files get description via icon.
Expand Down Expand Up @@ -1518,7 +1518,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
if ($ismoving) {
echo '<li><a title="'.$strmovefull.'"'.
' href="'.$CFG->wwwroot.'/course/mod.php?movetosection='.$section->id.'&amp;sesskey='.sesskey().'">'.
'<img class="movetarget" src="'.$CFG->pixpath.'/movehere.gif" '.
'<img class="movetarget" src="'.$OUTPUT->old_icon_url('movehere') . '" '.
' alt="'.$strmovehere.'" /></a></li>
';
}
Expand Down Expand Up @@ -1925,20 +1925,20 @@ function print_category_info($category, $depth, $showcourses = false) {
echo '<a title="'.$strallowguests.'" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">';
echo '<img alt="'.$strallowguests.'" src="'.$OUTPUT->old_icon_url('i/guest') . '" /></a>';
} else {
echo '<img alt="" style="width:18px;height:16px;" src="'.$CFG->pixpath.'/spacer.gif" />';
echo '<img alt="" style="width:18px;height:16px;" src="'.$OUTPUT->old_icon_url('spacer') . '" />';
}
if ($course->password) {
echo '<a title="'.$strrequireskey.'" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">';
echo '<img alt="'.$strrequireskey.'" src="'.$OUTPUT->old_icon_url('i/key') . '" /></a>';
} else {
echo '<img alt="" style="width:18px;height:16px;" src="'.$CFG->pixpath.'/spacer.gif" />';
echo '<img alt="" style="width:18px;height:16px;" src="'.$OUTPUT->old_icon_url('spacer') . '" />';
}
if ($course->summary) {
link_to_popup_window ('/course/info.php?id='.$course->id, 'courseinfo',
'<img alt="'.$strsummary.'" src="'.$OUTPUT->old_icon_url('i/info') . '" />',
400, 500, $strsummary);
} else {
echo '<img alt="" style="width:18px;height:16px;" src="'.$CFG->pixpath.'/spacer.gif" />';
echo '<img alt="" style="width:18px;height:16px;" src="'.$OUTPUT->old_icon_url('spacer') . '" />';
}
echo '</td></tr>';
}
Expand Down
2 changes: 1 addition & 1 deletion course/modedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
$currenttab = 'update';
require($CFG->dirroot.'/'.$CFG->admin.'/roles/tabs.php');
}
$icon = '<img src="'.$CFG->modpixpath.'/'.$module->name.'/icon.gif" alt=""/>';
$icon = '<img src="'.$OUTPUT->mod_icon_url('icon', $module->name) . '" alt=""/>';

print_heading_with_help($pageheading, 'mods', $module->name, $icon);
$mform->display();
Expand Down
2 changes: 1 addition & 1 deletion course/recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
$name = format_string($cm->name);
$modfullname = $modnames[$cm->modname];

$image = "<img src=\"$CFG->modpixpath/$cm->modname/icon.gif\" class=\"icon\" alt=\"$modfullname\" />";
$image = "<img src=\"" . $OUTPUT->mod_icon_url('icon', $cm->modname) . "\" class=\"icon\" alt=\"$modfullname\" />";
echo "<h4>$image $modfullname".
" <a href=\"$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id\" $linkformat>$name</a></h4>";
}
Expand Down
2 changes: 1 addition & 1 deletion course/report/outline/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
$dimmed = $cm->visible ? '' : 'class="dimmed"';
$modulename = get_string('modulename', $cm->modname);
echo '<tr class="r'.$ri++.'">';
echo "<td class=\"cell c0 actvity\"><img src=\"$CFG->modpixpath/$cm->modname/icon.gif\" class=\"icon\" alt=\"$modulename\" />";
echo "<td class=\"cell c0 actvity\"><img src=\"" . $OUTPUT->mod_icon_url('icon', $cm->modname) . "\" class=\"icon\" alt=\"$modulename\" />";
echo "<a $dimmed title=\"$modulename\" href=\"$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id\">".format_string($cm->name)."</a></td>";
echo "<td class=\"cell c1 numviews\">";
if (!empty($views[$cm->id]->numviews)) {
Expand Down
4 changes: 2 additions & 2 deletions course/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@


function print_outline_row($mod, $instance, $result) {
global $CFG;
global $OUTPUT;

$image = "<img src=\"$CFG->modpixpath/$mod->modname/icon.gif\" class=\"icon\" alt=\"$mod->modfullname\" />";
$image = "<img src=\"" . $OUTPUT->mod_icon_url('icon', $mod->modname) . "\" class=\"icon\" alt=\"$mod->modfullname\" />";

echo "<tr>";
echo "<td valign=\"top\">$image</td>";
Expand Down
4 changes: 2 additions & 2 deletions grade/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1268,8 +1268,8 @@ public function get_element_icon(&$element, $spacerifnone=false) {

} else if ($element['object']->itemtype == 'mod') {
$strmodname = get_string('modulename', $element['object']->itemmodule);
return '<img src="'.$CFG->modpixpath.'/'.
$element['object']->itemmodule.'/icon.gif" ' .
return '<img src="'.$OUTPUT->mod_icon_url('icon',
$element['object']->itemmodule) . '" ' .
'class="icon itemicon" title="' .s($strmodname).
'" alt="' .s($strmodname).'"/>';

Expand Down
4 changes: 2 additions & 2 deletions grade/report/grader/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public function get_toggles_html() {
* @return void
*/
public function print_toggle($type, $return=false) {
global $CFG;
global $CFG, $OUTPUT;

$icons = array('eyecons' => 't/hide.gif',
'calculations' => 't/calc.gif',
Expand Down Expand Up @@ -510,7 +510,7 @@ public function print_toggle($type, $return=false) {

$string = ${'str' . $show_hide};

$img = '<img src="'.$CFG->pixpath.'/'.$image_name.'" class="iconsmall" alt="'
$img = '<img src="'.$OUTPUT->old_icon_url($image_name).'" class="iconsmall" alt="'
.$string.'" title="'.$string.'" />'. "\n";

$retval = '<div class="gradertoggle">' . $img . '<a href="' . $this->baseurl . "&amp;toggle=$toggle_action&amp;toggle_type=$type\">"
Expand Down
4 changes: 2 additions & 2 deletions lib/form/modgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function MoodleQuickForm_modgrade($elementName=null, $elementLabel=null, $attrib
*/
function onQuickFormEvent($event, $arg, &$caller)
{
global $COURSE, $CFG;
global $COURSE, $CFG, $OUTPUT;
switch ($event) {
case 'createElement':
// Need to call superclass first because we want the constructor
Expand All @@ -62,7 +62,7 @@ function onQuickFormEvent($event, $arg, &$caller)
$grades[$i] = $i;
}
$this->load($grades);
$linkobject = '<span class="helplink"><img height="17" width="17" alt="'.$strscales.'" src="'.$CFG->pixpath .'/help.gif" /></span>';
$linkobject = '<span class="helplink"><img height="17" width="17" alt="'.$strscales.'" src="'.$OUTPUT->old_icon_url('help') . '" /></span>';
$this->setHelpButton(array('/course/scales.php?id='. $COURSE->id .'&amp;list=true', 'ratingscales',
$linkobject, 400, 500, $strscales, 'none', true), 'link_to_popup_window');
return $result;
Expand Down
Loading

0 comments on commit e63f88c

Please sign in to comment.