ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPollDataSet Class Reference

Poll Dataset class. More...

+ Inheritance diagram for ilPollDataSet:
+ Collaboration diagram for ilPollDataSet:

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.

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

Poll Dataset class.

This class implements the following entities:

  • poll: object data
  • poll_answer: data from table il_poll_answer
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.ilPollDataSet.php.

Member Function Documentation

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

Determine the dependent sets of data.

Definition at line 120 of file class.ilPollDataSet.php.

{
switch ($a_entity)
{
case "poll":
return array (
"poll_answer" => array("ids" => $a_rec["Id"])
);
}
return false;
}
ilPollDataSet::getSupportedVersions ( )

Get supported versions.

Reimplemented from ilDataSet.

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

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

Get field types for entity.

Reimplemented from ilDataSet.

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

{
if ($a_entity == "poll")
{
switch ($a_version)
{
case "4.3.0":
return array(
"Id" => "integer",
"Title" => "text",
"Description" => "text",
"Question" => "text",
"Image" => "text",
"ViewResults" => "integer",
"Dir" => "directory"
);
}
}
if ($a_entity == "poll_answer")
{
switch ($a_version)
{
case "4.3.0":
return array(
"Id" => "integer",
"PollId" => "integer",
"Answer" => "text",
"Pos" => "integer",
);
}
}
}
ilPollDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Reimplemented from ilDataSet.

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

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

Get xml record.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 138 of file class.ilPollDataSet.php.

References ilObjPoll\initStorage().

{
if ($a_entity == "poll")
{
include_once("./Modules/Poll/classes/class.ilObjPoll.php");
$dir = ilObjPoll::initStorage($a_set["Id"]);
$a_set["Dir"] = $dir;
}
return $a_set;
}

+ Here is the call graph for this function:

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

Import record.

Parameters
@return

Definition at line 156 of file class.ilPollDataSet.php.

References ilDataSet\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), ilObjPoll\initStorage(), and ilUtil\rCopy().

{
switch ($a_entity)
{
case "poll":
include_once("./Modules/Poll/classes/class.ilObjPoll.php");
// #13605
if($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"]))
{
$newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
}
else
{
$newObj = new ilObjPoll();
$newObj->create();
}
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->setQuestion($a_rec["Question"]);
$newObj->setImage($a_rec["Image"]);
$newObj->setViewResults($a_rec["ViewResults"]);
$newObj->update();
// handle image(s)
if($a_rec["Image"])
{
$dir = str_replace("..", "", $a_rec["Dir"]);
if ($dir != "" && $this->getImportDirectory() != "")
{
$source_dir = $this->getImportDirectory()."/".$dir;
$target_dir = ilObjPoll::initStorage($newObj->getId());
ilUtil::rCopy($source_dir, $target_dir);
}
}
$a_mapping->addMapping("Modules/Poll", "poll", $a_rec["Id"], $newObj->getId());
break;
case "poll_answer":
$poll_id = (int) $a_mapping->getMapping("Modules/Poll", "poll", $a_rec["PollId"]);
if($poll_id)
{
$poll = new ilObjPoll($poll_id, false);
$poll->saveAnswer($a_rec["Answer"], $a_rec["pos"]);
}
break;
}
}

+ Here is the call graph for this function:

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

Read data.

Parameters
@return

Definition at line 80 of file class.ilPollDataSet.php.

References ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
if ($a_entity == "poll")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT pl.id,od.title,od.description,".
"pl.question,pl.image,pl.view_results".
" FROM il_poll pl".
" JOIN object_data od ON (od.obj_id = pl.id)".
" WHERE ".$ilDB->in("pl.id", $a_ids, false, "integer").
" AND od.type = ".$ilDB->quote("poll", "text"));
break;
}
}
if ($a_entity == "poll_answer")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT id,poll_id,answer,pos".
" FROM il_poll_answer WHERE ".
$ilDB->in("poll_id", $a_ids, false, "integer"));
break;
}
}
}

+ Here is the call graph for this function:

Field Documentation

ilPollDataSet::$current_blog
protected

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


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