ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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.

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

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  }
global $DIC
Definition: feed.php:28
static _lookupObjectId(int $ref_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveRecords()

ilGlossaryAdvMetaDataAdapter::getActiveRecords ( )

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

References ilAdvancedMDRecord\_getSelectedRecordsByObject().

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)
+ 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.

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

Referenced by ilTermListTableGUI\__construct(), ilPresentationListTableGUI\__construct(), and getColumnOrder().

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 _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ 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.

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

Referenced by ilTermListTableGUI\__construct(), ilPresentationListTableGUI\__construct(), ilObjGlossaryGUI\initSettingsForm(), and ilObjGlossaryGUI\saveProperties().

70  : array
71  {
72  $ilDB = $this->db;
73  $lng = $this->lng;
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  }
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...
getAllFields()
Get all advanced metadata fields.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveColumnOrder()

ilGlossaryAdvMetaDataAdapter::saveColumnOrder ( array  $a_cols)

Save column order.

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

References Vendor\Package\$c, $db, and $ilDB.

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

◆ writeColumnOrder()

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

Write single column order.

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

References $DIC, and $ilDB.

Referenced by ilGlossaryImporter\finalProcessing().

149  : void {
150  global $DIC;
151 
152  $ilDB = $DIC->database();
153 
154  $ilDB->replace(
155  "glo_advmd_col_order",
156  array("glo_id" => array("integer", $a_glo_id),
157  "field_id" => array("integer", $a_field_id)),
158  array("order_nr" => array("integer", $a_order_nr))
159  );
160  }
global $DIC
Definition: feed.php:28
+ 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: