Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/event_manager.php
Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Line(s) | |||||
if ( !$event->SkipBeforeHooks ) { | if ( !$event->SkipBeforeHooks ) { | ||||
$this->Hooks->runHooks($event, hBEFORE); | $this->Hooks->runHooks($event, hBEFORE); | ||||
if ( $event->status == kEvent::erFATAL ) { | if ( $event->status == kEvent::erFATAL ) { | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
/** @var kEventHandler $event_handler */ | |||||
$event_handler = $this->Application->recallObject($event->Prefix . '_EventHandler'); | $event_handler = $this->Application->recallObject($event->Prefix . '_EventHandler'); | ||||
/* @var $event_handler kEventHandler */ | |||||
$event_handler->processEvent($event); | $event_handler->processEvent($event); | ||||
if ( $event->status == kEvent::erFATAL ) { | if ( $event->status == kEvent::erFATAL ) { | ||||
return; | return; | ||||
} | } | ||||
if ( !$event->SkipAfterHooks ) { | if ( !$event->SkipAfterHooks ) { | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
} | } | ||||
$where_clause = Array (); | $where_clause = Array (); | ||||
$where_clause['EmailTemplateId'] = 'EmailTemplateId = ' . $email_template['TemplateId']; | $where_clause['EmailTemplateId'] = 'EmailTemplateId = ' . $email_template['TemplateId']; | ||||
try { | try { | ||||
$category_ids = Array (); | $category_ids = Array (); | ||||
/** @var kDBItem $category */ | |||||
$category = $this->Application->recallObject('c'); | $category = $this->Application->recallObject('c'); | ||||
/* @var $category kDBItem */ | |||||
if ( $category->isLoaded() ) { | if ( $category->isLoaded() ) { | ||||
$category_ids = explode('|', substr($category->GetDBField('ParentPath'), 1, -1)); | $category_ids = explode('|', substr($category->GetDBField('ParentPath'), 1, -1)); | ||||
} | } | ||||
} | } | ||||
catch (Exception $e) { | catch (Exception $e) { | ||||
} | } | ||||
$where_clause['CategoryId'] = $this->_getSubscriberFilter('CategoryId', $category_ids, true); | $where_clause['CategoryId'] = $this->_getSubscriberFilter('CategoryId', $category_ids, true); | ||||
try { | try { | ||||
$item_id = $parent_item_id = false; | $item_id = $parent_item_id = false; | ||||
/** @var kDBItem $object */ | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBItem */ | |||||
if ( $object->isLoaded() ) { | if ( $object->isLoaded() ) { | ||||
$item_id = $object->GetID(); | $item_id = $object->GetID(); | ||||
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix'); | $parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix'); | ||||
if ( $parent_prefix ) { | if ( $parent_prefix ) { | ||||
$parent_item_id = $object->getParentId($parent_prefix); | $parent_item_id = $object->getParentId($parent_prefix); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | |||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function eventImplemented(kEvent $event) | public function eventImplemented(kEvent $event) | ||||
{ | { | ||||
if ( !$this->verifyEventPrefix($event, true) ) { | if ( !$this->verifyEventPrefix($event, true) ) { | ||||
return false; | return false; | ||||
} | } | ||||
/** @var kEventHandler $event_handler */ | |||||
$event_handler = $this->Application->recallObject($event->Prefix . '_EventHandler'); | $event_handler = $this->Application->recallObject($event->Prefix . '_EventHandler'); | ||||
/* @var $event_handler kEventHandler */ | |||||
return $event_handler->getEventMethod($event) != ''; | return $event_handler->getEventMethod($event) != ''; | ||||
} | } | ||||
/** | /** | ||||
* Checks if event prefix is valid | * Checks if event prefix is valid | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
* passed | * passed | ||||
* | * | ||||
* @param string $prefix_special | * @param string $prefix_special | ||||
* @param string $event_name | * @param string $event_name | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function setEvent($prefix_special,$event_name) | public function setEvent($prefix_special,$event_name) | ||||
{ | { | ||||
/** @var Params $actions */ | |||||
$actions = $this->Application->recallObject('kActions'); | $actions = $this->Application->recallObject('kActions'); | ||||
/* @var $actions Params */ | |||||
$actions->Set('events[' . $prefix_special . ']', $event_name); | $actions->Set('events[' . $prefix_special . ']', $event_name); | ||||
} | } | ||||
/** | /** | ||||
* Allows to determine, that required event is beeing processed right now | * Allows to determine, that required event is beeing processed right now | ||||
* | * | ||||
* @param string $event_key Event name in format prefix[.special]:event_name | * @param string $event_key Event name in format prefix[.special]:event_name | ||||
* @return bool | * @return bool | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function eventRunning($event_key) | public function eventRunning($event_key) | ||||
{ | { | ||||
return array_search($event_key, $this->recursionStack) !== false; | return array_search($event_key, $this->recursionStack) !== false; | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |