forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preferences.php
executable file
·57 lines (43 loc) · 1.74 KB
/
preferences.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php // $Id$
// preferences.php - user prefs for blog modeled on calendar
require_once('../config.php');
require_once($CFG->dirroot.'/blog/lib.php');
$courseid = optional_param('courseid', SITEID, PARAM_INT);
if ($courseid == SITEID) {
require_login();
$context = get_context_instance(CONTEXT_SYSTEM);
} else {
require_login($courseid);
$context = get_context_instance(CONTEXT_COURSE, $courseid);
}
if (empty($CFG->bloglevel)) {
print_error('blogdisable', 'blog');
}
require_capability('moodle/blog:view', $context);
/// If data submitted, then process and store.
if (data_submitted()) {
$pagesize = required_param('pagesize', PARAM_INT);
if ($pagesize < 1) {
print_error('invalidpagesize');
}
set_user_preference('blogpagesize', $pagesize);
// now try to guess where to go from here ;-)
if ($courseid == SITEID) {
redirect($CFG->wwwroot.'/blog/index.php');
} else {
redirect($CFG->wwwroot.'/blog/index.php?filtertype=course&filterselect='.$courseid);
}
}
$site = get_site();
$strpreferences = get_string('preferences');
$strblogs = get_string('blogs', 'blog');
$navlinks = array(array('name' => $strblogs, 'link' => "$CFG->wwwroot/blog/", 'type' => 'misc'));
$navlinks[] = array('name' => $strpreferences, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation);
print_heading($strpreferences);
print_simple_box_start('center', '', '');
require('./preferences.html');
print_simple_box_end();
print_footer();
?>