ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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  {
52  $type = ilObject::_lookupType($a_params['obj_id']);
53  }
54  else
55  {
56  $type = $a_params['obj_type'];
57  }
58 
59  if($type != 'file' and
60  $type != 'htlm')
61  {
62  return;
63  }
64 
65  switch($a_component)
66  {
67  case 'Services/Help':
68  case 'Services/Object':
69 
70  switch($a_event)
71  {
72  case 'update':
74  break;
75 
76  case 'create':
78  break;
79 
80  case 'toTrash':
82  break;
83 
84  case 'delete':
86  break;
87 
88  case 'undelete':
90  break;
91 
92  default:
93  return true;
94  }
95 
96  ilSearchAppEventListener::storeElement($command,$a_params);
97  return true;
98  }
99  }
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 101 of file class.ilSearchAppEventListener.php.

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

Referenced by handleEvent().

102  {
103  if(!$a_command)
104  {
105  return false;
106  }
107 
108  if(!isset($a_params['obj_id']) or !$a_params['obj_id'])
109  {
110  return false;
111  }
112 
113  if(!isset($a_params['obj_type']) or !$a_params['obj_type'])
114  {
115  $a_params['obj_type'] = ilObject::_lookupType($a_params['obj_id']);
116  }
117  ilLoggerFactory::getLogger('src')->debug('Handling new command: '.$a_command.' for type '.$a_params['obj_type']);
118 
119  $element = new ilSearchCommandQueueElement();
120  $element->setObjId($a_params['obj_id']);
121  $element->setObjType($a_params['obj_type']);
122  $element->setCommand($a_command);
123 
124  ilSearchCommandQueue::factory()->store($element);
125  return true;
126  }
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: