本文整理汇总了PHP中my_get_page函数的典型用法代码示例。如果您正苦于以下问题:PHP my_get_page函数的具体用法?PHP my_get_page怎么用?PHP my_get_page使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_get_page函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_string
// 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 {
示例2: fullname
$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;
示例3: dirname
* This script allows the site administrator to edit the default site
* profile.
*
* @package core_user
* @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 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();
示例4: my_reset_page
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;
}
示例5: my_reset_page
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;
}
示例6: dirname
* 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 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();