ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
EventStandardAdapter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
26 {
27  protected \ilLogger $log;
28  protected \ilAppEventHandler $event_handler;
29 
30  public function __construct(
31  protected InternalDomainService $domain,
32  ) {
33  $this->event_handler = $domain->event();
34  $this->log = $domain->logger()->root();
35  }
36 
37  public function beforeMoveToTrash(int $ref_id, array $subnodes): void
38  {
39  // TODO: needs other handling
40  // This class shouldn't have to know anything about ECS
41  \ilECSObjectSettings::_handleDelete($subnodes); // why only subnodes?
42  }
43 
44  public function afterMoveToTrash(int $ref_id, int $old_parent_ref_id): void
45  {
46  $this->log->write("ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $ref_id .
47  " to trash");
48 
49  $this->event_handler->raise(
50  "components/ILIAS/ILIASObject",
51  "toTrash",
52  [
53  "obj_id" => \ilObject::_lookupObjId($ref_id),
54  "ref_id" => $ref_id,
55  "old_parent_ref_id" => $old_parent_ref_id
56  ]
57  );
58  }
59 
60  public function beforeSubtreeRemoval(int $obj_id): void
61  {
62  // old wrandelshofer code, still needed?
64  $obj_id,
65  $this->domain->user()->getId(),
66  'purge',
67  null
68  );
69  }
70 
71  public function beforeObjectRemoval(
72  int $obj_id,
73  int $ref_id,
74  string $type,
75  string $title
76  ): void {
77  $this->log->info(
78  'delete obj_id: ' . $obj_id .
79  ', ref_id: ' . $ref_id .
80  ', type: ' . $type .
81  ', title: ' . $title
82  );
83  }
84 
85  public function failedRemoval(
86  int $obj_id,
87  int $ref_id,
88  string $type,
89  string $title,
90  string $message
91  ): void {
92  $this->log->error(
93  'failed to remove obj_id: ' . $obj_id .
94  ', ref_id: ' . $ref_id .
95  ', type: ' . $type .
96  ', title: ' . $title .
97  ', message: ' . $message
98  );
99  }
100 
101  public function afterObjectRemoval(
102  int $obj_id,
103  int $ref_id,
104  string $type,
105  int $old_parent_ref_id
106  ): void {
107  $this->event_handler->raise(
108  "components/ILIAS/ILIASObject",
109  "delete",
110  [
111  "obj_id" => $obj_id,
112  "ref_id" => $ref_id,
113  "type" => $type,
114  "old_parent_ref_id" => $old_parent_ref_id
115  ]
116  );
117  }
118 
119  public function afterTreeDeletion(
120  int $tree_id,
121  int $child
122  ): void {
123  $this->log->info(
124  'deleted tree, tree_id: ' . $tree_id .
125  ', child: ' . $child
126  );
127  }
128 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
afterObjectRemoval(int $obj_id, int $ref_id, string $type, int $old_parent_ref_id)
static _handleDelete(array $a_subbtree_nodes)
handle delete Objects that are moved to the trash call ECS-Remove
beforeObjectRemoval(int $obj_id, int $ref_id, string $type, string $title)
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
afterMoveToTrash(int $ref_id, int $old_parent_ref_id)
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
failedRemoval(int $obj_id, int $ref_id, string $type, string $title, string $message)
$message
Definition: xapiexit.php:31
__construct(protected InternalDomainService $domain,)