ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCloudPluginCreateFolderGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/JSON/classes/class.ilJsonUtil.php");
5include_once("./Modules/Cloud/exceptions/class.ilCloudException.php");
6
20{
21 public function asyncCreateFolder()
22 {
23 global $DIC;
24 $tpl = $DIC['tpl'];
25 $response = new stdClass();
26 $response->success = null;
27 $response->error = null;
28 $response->message = null;
29
30 try {
31 $this->initCreateFolder();
32 $response->content = $this->form->getHTML();
33 $response->success = true;
34 } catch (Exception $e) {
35 $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
36 }
37 header('Content-type: application/json');
39 exit;
40 }
41
47 public function initCreateFolder()
48 {
49 global $DIC;
50 $ilCtrl = $DIC['ilCtrl'];
51 $lng = $DIC['lng'];
52
53 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
54 $this->form = new ilPropertyFormGUI();
55 $this->form->setId("cld_create_folder");
56
57 $name = new ilTextInputGUI($lng->txt("cld_folder_name"), "folder_name");
58 $name->setRequired(true);
59 $this->form->addItem($name);
60
61 // folder id
62 $id = new ilHiddenInputGUI("parent_folder_id");
63 $id->setValue($_POST["id"]);
64 $this->form->addItem($id);
65
66
67 $this->form->addCommandButton("createFolder", $lng->txt("cld_create_folder"));
68 $this->form->addCommandButton("cancel", $lng->txt("cancel"));
69
70 $this->form->setTitle($lng->txt("cld_create_folder"));
71 $this->form->setFormAction($ilCtrl->getFormAction($this));
72 $this->form->setTarget("cld_blank_target");
73 }
74
78 public function createFolder()
79 {
80 global $DIC;
81 $tpl = $DIC['tpl'];
82 $lng = $DIC['lng'];
83
84 $response = new stdClass();
85 $response->success = null;
86 $response->message = null;
87 $response->folder_id = null;
88 try {
89 $response->status = "done";
90 include_once("class.ilCloudFileTree.php");
92 $new_node = $file_tree->addFolderToService($_POST["parent_folder_id"], $_POST["folder_name"]);
93 $response->folder_id = $new_node->getId();
94 $response->folder_path = $new_node->getPath();
95 $response->success = true;
96 $response->message = $tpl->getMessageHTML($lng->txt("cld_folder_created"), "success");
97 } catch (Exception $e) {
98 $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
99 }
100 echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterCreateFolder(" . ilJsonUtil::encode($response) . ");</script>";
101 exit;
102 }
103
107 public function cancel()
108 {
109 $response = new stdClass();
110 $response->status = "cancel";
111
112 echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterCreateFolder(" . ilJsonUtil::encode($response) . ");</script>";
113 exit;
114 }
115}
$tpl
Definition: ilias.php:10
exit
Definition: backend.php:16
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Class ilCloudPluginCreateFolderGUI.
Class ilCloudPluginGUI.
This class represents a hidden form property in a property form.
static encode($mixed, $suppress_native=false)
This class represents a property form user interface.
This class represents a text property in a property form.
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
$response
global $DIC
Definition: saml.php:7
$lng