本文整理汇总了PHP中MenuItem::setSelected方法的典型用法代码示例。如果您正苦于以下问题:PHP MenuItem::setSelected方法的具体用法?PHP MenuItem::setSelected怎么用?PHP MenuItem::setSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::setSelected方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
public function getItems()
{
$user = Transaction::getInstance()->getUser();
$items = array();
foreach ($this->xml->item as $element) {
$item = new MenuItem($this, $element);
if ($item->getId() == $this->mainMenuId) {
$item->setSelected(true);
}
if (!$item->isAdminOnly() || $user->isAdmin()) {
$items[] = $item;
}
}
return $items;
}
示例2: __construct
public function __construct($menu, $xmlElement)
{
$this->attributes = self::getXmlElementAttributes($xmlElement);
$this->menu = $menu;
$this->id = $xmlElement['id'];
$this->adminOnly = $xmlElement['adminOnly'];
$this->name = $xmlElement->name;
$this->href = $xmlElement->href;
$this->onclick = $xmlElement->onclick;
$this->class = $xmlElement->class;
$this->content = $xmlElement->content;
$this->subcontent = $xmlElement->subcontent;
$this->add = $xmlElement->add;
$this->display = $xmlElement->disp;
$this->xmlElement = $xmlElement;
foreach ($xmlElement->item as $childItem) {
$item = new MenuItem($this->menu, $childItem);
if ($item->getId() == $menu->getSubMenuId()) {
$item->setSelected(true);
}
$this->items[] = $item;
}
}
示例3: testSetSelected
/**
* @covers MenuItem::setSelected
*/
public function testSetSelected()
{
$this->assertFalse($this->menuItem->isSelected());
$this->menuItem->setSelected(true);
$this->assertTrue($this->menuItem->isSelected());
}