ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMediaPoolDataSet Class Reference

Media Pool Data set class. More...

+ Inheritance diagram for ilMediaPoolDataSet:
+ Collaboration diagram for ilMediaPoolDataSet:

Public Member Functions

 getSupportedVersions ($a_entity)
 Get supported versions.
 getXmlNamespace ($a_entity, $a_target_release)
 Get xml namespace.
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data.
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record.
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor.
 init ($a_entity, $a_target_release)
 Init.
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB.
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories.
 setImportDirectory ($a_val)
 Set import directory.
 getImportDirectory ()
 Get import directory.
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix.
 getDSPrefix ()
 Get XML dataset namespace prefix.
 getDSPrefixString ()
 getDirectDataFromQuery ($a_query, $a_convert_to_leading_upper=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields.
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string.
 getJsonRepresentation ()
 Get json representation.
 getXmlRepresentation ($a_entity, $a_target_release, $a_ids, $a_field="", $a_omit_header=false, $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text"> <ftype name="field_2" type="date"> <ftype name="field_3" type="integer"> </types> <types ...> ...
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_target_release, $a_ids, $a_field="")
 Add records xml.
 getNamespaces (&$namespaces, $a_entity, $a_target_release)
 Get xml namespaces.
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version.
 getJsonRecord ($a_set)
 Get json record for version.
 getXmlTypes ($a_entity, $a_version)
 Get xml types.
 getJsonTypes ($a_entity, $a_version)
 Get json types.
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten)
 getXMLEntityTag ($a_entity, $a_target_release)
 Get entity tag.
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten)
 setImport ($a_val)
 Set import object.
 getImport ()
 Get import object.

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity.
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data.

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt

Detailed Description

Media Pool Data set class.

This class implements the following entities:

  • mep_data: data from table mep_data
  • mep_tree: data from a join on mep_tree and mep_item
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

ilMediaPoolDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

Definition at line 139 of file class.ilMediaPoolDataSet.php.

{
switch ($a_entity)
{
case "mep":
return array (
"mep_tree" => array("ids" => $a_rec["Id"])
);
}
return false;
}
ilMediaPoolDataSet::getSupportedVersions (   $a_entity)

Get supported versions.

Parameters
@return

Reimplemented from ilDataSet.

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

{
switch ($a_entity)
{
case "mep":
return array("4.1.0");
case "mep_tree":
return array("4.1.0");
}
}
ilMediaPoolDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 53 of file class.ilMediaPoolDataSet.php.

{
// mep
if ($a_entity == "mep")
{
switch ($a_version)
{
case "4.1.0":
return array(
"Id" => "integer",
"Title" => "text",
"Description" => "text",
"DefaultWidth" => "integer",
"DefaultHeight" => "integer");
}
}
// mep_tree
if ($a_entity == "mep_tree")
{
switch ($a_version)
{
case "4.1.0":
return array(
"MepId" => "integer",
"Child" => "integer",
"Parent" => "integer",
"Depth" => "integer",
"Type" => "text",
"Title" => "text",
"ForeignId" => "integer"
);
}
}
}
ilMediaPoolDataSet::getXmlNamespace (   $a_entity,
  $a_target_release 
)

Get xml namespace.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 42 of file class.ilMediaPoolDataSet.php.

{
return "http://www.ilias.de/xml/Modules/MediaPool/".$a_entity;
}
ilMediaPoolDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters
@return

Definition at line 162 of file class.ilMediaPoolDataSet.php.

References ilObjectFactory\getInstanceByObjId().

{
//echo $a_entity;
//var_dump($a_rec);
switch ($a_entity)
{
case "mep":
include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
{
$newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
}
else
{
$newObj = new ilObjMediaPool();
$newObj->setType("mep");
$newObj->create(true);
}
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->setDefaultWidth($a_rec["DefaultWidth"]);
$newObj->setDefaultHeight($a_rec["DefaultHeight"]);
$newObj->update();
$this->current_obj = $newObj;
$a_mapping->addMapping("Modules/MediaPool", "mep", $a_rec["Id"], $newObj->getId());
break;
case "mep_tree":
switch ($a_rec["Type"])
{
case "fold":
$parent = (int) $a_mapping->getMapping("Modules/MediaPool", "mep_tree", $a_rec["Parent"]);
$fold_id =
$this->current_obj->createFolder($a_rec["Title"], $parent);
$a_mapping->addMapping("Modules/MediaPool", "mep_tree", $a_rec["Child"],
$fold_id);
break;
case "mob":
$parent = (int) $a_mapping->getMapping("Modules/MediaPool", "mep_tree", $a_rec["Parent"]);
$mob_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["ForeignId"]);
$item = new ilMediaPoolItem();
$item->setType("mob");
$item->setForeignId($mob_id);
$item->setTitle($a_rec["Title"]);
$item->create();
if ($item->getId() > 0)
{
$this->current_obj->insertInTree($item->getId(), $parent);
}
break;
case "pg":
$parent = (int) $a_mapping->getMapping("Modules/MediaPool", "mep_tree", $a_rec["Parent"]);
$item = new ilMediaPoolItem();
$item->setType("pg");
$item->setTitle($a_rec["Title"]);
$item->create();
$a_mapping->addMapping("Services/COPage", "pg", "mep:".$a_rec["Child"],
"mep:".$item->getId());
if ($item->getId() > 0)
{
$this->current_obj->insertInTree($item->getId(), $parent);
}
break;
}
}
}

+ Here is the call graph for this function:

ilMediaPoolDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters
@return

Definition at line 95 of file class.ilMediaPoolDataSet.php.

References $ilDB, and ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
// mep_data
if ($a_entity == "mep")
{
switch ($a_version)
{
case "4.1.0":
$this->getDirectDataFromQuery("SELECT id, title, description, ".
" default_width, default_height".
" FROM mep_data JOIN object_data ON (mep_data.id = object_data.obj_id) ".
"WHERE ".
$ilDB->in("id", $a_ids, false, "integer"));
break;
}
}
// mep_tree
if ($a_entity == "mep_tree")
{
switch ($a_version)
{
case "4.1.0":
$this->getDirectDataFromQuery("SELECT mep_id, child ".
" ,parent,depth,type,title,foreign_id ".
" FROM mep_tree JOIN mep_item ON (child = obj_id) ".
" WHERE ".
$ilDB->in("mep_id", $a_ids, false, "integer").
" ORDER BY depth");
break;
}
}
}

+ Here is the call graph for this function:


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