public function onBeforeRender() { parent::onBeforeRender(); $limit = MBOL_ConsoleService::SECTION_ITEMS_LIMIT; $this->addComponent('itemsCmp', new BASE_MCMP_ConsoleInvitations($limit)); $this->assign('loadMore', $this->service->findInvitationCount(OW::getUser()->getId()) > $limit); $params = array('cmdUrl' => OW::getRouter()->urlFor('BASE_MCTRL_Invitations', 'command')); $script = 'var invitationsConsole = new OWM_InvitationsConsole(' . json_encode($params) . ');'; OW::getDocument()->addOnloadScript($script); }
public function ping(BASE_CLASS_ConsoleDataEvent $event) { $userId = OW::getUser()->getId(); $data = $event->getItemData(self::CONSOLE_ITEM_KEY); $allInvitationCount = $this->service->findInvitationCount($userId); $newInvitationCount = $this->service->findInvitationCount($userId, false); $data['counter'] = array('all' => $allInvitationCount, 'new' => $newInvitationCount); $event->setItemData('invitation', $data); }