ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSurveyPhrasesTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
10{
11 protected $confirmdelete;
12
20 public function __construct($a_parent_obj, $a_parent_cmd, $confirmdelete = false)
21 {
22 global $DIC;
23
24 parent::__construct($a_parent_obj, $a_parent_cmd);
25
26 $lng = $DIC->language();
27 $ilCtrl = $DIC->ctrl();
28
29 $this->lng = $lng;
30 $this->ctrl = $ilCtrl;
31 $this->confirmdelete = $confirmdelete;
32
33 $this->setFormName('phrases');
34 $this->setStyle('table', 'fullwidth');
35 if (!$confirmdelete) {
36 $this->addColumn('', 'f', '1%');
37 }
38 $this->addColumn($this->lng->txt("phrase"), 'phrase', '');
39 $this->addColumn($this->lng->txt("answers"), 'answers', '');
40
41 if ($confirmdelete) {
42 $this->addCommandButton('confirmDeletePhrase', $this->lng->txt('confirm'));
43 $this->addCommandButton('cancelDeletePhrase', $this->lng->txt('cancel'));
44 } else {
45 $this->addMultiCommand('editPhrase', $this->lng->txt('edit'));
46 $this->addMultiCommand('deletePhrase', $this->lng->txt('delete'));
47 }
48
49 $this->setRowTemplate("tpl.il_svy_qpl_phrase_row.html", "Modules/SurveyQuestionPool");
50
51 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
52 $this->setDefaultOrderField("phrase");
53 $this->setDefaultOrderDirection("asc");
54
55 if ($confirmdelete) {
56 $this->disable('sort');
57 $this->disable('select_all');
58 } else {
59 $this->setPrefix('phrase');
60 $this->setSelectAllCheckbox('phrase');
61 $this->enable('sort');
62 $this->enable('select_all');
63 }
64 $this->enable('header');
65 }
66
74 public function fillRow($data)
75 {
76 if (!$this->confirmdelete) {
77 $this->tpl->setCurrentBlock('checkbox');
78 $this->tpl->setVariable('CB_PHRASE_ID', $data["phrase_id"]);
79 $this->tpl->parseCurrentBlock();
80 } else {
81 $this->tpl->setCurrentBlock('hidden');
82 $this->tpl->setVariable('HIDDEN_PHRASE_ID', $data["phrase_id"]);
83 $this->tpl->parseCurrentBlock();
84 }
85 $this->tpl->setVariable('PHRASE_ID', $data["phrase_id"]);
86 $this->tpl->setVariable("PHRASE", $data["phrase"]);
87 $this->tpl->setVariable("ANSWERS", $data["answers"]);
88 }
89}
An exception for terminatinating execution or to throw for unit testing.
__construct($a_parent_obj, $a_parent_cmd, $confirmdelete=false)
Constructor.
Class ilTable2GUI.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
disable($a_module_name)
diesables particular modules of table
setStyle($a_element, $a_style)
enable($a_module_name)
enables particular modules of table
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc