本文整理汇总了PHP中navigation_node::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP navigation_node::__construct方法的具体用法?PHP navigation_node::__construct怎么用?PHP navigation_node::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类navigation_node
的用法示例。
在下文中一共展示了navigation_node::__construct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructs a new global navigation
*
* @param moodle_page $page The page this navigation object belongs to
*/
public function __construct(moodle_page $page)
{
global $CFG, $SITE, $USER;
if (during_initial_install()) {
return;
}
if (get_home_page() == HOMEPAGE_SITE) {
// We are using the site home for the root element
$properties = array('key' => 'home', 'type' => navigation_node::TYPE_SYSTEM, 'text' => get_string('home'), 'action' => new moodle_url('/'));
} else {
// We are using the users my moodle for the root element
$properties = array('key' => 'myhome', 'type' => navigation_node::TYPE_SYSTEM, 'text' => get_string('myhome'), 'action' => new moodle_url('/my/'));
}
// Use the parents constructor.... good good reuse
parent::__construct($properties);
// Initalise and set defaults
$this->page = $page;
$this->forceopen = true;
$this->cache = new navigation_cache(NAVIGATION_CACHE_NAME);
}
示例2: __construct
/**
* A proxy constructor
*
* @param mixed $navnode A navigation_node or an array
*/
public function __construct($navnode)
{
if (is_array($navnode)) {
parent::__construct($navnode);
} else {
if ($navnode instanceof navigation_node) {
// Just clone everything.
$objvalues = get_object_vars($navnode);
foreach ($objvalues as $key => $value) {
$this->{$key} = $value;
}
} else {
throw coding_exception('Not a valid breadcrumb_navigation_node');
}
}
}