ILIAS  release_8 Revision v8.24
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)
 
 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: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getAllFields()

ilGlossaryAdvMetaDataAdapter::getAllFields ( )

Get all advanced metadata fields.

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

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

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 66 of file class.ilGlossaryAdvMetaDataAdapter.php.

66 : array
67 {
70
71 $columns = array();
72
73 $set = $ilDB->query(
74 "SELECT * FROM glo_advmd_col_order " .
75 " WHERE glo_id = " . $ilDB->quote($this->glo_id, "integer") .
76 " ORDER BY order_nr"
77 );
78 $order = array();
79 while ($rec = $ilDB->fetchAssoc($set)) {
80 $order[$rec["field_id"]] = $rec["order_nr"];
81 }
82 //var_dump($order);
83 // add term at beginning, if not included
84 if (!isset($order[0])) {
85 $columns[] = array("id" => 0,
86 "text" => $lng->txt("cont_term"));
87 }
88
89 $fields = $this->getAllFields();
90
91 // add all fields that have been already sorted
92 foreach ($order as $id => $order_nr) {
93 if (isset($fields[$id])) {
94 $columns[] = array("id" => $id,
95 "text" => $fields[$id]["title"]);
96 unset($fields[$id]);
97 } elseif ($id == 0) {
98 $columns[] = array("id" => 0,
99 "text" => $lng->txt("cont_term"));
100 }
101 }
102
103 // add all fields that have not been sorted
104 foreach ($fields as $f) {
105 $columns[] = array("id" => $f["id"],
106 "text" => $f["title"]);
107 }
108
109 return $columns;
110 }
$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.

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

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

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 143 of file class.ilGlossaryAdvMetaDataAdapter.php.

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

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: