MDL-19690 - the last lot of $CFG->pixpath to $OUTPUT->old_icon_url
authortjhunt <tjhunt>
Fri, 3 Jul 2009 07:55:30 +0000 (07:55 +0000)
committertjhunt <tjhunt>
Fri, 3 Jul 2009 07:55:30 +0000 (07:55 +0000)
Including MDL-19693

RIP $CFG->pixpath

20 files changed:
lib/outputlib.php
lib/pagelib.php
mod/assignment/lib.php
mod/assignment/type/upload/assignment.class.php
mod/assignment/type/uploadsingle/assignment.class.php
mod/data/field/file/field.class.php
mod/forum/lib.php
mod/forum/rate_ajax.js
mod/glossary/lib.php
mod/quiz/locallib.php
mod/quiz/styles.php
mod/resource/type/directory/resource.class.php
mod/scorm/datamodels/aicclib.php
mod/scorm/datamodels/scorm_12lib.php
mod/scorm/datamodels/scorm_13lib.php
mod/scorm/datamodels/scorm_datamodels.js
mod/scorm/lib.php
mod/scorm/loadSCO.php
mod/scorm/report.php
mod/wiki/ewiki/plugins/moodle/downloads.php

index a9a2e37..d44f374 100644 (file)
@@ -479,9 +479,10 @@ class theme_config {
 
     /**
      * Set the variable $CFG->pixpath and $CFG->modpixpath to be the right
-     * ones for this theme.
+     * ones for this theme. These should no longer be used, but legacy code
+     * might still rely on them.
      */
-    public function setup_cfg_paths() {
+    public function setup_legacy_pix_paths() {
         global $CFG;
         if (!empty($CFG->smartpix)) {
             if ($CFG->slasharguments) {
index 1dab12f..a57ae0f 100644 (file)
@@ -818,7 +818,7 @@ class moodle_page {
         if ($this === $PAGE) {
             $THEME = $this->_theme;
             // Support legacy code.
-            $this->_theme->setup_cfg_paths();
+            $this->_theme->setup_legacy_pix_paths();
         }
     }
 
@@ -912,7 +912,7 @@ class moodle_page {
             $THEME = $this->_theme;
             $OUTPUT = $this->_theme->get_renderer('core', $this);
             // Support legacy code.
-            $this->_theme->setup_cfg_paths();
+            $this->_theme->setup_legacy_pix_paths();
         }
 
         $this->_wherethemewasinitialised = debug_backtrace();
index 4210bd3..3af7cfe 100644 (file)
@@ -1757,7 +1757,7 @@ class assignment_base {
      * @return string optional
      */
     function print_user_files($userid=0, $return=false) {
-        global $CFG, $USER;
+        global $CFG, $USER, $OUTPUT;
 
         if (!$userid) {
             if (!isloggedin()) {
@@ -1779,9 +1779,9 @@ class assignment_base {
                 $filename = $file->get_filename();
                 $found = true;
                 $mimetype = $file->get_mimetype();
-                $icon = mimeinfo_from_type('icon', $mimetype);
+                $icon = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
                 $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/assignment_submission/'.$userid.'/'.$filename);
-                $output .= '<a href="'.$path.'" ><img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />'.s($filename).'</a>';
+                $output .= '<a href="'.$path.'" ><img src="'.$OUTPUT->old_icon_url('f/'.$icon).'" class="icon" alt="'.$icon.'" />'.s($filename).'</a>';
                 if ($this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
                     $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id, 'fileid' => $file->get_id()));
                     $button->set_formats(portfolio_format_from_file($file));
index 57357f9..89847e5 100644 (file)
@@ -261,7 +261,7 @@ class assignment_upload extends assignment_base {
 
 
     function print_student_answer($userid, $return=false){
-        global $CFG;
+        global $CFG, $OUTPUT;
 
         $submission = $this->get_submission($userid);
 
@@ -286,9 +286,9 @@ class assignment_upload extends assignment_base {
                 $filename = $file->get_filename();
                 $found = true;
                 $mimetype = $file->get_mimetype();
-                $icon = mimeinfo_from_type('icon', $mimetype);
+                $icon = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
                 $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/assignment_submission/'.$userid.'/'.$filename);
-                $output .= '<a href="'.$path.'" ><img class="icon" src="'.$CFG->pixpath.'/f/'.$icon.'" alt="'.$icon.'" />'.s($filename).'</a>&nbsp;';
+                $output .= '<a href="'.$path.'" ><img class="icon" src="'.$OUTPUT->old_icon_url('f/'.$icon).'" alt="'.$icon.'" />'.s($filename).'</a>&nbsp;';
 
             }
 
@@ -346,9 +346,9 @@ class assignment_upload extends assignment_base {
             foreach ($files as $file) {
                 $filename = $file->get_filename();
                 $mimetype = $file->get_mimetype();
-                $icon = mimeinfo_from_type('icon', $mimetype);
+                $icon = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
                 $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/assignment_submission/'.$userid.'/'.$filename);
-                $output .= '<a href="'.$path.'" ><img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />'.s($filename).'</a>';
+                $output .= '<a href="'.$path.'" ><img src="'.$OUTPUT->old_icon_url('f/'.$icon).'" class="icon" alt="'.$icon.'" />'.s($filename).'</a>';
 
                 if ($candelete) {
                     $delurl  = "$CFG->wwwroot/mod/assignment/delete.php?id={$this->cm->id}&amp;file=".rawurlencode($filename)."&amp;userid={$submission->userid}&amp;mode=$mode&amp;offset=$offset";
@@ -408,10 +408,10 @@ class assignment_upload extends assignment_base {
                 $filename = $file->get_filename();
                 $found = true;
                 $mimetype = $file->get_mimetype();
-                $icon = mimeinfo_from_type('icon', $mimetype);
+                $icon = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
                 $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/assignment_response/'.$userid.'/'.$filename);
 
-                $output .= '<a href="'.$path.'" ><img src="'.$CFG->pixpath.'/f/'.$icon.'" alt="'.$icon.'" />'.$filename.'</a>';
+                $output .= '<a href="'.$path.'" ><img src="'.$OUTPUT->old_icon_url('f/'.$icon).'" alt="'.$icon.'" />'.$filename.'</a>';
 
                 if ($candelete) {
                     $delurl  = "$CFG->wwwroot/mod/assignment/delete.php?id={$this->cm->id}&amp;file=".rawurlencode($filename)."&amp;userid=$userid&amp;mode=$mode&amp;offset=$offset&amp;action=response";
index 70b8669..116db58 100644 (file)
@@ -8,7 +8,7 @@ class assignment_uploadsingle extends assignment_base {
 
 
     function print_student_answer($userid, $return=false){
-        global $CFG, $USER;
+        global $CFG, $USER, $OUTPUT;
 
         $fs = get_file_storage();
         $browser = get_file_browser();
@@ -21,9 +21,9 @@ class assignment_uploadsingle extends assignment_base {
                 $filename = $file->get_filename();
                 $found = true;
                 $mimetype = $file->get_mimetype();
-                $icon = mimeinfo_from_type('icon', $mimetype);
+                $icon = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
                 $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/assignment_submission/'.$userid.'/'.$filename);
-                $output .= '<a href="'.$path.'" ><img class="icon" src="'.$CFG->pixpath.'/f/'.$icon.'" alt="'.$icon.'" />'.s($filename).'</a><br />';
+                $output .= '<a href="'.$path.'" ><img class="icon" src="'.$OUTPUT->old_icon_url('f/'.$icon).'" alt="'.$icon.'" />'.s($filename).'</a><br />';
             }
         }
 
index 261753f..34d0af3 100755 (executable)
@@ -26,7 +26,7 @@ class data_field_file extends data_field_base {
     var $type = 'file';
 
     function display_add_field($recordid=0) {
-        global $CFG, $DB;
+        global $CFG, $DB, $OUTPUT;
 
         $file        = false;
         $content     = false;
@@ -59,9 +59,9 @@ class data_field_file extends data_field_base {
         if ($file) {
             // Print icon if file already exists
             $browser = get_file_browser();
-            $icon    = mimeinfo_from_type('icon', $file->get_mimetype());
+            $icon    = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $file->get_mimetype()));
             $src     = file_encode_url($CFG->wwwroot.'/pluginfile.php', $this->context->id.'/data_content/'.$content->id.'/'.$file->get_filename());
-            $str .= '<img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />'.
+            $str .= '<img src="'.$OUTPUT->old_icon_url('f/'.$icon).'" class="icon" alt="'.$icon.'" />'.
                     '<a href="'.$src.'" >'.s($file->get_filename()).'</a>';
         }
         return $str;
@@ -118,12 +118,12 @@ class data_field_file extends data_field_base {
         }
 
         $name   = empty($content->content1) ? $file->get_filename() : $content->content1;
-        $icon   = mimeinfo_from_type('icon', $file->get_mimetype());
+        $icon   = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $file->get_mimetype()));
         $src    = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/data_content/'.$content->id.'/'.$file->get_filename());
         $width  = $this->field->param1 ? ' width  = "'.s($this->field->param1).'" ':' ';
         $height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
 
-        $str = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
+        $str = '<img src="'.$OUTPUT->old_icon_url('f/'.$icon).'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
                '<a href="'.$src.'" >'.s($name).'</a>';
         return $str;
     }
index c719ac4..0849867 100644 (file)
@@ -4268,7 +4268,7 @@ function forum_move_attachments($discussion, $forumfrom, $forumto) {
  * @return mixed string or array of (html text withouth images and image HTML)
  */
 function forum_print_attachments($post, $cm, $type) {
-    global $CFG, $DB, $USER;
+    global $CFG, $DB, $USER, $OUTPUT;
 
     if (empty($post->attachment)) {
         return $type !== 'separateimages' ? '' : array('', '');
@@ -4296,8 +4296,8 @@ function forum_print_attachments($post, $cm, $type) {
         foreach ($files as $file) {
             $filename = $file->get_filename();
             $mimetype = $file->get_mimetype();
-            $icon = mimeinfo_from_type('icon', $mimetype);
-            $iconimage = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />';
+            $icon = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
+            $iconimage = '<img src="'.$OUTPUT->old_icon_url('f/'.$icon).'" class="icon" alt="'.$icon.'" />';
             $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$context->id.'/forum_attachment/'.$post->id.'/'.$filename);
 
             if ($type == 'html') {
@@ -5685,7 +5685,7 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions=-1, $di
  */
 function forum_print_discussion($course, $cm, $forum, $discussion, $post, $mode, $canreply=NULL, $canrate=false) {
 
-    global $USER, $CFG, $DB, $PAGE;
+    global $USER, $CFG, $DB, $PAGE, $OUTPUT;
 
     if (!empty($USER->id)) {
         $ownpost = ($USER->id == $post->userid);
@@ -5806,7 +5806,7 @@ function forum_print_discussion($course, $cm, $forum, $discussion, $post, $mode,
             echo '<div class="ratingsubmit">';
             echo '<input type="submit" id="forumpostratingsubmit" value="'.get_string('sendinratings', 'forum').'" />';
             if (ajaxenabled() && !empty($CFG->forum_ajaxrating)) { /// AJAX enabled, standard submission form
-                $PAGE->requires->js_function_call('init_rate_ajax');
+                $PAGE->requires->js_function_call('add_menu_listeners', array($OUTPUT->old_icon_url('i/loading_small')))->on_dom_ready();
             }
             if ($forum->scale < 0) {
                 if ($scale = $DB->get_record("scale", array("id" => abs($forum->scale)))) {
@@ -5815,7 +5815,6 @@ function forum_print_discussion($course, $cm, $forum, $discussion, $post, $mode,
             }
             echo '</div>';
         }
-
         echo '</div>';
         echo '</form>';
     }
index 534067a..d252aa5 100644 (file)
 
 /// Javascript used to handle AJAX forum ratings
 
-/**
- * This function initializes all the stuff needed to have forum ratings
- * working under AJAX. Basically it adds one onload listener that triggers
- * the add_menu_listeners() function to add menu listeners
- */
-function init_rate_ajax () {
-    YAHOO.util.Event.onDOMReady(add_menu_listeners);
-}
-
+var smallloadingicon;
 /**
  * This function adds event listeners to any rating
  * menu found in he page (class = forumpostratingmenu)
  * and prevents manual submission
  */
-function add_menu_listeners(e) {
+function add_menu_listeners(loadingicon) {
+    smallloadingicon = loadingicon;
 
     /** hide the submit button */
     var submitbutton = YAHOO.util.Dom.get('forumpostratingsubmit');
@@ -88,7 +81,7 @@ function perform_rate(e, menu) {
 
     /** Start animation **/
     var animatedElement   = YAHOO.util.Dom.getAncestorByTagName(menu, 'div');
-    animatedElement.style.background = "url('" + moodle_cfg.pixpath + "/i/loading_small.gif') no-repeat top right";
+    animatedElement.style.background = "url('" + smallloadingicon + "') no-repeat top right";
 
 }
 
index 383ff29..e626c37 100644 (file)
@@ -1228,7 +1228,7 @@ function glossary_search_entries($searchterms, $glossary, $extended) {
  * @return string image string or nothing depending on $type param
  */
 function glossary_print_attachments($entry, $cm, $type=NULL, $align="left") {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) {
         return '';
@@ -1256,8 +1256,8 @@ function glossary_print_attachments($entry, $cm, $type=NULL, $align="left") {
         foreach ($files as $file) {
             $filename = $file->get_filename();
             $mimetype = $file->get_mimetype();
-            $icon = mimeinfo_from_type('icon', $mimetype);
-            $iconimage = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />';
+            $icon = str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
+            $iconimage = '<img src="'.$OUTPUT->old_icon_url('f/'.$icon).'" class="icon" alt="'.$icon.'" />';
             $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$context->id.'/glossary_attachment/'.$entry->id.'/'.$filename);
 
             if ($type == 'html') {
index 25fcb37..d5f7c5b 100644 (file)
@@ -795,7 +795,7 @@ function quiz_question_action_icons($quiz, $cmid, $question, $returnurl) {
  * @return the HTML for an edit icon, view icon, or nothing for a question (depending on permissions).
  */
 function quiz_question_edit_button($cmid, $question, $returnurl, $contentbeforeicon = '') {
-    global $CFG;
+    global $CFG, $OUTPUT;
 
     // Minor efficiency saving. Only get strings once, even if there are a lot of icons on one page.
     static $stredit = null;
@@ -821,7 +821,7 @@ function quiz_question_edit_button($cmid, $question, $returnurl, $contentbeforei
         $questionparams = array('returnurl' => $returnurl, 'cmid' => $cmid, 'id' => $question->id);
         $questionurl = new moodle_url("$CFG->wwwroot/question/question.php", $questionparams);
         return '<a title="' . $action . '" href="' . $questionurl->out() . '">' . $contentbeforeicon .
-                '<img src="' . $CFG->pixpath . $icon . '.gif" alt="' . $action . '" /></a>';
+                '<img src="' . $OUTPUT->old_icon_url($icon) . '.gif" alt="' . $action . '" /></a>';
     } else {
         return $contentbeforeicon;
     }
index 2fde483..f3acc20 100644 (file)
@@ -1,3 +1,3 @@
 #quiznavigation .qnbutton.flagged {
-  background-image: url(<?php echo $CFG->pixpath ?>/i/ne_red_mark.png);
+  background-image: url('<?php echo $OUTPUT->old_icon_url('i/ne_red_mark') ?>');
 }
index 3a3657c..353cd50 100644 (file)
@@ -25,7 +25,7 @@ function _postprocess(&$resource) {
 }
 
 function display() {
-    global $CFG;
+    global $CFG, $OUTPUT;
 
 /// Set up generic stuff first, including checking for access
     parent::display();
@@ -116,25 +116,25 @@ function display() {
          "</tr>";
     foreach ($files as $file) {
         if (is_dir("$CFG->dataroot/$relativepath/$file")) {          // Must be a directory
-            $icon = "folder.gif";
+            $icon = 'folder';
             $relativeurl = "/view.php?blah";
             $filesize = display_size(get_directory_size("$CFG->dataroot/$relativepath/$file"));
 
         } else {
-            $icon = mimeinfo("icon", $file);
+            $icon = str_replace(array('.gif', '.png'), '', mimeinfo("icon", $file));
             $relativeurl = get_file_url("$relativepath/$file");
             $filesize = display_size(filesize("$CFG->dataroot/$relativepath/$file"));
         }
 
-        if ($icon == 'folder.gif') {
+        if ($icon == 'folder') {
             echo '<tr class="folder">';
             echo '<td class="name">';
             echo "<a href=\"view.php?id={$cm->id}&amp;subdir=$subdir/$file\">";
-            echo "<img src=\"$CFG->pixpath/f/$icon\" class=\"icon\" alt=\"$strfolder\" />&nbsp;$file</a>";
+            echo "<img src=\"" . $OUTPUT->old_icon_url('f/' . $icon) . "\" class=\"icon\" alt=\"$strfolder\" />&nbsp;$file</a>";
         } else {
             echo '<tr class="file">';
             echo '<td class="name">';
-            link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "<img src=\"$CFG->pixpath/f/$icon\" class=\"icon\" alt=\"$strfile\" />&nbsp;$file", 450, 600, '');
+            link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "<img src=\"" . $OUTPUT->old_icon_url('f/' . $icon) . "\" class=\"icon\" alt=\"$strfile\" />&nbsp;$file", 450, 600, '');
         }
         echo '</td>';
         echo '<td>&nbsp;</td>';
index 9426c3f..804f756 100644 (file)
@@ -329,14 +329,13 @@ function scorm_parse_aicc($scorm) {
 }
 
 function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false) {
-    global $CFG, $DB, $PAGE;
+    global $CFG, $DB, $PAGE, $OUTPUT;
 
     $strexpand = get_string('expcoll','scorm');
     $modestr = '';
     if ($mode == 'browse') {
         $modestr = '&amp;mode='.$mode;
     }
-    $scormpixdir = $CFG->modpixpath.'/scorm/pix';
 
     $result = new stdClass();
     $result->toc = "<ul id='s0' class='$liststyle'>\n";
@@ -434,9 +433,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                 if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
                     $icon = 'plus';
                 }
-                $result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
+                $result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$OUTPUT->mod_icon_url('pix/' . $icon, 'scorm').'" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
             } else if ($isvisible) {
-                $result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" alt="" />';
+                $result->toc .= '<img src="'.$OUTPUT->mod_icon_url('pix/spacer', 'scorm').'" alt="" />';
             }
             if (empty($sco->title)) {
                 $sco->title = $sco->identifier;
@@ -453,9 +452,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         $usertrack = $usertracks[$sco->identifier];
                         $strstatus = get_string($usertrack->status,'scorm');
                         if ($sco->scormtype == 'sco') {
-                            $statusicon = '<img src="'.$scormpixdir.'/'.$usertrack->status.'.gif" alt="'.$strstatus.'" title="'.$strstatus.'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/' . $usertrack->status, 'scorm').'" alt="'.$strstatus.'" title="'.$strstatus.'" />';
                         } else {
-                            $statusicon = '<img src="'.$scormpixdir.'/assetc.gif" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/assetc', 'scorm').'" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
                         }
 
                         if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) {
@@ -469,7 +468,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         }
                         $strsuspended = get_string('suspended','scorm');
                         if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
-                            $statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/suspend', 'scorm').'" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
                         }
                     } else {
                         if ($play && empty($scoid)) {
@@ -477,9 +476,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         }
                         $incomplete = true;
                         if ($sco->scormtype == 'sco') {
-                            $statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/notattempted', 'scorm').'" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
                         } else {
-                            $statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/asset', 'scorm').'" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
                         }
                     }
                     if ($sco->id == $scoid) {
@@ -534,7 +533,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
     }
     $result->toc .= "\t</ul>\n";
     if ($scorm->hidetoc == 0) {
-        $result->toc .= $PAGE->requires->data_for_js('scormdata', Array('scormpixdir'=>$scormpixdir))->asap();
+        $result->toc .= $PAGE->requires->data_for_js('scormdata', array(
+                'plusicon' => $OUTPUT->mod_icon_url('pix/plus', 'scorm'),
+                'minusicon' => $OUTPUT->mod_icon_url('pix/minus', 'scorm')))->asap();
         $result->toc .= $PAGE->requires->js('mod/scorm/datamodels/scorm_datamodels.js')->asap();
     }
 
index 076e399..637f3b4 100644 (file)
@@ -107,14 +107,13 @@ function scorm_eval_prerequisites($prerequisites, $usertracks) {
 }
 
 function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false) {
-    global $CFG, $DB, $PAGE;
+    global $CFG, $DB, $PAGE, $OUTPUT;
 
     $strexpand = get_string('expcoll','scorm');
     $modestr = '';
     if ($mode == 'browse') {
         $modestr = '&amp;mode='.$mode;
     }
-    $scormpixdir = $CFG->modpixpath.'/scorm/pix';
 
     $result = new stdClass();
     $result->toc = "<ul id='s0' class='$liststyle'>\n";
@@ -213,9 +212,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                 if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
                     $icon = 'plus';
                 }
-                $result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
+                $result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$OUTPUT->mod_icon_url('pix/' . $icon, 'scorm').'" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
             } else if ($isvisible) {
-                $result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" alt="" />';
+                $result->toc .= '<img src="'.$OUTPUT->mod_icon_url('pix/spacer', 'scorm').'" alt="" />';
             }
             if (empty($sco->title)) {
                 $sco->title = $sco->identifier;
@@ -232,9 +231,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         $usertrack = $usertracks[$sco->identifier];
                         $strstatus = get_string($usertrack->status,'scorm');
                         if ($sco->scormtype == 'sco') {
-                            $statusicon = '<img src="'.$scormpixdir.'/'.$usertrack->status.'.gif" alt="'.$strstatus.'" title="'.$strstatus.'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/'.$usertrack->status, 'scorm').'" alt="'.$strstatus.'" title="'.$strstatus.'" />';
                         } else {
-                            $statusicon = '<img src="'.$scormpixdir.'/assetc.gif" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/assetc/', 'scorm').'" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
                         }
 
                         if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) {
@@ -249,7 +248,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         $strsuspended = get_string('suspended','scorm');
                         if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
                             if($usertrack->status !='completed') {
-                                $statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
+                                $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/suspend', 'scorm').'" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
                             }
                         }
                     } else {
@@ -258,9 +257,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         }
                         $incomplete = true;
                         if ($sco->scormtype == 'sco') {
-                            $statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/notattempted', 'scorm').'" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
                         } else {
-                            $statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/asset', 'scorm').'" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
                         }
                     }
                     if ($sco->id == $scoid) {
@@ -318,7 +317,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
     }
     $result->toc .= "\t</ul>\n";
     if ($scorm->hidetoc == 0) {
-        $PAGE->requires->data_for_js('scormdata', Array('scormpixdir'=>$scormpixdir));
+        $PAGE->requires->data_for_js('scormdata', array(
+                'plusicon' => $OUTPUT->mod_icon_url('pix/plus', 'scorm'),
+                'minusicon' => $OUTPUT->mod_icon_url('pix/minus', 'scorm')));
         $PAGE->requires->js('mod/scorm/datamodels/scorm_datamodels.js');
     }
 
index 14dddb0..95b3aed 100644 (file)
@@ -1,14 +1,13 @@
 <?php // $Id$
 
 function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false) {
-    global $CFG, $DB, $PAGE;
+    global $CFG, $DB, $PAGE, $OUTPUT;
 
     $strexpand = get_string('expcoll','scorm');
     $modestr = '';
     if ($mode == 'browse') {
         $modestr = '&amp;mode='.$mode;
     }
-    $scormpixdir = $CFG->modpixpath.'/scorm/pix';
 
     $result = new stdClass();
     $result->toc = "<ul id='s0' class='$liststyle'>\n";
@@ -105,9 +104,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                     $icon = 'plus';
                 }
                 $result->toc .= "\t\t".'<li><a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');">'.
-                                '<img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
+                                '<img id="img'.$sublist.'" src="'.$OUTPUT->mod_icon_url('pix/'.$icon, 'scorm').'" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
             } else if ($isvisible) {
-                $result->toc .= "\t\t".'<li><img src="'.$scormpixdir.'/spacer.gif" alt="" />';
+                $result->toc .= "\t\t".'<li><img src="'.$OUTPUT->mod_icon_url('pix/spacer', 'scorm').'" alt="" />';
             }
             if (empty($sco->title)) {
                 $sco->title = $sco->identifier;
@@ -124,9 +123,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         $usertrack = $usertracks[$sco->identifier];
                         $strstatus = get_string($usertrack->status,'scorm');
                         if ($sco->scormtype == 'sco') {
-                            $statusicon = '<img src="'.$scormpixdir.'/'.$usertrack->status.'.gif" alt="'.$strstatus.'" title="'.$strstatus.'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/'.$usertrack->status, 'scorm').'" alt="'.$strstatus.'" title="'.$strstatus.'" />';
                         } else {
-                            $statusicon = '<img src="'.$scormpixdir.'/assetc.gif" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/assetc', 'scorm').'" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
                         }
 
                         if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) {
@@ -141,7 +140,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                         $strsuspended = get_string('suspended','scorm');
                         if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
                             if($usertrack->status !='completed') {
-                                $statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
+                                $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/suspend', 'scorm').'" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
                             }
                         }
                     } else {
@@ -149,10 +148,10 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
                             $scoid = $sco->id;
                         }
                         if ($sco->scormtype == 'sco') {
-                            $statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/notattempted', 'scorm').'" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
                             $incomplete = true;
                         } else {
-                            $statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
+                            $statusicon = '<img src="'.$OUTPUT->mod_icon_url('pix/asset', 'scorm').'" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
                         }
                     }
 
@@ -209,7 +208,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
     }
     $result->toc .= "\t</ul>\n";
     if ($scorm->hidetoc == 0) {
-        $PAGE->requires->data_for_js('scormdata', Array('scormpixdir'=>$scormpixdir));
+        $PAGE->requires->data_for_js('scormdata', array(
+                'plusicon' => $OUTPUT->mod_icon_url('pix/plus', 'scorm'),
+                'minusicon' => $OUTPUT->mod_icon_url('pix/minus', 'scorm')));
         $PAGE->requires->js('mod/scorm/datamodels/scorm_datamodels.js');
     }
 
index 071c4c5..c199f8c 100644 (file)
@@ -3,11 +3,11 @@ function expandCollide(which,list,item) {
     which = which.substring(0,(which.length));
     var el2 = document.ids ? document.ids[which] : document.getElementById ? document.getElementById(which) : document.all[which];
     if (el.style.display != "none") {
-        el2.src = scormdata.scormpixdir+"/plus.gif";
+        el2.src = scormdata.plusicon;
         el.style.display='none';
         new cookie("hide:SCORMitem" + item, 1, 356, "/").set();
     } else {
-        el2.src = scormdata.scormpixdir+"/minus.gif";
+        el2.src = scormdata.minusicon;
         el.style.display='block';
         new cookie("hide:SCORMitem" + item, 1, -1, "/").set();
     }
index cd453ca..f1e1792 100755 (executable)
@@ -304,10 +304,9 @@ function scorm_user_outline($course, $user, $mod, $scorm) {
  * @return boolean
  */
 function scorm_user_complete($course, $user, $mod, $scorm) {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     $liststyle = 'structlist';
-    $scormpixdir = $CFG->modpixpath.'/scorm/pix';
     $now = time();
     $firstmodify = $now;
     $lastmodify = 0;
@@ -367,7 +366,7 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
                     if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
                         $sublist++;
                     } else {
-                        $report .= '<img src="'.$scormpixdir.'/spacer.gif" alt="" />';
+                        $report .= '<img src="'.$OUTPUT->mod_icon_url('pix/spacer', 'scorm').'" alt="" />';
                     }
 
                     if ($sco->launch) {
@@ -379,7 +378,7 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
                                 $usertrack->status = 'notattempted';
                             }
                             $strstatus = get_string($usertrack->status,'scorm');
-                            $report .= "<img src='".$scormpixdir.'/'.$usertrack->status.".gif' alt='$strstatus' title='$strstatus' />";
+                            $report .= "<img src='".$OUTPUT->mod_icon_url('pix/'.$usertrack->status, 'scorm')."' alt='$strstatus' title='$strstatus' />";
                             if ($usertrack->timemodified != 0) {
                                 if ($usertrack->timemodified > $lastmodify) {
                                     $lastmodify = $usertrack->timemodified;
@@ -390,9 +389,9 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
                             }
                         } else {
                             if ($sco->scormtype == 'sco') {
-                                $report .= '<img src="'.$scormpixdir.'/'.'notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
+                                $report .= '<img src="'.$OUTPUT->mod_icon_url('pix/notattempted', 'scorm').'" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
                             } else {
-                                $report .= '<img src="'.$scormpixdir.'/'.'asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
+                                $report .= '<img src="'.$OUTPUT->mod_icon_url('pix/asset', 'scorm').'" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
                             }
                         }
                         $report .= "&nbsp;$sco->title $score$totaltime</li>\n";
index 5cf4110..df4343c 100755 (executable)
         $result = "$CFG->wwwroot/pluginfile.php/$context->id/scorm_content/$scorm->revision/$launcher";
     }
 
-    $scormpixdir = $CFG->modpixpath.'/scorm/pix';
-
     // which API are we looking for
     $LMS_api = ($scorm->version == 'scorm_12' || $scorm->version == 'SCORM_1.2' || empty($scorm->version)) ? 'API' : 'API_1484_11';
 ?>
                 location = "<?php echo $result ?>";
             }
             else {
-                document.body.innerHTML = "<p><?php echo get_string('activityloading', 'scorm');?> <span id='countdown'><?php echo $delayseconds ?></span> <?php echo get_string('numseconds');?>. &nbsp; <img src='<?php echo $scormpixdir;?>/wait.gif'><p>";
+                document.body.innerHTML = "<p><?php echo get_string('activityloading', 'scorm');?> <span id='countdown'><?php echo $delayseconds ?></span> <?php echo get_string('numseconds');?>. &nbsp; <img src='<?php echo $OUTPUT->mod_icon_url('pix/wait', 'scorm') ?>'><p>";
                 var e = document.getElementById("countdown");
                 var cSeconds = parseInt(e.innerHTML);
                 var timer = setInterval(function() {
index cb5ca37..c66f2d5 100755 (executable)
         }
     }
 
-    $scormpixdir = $CFG->modpixpath.'/scorm/pix';
-
     if (empty($b)) {
         if (empty($a)) {
             // No options, show the global scorm report
                                     $detailslink = '&nbsp;';
                                 }
                                 $strstatus = get_string($trackdata->status,'scorm');
-                                $row[] = '<img src="'.$scormpixdir.'/'.$trackdata->status.'.gif" alt="'.$strstatus.'" title="'.
+                                $row[] = '<img src="'.$OUTPUT->mod_icon_url('pix/' . $trackdata->status, 'scorm').'" alt="'.$strstatus.'" title="'.
                                          $strstatus.'" />&nbsp;'.format_string($sco->title);
                                 $row[] = get_string($trackdata->status,'scorm');
                                 $row[] = $trackdata->total_time;
                 $trackdata->total_time = '';
             }
             $strstatus = get_string($trackdata->status,'scorm');
-            echo '<img src="'.$scormpixdir.'/'.$trackdata->status.'.gif" alt="'.$strstatus.'" title="'.
+            echo '<img src="'.$$OUTPUT->mod_icon_url('pix/'.$trackdata->status, 'scorm').'" alt="'.$strstatus.'" title="'.
             $strstatus.'" />&nbsp;'.$trackdata->total_time.'<br />'.$scoreview.'<br />';
             echo '</div>'."\n";
             echo '<hr /><h2>'.get_string('details','scorm').'</h2>';
index 06504bd..7da8c60 100644 (file)
@@ -294,7 +294,7 @@ function ewiki_page_filedownload($id, $data, $action, $def_sec="") {
 
 function ewiki_entry_downloads($row, $show_section=0, $fullinfo=false) {
 
-   global $ewiki_binary_icons, $ewiki_upload_sections, $DB;
+   global $ewiki_binary_icons, $ewiki_upload_sections, $DB, $OUTPUT;
 
    $meta = &$row["meta"];
 
@@ -329,9 +329,9 @@ function ewiki_entry_downloads($row, $show_section=0, $fullinfo=false) {
    
    /// Moodle Icon Handling
    global $CFG;
-   $icon = mimeinfo("icon", $id);
-   $p_icon="$CFG->pixpath/f/$icon";
-   $p_icon_t="";
+   $icon = str_replace(array('.gif', '.png'), '', mimeinfo("icon", $id));
+   $p_icon = $OUTPUT->old_icon_url('f/' . $icon);
+   $p_icon_t = '';
 
    $info->id = $id;
    $info->size = $p_size;