ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAdvancedMDValues Class Reference
+ Collaboration diagram for ilAdvancedMDValues:

Static Public Member Functions

static _getValuesByObjId ($a_obj_id)
 Get all values of an object.
static _cloneValues ($a_source_id, $a_target_id)
 Clone Advanced Meta Data.
static _appendXMLByObjId (ilXmlWriter $xml_writer, $a_obj_id)
 Get xml of object values.
static _preloadValuesByObjIds ($obj_ids)
 preload object values
static _deleteByFieldId ($a_field_id)
 Delete values by field_id.
static _deleteByObjId ($a_obj_id)
 Delete by objekt id.

Static Private Attributes

static $cached_values = array()

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 33 of file class.ilAdvancedMDValues.php.

Member Function Documentation

static ilAdvancedMDValues::_appendXMLByObjId ( ilXmlWriter  $xml_writer,
  $a_obj_id 
)
static

Get xml of object values.

public

Parameters
objectinstance of ilXmlWriter
int$a_obj_id

Definition at line 113 of file class.ilAdvancedMDValues.php.

References $ilDB, $query, $res, $row, ilAdvancedMDValue\_getInstance(), ilObject\_lookupType(), DB_FETCHMODE_OBJECT, ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by ilCourseXMLWriter\__buildAdvancedMetaData().

{
global $ilDB;
$type = ilObject::_lookupType($a_obj_id);
// Get active field_definitions
$query = "SELECT field_id FROM adv_md_record amr ".
"JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id ".
"JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id ".
"WHERE active = 1 ".
"AND obj_type = ".$ilDB->quote($type ,'text')." ";
$xml_writer->xmlStartTag('AdvancedMetaData');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
$value = ilAdvancedMDValue::_getInstance($a_obj_id,$row->field_id);
$value->appendXML($xml_writer);
}
$xml_writer->xmlEndTag('AdvancedMetaData');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDValues::_cloneValues (   $a_source_id,
  $a_target_id 
)
static

Clone Advanced Meta Data.

public

Parameters
intsource obj_id
inttarget obj_id

Definition at line 75 of file class.ilAdvancedMDValues.php.

References $ilLog, ilAdvancedMDFieldDefinition\_getActiveDefinitionsByObjType(), and ilObject\_lookupType().

Referenced by ilObject\cloneObject().

{
global $ilLog;
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
{
$ilLog->write(__METHOD__.': No advanced meta data found.');
return true;
}
$ilLog->write(__METHOD__.': Start cloning advanced meta data.');
foreach(self::_getValuesByObjId($a_source_id) as $field_id => $value)
{
if(!in_array($field_id,$defs))
{
continue;
}
$new_value = new ilAdvancedMDValue($field_id,$a_target_id);
$new_value->setValue($value);
$new_value->save();
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDValues::_deleteByFieldId (   $a_field_id)
static

Delete values by field_id.

Typically called after deleting a field

public

Parameters
intfield id

Definition at line 170 of file class.ilAdvancedMDValues.php.

References $ilDB, $query, and $res.

Referenced by ilAdvancedMDFieldDefinition\_deleteByRecordId(), and ilAdvancedMDFieldDefinition\delete().

{
global $ilDB;
$query = "DELETE FROM adv_md_values ".
"WHERE field_id = ".$ilDB->quote($a_field_id ,'integer')." ";
$res = $ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

static ilAdvancedMDValues::_deleteByObjId (   $a_obj_id)
static

Delete by objekt id.

public

Parameters
intobj_id

Definition at line 187 of file class.ilAdvancedMDValues.php.

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "DELETE FROM adv_md_values ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->manipulate($query);
}
static ilAdvancedMDValues::_getValuesByObjId (   $a_obj_id)
static

Get all values of an object.

Uses internal cache.

public

Parameters
intobj_id

Definition at line 46 of file class.ilAdvancedMDValues.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilECSSettingsGUI\exportImported(), ilECSSettingsGUI\exportReleased(), ilECSReleasedContentTableGUI\fillRow(), ilECSImportedContentTableGUI\fillRow(), ilAdvancedMDSubstitution\getParsedSubstitutions(), and ilECSContentWriter\updateJSON().

{
global $ilDB;
if(isset(self::$cached_values[$a_obj_id]))
{
return self::$cached_values[$a_obj_id];
}
$query = "SELECT field_id,value FROM adv_md_values ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer');
$res = $ilDB->query($query);
self::$cached_values[$a_obj_id] = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
self::$cached_values[$a_obj_id][$row->field_id] = $row->value;
}
return self::$cached_values[$a_obj_id];
}

+ Here is the caller graph for this function:

static ilAdvancedMDValues::_preloadValuesByObjIds (   $obj_ids)
static

preload object values

public

Parameters
arrayobj_ids

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT obj_id,field_id,value FROM adv_md_values ".
"WHERE ".$ilDB->in('obj_id',$obj_ids,false,'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
self::$cached_values[$row->obj_id][$row->field_id] = $row->value;
}
return true;
}

Field Documentation

ilAdvancedMDValues::$cached_values = array()
staticprivate

Definition at line 35 of file class.ilAdvancedMDValues.php.


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