moodle/blog/preferences.php

57 lines
1.6 KiB
PHP
Raw Normal View History

2006-03-10 06:53:01 +00:00
<?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, SITEID);
} else {
require_login($courseid);
$context = get_context_instance(CONTEXT_COURSE, $courseid);
}
2006-03-10 06:53:01 +00:00
if (empty($CFG->bloglevel)) {
error('Blogging is disabled!');
}
require_capability('moodle/blog:view', $context);
2006-03-10 06:53:01 +00:00
/// If data submitted, then process and store.
if (data_submitted()) {
$pagesize = required_param('pagesize', PARAM_INT);
2006-03-10 06:53:01 +00:00
if ($pagesize < 1) {
error('invalid page size');
2006-03-16 07:55:22 +00:00
}
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&amp;filterselect='.$courseid);
}
2006-03-10 06:53:01 +00:00
}
2006-03-10 06:53:01 +00:00
$site = get_site();
2006-03-13 07:54:44 +00:00
$strpreferences = get_string('preferences');
$strblogs = get_string('blogs', 'blog');
2006-03-10 06:53:01 +00:00
2006-03-15 02:17:35 +00:00
$navigation = "<a href='".$CFG->wwwroot."/blog/'>$strblogs</a> -> $strpreferences";
2006-03-10 06:53:01 +00:00
print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation);
2006-03-10 06:53:01 +00:00
print_heading($strpreferences);
print_simple_box_start('center', '', '');
require('./preferences.html');
2006-03-10 06:53:01 +00:00
print_simple_box_end();
print_footer();
?>