本文整理汇总了PHP中Menu::getItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::getItems方法的具体用法?PHP Menu::getItems怎么用?PHP Menu::getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::getItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: use
}
});
$app->error(function (\LogicException $logicException) use($app) {
if ($app['debug']) {
return;
} else {
// Aqui ira la vista error/500.html.twig
return new Response($logicException->getMessage());
}
});
$app->error(function (AccessDeniedHttpException $accessDeniedHttpException) use($app) {
if ($app['debug']) {
return;
} else {
$menuModelo = new Menu($app['db']);
$menuItems = $menuModelo->getItems();
// Respuesta en frontend
$uriActual = $_SERVER['REQUEST_URI'];
return $app['twig']->render('errors/403.html.twig', array('uri' => $uriActual, 'menu_items' => $menuItems));
}
});
$app->error(function (NotFoundHttpException $notFoundHttpException) use($app) {
if ($app['debug']) {
return;
} else {
$uriActual = $_SERVER['REQUEST_URI'];
return $app['twig']->render('errors/404.html.twig', array('uri' => $uriActual));
}
});
$app->error(function (MethodNotAllowedHttpException $methodNotAllowedHttpException, $code) use($app) {
if ($app['debug']) {
示例2: _displayItemAdd
private function _displayItemAdd()
{
global $cookie, $currentIndex;
$id_menu = Tools::isSubmit('edit') ? intVal(Tools::getValue('id_menu')) : 0;
$menu = new Menu($id_menu);
$id_lang = $cookie->id_lang;
$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
$iso = Language::getIsoById(intval($cookie->id_lang));
$languages = Language::getLanguages();
$divLangName = 'title¤link';
$this->_html .= '
<script type="text/javascript">id_language = Number(' . $defaultLanguage . ');</script>
<form action="" method="post" enctype="multipart/form-data">
<fieldset>
<legend>
<img src="' . _MODULE_DIR_ . $this->_module . '/gfx/tab/add.gif" alt="" title="" /> ' . $this->l('Add item') . '
</legend>
<label for="type">' . $this->l('Type:') . '</label>
<div class="margin-form">
<select name="type" onchange="$(\'.case\').addClass(\'hide\');$(\'.case_\'+$(this).val()).removeClass(\'hide\');">
<option value="">-- ' . $this->l('Select an item type') . ' --</option>
<option value="category" ' . ($menu->type == 'category' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Categories') . '</option>
<option value="product"' . ($menu->type == 'product' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Products') . '</option>
<option value="cms"' . ($menu->type == 'cms' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('CMS') . '</option>
<option value="manufacturers"' . ($menu->type == 'manufacturers' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Manufacturers List') . '</option>
<option value="manufacturer"' . ($menu->type == 'manufacturer' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Manufacturer') . '</option>
<option value="suppliers"' . ($menu->type == 'suppliers' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Suppliers List') . '</option>
<option value="supplier"' . ($menu->type == 'supplier' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Supplier') . '</option>
<option value="link"' . ($menu->type == 'link' && Tools::isSubmit('edit') ? 'selected=""' : '') . '>' . $this->l('Links') . '</option>
</select><sup> *</sup>
<!-- <p class="clear">...</p> -->
</div>
<label for="type">' . $this->l('Parent Item:') . '</label>
<div class="margin-form">
<select name="id_parent">
<option value="0">-- ' . $this->l('Choose a parent item') . ' --</option>';
$items = Menu::getItems($id_lang);
$this->_html .= $this->_showOption($items, $id_lang, 0, $menu->id_parent, array($menu->id));
$this->_html .= '
</select>
</div>
<!-- 2010-02-22 12:40:43 -->
<label for="css">' . $this->l('CSS ID:') . '</label>
<div class="margin-form">
<input type="text" name="css" id="css" value="' . (!is_null($menu->id) ? $menu->css : '') . '" />
<p class="clear">' . $this->l('Use this option to set a CSS ID to this item.') . '</p>
</div>
<!-- /2010-02-22 12:40:43 -->
<!-- INT -->
<label for="title">' . $this->l('Title:') . '</label>
<div class="margin-form">';
foreach ($languages as $language) {
$this->_html .= '
<div id="title_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" name="title[' . $language['id_lang'] . ']" value="' . (!is_null($menu->id) ? $menu->title[$language['id_lang']] : '') . '" class="' . ($language['id_lang'] != $defaultLanguage ? 'clone' : 'cloneParent') . '" /><sup class="case case_link hide"> *</sup>
</div>';
}
ob_start();
$this->displayFlags($languages, $defaultLanguage, $divLangName, 'title');
$this->_html .= ob_get_contents();
ob_end_clean();
$this->_html .= '
<p class="clear">' . $this->l('If you leave the field blank, the default title will be used.') . '</p>
</div>
<!-- INT -->
<!-- 2009-12-14 09:56:32 -->
<label for="logged">' . $this->l('Must be logged:') . '</label>
<div class="margin-form">
<input type="checkbox" id="logged" name="logged" value="1"' . (!is_null($menu->id) && $menu->logged ? ' checked=""' : '') . '/>
<p class="clear">' . $this->l('User must be logged.') . '</p>
</div>
<!-- /2009-12-14 09:56:32 -->
<div class="case_category case ' . ($menu->type == 'category' && Tools::isSubmit('edit') ? '' : 'hide') . '">
<label for="category_level">' . $this->l('Level:') . '</label>
<div class="margin-form">
<input type="text" name="category_level" id="category_level" value="' . (!is_null($menu->id) ? $menu->level : '0') . '" size="5" />
<p class="clear">' . $this->l('Maximum level of unfolding, leave 0 for all.') . '</p>
</div>
<label for="id_category">' . $this->l('Category:') . '</label>
<div class="margin-form">
<select name="id_category" id="id_category" size="10">';
$this->_getCategoryOption(1, $cookie->id_lang, true, !is_null($menu->id) ? $menu->id_item : null);
$this->_html .= '
</select><sup> *</sup>
<p class="clear">' . $this->l('Start category') . '</p>
</div>
<label for="category_ignore">' . $this->l('Categories to ignore:') . '</label>
<div class="margin-form">
<input type="text" name="category_ignore" id="category_ignore" value="' . (!is_null($menu->id) ? $menu->ignore : '') . '" />
<p class="clear">' . $this->l('Separate with comma. (id1,id2,...)') . '</p>
</div>
</div>
<div class="case_product case ' . ($menu->type == 'product' && Tools::isSubmit('edit') ? '' : 'hide') . '">
<label for="id_product">' . $this->l('Product ID:') . '</label>
<div class="margin-form">
<input type="text" name="id_product" id="id_product" size="6" />
//.........这里部分代码省略.........
示例3: testGetItems
/**
* @covers Menu::getItems
*/
public function testGetItems()
{
$this->menu->setMenuSelection("dashboard->sensors");
$actual = $this->menu->getItems();
$this->assertContainsOnlyInstancesOf("MenuItem", $actual);
}