本文整理汇总了PHP中BASE_MenuItem::setPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP BASE_MenuItem::setPrefix方法的具体用法?PHP BASE_MenuItem::setPrefix怎么用?PHP BASE_MenuItem::setPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BASE_MenuItem
的用法示例。
在下文中一共展示了BASE_MenuItem::setPrefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMenu
public function getMenu()
{
$language = OW::getLanguage();
$menu = new BASE_CMP_ContentMenu();
$menuItem = new BASE_MenuItem();
$menuItem->setKey('all');
$menuItem->setPrefix('questions');
$menuItem->setLabel($language->text('questions', 'list_all_tab'));
$menuItem->setOrder(1);
$menuItem->setUrl(OW::getRouter()->urlForRoute('questions-all'));
$menuItem->setIconClass('ow_ic_lens');
$menu->addElement($menuItem);
if (OW::getUser()->isAuthenticated()) {
if (OW::getPluginManager()->isPluginActive('friends')) {
$menuItem = new BASE_MenuItem();
$menuItem->setKey('friends');
$menuItem->setPrefix('questions');
$menuItem->setLabel($language->text('questions', 'list_friends_tab'));
$menuItem->setOrder(2);
$menuItem->setUrl(OW::getRouter()->urlForRoute('questions-friends'));
$menuItem->setIconClass('ow_ic_user');
$menu->addElement($menuItem);
}
$menuItem = new BASE_MenuItem();
$menuItem->setKey('my');
$menuItem->setPrefix('questions');
$menuItem->setLabel($language->text('questions', 'list_my_tab'));
$menuItem->setOrder(3);
$menuItem->setUrl(OW::getRouter()->urlForRoute('questions-my'));
$menuItem->setIconClass('ow_ic_user');
$menu->addElement($menuItem);
}
return $menu;
}
示例2: collectMailboxMenu
public function collectMailboxMenu(BASE_CLASS_EventCollector $event)
{
if (!OW::getUser()->isAuthorized('mailbox', 'send_message')) {
return;
}
$language = OW::getLanguage();
$item = new BASE_MenuItem();
$item->setLabel($language->text('mcompose', 'compose_btn'));
$item->setIconClass('ow_ic_new');
$item->setPrefix('mcompose');
$item->setUrl(OW::getRouter()->urlForRoute("mcompose-index"));
$item->setKey('compose');
$item->setOrder(3);
$event->add($item);
$staticUrl = OW::getPluginManager()->getPlugin('mcompose')->getStaticUrl();
OW::getDocument()->addStyleSheet($staticUrl . 'style.css');
}
示例3: getMenuItems
/**
* Converts query result array into BASE_MenuItem items array.
*
* @param array $items
*/
public function getMenuItems(array $menuItems)
{
$resultArray = array();
foreach ($menuItems as $value) {
$visible = (int) $value['visibleFor'];
$auth = OW::getUser()->isAuthenticated();
if ($visible === 0 || $visible === 1 && $auth || $visible === 2 && !$auth) {
continue;
}
if (!empty($value['externalUrl'])) {
$url = $value['externalUrl'];
} else {
if (!empty($value['uri'])) {
$url = OW::getRouter()->getBaseUrl() . $value['uri'];
} else {
if (!empty($value['routePath'])) {
$url = OW::getRouter()->urlForRoute($value['routePath']);
} else {
if (!empty($value['class']) && !empty($value['action'])) {
$url = OW::getRouter()->urlFor($value['class'], $value['action']);
} else {
$url = '_INVALID_URL_';
}
}
}
}
$menuItem = new BASE_MenuItem();
$menuItem->setKey($value['menu_key']);
$menuItem->setLabel(OW::getLanguage()->text($value['prefix'], $value['menu_key']));
$menuItem->setOrder($value['order']);
$menuItem->setUrl($url);
$menuItem->setNewWindow($value['newWindow']);
$menuItem->setPrefix($value['prefix']);
$resultArray[] = $menuItem;
}
return $resultArray;
}