ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilGlossaryAdvMetaDataAdapter Class Reference

Advanced meta data adapter. More...

+ Collaboration diagram for ilGlossaryAdvMetaDataAdapter:

Public Member Functions

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

Static Public Member Functions

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

Protected Attributes

 $db
 
 $lng
 

Detailed Description

Advanced meta data adapter.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryAdvMetaDataAdapter::__construct (   $a_glo_ref_id)

Constructor.

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

References $DIC, and ilObject\_lookupObjectId().

26  {
27  global $DIC;
28 
29  $this->db = $DIC->database();
30  $this->lng = $DIC->language();
31  $this->glo_id = ilObject::_lookupObjectId($a_glo_ref_id);
32  $this->glo_ref_id = $a_glo_ref_id;
33  }
static _lookupObjectId($a_ref_id)
lookup object id
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ getAllFields()

ilGlossaryAdvMetaDataAdapter::getAllFields ( )

Get all advanced metadata fields.

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

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

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

40  {
41  $fields = array();
42  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $this->glo_ref_id, "term");
43 
44  foreach ($recs as $record_obj) {
45  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record_obj->getRecordId()) as $def) {
46  $fields[$def->getFieldId()] = array(
47  "id" => $def->getFieldId(),
48  "title" => $def->getTitle(),
49  "type" => $def->getType()
50  );
51  }
52  }
53 
54  return $fields;
55  }
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
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.

Parameters

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

References $columns, $db, Vendor\Package\$f, $ilDB, $lng, and getAllFields().

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

64  {
65  $ilDB = $this->db;
66  $lng = $this->lng;
67 
68  $columns = array();
69 
70  $set = $ilDB->query(
71  "SELECT * FROM glo_advmd_col_order " .
72  " WHERE glo_id = " . $ilDB->quote($this->glo_id, "integer") .
73  " ORDER BY order_nr"
74  );
75  $order = array();
76  while ($rec = $ilDB->fetchAssoc($set)) {
77  $order[$rec["field_id"]] = $rec["order_nr"];
78  }
79  //var_dump($order);
80  // add term at beginning, if not included
81  if (!isset($order[0])) {
82  $columns[] = array("id" => 0,
83  "text" => $lng->txt("cont_term"));
84  }
85 
86  $fields = $this->getAllFields();
87 
88  // add all fields that have been already sorted
89  foreach ($order as $id => $order_nr) {
90  if (isset($fields[$id])) {
91  $columns[] = array("id" => $id,
92  "text" => $fields[$id]["title"]);
93  unset($fields[$id]);
94  } elseif ($id == 0) {
95  $columns[] = array("id" => 0,
96  "text" => $lng->txt("cont_term"));
97  }
98  }
99 
100  // add all fields that have not been sorted
101  foreach ($fields as $f) {
102  $columns[] = array("id" => $f["id"],
103  "text" => $f["title"]);
104  }
105 
106  return $columns;
107  }
getAllFields()
Get all advanced metadata fields.
global $ilDB
if(! $in) $columns
Definition: Utf8Test.php:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveColumnOrder()

ilGlossaryAdvMetaDataAdapter::saveColumnOrder (   $a_cols)

Save column order.

Parameters

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

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

116  {
117  $ilDB = $this->db;
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  }
global $ilDB

◆ writeColumnOrder()

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

Write single column order.

Parameters

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

References $DIC, and $ilDB.

Referenced by ilGlossaryImporter\finalProcessing().

147  {
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  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilGlossaryAdvMetaDataAdapter::$db
protected

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

Referenced by getColumnOrder(), and saveColumnOrder().

◆ $lng

ilGlossaryAdvMetaDataAdapter::$lng
protected

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

Referenced by getColumnOrder().


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