ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclFormulaRecordQueryObject.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 public function applyCustomSorting(
25 array $all_records,
26 string $direction = 'asc'
27 ): array {
28 $sort_array = [];
29 foreach ($all_records as $id) {
30 $formula_field = ilDclCache::getRecordFieldCache(new ilDclBaseRecordModel($id), $field);
31 $sort_array[$id] = $formula_field->getValue();
32 }
33 switch (strtolower($direction)) {
34 case 'asc':
35 asort($sort_array);
36 break;
37 case 'desc':
38 arsort($sort_array);
39 break;
40 }
41
42 return array_keys($sort_array);
43 }
44}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getRecordFieldCache(object $record, object $field)
applyCustomSorting(ilDclBaseFieldModel $field, array $all_records, string $direction='asc')
Apply custom sorting.