Professional Documents
Culture Documents
Index10 PHP
Index10 PHP
Index10 PHP
php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* My Moodle -- a user's personal dashboard
*
* - each user can currently have their own page (cloned from system and then
customised)
* - only the user can see their own dashboard
* - users can add any blocks they want
* - the administrators can define a default site dashboard for users who have
* not created their own dashboard
*
* This script implements the user's view of the dashboard, and allows editing
* of the dashboard.
*
* @package moodlecore
* @subpackage my
* @copyright 2010 Remote-Learner.net
* @author Hubert Chathi <hubert@remote-learner.net>
* @author Olav Jordan <olav.jordan@remote-learner.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once($CFG->dirroot . '/my/lib.php');
redirect_if_major_upgrade_required();
require_login();
$strmymoodle = get_string('myhome');
$userid = null;
$USER->editing = $edit = 0; // Just in case
$context = context_system::instance();
$PAGE->set_blocks_editing_capability('moodle/my:configsyspages'); //
unlikely :)
$header = "$SITE->shortname: $strmymoodle (GUEST)";
$pagetitle = $header;
// Get the My Moodle page info. Should always return something unless the database
is broken.
if (!$currentpage = my_get_page($userid, MY_PAGE_PRIVATE)) {
print_error('mymoodlesetup');
}
$resetbutton = '';
$resetstring = get_string('resetpage', 'my');
$reseturl = new moodle_url("$CFG->wwwroot/my/index.php", array('edit' => 1,
'reset' => 1));
if (!$currentpage->userid) {
// viewing a system page -- let the user customise it
$editstring = get_string('updatemymoodleon');
$params['edit'] = 1;
} else if (empty($edit)) {
$editstring = get_string('updatemymoodleon');
} else {
$editstring = get_string('updatemymoodleoff');
$resetbutton = $OUTPUT->single_button($reseturl, $resetstring);
}
} else {
$USER->editing = $edit = 0;
}
echo $OUTPUT->header();
echo $OUTPUT->custom_block_region('content');
echo $OUTPUT->footer();