public function collectItems(BASE_CLASS_ConsoleItemCollector $event) { $language = OW::getLanguage(); $router = OW::getRouter(); //Hardik Changes for menu if (OW::getUser()->isAuthenticated()) { //$item = new BASE_CMP_ConsoleDropdownMenu(BOL_UserService::getInstance()->getDisplayName(OW::getUser()->getId())); $item = new BASE_CMP_ConsoleDropdownMenu(OW::getUser()->getUserObject()->getUsername()); $item->setUrl($router->urlForRoute('base_user_profile', array('username' => OW::getUser()->getUserObject()->getUsername()))); $item->addItem('main', array('label' => $language->text('base', 'console_item_label_profile'), 'url' => $router->urlForRoute('base_user_profile', array('username' => OW::getUser()->getUserObject()->getUsername())))); $item->addItem('main', array('label' => $language->text('base', 'edit_index'), 'url' => $router->urlForRoute('base_edit'))); // $item->addItem('main', array('label' => $language->text('base', 'preference_index'), 'url' => $router->urlForRoute('base_preference_index'))); if (OW::getUser()->isAdmin() || BOL_AuthorizationService::getInstance()->isModerator()) { $item->addItem('main', array('label' => $language->text('base', 'moderation_tools'), 'url' => $router->urlForRoute('base.moderation_tools'))); } $item->addItem('foot', array('label' => $language->text('base', 'console_item_label_sign_out'), 'url' => $router->urlForRoute('base_sign_out'))); $addItemsEvent = new BASE_CLASS_EventCollector('base.add_main_console_item'); OW::getEventManager()->trigger($addItemsEvent); $addItems = $addItemsEvent->getData(); // echo '<pre>'; // print_r($addItems); // echo '</pre>'; foreach ($addItems as $addItem) { if (!empty($addItem['label']) && !empty($addItem['url'])) { // $item->addItem('main', array('label' => $addItem['label'], 'url' => $addItem['url'])); } } $event->addItem($item, 2); if (OW::getUser()->isAdmin()) { $item = new BASE_CMP_ConsoleDropdownMenu($language->text('admin', 'main_menu_admin')); $item->setUrl($router->urlForRoute('admin_default')); $item->addItem('head', array('label' => $language->text('admin', 'console_item_admin_dashboard'), 'url' => $router->urlForRoute('admin_default'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_theme'), 'url' => $router->urlForRoute('admin_themes_edit'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_users'), 'url' => $router->urlForRoute('admin_users_browse'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_pages'), 'url' => $router->urlForRoute('admin_pages_main'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_plugins'), 'url' => $router->urlForRoute('admin_plugins_installed'))); $event->addItem($item, 1); } } else { $buttonListEvent = new BASE_CLASS_EventCollector(BASE_CMP_ConnectButtonList::HOOK_REMOTE_AUTH_BUTTON_LIST); OW::getEventManager()->trigger($buttonListEvent); $buttonList = $buttonListEvent->getData(); $iconListMarkup = ''; foreach ($buttonList as $button) { $iconListMarkup .= '<span class="ow_ico_signin ' . $button['iconClass'] . '"></span>'; } $cmp = new BASE_CMP_SignIn(true); $signInMarkup = '<div style="display:none"><div id="base_cmp_floatbox_ajax_signin">' . $cmp->render() . '</div></div>'; $item = new BASE_CMP_ConsoleItem(); $item->setControl($signInMarkup . '<span class="ow_signin_label' . (empty($buttonList) ? '' : ' ow_signin_delimiter') . '">' . $language->text('base', 'sign_in_submit_label') . '</span>' . $iconListMarkup); $event->addItem($item, 2); OW::getDocument()->addOnloadScript("\n \$('#" . $item->getUniqId() . "').click(function(){new OW_FloatBox({ \$contents: \$('#base_cmp_floatbox_ajax_signin')});});\n "); $item = new BASE_CMP_ConsoleButton($language->text('base', 'console_item_sign_up_label'), OW::getRouter()->urlForRoute('base_join')); $event->addItem($item, 1); } $item = new BASE_CMP_ConsoleSwitchLanguage(); $event->addItem($item, 0); }
public function collectItems(BASE_CLASS_ConsoleItemCollector $event) { $toplinks = TOPLINK_BOL_Service::getInstance()->getToplink(false); $prefericon = 1; if (!empty($toplinks)) { foreach ($toplinks as $toplink) { $eventContent = array(); if (empty($toplink->itemname)) { $eventContent['notitle'] = 1; } if (!empty($toplink->icon)) { $toplink->icon = preg_match('/^\\//', $toplink->icon) ? OW::getPluginManager()->getPlugin('base')->getUserFilesUrl() . 'avatars' . $toplink->icon : $toplink->icon; if (!empty($toplink->itemname)) { $label = "<span style=\"display:inline;padding-left:21px;background:url('" . $toplink->icon . "') no-repeat scroll left center transparent;\" >" . $toplink->itemname . "</span>"; } else { $label = "<span style=\"display:inline;padding-left:21px;width:21px;background:url('" . $toplink->icon . "') no-repeat scroll center center transparent;\" ></span>"; } } else { $toplink->icon = OW::getPluginManager()->getPlugin('toplink')->getStaticUrl() . 'images/no-title-16.png'; $label = $toplink->itemname; } /*-- check for children --*/ $toplinkchild = TOPLINK_BOL_Service::getInstance()->getTopLinkChildObjectByParentId($toplink->id); if (!empty($toplinkchild)) { $item = new BASE_CMP_ConsoleDropdownMenu($label, 'toplink'); $item->addClass('ow_toplink_' . mt_rand(100, 10000) . '_list'); foreach ($toplinkchild as $children) { $itemarr = array(); $itemarr['url'] = $children->url; $itemarr['label'] = $children->name; $item->addItem('xxxx', $itemarr); } } else { $item = new BASE_CMP_ConsoleItem(); $template = OW::getPluginManager()->getPlugin('toplink')->getCmpViewDir() . 'top_link_item.html'; $item->setTemplate($template); $eventContent['name'] = $toplink->itemname; $eventContent['icon'] = $toplink->icon; $eventContent['url'] = $toplink->url; $eventContent['target'] = $toplink->target; $item->setContent($eventContent); } $event->addItem($item, $toplink->order); /*-- check for children --*/ } } }
public function collectItems(BASE_CLASS_ConsoleItemCollector $event) { $language = OW::getLanguage(); $router = OW::getRouter(); if (OW::getUser()->isAuthenticated()) { // Admin menu if (OW::getUser()->isAdmin()) { $item = new BASE_CMP_ConsoleDropdownMenu($language->text('admin', 'main_menu_admin')); $item->setUrl($router->urlForRoute('admin_default')); $item->addItem('head', array('label' => $language->text('admin', 'console_item_admin_dashboard'), 'url' => $router->urlForRoute('admin_default'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_theme'), 'url' => $router->urlForRoute('admin_themes_edit'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_users'), 'url' => $router->urlForRoute('admin_users_browse'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_pages'), 'url' => $router->urlForRoute('admin_pages_main'))); $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_plugins'), 'url' => $router->urlForRoute('admin_plugins_installed'))); $event->addItem($item, 1); } /** * My Profile Menu * * @var $item BASE_CMP_MyProfileConsoleItem */ $item = OW::getClassInstance("BASE_CMP_MyProfileConsoleItem"); $event->addItem($item, 2); } else { $buttonListEvent = new BASE_CLASS_EventCollector(BASE_CMP_ConnectButtonList::HOOK_REMOTE_AUTH_BUTTON_LIST); OW::getEventManager()->trigger($buttonListEvent); $buttonList = $buttonListEvent->getData(); $iconListMarkup = ''; foreach ($buttonList as $button) { $iconListMarkup .= '<span class="ow_ico_signin ' . $button['iconClass'] . '"></span>'; } $cmp = new BASE_CMP_SignIn(true); $signInMarkup = '<div style="display:none"><div id="base_cmp_floatbox_ajax_signin">' . $cmp->render() . '</div></div>'; $item = new BASE_CMP_ConsoleItem(); $item->setControl($signInMarkup . '<span class="ow_signin_label' . (empty($buttonList) ? '' : ' ow_signin_delimiter') . '">' . $language->text('base', 'sign_in_submit_label') . '</span>' . $iconListMarkup); $event->addItem($item, 2); OW::getDocument()->addOnloadScript("\n \$('#" . $item->getUniqId() . "').click(function(){new OW_FloatBox({ \$contents: \$('#base_cmp_floatbox_ajax_signin')});});\n "); $item = new BASE_CMP_ConsoleButton($language->text('base', 'console_item_sign_up_label'), OW::getRouter()->urlForRoute('base_join')); $event->addItem($item, 1); } $item = new BASE_CMP_ConsoleSwitchLanguage(); $event->addItem($item, 0); }
public function render() { $this->consoleItem->setControl(parent::render()); return $this->consoleItem->render(); }