public function __construct() { parent::__construct(); $this->service = NOTIFICATIONS_BOL_Service::getInstance(); $this->addJob('expireUnsubscribe', 60 * 60); $this->addJob('deleteExpired', 60 * 60); $this->addJob('fillSendQueue', 10); }
public function countNewItems(BASE_CLASS_EventCollector $event) { $params = $event->getParams(); if ($params['page'] == self::CONSOLE_PAGE_KEY) { $service = NOTIFICATIONS_BOL_Service::getInstance(); $event->add(array(self::CONSOLE_SECTION_KEY => $service->findNotificationCount(OW::getUser()->getId(), false))); } }
/** * Constructor. */ public function __construct() { parent::__construct(); $this->service = NOTIFICATIONS_BOL_Service::getInstance(); $count = $this->service->findNotificationCount(OW::getUser()->getId()); if (!$count) { $this->setVisible(false); } }
/** * Constructor. */ public function __construct($timestamp) { parent::__construct(); $service = NOTIFICATIONS_BOL_Service::getInstance(); $userId = OW::getUser()->getId(); $notifications = $service->findNewNotificationList($userId, $timestamp); $items = NOTIFICATIONS_MCMP_ConsoleItems::prepareData($notifications); $this->assign('items', $items); // Mark as viewed $service->markNotificationsViewedByUserId($userId); $tpl = OW::getPluginManager()->getPlugin('notifications')->getMobileCmpViewDir() . 'console_items.html'; $this->setTemplate($tpl); }
/** * Constructor. */ public function __construct($limit, $exclude = null) { parent::__construct(); $service = NOTIFICATIONS_BOL_Service::getInstance(); $userId = OW::getUser()->getId(); $notifications = $service->findNotificationList($userId, time(), $exclude, $limit); $items = self::prepareData($notifications); $this->assign('items', $items); $notificationIdList = array(); foreach ($items as $id => $item) { $notificationIdList[] = $id; } // Mark as viewed $service->markNotificationsViewedByUserId($userId); $exclude = is_array($exclude) ? array_merge($exclude, $notificationIdList) : $notificationIdList; $loadMore = (bool) $service->findNotificationCount($userId, null, $exclude); if (!$loadMore) { $script = "OWM.trigger('mobile.console_hide_notifications_load_more', {});"; OW::getDocument()->addOnloadScript($script); } }
private function winkBack($params) { if (empty($params['userId']) || empty($params['partnerId']) || empty($params['messageId']) || ($wink = $this->service->findWinkByUserIdAndPartnerId($params['userId'], $params['partnerId'])) === NULL) { return array('result' => FALSE, 'msg' => OW::getLanguage()->text('winks', 'wink_back_error')); } if ($this->service->setWinkback($wink->getId(), TRUE)) { if (OW::getPluginManager()->isPluginActive('notifications')) { $rule = NOTIFICATIONS_BOL_Service::getInstance()->findRuleList($wink->userId, array('wink_email_notification')); if (!isset($rule['wink_email_notification']) || (int) $rule['wink_email_notification']->checked) { $this->sendWinkEmailNotification($wink->partnerId, $wink->userId, self::EMAIL_BACK); } } } $event = new OW_Event('winks.onWinkBack', array('userId' => $wink->getUserId(), 'partnerId' => $wink->getPartnerId(), 'conversationId' => $wink->getConversationId(), 'content' => array('entityType' => 'wink', 'eventName' => 'renderWinkBack', 'params' => array('winkId' => $wink->id, 'messageId' => $params['messageId'])))); OW::getEventManager()->trigger($event); }
private function __construct() { $this->service = NOTIFICATIONS_BOL_Service::getInstance(); }
public function process($data, $actions, $dtoList) { $userId = OW::getUser()->getId(); $result = 0; $service = NOTIFICATIONS_BOL_Service::getInstance(); if (!empty($data['schedule'])) { $result += (int) $service->setSchedule($userId, $data['schedule']); unset($data['schedule']); } foreach ($actions as $action) { /* @var $dto NOTIFICATIONS_BOL_Rule */ if (empty($dtoList[$action])) { $dto = new NOTIFICATIONS_BOL_Rule(); $dto->userId = $userId; $dto->action = $action; } else { $dto = $dtoList[$action]; } $checked = (int) (!empty($data[$action])); if (!empty($dto->id) && $dto->checked == $checked) { continue; } $dto->checked = $checked; $result++; $service->saveRule($dto); } return $result; }