本文整理汇总了PHP中sys::getMenues方法的典型用法代码示例。如果您正苦于以下问题:PHP sys::getMenues方法的具体用法?PHP sys::getMenues怎么用?PHP sys::getMenues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sys
的用法示例。
在下文中一共展示了sys::getMenues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load()
{
$this->headline = Language::DirectTranslate("plugin_menulistwidget_menus");
if (Cache::contains("menu", "widget_" . $_GET['dir'])) {
$this->content = Cache::getData("menu", "widget_" . $_GET['dir']);
} else {
if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
$_GET['dir'] = "";
}
$template = new Template();
$template->load("plugin_menulistwidget_menulist");
$newmenuurl = UrlRewriting::GetUrlByAlias("admin/newmenu");
$template->assign_var("NEWMENUURL", $newmenuurl);
$menus = sys::getMenues($_GET['dir']);
foreach ($menus as $menu) {
$index = $template->add_loop_item("MENUS");
$template->assign_loop_var("MENUS", $index, "ID", $menu->id);
$template->assign_loop_var("MENUS", $index, "TITLE", $menu->name);
$template->assign_loop_var("MENUS", $index, "PAGES", $menu->count);
$editurl = UrlRewriting::GetUrlByAlias("admin/editmenu", "menu=" . $menu->id);
$template->assign_loop_var("MENUS", $index, "EDITURL", $editurl);
$deleteurl = UrlRewriting::GetUrlByAlias("admin/deletemenu", "menu=" . $menu->id);
$template->assign_loop_var("MENUS", $index, "DELETEURL", $deleteurl);
}
if (!$menus) {
$template->assign_var("NOMENUS", Language::DirectTranslate("plugin_menulistwidget_no_menus"));
} else {
$template->assign_var("NOMENUS", "");
}
$this->content = $template->getCode();
Cache::setData("menu", "widget_" . $_GET['dir'], $this->content);
}
}
示例2: display
public function display()
{
$template = new Template();
$template->load("site_edit");
$page = new Page();
if (isset($_GET['site'])) {
$page->loadProperties(DataBase::Current()->EscapeString($_GET['site']));
if (isset($_POST['save'])) {
$oldpage = $page;
$page->title = $_POST['title'];
$page->menu = $_POST['menu'];
$page->getMeta()->description = $_POST['meta-description'];
$page->getMeta()->keywords = $_POST['meta-keywords'];
$page->getMeta()->robots = $_POST['meta-robots'];
$page->alias = $page->getDir() . $_POST['localalias'];
$page->ownerid = $_POST['owner'];
$page->canonical = $_POST['canonical'];
$page->advancedHtmlHeader = $_POST['advanced_html_header'];
$page->SetChangeFrequence($_POST['change_frequence']);
if (isset($_POST['in_sitemap'])) {
$page->inSitemap = $_POST['in_sitemap'];
} else {
$page->inSitemap = false;
}
$page->priority = $_POST['priority'];
$page->save();
$page->getEditor()->save($page, $oldpage);
Role::clearAccess($page);
if ($_POST['rights']) {
foreach ($_POST['rights'] as $right) {
$role = new Role();
$role->load($right);
$role->allowAccess($page);
}
}
} else {
if (isset($_POST['menu'])) {
$page->title = $_POST['title'];
$page->alias = $page->getDir() . $_POST['localalias'];
$page->menu = $_POST['menu'];
$page->getEditor()->content = $_POST['content'];
}
}
$url = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias);
$template->assign_var("PATH", $url);
$template->assign_var("ALIAS", $page->alias);
$template->assign_var("LOCALALIAS", $page->getLocalAlias());
if (!isset($_POST['menu'])) {
foreach (Role::getAllRoles() as $role) {
$index = $template->add_loop_item("RIGHTS");
$template->assign_loop_var("RIGHTS", $index, "LABEL", "/");
$template->assign_loop_var("RIGHTS", $index, "VALUE", $role->ID);
$template->assign_loop_var("RIGHTS", $index, "NAME", $role->name);
if ($role->canAccess($page)) {
$template->assign_loop_var("RIGHTS", $index, "SELECTED", "selected=\"1\" ");
} else {
$template->assign_loop_var("RIGHTS", $index, "SELECTED", "");
}
}
} else {
foreach (Role::getAllRoles() as $role) {
$index = $template->add_loop_item("RIGHTS");
$template->assign_loop_var("RIGHTS", $index, "LABEL", "/");
$template->assign_loop_var("RIGHTS", $index, "VALUE", $role->ID);
$template->assign_loop_var("RIGHTS", $index, "NAME", $role->name);
if (isset($_POST['rights']) && in_array($role->ID, $_POST['rights'])) {
$template->assign_loop_var("RIGHTS", $index, "SELECTED", "selected=\"1\" ");
} else {
$template->assign_loop_var("RIGHTS", $index, "SELECTED", "");
}
}
}
$index = $template->add_loop_item("MENU");
$template->assign_loop_var("MENU", $index, "VALUE", "0");
$template->assign_loop_var("MENU", $index, "NAME", "-- " . Language::DirectTranslate("NO_MENU") . " --");
$template->assign_loop_var("MENU", $index, "SELECTED", "");
foreach (sys::getMenues($_SESSION['dir']) as $menu) {
$index = $template->add_loop_item("MENU");
$template->assign_loop_var("MENU", $index, "VALUE", $menu->id);
$template->assign_loop_var("MENU", $index, "NAME", $menu->name);
if (isset($_POST['menu']) && $_POST['menu'] == $menu->id) {
$template->assign_loop_var("MENU", $index, "SELECTED", "selected=\"1\" ");
} else {
if (!isset($_POST['menu']) && $menu->id == $page->menu) {
$template->assign_loop_var("MENU", $index, "SELECTED", "selected=\"1\" ");
} else {
$template->assign_loop_var("MENU", $index, "SELECTED", "");
}
}
}
if (isset($_POST['menu'])) {
$template->assign_var("MENUPREVIEW", Menu::getCode($_POST['menu'], "<ul>", "</ul>", "<li>", "</li>", ""));
} else {
if ($page->menu > 0) {
$template->assign_var("MENUPREVIEW", Menu::getCode($page->menu, "<ul>", "</ul>", "<li>", "</li>", ""));
} else {
$template->assign_var("MENUPREVIEW", "");
}
}
$template->assign_var("METADESCRIPTION", htmlentities($page->getMeta()->description));
//.........这里部分代码省略.........