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

Media Pool Data set class. More...

+ Inheritance diagram for ilMediaObjectDataSet:
+ Collaboration diagram for ilMediaObjectDataSet:

Public Member Functions

 getSupportedVersions ()
 Get supported versions.
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace.
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data.
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record.
 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_schema_version)
 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_schema_version, $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_schema_version, $a_ids, $a_field="")
 Add records xml.
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record.
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces.
 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_schema_version)
 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.
- Protected Member Functions inherited from ilDataSet
 createObjectExportId ($a_type, $a_id)
 Build ilias export id.
 parseObjectExportId ($a_id, $a_fallback_id=NULL)
 Parse export id.

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
const EXPORT_NO_INST_ID = 1
const EXPORT_ID_ILIAS_LOCAL = 2
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
const EXPORT_ID_ILIAS_REMOTE = 4
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
const EXPORT_ID = 6
const EXPORT_ID_INVALID = 7

Detailed Description

Media Pool Data set class.

This class implements the following entities:

  • mob: object data
  • mob_media_item: data from table media_item
  • mob_mi_map_area: data from a table map_area
  • mob_mi_parameter: data from a table mob_parameter
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 19 of file class.ilMediaObjectDataSet.php.

Member Function Documentation

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

Determine the dependent sets of data.

Definition at line 237 of file class.ilMediaObjectDataSet.php.

{
switch ($a_entity)
{
case "mob":
return array (
"mob_media_item" => array("ids" => $a_rec["Id"])
);
case "mob_media_item":
return array (
"mob_mi_map_area" => array("ids" => $a_rec["Id"]),
"mob_mi_parameter" => array("ids" => $a_rec["Id"])
);
}
return false;
}
ilMediaObjectDataSet::getSupportedVersions ( )

Get supported versions.

Parameters
@return

Reimplemented from ilDataSet.

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

{
return array("4.3.0", "4.1.0");
}
ilMediaObjectDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 49 of file class.ilMediaObjectDataSet.php.

{
// mob
if ($a_entity == "mob")
{
switch ($a_version)
{
case "4.1.0":
case "4.3.0":
return array(
"Id" => "integer",
"Title" => "text",
"Description" => "text",
"Dir" => "directory"
);
}
}
// media item
if ($a_entity == "mob_media_item")
{
switch ($a_version)
{
case "4.1.0":
return array(
"Id" => "integer",
"MobId" => "integer",
"Width" => "integer",
"Height" => "integer",
"Halign" => "text",
"Caption" => "text",
"Nr" => "integer",
"Purpose" => "text",
"Location" => "text",
"LocationType" => "text",
"Format" => "text",
"TextRepresentation" => "text"
);
case "4.3.0":
return array(
"Id" => "integer",
"MobId" => "integer",
"Width" => "integer",
"Height" => "integer",
"Halign" => "text",
"Caption" => "text",
"Nr" => "integer",
"Purpose" => "text",
"Location" => "text",
"LocationType" => "text",
"Format" => "text",
"TextRepresentation" => "text"
);
}
}
// map areas
if ($a_entity == "mob_mi_map_area")
{
switch ($a_version)
{
case "4.1.0":
case "4.3.0":
return array(
"MiId" => "integer",
"Nr" => "integer",
"Shape" => "text",
"Coords" => "text",
"LinkType" => "text",
"Title" => "text",
"Href" => "text",
"Target" => "text",
"Type" => "text",
"TargetFrame" => "text",
"HighlightMode" => "text",
"HighlightText" => "text"
);
}
}
// media item parameter
if ($a_entity == "mob_mi_parameter")
{
switch ($a_version)
{
case "4.1.0":
case "4.3.0":
return array(
"MiId" => "integer",
"Name" => "text",
"Value" => "text"
);
}
}
}
ilMediaObjectDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 38 of file class.ilMediaObjectDataSet.php.

{
return "http://www.ilias.de/xml/Services/MediaObject/".$a_entity;
}
ilMediaObjectDataSet::getXmlRecord (   $a_entity,
  $a_version,
  $a_set 
)

Get xml record.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 261 of file class.ilMediaObjectDataSet.php.

References ilObjMediaObject\_getDirectory().

{
if ($a_entity == "mob")
{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$dir = ilObjMediaObject::_getDirectory($a_set["Id"]);
$a_set["Dir"] = $dir;
}
return $a_set;
}

+ Here is the call graph for this function:

ilMediaObjectDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters
@return

Definition at line 279 of file class.ilMediaObjectDataSet.php.

References ilObjMediaObject\_createThumbnailDirectory(), ilObjMediaObject\_getDirectory(), ilDataSet\getImportDirectory(), and ilUtil\rCopy().

{
//echo $a_entity;
//var_dump($a_rec);
switch ($a_entity)
{
case "mob":
//var_dump($a_rec);
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$newObj = new ilObjMediaObject();
$newObj->setType("mob");
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->create();
$newObj->createDirectory();
$this->current_mob = $newObj;
$dir = str_replace("..", "", $a_rec["Dir"]);
if ($dir != "" && $this->getImportDirectory() != "")
{
$source_dir = $this->getImportDirectory()."/".$dir;
$target_dir = $dir = ilObjMediaObject::_getDirectory($newObj->getId());
ilUtil::rCopy($source_dir, $target_dir);
}
$a_mapping->addMapping("Services/MediaObjects", "mob", $a_rec["Id"], $newObj->getId());
//echo "<br>++add++"."0:".$a_rec["Id"].":mob+0:".$newObj->getId().":mob"."+";
$a_mapping->addMapping("Services/MetaData", "md",
"0:".$a_rec["Id"].":mob", "0:".$newObj->getId().":mob");
break;
case "mob_media_item":
// determine parent mob
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mob_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["MobId"]);
if (is_object($this->current_mob) && $this->current_mob->getId() == $mob_id)
{
$mob = $this->current_mob;
}
else
{
$mob = new ilObjMediaObject($mob_id);
}
include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
$newObj = new ilMediaItem();
$newObj->setMobId($mob_id);
$newObj->setWidth($a_rec["Width"]);
$newObj->setHeight($a_rec["Height"]);
$newObj->setCaption($a_rec["Caption"]);
$newObj->setNr($a_rec["Nr"]);
$newObj->setPurpose($a_rec["Purpose"]);
$newObj->setLocation($a_rec["Location"]);
$newObj->setLocationType($a_rec["LocationType"]);
$newObj->setFormat($a_rec["Format"]);
$newObj->setTextRepresentation($a_rec["TextRepresentation"]);
$newObj->create();
$this->current_media_item = $newObj;
$a_mapping->addMapping("Services/MediaObjects", "mob_media_item", $a_rec["Id"], $newObj->getId());
break;
case "mob_mi_parameter":
// get media item
include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
$med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]);
if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id)
{
$med = $this->current_media_item;
}
else
{
$med = new ilMediaItem($med_id);
}
$med->writeParameter($a_rec["Name"], $a_rec["Value"]);
break;
case "mob_mi_map_area":
// get media item
include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
$med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]);
if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id)
{
$med = $this->current_media_item;
}
else
{
$med = new ilMediaItem($med_id);
}
include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
$map_area = new ilMapArea();
$map_area->setItemId($med_id);
$map_area->setNr($a_rec["Nr"]);
$map_area->setShape($a_rec["Shape"]);
$map_area->setCoords($a_rec["Coords"]);
$map_area->setLinkType($a_rec["LinkType"]);
$map_area->setTitle($a_rec["Title"]);
$map_area->setHref($a_rec["Href"]);
$map_area->setTarget($a_rec["Target"]);
$map_area->setType($a_rec["Type"]);
$map_area->setTargetFrame($a_rec["TargetFrame"]);
$map_area->setHighlightMode($a_rec["HighlightMode"]);
$map_area->setHighlightClass($a_rec["HighlightClass"]);
$map_area->create();
break;
}
}

+ Here is the call graph for this function:

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

Read data.

Parameters
@return

Definition at line 152 of file class.ilMediaObjectDataSet.php.

References $ilDB, ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilObject\_lookupType(), and ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
// mob
if ($a_entity == "mob")
{
$this->data = array();
foreach ($a_ids as $mob_id)
{
if (ilObject::_lookupType($mob_id) == "mob")
{
$this->data[] = array ("Id" => $mob_id,
"Title" => ilObject::_lookupTitle($mob_id),
"Description" => ilObject::_lookupDescription($mob_id));
}
}
}
// media item
if ($a_entity == "mob_media_item")
{
switch ($a_version)
{
case "4.1.0":
$this->getDirectDataFromQuery("SELECT id, mob_id, width, height, halign,".
"caption, nr, purpose, location, location_type, format, text_representation".
" FROM media_item WHERE ".
$ilDB->in("mob_id", $a_ids, false, "integer"));
break;
case "4.3.0":
$this->getDirectDataFromQuery("SELECT id, mob_id, width, height, halign,".
"caption, nr, purpose, location, location_type, format, text_representation".
" FROM media_item WHERE ".
$ilDB->in("mob_id", $a_ids, false, "integer"));
break;
}
}
// media item map area
if ($a_entity == "mob_mi_map_area")
{
switch ($a_version)
{
case "4.1.0":
case "4.3.0":
$this->getDirectDataFromQuery("SELECT item_id mi_id, nr".
" ,shape, coords, link_type, title, href, target, type, target_frame, ".
" highlight_mode, highlight_class".
" FROM map_area ".
" WHERE ".
$ilDB->in("item_id", $a_ids, false, "integer").
" ORDER BY nr");
break;
}
}
// media item parameter
if ($a_entity == "mob_mi_parameter")
{
switch ($a_version)
{
case "4.1.0":
case "4.3.0":
$this->getDirectDataFromQuery("SELECT med_item_id mi_id, name, value".
" FROM mob_parameter ".
" WHERE ".
$ilDB->in("med_item_id", $a_ids, false, "integer"));
break;
}
}
}

+ Here is the call graph for this function:


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