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');
|
|
|
|
|
2006-10-06 10:11:52 +00:00
|
|
|
$courseid = optional_param('courseid', SITEID, PARAM_INT);
|
|
|
|
|
|
|
|
if ($courseid == SITEID) {
|
|
|
|
require_login();
|
2008-04-30 04:46:46 +00:00
|
|
|
$context = get_context_instance(CONTEXT_SYSTEM);
|
2006-10-06 10:11:52 +00:00
|
|
|
} else {
|
|
|
|
require_login($courseid);
|
|
|
|
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
|
|
|
}
|
2006-03-10 06:53:01 +00:00
|
|
|
|
2006-10-03 19:21:35 +00:00
|
|
|
if (empty($CFG->bloglevel)) {
|
2008-04-23 08:00:05 +00:00
|
|
|
print_error('blogdisable', 'blog');
|
2006-10-03 19:21:35 +00:00
|
|
|
}
|
|
|
|
|
2006-10-06 10:11:52 +00:00
|
|
|
require_capability('moodle/blog:view', $context);
|
2006-03-10 06:53:01 +00:00
|
|
|
|
|
|
|
/// If data submitted, then process and store.
|
|
|
|
|
2006-10-03 20:41:15 +00:00
|
|
|
if (data_submitted()) {
|
2006-10-06 10:11:52 +00:00
|
|
|
$pagesize = required_param('pagesize', PARAM_INT);
|
2006-03-10 06:53:01 +00:00
|
|
|
|
2006-10-06 10:11:52 +00:00
|
|
|
if ($pagesize < 1) {
|
2008-04-23 08:00:05 +00:00
|
|
|
print_error('invalidpagesize');
|
2006-03-16 07:55:22 +00:00
|
|
|
}
|
|
|
|
set_user_preference('blogpagesize', $pagesize);
|
2006-10-06 10:11:52 +00:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
2006-03-10 06:53:01 +00:00
|
|
|
}
|
2006-10-03 20:41:15 +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');
|
2006-10-06 10:11:52 +00:00
|
|
|
$strblogs = get_string('blogs', 'blog');
|
2007-08-16 15:01:25 +00:00
|
|
|
$navlinks = array(array('name' => $strblogs, 'link' => "$CFG->wwwroot/blog/", 'type' => 'misc'));
|
|
|
|
$navlinks[] = array('name' => $strpreferences, 'link' => null, 'type' => 'misc');
|
|
|
|
$navigation = build_navigation($navlinks);
|
2006-03-10 06:53:01 +00:00
|
|
|
|
2006-10-06 10:11:52 +00:00
|
|
|
print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation);
|
2009-08-06 08:26:20 +00:00
|
|
|
echo $OUTPUT->heading($strpreferences);
|
2006-03-10 06:53:01 +00:00
|
|
|
|
2009-08-18 04:29:42 +00:00
|
|
|
echo $OUTPUT->box_start('generalbox boxaligncenter');
|
2006-10-06 10:11:52 +00:00
|
|
|
require('./preferences.html');
|
2009-08-18 04:29:42 +00:00
|
|
|
echo $OUTPUT->box_end();
|
2006-03-10 06:53:01 +00:00
|
|
|
|
2009-08-06 14:22:50 +00:00
|
|
|
echo $OUTPUT->footer();
|
2006-03-10 06:53:01 +00:00
|
|
|
?>
|