4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
26 return array(
"4.3.0",
"5.0.0");
34 return "http://www.ilias.de/xml/Modules/Poll/" . $a_entity;
40 protected function getTypes($a_entity, $a_version)
42 if ($a_entity ==
"poll") {
48 "Description" =>
"text",
51 "ViewResults" =>
"integer",
59 "Description" =>
"text",
62 "ViewResults" =>
"integer",
64 "ShowResultsAs" =>
"integer",
65 "ShowComments" =>
"integer",
66 "MaxAnswers" =>
"integer",
67 "ResultSort" =>
"integer",
68 "NonAnon" =>
"integer",
69 "Period" =>
"integer",
70 "PeriodBegin" =>
"integer",
71 "PeriodEnd" =>
"integer" 78 if ($a_entity ==
"poll_answer") {
84 "PollId" =>
"integer",
99 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
103 if (!is_array($a_ids)) {
104 $a_ids =
array($a_ids);
107 if ($a_entity ==
"poll") {
108 switch ($a_version) {
111 "pl.question,pl.image,pl.view_results" .
113 " JOIN object_data od ON (od.obj_id = pl.id)" .
114 " WHERE " .
$ilDB->in(
"pl.id", $a_ids,
false,
"integer") .
115 " AND od.type = " .
$ilDB->quote(
"poll",
"text"));
119 ",pl.question,pl.image,pl.view_results,pl.show_results_as" .
120 ",pl.max_answers,pl.result_sort,pl.non_anon,pl.period,pl.period_begin,pl.period_end" .
122 " JOIN object_data od ON (od.obj_id = pl.id)" .
123 " WHERE " .
$ilDB->in(
"pl.id", $a_ids,
false,
"integer") .
124 " AND od.type = " .
$ilDB->quote(
"poll",
"text"));
130 if ($a_entity ==
"poll_answer") {
131 switch ($a_version) {
135 " FROM il_poll_answer WHERE " .
136 $ilDB->in(
"poll_id", $a_ids,
false,
"integer"));
150 "poll_answer" =>
array(
"ids" => $a_rec[
"Id"])
164 if ($a_entity ==
"poll") {
165 include_once(
"./Modules/Poll/classes/class.ilObjPoll.php");
167 $a_set[
"Dir"] = $dir;
169 include_once(
"./Services/Notes/classes/class.ilNote.php");
182 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
186 include_once(
"./Modules/Poll/classes/class.ilObjPoll.php");
189 if ($new_id = $a_mapping->getMapping(
"Services/Container",
"objs", $a_rec[
"Id"])) {
196 $newObj->setTitle($a_rec[
"Title"]);
197 $newObj->setDescription($a_rec[
"Description"]);
198 if ((
int) $a_rec[
"MaxAnswers"]) {
199 $newObj->setMaxNumberOfAnswers($a_rec[
"MaxAnswers"]);
201 $newObj->setSortResultByVotes((
bool) $a_rec[
"ResultSort"]);
202 $newObj->setNonAnonymous((
bool) $a_rec[
"NonAnon"]);
203 if ((
int) $a_rec[
"ShowResultsAs"]) {
204 $newObj->setShowResultsAs($a_rec[
"ShowResultsAs"]);
206 $newObj->setShowComments($a_rec[
"ShowComments"]);
207 $newObj->setQuestion($a_rec[
"Question"]);
208 $newObj->setImage($a_rec[
"Image"]);
209 $newObj->setViewResults($a_rec[
"ViewResults"]);
210 $newObj->setVotingPeriod($a_rec[
"Period"]);
211 $newObj->setVotingPeriodBegin($a_rec[
"PeriodBegin"]);
212 $newObj->setVotingPeriodEnd($a_rec[
"PeriodEnd"]);
216 if ($a_rec[
"Image"]) {
217 $dir = str_replace(
"..",
"", $a_rec[
"Dir"]);
225 $a_mapping->addMapping(
"Modules/Poll",
"poll", $a_rec[
"Id"], $newObj->getId());
229 $poll_id = (int) $a_mapping->getMapping(
"Modules/Poll",
"poll", $a_rec[
"PollId"]);
232 $poll->saveAnswer($a_rec[
"Answer"], $a_rec[
"pos"]);
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 ...
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getXmlRecord($a_entity, $a_version, $a_set)
Get xml record.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getSupportedVersions()
Get supported versions.
getImportDirectory()
Get import directory.
getTypes($a_entity, $a_version)
Get field types for entity.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.