ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 (string $a_component, string $a_event, array $a_parameter)
 

Static Protected Member Functions

static storeElement (string $a_command, array $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

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

Member Function Documentation

◆ handleEvent()

static ilSearchAppEventListener::handleEvent ( string  $a_component,
string  $a_event,
array  $a_parameter 
)
static

Implements ilAppEventListener.

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

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

40  : void
41  {
42  if (!isset($a_parameter['obj_id'])) {
43  return;
44  }
45 
46  // only for files in the moment
47  if (!isset($a_parameter['obj_type'])) {
48  $type = ilObject::_lookupType($a_parameter['obj_id']);
49  } else {
50  $type = $a_parameter['obj_type'];
51  }
52 
53  if ($type != 'file' and
54  $type != 'htlm') {
55  return;
56  }
57 
58  switch ($a_component) {
59  case 'Services/Help':
60  case 'Services/Object':
61 
62  switch ($a_event) {
63  case 'undelete':
64  case 'update':
66  break;
67 
68  case 'create':
70  break;
71 
72  case 'delete':
73  case 'toTrash':
75  break;
76 
77  default:
78  return;
79  }
80  ilSearchAppEventListener::storeElement($command, $a_parameter);
81  }
82  }
$type
static storeElement(string $a_command, array $a_params)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ storeElement()

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

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

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

Referenced by handleEvent().

84  : bool
85  {
86  if (!$a_command) {
87  return false;
88  }
89 
90  if (!isset($a_params['obj_id']) or !$a_params['obj_id']) {
91  return false;
92  }
93 
94  if (!isset($a_params['obj_type']) or !$a_params['obj_type']) {
95  $a_params['obj_type'] = ilObject::_lookupType($a_params['obj_id']);
96  }
97  ilLoggerFactory::getLogger('src')->debug('Handling new command: ' . $a_command . ' for type ' . $a_params['obj_type']);
98 
99  $element = new ilSearchCommandQueueElement();
100  $element->setObjId($a_params['obj_id']);
101  $element->setObjType($a_params['obj_type']);
102  $element->setCommand($a_command);
103 
104  ilSearchCommandQueue::factory()->store($element);
105  return true;
106  }
static getLogger(string $a_component_id)
Get component logger.
Represents an entry for the search command queue.
static factory()
get singleton instance
static _lookupType(int $id, bool $reference=false)
+ 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: