ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAdministrationCommandGUI.php
Go to the documentation of this file.
1<?php
2
3/*
4 +-----------------------------------------------------------------------------+
5 | ILIAS open source |
6 +-----------------------------------------------------------------------------+
7 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
8 | |
9 | This program is free software; you can redistribute it and/or |
10 | modify it under the terms of the GNU General Public License |
11 | as published by the Free Software Foundation; either version 2 |
12 | of the License, or (at your option) any later version. |
13 | |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU General Public License |
20 | along with this program; if not, write to the Free Software |
21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22 +-----------------------------------------------------------------------------+
23*/
24
35{
36 protected $ctrl = null;
37 protected $lng = null;
38 private $container = null;
39
43 public function __construct($a_container)
44 {
45 global $ilCtrl, $lng;
46
47 $this->container = $a_container;
48 $this->ctrl = $ilCtrl;
49 $this->lng = $lng;
50 }
51
55 public function getContainer()
56 {
57 return $this->container;
58 }
59
63 public function delete()
64 {
65 global $tpl,$ilSetting,$ilErr;
66
67 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
68
69 $to_delete = array ();
70 if ((int) $_GET['item_ref_id'])
71 {
72 $to_delete = array (
73 (int) $_GET['item_ref_id']
74 );
75 }
76
77 if (isset ($_POST['id']) and is_array($_POST['id']))
78 {
79 $to_delete = $_POST['id'];
80 }
81
82 if(!$to_delete)
83 {
84 $ilErr->raiseError($this->lng->txt('no_checkbox'),$ilErr->MESSAGE);
85 }
86
87 include_once ('./Services/Utilities/classes/class.ilConfirmationGUI.php');
88 $confirm = new ilConfirmationGUI();
89 $confirm->setFormAction($this->ctrl->getFormActionByClass(get_class($this->getContainer()), 'cancel'));
90 $confirm->setHeaderText('');
91 $confirm->setCancel($this->lng->txt('cancel'), 'cancelDelete');
92 $confirm->setConfirm($this->lng->txt('delete'), 'performDelete');
93
94 foreach ($to_delete as $delete)
95 {
96 $obj_id = ilObject :: _lookupObjId($delete);
97 $type = ilObject :: _lookupType($obj_id);
98
99 $confirm->addItem(
100 'id[]',
101 $delete,
102 call_user_func(array(ilObjectFactory::getClassByType($type),'_lookupTitle'),$obj_id),
103 ilUtil :: getTypeIconPath($type, $obj_id)
104 );
105 }
106
107 $msg = $this->lng->txt("info_delete_sure");
108
109 if(!$ilSetting->get('enable_trash'))
110 {
111 $msg .= "<br/>".$this->lng->txt("info_delete_warning_no_trash");
112 }
114
115 $tpl->setContent($confirm->getHTML());
116 }
117
121 public function performDelete()
122 {
123 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
124
125 include_once './Services/Object/classes/class.ilObjectGUI.php';
126 $_SESSION['saved_post'] = $_POST['id'];
127 $object = new ilObjectGUI(array (), 0, false, false);
128 $object->confirmedDeleteObject();
129 return true;
130 }
131
135 public function cut()
136 {
137 global $tree;
138
139 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
140
141 $_GET['ref_id'] = $tree->getParentId((int) $_GET['item_ref_id']);
142
143 include_once './Services/Container/classes/class.ilContainerGUI.php';
144 $container = new ilContainerGUI(array (), 0, false, false);
145 $container->cutObject();
146 return true;
147 }
148
153 public function showMoveIntoObjectTree()
154 {
155 global $objDefinition;
156
157 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
158
159 $obj_id = ilObject :: _lookupObjId((int) $_GET['ref_id']);
160 $type = ilObject :: _lookupType($obj_id);
161
162 $location = $objDefinition->getLocation($type);
163 $class_name = "ilObj" . $objDefinition->getClassName($type) . 'GUI';
164
165 // create instance
166 include_once ($location . "/class." . $class_name . ".php");
167 $container = new $class_name (array (), (int) $_GET['ref_id'], true, false);
168 $container->showMoveIntoObjectTreeObject();
169 return true;
170
171 }
172
178 {
179 global $objDefinition;
180
181 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
182
183 $obj_id = ilObject :: _lookupObjId((int) $_GET['ref_id']);
184 $type = ilObject :: _lookupType($obj_id);
185
186 $location = $objDefinition->getLocation($type);
187 $class_name = "ilObj" . $objDefinition->getClassName($type) . 'GUI';
188
189 // create instance
190 include_once ($location . "/class." . $class_name . ".php");
191 $container = new $class_name (array (), (int) $_GET['ref_id'], true, false);
192 $container->showLinkIntoMultipleObjectsTreeObject();
193 return true;
194 }
195
199 public function link()
200 {
201 global $tree;
202
203 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
204
205 $_GET['ref_id'] = $tree->getParentId((int) $_GET['item_ref_id']);
206
207 include_once './Services/Container/classes/class.ilContainerGUI.php';
208 $container = new ilContainerGUI(array (), 0, false, false);
209 $container->linkObject();
210 return true;
211 }
212
216 public function paste()
217 {
218 global $objDefinition;
219
220 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
221 $_GET['ref_id'] = (int) $_GET['item_ref_id'];
222
223 $obj_id = ilObject :: _lookupObjId((int) $_GET['item_ref_id']);
224 $type = ilObject :: _lookupType($obj_id);
225
226 $location = $objDefinition->getLocation($type);
227 $class_name = "ilObj" . $objDefinition->getClassName($type) . 'GUI';
228
229 // create instance
230 include_once ($location . "/class." . $class_name . ".php");
231 $container = new $class_name (array (), (int) $_GET['item_ref_id'], true, false);
232 $container->pasteObject();
233 return true;
234 }
235
237 {
238 global $objDefinition;
239
240 $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
241
242 $obj_id = ilObject :: _lookupObjId((int) $_GET['ref_id']);
243 $type = ilObject :: _lookupType($obj_id);
244
245 $location = $objDefinition->getLocation($type);
246 $class_name = "ilObj" . $objDefinition->getClassName($type) . 'GUI';
247
248 // create instance
249 include_once ($location . "/class." . $class_name . ".php");
250 $container = new $class_name (array (), (int) $_GET['ref_id'], true, false);
251 $container->performPasteIntoMultipleObjectsObject();
252 return true;
253 }
254}
255?>
global $tpl
Definition: ilias.php:8
$location
Definition: buildRTE.php:44
$_GET["client_id"]
$_SESSION["AccountId"]
Handles Administration commands (cut, delete paste)
Confirmation screen class.
Class ilContainerGUI.
static getClassByType($a_obj_type)
Get class by type.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40