ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
19{
20 public function asyncCreateFolder()
21 {
22 global $DIC;
23 $tpl = $DIC['tpl'];
24 $response = new stdClass();
25 $response->success = null;
26 $response->error = null;
27 $response->message = null;
28
29 try {
30 $this->initCreateFolder();
31 $response->content = $this->form->getHTML();
32 $response->success = true;
33 } catch (Exception $e) {
34 $response->message = ilUtil::getSystemMessageHTML($e->getMessage(), "failure");
35 }
36 header('Content-type: application/json');
38 exit;
39 }
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 $this->form->addCommandButton("createFolder", $lng->txt("cld_create_folder"));
67 $this->form->addCommandButton("cancel", $lng->txt("cancel"));
68
69 $this->form->setTitle($lng->txt("cld_create_folder"));
70 $this->form->setFormAction($ilCtrl->getFormAction($this));
71 $this->form->setTarget("cld_blank_target");
72 }
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 = ilUtil::getSystemMessageHTML($lng->txt("cld_folder_created"), "success");
97 } catch (Exception $e) {
98 $response->message = ilUtil::getSystemMessageHTML($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
104
108 public function cancel()
109 {
110 $response = new stdClass();
111 $response->status = "cancel";
112
113 echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterCreateFolder(" . ilJsonUtil::encode($response) . ");</script>";
114 exit;
115 }
116}
$_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.
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:29
if($format !==null) $name
Definition: metadata.php:230
$response
$lng
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$DIC
Definition: xapitoken.php:46