Skip to content

Commit

Permalink
Simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Mar 16, 2006
1 parent 3daaa61 commit aad6de9
Showing 1 changed file with 6 additions and 41 deletions.
47 changes: 6 additions & 41 deletions blog/set_session_vars.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,14 @@
/// inspired/taken from moodle calendar module's set.php file

require_once('../config.php');
require_once('lib.php');

$referrer = required_param('referrer', PARAM_NOTAGS);
$var = required_param('var',PARAM_ALPHA);
$value = optional_param('value','', PARAM_NOTAGS);
$userid = optional_param('userid',0 , PARAM_INT);
$courseid = optional_param('courseid',0, PARAM_INT);
$d = optional_param('d', 0, PARAM_INT);
$m = optional_param('m', 0, PARAM_INT);
$y = optional_param('y', 0, PARAM_INT);
$id = optional_param('id', 0, PARAM_INT);
$referrer = required_param('referrer', PARAM_URL);

switch($var) {
case 'setcourse':
$id = intval($id);
if($id == 0) {
$SESSION->cal_courses_shown = array();
calendar_set_referring_course(0);
}
else if($id == 1) {
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
calendar_set_referring_course(0);
}
else {
// We don't check for membership anymore: if(isstudent($id, $USER->id) || isteacher($id, $USER->id)) {
if(get_record('course', 'id', $id) === false) {
// There is no such course
$SESSION->cal_courses_shown = array();
calendar_set_referring_course(0);
}
else {
calendar_set_referring_course($id);
$SESSION->cal_courses_shown = $id;
}
}
break;
case 'setcategory':
break;
case 'setblog':
break;
case 'showediting':
$SESSION->blog_editing_enabled = !$SESSION->blog_editing_enabled;
break;
if (isset($SESSION->blog_editing_enabled)) {
$SESSION->blog_editing_enabled = !$SESSION->blog_editing_enabled;
} else {
$SESSION->blog_editing_enabled = true;
}

redirect($referrer);
?>

0 comments on commit aad6de9

Please sign in to comment.