ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSearchAppEventListener Class Reference

Update search command queue from Services/Object events. More...

+ Inheritance diagram for ilSearchAppEventListener:
+ Collaboration diagram for ilSearchAppEventListener:

Static Public Member Functions

static handleEvent ($a_component, $a_event, $a_params)
 Handle an event in a listener. More...
 

Static Protected Member Functions

static storeElement ($a_command, $a_params)
 

Detailed Description

Update search command queue from Services/Object events.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 37 of file class.ilSearchAppEventListener.php.

Member Function Documentation

◆ handleEvent()

static ilSearchAppEventListener::handleEvent (   $a_component,
  $a_event,
  $a_params 
)
static

Handle an event in a listener.

Parameters
string$a_componentcomponent, e.g. "Modules/Forum" or "Services/User"
string$a_eventevent e.g. "createUser", "updateUser", "deleteUser", ...
array$a_parameterparameter array (assoc), array("name" => ..., "phone_office" => ...)

Implements ilAppEventListener.

Definition at line 47 of file class.ilSearchAppEventListener.php.

References $type, ilObject\_lookupType(), ilSearchCommandQueueElement\CREATE, ilSearchCommandQueueElement\DELETE, ilSearchCommandQueueElement\RESET, and storeElement().

48  {
49  // only for files in the moment
50  if (!isset($a_params['obj_type'])) {
51  $type = ilObject::_lookupType($a_params['obj_id']);
52  } else {
53  $type = $a_params['obj_type'];
54  }
55 
56  if ($type != 'file' and
57  $type != 'htlm') {
58  return;
59  }
60 
61  switch ($a_component) {
62  case 'Services/Help':
63  case 'Services/Object':
64 
65  switch ($a_event) {
66  case 'update':
68  break;
69 
70  case 'create':
72  break;
73 
74  case 'toTrash':
76  break;
77 
78  case 'delete':
80  break;
81 
82  case 'undelete':
84  break;
85 
86  default:
87  return true;
88  }
89 
90  ilSearchAppEventListener::storeElement($command, $a_params);
91  return true;
92  }
93  }
$type
static storeElement($a_command, $a_params)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ storeElement()

static ilSearchAppEventListener::storeElement (   $a_command,
  $a_params 
)
staticprotected

Definition at line 95 of file class.ilSearchAppEventListener.php.

References ilObject\_lookupType(), ilSearchCommandQueue\factory(), and ilLoggerFactory\getLogger().

Referenced by handleEvent().

96  {
97  if (!$a_command) {
98  return false;
99  }
100 
101  if (!isset($a_params['obj_id']) or !$a_params['obj_id']) {
102  return false;
103  }
104 
105  if (!isset($a_params['obj_type']) or !$a_params['obj_type']) {
106  $a_params['obj_type'] = ilObject::_lookupType($a_params['obj_id']);
107  }
108  ilLoggerFactory::getLogger('src')->debug('Handling new command: ' . $a_command . ' for type ' . $a_params['obj_type']);
109 
110  $element = new ilSearchCommandQueueElement();
111  $element->setObjId($a_params['obj_id']);
112  $element->setObjType($a_params['obj_type']);
113  $element->setCommand($a_command);
114 
115  ilSearchCommandQueue::factory()->store($element);
116  return true;
117  }
Represents an entry for the search command queue.
static factory()
get singleton instance
static _lookupType($a_id, $a_reference=false)
lookup object type
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: