ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjectActivation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
29  public const ERR_SUG_START_END = 1;
30 
31  public const TIMINGS_ACTIVATION = 0;
32  public const TIMINGS_DEACTIVATED = 1;
33  public const TIMINGS_PRESETTING = 2;
34  public const TIMINGS_FIXED = 3; // session only => obsolete?
35 
36  protected static array $preloaded_data = [];
37 
39  protected ilLanguage $lng;
40  protected ilDBInterface $db;
41 
42  protected int $timing_type = 0;
43  protected ?int $timing_start = null;
44  protected ?int $timing_end = null;
45  protected ?int $suggestion_start = null;
46  protected ?int $suggestion_end = null;
47  protected bool $visible = false;
48  protected int $changeable = 0;
49 
50  protected ?int $suggestion_start_rel = null;
51  protected ?int $suggestion_end_rel = null;
52 
53  public function __construct()
54  {
55  global $DIC;
56 
57  $this->error = $DIC["ilErr"];
58  $this->lng = $DIC->language();
59  $this->db = $DIC->database();
60  }
61 
62  public function setTimingType(int $type): void
63  {
64  $this->timing_type = $type;
65  }
66 
67  public function getTimingType(): int
68  {
69  return $this->timing_type;
70  }
71 
72  public function setTimingStart(?int $start): void
73  {
74  $this->timing_start = $start;
75  }
76 
77  public function getTimingStart(): ?int
78  {
79  return $this->timing_start;
80  }
81 
82  public function setTimingEnd(?int $end): void
83  {
84  $this->timing_end = $end;
85  }
86 
87  public function getTimingEnd(): ?int
88  {
89  return $this->timing_end;
90  }
91 
92  public function setSuggestionStart(?int $start): void
93  {
94  if ($start === 0) {
95  $start = null;
96  }
97  $this->suggestion_start = $start;
98  }
99 
100  public function setSuggestionStartRelative(?int $start): void
101  {
102  if ($start === 0) {
103  $start = null;
104  }
105  $this->suggestion_start_rel = $start;
106  }
107 
108  public function setSuggestionEndRelative(int $end): void
109  {
110  if ($end === 0) {
111  $end = null;
112  }
113  $this->suggestion_end_rel = $end;
114  }
115 
116  public function setSuggestionEnd(?int $end): void
117  {
118  if ($end === 0) {
119  $end = null;
120  }
121  $this->suggestion_end = $end;
122  }
123 
124  public function toggleVisible(bool $status): void
125  {
126  $this->visible = $status;
127  }
128 
129  public function enabledVisible(): bool
130  {
131  return $this->visible;
132  }
133 
134  public function toggleChangeable(bool $status): void
135  {
136  $this->changeable = (int) $status;
137  }
138 
139  public function enabledChangeable(): bool
140  {
141  return (bool) $this->changeable;
142  }
143 
144  public function update(int $ref_id, ?int $parent_id = null): bool
145  {
146  $values = [
147  "timing_type" => ["integer", $this->getTimingType()],
148  "timing_start" => ["integer", $this->getTimingStart() ?? 0],
149  "timing_end" => ["integer", $this->getTimingEnd() ?? 0],
150  "suggestion_start" => ["integer", $this->suggestion_start ?? 0],
151  "suggestion_end" => ["integer", $this->suggestion_end ?? 0],
152  "changeable" => ["integer", (int) $this->enabledChangeable()],
153  "suggestion_start_rel" => ["integer", $this->suggestion_start_rel ?? 0],
154  "suggestion_end_rel" => ["integer", $this->suggestion_end_rel ?? 0],
155  "visible" => ["integer", $this->enabledVisible()]
156  ];
157 
158  if (!is_null($parent_id)) {
159  $values["parent_id"] = ["integer", $parent_id];
160  }
161 
162  $where = [
163  "obj_id" => ["integer", $ref_id]
164  ];
165 
166  $this->db->update("crs_items", $values, $where);
167 
168  unset(self::$preloaded_data[$ref_id]);
169 
170  return true;
171  }
172 
176  public static function preloadData(array $ref_ids): void
177  {
178  global $DIC;
179  $db = $DIC->database();
180 
181  $sql =
182  "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
183  . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
184  . "FROM crs_items" . PHP_EOL
185  . "WHERE " . $db->in("obj_id", $ref_ids, false, "integer") . PHP_EOL
186  ;
187  $set = $db->query($sql);
188  while ($row = $db->fetchAssoc($set)) {
189  self::$preloaded_data[$row["obj_id"]] = $row;
190  }
191  }
192 
193  public static function getItem(int $ref_id): array
194  {
195  global $DIC;
196  $db = $DIC->database();
197 
198  if (isset(self::$preloaded_data[$ref_id])) {
199  return self::$preloaded_data[$ref_id];
200  }
201 
202  $sql =
203  "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
204  . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
205  . "FROM crs_items" . PHP_EOL
206  . "WHERE obj_id = " . $db->quote($ref_id, "integer") . PHP_EOL
207  ;
208  $set = $db->query($sql);
209  $row = $db->fetchAssoc($set);
210 
211  if (!isset($row["obj_id"])) {
212  $row = self::createDefaultEntry($ref_id);
213  } else {
214  self::$preloaded_data[$row["obj_id"]] = $row;
215  }
216  return $row;
217  }
218 
222  public static function addAdditionalSubItemInformation(array &$item): void
223  {
224  global $DIC;
225  $ilUser = $DIC->user();
226 
227  $item_array = self::getItem((int) $item['ref_id']);
228 
229  $item['obj_id'] = ($item['obj_id'] > 0)
230  ? $item['obj_id']
231  : ilObject::_lookupObjId((int) $item['ref_id']);
232  $item['type'] = ($item['type'] != '')
233  ? $item['type']
234  : ilObject::_lookupType((int) $item['obj_id']);
235 
236  $item['timing_type'] = $item_array['timing_type'] ?? 0;
237 
238  if ($item_array['timing_type'] == self::TIMINGS_PRESETTING &&
239  (
240  ($item_array['changeable'] ?? false) ||
242  )
243  ) {
244  // cognos-blu-patch: begin
245  $user_data = new ilTimingUser((int) $item['ref_id'], $ilUser->getId());
246  if ($user_data->isScheduled()) {
247  $item['start'] = $user_data->getStart()->get(IL_CAL_UNIX);
248  $item['end'] = $user_data->getEnd()->get(IL_CAL_UNIX);
249  $item['activation_info'] = 'crs_timings_planed_info';
250  } else {
251  $item['start'] = $item_array['suggestion_start'] ?? "";
252  $item['end'] = $item_array['suggestion_end'] ?? "";
253  $item['activation_info'] = 'crs_timings_suggested_info';
254  }
255  // cognos-blu-patch: end
256  } elseif (($item_array['timing_type'] ?? 0) == self::TIMINGS_PRESETTING) {
257  $item['start'] = $item_array['suggestion_start'] ?? "";
258  $item['end'] = $item_array['suggestion_end'] ?? "";
259  $item['activation_info'] = 'crs_timings_suggested_info';
260  } elseif (($item_array['timing_type'] ?? 0) == self::TIMINGS_ACTIVATION) {
261  $item['start'] = $item_array['timing_start'] ?? "";
262  $item['end'] = $item_array['timing_end'] ?? "";
263  $item['activation_info'] = 'obj_activation_list_gui';
264  }
265 
266  // #7359 - session sorting should always base on appointment date
267  if ($item['type'] == 'sess') {
268  $info = ilSessionAppointment::_lookupAppointment((int) $item['obj_id']);
269  // #11987
270  $item['masked_start'] = $item['start'] ?? '';
271  $item['masked_end'] = $item['end'] ?? '';
272  $item['start'] = $info['start'] ?? '';
273  $item['end'] = $info['end'] ?? '';
274  }
275  }
276 
280  public static function addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item): void
281  {
282  self::addAdditionalSubItemInformation($item);
283  if (isset($item['timing_type'])) {
284  if (!isset($item['masked_start'])) {
285  $start = $item['start'] ?? 0;
286  $end = $item['end'] ?? 0;
287  } else {
288  $start = $item['masked_start'];
289  $end = $item['masked_end'];
290  }
291  $activation = '';
292  switch ($item['timing_type']) {
294  $activation = ilDatePresentation::formatPeriod(
295  new ilDateTime($start, IL_CAL_UNIX),
296  new ilDateTime($end, IL_CAL_UNIX)
297  );
298  break;
299 
301  $activation = ilDatePresentation::formatPeriod(
302  new ilDate($start, IL_CAL_UNIX),
303  new ilDate($end, IL_CAL_UNIX)
304  );
305  break;
306  }
307  if ($activation != "") {
308  global $DIC;
309 
310  $lng = $DIC->language();
311  $lng->loadLanguageModule('crs');
312 
313  $list_gui->addCustomProperty(
314  $lng->txt($item['activation_info']),
315  $activation,
316  false,
317  true
318  );
319  }
320  }
321  }
322 
326  protected static function createDefaultEntry(int $ref_id): array
327  {
328  global $DIC;
329 
330  $db = $DIC->database();
331  $tree = $DIC->repositoryTree();
332 
333  $parent_id = $tree->getParentId($ref_id);
334  if (!$parent_id) {
335  return [];
336  }
337 
338  $ilAtomQuery = $db->buildAtomQuery();
339  $ilAtomQuery->addTableLock("crs_items");
340 
341  $ilAtomQuery->addQueryCallable(function (ilDBInterface $db) use ($ref_id, $parent_id, &$item): void {
342  $sql =
343  "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
344  . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
345  . "FROM crs_items" . PHP_EOL
346  . "WHERE obj_id = " . $db->quote($ref_id, "integer") . PHP_EOL
347  ;
348  $set = $db->query($sql);
349  if (!$db->numRows($set)) {
350  $now = time();
351 
352  $item = [];
353  $item["timing_type"] = self::TIMINGS_DEACTIVATED;
354  $item["timing_start"] = $now;
355  $item["timing_end"] = $now;
356  $item["suggestion_start"] = $now;
357  $item["suggestion_end"] = $now;
358  $item['visible'] = 0;
359  $item['changeable'] = 0;
360 
361  $values = [
362  "parent_id" => ["integer", $parent_id],
363  "obj_id" => ["integer", $ref_id],
364  "timing_type" => ["integer", $item["timing_type"]],
365  "timing_start" => ["integer", $item["timing_start"]],
366  "timing_end" => ["integer", $item["timing_end"]],
367  "suggestion_start" => ["integer", $item["suggestion_start"]],
368  "suggestion_end" => ["integer", $item["suggestion_end"]],
369  "changeable" => ["integer", $item["changeable"]],
370  "visible" => ["integer", $item["visible"]],
371  "suggestion_start_rel" => ["integer", $item["suggestion_start_rel"] ?? 0],
372  "suggestion_end_rel" => ["integer", $item["suggestion_end_rel"] ?? 0],
373  "position" => ["integer", 0]
374  ];
375  $db->insert("crs_items", $values);
376  }
377  });
378 
379  $ilAtomQuery->run();
380 
381  // #9982 - to make getItem()-cache work
382  $item["obj_id"] = $ref_id;
383  $item["parent_id"] = $parent_id;
384 
385  return $item;
386  }
387 
391  public static function deleteAllEntries(int $ref_id): bool
392  {
393  global $DIC;
394 
395  $db = $DIC->database();
396 
397  if (!$ref_id) {
398  return false;
399  }
400 
401  $sql =
402  "DELETE FROM crs_items " . PHP_EOL
403  . "WHERE obj_id = " . $db->quote($ref_id, 'integer') . PHP_EOL
404  ;
405  $db->manipulate($sql);
406 
407  $sql =
408  "DELETE FROM crs_items " . PHP_EOL
409  . "WHERE parent_id = " . $db->quote($ref_id, 'integer') . PHP_EOL
410  ;
411  $db->manipulate($sql);
412 
413  return true;
414  }
415 
416  public static function cloneDependencies(int $ref_id, int $target_id, int $copy_id): void
417  {
418  global $DIC;
419 
420  $ilLog = $DIC["ilLog"];
421 
422  $ilLog->write(__METHOD__ . ': Begin course items...' . $ref_id);
423 
424  $items = self::getItems($ref_id, false);
425  if (!$items) {
426  $ilLog->write(__METHOD__ . ': No course items found.');
427  return;
428  }
429 
430  // new course item object
431  if (!is_object(ilObjectFactory::getInstanceByRefId($target_id, false))) {
432  $ilLog->write(__METHOD__ . ': Cannot create target object.');
433  return;
434  }
435 
436  $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
437  $mappings = $cp_options->getMappings();
438 
439  foreach ($items as $item) {
440  if (!isset($mappings[$item['parent_id']]) or !$mappings[$item['parent_id']]) {
441  $ilLog->write(__METHOD__ . ': No mapping for parent nr. ' . $item['parent_id']);
442  continue;
443  }
444  if (!isset($mappings[$item['obj_id']]) or !$mappings[$item['obj_id']]) {
445  $ilLog->write(__METHOD__ . ': No mapping for item nr. ' . $item['obj_id']);
446  continue;
447  }
448  $new_item_id = $mappings[$item['obj_id']];
449  $new_parent = $mappings[$item['parent_id']];
450 
451  $new_item = new self();
452  $new_item->setTimingType((int) $item['timing_type']);
453  $new_item->setTimingStart((int) $item['timing_start']);
454  $new_item->setTimingEnd((int) $item['timing_end']);
455  $new_item->setSuggestionStart((int) $item['suggestion_start']);
456  $new_item->setSuggestionEnd((int) $item['suggestion_end']);
457  $new_item->toggleChangeable((bool) $item['changeable']);
458  $new_item->toggleVisible((bool) $item['visible']);
459  $new_item->update($new_item_id, $new_parent);
460  $new_item->setSuggestionStartRelative((int) ($item['suggestion_start_rel'] ?? 0));
461  $new_item->setSuggestionEndRelative((int) ($item['suggestion_end_rel'] ?? 0));
462  $new_item->createDefaultEntry($new_item_id);
463  $new_item->update($new_item_id);
464  }
465  }
466 
467 
468  //
469  // TIMINGS VIEW RELATED (COURSE ONLY)
470  //
471 
475  public static function hasTimings(int $ref_id): bool
476  {
477  global $DIC;
478 
479  $tree = $DIC->repositoryTree();
480  $db = $DIC->database();
481 
482  $subtree = $tree->getSubTree($tree->getNodeData($ref_id));
483  $ref_ids = [];
484  foreach ($subtree as $node) {
485  $ref_ids[] = $node['ref_id'];
486  }
487 
488  $sql =
489  "SELECT parent_id" . PHP_EOL
490  . "FROM crs_items" . PHP_EOL
491  . "WHERE timing_type = " . $db->quote(self::TIMINGS_PRESETTING, 'integer') . PHP_EOL
492  . "AND " . $db->in('obj_id', $ref_ids, false, 'integer') . PHP_EOL
493  ;
494  $res = $db->query($sql);
495  return (bool) $res->numRows();
496  }
497 
501  public static function hasChangeableTimings(int $ref_id): bool
502  {
503  global $DIC;
504 
505  $tree = $DIC->repositoryTree();
506  $db = $DIC->database();
507 
508  $subtree = $tree->getSubTree($tree->getNodeData($ref_id));
509  $ref_ids = [];
510  foreach ($subtree as $node) {
511  $ref_ids[] = $node['ref_id'];
512  }
513 
514  $sql =
515  "SELECT parent_id" . PHP_EOL
516  . "FROM crs_items" . PHP_EOL
517  . "WHERE timing_type = " . $db->quote(self::TIMINGS_PRESETTING, 'integer') . PHP_EOL
518  . "AND changeable = " . $db->quote(1, 'integer') . PHP_EOL
519  . "AND " . $db->in('obj_id', $ref_ids, false, 'integer') . PHP_EOL
520  ;
521  $res = $db->query($sql);
522  return (bool) $res->numRows();
523  }
524 
528  protected static function processListItems(array $ref_ids): array
529  {
530  global $DIC;
531 
532  $tree = $DIC->repositoryTree();
533 
534  $res = [];
535 
536  foreach (array_map('intval', $ref_ids) as $item_ref_id) {
537  if ($tree->isDeleted($item_ref_id)) {
538  continue;
539  }
540  // #7571: when node is removed from system, e.g. inactive trashcan, an empty array is returned
541  $node = $tree->getNodeData($item_ref_id);
542  if (!isset($node["ref_id"]) || (int) $node["ref_id"] !== $item_ref_id) {
543  continue;
544  }
545  $res[$item_ref_id] = $node;
546  }
547 
548  if (count($res)) {
549  self::preloadData(array_keys($res));
550  foreach ($res as $idx => $item) {
551  self::addAdditionalSubItemInformation($item);
552  $res[$idx] = $item;
553  }
554  }
555 
556  return array_values($res);
557  }
558 
562  public static function getItemsByEvent(int $event_id): array
563  {
564  $event_items = new ilEventItems($event_id);
565  return self::processListItems($event_items->getItems());
566  }
567 
571  public static function getItemsByItemGroup(int $item_group_ref_id): array
572  {
573  $ig_items = new ilItemGroupItems($item_group_ref_id);
574  $items = $ig_items->getValidItems();
575  return self::processListItems($items);
576  }
577 
581  public static function getItemsByObjective(int $objective_id): array
582  {
583  $item_ids = ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id);
584  return self::processListItems($item_ids);
585  }
586 
590  public static function getItems(int $parent_id, bool $with_list_data = true): array
591  {
592  global $DIC;
593 
594  $tree = $DIC->repositoryTree();
595 
596  $items = [];
597 
598  $ref_ids = [];
599  foreach ($tree->getChilds($parent_id) as $item) {
600  if ($item['type'] !== 'rolf') {
601  $items[] = $item;
602  $ref_ids[] = (int) $item['ref_id'];
603  }
604  }
605 
606  if ($ref_ids) {
607  self::preloadData($ref_ids);
608 
609  foreach ($items as $idx => $item) {
610  if (!$with_list_data) {
611  $items[$idx] = array_merge($item, self::getItem((int) $item['ref_id']));
612  } else {
613  self::addAdditionalSubItemInformation($item);
614  $items[$idx] = $item;
615  }
616  }
617  }
618  return $items;
619  }
620 
624  public static function getTimingsAdministrationItems(int $parent_id): array
625  {
626  $items = self::getItems($parent_id, false);
627  $active = $availability = $inactive = [];
628  foreach ($items as $item) {
629  if ($item['timing_type'] == self::TIMINGS_DEACTIVATED) {
630  $inactive[] = $item;
631  } elseif ($item['timing_type'] == self::TIMINGS_ACTIVATION) {
632  $availability[] = $item;
633  } else {
634  $active[] = $item;
635  }
636  }
637  $active = ilArrayUtil::sortArray($active, 'suggestion_start');
638  $availability = ilArrayUtil::sortArray($availability, 'timing_start');
639  $inactive = ilArrayUtil::sortArray($inactive, 'title');
640 
641  $items = array_merge($active, $availability, $inactive);
642  return $items;
643  }
644 
648  public static function getTimingsItems(int $container_ref_id): array
649  {
650  global $DIC;
651 
652  $objDefinition = $DIC["objDefinition"];
653 
654  $filtered = [];
655 
656  $event_items = ilEventItems::_getItemsOfContainer($container_ref_id);
657  foreach (self::getTimingsAdministrationItems($container_ref_id) as $item) {
658  if (!in_array($item['ref_id'], $event_items) &&
659  !$objDefinition->isSideBlock($item['type'])) {
660  $filtered[] = $item;
661  }
662  }
663 
664  return $filtered;
665  }
666 
667  public function read(int $ref_id, int $parent_id = 0): void
668  {
669  global $DIC;
670  $db = $DIC->database();
671 
672  $sql =
673  "SELECT parent_id, obj_id, timing_type, timing_start, timing_end, suggestion_start," . PHP_EOL
674  . "suggestion_end, changeable, visible, position, suggestion_start_rel, suggestion_end_rel" . PHP_EOL
675  . "FROM crs_items" . PHP_EOL
676  . "WHERE obj_id = " . $db->quote($ref_id, 'integer') . PHP_EOL
677  ;
678 
679  if ($parent_id) {
680  $sql .= "AND parent_id = " . $db->quote($parent_id, "integer") . PHP_EOL;
681  }
682 
683  $res = $db->query($sql);
684  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
685  $this->setSuggestionStart((int) $row->suggestion_start);
686  $this->setSuggestionEnd((int) $row->suggestion_end);
687  $this->setSuggestionStartRelative((int) $row->suggestion_start_rel);
688  $this->setSuggestionEndRelative((int) $row->suggestion_end_rel);
689  $this->toggleVisible((bool) $row->visible);
690  $this->toggleChangeable((bool) $row->changeable);
691  $this->setTimingType((int) $row->timing_type);
692  $this->setTimingStart((int) $row->timing_start);
693  $this->setTimingEnd((int) $row->timing_end);
694  }
695  }
696 }
static lookupTimingMode(int $a_obj_id)
static deleteAllEntries(int $ref_id)
Delete all db entries for ref id.
$res
Definition: ltiservices.php:69
static _getAssignedMaterials(int $a_objective_id)
numRows(ilDBStatement $statement)
insert(string $table_name, array $values)
static hasChangeableTimings(int $ref_id)
Check if there is any active changeable timing (in subtree)
getStart()
Use to set start date.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getItemsByEvent(int $event_id)
Get session material / event items.
fetchAssoc(ilDBStatement $statement)
static processListItems(array $ref_ids)
Validate ref ids and add list data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
quote($value, string $type)
loadLanguageModule(string $a_module)
Load language module.
const IL_CAL_UNIX
static createDefaultEntry(int $ref_id)
Create db entry with default values.
static _getItemsOfContainer(int $a_ref_id)
static cloneDependencies(int $ref_id, int $target_id, int $copy_id)
static _lookupObjId(int $ref_id)
static getItems(int $parent_id, bool $with_list_data=true)
Get sub item data.
global $DIC
Definition: feed.php:28
static getTimingsAdministrationItems(int $parent_id)
Get (sub) item data for timings administration view (active/inactive)
static _lookupAppointment(int $a_obj_id)
$ref_id
Definition: ltiauth.php:67
static preloadData(array $ref_ids)
Preload data to internal cache.
static getTimingsItems(int $container_ref_id)
Get (sub) item data for timings view (no session material, no side blocks)
read(int $ref_id, int $parent_id=0)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item)
Get timing details for list gui.
query(string $query)
Run a (read-only) Query on the database.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getItemsByItemGroup(int $item_group_ref_id)
Get materials of item group.
in(string $field, array $values, bool $negate=false, string $type="")
static getItem(int $ref_id)
Error Handling & global info handling.
static getItemsByObjective(int $objective_id)
Get objective items.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static addAdditionalSubItemInformation(array &$item)
Parse item data for list entries.
static hasTimings(int $ref_id)
Check if there is any active timing (in subtree)
static _getInstance(int $a_copy_id)
manipulate(string $query)
Run a (write) Query on the database.
static _lookupType(int $id, bool $reference=false)
update(int $ref_id, ?int $parent_id=null)
Class ilObjectActivation.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCustomProperty(string $property='', string $value='', bool $alert=false, bool $newline=false)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)