Пример #1
0
 /**
  * @return MBOL_ConsoleService
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Пример #2
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $sections = MBOL_ConsoleService::getInstance()->getPageSections('notifications');
     $tplSections = array();
     foreach ($sections as $section) {
         $tplSections[] = $section['item'];
     }
     $this->assign('items', $tplSections);
 }
Пример #3
0
 public function ping(OW_Event $e)
 {
     $params = $e->getParams();
     $state = $params['state'];
     $timestamp = $params['timestamp'];
     $service = MBOL_ConsoleService::getInstance();
     $count = $service->countNewItems();
     $response = array('count' => $count);
     if ($state == "open" && $count) {
         $response['new_items'] = $service->getNewItems(self::CONSOLE_NOTIFICATIONS_PAGE_KEY, $timestamp);
     }
     $response['timestamp'] = time();
     $e->setData($response);
 }
Пример #4
0
 public function onDocRenderAddJsDeclarations($e)
 {
     $scriptGen = UTIL_JsGenerator::newInstance()->setVariable(array('OWM', 'ajaxComponentLoaderRsp'), OW::getRouter()->urlFor('BASE_MCTRL_AjaxLoader', 'component'));
     //UsersApi
     $scriptGen->newObject(array('OW', 'Users'), 'OWM_UsersApi', array(array("rsp" => OW::getRouter()->urlFor('BASE_CTRL_AjaxUsersApi', 'rsp'))));
     // Right console initialization
     if (OW::getUser()->isAuthenticated()) {
         OW::getLanguage()->addKeyForJs('base', 'mobile_disabled_item_message');
         $params = array('pages' => MBOL_ConsoleService::getInstance()->getPages(), 'rspUrl' => OW::getRouter()->urlFor('BASE_MCTRL_Ping', 'index'), 'lastFetchTime' => time(), 'pingInterval' => 10, 'desktopUrl' => OW::getRouter()->urlForRoute('base.desktop_version'));
         $scriptGen->addScript('
         var mconsole = new OWM_Console(' . json_encode($params) . ');
         mconsole.init();
     ');
     }
     OW::getDocument()->addScriptDeclaration($scriptGen->generateJs());
 }
Пример #5
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $pages = MBOL_ConsoleService::getInstance()->getPages();
     $this->assign('pages', $pages);
 }