本文整理汇总了PHP中admin_critical_warnings_present函数的典型用法代码示例。如果您正苦于以下问题:PHP admin_critical_warnings_present函数的具体用法?PHP admin_critical_warnings_present怎么用?PHP admin_critical_warnings_present使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了admin_critical_warnings_present函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_tree
function build_tree(&$content)
{
global $CFG;
if (is_a($content, 'admin_settingpage')) {
// show hidden pages in tree if hidden page active
if ($content->check_access() and ($content->name == $this->section or !$content->is_hidden())) {
$class = $content->name == $this->section ? 'link current' : 'link';
if ($content->is_hidden()) {
$class .= ' hidden';
}
$this->create_item($content->visiblename, $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $content->name, $CFG->pixpath . '/i/item.gif', $class);
}
} else {
if (is_a($content, 'admin_externalpage')) {
// show hidden pages in tree if hidden page active
if ($content->check_access() and ($content->name == $this->section or !$content->is_hidden())) {
$class = $content->name == $this->section ? 'link current' : 'link';
if ($content->name === 'adminnotifications') {
if (admin_critical_warnings_present()) {
$class .= ' criticalnotification';
}
}
if ($content->is_hidden()) {
$class .= ' hidden';
}
$this->create_item($content->visiblename, $content->url, $CFG->pixpath . '/i/item.gif', $class);
}
} else {
if (is_a($content, 'admin_category')) {
if ($content->check_access() and !$content->is_hidden()) {
// check if the category we're currently printing is a parent category for the current page; if it is, we
// make a note (in the javascript) that it has to be expanded after the page has loaded
if ($this->section != '' and $this->pathtosection[count($this->pathtosection) - 1] == $content->name) {
$this->expandjavascript .= 'expand(' . $this->divcounter . ');' . "\n";
array_pop($this->pathtosection);
}
$this->open_folder($content->visiblename);
$entries = array_keys($content->children);
foreach ($entries as $entry) {
$this->build_tree($content->children[$entry]);
}
$this->close_folder();
}
}
}
}
}
示例2: load_administration_settings
/**
* Load the site administration tree
*
* This function loads the site administration tree by using the lib/adminlib library functions
*
* @param navigation_node $referencebranch A reference to a branch in the settings
* navigation tree
* @param part_of_admin_tree $adminbranch The branch to add, if null generate the admin
* tree and start at the beginning
* @return mixed A key to access the admin tree by
*/
protected function load_administration_settings(navigation_node $referencebranch = null, part_of_admin_tree $adminbranch = null)
{
global $CFG;
// Check if we are just starting to generate this navigation.
if ($referencebranch === null) {
// Require the admin lib then get an admin structure
if (!function_exists('admin_get_root')) {
require_once $CFG->dirroot . '/lib/adminlib.php';
}
$adminroot = admin_get_root(false, false);
// This is the active section identifier
$this->adminsection = $this->page->url->param('section');
// Disable the navigation from automatically finding the active node
navigation_node::$autofindactive = false;
$referencebranch = $this->add(get_string('administrationsite'), null, self::TYPE_SETTING, null, 'root');
foreach ($adminroot->children as $adminbranch) {
$this->load_administration_settings($referencebranch, $adminbranch);
}
navigation_node::$autofindactive = true;
// Use the admin structure to locate the active page
if (!$this->contains_active_node() && ($current = $adminroot->locate($this->adminsection, true))) {
$currentnode = $this;
while (($pathkey = array_pop($current->path)) !== null && $currentnode) {
$currentnode = $currentnode->get($pathkey);
}
if ($currentnode) {
$currentnode->make_active();
}
} else {
$this->scan_for_active_node($referencebranch);
}
return $referencebranch;
} else {
if ($adminbranch->check_access()) {
// We have a reference branch that we can access and is not hidden `hurrah`
// Now we need to display it and any children it may have
$url = null;
$icon = null;
if ($adminbranch instanceof admin_settingpage) {
$url = new moodle_url('/' . $CFG->admin . '/settings.php', array('section' => $adminbranch->name));
} else {
if ($adminbranch instanceof admin_externalpage) {
$url = $adminbranch->url;
} else {
if (!empty($CFG->linkadmincategories) && $adminbranch instanceof admin_category) {
$url = new moodle_url('/' . $CFG->admin . '/category.php', array('category' => $adminbranch->name));
}
}
}
// Add the branch
$reference = $referencebranch->add($adminbranch->visiblename, $url, self::TYPE_SETTING, null, $adminbranch->name, $icon);
if ($adminbranch->is_hidden()) {
if (($adminbranch instanceof admin_externalpage || $adminbranch instanceof admin_settingpage) && $adminbranch->name == $this->adminsection) {
$reference->add_class('hidden');
} else {
$reference->display = false;
}
}
// Check if we are generating the admin notifications and whether notificiations exist
if ($adminbranch->name === 'adminnotifications' && admin_critical_warnings_present()) {
$reference->add_class('criticalnotification');
}
// Check if this branch has children
if ($reference && isset($adminbranch->children) && is_array($adminbranch->children) && count($adminbranch->children) > 0) {
foreach ($adminbranch->children as $branch) {
// Generate the child branches as well now using this branch as the reference
$this->load_administration_settings($reference, $branch);
}
} else {
$reference->icon = new pix_icon('i/settings', '');
}
}
}
}