4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
23 $this->
setId(
"ilobjpollaw");
25 parent::__construct($a_parent_obj, $a_parent_cmd);
27 $this->
addColumn($lng->txt(
"poll_sortorder"),
"pos");
28 $this->
addColumn($lng->txt(
"poll_answer"),
"answer");
29 $this->
addColumn($lng->txt(
"poll_absolute"),
"votes");
30 $this->
addColumn($lng->txt(
"poll_percentage"),
"percentage");
34 $this->
setTitle($this->lng->txt(
"poll_question").
": \"".
35 $a_parent_obj->object->getQuestion().
"\"");
40 $this->
addCommandButton(
"confirmDeleteAllVotes", $lng->txt(
"poll_delete_votes"));
43 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
53 if($a_field !=
"answer")
62 $data = $this->parent_obj->object->getAnswers();
63 $perc = $this->parent_obj->object->getVotePercentages();
65 $perc = $perc[
"perc"];
68 foreach(
$data as $idx => $item)
70 if(!isset($perc[$item[
"id"]]))
72 $data[$idx][
"percentage"] = 0;
73 $data[$idx][
"votes"] = 0;
77 $data[$idx][
"percentage"] = round($perc[$item[
"id"]][
"perc"]);
78 $data[$idx][
"votes"] = $perc[$item[
"id"]][
"abs"];
89 $this->tpl->setVariable(
"VALUE_POS", $a_set[
"pos"]/10);
90 $this->tpl->setVariable(
"TXT_ANSWER", nl2br($a_set[
"answer"]));
91 $this->tpl->setVariable(
"VALUE_VOTES", $a_set[
"votes"]);
92 $this->tpl->setVariable(
"VALUE_PERCENTAGE", $a_set[
"percentage"]);
setDescription($a_val)
Set description.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
TableGUI class for poll answers.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
numericOrdering($a_field)
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="")
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action)
Set Form action parameter.