ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilEditClipboardGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
6
19{
25 {
26 global $lng, $ilCtrl;
27
28 $this->multiple = false;
29 $this->page_back_title = $lng->txt("cont_back");
30 if ($_GET["returnCommand"] != "")
31 {
32 $this->mode = "getObject";
33 }
34 else
35 {
36 $this->mode = "";
37 }
38
39 $ilCtrl->setParameter($this, "returnCommand",
40 rawurlencode($_GET["returnCommand"]));
41
42 $ilCtrl->saveParameter($this, array("clip_item_id"));
43 }
44
50 function _forwards()
51 {
52 return array("ilObjMediaObjectGUI");
53 }
54
58 function &executeCommand()
59 {
60 global $ilUser, $ilCtrl, $ilTabs, $lng;
61
62 $next_class = $ilCtrl->getNextClass($this);
63 $cmd = $ilCtrl->getCmd();
64
65 switch($next_class)
66 {
67 case "ilobjmediaobjectgui":
68 $ilCtrl->setReturn($this, "view");
69 $ilTabs->clearTargets();
70 $ilTabs->setBackTarget($lng->txt("back"),
71 $ilCtrl->getLinkTarget($this, "view"));
72 $mob_gui =& new ilObjMediaObjectGUI("", $_GET["clip_item_id"],false, false);
73 $mob_gui->setTabs();
74 $ret =& $ilCtrl->forwardCommand($mob_gui);
75 switch($cmd)
76 {
77 case "save":
78 $ilUser->addObjectToClipboard($ret->getId(), "mob", $ret->getTitle());
79 $ilCtrl->redirect($this, "view");
80 break;
81 }
82 break;
83
84 default:
85 $ret =& $this->$cmd();
86 break;
87 }
88
89 return $ret;
90 }
91
95 function setMultipleSelections($a_multiple = true)
96 {
97 $this->multiple = $a_multiple;
98 }
99
104 {
105 return $this->multiple;
106 }
107
113 function setInsertButtonTitle($a_insertbuttontitle)
114 {
115 $this->insertbuttontitle = $a_insertbuttontitle;
116 }
117
124 {
125 global $lng;
126
127 if ($this->insertbuttontitle == "")
128 {
129 return $lng->txt("insert");
130 }
131
132 return $this->insertbuttontitle;
133 }
134
135 /*
136 * display clipboard content
137 */
138 function view()
139 {
140 global $tree, $ilUser, $ilCtrl, $lng, $tpl, $ilToolbar;
141
142 include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
144 $but->setUrl($ilCtrl->getLinkTargetByClass("ilobjmediaobjectgui", "create"));
145 $but->setCaption("cont_create_mob");
146 $ilToolbar->addButtonInstance($but);
147
148 include_once("./Services/Clipboard/classes/class.ilClipboardTableGUI.php");
149 $table_gui = new ilClipboardTableGUI($this, "view");
150 $tpl->setContent($table_gui->getHTML());
151 }
152
153
157 function getObject()
158 {
159 $this->mode = "getObject";
160 $this->view();
161 }
162
163
167 function remove()
168 {
169 global $ilias, $ilUser, $lng, $ilCtrl;
170
171 // check number of objects
172 if (!isset($_POST["id"]))
173 {
174 $ilias->raiseError($lng->txt("no_checkbox"),$ilias->error_obj->MESSAGE);
175 }
176
177 foreach($_POST["id"] AS $obj_id)
178 {
179 $id = explode(":", $obj_id);
180 if ($id[0] == "mob")
181 {
182 $ilUser->removeObjectFromClipboard($id[1], "mob");
183 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
184 $mob = new ilObjMediaObject($id[1]);
185 $mob->delete(); // this method don't delete, if mob is used elsewhere
186 }
187 if ($id[0] == "incl")
188 {
189 $ilUser->removeObjectFromClipboard($id[1], "incl");
190 }
191 }
192 $ilCtrl->redirect($this, "view");
193 }
194
198 function insert()
199 {
200 global $ilias, $lng;
201
202 // check number of objects
203 if (!isset($_POST["id"]))
204 {
205 $ilias->raiseError($lng->txt("no_checkbox"),$ilias->error_obj->MESSAGE);
206 }
207
208 if (!$this->getMultipleSelections())
209 {
210 if(count($_POST["id"]) > 1)
211 {
212 $ilias->raiseError($lng->txt("cont_select_max_one_item"),$ilias->error_obj->MESSAGE);
213 }
214 }
215
216 $_SESSION["ilEditClipboard_mob_id"] = $_POST["id"];
217 ilUtil::redirect($_GET["returnCommand"]);
218 }
219
221 {
222 return $_SESSION["ilEditClipboard_mob_id"];
223 }
224
228 function setTabs()
229 {
230 global $ilTabs, $lng, $tpl;
231
232 $tpl->setTitle($lng->txt("clipboard"));
233 $this->getTabs($ilTabs);
234 }
235
239 function setPageBackTitle($a_title)
240 {
241 $this->page_back_title = $a_title;
242 }
243
249 function getTabs(&$tabs_gui)
250 {
251 global $ilCtrl;
252
253 // back to upper context
254 $tabs_gui->setBackTarget($this->page_back_title,
255 $ilCtrl->getParentReturn($this));
256 }
257
258}
259?>
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
$_SESSION["AccountId"]
TableGUI clipboard items.
Class ilEditClipboardGUI.
getTabs(&$tabs_gui)
adds tabs to tab gui object
_forwards()
get all gui classes that are called from this one (see class ilCtrl)
& executeCommand()
execute command
setInsertButtonTitle($a_insertbuttontitle)
Set Insert Button Title.
ilEditClipboardGUI()
Constructor @access public.
getMultipleSelections()
check wether multiple selections are enabled
getInsertButtonTitle()
Get Insert Button Title.
setMultipleSelections($a_multiple=true)
set, if multiple selections are enabled
setPageBackTitle($a_title)
Set title for back link.
static getInstance()
Factory.
Class ilObjMediaObjectGUI.
Class ilObjMediaObject.
static redirect($a_script)
http redirect to other script
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15