public function systemEventsNotify(iUmiEventPoint $event)
 {
     $eventId = $event->getEventId();
     $titleLabel = $titleLabel = 'event-' . $eventId . '-title';
     $contentLabel = 'event-' . $eventId . '-content';
     $title = getLabel($titleLabel, 'common/content/config');
     $content = getLabel($contentLabel, 'common/content/config');
     if ($titleLabel == $title) {
         return;
     }
     if ($element = $event->getRef('element')) {
         $hierarchy = umiHierarchy::getInstance();
         $oldbForce = $hierarchy->forceAbsolutePath(true);
         $params = array('%page-name%' => $element->name, '%page-link%' => $element->link);
         $hierarchy->forceAbsolutePath($oldbForce);
     } else {
         $params = array();
     }
     if ($object = $event->getRef('object')) {
         $params['%object-name%'] = $object->name;
         $objectTypes = umiObjectTypesCollection::getInstance();
         $objectType = $objectTypes->getType($object->getTypeId());
         if ($hierarchyTypeId = $objectType->getHierarchyTypeId()) {
             $hierarchyTypes = umiHierarchyTypesCollection::getInstance();
             $hierarchyType = $hierarchyTypes->getType($hierarchyTypeId);
             $params['%object-type%'] = $hierarchyType->getTitle();
         }
     }
     $title = str_replace(array_keys($params), array_values($params), $title);
     $content = str_replace(array_keys($params), array_values($params), $content);
     $this->dispatchSystemEvent($title, $content);
 }
Esempio n. 2
0
 public function onPageCreate(iUmiEventPoint $event)
 {
     if (!$event->getRef('element') instanceof umiHierarchyElement) {
         return;
     }
     $pageId = $event->getRef('element')->getId();
     $hierarchy = umiHierarchy::getInstance();
     $page = $hierarchy->getElement($pageId);
     $postparams = http_build_query(array('message' => $page->content, 'title' => $page->name, 'link' => 'http://netizenhostels.com' . $hierarchy->getPathById($page->id) . '?media=mobile'));
     $options = array("http" => array("method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded", "content" => $postparams));
     $context = stream_context_create($options);
     $result = file_get_contents('http://netizen.octopod.com/push/send_message.php', false, $context);
     //	        if ($page->getIsActive()) {
     //	        file_get_contents('http://netizen.octopod.com/push/send_message.php?message='.$page->altName);
     /*
     				file_put_contents(
     					sys_get_temp_dir().'/zzzzzy',print_r(array(
     						'id' => $page->id,
     						'name' => $page->name,
     						'permalink' => $page->altName,
     						'anons' => $page->anons,
     						'content' => $page->content,
     						'url' => $hierarchy->getPathById($page->id)
     					),true)
     				);
     */
     //	        }
 }
Esempio n. 3
0
 public function onPopularRefresh(iUmiEventPoint $event)
 {
     static $price = false, $element = false;
     if ($event->getMode() == "before") {
         $order_item = $event->getRef('orderItem');
         $element = $order_item->getItemElement();
         $price = $order_item->getTotalActualPrice();
     } else {
         if ($price && $element) {
             $new_price = $event->getRef('totalActualPrice');
             if ($new_price > $price) {
                 $visits = $element->getValue('popular');
                 if ($visits) {
                     $element->setValue('popular', $visits + 1);
                 } else {
                     $element->setValue('popular', 1);
                 }
                 $element->commit();
             }
         }
     }
 }
 public function onChangeActivity(iUmiEventPoint $oEventPoint)
 {
     if ($oEventPoint->getMode() === "after") {
         $element = $oEventPoint->getRef("element");
         if (!$element->getIsActive()) {
             return true;
         }
         $type_id = $element->getTypeId();
         $type = umiHierarchyTypesCollection::getInstance()->getType($type_id);
         if ($type->getName() == "faq" && $type->getExt() == "question") {
             return $this->confirmUserAnswer($element);
         }
     }
 }
 public function onElementAppend(iUmiEventPoint $oEventPoint)
 {
     if ($oEventPoint->getMode() === 'after') {
         $o_element = $oEventPoint->getRef('element');
         if ($o_element instanceof umiHierarchyElement) {
             $i_element_type = intval($o_element->getTypeId());
             if ($i_element_type && ($i_element_type === $this->getHTypeByName('topic') || $i_element_type === $this->getHTypeByName('message'))) {
                 // increase
                 $this->recalcCounts($o_element);
                 // publish_time
                 $publish_time = new umiDate(time());
                 $o_element->setValue("publish_time", $publish_time);
                 $o_element->commit();
             }
         }
     }
 }
Esempio n. 6
0
		public function onDeliveryStatusChanged(iUmiEventPoint $event) {
			if($event->getMode() == "after" &&
				$event->getParam("old-status-id") != $event->getParam("new-status-id")) {
				$order = $event->getRef("order");
				$this->notifyOrderStatusChange($order, "delivery_status_id");
			}
		}
 public function onEmarketOrderAdded(iUmiEventPoint $event)
 {
     if ($event->getMode() == "after" && $event->getParam("old-status-id") != $event->getParam("new-status-id")) {
         if ($event->getParam("new-status-id") == order::getStatusByCode('waiting') && $event->getParam("old-status-id") != order::getStatusByCode('editing')) {
             $module = cmsController::getInstance()->getModule('emarket');
             $order = $event->getRef("order");
             $link = $module->getObjectEditLink($order->getId(), 'order');
             $this->registerEvent('emarket-order-add', array($link, $order->getName()), null, $order->getId());
         }
     }
 }
 public function onEmarketOrderAdded(iUmiEventPoint $v4119639092e62c55ea8be348e4d9260d)
 {
     if ($v4119639092e62c55ea8be348e4d9260d->getMode() == "after" && $v4119639092e62c55ea8be348e4d9260d->getParam("old-status-id") != $v4119639092e62c55ea8be348e4d9260d->getParam("new-status-id")) {
         if ($v4119639092e62c55ea8be348e4d9260d->getParam("new-status-id") == order::getStatusByCode('waiting') && $v4119639092e62c55ea8be348e4d9260d->getParam("old-status-id") != order::getStatusByCode('editing')) {
             $v22884db148f0ffb0d830ba431102b0b5 = cmsController::getInstance()->getModule('emarket');
             $v70a17ffa722a3985b86d30b034ad06d7 = $v4119639092e62c55ea8be348e4d9260d->getRef("order");
             $v2a304a1348456ccd2234cd71a81bd338 = $v22884db148f0ffb0d830ba431102b0b5->getObjectEditLink($v70a17ffa722a3985b86d30b034ad06d7->getId(), 'order');
             $this->registerEvent('emarket-order-add', array($v2a304a1348456ccd2234cd71a81bd338, $v70a17ffa722a3985b86d30b034ad06d7->getName()), null, $v70a17ffa722a3985b86d30b034ad06d7->getId());
         }
     }
 }
 public function onOrderDelete(iUmiEventPoint $e)
 {
     if ($e->getMode() != 'before') {
         return;
     }
     $object = $e->getRef('object');
     if ($object instanceof iUmiObject) {
         $type = selector::get('object-type')->id($object->getTypeId());
         if ($type && $type->getMethod() == 'order') {
             $order = order::get($object->id);
             $order->unreserve();
             $order->commit();
         }
     }
 }
Esempio n. 10
0
 public function onModifyElementAntispam(iUmiEventPoint $event)
 {
     static $cache = array();
     $element = $event->getRef("element");
     if (!$element) {
         return;
     }
     if ($event->getMode() == "before") {
         $data = getRequest("data");
         if (isset($data[$element->getId()])) {
             $oldValue = getArrayKey($data[$element->getId()], 'is_spam');
             if ($oldValue != $element->getValue("is_spam")) {
                 $cache[$element->getId()] = true;
             }
         }
     } else {
         if (isset($cache[$element->getId()])) {
             $type = umiHierarchyTypesCollection::getInstance()->getTypeByName("faq", "question");
             $contentField = $type->getId() == $element->getTypeId() ? 'question' : 'content';
             antiSpamHelper::report($element->getId(), $contentField);
         }
     }
 }