Added 'studentview' button to course page.

This commit is contained in:
thepurpleblob 2005-08-15 12:54:46 +00:00
parent 367b841305
commit 15ffee79b5

View File

@ -8,9 +8,10 @@
$id = optional_param('id', 0, PARAM_INT);
$name = optional_param('name');
$edit = optional_param('edit');
$edit = optional_param('edit','',PARAM_ALPHA);
$idnumber = optional_param('idnumber');
$topic = optional_param('topic',0,PARAM_INT);
$studentview = optional_param('studentview','',PARAM_ALPHA);
if (empty($id) && empty($name)) {
error("Must specify course id or short name");
@ -59,10 +60,19 @@
$USER->editing = false;
}
if (!isset($USER->studentview)) {
$USER->studentview = false;
}
// need to check this here, as studentview=on disables edit allowed (where 'on' is checked)
if (($studentview == 'off') and confirm_sesskey()) {
$USER->studentview = false;
}
if ($PAGE->user_allowed_editing()) {
if ($edit == 'on') {
if (($edit == 'on') and confirm_sesskey()) {
$USER->editing = true;
} else if ($edit == 'off') {
} else if (($edit == 'off') and confirm_sesskey()) {
$USER->editing = false;
if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
$USER->activitycopy = false;
@ -70,6 +80,11 @@
}
}
if (($studentview == 'on') and confirm_sesskey()) {
$USER->studentview = true;
$USER->editing = false;
}
if (isset($hide) && confirm_sesskey()) {
set_section_visible($course->id, $hide, '0');
}
@ -126,4 +141,4 @@
echo '</div>'; // content wrapper end
print_footer(NULL, $course);
?>
?>