Exemple #1
0
    // Course managers can be browsed at site level. If not forceloginforprofiles, allow access (bug #4366).
    $struser = get_string('user');
    $PAGE->set_context(context_system::instance());
    $PAGE->set_title("$SITE->shortname: $struser");  // Do not leak the name.
    $PAGE->set_heading($struser);
    $PAGE->set_url('/user/profile.php', array('id' => $userid));
    $PAGE->navbar->add($struser);
    echo $OUTPUT->header();
    echo $OUTPUT->notification(get_string('usernotavailable', 'error'));
    echo $OUTPUT->footer();
    exit;
}

// Get the profile page.  Should always return something unless the database is broken.
if (!$currentpage = my_get_page($userid, MY_PAGE_PUBLIC)) {
    print_error('mymoodlesetup');
}

$PAGE->set_context($context);
$PAGE->set_pagelayout('mypublic');
$PAGE->set_pagetype('user-profile');

// Set up block editing capabilities.
if (isguestuser()) {     // Guests can never edit their profile.
    $USER->editing = $edit = 0;  // Just in case.
    $PAGE->set_blocks_editing_capability('moodle/my:configsyspages');  // unlikely :).
} else {
    if ($currentuser) {
        $PAGE->set_blocks_editing_capability('moodle/user:manageownblocks');
    } else {
Exemple #2
0
    $context = context_system::instance();
    $PAGE->set_blocks_editing_capability('moodle/my:configsyspages');
    // unlikely :)
    $header = "{$SITE->shortname}: {$strmymoodle} (GUEST)";
    $pagetitle = $header;
} else {
    // We are trying to view or edit our own My Moodle page
    $userid = $USER->id;
    // Owner of the page
    $context = context_user::instance($USER->id);
    $PAGE->set_blocks_editing_capability('moodle/my:manageblocks');
    $header = fullname($USER);
    $pagetitle = $strmymoodle;
}
// 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');
}
// desde aqui se debe configurar la pag
$params = array();
$PAGE->set_context($context);
$PAGE->set_url('/local/wellness/salapesas.php', $params);
$PAGE->set_pagelayout('mydashboard');
$PAGE->set_pagetype('local-salapesas-index');
$PAGE->blocks->add_region('content');
$PAGE->set_subpage($currentpage->id);
$PAGE->set_title('Rutinas');
$PAGE->set_heading($header);
$PAGE->navbar->add(get_string('navrutinas', 'local_wellness'), new moodle_url('/local/wellness/salapesas.php'));
$userid = $USER->id;
$usermail = $USER->email;
Exemple #3
0
 * This script allows the site administrator to edit the default site
 * profile.
 *
 * @package    core_user
 * @copyright  2010 Remote-Learner.net
 * @author     Hubert Chathi <*****@*****.**>
 * @author     Olav Jordan <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../config.php';
require_once $CFG->dirroot . '/my/lib.php';
require_once $CFG->libdir . '/adminlib.php';
$edit = optional_param('edit', null, PARAM_BOOL);
// Turn editing on and off.
require_login();
$header = "{$SITE->shortname}: " . get_string('publicprofile') . " (" . get_string('myprofile', 'admin') . ")";
$PAGE->set_blocks_editing_capability('moodle/my:configsyspages');
admin_externalpage_setup('profilepage', '', null, '', array('pagelayout' => 'mypublic'));
// Override pagetype to show blocks properly.
$PAGE->set_pagetype('user-profile');
$PAGE->set_title($header);
$PAGE->set_heading($header);
$PAGE->blocks->add_region('content');
// Get the Public Profile page info.  Should always return something unless the database is broken.
if (!($currentpage = my_get_page(null, MY_PAGE_PUBLIC))) {
    print_error('publicprofilesetup');
}
$PAGE->set_subpage($currentpage->id);
echo $OUTPUT->header();
echo $OUTPUT->custom_block_region('content');
echo $OUTPUT->footer();
Exemple #4
0
function my_reset_page($userid, $private = MY_PAGE_PRIVATE, $pagetype = 'my-index')
{
    global $DB, $CFG;
    $page = my_get_page($userid, $private);
    if ($page->userid == $userid) {
        $context = context_user::instance($userid);
        if ($blocks = $DB->get_records('block_instances', array('parentcontextid' => $context->id, 'pagetypepattern' => $pagetype))) {
            foreach ($blocks as $block) {
                if (is_null($block->subpagepattern) || $block->subpagepattern == $page->id) {
                    blocks_delete_instance($block);
                }
            }
        }
        $DB->delete_records('my_pages', array('id' => $page->id));
    }
    // Get the system default page
    if (!($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => $private)))) {
        return false;
        // error
    }
    // Trigger dashboard has been reset event.
    $eventparams = array('context' => context_user::instance($userid), 'other' => array('private' => $private, 'pagetype' => $pagetype));
    $event = \core\event\dashboard_reset::create($eventparams);
    $event->trigger();
    return $systempage;
}
Exemple #5
0
function my_reset_page($userid, $private = MY_PAGE_PRIVATE, $pagetype = 'my-index')
{
    global $DB, $CFG;
    $page = my_get_page($userid, $private);
    if ($page->userid == $userid) {
        $context = context_user::instance($userid);
        if ($blocks = $DB->get_records('block_instances', array('parentcontextid' => $context->id, 'pagetypepattern' => $pagetype))) {
            foreach ($blocks as $block) {
                if (is_null($block->subpagepattern) || $block->subpagepattern == $page->id) {
                    blocks_delete_instance($block);
                }
            }
        }
        $DB->delete_records('my_pages', array('id' => $page->id));
    }
    // Get the system default page
    if (!($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => $private)))) {
        return false;
        // error
    }
    return $systempage;
}
 * of the dashboard.
 *
 * @package    moodlecore
 * @subpackage my
 * @copyright  2010 Remote-Learner.net
 * @author     Hubert Chathi <*****@*****.**>
 * @author     Olav Jordan <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../config.php';
require_once $CFG->dirroot . '/my/lib.php';
require_once $CFG->libdir . '/adminlib.php';
$edit = optional_param('edit', null, PARAM_BOOL);
// Turn editing on and off
require_login();
$header = "{$SITE->shortname}: " . get_string('myhome') . " (" . get_string('mypage', 'admin') . ")";
$PAGE->set_blocks_editing_capability('moodle/my:configsyspages');
admin_externalpage_setup('mypage', '', null, '', array('pagelayout' => 'mydashboard'));
// Override pagetype to show blocks properly.
$PAGE->set_pagetype('my-index');
$PAGE->set_title($header);
$PAGE->set_heading($header);
$PAGE->blocks->add_region('content');
// Get the My Moodle page info.  Should always return something unless the database is broken.
if (!($currentpage = my_get_page(null, MY_PAGE_PRIVATE))) {
    print_error('mymoodlesetup');
}
$PAGE->set_subpage($currentpage->id);
echo $OUTPUT->header();
echo $OUTPUT->custom_block_region('content');
echo $OUTPUT->footer();