MDL-19792 Upgraded calls to helpbutton, print_simple_box* and notify
[moodle.git] / blog / preferences.php
CommitLineData
4a173181 1<?php // $Id$
2 // preferences.php - user prefs for blog modeled on calendar
3
4 require_once('../config.php');
5 require_once($CFG->dirroot.'/blog/lib.php');
6
e96f2a77 7 $courseid = optional_param('courseid', SITEID, PARAM_INT);
8
9 if ($courseid == SITEID) {
10 require_login();
d9d16e56 11 $context = get_context_instance(CONTEXT_SYSTEM);
e96f2a77 12 } else {
13 require_login($courseid);
14 $context = get_context_instance(CONTEXT_COURSE, $courseid);
15 }
4a173181 16
ab2f17b0 17 if (empty($CFG->bloglevel)) {
8b141784 18 print_error('blogdisable', 'blog');
ab2f17b0 19 }
20
e96f2a77 21 require_capability('moodle/blog:view', $context);
4a173181 22
23/// If data submitted, then process and store.
24
db837673 25 if (data_submitted()) {
e96f2a77 26 $pagesize = required_param('pagesize', PARAM_INT);
4a173181 27
e96f2a77 28 if ($pagesize < 1) {
8b141784 29 print_error('invalidpagesize');
e97e16df 30 }
31 set_user_preference('blogpagesize', $pagesize);
e96f2a77 32
33 // now try to guess where to go from here ;-)
34 if ($courseid == SITEID) {
35 redirect($CFG->wwwroot.'/blog/index.php');
36 } else {
37 redirect($CFG->wwwroot.'/blog/index.php?filtertype=course&amp;filterselect='.$courseid);
38 }
4a173181 39 }
db837673 40
4a173181 41 $site = get_site();
4a173181 42
25a78406 43 $strpreferences = get_string('preferences');
e96f2a77 44 $strblogs = get_string('blogs', 'blog');
73c24ef8 45 $navlinks = array(array('name' => $strblogs, 'link' => "$CFG->wwwroot/blog/", 'type' => 'misc'));
46 $navlinks[] = array('name' => $strpreferences, 'link' => null, 'type' => 'misc');
47 $navigation = build_navigation($navlinks);
4a173181 48
e96f2a77 49 print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation);
16ba76bd 50 echo $OUTPUT->heading($strpreferences);
4a173181 51
d383a3c4 52 echo $OUTPUT->box_start('generalbox boxaligncenter');
e96f2a77 53 require('./preferences.html');
d383a3c4 54 echo $OUTPUT->box_end();
4a173181 55
033e4aff 56 echo $OUTPUT->footer();
4a173181 57?>