From: moodler Date: Sun, 14 Sep 2003 12:25:16 +0000 (+0000) Subject: Two things are in this checkin: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c9f6251ea8d9b77daa980f9264b5a364fed80c03;p=moodle.git Two things are in this checkin: 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. --- diff --git a/course/format/social.php b/course/format/social.php index 83a1325dbf..5aac35aeef 100644 --- a/course/format/social.php +++ b/course/format/social.php @@ -13,7 +13,7 @@ id\">".get_string("participants").""; - $modicon[]="\"\""; + $modicon[]="pixpath/i/users.gif\" height=16 width=16 alt=\"\">"; $editmyprofile = "firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">". get_string("editmyprofile").""; if ($USER->description) { @@ -21,7 +21,7 @@ } else { $moddata[]= $editmyprofile." *"; } - $modicon[]="\"\""; + $modicon[]="pixpath/i/user.gif\" height=16 width=16 alt=\"\">"; print_side_block(get_string("people"), "", $moddata, $modicon, "", $leftwidth); diff --git a/course/format/topics.php b/course/format/topics.php index d2c5df4a90..a60f88d272 100644 --- a/course/format/topics.php +++ b/course/format/topics.php @@ -54,14 +54,14 @@ /// Links to people $moddata[]="id\">".get_string("participants").""; - $modicon[]="\"\""; + $modicon[]="pixpath/i/users.gif\" height=16 width=16 alt=\"\">"; $editmyprofile = "firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile").""; if ($USER->description) { $moddata[]= $editmyprofile; } else { $moddata[]= $editmyprofile." *"; } - $modicon[]="\"\""; + $modicon[]="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[] = "id\">".$modnamesplural[$modname].""; - $modicon[] = "\"\""; + $modicon[] = "modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">"; } } print_side_block($stractivities, "", $moddata, $modicon); @@ -122,7 +122,7 @@ if (isediting($course->id)) { $thissection->summary .= " id\">id\">pixpath/t/edit.gif\" ". "height=11 width=11 border=0 alt=\"$streditsummary\">

"; } @@ -211,7 +211,7 @@ if (isediting($course->id)) { $thissection->summary .= " id>". - ""; + "pixpath/t/edit.gif\" border=0 height=11 width=11>"; } echo text_to_html($thissection->summary); @@ -232,38 +232,38 @@ if ($displaysection == $section) { // Show the zoom boxes echo "id&topic=all\" title=\"$strshowalltopics\">". - "
"; + "pixpath/i/all.gif\" height=25 width=16 border=0>
"; } else { $strshowonlytopic = get_string("showonlytopic", "", $section); echo "id&topic=$section\" title=\"$strshowonlytopic\">". - "
"; + "pixpath/i/one.gif\" height=16 width=16 border=0>
"; } if (isediting($course->id)) { if ($course->marker == $section) { // Show the "light globe" on/off echo "id&marker=0\" title=\"$strmarkedthistopic\">". - "
"; + "pixpath/i/marked.gif\" vspace=3 height=16 width=16 border=0>
"; } else { echo "id&marker=$section\" title=\"$strmarkthistopic\">". - "
"; + "pixpath/i/marker.gif\" vspace=3 height=16 width=16 border=0>
"; } if ($thissection->visible) { // Show the hide/show eye echo "id&hide=$section\" title=\"$strtopichide\">". - "
"; + "pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0>
"; } else { echo "id&show=$section\" title=\"$strtopicshow\">". - "
"; + "pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0>
"; } if ($section > 1) { // Add a arrow to move section up echo "id§ion=$section&move=-1\" title=\"$strmoveup\">". - "
"; + "pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0>
"; } if ($section < $course->numsections) { // Add a arrow to move section down echo "id§ion=$section&move=1\" title=\"$strmovedown\">". - "
"; + "pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0>
"; } } diff --git a/course/format/weeks.php b/course/format/weeks.php index 686a56fa84..4bcd202aa9 100644 --- a/course/format/weeks.php +++ b/course/format/weeks.php @@ -42,14 +42,14 @@ /// Links to people $moddata[]="id\">".get_string("participants").""; - $modicon[]="\"\""; + $modicon[]="pixpath/i/users.gif\" height=16 width=16 alt=\"\">"; $editmyprofile = "firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile").""; if ($USER->description) { $moddata[]= $editmyprofile; } else { $moddata[]= $editmyprofile." *"; } - $modicon[]="\"\""; + $modicon[]="pixpath/i/user.gif\" height=16 width=16 alt=\"\">"; print_side_block(get_string("people"), "", $moddata, $modicon); @@ -58,8 +58,10 @@ $modicon = array(); if ($modnamesused) { foreach ($modnamesused as $modname => $modfullname) { - $moddata[] = "id\">".$modnamesplural[$modname].""; - $modicon[] = "\"\""; + if ($modname != "label") { + $moddata[] = "id\">".$modnamesplural[$modname].""; + $modicon[] = "modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">"; + } } } print_side_block($stractivities, "", $moddata, $modicon); @@ -109,7 +111,7 @@ if (isediting($course->id)) { $thissection->summary .= " id\">id\">pixpath/t/edit.gif\" ". "border=0 alt=\"$streditsummary\">

"; } @@ -201,7 +203,7 @@ if (isediting($course->id)) { $thissection->summary .= " id\">". - "

"; + "pixpath/t/edit.gif\" height=11 width=11 border=0>

"; } echo text_to_html($thissection->summary); @@ -222,30 +224,30 @@ if ($displaysection == $section) { echo "id&week=all\" title=\"$strshowallweeks\">". - "
"; + "pixpath/i/all.gif\" height=25 width=16 border=0>
"; } else { $strshowonlyweek = get_string("showonlyweek", "", $section); echo "id&week=$section\" title=\"$strshowonlyweek\">". - "
"; + "pixpath/i/one.gif\" height=16 width=16 border=0>
"; } if (isediting($course->id)) { if ($thissection->visible) { // Show the hide/show eye echo "id&hide=$section\" title=\"$strweekhide\">". - "
"; + "pixpath/i/hide.gif\" vspace=3 height=16 width=16 border=0>
"; } else { echo "id&show=$section\" title=\"$strweekshow\">". - "
"; + "pixpath/i/show.gif\" vspace=3 height=16 width=16 border=0>
"; } if ($section > 1) { // Add a arrow to move section up echo "id§ion=$section&move=-1\" title=\"$strmoveup\">". - "
"; + "pixpath/t/up.gif\" vspace=3 height=11 width=11 border=0>
"; } if ($section < $course->numsections) { // Add a arrow to move section down echo "id§ion=$section&move=1\" title=\"$strmovedown\">". - "
"; + "pixpath/t/down.gif\" vspace=3 height=11 width=11 border=0>
"; } } diff --git a/course/lib.php b/course/lib.php index 714349ca72..d476ace061 100644 --- a/course/lib.php +++ b/course/lib.php @@ -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[] = " "; + $modicon[] = " pixpath/t/move.gif\" height=\"11\" width=\"11\">"; $moddata[] = "$USER->activitycopyname (wwwroot/course/mod.php?cancelcopy=true\">$strcancel)"; } @@ -548,11 +553,16 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod $extra = ""; } - $modicon[] = "wwwroot/mod/$mod->modname/icon.gif\"". - " height=\"16\" width=\"16\" alt=\"$mod->modfullname\">"; - $moddata[] = "modfullname\" $linkcss $extra". - "href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename". - "$editbuttons"; + if ($mod->modname == "label") { + $modicon[] = ""; + $moddata[] = format_text($extra, FORMAT_HTML).$editbuttons; + } else { + $modicon[] = "wwwroot/mod/$mod->modname/icon.gif\"". + " height=\"16\" width=\"16\" alt=\"$mod->modfullname\">"; + $moddata[] = "modfullname\" $linkcss $extra". + "href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename". + "$editbuttons"; + } } } } @@ -599,7 +609,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, $modinfo = unserialize($course->modinfo); - echo "
\n"; + echo "\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 ""; + if ($isediting) { + echo ""; + } + echo ""; } } } if ($ismoving) { - echo " -> id\">$strmovehere
\n"; + echo "\n"; } - echo "
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
\n"; } $instancename = urldecode($modinfo[$modnumber]->name); + if (!empty($modinfo[$modnumber]->extra)) { $extra = urldecode($modinfo[$modnumber]->extra); } else { $extra = ""; } - $linkcss = $mod->visible ? "" : " class=\"dimmed\" "; - echo "wwwroot/mod/$mod->modname/icon.gif\"". - " height=16 width=16 alt=\"$mod->modfullname\">". - " modfullname\" $linkcss $extra". - " href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename"; - } - if (isediting($course->id)) { - echo "  "; - echo make_editing_buttons($mod->id, $absolute, $mod->visible); - } - if ($mod->visible or $isteacher) { - echo "
\n"; + + if ($mod->modname == "label") { + echo format_text($extra, FORMAT_HTML); + + } else { // Normal activity + $linkcss = $mod->visible ? "" : " class=\"dimmed\" "; + echo "wwwroot/mod/$mod->modname/icon.gif\"". + " height=16 width=16 alt=\"$mod->modfullname\">". + " modfullname\" $linkcss $extra". + " href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename"; + } + echo "
"; + echo make_editing_buttons($mod->id, $absolute, $mod->visible); + echo "
-> id\">$strmovehere

\n\n"; + echo "
\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[]="wwwroot/$CFG->admin/configure.php\">".get_string("configuration")."..."; - $modicon[]="\"\""; + $modicon[]="pixpath/i/admin.gif\" height=16 width=16 alt=\"\" />"; $moddata[]="wwwroot/$CFG->admin/users.php\">".get_string("users")."..."; - $modicon[]="\"\""; + $modicon[]="pixpath/i/users.gif\" height=16 width=16 alt=\"\" />"; } if (iscreator()) { $moddata[]="wwwroot/course/index.php?edit=on\">".get_string("courses").""; - $modicon[]="\"\""; + $modicon[]="pixpath/i/course.gif\" height=16 width=16 alt=\"\" />"; $fulladmin = ""; } if (isadmin()) { $moddata[]="wwwroot/course/log.php?id=$siteid\">".get_string("logs").""; - $modicon[]="\"\""; + $modicon[]="pixpath/i/log.gif\" height=16 width=16 alt=\"\" />"; $moddata[]="wwwroot/files/index.php?id=$siteid\">".get_string("sitefiles").""; - $modicon[]="\"\""; + $modicon[]="pixpath/i/files.gif\" height=16 width=16 alt=\"\" />"; if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) { $moddata[]="wwwroot/$CFG->admin/$CFG->dbtype/frame.php\">". get_string("managedatabase").""; - $modicon[]="\"\""; + $modicon[]="pixpath/i/settings.gif\" height=16 width=16 alt=\"\" />"; } $fulladmin = "

wwwroot/$CFG->admin/\">".get_string("admin")."..."; } @@ -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[]="\"\""; + $adminicon[]="pixpath/i/edit.gif\" height=16 width=16 alt=\"\">"; if (isediting($course->id)) { $admindata[]="id&edit=off\">".get_string("turneditingoff").""; } else { $admindata[]="id&edit=on\">".get_string("turneditingon").""; } $admindata[]="id\">".get_string("settings")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/settings.gif\" height=16 width=16 alt=\"\">"; if (iscreator() or !empty($CFG->teacherassignteachers)) { if (!$course->teachers) { $course->teachers = get_string("defaultcourseteachers"); } $admindata[]="id\">$course->teachers..."; - $adminicon[]="\"\""; + $adminicon[]="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[]="id\">$course->students..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/users.gif\" height=16 width=16 alt=\"\">"; if (isteacheredit($course->id)) { $admindata[]="wwwroot/backup/backup.php?id=$course->id\">".get_string("backup")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/backup.gif\" height=16 width=16 alt=\"\">"; $admindata[]="wwwroot/files/index.php?id=$course->id&wdir=/backupdata\">".get_string("restore")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/restore.gif\" height=16 width=16 alt=\"\">"; $admindata[]="id\">".get_string("scales")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/scales.gif\" height=16 width=16 alt=\"\">"; } $admindata[]="id\">".get_string("grades")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/grades.gif\" height=16 width=16 alt=\"\">"; $admindata[]="id\">".get_string("logs")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/log.gif\" height=16 width=16 alt=\"\">"; $admindata[]="wwwroot/files/index.php?id=$course->id\">".get_string("files")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/files.gif\" height=16 width=16 alt=\"\">"; $admindata[]="wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."..."; - $adminicon[]="\"\""; + $adminicon[]="modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">"; if ($teacherforum = forum_get_course_forum($course->id, "teacher")) { $admindata[]="wwwroot/mod/forum/view.php?f=$teacherforum->id\">$teacherforum->name"; - $adminicon[]="\"\""; + $adminicon[]="modpixpath/forum/icon.gif\" height=16 width=16 alt=\"\">"; } } else if (!isguest()) { // Students menu if ($course->showgrades) { $admindata[]="id\">".get_string("grades")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/grades.gif\" height=16 width=16 alt=\"\">"; } if ($CFG->auth == "email" or $CFG->auth == "none" or $CFG->auth == "manual") { $admindata[]="wwwroot/login/change_password.php?id=$course->id\">". get_string("changepassword")."..."; - $adminicon[]="\"\""; + $adminicon[]="pixpath/i/user.gif\" height=16 width=16 alt=\"\">"; } else if ($CFG->changepassword) { $admindata[]="changepassword\">".get_string("changepassword")."..."; - $adminicon[]="\"\""; + $adminicon[]="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 = ""; + $catimage = "pixpath/i/course.gif\" width=16 height=16 border=0>"; } else { $catimage = " "; } @@ -985,22 +986,22 @@ function print_category_info($category, $depth) { echo "\n"; if ($course->guest ) { echo "wwwroot/course/view.php?id=$course->id\">"; - echo "\"\""; + echo "\"\"pixpath/i/user.gif\">"; } else { - echo "\"\""; + echo "\"\"pixpath/spacer.gif\">"; } if ($course->password) { echo "wwwroot/course/view.php?id=$course->id\">"; - echo "\"\""; + echo "\"\"pixpath/i/key.gif\">"; } else { - echo "\"\""; + echo "\"\"pixpath/spacer.gif\">"; } if ($course->summary) { link_to_popup_window ("/course/info.php?id=$course->id", "courseinfo", - "\"info\"", + "\"info\"pixpath/i/info.gif\">", 400, 500, $strsummary); } else { - echo "\"\""; + echo "\"\"pixpath/spacer.gif\">"; } echo "\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 "wwwroot/course/view.php?id=$course->id\">"; - echo "\"$strallowguests\"  "; + echo "\"$strallowguests\"pixpath/i/user.gif\">  "; } if ($course->password) { $strrequireskey = get_string("requireskey"); echo "wwwroot/course/view.php?id=$course->id\">"; - echo "\"$strrequireskey\""; + echo "\"$strrequireskey\"pixpath/i/key.gif\">"; } diff --git a/course/mod.php b/course/mod.php index d205e5ac7f..73d4a331d5 100644 --- a/course/mod.php +++ b/course/mod.php @@ -433,7 +433,9 @@ if (file_exists($modform)) { - print_heading_with_help($pageheading, "mods", $module->name); + $icon = "modpixpath/$module->name/icon.gif\"> "; + + print_heading_with_help($pageheading, "mods", $module->name, $icon); print_simple_box_start("center", "", "$THEME->cellheading"); include_once($modform); print_simple_box_end(); diff --git a/course/recent.php b/course/recent.php index e625270778..52bc752a8e 100644 --- a/course/recent.php +++ b/course/recent.php @@ -15,14 +15,6 @@ 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 = "

".user_login_string($course, $USER)."

"; @@ -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 = "modname/icon.gif\" ". + $image = "modpixpath/$mod->modname/icon.gif\" ". "height=16 width=16 alt=\"$mod->modfullname\">"; echo "

$image $mod->modfullname: ". "wwwroot/mod/$mod->modname/view.php?id=$mod->id\">". diff --git a/course/search.php b/course/search.php index 5dd76458c4..8eac25f971 100644 --- a/course/search.php +++ b/course/search.php @@ -23,12 +23,6 @@ $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, ""); diff --git a/course/view.php b/course/view.php index 165b903251..41e7a2a62c 100644 --- a/course/view.php +++ b/course/view.php @@ -60,14 +60,6 @@ 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 = "

".user_login_string($course, $USER)."

"; diff --git a/lib/setup.php b/lib/setup.php index adca64b9ac..35106df9c7 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -116,6 +116,14 @@ $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 diff --git a/lib/weblib.php b/lib/weblib.php index fdc77a3b86..0804b5e5c9 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -581,7 +581,7 @@ function replace_smilies(&$text) { if ($runonce == false){ foreach ($emoticons as $emoticon => $image){ $e[] = $emoticon; - $img[] = "\"$emoticon\"wwwroot/pix/s/$image\">"; + $img[] = "\"$emoticon\"pixpath/s/$image\">"; } $runonce = true; } @@ -871,9 +871,10 @@ function print_heading($text, $align="center", $size=3) { echo "

".stripslashes_safe($text)."

"; } -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 "

".stripslashes_safe($text); +// and optional icon attached + echo "

$icon".stripslashes_safe($text); helpbutton($helppage, $text, $module); echo "

"; } @@ -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 .= "wwwroot/pix/u/$file.png\"". - " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">"; - } else { - $output .= "wwwroot/theme/$CFG->theme/pix/u/$file.png\"". - " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">"; - } - + $output .= "pixpath/u/$file.png\"". + " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">"; } if ($link) { $output .= "
"; @@ -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 = "\"$strscales\""; 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 = "\"$strscales\""; 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 = "\"$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\"\""; } else { @@ -1526,7 +1504,11 @@ function emoticonhelpbutton($form, $field) { $SESSION->inserttextform = $form; $SESSION->inserttextfield = $field; helpbutton("emoticons", get_string("helpemoticons"), "moodle", false, true); - echo " wwwroot/pix/s/smiley.gif\" align=\"absmiddle\" width=15 height=15>"; + echo " "; + link_to_popup_window ("/help.php?module=moodle&file=emoticons.html", "popup", + "pixpath/s/smiley.gif\" border=0 align=\"absmiddle\" width=15 height=15>", + 400, 500, get_string("helpemoticons")); + echo "
"; } function notice ($message, $link="") {