2 // preferences.php - user prefs for blog modeled on calendar
4 require_once('../config.php');
5 require_once($CFG->dirroot
.'/blog/lib.php');
7 $courseid = optional_param('courseid', SITEID
, PARAM_INT
);
9 if ($courseid == SITEID
) {
11 $context = get_context_instance(CONTEXT_SYSTEM
, SITEID
);
13 require_login($courseid);
14 $context = get_context_instance(CONTEXT_COURSE
, $courseid);
17 if (empty($CFG->bloglevel
)) {
18 error('Blogging is disabled!');
21 require_capability('moodle/blog:view', $context);
23 /// If data submitted, then process and store.
25 if (data_submitted()) {
26 $pagesize = required_param('pagesize', PARAM_INT
);
29 error('invalid page size');
31 set_user_preference('blogpagesize', $pagesize);
33 // now try to guess where to go from here ;-)
34 if ($courseid == SITEID
) {
35 redirect($CFG->wwwroot
.'/blog/index.php');
37 redirect($CFG->wwwroot
.'/blog/index.php?filtertype=course&filterselect='.$courseid);
43 $strpreferences = get_string('preferences');
44 $strblogs = get_string('blogs', 'blog');
46 $navigation = "<a href='".$CFG->wwwroot
."/blog/'>$strblogs</a> -> $strpreferences";
48 print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation);
49 print_heading($strpreferences);
51 print_simple_box_start('center', '', '');
52 require('./preferences.html');
53 print_simple_box_end();