Permalink
Browse files

Changes so that an icon can be displayed in the header

  • Loading branch information...
1 parent 65adacc commit c7e3ac2ac28fc0835dde1ebef95c557647eb93c1 martin committed Jun 8, 2002
Showing with 27 additions and 9 deletions.
  1. +27 −9 lib/moodlelib.php
View
@@ -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 "<A HREF=\"$CFG->wwwroot/course/view.php?id=$courseid&edit=off\">Turn editing off</A>";
} 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 "<A TITLE=\"Turn editing OFF\" HREF=\"$CFG->wwwroot/course/view.php?id=$courseid&edit=off\"
+ TARGET=_top><IMG SRC=\"$CFG->wwwroot/pix/i/edit.gif\" ALIGN=right BORDER=0></A>";
+ } else {
+ return "<A TITLE=\"Turn editing ON\" HREF=\"$CFG->wwwroot/course/view.php?id=$courseid&edit=on\"
+ TARGET=_top><IMG SRC=\"$CFG->wwwroot/pix/i/edit.gif\" ALIGN=right BORDER=0></A>";
+ }
+ }
+}
+
+function update_module_icon($moduleid) {
+ global $CFG;
+
+ if (isteacher($courseid)) {
+ return "<A TITLE=\"Edit this activity\" HREF=\"$CFG->wwwroot/course/mod.php?update=$moduleid\" TARGET=_top><IMG
+ SRC=\"$CFG->wwwroot/pix/i/edit.gif\" ALIGN=right BORDER=0></A>";
+ }
+}
+
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 "&nbsp; &nbsp;
- <A HREF=\"$CFG->wwwroot/course/mod.php?update=$moduleid\" TARGET=_top><IMG
- SRC=\"$CFG->wwwroot/pix/t/edit.gif\" ALIGN=right BORDER=0 ALT=\"Update this module\"></A>";
-}

0 comments on commit c7e3ac2

Please sign in to comment.