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

Blog Data set class. More...

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

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.

Static Public Attributes

static $style_map = array()

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.

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

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

Determine the dependent sets of data.

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

{
switch ($a_entity)
{
case "blog":
return array (
"blog_posting" => array("ids" => $a_rec["Id"])
);
}
return false;
}
ilBlogDataSet::getSupportedVersions ( )

Get supported versions.

Reimplemented from ilDataSet.

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

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

Get field types for entity.

Reimplemented from ilDataSet.

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

{
if ($a_entity == "blog")
{
switch ($a_version)
{
case "4.3.0":
return array(
"Id" => "integer",
"Title" => "text",
"Description" => "text",
"Notes" => "integer",
"BgColor" => "text",
"FontColor" => "text",
"Img" => "text",
"Ppic" => "integer",
"RssActive" => "integer",
"Approval" => "integer",
"Dir" => "directory"
);
case "5.0.0":
return array(
"Id" => "integer",
"Title" => "text",
"Description" => "text",
"Notes" => "integer",
"BgColor" => "text",
"FontColor" => "text",
"Img" => "text",
"Ppic" => "integer",
"RssActive" => "integer",
"Approval" => "integer",
"Dir" => "directory",
"AbsShorten" => "integer",
"AbsShortenLen" => "integer",
"AbsImage" => "integer",
"AbsImgWidth" => "integer",
"AbsImgHeight" => "integer",
"NavMode" => "integer",
"NavListPost" => "integer",
"NavListMon" => "integer",
"Keywords" => "integer",
"Authors" => "integer",
"NavOrder" => "text",
"OvPost" => "integer",
"Style" => "integer"
);
}
}
if ($a_entity == "blog_posting")
{
switch ($a_version)
{
case "4.3.0":
case "5.0.0":
return array(
"Id" => "integer",
"BlogId" => "integer",
"Title" => "integer",
"Created" => "text",
"Author" => "text",
"Approved" => "integer"
);
}
}
}
ilBlogDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Reimplemented from ilDataSet.

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

{
return "http://www.ilias.de/xml/Modules/Blog/".$a_entity;
}
ilBlogDataSet::getXmlRecord (   $a_entity,
  $a_version,
  $a_set 
)

Get xml record.

Parameters
@return

Reimplemented from ilDataSet.

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

References ilNote\commentsActivated(), ilObjBlog\initStorage(), and ilObjStyleSheet\lookupObjectStyle().

{
if ($a_entity == "blog")
{
include_once("./Modules/Blog/classes/class.ilObjBlog.php");
$dir = ilObjBlog::initStorage($a_set["Id"]);
$a_set["Dir"] = $dir;
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$a_set["Style"] = ilObjStyleSheet::lookupObjectStyle($a_set["Id"]);
// #14734
include_once("./Services/Notes/classes/class.ilNote.php");
$a_set["Notes"] = ilNote::commentsActivated($a_set["Id"], 0, "blog");
}
return $a_set;
}

+ Here is the call graph for this function:

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

Import record.

Parameters
@return

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

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

{
switch ($a_entity)
{
case "blog":
include_once("./Modules/Blog/classes/class.ilObjBlog.php");
// container copy
if($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"]))
{
$newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
}
else
{
$newObj = new ilObjBlog();
$newObj->create();
}
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->setNotesStatus($a_rec["Notes"]);
$newObj->setBackgroundColor($a_rec["BgColor"]);
$newObj->setFontColor($a_rec["FontColor"]);
$newObj->setProfilePicture($a_rec["Ppic"]);
$newObj->setRSS($a_rec["RssActive"]);
$newObj->setApproval($a_rec["Approval"]);
$newObj->setImage($a_rec["Img"]);
$newObj->setAbstractShorten($a_rec["AbsShorten"]);
$newObj->setAbstractShortenLength($a_rec["AbsShortenLen"]);
$newObj->setAbstractImage($a_rec["AbsImage"]);
$newObj->setAbstractImageWidth($a_rec["AbsImgWidth"]);
$newObj->setAbstractImageHeight($a_rec["AbsImgHeight"]);
$newObj->setNavMode($a_rec["NavMode"]);
$newObj->setNavModeListPostings($a_rec["NavListPost"]);
$newObj->setNavModeListMonths($a_rec["NavListMon"]);
$newObj->setKeywords($a_rec["Keywords"]);
$newObj->setAuthors($a_rec["Authors"]);
$newObj->setOrder(trim($a_rec["NavOrder"])
? explode(";", $a_rec["NavOrder"])
: null);
$newObj->setOverviewPostings($a_rec["OvPost"]);
$newObj->update();
// handle image(s)
if($a_rec["Img"])
{
$dir = str_replace("..", "", $a_rec["Dir"]);
if ($dir != "" && $this->getImportDirectory() != "")
{
$source_dir = $this->getImportDirectory()."/".$dir;
$target_dir = ilObjBlog::initStorage($newObj->getId());
ilUtil::rCopy($source_dir, $target_dir);
}
}
if($a_rec["Style"])
{
self::$style_map[$a_rec["Style"]][] = $newObj->getId();
}
$a_mapping->addMapping("Modules/Blog", "blog", $a_rec["Id"], $newObj->getId());
break;
case "blog_posting":
$blog_id = (int) $a_mapping->getMapping("Modules/Blog", "blog", $a_rec["BlogId"]);
if($blog_id)
{
include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
$newObj = new ilBlogPosting();
$newObj->setBlogId($blog_id);
$newObj->setTitle($a_rec["Title"]);
$newObj->setCreated(new ilDateTime($a_rec["Created"], IL_CAL_DATETIME));
$newObj->setApproved($a_rec["Approved"]);
// parse export id into local id (if possible)
$author = $this->parseObjectExportId($a_rec["Author"], -1);
$newObj->setAuthor($author["id"]);
$newObj->create(true);
// keywords
$keywords = array();
for($loop = 0; $loop < 1000; $loop++)
{
if(isset($a_rec["Keyword".$loop]))
{
$keyword = trim($a_rec["Keyword".$loop]);
if(strlen($keyword))
{
$keywords[] = $keyword;
}
}
}
if(sizeof($keywords))
{
$newObj->updateKeywords($keywords);
}
$a_mapping->addMapping("Services/COPage", "pg", "blp:".$a_rec["Id"], "blp:".$newObj->getId());
}
break;
}
}

+ Here is the call graph for this function:

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

Read data.

Parameters
@return

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

References $ilDB, ilDataSet\createObjectExportId(), ilDataSet\getDirectDataFromQuery(), ilBlogPosting\getKeywords(), and ilBlogPosting\lookupBlogId().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
if ($a_entity == "blog")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT bl.id,od.title,od.description,".
"bl.notes,bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval".
" FROM il_blog bl".
" JOIN object_data od ON (od.obj_id = bl.id)".
" WHERE ".$ilDB->in("bl.id", $a_ids, false, "integer").
" AND od.type = ".$ilDB->quote("blog", "text"));
break;
case "5.0.0":
$this->getDirectDataFromQuery("SELECT bl.id,od.title,od.description,".
"bl.bg_color,bl.font_color,bl.img,bl.ppic,bl.rss_active,bl.approval,".
"bl.abs_shorten,bl.abs_shorten_len,bl.abs_image,bl.abs_img_width,bl.abs_img_height,".
"bl.nav_mode,bl.nav_list_post,bl.nav_list_mon,bl.keywords,bl.authors,bl.nav_order,".
"bl.ov_post".
" FROM il_blog bl".
" JOIN object_data od ON (od.obj_id = bl.id)".
" WHERE ".$ilDB->in("bl.id", $a_ids, false, "integer").
" AND od.type = ".$ilDB->quote("blog", "text"));
break;
}
}
if ($a_entity == "blog_posting")
{
switch ($a_version)
{
case "4.3.0":
case "5.0.0":
$this->getDirectDataFromQuery("SELECT id,blog_id,title,created,author,approved".
" FROM il_blog_posting WHERE ".
$ilDB->in("blog_id", $a_ids, false, "integer"));
foreach($this->data as $idx => $item)
{
// create full export id
$this->data[$idx]["Author"] = $this->createObjectExportId("usr", $item["Author"]);
}
break;
}
// keywords
include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
include_once("./Services/MetaData/classes/class.ilMDKeyword.php");
foreach($this->data as $idx => $item)
{
$blog_id = ilBlogPosting::lookupBlogId($item["Id"]);
$keywords = ilBlogPosting::getKeywords($blog_id, $item["Id"]);
if($keywords)
{
foreach($keywords as $kidx => $keyword)
{
$this->data[$idx]["Keyword".$kidx] = $keyword;
}
}
}
}
}

+ Here is the call graph for this function:

Field Documentation

ilBlogDataSet::$current_blog
protected

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

ilBlogDataSet::$style_map = array()
static

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

Referenced by ilBlogImporter\finalProcessing().


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