ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 
 cloneFilterFields (int $from_ref_id, int $to_ref_id)
 

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.

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

References $DIC.

Member Function Documentation

◆ cloneFilterFields()

ilContainerFilterFieldData::cloneFilterFields ( int  $from_ref_id,
int  $to_ref_id 
)

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

83 : void
84 {
85 $set = $this->getFilterSetForRefId($from_ref_id);
86 $fields = [];
87 foreach ($set->getFields() as $f) {
88 if ($f->getRecordSetId() === 0) {
89 $fields[] = $f;
90 }
91 }
92 }

References Vendor\Package\$f, and getFilterSetForRefId().

+ Here is the call graph for this function:

◆ getFilterSetForRefId()

ilContainerFilterFieldData::getFilterSetForRefId ( int  $ref_id)

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

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 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
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...
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
$ref_id
Definition: ltiauth.php:66

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

Referenced by cloneFilterFields().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFilterSetForRefId()

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

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

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)

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

+ 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: