From c7e3ac2ac28fc0835dde1ebef95c557647eb93c1 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 8 Jun 2002 06:47:33 +0000 Subject: [PATCH] Changes so that an icon can be displayed in the header --- lib/moodlelib.php | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 51dc6749cb..52a8673b1e 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -11,12 +11,14 @@ /// STANDARD WEB PAGE PARTS /////////////////////////////////////////////////// -function print_header ($title="", $heading="", $navigation="", $focus="", $meta="",$cache=true) { +function print_header ($title="", $heading="", $navigation="", $focus="", $meta="", $cache=true, $button="") { // $title - appears top of window // $heading - appears top of page // $navigation - premade navigation string // $focus - indicates form element eg inputform.password // $meta - meta tags in the header +// $cache - should this page be cacheable? +// $button - code for a button in the top-right global $USER, $CFG, $THEME; if (file_exists("$CFG->dirroot/theme/$CFG->theme/styles.css")) { @@ -168,7 +170,7 @@ function print_table($table) { function print_editing_switch($courseid) { global $CFG, $USER; - if (isadmin() || isteacher($courseid)) { + if (isteacher($courseid)) { if ($USER->editing) { echo "wwwroot/course/view.php?id=$courseid&edit=off\">Turn editing off"; } else { @@ -177,6 +179,29 @@ function print_editing_switch($courseid) { } } +function update_course_icon($courseid) { + global $CFG, $USER; + + if (isteacher($courseid)) { + if ($USER->editing) { + return "wwwroot/course/view.php?id=$courseid&edit=off\" + TARGET=_top>wwwroot/pix/i/edit.gif\" ALIGN=right BORDER=0>"; + } else { + return "wwwroot/course/view.php?id=$courseid&edit=on\" + TARGET=_top>wwwroot/pix/i/edit.gif\" ALIGN=right BORDER=0>"; + } + } +} + +function update_module_icon($moduleid) { + global $CFG; + + if (isteacher($courseid)) { + return "wwwroot/course/mod.php?update=$moduleid\" TARGET=_top>wwwroot/pix/i/edit.gif\" ALIGN=right BORDER=0>"; + } +} + function userdate($date, $format="", $timezone=99) { global $USER; @@ -875,13 +900,6 @@ function get_all_instances_in_course($modulename, $course, $sort="cw.week") { } -function print_update_module_icon($moduleid) { - global $CFG; - - echo "    - wwwroot/course/mod.php?update=$moduleid\" TARGET=_top>wwwroot/pix/t/edit.gif\" ALIGN=right BORDER=0 ALT=\"Update this module\">"; -} -- 2.39.5