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")
50 "Description" =>
"text",
53 "ViewResults" =>
"integer",
61 "Description" =>
"text",
64 "ViewResults" =>
"integer",
66 "ShowResultsAs" =>
"integer",
67 "ShowComments" =>
"integer",
68 "MaxAnswers" =>
"integer",
69 "ResultSort" =>
"integer",
70 "NonAnon" =>
"integer",
71 "Period" =>
"integer",
72 "PeriodBegin" =>
"integer",
73 "PeriodEnd" =>
"integer"
80 if ($a_entity ==
"poll_answer")
88 "PollId" =>
"integer",
103 function readData($a_entity, $a_version, $a_ids, $a_field =
"")
107 if (!is_array($a_ids))
109 $a_ids = array($a_ids);
112 if ($a_entity ==
"poll")
118 "pl.question,pl.image,pl.view_results".
120 " JOIN object_data od ON (od.obj_id = pl.id)".
121 " WHERE ".$ilDB->in(
"pl.id", $a_ids,
false,
"integer").
122 " AND od.type = ".$ilDB->quote(
"poll",
"text"));
126 ",pl.question,pl.image,pl.view_results,pl.show_results_as".
127 ",pl.max_answers,pl.result_sort,pl.non_anon,pl.period,pl.period_begin,pl.period_end".
129 " JOIN object_data od ON (od.obj_id = pl.id)".
130 " WHERE " . $ilDB->in(
"pl.id", $a_ids,
false,
"integer").
131 " AND od.type = " . $ilDB->quote(
"poll",
"text"));
137 if ($a_entity ==
"poll_answer")
144 " FROM il_poll_answer WHERE ".
145 $ilDB->in(
"poll_id", $a_ids,
false,
"integer"));
160 "poll_answer" => array(
"ids" => $a_rec[
"Id"])
174 if ($a_entity ==
"poll")
176 include_once(
"./Modules/Poll/classes/class.ilObjPoll.php");
178 $a_set[
"Dir"] = $dir;
180 include_once(
"./Services/Notes/classes/class.ilNote.php");
193 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
198 include_once(
"./Modules/Poll/classes/class.ilObjPoll.php");
201 if($new_id = $a_mapping->getMapping(
"Services/Container",
"objs", $a_rec[
"Id"]))
211 $newObj->setTitle($a_rec[
"Title"]);
212 $newObj->setDescription($a_rec[
"Description"]);
213 if((
int)$a_rec[
"MaxAnswers"])
215 $newObj->setMaxNumberOfAnswers($a_rec[
"MaxAnswers"]);
217 $newObj->setSortResultByVotes((
bool)$a_rec[
"ResultSort"]);
218 $newObj->setNonAnonymous((
bool)$a_rec[
"NonAnon"]);
219 if((
int)$a_rec[
"ShowResultsAs"])
221 $newObj->setShowResultsAs($a_rec[
"ShowResultsAs"]);
223 $newObj->setShowComments($a_rec[
"ShowComments"]);
224 $newObj->setQuestion($a_rec[
"Question"]);
225 $newObj->setImage($a_rec[
"Image"]);
226 $newObj->setViewResults($a_rec[
"ViewResults"]);
227 $newObj->setVotingPeriod($a_rec[
"Period"]);
228 $newObj->setVotingPeriodBegin($a_rec[
"PeriodBegin"]);
229 $newObj->setVotingPeriodEnd($a_rec[
"PeriodEnd"]);
235 $dir = str_replace(
"..",
"", $a_rec[
"Dir"]);
244 $a_mapping->addMapping(
"Modules/Poll",
"poll", $a_rec[
"Id"], $newObj->getId());
248 $poll_id = (int) $a_mapping->getMapping(
"Modules/Poll",
"poll", $a_rec[
"PollId"]);
252 $poll->saveAnswer($a_rec[
"Answer"], $a_rec[
"pos"]);