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');
|
|
|
|
|
|
|
|
require_login();
|
|
|
|
global $USER;
|
|
|
|
|
|
|
|
// detemine where the user is coming from in case we need to send them back there
|
2006-03-14 02:26:44 +00:00
|
|
|
|
2006-03-16 08:22:53 +00:00
|
|
|
if (!$referrer = optional_param('referrer','', PARAM_URL)) {
|
2006-03-14 02:26:44 +00:00
|
|
|
if (isset($_SERVER['HTTP_REFERER'])) {
|
|
|
|
$referrer = $_SERVER['HTTP_REFERER'];
|
|
|
|
} else {
|
|
|
|
$referrer = $CFG->wwwroot;
|
|
|
|
}
|
2006-03-10 06:53:01 +00:00
|
|
|
}
|
|
|
|
|
2006-08-08 05:13:06 +00:00
|
|
|
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
|
|
|
|
|
|
|
// Ensure that the logged in user has the capability to post blog entries.
|
2006-08-14 05:55:40 +00:00
|
|
|
if (!has_capability('moodle/blog:writepost', $context)) {
|
2006-08-08 05:13:06 +00:00
|
|
|
error(get_string('nopost', 'blog'), $referrer);
|
2006-03-10 06:53:01 +00:00
|
|
|
}
|
|
|
|
$userid = $USER->id;
|
|
|
|
|
|
|
|
/// If data submitted, then process and store.
|
|
|
|
|
2006-05-17 16:47:44 +00:00
|
|
|
if ($post = data_submitted()) {
|
2006-03-10 06:53:01 +00:00
|
|
|
|
2006-03-16 07:55:22 +00:00
|
|
|
$pagesize = optional_param('pagesize', 10, PARAM_INT);
|
|
|
|
if ($pagesize < 1 ) {
|
|
|
|
error ('invalid page size');
|
|
|
|
}
|
|
|
|
set_user_preference('blogpagesize', $pagesize);
|
2006-03-10 06:53:01 +00:00
|
|
|
redirect($referrer, get_string('changessaved'), 1);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$site = get_site();
|
2006-03-14 02:46:46 +00:00
|
|
|
$pageMeta = '' . "\n";
|
2006-03-10 06:53:01 +00:00
|
|
|
|
2006-03-13 07:54:44 +00:00
|
|
|
$strpreferences = get_string('preferences');
|
2006-03-15 02:17:35 +00:00
|
|
|
$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
|
|
|
|
2006-03-15 02:17:35 +00:00
|
|
|
print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation, '', $pageMeta, true, '', '');
|
2006-03-10 06:53:01 +00:00
|
|
|
|
|
|
|
print_heading($strpreferences);
|
|
|
|
|
|
|
|
print_simple_box_start('center', '', '');
|
|
|
|
|
2006-05-17 16:47:44 +00:00
|
|
|
include('./preferences.html');
|
2006-03-10 06:53:01 +00:00
|
|
|
print_simple_box_end();
|
|
|
|
|
|
|
|
print_footer();
|
|
|
|
?>
|