ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.arDeleteGUI.php
Go to the documentation of this file.
1<?php
2require_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
3
12{
13
17 protected $ids = null;
18
19
27 public function __construct(arGUI $a_parent_obj, $a_parent_cmd, ActiveRecordList $active_record_list, $custom_title = null, $ids = null)
28 {
29 $this->setIds($ids);
30 parent::__construct($a_parent_obj, $a_parent_cmd, $active_record_list, $custom_title);
31 }
32
33
34 protected function initActions()
35 {
36 }
37
38
39 protected function initFormAction()
40 {
41 $this->setFormAction($this->ctrl->getFormAction($this->parent_obj));
42 }
43
44
45 protected function initRowSelector()
46 {
47 $this->setShowRowsSelector(false);
48 $this->setLimit(9999);
49 }
50
51
55 public function getSelectableColumns()
56 {
57 return array();
58 }
59
60
61 protected function initCommandButtons()
62 {
63 $this->addCommandButton("deleteItems", $this->txt("delete", false));
64 $this->addCommandButton("index", $this->txt("cancel", false));
65
66 $id_nr = 0;
67 foreach ($this->getIds() as $id) {
68 $this->addHiddenInput("delete_id_" . $id_nr, $id);
69 $id_nr++;
70 }
71 $this->addHiddenInput("nr_ids", $id_nr);
72 }
73
74
75 public function customizeFields()
76 {
77 $field = $this->getFields()->getPrimaryField();
81 $field->setTxt($field->getName());
82 $field->setVisibleDefault(true);
83 $field->setHasFilter(false);
84 $field->setSortable(false);
85 $field->setPosition(0);
86 }
87
88
94 protected function beforeGetData()
95 {
96 $this->active_record_list->where($this->buildWhereQueryForIds($this->getIds()));
97 }
98
99
106 {
107 $query = "";
108 foreach ($ids as $id) {
109 if ($query != "") {
110 $query .= " OR ";
111 }
112 $query .= $this->getFields()->getPrimaryField()->getName() . " = '" . $id . "'";
113 }
114
115 return $query;
116 }
117
118
122 public function setIds($ids)
123 {
124 $this->ids = $ids;
125 }
126
127
131 public function getIds()
132 {
133 return $this->ids;
134 }
135}
Class ActiveRecordList.
An exception for terminatinating execution or to throw for unit testing.
GUI-Class arDeleteGUI.
buildWhereQueryForIds($ids)
__construct(arGUI $a_parent_obj, $a_parent_cmd, ActiveRecordList $active_record_list, $custom_title=null, $ids=null)
GUI-Class arIndexTableGUI.
customizeFields()
@description To be overridden
txt($txt, $plugin_txt=true)
addHiddenInput($a_name, $a_value)
Add Hidden Input field.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
if(!array_key_exists('StateId', $_REQUEST)) $id
$query