ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.arDeleteGUI.php
Go to the documentation of this file.
1 <?php
2 require_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
3 
12 
16  protected $ids = NULL;
17 
18 
26  public function __construct(arGUI $a_parent_obj, $a_parent_cmd, ActiveRecordList $active_record_list, $custom_title = NULL, $ids = NULL) {
27  $this->setIds($ids);
28  parent::__construct($a_parent_obj, $a_parent_cmd, $active_record_list, $custom_title);
29  }
30 
31 
32  protected function initActions() {
33  }
34 
35 
36  protected function initFormAction() {
37  $this->setFormAction($this->ctrl->getFormAction($this->parent_obj));
38  }
39 
40 
41  protected function initRowSelector() {
42  $this->setShowRowsSelector(false);
43  $this->setLimit(9999);
44  }
45 
46 
50  function getSelectableColumns() {
51  return array();
52  }
53 
54 
55  protected function initCommandButtons() {
56  $this->addCommandButton("deleteItems", $this->txt("delete", false));
57  $this->addCommandButton("index", $this->txt("cancel", false));
58 
59  $id_nr = 0;
60  foreach ($this->getIds() as $id) {
61  $this->addHiddenInput("delete_id_" . $id_nr, $id);
62  $id_nr ++;
63  }
64  $this->addHiddenInput("nr_ids", $id_nr);
65  }
66 
67 
68  public function customizeFields() {
69  $field = $this->getFields()->getPrimaryField();
73  $field->setTxt($field->getName());
74  $field->setVisibleDefault(true);
75  $field->setHasFilter(false);
76  $field->setSortable(false);
77  $field->setPosition(0);
78  }
79 
80 
86  protected function beforeGetData() {
87 
88  $this->active_record_list->where($this->buildWhereQueryForIds($this->getIds()));
89  }
90 
91 
97  public function buildWhereQueryForIds($ids) {
98  $query = "";
99  foreach ($ids as $id) {
100  if ($query != "") {
101  $query .= " OR ";
102  }
103  $query .= $this->getFields()->getPrimaryField()->getName() . " = '" . $id . "'";
104  }
105 
106  return $query;
107  }
108 
109 
113  public function setIds($ids) {
114  $this->ids = $ids;
115  }
116 
117 
121  public function getIds() {
122  return $this->ids;
123  }
124 }