ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilNewsDataSet Class Reference

News data set class. More...

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

Public Member Functions

 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 getDirectDataFromQuery ($a_query, $a_convert_to_leading_upper=true, $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 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 ...> ... More...
 
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=null)
 Parse export id. More...
 

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
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

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

◆ getDependencies()

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

Determine the dependent sets of data.

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

100  {
101  return false;
102  }

◆ getSupportedVersions()

ilNewsDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

References array.

22  {
23  return array("4.1.0");
24  }
Create styles array
The data for the language used.

◆ getTypes()

ilNewsDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters

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

References array.

44  {
45  if ($a_entity == "news") {
46  switch ($a_version) {
47  case "4.1.0":
48  return array(
49  "Id" => "integer",
50  "Title" => "text",
51  "Content" => "text",
52  "Priority" => "integer",
53  "ContextObjId" => "integer",
54  "ContextObjType" => "text",
55  "ContextSubObjId" => "integer",
56  "ContextSubObjType" => "text",
57  "ContentType" => "text",
58  "Visibility" => "text",
59  "ContentLong" => "text",
60  "ContentIsLangVar" => "integer",
61  "MobId" => "integer",
62  "Playtime" => "text"
63  );
64  }
65  }
66  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilNewsDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

33  {
34  return "http://www.ilias.de/xml/Services/News/" . $a_entity;
35  }

◆ importRecord()

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

Import record.

Parameters

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

112  {
113  //echo $a_entity;
114  //var_dump($a_rec);
115 
116  switch ($a_entity) {
117  case "news":
118  $mob_id = null;
119  if ($a_rec["MobId"] > 0) {
120  $mob_id = $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["MobId"]);
121  }
122  $c = (int) $a_rec["ContextObjId"] . ":" . $a_rec["ContextObjType"] . ":" . (int) $a_rec["ContextSubObjId"] .
123  ":" . $a_rec["ContextSubObjType"];
124  $context = $a_mapping->getMapping("Services/News", "news_context", $c);
125  $context = explode(":", $context);
126 //var_dump($c);
127 //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
128  include_once("./Services/News/classes/class.ilNewsItem.php");
129  $newObj = new ilNewsItem();
130  $newObj->setTitle($a_rec["Title"]);
131  $newObj->setContent($a_rec["Content"]);
132  $newObj->setPriority($a_rec["Priority"]);
133  $newObj->setContextObjId($context[0]);
134  $newObj->setContextObjType($context[1]);
135  $newObj->setContextSubObjId($context[2]);
136  $newObj->setContextSubObjType($context[3]);
137  $newObj->setContentType($a_rec["ContentType"]);
138  $newObj->setVisibility($a_rec["Visibility"]);
139  $newObj->setContentLong($a_rec["ContentLong"]);
140  $newObj->setContentIsLangVar($a_rec["ContentIsLangVar"]);
141  $newObj->setMobId($mob_id);
142  $newObj->setPlaytime($a_rec["Playtime"]);
143  $newObj->create();
144  $a_mapping->addMapping("Services/News", "news", $a_rec["Id"], $newObj->getId());
145  break;
146  }
147  }

◆ readData()

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

Read data.

Parameters

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

References ilDataSet\$db, $ilDB, array, and ilDataSet\getDirectDataFromQuery().

75  {
76  $ilDB = $this->db;
77 
78  if (!is_array($a_ids)) {
79  $a_ids = array($a_ids);
80  }
81 
82  if ($a_entity == "news") {
83  switch ($a_version) {
84  case "4.1.0":
85  $this->getDirectDataFromQuery("SELECT id, title, content, priority," .
86  " context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, " .
87  " content_type, visibility, content_long, content_is_lang_var, mob_id, playtime" .
88  " FROM il_news_item " .
89  "WHERE " .
90  $ilDB->in("id", $a_ids, false, "integer"));
91  break;
92  }
93  }
94  }
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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