本文整理匯總了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');
}
}
}