fix undefined variable $context on line 135
[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
7 require_login();
4a173181 8
ab2f17b0 9 if (empty($CFG->bloglevel)) {
10 error('Blogging is disabled!');
11 }
12
db837673 13 $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
752c0c4d 14
db837673 15 // Ensure that the logged in user has the capability to view blog entries for now,
16 // because there is only $pagesize which affects the viewing ;-)
17 require_capability('moodle/blog:view', $sitecontext);
4a173181 18
19/// If data submitted, then process and store.
20
db837673 21 if (data_submitted()) {
4a173181 22
e97e16df 23 $pagesize = optional_param('pagesize', 10, PARAM_INT);
24 if ($pagesize < 1 ) {
25 error ('invalid page size');
26 }
27 set_user_preference('blogpagesize', $pagesize);
db837673 28 // the best guess is IMHO to redirect to blog page, so that user reviews the changed preferences - skodak
29 redirect($CFG->wwwroot.'/blog/index.php');
4a173181 30 }
db837673 31
4a173181 32 $site = get_site();
954cfa1b 33 $pageMeta = '' . "\n";
4a173181 34
25a78406 35 $strpreferences = get_string('preferences');
e17426ca 36 $strblogs = get_string('blogs', 'blog');
4a173181 37
e17426ca 38 $navigation = "<a href='".$CFG->wwwroot."/blog/'>$strblogs</a> -> $strpreferences";
4a173181 39
e17426ca 40 print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation, '', $pageMeta, true, '', '');
4a173181 41
42 print_heading($strpreferences);
43
44 print_simple_box_start('center', '', '');
45
450a0a7d 46 include('./preferences.html');
4a173181 47 print_simple_box_end();
48
49 print_footer();
50?>