ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBlogDataSet Class Reference

Blog Data set class. More...

+ Inheritance diagram for ilBlogDataSet:
+ Collaboration diagram for ilBlogDataSet:

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...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record. 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)
 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...
 

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...
 

Protected Attributes

 $current_blog
 

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

Blog Data set class.

This class implements the following entities:

  • blog: object data
  • blog_posting: data from table il_blog_posting
Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

◆ getDependencies()

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

Determine the dependent sets of data.

Definition at line 131 of file class.ilBlogDataSet.php.

132  {
133  switch ($a_entity)
134  {
135  case "blog":
136  return array (
137  "blog_posting" => array("ids" => $a_rec["Id"])
138  );
139  }
140  return false;
141  }

◆ getSupportedVersions()

ilBlogDataSet::getSupportedVersions ( )

Get supported versions.

Definition at line 24 of file class.ilBlogDataSet.php.

25  {
26  return array("4.3.0");
27  }

◆ getTypes()

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

Get field types for entity.

Definition at line 40 of file class.ilBlogDataSet.php.

41  {
42  if ($a_entity == "blog")
43  {
44  switch ($a_version)
45  {
46  case "4.3.0":
47  return array(
48  "Id" => "integer",
49  "Title" => "text",
50  "Description" => "text",
51  "Notes" => "integer",
52  "BgColor" => "text",
53  "FontColor" => "text",
54  "Img" => "text",
55  "Ppic" => "integer",
56  "RssActive" => "integer",
57  "Approval" => "integer",
58  "Dir" => "directory"
59  );
60  }
61  }
62 
63  if ($a_entity == "blog_posting")
64  {
65  switch ($a_version)
66  {
67  case "4.3.0":
68  return array(
69  "Id" => "integer",
70  "BlogId" => "integer",
71  "Title" => "integer",
72  "Created" => "text",
73  "Author" => "text",
74  "Approved" => "integer"
75  );
76  }
77  }
78  }

◆ getXmlNamespace()

ilBlogDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

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

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

◆ getXmlRecord()

ilBlogDataSet::getXmlRecord (   $a_entity,
  $a_version,
  $a_set 
)

Get xml record.

Parameters

Definition at line 149 of file class.ilBlogDataSet.php.

References ilObjBlog\initStorage().

150  {
151  if ($a_entity == "blog")
152  {
153  include_once("./Modules/Blog/classes/class.ilObjBlog.php");
154  $dir = ilObjBlog::initStorage($a_set["Id"]);
155  $a_set["Dir"] = $dir;
156  }
157 
158  return $a_set;
159  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
+ Here is the call graph for this function:

◆ importRecord()

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

Import record.

Parameters

Definition at line 167 of file class.ilBlogDataSet.php.

References ilDataSet\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), IL_CAL_DATETIME, ilObjBlog\initStorage(), ilDataSet\parseObjectExportId(), and ilUtil\rCopy().

168  {
169  switch ($a_entity)
170  {
171  case "blog":
172  include_once("./Modules/Blog/classes/class.ilObjBlog.php");
173 
174  if($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"]))
175  {
176  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
177  }
178  else
179  {
180  $newObj = new ilObjBlog();
181  $newObj->create();
182  }
183 
184  $newObj->setTitle($a_rec["Title"]);
185  $newObj->setDescription($a_rec["Description"]);
186  $newObj->setNotesStatus($a_rec["Notes"]);
187  $newObj->setBackgroundColor($a_rec["BgColor"]);
188  $newObj->setFontColor($a_rec["FontColor"]);
189  $newObj->setProfilePicture($a_rec["Ppic"]);
190  $newObj->setRSS($a_rec["RssActive"]);
191  $newObj->setApproval($a_rec["Approval"]);
192  $newObj->setImage($a_rec["Img"]);
193  $newObj->update();
194 
195  // handle image(s)
196  if($a_rec["Img"])
197  {
198  $dir = str_replace("..", "", $a_rec["Dir"]);
199  if ($dir != "" && $this->getImportDirectory() != "")
200  {
201  $source_dir = $this->getImportDirectory()."/".$dir;
202  $target_dir = ilObjBlog::initStorage($newObj->getId());
203  ilUtil::rCopy($source_dir, $target_dir);
204  }
205  }
206 
207  $a_mapping->addMapping("Modules/Blog", "blog", $a_rec["Id"], $newObj->getId());
208  break;
209 
210  case "blog_posting":
211  $blog_id = (int) $a_mapping->getMapping("Modules/Blog", "blog", $a_rec["BlogId"]);
212  if($blog_id)
213  {
214  include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
215  $newObj = new ilBlogPosting();
216  $newObj->setBlogId($blog_id);
217  $newObj->setTitle($a_rec["Title"]);
218  $newObj->setCreated(new ilDateTime($a_rec["Created"], IL_CAL_DATETIME));
219  $newObj->setApproved($a_rec["Approved"]);
220 
221  // parse export id into local id (if possible)
222  $author = $this->parseObjectExportId($a_rec["Author"], -1);
223  $newObj->setAuthor($author["id"]);
224 
225  $newObj->create(true);
226 
227  $a_mapping->addMapping("Services/COPage", "pg", "blp:".$a_rec["Id"], "blp:".$newObj->getId());
228  }
229  break;
230  }
231  }
Class ilBlogPosting.
const IL_CAL_DATETIME
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getImportDirectory()
Get import directory.
parseObjectExportId($a_id, $a_fallback_id=NULL)
Parse export id.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
Class ilObjBlog.
Date and time handling
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

◆ readData()

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

Read data.

Parameters

Definition at line 86 of file class.ilBlogDataSet.php.

References ilDataSet\createObjectExportId(), and ilDataSet\getDirectDataFromQuery().

87  {
88  global $ilDB;
89 
90  if (!is_array($a_ids))
91  {
92  $a_ids = array($a_ids);
93  }
94 
95  if ($a_entity == "blog")
96  {
97  switch ($a_version)
98  {
99  case "4.3.0":
100  $this->getDirectDataFromQuery("SELECT bl.id,od.title,od.description,".
101  "bl.notes,bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval".
102  " FROM il_blog bl".
103  " JOIN object_data od ON (od.obj_id = bl.id)".
104  " WHERE ".$ilDB->in("bl.id", $a_ids, false, "integer").
105  " AND od.type = ".$ilDB->quote("blog", "text"));
106  break;
107  }
108  }
109 
110  if ($a_entity == "blog_posting")
111  {
112  switch ($a_version)
113  {
114  case "4.3.0":
115  $this->getDirectDataFromQuery("SELECT id,blog_id,title,created,author,approved".
116  " FROM il_blog_posting WHERE ".
117  $ilDB->in("blog_id", $a_ids, false, "integer"));
118  foreach($this->data as $idx => $item)
119  {
120  // create full export id
121  $this->data[$idx]["Author"] = $this->createObjectExportId("usr", $item["Author"]);
122  }
123  break;
124  }
125  }
126  }
createObjectExportId($a_type, $a_id)
Build ilias export id.
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 ...
+ Here is the call graph for this function:

Field Documentation

◆ $current_blog

ilBlogDataSet::$current_blog
protected

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


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