$pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
if (!isset($USER->editing)) {
- $USER->editing = false;
+ $USER->editing = 0;
}
if (!isset($USER->studentview)) {
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;
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;
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\" />".
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\" />".
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%');
$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
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
/// 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 => '');
}
- $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);