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);
 }
Example #2
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 __construct()
 {
     $this->userName = OW::getUser()->getUserObject()->getUsername();
     $this->userId = OW::getUser()->getId();
     $label = BOL_UserService::getInstance()->getDisplayName($this->userId);
     parent::__construct($label, self::KEY);
     $url = OW::getRouter()->urlForRoute('base_user_profile', array('username' => $this->userName));
     $this->setUrl($url);
     $this->collectItems();
 }
Example #4
0
 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);
 }
Example #5
0
 public function collectItems(BASE_CLASS_ConsoleItemCollector $event)
 {
     $language = OW::getLanguage();
     $router = OW::getRouter();
     if (OW::getUser()->isAuthenticated()) {
         $userId = OW::getUser()->getId();
         $credits = USERCREDITS_BOL_CreditsService::getInstance()->getCreditsBalance($userId);
         $item = new BASE_CMP_ConsoleDropdownMenu($language->text('credits', 'action_label', array('credits' => $credits)));
         $item->setUrl($router->urlForRoute('base_user_profile', array('username' => OW::getUser()->getUserObject()->getUsername())));
         if (OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('credits')) {
             $item->addItem('main', array('label' => $language->text('credits', 'view_admin_logs'), 'url' => $router->urlForRoute('credits_admin_logs')));
         }
         $item->addItem('main', array('label' => $language->text('credits', 'my_credit_log'), 'url' => $router->urlForRoute('credits_logs', array('type' => 'all'))));
         $item->addItem('main', array('label' => $language->text('credits', 'send_credits'), 'url' => $router->urlForRoute('credits_transfer')));
         $item->addItem('main', array('label' => $language->text('credits', 'buy_credits'), 'url' => $router->urlForRoute('usercredits.buy_credits')));
         $addItemsEvent = new BASE_CLASS_EventCollector('base.add_main_console_item');
         OW::getEventManager()->trigger($addItemsEvent);
         $event->addItem($item, 7);
     }
 }