ILIAS  release_8 Revision v8.24
class.ilDclFormulaRecordQueryObject.php
Go to the documentation of this file.
1<?php
2
20{
21 public function applyCustomSorting(
23 array $all_records,
24 string $direction = 'asc'
25 ): array {
26 $sort_array = array();
27 foreach ($all_records as $id) {
28 $formula_field = ilDclCache::getRecordFieldCache(new ilDclBaseRecordModel($id), $field);
29 $sort_array[$id] = $formula_field->getValue();
30 }
31 switch (strtolower($direction)) {
32 case 'asc':
33 asort($sort_array);
34 break;
35 case 'desc':
36 arsort($sort_array);
37 break;
38 }
39
40 return array_keys($sort_array);
41 }
42}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRecordFieldCache(object $record, object $field)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
applyCustomSorting(ilDclBaseFieldModel $field, array $all_records, string $direction='asc')
Apply custom sorting.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...