4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
23 $this->ctrl = $DIC->ctrl();
24 $this->lng = $DIC->language();
26 $lng = $DIC->language();
28 $this->
setId(
"ilobjpollaw");
30 parent::__construct($a_parent_obj, $a_parent_cmd);
39 $this->
setTitle($this->lng->txt(
"poll_question") .
": \"" .
40 $a_parent_obj->object->getQuestion() .
"\"");
57 if ($a_field !=
"answer") {
65 $data = $this->parent_obj->object->getAnswers();
66 $perc = $this->parent_obj->object->getVotePercentages();
68 $perc = $perc[
"perc"];
71 foreach (
$data as $idx => $item) {
72 if (!isset($perc[$item[
"id"]])) {
73 $data[$idx][
"percentage"] = 0;
74 $data[$idx][
"votes"] = 0;
76 $data[$idx][
"percentage"] = round($perc[$item[
"id"]][
"perc"]);
77 $data[$idx][
"votes"] = $perc[$item[
"id"]][
"abs"];
88 $this->tpl->setVariable(
"VALUE_POS", $a_set[
"pos"] / 10);
89 $this->tpl->setVariable(
"TXT_ANSWER", nl2br($a_set[
"answer"]));
90 $this->tpl->setVariable(
"VALUE_VOTES", $a_set[
"votes"]);
91 $this->tpl->setVariable(
"VALUE_PERCENTAGE", $a_set[
"percentage"]);
96 $a_csv->addColumn($a_set[
"pos"] / 10);
97 $a_csv->addColumn($a_set[
"answer"]);
98 $a_csv->addColumn($a_set[
"votes"]);
99 $a_csv->addColumn($a_set[
"percentage"]);
105 $a_excel->
setCell($a_row, 0, $a_set[
"pos"] / 10);
106 $a_excel->
setCell($a_row, 1, $a_set[
"answer"]);
107 $a_excel->
setCell($a_row, 2, $a_set[
"votes"]);
108 $a_excel->
setCell($a_row, 3, $a_set[
"percentage"] .
"%");
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setDescription($a_val)
Set description.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
__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.
fillRowCSV($a_csv, $a_set)
numericOrdering($a_field)
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.