ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilCloudPluginInitGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("class.ilCloudPluginGUI.php");
5
17{
18
22 protected $gui_class = null;
26 protected $perm_upload_items = false;
30 protected $perm_create_folders = false;
34 protected $perm_delete_files = false;
38 protected $perm_delete_folders = false;
42 protected $perm_download = false;
46 protected $perm_files_visible = false;
50 protected $perm_folders_visible = false;
51
52
56 public function setGuiClass($gui_class)
57 {
58 $this->gui_class = $gui_class;
59 }
60
61
65 public function getGuiClass()
66 {
67 return $this->gui_class;
68 }
69
70
75 {
76 $this->perm_create_folders = $perm_create_folders;
77 }
78
79
83 public function getPermCreateFolders()
84 {
86 }
87
88
93 {
94 $this->perm_delete_files = $perm_delete_files;
95 }
96
97
101 public function getPermDeleteFiles()
102 {
104 }
105
106
111 {
112 $this->perm_delete_folders = $perm_delete_folders;
113 }
114
115
119 public function getPermDeleteFolders()
120 {
122 }
123
124
129 {
130 $this->perm_download = $perm_download;
131 }
132
133
137 public function getPermDownload()
138 {
140 }
141
142
147 {
148 $this->perm_files_visible = $perm_files_visible;
149 }
150
151
155 public function getPermFilesVisible()
156 {
158 }
159
160
165 {
166 $this->perm_folders_visible = $perm_folders_visible;
167 }
168
169
173 public function getPermFoldersVisible()
174 {
176 }
177
178
183 {
184 $this->perm_upload_items = $perm_upload_items;
185 }
186
187
191 public function getPermUploadItems()
192 {
194 }
195
196
201 {
202 $this->tpl_file_tree = $tpl_file_tree;
203 }
204
205
209 public function getTplFileTree()
210 {
212 }
213
214
218 protected $tpl_file_tree = null;
219
220
232 {
233 global $DIC;
234 $ilTabs = $DIC['ilTabs'];
235 $lng = $DIC['lng'];
236 $tpl = $DIC['tpl'];
237
238 $ilTabs->activateTab("content");
239
240 $this->setGuiClass($gui_class);
242 $this->setPermCreateFolders($perm_create_folder);
248
249 try {
250 ilCloudConnector::checkServiceActive($this->getGUIClass()->object->getServiceName());
251 $this->beforeInitGUI();
252
253 //if($this->getPluginObject()->getAsyncDrawing())
254 {
255 $tpl->addJavaScript("./Modules/Cloud/js/ilCloudFileList.js");
256 $tpl->addJavaScript("./Modules/Cloud/js/jquery.address.js");
257 $tpl->addJavascript("./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js");
258 $tpl->addCss("./Modules/Cloud/templates/css/cloud.css");
259
260 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
262
263 $this->tpl_file_tree = new ilTemplate("tpl.cloud_file_tree.html", true, true, "Modules/Cloud");
264
265 $file_tree = new ilCloudFileTree(
266 $this->getGUIClass()->object->getRootFolder(),
267 $this->getGUIClass()->object->getRootId(),
268 $this->getGUIClass()->object->getId(),
269 $this->getGUIClass()->object->getServiceName()
270 );
271 $file_tree->storeFileTreeToSession();
272
273 $this->addToolbar($file_tree->getRootNode());
274
275 $this->tpl_file_tree->setVariable("ASYNC_GET_BLOCK", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilobjcloudgui", "asyncGetBlock", true)));
276 $this->tpl_file_tree->setVariable("ASYNC_CREATE_FOLDER", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilcloudplugincreatefoldergui", "asyncCreateFolder", true)));
277 $this->tpl_file_tree->setVariable("ASYNC_UPLOAD_FILE", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilcloudpluginuploadgui", "asyncUploadFile", true)));
278 $this->tpl_file_tree->setVariable("ASYNC_DELETE_ITEM", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilcloudplugindeletegui", "asyncDeleteItem", true)));
279 $this->tpl_file_tree->setVariable("ROOT_ID", json_encode($file_tree->getRootNode()->getId()));
280 $this->tpl_file_tree->setVariable("ROOT_PATH", json_encode($file_tree->getRootNode()->getPath()));
281 if (isset($_POST["path"])) {
282 $this->tpl_file_tree->setVariable("CURRENT_PATH", json_encode($_POST["path"]));
283 $file_tree->updateFileTree($_POST["path"]);
284 $node = $file_tree->getNodeFromPath($_POST["path"]);
285 $this->tpl_file_tree->setVariable("CURRENT_ID", json_encode($node->getId()));
286 } else {
287 $this->tpl_file_tree->setVariable("CURRENT_PATH", json_encode($file_tree->getRootNode()->getPath()));
288 $this->tpl_file_tree->setVariable("CURRENT_ID", json_encode($file_tree->getRootNode()->getID()));
289 }
290 $txt_max_file_size = $lng->txt("file_notice") . " "
291 . ilCloudConnector::getPluginClass($this->getGUIClass()->object->getServiceName(), $this->getGUIClass()->object->getId())
292 ->getMaxFileSize() . " MB";
293 $this->tpl_file_tree->setVariable("MAX_FILE_SIZE", json_encode($txt_max_file_size));
294 $this->beforeSetContent();
295 $tpl->setContent($this->tpl_file_tree->get());
296 $tpl->setPermanentLink("cld", $this->getGuiClass()->object->getRefId(), "_path__endPath");
297 }
298
323 $this->afterInitGUI();
324 } catch (Exception $e) {
326 $this->getGUIClass()->object->setAuthComplete(false);
327 $this->getGUIClass()->object->doUpdate();
328 }
329 ilUtil::sendFailure($e->getMessage());
330 }
331 }
332
333
337 public function addToolbar($root_node)
338 {
339 global $DIC;
340 $lng = $DIC['lng'];
341 $ilToolbar = $DIC['ilToolbar'];
342 $ilLog = $DIC['ilLog'];
343
345
346 $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders());
347 if ($list_gui_html) {
348 //toolbar
349 $toolbar_locator = new ilLocatorGUI();
350 $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node));
351 $ilToolbar->setId('xcld_toolbar');
352 $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>");
353 $ilToolbar->addSeparator();
354
355 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
356 $adv = new ilAdvancedSelectionListGUI();
357 $adv->setListTitle($lng->txt("cld_add_new_item"));
358
359 $ilCloudGroupedListGUI = $create_list_gui->getGroupedListItems($this->getPermUploadItems(), $this->getPermCreateFolders());
360
361 if ($ilCloudGroupedListGUI->hasItems()) {
362 $adv->setGroupedList($ilCloudGroupedListGUI);
363 }
364
366 $ilToolbar->addText($adv->getHTML());
367 }
368 }
369
370
371 public function beforeInitGUI()
372 {
373 }
374
375
376 public function beforeSetContent()
377 {
378 }
379
380
381 public function afterInitGUI()
382 {
383 }
384}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static checkServiceActive($name)
static getPluginClass($service_name, $obj_id)
static getItemCreationListGUIClass(ilCloudPluginService $plugin_service_class)
ilCloudFileTree class
static getLinkToFolder(ilCloudFileNode $node)
Class ilCloudPluginGUI.
Class ilCloudPluginInitGUI.
setPermFoldersVisible($perm_folders_visible)
initGUI(ilObjCloudGUI $gui_class, $perm_create_folder, $perm_upload_items, $perm_delete_files, $perm_delete_folders, $perm_download, $perm_files_visible, $perm_folders_visible)
setPermDeleteFiles($perm_delete_files)
setPermCreateFolders($perm_create_folders)
setPermUploadItems($perm_upload_items)
setPermFilesVisible($perm_files_visible)
setPermDeleteFolders($perm_delete_folders)
locator handling class
Class ilObjCloudGUI.
special template class to simplify handling of ITX/PEAR
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
global $DIC
Definition: goto.php:24
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$lng