]> git.mjollnir.org Git - moodle.git/commitdiff
block editing now uses PARAM_BOOL
authorskodak <skodak>
Sun, 23 Apr 2006 20:58:06 +0000 (20:58 +0000)
committerskodak <skodak>
Sun, 23 Apr 2006 20:58:06 +0000 (20:58 +0000)
course/view.php
lib/weblib.php
mod/chat/view.php
mod/data/view.php
mod/quiz/view.php
mod/resource/lib.php
my/index.php

index f58e65218b7360422be30a1f534226d0d9f233c6..d9afd08fd0b24815c4408fac867f93bf87692e50 100644 (file)
@@ -62,7 +62,7 @@
     $pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
 
     if (!isset($USER->editing)) {
-        $USER->editing = false;
+        $USER->editing = 0;
     }
 
     if (!isset($USER->studentview)) {
@@ -76,9 +76,9 @@
 
     if ($PAGE->user_allowed_editing()) {
         if (($edit == 1) and confirm_sesskey()) {
-            $USER->editing = true;
+            $USER->editing = 1;
         } else if (($edit == 0) and confirm_sesskey()) {
-            $USER->editing = false;
+            $USER->editing = 0;
             if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
                 $USER->activitycopy       = false;
                 $USER->activitycopycourse = NULL;
@@ -87,7 +87,7 @@
 
         if (($studentview == 1) and confirm_sesskey()) {
             $USER->studentview = true;
-            $USER->editing = false;
+            $USER->editing = 0;
         }
 
         if ($hide && confirm_sesskey()) {
             }
         }
     } else {
-        $USER->editing = false;
+        $USER->editing = 0;
     }
 
     $SESSION->fromdiscussion = $CFG->wwwroot .'/course/view.php?id='. $course->id;
index c65d345693ca86f03ed0a3341220fd794ccf749f..a86b59902d3a538918875a101d6fa6e29c3255f4 100644 (file)
@@ -3372,10 +3372,10 @@ function update_course_icon($courseid) {
     if (isteacheredit($courseid)) {
         if (!empty($USER->editing)) {
             $string = get_string('turneditingoff');
-            $edit = 'off';
+            $edit = '0';
         } else {
             $string = get_string('turneditingon');
-            $edit = 'on';
+            $edit = '1';
         }
         return "<form target=\"$CFG->framename\" method=\"get\" action=\"$CFG->wwwroot/course/view.php\">".
             "<input type=\"hidden\" name=\"id\" value=\"$courseid\" />".
@@ -3429,10 +3429,10 @@ function update_mymoodle_icon() {
 
     if (!empty($USER->editing)) {
         $string = get_string('updatemymoodleoff');
-        $edit = 'off';
+        $edit = '0';
     } else {
         $string = get_string('updatemymoodleon');
-        $edit = 'on';
+        $edit = '1';
     }
     return "<form target=\"$CFG->framename\" method=\"get\" action=\"$CFG->wwwroot/my/index.php\">".
         "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
index 80f51bfc68e9864475574045cc41eac67a3883ed..e6f73a1279d8672aac42a2fbfcc950ae82ecd1a2 100644 (file)
@@ -7,9 +7,9 @@
     require_once($CFG->libdir.'/blocklib.php');
     require_once('pagelib.php');
 
-    $id          = optional_param('id', 0, PARAM_INT);
-    $c           = optional_param('c', 0, PARAM_INT);
-    $edit        = optional_param('edit', '');
+    $id   = optional_param('id', 0, PARAM_INT);
+    $c    = optional_param('c', 0, PARAM_INT);
+    $edit = optional_param('edit', -1, PARAM_BOOL);
 
     if ($id) {
         if (! $cm = get_record('course_modules', 'id', $id)) {
     $strcurrentusers = get_string('currentusers', 'chat');
     $strnextsession  = get_string('nextsession', 'chat');
 
-    if (!empty($edit) && $PAGE->user_allowed_editing()) {
-        if ($edit == 'on') {
-            $USER->editing = true;
-        } else if ($edit == 'off') {
-            $USER->editing = false;
-        }
+    if (($edit != -1) and $PAGE->user_allowed_editing()) {
+        $USER->editing = $edit;
     }
 
     $PAGE->print_header($course->shortname.': %fullname%');
index 5f0fa85e3abd1b0ca5b489d4670c30ee94223e5b..4eca3b4406019338a1a561ab4802eb13e6ab04d1 100755 (executable)
@@ -37,6 +37,7 @@
 
     $mode  = optional_param('mode', '', PARAM_ALPHA);    // Force the browse mode  ('single')
 
+    $edit = optional_param('edit', -1, PARAM_BOOL);
 
 /// These can be added to perform an action on a record
     $approve = optional_param('approve', 0, PARAM_INT);    //approval recordid
     $pageblocks = blocks_setup($PAGE);
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
 
-    if (!empty($edit) && $PAGE->user_allowed_editing()) {
-        if ($edit == 'on') {
-            $USER->editing = true;
-        } else if ($edit == 'off') {
-            $USER->editing = false;
-        }
+    if (($edit != -1) and $PAGE->user_allowed_editing()) {
+        $USER->editing = $edit;
     }
 
 /// RSS and CSS meta
index 74257d0859191ab2714c6152232101d3589f4751..d408728d3c346f35f36ba8c2203ad759fb3c8cb2 100644 (file)
@@ -7,9 +7,9 @@
     require_once($CFG->libdir.'/blocklib.php');
     require_once('pagelib.php');
 
-    $id          = optional_param('id', 0, PARAM_INT); // Course Module ID, or
-    $q           = optional_param('q',  0, PARAM_INT);  // quiz ID
-    $edit        = optional_param('edit', '');
+    $id   = optional_param('id', 0, PARAM_INT); // Course Module ID, or
+    $q    = optional_param('q',  0, PARAM_INT);  // quiz ID
+    $edit = optional_param('edit', -1, PARAM_BOOL);
     
     if ($id) {
         if (! $cm = get_record("course_modules", "id", $id)) {
 
 // Print the page header
 
-    if (!empty($edit) && $PAGE->user_allowed_editing()) {
-        if ($edit == 'on') {
-            $USER->editing = true;
-        } else if ($edit == 'off') {
-            $USER->editing = false;
-        }
+    if (($edit != -1) and $PAGE->user_allowed_editing()) {
+        $USER->editing = $edit;
     }
 
     //only check pop ups if the user is not a teacher, and popup is set
index eb53723f68a670a1a8d1cd68b6126b28e0acd658..9c515d544749ca7f82e9b39a7a463c357376fadc 100644 (file)
@@ -148,13 +148,12 @@ function display_course_blocks_start() {
 
 /// Print the page header
 
-    if (!empty($edit) && $PAGE->user_allowed_editing()) {
-        if ($edit == 'on') {
-            $USER->editing = true;
-        } else if ($edit == 'off') {
-            $USER->editing = false;
-        }
+    $edit = optional_param('edit', -1, PARAM_BOOL);
+
+    if (($edit != -1) and $PAGE->user_allowed_editing()) {
+        $USER->editing = $edit;
     }
+
     $morebreadcrumbs = array($this->strresources   => 'index.php?id='.$this->course->id,
                              $this->resource->name => '');
 
index 5721d8dc30bcf8d1b0e5dcfdee2e5d18df37f394..74672501440bf3a43f7a344b751671f18b06da54 100644 (file)
     }
 
 
-    $edit        = optional_param('edit', '');
-    $blockaction = optional_param('blockaction');
+    $edit        = optional_param('edit', -1, PARAM_BOOL);
+    $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
 
     $PAGE = page_create_instance($USER->id);
 
     $pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
 
-    if (!empty($edit) && $PAGE->user_allowed_editing()) {
-        if ($edit == 'on') {
-            $USER->editing = true;
-        } else if ($edit == 'off') {
-            $USER->editing = false;
-        }
+    if (($edit != -1) and $PAGE->user_allowed_editing()) {
+        $USER->editing = $edit;
     }
 
     $PAGE->print_header($mymoodlestr);