ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilGlossaryAdvMetaDataAdapter 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 ilGlossaryAdvMetaDataAdapter:

Public Member Functions

 __construct (int $a_glo_ref_id)
 
 getActiveRecords ()
 
 getAllFields ()
 Get all advanced metadata fields. More...
 
 getColumnOrder ()
 Get column order. More...
 
 saveColumnOrder (array $a_cols)
 Save column order. More...
 

Static Public Member Functions

static writeColumnOrder (int $a_glo_id, int $a_field_id, int $a_order_nr)
 Write single column order. More...
 

Protected Attributes

int $glo_ref_id
 
int $glo_id
 
ilDBInterface $db
 
ilLanguage $lng
 

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 Advanced meta data adapter

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

Definition at line 23 of file class.ilGlossaryAdvMetaDataAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryAdvMetaDataAdapter::__construct ( int  $a_glo_ref_id)

Definition at line 30 of file class.ilGlossaryAdvMetaDataAdapter.php.

32 {
33 global $DIC;
34
35 $this->db = $DIC->database();
36 $this->lng = $DIC->language();
37 $this->glo_id = ilObject::_lookupObjectId($a_glo_ref_id);
38 $this->glo_ref_id = $a_glo_ref_id;
39 }
static _lookupObjectId(int $ref_id)
global $DIC
Definition: shib_login.php:26

References $DIC, ilObject\_lookupObjectId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveRecords()

ilGlossaryAdvMetaDataAdapter::getActiveRecords ( )

Definition at line 41 of file class.ilGlossaryAdvMetaDataAdapter.php.

41 : array
42 {
43 return ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $this->glo_ref_id, "term");
44 }
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)

References ilAdvancedMDRecord\_getSelectedRecordsByObject().

+ Here is the call graph for this function:

◆ getAllFields()

ilGlossaryAdvMetaDataAdapter::getAllFields ( )

Get all advanced metadata fields.

Definition at line 49 of file class.ilGlossaryAdvMetaDataAdapter.php.

49 : array
50 {
51 $fields = array();
52 $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $this->glo_ref_id, "term");
53
54 foreach ($recs as $record_obj) {
55 foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record_obj->getRecordId()) as $def) {
56 $fields[$def->getFieldId()] = array(
57 "id" => $def->getFieldId(),
58 "title" => $def->getTitle(),
59 "type" => $def->getType()
60 );
61 }
62 }
63
64 return $fields;
65 }
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.

References ilAdvancedMDRecord\_getSelectedRecordsByObject(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by getColumnOrder().

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

◆ getColumnOrder()

ilGlossaryAdvMetaDataAdapter::getColumnOrder ( )

Get column order.

Definition at line 70 of file class.ilGlossaryAdvMetaDataAdapter.php.

70 : array
71 {
74
75 $columns = array();
76
77 $set = $ilDB->query(
78 "SELECT * FROM glo_advmd_col_order " .
79 " WHERE glo_id = " . $ilDB->quote($this->glo_id, "integer") .
80 " ORDER BY order_nr"
81 );
82 $order = array();
83 while ($rec = $ilDB->fetchAssoc($set)) {
84 $order[$rec["field_id"]] = $rec["order_nr"];
85 }
86 // add term at beginning, if not included
87 if (!isset($order[0])) {
88 $columns[] = array("id" => 0,
89 "text" => $lng->txt("cont_term"));
90 }
91
92 $fields = $this->getAllFields();
93
94 // add all fields that have been already sorted
95 foreach ($order as $id => $order_nr) {
96 if (isset($fields[$id])) {
97 $columns[] = array("id" => $id,
98 "text" => $fields[$id]["title"]);
99 unset($fields[$id]);
100 } elseif ($id == 0) {
101 $columns[] = array("id" => 0,
102 "text" => $lng->txt("cont_term"));
103 }
104 }
105
106 // add all fields that have not been sorted
107 foreach ($fields as $f) {
108 $columns[] = array("id" => $f["id"],
109 "text" => $f["title"]);
110 }
111
112 return $columns;
113 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getAllFields()
Get all advanced metadata fields.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $db, Vendor\Package\$f, $id, $ilDB, $lng, getAllFields(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ saveColumnOrder()

ilGlossaryAdvMetaDataAdapter::saveColumnOrder ( array  $a_cols)

Save column order.

TODO: this is not a setting anymore, remove?

Definition at line 120 of file class.ilGlossaryAdvMetaDataAdapter.php.

120 : void
121 {
123
124 $ilDB->manipulate(
125 "DELETE FROM glo_advmd_col_order WHERE " .
126 " glo_id = " . $ilDB->quote($this->glo_id, "integer")
127 );
128
129 $nr = 10;
130 $set = array();
131 foreach ($a_cols as $c) {
132 if (!isset($set[$c["id"]])) {
133 $ilDB->manipulate("INSERT INTO glo_advmd_col_order " .
134 "(glo_id, field_id, order_nr) VALUES (" .
135 $ilDB->quote($this->glo_id, "integer") . "," .
136 $ilDB->quote($c["id"], "integer") . "," .
137 $ilDB->quote($nr += 10, "integer") .
138 ")");
139 $set[$c["id"]] = $c["id"];
140 }
141 }
142 }
$c
Definition: deliver.php:25

References $c, $db, and $ilDB.

◆ writeColumnOrder()

static ilGlossaryAdvMetaDataAdapter::writeColumnOrder ( int  $a_glo_id,
int  $a_field_id,
int  $a_order_nr 
)
static

Write single column order.

Definition at line 147 of file class.ilGlossaryAdvMetaDataAdapter.php.

151 : void {
152 global $DIC;
153
154 $ilDB = $DIC->database();
155
156 $ilDB->replace(
157 "glo_advmd_col_order",
158 array("glo_id" => array("integer", $a_glo_id),
159 "field_id" => array("integer", $a_field_id)),
160 array("order_nr" => array("integer", $a_order_nr))
161 );
162 }

Referenced by ilGlossaryImporter\finalProcessing().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilGlossaryAdvMetaDataAdapter::$db
protected

Definition at line 27 of file class.ilGlossaryAdvMetaDataAdapter.php.

Referenced by getColumnOrder(), and saveColumnOrder().

◆ $glo_id

int ilGlossaryAdvMetaDataAdapter::$glo_id
protected

Definition at line 26 of file class.ilGlossaryAdvMetaDataAdapter.php.

◆ $glo_ref_id

int ilGlossaryAdvMetaDataAdapter::$glo_ref_id
protected

Definition at line 25 of file class.ilGlossaryAdvMetaDataAdapter.php.

◆ $lng

ilLanguage ilGlossaryAdvMetaDataAdapter::$lng
protected

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

Referenced by getColumnOrder().


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