本文整理汇总了PHP中BASE_MenuItem::setActive方法的典型用法代码示例。如果您正苦于以下问题:PHP BASE_MenuItem::setActive方法的具体用法?PHP BASE_MenuItem::setActive怎么用?PHP BASE_MenuItem::setActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BASE_MenuItem
的用法示例。
在下文中一共展示了BASE_MenuItem::setActive方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMenu
private function getMenu($active = 'actions')
{
$language = OW::getLanguage();
$item = new BASE_MenuItem();
$item->setLabel($language->text('usercredits', 'tab_actions'));
$item->setUrl(OW::getRouter()->urlForRoute('usercredits.admin'));
$item->setKey('actions');
$item->setOrder(1);
$item->setActive($active == 'actions');
$item->setIconClass('ow_ic_info');
$item2 = new BASE_MenuItem();
$item2->setLabel($language->text('usercredits', 'packs'));
$item2->setUrl(OW::getRouter()->urlForRoute('usercredits.admin_packs'));
$item2->setKey('packs');
$item2->setOrder(2);
$item2->setActive($active == 'packs');
$item2->setIconClass('ow_ic_folder');
$item3 = new BASE_MenuItem();
$item3->setLabel($language->text('usercredits', 'settings'));
$item3->setUrl(OW::getRouter()->urlForRoute('usercredits.admin_settings'));
$item3->setKey('settings');
$item3->setOrder(3);
$item3->setActive($active == 'settings');
$item3->setIconClass('ow_ic_gear_wheel');
return new BASE_CMP_ContentMenu(array($item, $item2, $item3));
}
示例2: index
public function index()
{
$language = OW::getLanguage();
$this->setPageHeading($language->text('ynsocialpublisher', 'admin_config'));
$this->setPageHeadingIconClass('ow_ic_picture');
$item = new BASE_MenuItem();
$item->setLabel($language->text('ynsocialpublisher', 'admin_menu_general'));
$item->setUrl(OW::getRouter()->urlForRoute('ynsocialpublisher.admin'));
$item->setKey('general');
$item->setIconClass('ow_ic_gear_wheel');
$item->setOrder(0);
$item->setActive(true);
$menu = new BASE_CMP_ContentMenu(array($item));
$this->addComponent('menu', $menu);
$service = YNSOCIALPUBLISHER_BOL_Service::getInstance();
$plugins = $service->getEnabledPlugins();
$this->assign('plugins', $plugins);
$form_url = OW::getRouter()->urlForRoute('ynsocialpublisher.admin');
$this->assign('form_url', $form_url);
if (OW::getRequest()->isPost()) {
// get plugins data from post
$params = $_POST['params'];
foreach ($params as $key => $settings) {
if (!isset($settings['providers'])) {
$settings['providers'] = array();
}
OW::getConfig()->saveConfig('ynsocialpublisher', $key, json_encode($settings));
}
OW::getFeedback()->info($language->text('ynsocialpublisher', 'settings_updated'));
$this->redirect($form_url);
}
}
示例3: __construct
public function __construct($recipientId)
{
parent::__construct();
$userId = OW::getUser()->getId();
$giftService = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance();
$authService = BOL_AuthorizationService::getInstance();
if (!OW::getUser()->isAuthorized('virtualgifts', 'send_gift')) {
$status = $authService->getActionStatus('virtualgifts', 'send_gift');
$this->assign('authMessage', $status['msg']);
return;
}
$form = new SendGiftForm($recipientId);
$this->addForm($form);
$categoriesSetup = $giftService->categoriesSetup();
if ($categoriesSetup) {
$templates = $giftService->getTemplateListByCategories();
if (!$templates) {
$templates = $giftService->getTemplateList();
$categoriesSetup = false;
}
} else {
$templates = $giftService->getTemplateList();
}
$this->assign('catSetup', $categoriesSetup);
if ($categoriesSetup) {
$menuItems = array();
$order = 1;
foreach ($templates as $id => $tpl) {
$item = new BASE_MenuItem();
$item->setLabel($tpl['title']);
$item->setUrl("js-call:{$id}");
$item->setKey($id);
$item->setIconClass('ow_ic_heart');
$item->setOrder($order);
$item->setActive($order == 1);
array_push($menuItems, $item);
$order++;
}
$menu = new BASE_CMP_ContentMenu($menuItems);
$this->addComponent('menu', $menu);
}
$this->assign('tpls', $templates);
$showPrice = OW::getPluginManager()->isPluginActive('usercredits') && !$authService->isActionAuthorizedForUser($userId, 'virtualgifts', 'send_gift');
$this->assign('showPrice', $showPrice);
$this->assign('balance', OW::getEventManager()->call('usercredits.get_balance'));
$url = OW::getPluginManager()->getPlugin('virtualgifts')->getStaticCssUrl() . 'style.css';
OW::getDocument()->addStyleSheet($url);
}
示例4: getMenu
private function getMenu($active = 'memberships')
{
$language = OW::getLanguage();
$menuItems = array();
$item = new BASE_MenuItem();
$item->setLabel($language->text('membership', 'admin_menu_memberships'));
$item->setUrl(OW::getRouter()->urlForRoute('membership_admin'));
$item->setKey('memberships');
$item->setActive($active == 'memberships');
$item->setIconClass('ow_ic_update');
$item->setOrder(0);
$menuItems[] = $item;
$item = new BASE_MenuItem();
$item->setLabel($language->text('membership', 'admin_menu_subscribe'));
$item->setUrl(OW::getRouter()->urlForRoute('membership_admin_subscribe'));
$item->setKey('subscribe');
$item->setActive($active == 'subscribe');
$item->setIconClass('ow_ic_script');
$item->setOrder(1);
$menuItems[] = $item;
$item = new BASE_MenuItem();
$item->setLabel($language->text('membership', 'admin_menu_browse_users'));
$item->setUrl(OW::getRouter()->urlForRoute('membership_admin_browse_users_st'));
$item->setKey('users');
$item->setActive($active == 'users');
$item->setIconClass('ow_ic_user');
$item->setOrder(2);
$menuItems[] = $item;
$item = new BASE_MenuItem();
$item->setLabel($language->text('membership', 'admin_menu_settings'));
$item->setUrl(OW::getRouter()->urlForRoute('membership_admin_settings'));
$item->setKey('settings');
$item->setActive($active == 'settings');
$item->setIconClass('ow_ic_gear_wheel');
$item->setOrder(3);
$menuItems[] = $item;
return new BASE_CMP_ContentMenu($menuItems);
}
示例5: __construct
public function __construct($ownerMode, $album)
{
parent::__construct();
$language = OW::getLanguage();
$handler = OW::getRequestHandler()->getHandlerAttributes();
$isAuthenticated = OW::getUser()->isAuthenticated();
$canUpload = !OW::getRequest()->isAjax() && OW::getUser()->isAuthorized('photo', 'upload');
if ($isAuthenticated && $canUpload) {
$language->addKeyForJs('photo', 'album_name');
$language->addKeyForJs('photo', 'album_desc');
$language->addKeyForJs('photo', 'create_album');
$language->addKeyForJs('photo', 'newsfeed_album');
$language->addKeyForJs('photo', 'newsfeed_album_error_msg');
$language->addKeyForJs('photo', 'upload_photos');
$language->addKeyForJs('photo', 'close_alert');
} else {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'upload');
if ($status['status'] != BOL_AuthorizationService::STATUS_DISABLED) {
$this->assign('isPromo', true);
$this->assign('promoMsg', json_encode($status['msg']));
}
}
$this->assign('isAuthenticated', $isAuthenticated);
$this->assign('canUpload', $canUpload);
$this->assign('url', OW::getEventManager()->call('photo.getAddPhotoURL', array('albumId' => !empty($ownerMode) && !empty($album) ? $album->id : 0)));
$menu = new BASE_CMP_SortControl();
$menu->setTemplate(OW::getPluginManager()->getPlugin('photo')->getCmpViewDir() . 'sort_control.html');
if (in_array($handler[OW_RequestHandler::ATTRS_KEY_ACTION], array('viewList', 'viewTaggedList'))) {
$menu->addItem('latest', $language->text('photo', 'menu_latest'), OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'latest')));
if (PHOTO_BOL_PhotoService::getInstance()->countPhotos('featured', PHOTO_BOL_PhotoService::getInstance()->countPhotos('featured'))) {
$menu->addItem('featured', $language->text('photo', 'menu_featured'), OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'featured')));
}
$menu->addItem('toprated', $language->text('photo', 'menu_toprated'), OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'toprated')));
$menu->addItem('most_discussed', $language->text('photo', 'menu_most_discussed'), OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'most_discussed')));
if ($handler[OW_RequestHandler::ATTRS_KEY_ACTION] != 'viewTaggedList') {
$menu->setActive(!empty($handler[OW_RequestHandler::ATTRS_KEY_VARLIST]['listType']) ? $handler[OW_RequestHandler::ATTRS_KEY_VARLIST]['listType'] : 'latest');
}
$menu->assign('initSearchEngine', TRUE);
} else {
if (!$ownerMode) {
$user = BOL_UserService::getInstance()->findByUsername($handler[OW_RequestHandler::ATTRS_KEY_VARLIST]['user']);
$this->assign('user', $user);
$avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($user->id));
$this->assign('avatar', $avatar[$user->id]);
$onlineStatus = BOL_UserService::getInstance()->findOnlineStatusForUserList(array($user->id));
$this->assign('onlineStatus', $onlineStatus[$user->id]);
}
$menu->addItem('userPhotos', $language->text('photo', 'menu_photos'), OW::getRouter()->urlForRoute('photo.user_photos', array('user' => $handler[OW_RequestHandler::ATTRS_KEY_VARLIST]['user'])));
$menu->addItem('userAlbums', $language->text('photo', 'menu_albums'), OW::getRouter()->urlForRoute('photo_user_albums', array('user' => $handler[OW_RequestHandler::ATTRS_KEY_VARLIST]['user'])));
if (in_array($handler[OW_RequestHandler::ATTRS_KEY_ACTION], array('userAlbums', 'userAlbum'))) {
$menu->setActive('userAlbums');
} else {
$menu->setActive('userPhotos');
}
}
$event = new BASE_CLASS_EventCollector(PHOTO_CLASS_EventHandler::EVENT_COLLECT_PHOTO_SUB_MENU);
OW::getEventManager()->trigger($event);
foreach ($event->getData() as $menuItem) {
$menu->addItem($menuItem['sortOrder'], $menuItem['label'], $menuItem['url'], !empty($menuItem['isActive']) ? (bool) $menuItem['isActive'] : FALSE);
}
$this->addComponent('subMenu', $menu);
if (OW::getUser()->isAuthenticated()) {
$userObj = OW::getUser()->getUserObject();
if (in_array($handler[OW_RequestHandler::ATTRS_KEY_ACTION], array('viewList', 'viewTaggedList')) || !empty($handler[OW_RequestHandler::ATTRS_KEY_VARLIST]['user']) && $handler[OW_RequestHandler::ATTRS_KEY_VARLIST]['user'] == $userObj->username) {
$menuItems = array();
$item = new BASE_MenuItem();
$item->setKey('menu_explore');
$item->setLabel($language->text('photo', 'menu_explore'));
$item->setUrl(OW::getRouter()->urlForRoute('view_photo_list'));
$item->setIconClass('ow_ic_lens');
$item->setOrder(0);
$item->setActive(in_array($handler[OW_RequestHandler::ATTRS_KEY_ACTION], array('viewList', 'viewTaggedList')));
array_push($menuItems, $item);
$item = new BASE_MenuItem();
$item->setKey('menu_my_photos');
$item->setLabel($language->text('photo', 'menu_my_photos'));
$item->setUrl(OW::getRouter()->urlForRoute('photo.user_photos', array('user' => $userObj->username)));
$item->setIconClass('ow_ic_picture');
$item->setOrder(1);
$item->setActive($ownerMode);
array_push($menuItems, $item);
$this->addComponent('photoMenu', new BASE_CMP_ContentMenu($menuItems));
}
}
}
示例6: addMenu
public function addMenu($sections)
{
$menuItems = array();
foreach ($sections as $key => $section) {
$item = new BASE_MenuItem();
$item->setLabel(BOL_QuestionService::getInstance()->getSectionLang($section))->setKey($section)->setUrl('javascript://')->setPrefix('menu')->setOrder($key);
if ($key == 0) {
$item->setActive(true);
}
$menuItems[] = $item;
$script = '$(\'li.menu_' . $section . '\').click(function(){view.showSection(\'' . $section . '\');});';
OW::getDocument()->addOnloadScript($script);
}
$this->addComponent('menu', new BASE_CMP_ContentMenu($menuItems));
}
示例7: getMenu
/**
*
* @return BASE_CMP_ContentMenu
*/
protected function getMenu()
{
$advancedUpload = OW::getConfig()->getValue('photo', 'advanced_upload_enabled');
if (!$advancedUpload) {
return null;
}
$language = OW::getLanguage();
$menuItems = array();
$item = new BASE_MenuItem();
$item->setLabel($language->text('photo', 'advanced_upload'));
$item->setUrl('js-call:upload_advanced');
$item->setKey('upload_advanced');
$item->setIconClass('ow_ic_files');
$item->setOrder(1);
$item->setActive(true);
array_push($menuItems, $item);
$item = new BASE_MenuItem();
$item->setLabel($language->text('photo', 'simple_upload'));
$item->setUrl('js-call:upload_simple');
$item->setKey('upload_simple');
$item->setIconClass('ow_ic_file');
$item->setOrder(2);
$item->setActive(false);
array_push($menuItems, $item);
$menu = new BASE_CMP_ContentMenu($menuItems);
return $menu;
}
示例8: getMenu
public static function getMenu($activeList)
{
$menuItems = array();
$lang = OW::getLanguage();
$router = OW::getRouter();
$item = new BASE_MenuItem();
$item->setLabel($lang->text('ocsfavorites', 'my_favorites'));
$item->setUrl($router->urlForRoute('ocsfavorites.list'));
$item->setKey('my_favorites');
$item->setIconClass('ow_ic_heart');
$item->setOrder(1);
$item->setActive($activeList == 'my_favorites');
array_push($menuItems, $item);
$item = new BASE_MenuItem();
$item->setLabel($lang->text('ocsfavorites', 'added_me'));
$item->setUrl($router->urlForRoute('ocsfavorites.added_list'));
$item->setKey('added_me');
$item->setIconClass('ow_ic_heart');
$item->setOrder(2);
$item->setActive($activeList == 'added_me');
array_push($menuItems, $item);
$item = new BASE_MenuItem();
$item->setLabel($lang->text('ocsfavorites', 'mutual_attraction'));
$item->setUrl($router->urlForRoute('ocsfavorites.mutual_list'));
$item->setKey('mutual');
$item->setIconClass('ow_ic_heart');
$item->setOrder(3);
$item->setActive($activeList == 'mutual');
array_push($menuItems, $item);
$menu = new BASE_MCMP_ContentMenu($menuItems);
return $menu;
}
示例9: getMenu
/**
* Returns menu component
*
* @param $active
* @return BASE_CMP_ContentMenu
*/
private function getMenu($active)
{
$language = OW::getLanguage();
$menuItems = array();
$item = new BASE_MenuItem();
$item->setLabel($language->text('ocsaffiliates', 'affiliate_list'));
$item->setUrl(OW::getRouter()->urlForRoute('ocsaffiliates.admin'));
$item->setKey('list');
$item->setActive($active == 'list');
$item->setIconClass('ow_ic_script');
$item->setOrder(0);
array_push($menuItems, $item);
$item = new BASE_MenuItem();
$item->setLabel($language->text('ocsaffiliates', 'settings'));
$item->setUrl(OW::getRouter()->urlForRoute('ocsaffiliates.admin_settings'));
$item->setKey('settings');
$item->setActive($active == 'settings');
$item->setIconClass('ow_ic_gear_wheel');
$item->setOrder(1);
array_push($menuItems, $item);
$item = new BASE_MenuItem();
$item->setLabel($language->text('ocsaffiliates', 'banners'));
$item->setUrl(OW::getRouter()->urlForRoute('ocsaffiliates.admin_banners'));
$item->setKey('banners');
$item->setActive($active == 'banners');
$item->setIconClass('ow_ic_picture');
$item->setOrder(2);
array_push($menuItems, $item);
$menu = new BASE_CMP_ContentMenu($menuItems);
return $menu;
}
示例10: getMenu
private function getMenu($active)
{
$lang = OW::getLanguage();
$router = OW::getRouter();
$menuItem = new BASE_MenuItem();
$menuItem->setKey('dashboard');
$menuItem->setActive($active == 'dashboard');
$menuItem->setOrder(0);
$menuItem->setUrl($router->urlForRoute('ocsaffiliates.home'));
$menuItem->setLabel($lang->text('ocsaffiliates', 'dashboard'));
$menuItem->setIconClass('ow_ic_dashboard');
$menuItems[] = $menuItem;
$menuItem = new BASE_MenuItem();
$menuItem->setKey('log');
$menuItem->setActive($active == 'log');
$menuItem->setOrder(1);
$menuItem->setUrl($router->urlForRoute('ocsaffiliates.home_log'));
$menuItem->setLabel($lang->text('ocsaffiliates', 'log'));
$menuItem->setIconClass('ow_ic_script');
$menuItems[] = $menuItem;
$menuItem = new BASE_MenuItem();
$menuItem->setKey('banners');
$menuItem->setActive($active == 'banners');
$menuItem->setOrder(2);
$menuItem->setUrl($router->urlForRoute('ocsaffiliates.home_banners'));
$menuItem->setLabel($lang->text('ocsaffiliates', 'banners'));
$menuItem->setIconClass('ow_ic_picture');
$menuItems[] = $menuItem;
$menuItem = new BASE_MenuItem();
$menuItem->setKey('profile');
$menuItem->setActive($active == 'profile');
$menuItem->setOrder(3);
$menuItem->setUrl($router->urlForRoute('ocsaffiliates.home_profile'));
$menuItem->setLabel($lang->text('ocsaffiliates', 'profile'));
$menuItem->setIconClass('ow_ic_user');
$menuItems[] = $menuItem;
$menuItem = new BASE_MenuItem();
$menuItem->setKey('payouts');
$menuItem->setActive($active == 'payouts');
$menuItem->setOrder(4);
$menuItem->setUrl($router->urlForRoute('ocsaffiliates.home_payouts'));
$menuItem->setLabel($lang->text('ocsaffiliates', 'payouts'));
$menuItem->setIconClass('ow_ic_');
$menuItems[] = $menuItem;
$menuItem = new BASE_MenuItem();
$menuItem->setKey('logout');
$menuItem->setActive($active == 'logout');
$menuItem->setOrder(5);
$menuItem->setUrl($router->urlForRoute('ocsaffiliates.logout'));
$menuItem->setLabel($lang->text('ocsaffiliates', 'signout'));
$menuItem->setIconClass('ow_ic_right_arrow');
$menuItems[] = $menuItem;
return new BASE_CMP_ContentMenu($menuItems);
}