ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 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  switch ($a_component) {
54  case 'Services/Search':
55  if ($a_event === 'contentChanged') {
57  }
58  break;
59 
60  case 'Services/Help':
61  case 'Services/Object':
62 
63  switch ($a_event) {
64  case 'undelete':
65  case 'update':
67  break;
68 
69  case 'create':
71  break;
72 
73  case 'delete':
74  case 'toTrash':
76  break;
77 
78  default:
79  return;
80  }
81  ilSearchAppEventListener::storeElement($command, $a_parameter);
82  }
83  }
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 85 of file class.ilSearchAppEventListener.php.

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

Referenced by handleEvent().

85  : bool
86  {
87  if (!$a_command) {
88  return false;
89  }
90 
91  if (!isset($a_params['obj_id']) or !$a_params['obj_id']) {
92  return false;
93  }
94 
95  if (!isset($a_params['obj_type']) or !$a_params['obj_type']) {
96  $a_params['obj_type'] = ilObject::_lookupType($a_params['obj_id']);
97  }
98  ilLoggerFactory::getLogger('src')->debug('Handling new command: ' . $a_command . ' for type ' . $a_params['obj_type']);
99 
100  $element = new ilSearchCommandQueueElement();
101  $element->setObjId($a_params['obj_id']);
102  $element->setObjType($a_params['obj_type']);
103  $element->setCommand($a_command);
104 
105  ilSearchCommandQueue::factory()->store($element);
106  return true;
107  }
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: