本文整理汇总了PHP中page_map_class函数的典型用法代码示例。如果您正苦于以下问题:PHP page_map_class函数的具体用法?PHP page_map_class怎么用?PHP page_map_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了page_map_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page_create_object
/**
* Factory function page_create_object(). Called with a pagetype identifier and possibly with
* its numeric ID. Returns a fully constructed page_base subclass you can work with.
*/
function page_create_object($type, $id = NULL)
{
global $CFG;
$data = new stdClass();
$data->pagetype = $type;
$data->pageid = $id;
$classname = page_map_class($type);
$object = new $classname();
// TODO: subclassing check here
if ($object->get_type() !== $type) {
// Somehow somewhere someone made a mistake
debugging('Page object\'s type (' . $object->get_type() . ') does not match requested type (' . $type . ')');
}
$object->init_quick($data);
return $object;
}
示例2: define
require_once $CFG->dirroot . '/course/lib.php';
// Needed for some blocks
require_once $CFG->dirroot . '/course/format/page/pagelib.php';
// Needed for inheritance
if (!defined('BLOCK_POS_CENTER')) {
define('BLOCK_POS_CENTER', 'c');
}
if (defined('ADMIN_STICKYBLOCKS')) {
define('PAGE_FORMAT_LEARNING', 'format_learning');
page_map_class(PAGE_FORMAT_LEARNING, 'format_learning');
}
/**
* Remapping PAGE_COURSE_VIEW to format_page class
*
**/
page_map_class(PAGE_COURSE_VIEW, 'format_learning');
/**
* Add the page types defined in this file
*
**/
$DEFINEDPAGES = array(PAGE_COURSE_VIEW);
/**
* Class that models the behavior of a format page
*
* @package format_page
**/
class format_learning extends format_page
{
/**
* Prints the tabs for the learning path type
*
示例3: get_format_name
function get_format_name()
{
return MYVIEW_MOODLE_FORMAT;
}
}
/**
* Returns a turn edit on/off button for course in a self contained form.
* Used to be an icon, but it's now a simple form button
*
* @uses $CFG
* @uses $USER
* @param int $courseid The course to update by id as found in 'course' table
* @return string
*/
function update_myviewmoodle_icon()
{
global $CFG, $USER;
if (!empty($USER->editing)) {
$string = get_string('updatemymoodleoff');
$edit = '0';
} else {
$string = get_string('updatemymoodleon');
$edit = '1';
}
return "<form {$CFG->frametarget} method=\"get\" action=\"{$CFG->wwwroot}/myview/index.php\">" . "<div>" . "<input type=\"hidden\" name=\"edit\" value=\"{$edit}\" />" . "<input type=\"submit\" value=\"{$string}\" /></div></form>";
}
define('PAGE_MYVIEW_MOODLE', 'myview-index');
define('MYVIEW_MOODLE_FORMAT', 'myview');
//doing this so we don't run into problems with applicable formats.
page_map_class(PAGE_MYVIEW_MOODLE, 'page_myview_moodle');
示例4: get_format_name
}
return $instance->position;
}
function get_format_name()
{
return TAG_FORMAT;
}
//----------- printing funtions -----------
function print_header()
{
global $USER, $CFG;
$tag = $this->tag_object;
$tagname = tag_display_name($tag);
$navlinks = array();
$navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
$navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
$navigation = build_navigation($navlinks);
$title = get_string('tag', 'tag') . ' - ' . $tagname;
$button = '';
if ($this->user_allowed_editing()) {
$button = update_tag_button($this->id);
}
print_header_simple($title, '', $navigation, '', '', '', $button);
}
function print_footer()
{
print_footer();
}
}
page_map_class(PAGE_TAG_INDEX, 'page_tag');
示例5: page_create_object
/**
* @deprecated since Moodle 2.0
* Do not use this any more. The global $PAGE is automatically created for you.
* If you need custom behaviour, you should just set properties of that object.
*/
function page_create_object($type, $id = NULL) {
global $CFG, $PAGE, $SITE, $ME;
debugging('Call to deprecated function page_create_object.', DEBUG_DEVELOPER);
$data = new stdClass;
$data->pagetype = $type;
$data->pageid = $id;
$classname = page_map_class($type);
if (!$classname) {
return $PAGE;
}
$legacypage = new $classname;
$legacypage->init_quick($data);
$course = $PAGE->course;
if ($course->id != $SITE->id) {
$legacypage->set_course($course);
} else {
try {
$category = $PAGE->category;
} catch (coding_exception $e) {
// Was not set before, so no need to try to set it again.
$category = false;
}
if ($category) {
$legacypage->set_category_by_id($category->id);
} else {
$legacypage->set_course($SITE);
}
}
$legacypage->set_pagetype($type);
$legacypage->set_url($ME);
$PAGE->set_url(str_replace($CFG->wwwroot . '/', '', $legacypage->url_get_full()));
$PAGE->set_pagetype($type);
$PAGE->set_legacy_page_object($legacypage);
return $PAGE;
}
示例6: define
<?php
// $Id: pagelib.php,v 1.5 2012/07/25 11:16:04 bdaloukas Exp $
require_once $CFG->libdir . '/pagelib.php';
require_once $CFG->dirroot . '/course/lib.php';
// needed for some blocks
define('PAGE_GAME_VIEW', 'mod-game-view');
page_map_class(PAGE_GAME_VIEW, 'page_game');
$DEFINEDPAGES = array(PAGE_GAME_VIEW);
/**
* Class that models the behavior of a game
*
* @author Jon Papaioannou
* @package pages
*/
class page_game extends page_generic_activity
{
function init_quick($data)
{
if (empty($data->pageid)) {
print_error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'game';
parent::init_quick($data);
}
function print_header($title, $morebreadcrumbs = NULL, $navigation = '')
{
global $USER, $CFG;
$this->init_full();
$replacements = array('%fullname%' => format_string($this->activityrecord->name));
foreach ($replacements as $search => $replace) {
示例7: define
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License version 2 as //
// published by the Free Software Foundation. //
// //
// This program 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: //
// //
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once $CFG->libdir . '/pagelib.php';
define('PAGE_bigbluebutton_VIEW', 'mod-bigbluebutton-view');
page_map_class(PAGE_bigbluebutton_VIEW, 'page_bigbluebutton');
$DEFINEDPAGES = array(PAGE_bigbluebutton_VIEW);
/**
* Class that models the behavior of a Web conference
*
* @package pages
*/
class page_bigbluebutton extends page_generic_activity
{
function init_quick($data)
{
if (empty($data->pageid)) {
error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'bigbluebutton';
parent::init_quick($data);
示例8: print_header
{
return PAGE_MY_COLLABORATION;
}
function print_header($title)
{
global $USER, $CFG;
$replacements = array('%fullname%' => get_string('mycollaboration', 'local'));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
$site = get_site();
$nav = get_string('mycollaboration', 'local');
$header = $site->shortname . ': ' . $nav;
$navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
print_header($title, $header, $navigation, '', '', true);
}
function url_get_path()
{
global $CFG;
page_id_and_class($id, $class);
if ($id == PAGE_MY_MOODLE) {
return $CFG->wwwroot . '/my/local/collaboration.php';
} elseif (defined('ADMIN_STICKYBLOCKS')) {
return $CFG->wwwroot . '/' . $CFG->admin . '/stickyblocks.php';
}
}
}
define('PAGE_MY_COLLABORATION', 'my-collaboration');
page_map_class(PAGE_MY_COLLABORATION, 'page_my_collaboration');
示例9: define
<?php
// $Id: pagelib.php,v 1.10 2007/04/16 20:59:17 mattc-catalyst Exp $
require_once $CFG->libdir . '/pagelib.php';
define('PAGE_CHAT_VIEW', 'mod-chat-view');
page_map_class(PAGE_CHAT_VIEW, 'page_chat');
$DEFINEDPAGES = array(PAGE_CHAT_VIEW);
/**
* Class that models the behavior of a chat
*
* @author Jon Papaioannou
* @package pages
*/
class page_chat extends page_generic_activity
{
function init_quick($data)
{
if (empty($data->pageid)) {
error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'chat';
parent::init_quick($data);
}
function get_type()
{
return PAGE_CHAT_VIEW;
}
}
示例10: url_get_parameters
}
return '';
}
function url_get_parameters()
{
if (defined('ADMIN_STICKYBLOCKS')) {
return array('pt' => 'tao');
}
}
function print_header($title, $morenavlinks = NULL)
{
$nav = build_navigation($morenavlinks);
print_header($title, $title, $nav);
}
}
page_map_class('tao', 'tao_page_class_hack');
/**
* local footer hook. nothing yet but this could print right blocks
*/
function tao_local_footer_hook()
{
if (!defined('TAO_HEADER_OVERRIDDEN')) {
return;
}
echo '</td></tr></table>';
}
/**
* print out the TAO nav section
*/
function tao_print_static_nav($return = false)
{
示例11: define
<?php
require_once $CFG->libdir . '/pagelib.php';
require_once $CFG->dirroot . '/course/lib.php';
// needed for some blocks
define('PAGE_FORUMNG_VIEW', 'mod-forumng-view');
page_map_class(PAGE_FORUMNG_VIEW, 'page_forumng_view');
$DEFINEDPAGES = array(PAGE_FORUMNG_VIEW);
class page_forumng_view extends page_generic_activity
{
function get_type()
{
return PAGE_FORUMNG_VIEW;
}
function init_quick($data)
{
if (empty($data->pageid)) {
error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'forumng';
parent::init_quick($data);
}
function init_full()
{
global $CURRENTFORUM;
if ($this->full_init_done) {
return;
}
$this->modulerecord = $CURRENTFORUM->get_course_module();
$this->modulerecord->section = get_field('course_modules', 'section', 'id', $this->modulerecord->id);
$this->courserecord = $CURRENTFORUM->get_course();
示例12: empty
// Bounds for block widths
// more flexible for theme designers taken from theme config.php
$lmin = empty($THEME->block_l_min_width) ? 160 : $THEME->block_l_min_width;
$lmax = empty($THEME->block_l_max_width) ? 210 : $THEME->block_l_max_width;
$rmin = empty($THEME->block_r_min_width) ? 160 : $THEME->block_r_min_width;
$rmax = empty($THEME->block_r_max_width) ? 210 : $THEME->block_r_max_width;
define('BLOCK_L_MIN_WIDTH', $lmin);
define('BLOCK_L_MAX_WIDTH', $lmax);
define('BLOCK_R_MIN_WIDTH', $rmin);
define('BLOCK_R_MAX_WIDTH', $rmax);
//_____________ new page class code ________
$pagetype = PAGE_BLOG_VIEW;
$pageclass = 'page_blog';
// map our page identifier to the actual name
// of the class which will be handling its operations.
page_map_class($pagetype, $pageclass);
// Now, create our page object.
if (empty($USER->id)) {
$PAGE = page_create_object($pagetype);
} else {
$PAGE = page_create_object($pagetype, $USER->id);
}
$PAGE->courseid = $courseid;
$PAGE->filtertype = $filtertype;
$PAGE->filterselect = $filterselect;
$PAGE->tagid = $tagid;
$PAGE->init_full();
//init the BlogInfo object and the courserecord object
$editing = false;
if ($PAGE->user_allowed_editing()) {
$editing = $PAGE->user_is_editing();
示例13: define
* (at your option) any later version. *
* *
* This program 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: *
* *
* http://www.gnu.org/copyleft/gpl.html *
* *
* *
* *
**************************************************************************
*/
require_once $CFG->libdir . '/pagelib.php';
define('PAGE_dimdim_VIEW', 'mod-dimdim-view');
page_map_class(PAGE_dimdim_VIEW, 'page_dimdim');
$DEFINEDPAGES = array(PAGE_dimdim_VIEW);
/**
* Class that models the behavior of a dimdim
*
* @author Jon Papaioannou
* @package pages
*/
class page_dimdim extends page_generic_activity
{
function init_quick($data)
{
if (empty($data->pageid)) {
error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'dimdim';
示例14: redirect
case 'site':
redirect("{$CFG->wwwroot}/");
case 'admin':
redirect("{$CFG->wwwroot}/{$CFG->admin}/");
}
} else {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
$focus = $firsterror->id;
}
$adminroot =& admin_get_root(true);
//reload tree
$page =& $adminroot->locate($section);
}
/// very hacky page setup
page_map_class(PAGE_ADMIN, 'page_admin');
$PAGE = page_create_object(PAGE_ADMIN, 0);
// there must be any constant id number
$PAGE->init_extra($section);
$CFG->pagepath = 'admin/setting/' . $section;
if (!isset($USER->adminediting)) {
$USER->adminediting = false;
}
if ($PAGE->user_allowed_editing()) {
if ($adminediting == 1) {
$USER->adminediting = true;
} elseif ($adminediting == 0) {
$USER->adminediting = false;
}
}
/// print header stuff ------------------------------------------------------------
示例15: define
<?php
// $Id: pagelib.php,v 1.14.4.1 2007/11/02 16:19:58 tjhunt Exp $
require_once $CFG->libdir . '/pagelib.php';
require_once $CFG->dirroot . '/course/lib.php';
// needed for some blocks
define('PAGE_QUIZ_VIEW_EMBEDDED', 'mod-quiz-view-embedded');
page_map_class(PAGE_QUIZ_VIEW_EMBEDDED, 'page_quiz_embedded');
$DEFINEDPAGES = array(PAGE_QUIZ_VIEW_EMBEDDED);
/**
* Class that models the behavior of an embedded quiz
*
* @author Jon Papaioannou
* @package pages
*/
class page_quiz_embedded extends page_generic_activity
{
function init_quick($data)
{
if (empty($data->pageid)) {
error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'quiz';
parent::init_quick($data);
}
function get_type()
{
return PAGE_QUIZ_VIEW_EMBEDDED;
}
}