ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryAdvMetaDataAdapter::__construct (   $a_glo_ref_id)

Constructor.

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

References $DIC, and ilObject\_lookupObjectId().

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

Member Function Documentation

◆ getAllFields()

ilGlossaryAdvMetaDataAdapter::getAllFields ( )

Get all advanced metadata fields.

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

References $def, ilAdvancedMDRecord\_getSelectedRecordsByObject(), array, and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

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

42  {
43  $fields = array();
44  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
45  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $this->glo_ref_id, "term");
46 
47  foreach ($recs as $record_obj) {
48  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
49  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record_obj->getRecordId()) as $def) {
50  $fields[$def->getFieldId()] = array(
51  "id" => $def->getFieldId(),
52  "title" => $def->getTitle(),
53  "type" => $def->getType()
54  );
55  }
56  }
57 
58  return $fields;
59  }
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.
Create styles array
The data for the language used.
$def
Definition: croninfo.php:21
+ 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 67 of file class.ilGlossaryAdvMetaDataAdapter.php.

References $columns, $db, $id, $ilDB, $lng, array, and getAllFields().

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

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

References $db, $ilDB, and array.

120  {
121  $ilDB = $this->db;
122 
123  $ilDB->manipulate(
124  "DELETE FROM glo_advmd_col_order WHERE " .
125  " glo_id = " . $ilDB->quote($this->glo_id, "integer")
126  );
127 
128  $nr = 10;
129  $set = array();
130  foreach ($a_cols as $c) {
131  //var_dump($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  }
Create styles array
The data for the language used.
global $ilDB

◆ writeColumnOrder()

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

Write single column order.

Parameters

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

References $DIC, $ilDB, and array.

Referenced by ilGlossaryImporter\finalProcessing().

151  {
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  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilGlossaryAdvMetaDataAdapter::$db
protected

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

Referenced by getColumnOrder(), and saveColumnOrder().

◆ $lng

ilGlossaryAdvMetaDataAdapter::$lng
protected

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

Referenced by getColumnOrder().


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