3 declare(strict_types=1);
19 $this->db = $DIC->database();
27 $query =
'DELETE FROM adv_md_record_obj_ord ' .
28 'WHERE obj_id = ' . $this->db->quote($obj_id,
'integer');
29 $this->db->manipulate(
$query);
37 public function sortRecords(array $records,
int $obj_id = null): array
102 $local_pos_a = $this->record_position_map[$a->
getRecordId()] ??
104 $local_pos_b = $this->record_position_map[$b->
getRecordId()] ??
106 if ($local_pos_a < $local_pos_b) {
109 if ($local_pos_a > $local_pos_b) {
120 $query =
'SELECT record_id, position FROM adv_md_record_obj_ord ' .
121 'WHERE obj_id = ' . $this->db->quote($obj_id,
'integer');
124 $this->record_position_map = [];
126 $this->record_position_map[(
int) $row->record_id] = (
int) $row->position;
compareRecords(ilAdvancedMDRecord $a, ilAdvancedMDRecord $b)
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
setGlobalPosition(int $position)
readPositionsForObject(int $obj_id)
Read local positions for object.
array $record_position_map
sortRecords(array $records, int $obj_id=null)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
deleteByObjId(int $obj_id)
Delete entries by obj_id.
compareLocalRecords(ilAdvancedMDRecord $a, ilAdvancedMDRecord $b)