ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilGlossaryAdvMetaDataAdapter Class Reference

Advanced meta data adapter. More...

+ Collaboration diagram for ilGlossaryAdvMetaDataAdapter:

Public Member Functions

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

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

ilGlossaryAdvMetaDataAdapter::__construct (   $a_glo_id)

Constructor.

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

{
$this->glo_id = $a_glo_id;
}

Member Function Documentation

ilGlossaryAdvMetaDataAdapter::getAllFields ( )

Get all advanced metadata fields.

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

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

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

{
$fields = array();
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
$recs = ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $this->glo_id, "term");
foreach($recs as $record_obj)
{
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record_obj->getRecordId()) as $def)
{
$fields[$def->getFieldId()] = array(
"id" => $def->getFieldId(),
"title" => $def->getTitle(),
"type" => $def->getType()
);
}
}
return $fields;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryAdvMetaDataAdapter::getColumnOrder ( )

Get column order.

Parameters
@return

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

References $columns, $ilDB, $lng, and getAllFields().

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

{
global $ilDB, $lng;
$columns = array();
$set = $ilDB->query("SELECT * FROM glo_advmd_col_order ".
" WHERE glo_id = ".$ilDB->quote($this->glo_id, "integer").
" ORDER BY order_nr"
);
$order = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$order[$rec["field_id"]] = $rec["order_nr"];
}
//var_dump($order);
// add term at beginning, if not included
if (!isset($order[0]))
{
$columns[] = array("id" => 0,
"text" => $lng->txt("cont_term"));
}
$fields = $this->getAllFields();
// add all fields that have been already sorted
foreach ($order as $id => $order_nr)
{
if (isset($fields[$id]))
{
$columns[] = array("id" => $id,
"text" => $fields[$id]["title"]);
unset($fields[$id]);
}
else if ($id == 0)
{
$columns[] = array("id" => 0,
"text" => $lng->txt("cont_term"));
}
}
// add all fields that have not been sorted
foreach ($fields as $f)
{
$columns[] = array("id" => $f["id"],
"text" => $f["title"]);
}
return $columns;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGlossaryAdvMetaDataAdapter::saveColumnOrder (   $a_cols)

Save column order.

Parameters
@return

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

References $ilDB.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM glo_advmd_col_order WHERE ".
" glo_id = ".$ilDB->quote($this->glo_id, "integer")
);
$nr = 10;
$set = array();
foreach ($a_cols as $c)
{
//var_dump($c);
if (!isset($set[$c["id"]]))
{
$ilDB->manipulate("INSERT INTO glo_advmd_col_order ".
"(glo_id, field_id, order_nr) VALUES (".
$ilDB->quote($this->glo_id, "integer").",".
$ilDB->quote($c["id"], "integer").",".
$ilDB->quote($nr+=10, "integer").
")");
$set[$c["id"]] = $c["id"];
}
}
}

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