ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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($this->getGUIClass()->object->getRootFolder(), $this->getGUIClass()->object->getRootId(), $this->getGUIClass()->object->getId(), $this->getGUIClass()->object->getServiceName());
266 $file_tree->storeFileTreeToSession();
267
268 $this->addToolbar($file_tree->getRootNode());
269
270 $this->tpl_file_tree->setVariable("ASYNC_GET_BLOCK", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilobjcloudgui", "asyncGetBlock", true)));
271 $this->tpl_file_tree->setVariable("ASYNC_CREATE_FOLDER", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilcloudplugincreatefoldergui", "asyncCreateFolder", true)));
272 $this->tpl_file_tree->setVariable("ASYNC_UPLOAD_FILE", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilcloudpluginuploadgui", "asyncUploadFile", true)));
273 $this->tpl_file_tree->setVariable("ASYNC_DELETE_ITEM", json_encode($this->getGUIClass()->getCtrl()->getLinkTargetByClass("ilcloudplugindeletegui", "asyncDeleteItem", true)));
274 $this->tpl_file_tree->setVariable("ROOT_ID", json_encode($file_tree->getRootNode()->getId()));
275 $this->tpl_file_tree->setVariable("ROOT_PATH", json_encode($file_tree->getRootNode()->getPath()));
276 if (isset($_POST["path"])) {
277 $this->tpl_file_tree->setVariable("CURRENT_PATH", json_encode($_POST["path"]));
278 $file_tree->updateFileTree($_POST["path"]);
279 $node = $file_tree->getNodeFromPath($_POST["path"]);
280 $this->tpl_file_tree->setVariable("CURRENT_ID", json_encode($node->getId()));
281 } else {
282 $this->tpl_file_tree->setVariable("CURRENT_PATH", json_encode($file_tree->getRootNode()->getPath()));
283 $this->tpl_file_tree->setVariable("CURRENT_ID", json_encode($file_tree->getRootNode()->getID()));
284 }
285 $txt_max_file_size = $lng->txt("file_notice") . " "
286 . ilCloudConnector::getPluginClass($this->getGUIClass()->object->getServiceName(), $this->getGUIClass()->object->getId())
287 ->getMaxFileSize() . " MB";
288 $this->tpl_file_tree->setVariable("MAX_FILE_SIZE", json_encode($txt_max_file_size));
289 $this->beforeSetContent();
290 $tpl->setContent($this->tpl_file_tree->get());
291 $tpl->setPermanentLink("cld", $this->getGuiClass()->object->getRefId(), "_path__endPath");
292 }
293
318 $this->afterInitGUI();
319 } catch (Exception $e) {
320 if ($e->getCode() == ilCloudException::AUTHENTICATION_FAILED) {
321 $this->getGUIClass()->object->setAuthComplete(false);
322 $this->getGUIClass()->object->doUpdate();
323 }
324 ilUtil::sendFailure($e->getMessage());
325 }
326 }
327
328
332 public function addToolbar($root_node)
333 {
334 global $DIC;
335 $lng = $DIC['lng'];
336 $ilToolbar = $DIC['ilToolbar'];
337 $ilLog = $DIC['ilLog'];
338
340
341 $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders());
342 if ($list_gui_html) {
343 //toolbar
344 $toolbar_locator = new ilLocatorGUI();
345 $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node));
346 $ilToolbar->setId('xcld_toolbar');
347 $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>");
348 $ilToolbar->addSeparator();
349
350 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
351 $adv = new ilAdvancedSelectionListGUI();
352 $adv->setListTitle($lng->txt("cld_add_new_item"));
353
354 $ilCloudGroupedListGUI = $create_list_gui->getGroupedListItems($this->getPermUploadItems(), $this->getPermCreateFolders());
355
356 if ($ilCloudGroupedListGUI->hasItems()) {
357 $adv->setGroupedList($ilCloudGroupedListGUI);
358 }
359
361 $ilToolbar->addText($adv->getHTML());
362 }
363 }
364
365
366 public function beforeInitGUI()
367 {
368 }
369
370
371 public function beforeSetContent()
372 {
373 }
374
375
376 public function afterInitGUI()
377 {
378 }
379}
$tpl
Definition: ilias.php:10
$_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(ilTemplate $a_main_tpl=null)
Init YUI Connection module.
global $DIC
Definition: saml.php:7
$lng