]> git.mjollnir.org Git - moodle.git/commitdiff
Two things are in this checkin:
authormoodler <moodler>
Sun, 14 Sep 2003 12:25:16 +0000 (12:25 +0000)
committermoodler <moodler>
Sun, 14 Sep 2003 12:25:16 +0000 (12:25 +0000)
1) Support for the new "label" module has been added.  It's unfortunate
   about having to make these exceptions but this was the overall cleanest
   way I could think of.

2) All local calculation of pixpath and modpixpath has been removed and
   replaced with a single calculation which is done in setup.php and
   stored in $CFG->pixpath and #CFG->modpixpath.  All graphics should
   use these variables so that themes can easily override them.

course/format/social.php
course/format/topics.php
course/format/weeks.php
course/lib.php
course/mod.php
course/recent.php
course/search.php
course/view.php
lib/setup.php
lib/weblib.php

index 83a1325dbff5adcf6f2397107572bf30ab3b0a72..5aac35aeefbfbdd97b37648e5efa89ab899a14ed 100644 (file)
@@ -13,7 +13,7 @@
     <td width="<?php echo $leftwidth?>" valign="top"> 
       <?php 
       $moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
-      $modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
+      $modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
       $editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".
                         get_string("editmyprofile")."</A>";
       if ($USER->description) {
@@ -21,7 +21,7 @@
       } else {
           $moddata[]= $editmyprofile." <blink>*</blink>";
       }
-      $modicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
+      $modicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
       print_side_block(get_string("people"), "", $moddata, $modicon, "", $leftwidth);
 
       
index d2c5df4a90817d6c2920aded5df1806455a04e75..a60f88d272b923b682ab623c00715abe8d6f5633 100644 (file)
     
 /// Links to people
     $moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
-    $modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
+    $modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
     $editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
     if ($USER->description) {
         $moddata[]= $editmyprofile;
     } else {
         $moddata[]= $editmyprofile." <blink>*</blink>";
     }
-    $modicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
+    $modicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
     print_side_block(get_string("people"), "", $moddata, $modicon);
 
 
@@ -71,7 +71,7 @@
     if ($modnamesused) {
         foreach ($modnamesused as $modname => $modfullname) {
             $moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
-            $modicon[] = "<img src=\"$modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
+            $modicon[] = "<img src=\"$CFG->modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
         }
     }
     print_side_block($stractivities, "", $moddata, $modicon);
     
         if (isediting($course->id)) {
             $thissection->summary .= " <a title=\"$streditsummary\" ".
-                                     "href=\"editsection.php?id=$thissection->id\"><img src=\"$pixpath/t/edit.gif\" ".
+                                     "href=\"editsection.php?id=$thissection->id\"><img src=\"$CFG->pixpath/t/edit.gif\" ".
                                      "height=11 width=11 border=0 alt=\"$streditsummary\"></a></p>";
         }
     
 
             if (isediting($course->id)) {
                 $thissection->summary .= " <a title=\"$streditsummary\" href=editsection.php?id=$thissection->id>".
-                     "<img src=\"$pixpath/t/edit.gif\" border=0 height=11 width=11></a>";
+                     "<img src=\"$CFG->pixpath/t/edit.gif\" border=0 height=11 width=11></a>";
             }
     
             echo text_to_html($thissection->summary);
 
         if ($displaysection == $section) {      // Show the zoom boxes
             echo "<a href=\"view.php?id=$course->id&topic=all\" title=\"$strshowalltopics\">".
-                 "<img src=\"$pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
+                 "<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
         } else {
             $strshowonlytopic = get_string("showonlytopic", "", $section);
             echo "<a href=\"view.php?id=$course->id&topic=$section\" title=\"$strshowonlytopic\">".
-                 "<img src=\"$pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
+                 "<img src=\"$CFG->pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
         }
 
         if (isediting($course->id)) {
             if ($course->marker == $section) {  // Show the "light globe" on/off
                 echo "<a href=\"view.php?id=$course->id&marker=0\" title=\"$strmarkedthistopic\">".
-                     "<img src=\"$pixpath/i/marked.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/i/marked.gif\" vspace=3 height=16 width=16 border=0></a><br />";
             } else {
                 echo "<a href=\"view.php?id=$course->id&marker=$section\" title=\"$strmarkthistopic\">".
-                     "<img src=\"$pixpath/i/marker.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/i/marker.gif\" vspace=3 height=16 width=16 border=0></a><br />";
             }
 
             if ($thissection->visible) {        // Show the hide/show eye
                 echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strtopichide\">".
-                     "<img src=\"$pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
             } else {
                 echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strtopicshow\">".
-                     "<img src=\"$pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
             }
 
             if ($section > 1) {                       // Add a arrow to move section up
                 echo "<a href=\"view.php?id=$course->id&section=$section&move=-1\" title=\"$strmoveup\">".
-                     "<img src=\"$pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
             }
 
             if ($section < $course->numsections) {    // Add a arrow to move section down
                 echo "<a href=\"view.php?id=$course->id&section=$section&move=1\" title=\"$strmovedown\">".
-                     "<img src=\"$pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
             }
 
         }
index 686a56fa84a8caf5c7372f44685f3e6db0ec6a18..4bcd202aa919d2834a49e28a5575bcd2eacea822 100644 (file)
 
 /// Links to people
     $moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
-    $modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
+    $modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
     $editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
     if ($USER->description) {
         $moddata[]= $editmyprofile;
     } else {
         $moddata[]= $editmyprofile." <blink>*</blink>";
     }
-    $modicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
+    $modicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
     print_side_block(get_string("people"), "", $moddata, $modicon);
 
 
     $modicon = array();
     if ($modnamesused) {
         foreach ($modnamesused as $modname => $modfullname) {
-            $moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
-            $modicon[] = "<img src=\"$modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
+            if ($modname != "label") {
+                $moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
+                $modicon[] = "<img src=\"$CFG->modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
+            }
         }
     }
     print_side_block($stractivities, "", $moddata, $modicon);
 
         if (isediting($course->id)) {
             $thissection->summary .= " <a title=\"$streditsummary\" ".
-                                  "href=\"editsection.php?id=$thissection->id\"><img height=11 width=11 src=\"$pixpath/t/edit.gif\" ".
+                                  "href=\"editsection.php?id=$thissection->id\"><img height=11 width=11 src=\"$CFG->pixpath/t/edit.gif\" ".
                                   "border=0 alt=\"$streditsummary\"></a></p>";
         }
     
 
             if (isediting($course->id)) {
                 $thissection->summary .= " <a title=\"$streditsummary\" href=\"editsection.php?id=$thissection->id\">".
-                      "<img src=\"$pixpath/t/edit.gif\" height=11 width=11 border=0></a></p>";
+                      "<img src=\"$CFG->pixpath/t/edit.gif\" height=11 width=11 border=0></a></p>";
             }
 
             echo text_to_html($thissection->summary);
 
         if ($displaysection == $section) { 
             echo "<a href=\"view.php?id=$course->id&week=all\" title=\"$strshowallweeks\">".
-                 "<img src=\"$pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
+                 "<img src=\"$CFG->pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
         } else {
             $strshowonlyweek = get_string("showonlyweek", "", $section);
             echo "<a href=\"view.php?id=$course->id&week=$section\" title=\"$strshowonlyweek\">".
-                 "<img src=\"$pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
+                 "<img src=\"$CFG->pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
         }
 
         if (isediting($course->id)) {
             if ($thissection->visible) {        // Show the hide/show eye
                 echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strweekhide\">".
-                     "<img src=\"$pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0></a><br />";
             } else {
                 echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strweekshow\">".
-                     "<img src=\"$pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0></a><br />";
             }
 
             if ($section > 1) {                       // Add a arrow to move section up
                 echo "<a href=\"view.php?id=$course->id&section=$section&move=-1\" title=\"$strmoveup\">".
-                     "<img src=\"$pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0></a><br />";
             }
 
             if ($section < $course->numsections) {    // Add a arrow to move section down
                 echo "<a href=\"view.php?id=$course->id&section=$section&move=1\" title=\"$strmovedown\">".
-                     "<img src=\"$pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
+                     "<img src=\"$CFG->pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0></a><br />";
             }
 
         }
index 714349ca72d772adeee0732858195fff66154288..d476ace0614ef10ab6acf3c41f2e833c7b28cfa0 100644 (file)
@@ -261,6 +261,11 @@ function print_recent_activity($course) {
     if ($logs) {
         foreach ($logs as $key => $log) {
             $info = split(" ", $log->info);
+
+            if ($info[0] == "label") {     // Labels are special activities
+                continue;
+            }
+
             $modname = get_field($info[0], "name", "id", $info[1]);
             //Create a temp valid module structure (course,id)
             $tempmod->course = $log->course;
@@ -386,6 +391,11 @@ function get_array_of_activities($courseid) {
                            }
                        }
                    }
+                   if ($mod[$seq]->mod == "label") {
+                       if ($label = get_record("label", "id", $rawmods[$seq]->instance)) {
+                           $mod[$seq]->extra = urlencode($label->content);
+                       }
+                   }
                }
             }
         }
@@ -512,12 +522,7 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod
             $strmovefull = get_string("movefull", "", "'$USER->activitycopyname'");
             $stractivityclipboard = $USER->activitycopyname;
             $strcancel= get_string("cancel");
-            if (empty($THEME->custompix)) {
-                $pixpath = "$CFG->wwwroot/pix";
-            } else {
-                $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
-            }
-            $modicon[] = "&nbsp;<img align=bottom src=\"$pixpath/t/move.gif\" height=\"11\" width=\"11\">";
+            $modicon[] = "&nbsp;<img align=bottom src=\"$CFG->pixpath/t/move.gif\" height=\"11\" width=\"11\">";
             $moddata[] = "$USER->activitycopyname&nbsp;(<a href=\"$CFG->wwwroot/course/mod.php?cancelcopy=true\">$strcancel</a>)";
         }
 
@@ -548,11 +553,16 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod
                     $extra = "";
                 }
 
-                $modicon[] = "<img src=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\"".
-                             " height=\"16\" width=\"16\" alt=\"$mod->modfullname\">";
-                $moddata[] = "<a title=\"$mod->modfullname\" $linkcss $extra".
-                             "href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a>".
-                             "$editbuttons";
+                if ($mod->modname == "label") {
+                    $modicon[] = "";
+                    $moddata[] = format_text($extra, FORMAT_HTML).$editbuttons;
+                } else {
+                    $modicon[] = "<img src=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\"".
+                                 " height=\"16\" width=\"16\" alt=\"$mod->modfullname\">";
+                    $moddata[] = "<a title=\"$mod->modfullname\" $linkcss $extra".
+                                 "href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a>".
+                                 "$editbuttons";
+                }
             }
         }
     }
@@ -599,7 +609,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
 
     $modinfo = unserialize($course->modinfo);
 
-    echo "<table width=\"$width\"><tr><td>\n";
+    echo "<table width=\"$width\" cellpadding=3 cellspacing=0>\n";
     if (!empty($section->sequence)) {
 
         $sectionmods = explode(",", $section->sequence);
@@ -609,7 +619,9 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
                 continue;
             }
             $mod = $mods[$modnumber];
+
             if ($mod->visible or $isteacher) {
+                echo "<tr><td class=\"activity$mod->modname\">";
                 if ($ismoving) {
                     if ($mod->id == $USER->activitycopy) {
                         continue;
@@ -618,31 +630,38 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
                          " href=\"mod.php?moveto=$mod->id\">$strmovehere</a></font><br />\n";
                 }
                 $instancename = urldecode($modinfo[$modnumber]->name);
+
                 if (!empty($modinfo[$modnumber]->extra)) {
                     $extra = urldecode($modinfo[$modnumber]->extra);
                 } else {
                     $extra = "";
                 }
-                $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
-                echo "<img src=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\"".
-                     " height=16 width=16 alt=\"$mod->modfullname\">".
-                     " <font size=2><a title=\"$mod->modfullname\" $linkcss $extra".
-                     " href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a></font>";
-            }
-            if (isediting($course->id)) {
-                echo "&nbsp;&nbsp;";
-                echo make_editing_buttons($mod->id, $absolute, $mod->visible);
-            }
-            if ($mod->visible or $isteacher) {
-                echo "<br />\n";
+
+                if ($mod->modname == "label") {
+                    echo format_text($extra, FORMAT_HTML);
+
+                } else { // Normal activity
+                    $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
+                    echo "<img src=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\"".
+                         " height=16 width=16 alt=\"$mod->modfullname\">".
+                         " <font size=2><a title=\"$mod->modfullname\" $linkcss $extra".
+                         " href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a></font>";
+                }
+                echo "</td>";
+                if ($isediting) {
+                    echo "<td align=\"right\" valign=\"top\" nowrap=\"nowrap\" class=\"activityeditbuttons\">";
+                    echo make_editing_buttons($mod->id, $absolute, $mod->visible);
+                    echo " </td>";
+                }
+                echo "</tr>";
             }
         }
     }
     if ($ismoving) {
-        echo "<font size=\"2\"> -> <a title=\"$strmovefull\"".
-             " href=\"mod.php?movetosection=$section->id\">$strmovehere</a></font><br />\n";
+        echo "<tr><td><font size=\"2\"> -> <a title=\"$strmovefull\"".
+             " href=\"mod.php?movetosection=$section->id\">$strmovehere</a></font></td></tr>\n";
     }
-    echo "</td></tr></table><br />\n\n";
+    echo "</table>\n\n";
 }
 
 
@@ -734,37 +753,31 @@ function print_side_block_end() {
 function print_admin_links ($siteid, $width=180) {
     global $CFG, $THEME;
     
-    if (empty($THEME->custompix)) {
-        $pixpath = "$CFG->wwwroot/pix";
-    } else {
-        $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
-    }
-
     if (isadmin()) {
            $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">".get_string("configuration")."</a>...";
-               $modicon[]="<img src=\"$pixpath/i/admin.gif\" height=16 width=16 alt=\"\" />";
+               $modicon[]="<img src=\"$CFG->pixpath/i/admin.gif\" height=16 width=16 alt=\"\" />";
 
            $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/users.php\">".get_string("users")."</a>...";
-               $modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\" />";
+               $modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\" />";
     }
 
     if (iscreator()) {
            $moddata[]="<a href=\"$CFG->wwwroot/course/index.php?edit=on\">".get_string("courses")."</a>";
-               $modicon[]="<img src=\"$pixpath/i/course.gif\" height=16 width=16 alt=\"\" />";
+               $modicon[]="<img src=\"$CFG->pixpath/i/course.gif\" height=16 width=16 alt=\"\" />";
         $fulladmin = "";
     }
 
     if (isadmin()) {
                $moddata[]="<a href=\"$CFG->wwwroot/course/log.php?id=$siteid\">".get_string("logs")."</a>";
-               $modicon[]="<img src=\"$pixpath/i/log.gif\" height=16 width=16 alt=\"\" />";
+               $modicon[]="<img src=\"$CFG->pixpath/i/log.gif\" height=16 width=16 alt=\"\" />";
 
                $moddata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$siteid\">".get_string("sitefiles")."</a>";
-               $modicon[]="<img src=\"$pixpath/i/files.gif\" height=16 width=16 alt=\"\" />";
+               $modicon[]="<img src=\"$CFG->pixpath/i/files.gif\" height=16 width=16 alt=\"\" />";
 
                if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
             $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/$CFG->dbtype/frame.php\">".
                         get_string("managedatabase")."</a>";
-                   $modicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\" />";
+                   $modicon[]="<img src=\"$CFG->pixpath/i/settings.gif\" height=16 width=16 alt=\"\" />";
                }
         $fulladmin = "<p><a href=\"$CFG->wwwroot/$CFG->admin/\">".get_string("admin")."</a>...";
     }
@@ -780,30 +793,23 @@ function print_course_admin_links($course, $width=180) {
     if (isguest()) {
         return true;
     }
-    if (empty($THEME->custompix)) {
-        $pixpath = "$CFG->wwwroot/pix";
-        $modpixpath = "$CFG->wwwroot/mod";
-    } else {
-        $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
-        $modpixpath = "$CFG->wwwroot/theme/$CFG->theme/pix/mod";
-    }
     if (isteacher($course->id)) {
         if (isteacheredit($course->id)) {
-            $adminicon[]="<img src=\"$pixpath/i/edit.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/edit.gif\" height=16 width=16 alt=\"\">";
             if (isediting($course->id)) {
                 $admindata[]="<a href=\"view.php?id=$course->id&edit=off\">".get_string("turneditingoff")."</a>";
             } else {
                 $admindata[]="<a href=\"view.php?id=$course->id&edit=on\">".get_string("turneditingon")."</a>";
             }
             $admindata[]="<a href=\"edit.php?id=$course->id\">".get_string("settings")."...</a>";
-            $adminicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
 
             if (iscreator() or !empty($CFG->teacherassignteachers)) {
                 if (!$course->teachers) {
                     $course->teachers = get_string("defaultcourseteachers");
                 }
                 $admindata[]="<a href=\"teacher.php?id=$course->id\">$course->teachers...</a>";
-                $adminicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
+                $adminicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
             }
         }
 
@@ -811,47 +817,47 @@ function print_course_admin_links($course, $width=180) {
             $course->students = get_string("defaultcoursestudents");
         }
         $admindata[]="<a href=\"student.php?id=$course->id\">$course->students...</a>";
-        $adminicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
+        $adminicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
 
         if (isteacheredit($course->id)) {
             $admindata[]="<a href=\"$CFG->wwwroot/backup/backup.php?id=$course->id\">".get_string("backup")."...</a>";
-            $adminicon[]="<img src=\"$pixpath/i/backup.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/backup.gif\" height=16 width=16 alt=\"\">";
         
             $admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id&wdir=/backupdata\">".get_string("restore")."...</a>";
-            $adminicon[]="<img src=\"$pixpath/i/restore.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/restore.gif\" height=16 width=16 alt=\"\">";
             $admindata[]="<a href=\"scales.php?id=$course->id\">".get_string("scales")."...</a>";
-            $adminicon[]="<img src=\"$pixpath/i/scales.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/scales.gif\" height=16 width=16 alt=\"\">";
         }
     
         $admindata[]="<a href=\"grades.php?id=$course->id\">".get_string("grades")."...</a>";
-        $adminicon[]="<img src=\"$pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
+        $adminicon[]="<img src=\"$CFG->pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
     
         $admindata[]="<a href=\"log.php?id=$course->id\">".get_string("logs")."...</a>";
-        $adminicon[]="<img src=\"$pixpath/i/log.gif\" height=16 width=16 alt=\"\">";
+        $adminicon[]="<img src=\"$CFG->pixpath/i/log.gif\" height=16 width=16 alt=\"\">";
 
         $admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id\">".get_string("files")."...</a>";
-        $adminicon[]="<img src=\"$pixpath/i/files.gif\" height=16 width=16 alt=\"\">";
+        $adminicon[]="<img src=\"$CFG->pixpath/i/files.gif\" height=16 width=16 alt=\"\">";
 
         $admindata[]="<a href=\"$CFG->wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."...</a>";
-        $adminicon[]="<img src=\"$modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">";
+        $adminicon[]="<img src=\"$CFG->modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">";
 
         if ($teacherforum = forum_get_course_forum($course->id, "teacher")) {
             $admindata[]="<a href=\"$CFG->wwwroot/mod/forum/view.php?f=$teacherforum->id\">$teacherforum->name</a>";
-            $adminicon[]="<img src=\"$modpixpath/forum/icon.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->modpixpath/forum/icon.gif\" height=16 width=16 alt=\"\">";
         }
 
     } else if (!isguest()) {  // Students menu
         if ($course->showgrades) {
             $admindata[]="<a href=\"grade.php?id=$course->id\">".get_string("grades")."...</a>";
-            $adminicon[]="<img src=\"$pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
         }
         if ($CFG->auth == "email" or $CFG->auth == "none" or $CFG->auth == "manual") {
             $admindata[]="<a href=\"$CFG->wwwroot/login/change_password.php?id=$course->id\">".
                           get_string("changepassword")."...</a>";
-            $adminicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
         } else if ($CFG->changepassword) {
             $admindata[]="<a href=\"$CFG->changepassword\">".get_string("changepassword")."...</a>";
-            $adminicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
         }
     } 
 
@@ -941,15 +947,10 @@ function print_category_info($category, $depth) {
         $strsummary = get_string("summary");
     }
 
-    if (empty($THEME->custompix)) {
-        $pixpath = "$CFG->wwwroot/pix";
-    } else {
-        $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
-    }
     $catlinkcss = $category->visible ? "" : " class=\"dimmed\" ";
 
     if ($CFG->frontpage == FRONTPAGECOURSELIST) {
-        $catimage = "<img src=\"$pixpath/i/course.gif\" width=16 height=16 border=0>";
+        $catimage = "<img src=\"$CFG->pixpath/i/course.gif\" width=16 height=16 border=0>";
     } else {
         $catimage = "&nbsp";
     }
@@ -985,22 +986,22 @@ function print_category_info($category, $depth) {
                 echo "</td>\n<td align=\"right\" valign=\"top\" nowrap class=\"coursename\">";
                 if ($course->guest ) {
                     echo "<a title=\"$strallowguests\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
-                    echo "<img hspace=1 alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a>";
+                    echo "<img hspace=1 alt=\"\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/user.gif\"></a>";
                 } else {
-                    echo "<img alt=\"\" height=16 width=18 border=0 src=\"$pixpath/spacer.gif\">";
+                    echo "<img alt=\"\" height=16 width=18 border=0 src=\"$CFG->pixpath/spacer.gif\">";
                 }
                 if ($course->password) {
                     echo "<a title=\"$strrequireskey\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
-                    echo "<img hspace=1 alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a>";
+                    echo "<img hspace=1 alt=\"\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/key.gif\"></a>";
                 } else {
-                    echo "<img alt=\"\" height=16 width=18 border=0 src=\"$pixpath/spacer.gif\">";
+                    echo "<img alt=\"\" height=16 width=18 border=0 src=\"$CFG->pixpath/spacer.gif\">";
                 }
                 if ($course->summary) {
                     link_to_popup_window ("/course/info.php?id=$course->id", "courseinfo", 
-                                          "<img hspace=1 alt=\"info\" height=16 width=16 border=0 src=\"$pixpath/i/info.gif\">", 
+                                          "<img hspace=1 alt=\"info\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/info.gif\">", 
                                            400, 500, $strsummary);
                 } else {
-                    echo "<img alt=\"\" height=16 width=18 border=0 src=\"$pixpath/spacer.gif\">";
+                    echo "<img alt=\"\" height=16 width=18 border=0 src=\"$CFG->pixpath/spacer.gif\">";
                 }
                 echo "</td></tr>\n";
             }
@@ -1120,12 +1121,6 @@ function print_course($course, $width="100%") {
         error("Could not find a site!");
     }
 
-    if (empty($THEME->custompix)) {
-        $pixpath = "$CFG->wwwroot/pix";
-    } else {
-        $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
-    }
-
     print_simple_box_start("center", "$width");
 
     $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
@@ -1150,12 +1145,12 @@ function print_course($course, $width="100%") {
     if ($course->guest) {
         $strallowguests = get_string("allowguests");
         echo "<a title=\"$strallowguests\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
-        echo "<img vspace=4 alt=\"$strallowguests\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a>&nbsp;&nbsp;";
+        echo "<img vspace=4 alt=\"$strallowguests\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/user.gif\"></a>&nbsp;&nbsp;";
     }
     if ($course->password) {
         $strrequireskey = get_string("requireskey");
         echo "<a title=\"$strrequireskey\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
-        echo "<img vspace=4 alt=\"$strrequireskey\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a>";
+        echo "<img vspace=4 alt=\"$strrequireskey\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/key.gif\"></a>";
     }
 
 
index d205e5ac7fd26a88fd5c330e23bbfa228a1836dc..73d4a331d559bae0fbd168fb31bd6259586b51c6 100644 (file)
 
     if (file_exists($modform)) {
 
-        print_heading_with_help($pageheading, "mods", $module->name);
+        $icon = "<img align=absmiddle height=16 width=16 src=\"$CFG->modpixpath/$module->name/icon.gif\">&nbsp;";
+
+        print_heading_with_help($pageheading, "mods", $module->name, $icon);
         print_simple_box_start("center", "", "$THEME->cellheading");
         include_once($modform);
         print_simple_box_end();
index e625270778f869fa09f3573bf36993225168d014..52bc752a8eb898f2022793c703105718f43c73b2 100644 (file)
 
     add_to_log($course->id, "course", "recent", "recent.php?id=$course->id", "$course->id");
 
-    if (empty($THEME->custompix)) {
-        $pixpath = "../pix";
-        $modpixpath = "../mod";
-    } else {
-        $pixpath = "../theme/$CFG->theme/pix";
-        $modpixpath = "../theme/$CFG->theme/pix/mod";
-    }
-
     $strrecentactivity = get_string("recentactivity");
 
     $loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
@@ -78,7 +70,7 @@
                         require_once($libfile);
                         $print_recent_instance_activity = $mod->modname."_print_recent_instance_activity";
                         if (function_exists($print_recent_instance_activity)) {
-                            $image = "<img src=\"$modpixpath/$mod->modname/icon.gif\" ".
+                            $image = "<img src=\"$CFG->modpixpath/$mod->modname/icon.gif\" ".
                                      "height=16 width=16 alt=\"$mod->modfullname\">";
                             echo "<h4>$image $mod->modfullname: ".
                                  "<a href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
index 5dd76458c46ba2b752dbc56dd6f95a4c584fe046..8eac25f971ea3ad20672cf56bda4a3681739bd27 100644 (file)
 
     $site = get_site();
 
-    if (empty($THEME->custompix)) {
-        $pixpath = "$CFG->wwwroot/pix";
-    } else {
-        $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
-    }
-
     $displaylist = array();
     $parentlist = array();
     make_categories_list($displaylist, $parentlist, "");
index 165b9032514417c65f3a4b7156e7fb1263a7e589..41e7a2a62c0ad8e517989b1dd5a5b9f72788f42d 100644 (file)
         redirect("$CFG->wwwroot/");
     }
 
-    if (empty($THEME->custompix)) {
-        $pixpath = "../pix";
-        $modpixpath = "../mod";
-    } else {
-        $pixpath = "../theme/$CFG->theme/pix";
-        $modpixpath = "../theme/$CFG->theme/pix/mod";
-    }
-
     $courseword = get_string("course");
 
     $loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
index adca64b9ac17011d1cbbecef853534f24a3aeb57..35106df9c798363297ac953059f1765fa87fcffd 100644 (file)
     $CFG->header      = "$CFG->dirroot/theme/$CFG->theme/header.html";
     $CFG->footer      = "$CFG->dirroot/theme/$CFG->theme/footer.html";
 
+    if (empty($THEME->custompix)) {
+        $CFG->pixpath = "$CFG->wwwroot/pix";
+        $CFG->modpixpath = "$CFG->wwwroot/mod";
+    } else {
+        $CFG->pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
+        $CFG->modpixpath = "$CFG->wwwroot/theme/$CFG->theme/pix/mod";
+    }
+
 
 /// A hack to get around magic_quotes_gpc being turned off
 
index fdc77a3b8646edc3581f63a687bd3ca9a2a172d8..0804b5e5c9c56133494414035e4979afd154534c 100644 (file)
@@ -581,7 +581,7 @@ function replace_smilies(&$text) {
      if ($runonce == false){
         foreach ($emoticons as $emoticon => $image){
             $e[] = $emoticon;
-            $img[] = "<img alt=\"$emoticon\" width=15 height=15 src=\"$CFG->wwwroot/pix/s/$image\">";
+            $img[] = "<img alt=\"$emoticon\" width=15 height=15 src=\"$CFG->pixpath/s/$image\">";
         }
         $runonce = true;
     }
@@ -871,9 +871,10 @@ function print_heading($text, $align="center", $size=3) {
     echo "<p align=\"$align\"><font size=\"$size\"><b>".stripslashes_safe($text)."</b></font></p>";
 }
 
-function print_heading_with_help($text, $helppage, $module="moodle") {
+function print_heading_with_help($text, $helppage, $module="moodle", $icon="") {
 // Centered heading with attached help button (same title text)
-    echo "<p align=\"center\"><font size=\"3\"><b>".stripslashes_safe($text);
+// and optional icon attached
+    echo "<p align=\"center\"><font size=\"3\">$icon<b>".stripslashes_safe($text);
     helpbutton($helppage, $text, $module);
     echo "</b></font></p>";
 }
@@ -985,14 +986,8 @@ function print_user_picture($userid, $courseid, $picture, $large=false, $returns
                        " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
         }
     } else {         // Print default user pictures (use theme version if available)
-        if (empty($THEME->custompix)) {
-            $output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/pix/u/$file.png\"".
-                       " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
-        } else {
-            $output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/theme/$CFG->theme/pix/u/$file.png\"".
-                       " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
-        }
-
+        $output .= "<img align=\"absmiddle\" src=\"$CFG->pixpath/u/$file.png\"".
+                   " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
     }
     if ($link) {
         $output .= "</a>";
@@ -1399,7 +1394,7 @@ function print_grade_menu($courseid, $name, $current, $includenograde=true) {
 /// Prints a grade menu (as part of an existing form) with help
 /// Showing all possible numerical grades and scales
 
-    global $CFG, $THEME;
+    global $CFG;
 
     $strscale = get_string("scale");
     $strscales = get_string("scales");
@@ -1416,11 +1411,7 @@ function print_grade_menu($courseid, $name, $current, $includenograde=true) {
     }
     choose_from_menu($grades, "$name", "$current", "");
 
-    if (empty($THEME->custompix)) {
-        $helpicon = "$CFG->wwwroot/pix/help.gif";
-    } else {
-        $helpicon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif";
-    }
+    $helpicon = "$CFG->pixpath/help.gif";
     $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$strscales\" src=\"$helpicon\">";
     link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales", 
                           $linkobject, 400, 500, $strscales);
@@ -1430,15 +1421,11 @@ function print_scale_menu($courseid, $name, $current) {
 /// Prints a scale menu (as part of an existing form) including help button
 /// Just like print_grade_menu but without the numerical grades
 
-    global $CFG, $THEME;
+    global $CFG;
 
     $strscales = get_string("scales");
     choose_from_menu(get_scales_menu($courseid), "$name", $current, "");
-    if (empty($THEME->custompix)) {
-        $helpicon = "$CFG->wwwroot/pix/help.gif";
-    } else {
-        $helpicon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif";
-    }
+    $helpicon = "$CFG->pixpath/help.gif";
     $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$strscales\" src=\"$helpicon\">";
     link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales", 
                           $linkobject, 400, 500, $strscales);
@@ -1449,14 +1436,10 @@ function print_scale_menu_helpbutton($courseid, $scale) {
 /// Prints a help button about a scale
 /// scale is an object
 
-    global $CFG, $THEME;
+    global $CFG;
 
     $strscales = get_string("scales");
-    if (empty($THEME->custompix)) {
-        $helpicon = "$CFG->wwwroot/pix/help.gif";
-    } else {
-        $helpicon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif";
-    }
+    $helpicon = "$CFG->pixpath/help.gif";
     $linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$scale->name\" src=\"$helpicon\">";
     link_to_popup_window ("/course/scales.php?id=$courseid&list=true&scale=$scale->id", "ratingscale", 
                           $linkobject, 400, 500, $scale->name);
@@ -1496,13 +1479,8 @@ function helpbutton ($page, $title="", $module="moodle", $image=true, $linktext=
         $module = "moodle";
     }
 
-    if (empty($THEME->custompix)) {
-        $icon = "$CFG->wwwroot/pix/help.gif";
-    } else {
-        $icon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif";
-    }
-
     if ($image) {
+        $icon = "$CFG->pixpath/help.gif";
         if ($linktext) {
             $linkobject = "$title<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"\" src=\"$icon\">";
         } else {
@@ -1526,7 +1504,11 @@ function emoticonhelpbutton($form, $field) {
     $SESSION->inserttextform = $form;
     $SESSION->inserttextfield = $field;
     helpbutton("emoticons", get_string("helpemoticons"), "moodle", false, true);
-    echo "&nbsp;<img src=\"$CFG->wwwroot/pix/s/smiley.gif\" align=\"absmiddle\" width=15 height=15></a>";
+    echo "&nbsp;";
+    link_to_popup_window ("/help.php?module=moodle&file=emoticons.html", "popup", 
+                          "<img src=\"$CFG->pixpath/s/smiley.gif\" border=0 align=\"absmiddle\" width=15 height=15>", 
+                           400, 500, get_string("helpemoticons"));
+    echo "<br />";
 }
 
 function notice ($message, $link="") {