ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerFilterFieldData Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilContainerFilterFieldData:

Public Member Functions

 __construct ()
 
 getFilterSetForRefId (int $ref_id)
 
 saveFilterSetForRefId (int $ref_id, ilContainerFilterSet $set)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Container field data

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilContainerFilterFieldData.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerFilterFieldData::__construct ( )

Definition at line 28 of file class.ilContainerFilterFieldData.php.

References $DIC.

29  {
30  global $DIC;
31 
32  $this->db = $DIC->database();
33  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ getFilterSetForRefId()

ilContainerFilterFieldData::getFilterSetForRefId ( int  $ref_id)

Definition at line 35 of file class.ilContainerFilterFieldData.php.

References $db, $i, ilAdvancedMDFieldDefinition\exists(), ilDBInterface\fetchAssoc(), ilDBInterface\queryF(), and ilArrayUtil\sortArray().

36  {
37  $db = $this->db;
38 
39  $filter = [];
40  $set = $db->queryF(
41  "SELECT * FROM cont_filter_field " .
42  " WHERE ref_id = %s ",
43  ["integer"],
44  [$ref_id]
45  );
46  while ($rec = $db->fetchAssoc($set)) {
47  if ($rec["record_set_id"] > 0 && !ilAdvancedMDFieldDefinition::exists($rec["field_id"])) {
48  continue;
49  }
50  $filter[] = [
51  "field" => new ilContainerFilterField($rec["record_set_id"], $rec["field_id"]),
52  "sort" => ($rec["record_set_id"] * 100000) + $rec["field_id"]];
53  }
54  $filter = ilArrayUtil::sortArray($filter, "sort", "asc", true);
55 
56  $filter = array_map(static function (array $i): ilContainerFilterField {
57  return $i["field"];
58  }, $filter);
59 
60  return new ilContainerFilterSet($filter);
61  }
fetchAssoc(ilDBStatement $statement)
$ref_id
Definition: ltiauth.php:67
queryF(string $query, array $types, array $values)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$i
Definition: metadata.php:41
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:

◆ saveFilterSetForRefId()

ilContainerFilterFieldData::saveFilterSetForRefId ( int  $ref_id,
ilContainerFilterSet  $set 
)

Definition at line 63 of file class.ilContainerFilterFieldData.php.

References $db, Vendor\Package\$f, ilContainerFilterSet\getFields(), ilDBInterface\insert(), and ilDBInterface\manipulateF().

63  : void
64  {
65  $db = $this->db;
66 
68  "DELETE FROM cont_filter_field WHERE " .
69  " ref_id = %s",
70  ["integer"],
71  [$ref_id]
72  );
73 
74  foreach ($set->getFields() as $f) {
75  $db->insert("cont_filter_field", [
76  "ref_id" => ["integer", $ref_id],
77  "record_set_id" => ["integer", $f->getRecordSetId()],
78  "field_id" => ["integer", $f->getFieldId()]
79  ]);
80  }
81  }
insert(string $table_name, array $values)
manipulateF(string $query, array $types, array $values)
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilContainerFilterFieldData::$db
protected

The documentation for this class was generated from the following file: