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

News data set class. More...

+ Inheritance diagram for ilNewsDataSet:
+ Collaboration diagram for ilNewsDataSet:

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

News data set class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilNewsDataSet.php.

Member Function Documentation

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

Determine the dependent sets of data.

Definition at line 110 of file class.ilNewsDataSet.php.

{
return false;
}
ilNewsDataSet::getSupportedVersions (   $a_entity)

Get supported versions.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 21 of file class.ilNewsDataSet.php.

{
switch ($a_entity)
{
case "news":
return array("4.1.0");
}
}
ilNewsDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 47 of file class.ilNewsDataSet.php.

{
if ($a_entity == "news")
{
switch ($a_version)
{
case "4.1.0":
return array(
"Id" => "integer",
"Title" => "text",
"Content" => "text",
"Priority" => "integer",
"ContextObjId" => "integer",
"ContextObjType" => "text",
"ContextSubObjId" => "integer",
"ContextSubObjType" => "text",
"ContentType" => "text",
"Visibility" => "text",
"ContentLong" => "text",
"ContentIsLangVar" => "integer",
"MobId" => "integer",
"Playtime" => "text"
);
}
}
}
ilNewsDataSet::getXmlNamespace (   $a_entity,
  $a_target_release 
)

Get xml namespace.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 36 of file class.ilNewsDataSet.php.

{
return "http://www.ilias.de/xml/Services/News/".$a_entity;
}
ilNewsDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters
@return

Definition at line 122 of file class.ilNewsDataSet.php.

{
//echo $a_entity;
//var_dump($a_rec);
switch ($a_entity)
{
case "news":
$mob_id = null;
if ($a_rec["MobId"] > 0)
{
$mob_id = $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["MobId"]);
}
$c = (int)$a_rec["ContextObjId"].":".$a_rec["ContextObjType"].":".(int)$a_rec["ContextSubObjId"].
":".$a_rec["ContextSubObjType"];
$context = $a_mapping->getMapping("Services/News", "news_context", $c);
$context = explode(":", $context);
//var_dump($c);
//var_dump($a_mapping->mappings["Services/News"]["news_context"]);
include_once("./Services/News/classes/class.ilNewsItem.php");
$newObj = new ilNewsItem();
$newObj->setTitle($a_rec["Title"]);
$newObj->setContent($a_rec["Content"]);
$newObj->setPriority($a_rec["Priority"]);
$newObj->setContextObjId($context[0]);
$newObj->setContextObjType($context[1]);
$newObj->setContextSubObjId($context[2]);
$newObj->setContextSubObjType($context[3]);
$newObj->setContentType($a_rec["ContentType"]);
$newObj->setVisibility($a_rec["Visibility"]);
$newObj->setContentLong($a_rec["ContentLong"]);
$newObj->setContentIsLangVar($a_rec["ContentIsLangVar"]);
$newObj->setMobId($mob_id);
$newObj->setPlaytime($a_rec["Playtime"]);
$newObj->create();
$a_mapping->addMapping("Services/News", "news", $a_rec["Id"], $newObj->getId());
break;
}
}
ilNewsDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters
@return

Definition at line 81 of file class.ilNewsDataSet.php.

References $ilDB, and ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
if ($a_entity == "news")
{
switch ($a_version)
{
case "4.1.0":
$this->getDirectDataFromQuery("SELECT id, title, content, priority,".
" context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, ".
" content_type, visibility, content_long, content_is_lang_var, mob_id, playtime".
" FROM il_news_item ".
"WHERE ".
$ilDB->in("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: