Example #1
0
		/**
		* Зарегистрировать событие в истории событий
		* @param string $eventTypeId идентификатор типа события
		* @param array $params массив параметров события
		* @param int $elementId id связанной страницы
		* @param int $objectId id связанного объекта
		*/
		public function registerEvent($eventTypeId, $params = array(), $elementId = null, $objectId = null) {
			
			$pool = ConnectionPool::getInstance();
			$connection = $pool->getConnection();
			umiEventFeed::setConnection($connection);
			umiEventFeedType::setConnection($connection);
					
			try {
				$eventType = umiEventFeedType::get($eventTypeId);
			} catch (Exception $e) {
				$eventType = umiEventFeedType::create($eventTypeId);
			}
			
			$userId = permissionsCollection::getInstance()->getUserId();
			$user = umiObjectsCollection::getInstance()->getObject($userId)->getName();
			
			$module = cmsController::getInstance()->getModule('users');
			$link = $module->getObjectEditLink($userId);
			
			array_unshift($params, $user);
			array_unshift($params, $link);
			umiEventFeed::create($eventType, $params, $elementId, $objectId);
			
			$maxDays = (int) regedit::getInstance()->getVal("//modules/events/max-days-storing-events");
			if ($maxDays > 0) {
				$lastDate = time() - ($maxDays * 24 * 60 * 60);
				umiEventFeed::deleteList(array(), $lastDate);
			}
			
		}
 public function onObjectView(iUmiEventPoint $event)
 {
     if ($event->getMode() == 'before') {
         $objectId = $event->getRef('object')->getId();
         $user = $this->getUser();
         $pool = ConnectionPool::getInstance();
         $connection = $pool->getConnection();
         umiEventFeed::setConnection($connection);
         $eventId = umiEventFeed::findEventIdByObjectId($objectId);
         if ($eventId) {
             umiEventFeed::markReadEvent($eventId, $user->getId());
         }
     }
 }
 public function onObjectView(iUmiEventPoint $v4119639092e62c55ea8be348e4d9260d)
 {
     if ($v4119639092e62c55ea8be348e4d9260d->getMode() == 'before') {
         $v16b2b26000987faccb260b9d39df1269 = $v4119639092e62c55ea8be348e4d9260d->getRef('object')->getId();
         $vee11cbb19052e40b07aac0ca060c23ee = $this->getUser();
         $vb10a8c0bede9eb4ea771b04db3149f28 = ConnectionPool::getInstance();
         $v4717d53ebfdfea8477f780ec66151dcb = $vb10a8c0bede9eb4ea771b04db3149f28->getConnection();
         umiEventFeed::setConnection($v4717d53ebfdfea8477f780ec66151dcb);
         $v53cc4db543d7a569e51c1d76ac6f278e = umiEventFeed::findEventIdByObjectId($v16b2b26000987faccb260b9d39df1269);
         if ($v53cc4db543d7a569e51c1d76ac6f278e) {
             umiEventFeed::markReadEvent($v53cc4db543d7a569e51c1d76ac6f278e, $vee11cbb19052e40b07aac0ca060c23ee->getId());
         }
     }
 }
Example #4
0
 public function registerEvent($v803e96ab2d19ace0f4af5786a470117e, $v21ffce5b8a6cc8cc6a41448dd69623c9 = array(), $v7552cd149af7495ee7d8225974e50f80 = null, $v16b2b26000987faccb260b9d39df1269 = null)
 {
     $vb10a8c0bede9eb4ea771b04db3149f28 = ConnectionPool::getInstance();
     $v4717d53ebfdfea8477f780ec66151dcb = $vb10a8c0bede9eb4ea771b04db3149f28->getConnection();
     umiEventFeed::setConnection($v4717d53ebfdfea8477f780ec66151dcb);
     umiEventFeedType::setConnection($v4717d53ebfdfea8477f780ec66151dcb);
     try {
         $v2f264034c73acbd6baae70dd7edb3d3f = umiEventFeedType::get($v803e96ab2d19ace0f4af5786a470117e);
     } catch (Exception $ve1671797c52e15f763380b45e841ec32) {
         $v2f264034c73acbd6baae70dd7edb3d3f = umiEventFeedType::create($v803e96ab2d19ace0f4af5786a470117e);
     }
     $v8e44f0089b076e18a718eb9ca3d94674 = permissionsCollection::getInstance()->getUserId();
     $vee11cbb19052e40b07aac0ca060c23ee = umiObjectsCollection::getInstance()->getObject($v8e44f0089b076e18a718eb9ca3d94674)->getName();
     $v22884db148f0ffb0d830ba431102b0b5 = cmsController::getInstance()->getModule('users');
     $v2a304a1348456ccd2234cd71a81bd338 = $v22884db148f0ffb0d830ba431102b0b5->getObjectEditLink($v8e44f0089b076e18a718eb9ca3d94674);
     array_unshift($v21ffce5b8a6cc8cc6a41448dd69623c9, $vee11cbb19052e40b07aac0ca060c23ee);
     array_unshift($v21ffce5b8a6cc8cc6a41448dd69623c9, $v2a304a1348456ccd2234cd71a81bd338);
     umiEventFeed::create($v2f264034c73acbd6baae70dd7edb3d3f, $v21ffce5b8a6cc8cc6a41448dd69623c9, $v7552cd149af7495ee7d8225974e50f80, $v16b2b26000987faccb260b9d39df1269);
     $v5a0eeddea3917f781ddb458441cc2a3e = (int) regedit::getInstance()->getVal("//modules/events/max-days-storing-events");
     if ($v5a0eeddea3917f781ddb458441cc2a3e > 0) {
         $v636843b5194c655771a1f62d6690ced4 = time() - $v5a0eeddea3917f781ddb458441cc2a3e * 24 * 60 * 60;
         umiEventFeed::deleteList(array(), $v636843b5194c655771a1f62d6690ced4);
     }
 }
 public static function setConnection(iConnection $v4717d53ebfdfea8477f780ec66151dcb)
 {
     self::$connection = $v4717d53ebfdfea8477f780ec66151dcb;
 }
Example #6
0
 public function markUnreadEvents($events = null)
 {
     if (!is_array($events)) {
         $events = getRequest('events');
     }
     if (is_array($events)) {
         $user = $this->getUser();
         $pool = ConnectionPool::getInstance();
         $connection = $pool->getConnection();
         umiEventFeed::setConnection($connection);
         foreach ($events as $eventId) {
             umiEventFeed::markUnreadEvent($eventId, $user->getId());
         }
     }
 }
Example #7
0
 public function markUnreadEvents($v16908b0605f2645dfcb4c3a8d248cef3 = null)
 {
     if (!is_array($v16908b0605f2645dfcb4c3a8d248cef3)) {
         $v16908b0605f2645dfcb4c3a8d248cef3 = getRequest('events');
     }
     if (is_array($v16908b0605f2645dfcb4c3a8d248cef3)) {
         $vee11cbb19052e40b07aac0ca060c23ee = $this->getUser();
         $vb10a8c0bede9eb4ea771b04db3149f28 = ConnectionPool::getInstance();
         $v4717d53ebfdfea8477f780ec66151dcb = $vb10a8c0bede9eb4ea771b04db3149f28->getConnection();
         umiEventFeed::setConnection($v4717d53ebfdfea8477f780ec66151dcb);
         foreach ($v16908b0605f2645dfcb4c3a8d248cef3 as $v53cc4db543d7a569e51c1d76ac6f278e) {
             umiEventFeed::markUnreadEvent($v53cc4db543d7a569e51c1d76ac6f278e, $vee11cbb19052e40b07aac0ca060c23ee->getId());
         }
     }
 }