ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCloudPluginDeleteGUI Class Reference

Class ilCloudPluginDeleteGUI. More...

+ Inheritance diagram for ilCloudPluginDeleteGUI:
+ Collaboration diagram for ilCloudPluginDeleteGUI:

Public Member Functions

 asyncDeleteItem ()
 is called async and prints the content from the confirmation gui More...
 
 initDeleteItem ()
 
 deleteItem ()
 Update properties. More...
 
 cancel ()
 Update properties. More...
 
- Public Member Functions inherited from ilCloudPluginGUI
 __construct ($plugin_service_class)
 
 getPluginObject ()
 
 getPluginHookObject ()
 
 getAdminConfigObject ()
 
 getService ()
 
 txt ($var="")
 
 executeCommand ()
 

Protected Attributes

 $path = "/"
 
 $id = 0
 
 $is_dir
 
 $gui
 
- Protected Attributes inherited from ilCloudPluginGUI
 $service = null
 

Detailed Description

Class ilCloudPluginDeleteGUI.

Standard GUI when deleting files or folders. Could be overwritten by the plugin if needed.

Author
Timon Amstutz timon.nosp@m..ams.nosp@m.tutz@.nosp@m.ilub.nosp@m..unib.nosp@m.e.ch
Version
$Id:

Definition at line 17 of file class.ilCloudPluginDeleteGUI.php.

Member Function Documentation

◆ asyncDeleteItem()

ilCloudPluginDeleteGUI::asyncDeleteItem ( )

is called async and prints the content from the confirmation gui

Definition at line 40 of file class.ilCloudPluginDeleteGUI.php.

40 {
41 global $DIC;
42 $tpl = $DIC['tpl'];
43 $lng = $DIC['lng'];
44 $response = new stdClass();
45 $response->success = null;
46 $response->message = null;
47 $response->content = null;
49 try {
50 $node = $file_tree->getNodeFromId($_POST["id"]);
51 if (!$node) {
53 } else {
54 $this->is_dir = $node->getIsDir();
55 }
56
57 $this->path = $node->getPath();
58 $this->id = $node->getId();
59 if (!$this->is_dir) {
60 $this->path = rtrim($this->path, "/");
61 }
62 $this->initDeleteItem();
63 $response->content = "<div id = 'cld_delete_item' >";
64 if ($this->is_dir) {
65 $response->content .= $tpl->getMessageHTML($lng->txt("cld_confirm_delete_folder"), "question");
66 } else {
67 $response->content .= $tpl->getMessageHTML($lng->txt("cld_confirm_delete_file"), "question");
68 }
69 $response->content .= $this->gui->getHTML();
70 $response->content .= "</div >";
71 $response->success = true;
72 } catch (Exception $e) {
73 $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
74 }
75 header('Content-type: application/json');
76 echo ilJsonUtil::encode($response);
77 exit;
78 }
global $tpl
Definition: ilias.php:8
$_POST["username"]
Class ilCloudException.
const ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
static encode($mixed, $suppress_native=false)
global $lng
Definition: privfeed.php:17
global $DIC

References $_POST, $DIC, $lng, $tpl, ilJsonUtil\encode(), exit, ilCloudFileTree\getFileTreeFromSession(), ilCloudException\ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION, and initDeleteItem().

+ Here is the call graph for this function:

◆ cancel()

ilCloudPluginDeleteGUI::cancel ( )

Update properties.

Definition at line 146 of file class.ilCloudPluginDeleteGUI.php.

146 {
147 $response = new stdClass();
148 $response->status = "cancel";
149
150 echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response)
151 . ");</script>";
152 exit;
153 }

References ilJsonUtil\encode(), and exit.

+ Here is the call graph for this function:

◆ deleteItem()

ilCloudPluginDeleteGUI::deleteItem ( )

Update properties.

Definition at line 117 of file class.ilCloudPluginDeleteGUI.php.

117 {
118 global $DIC;
119 $tpl = $DIC['tpl'];
120 $lng = $DIC['lng'];
121
122 $response = new stdClass();
123 $response->success = null;
124 $response->message = null;
125
126 if (true) {
127 try {
129 $node = $file_tree->getNodeFromId($_POST["id"]);
130 $file_tree->deleteFromService($node->getId());
131 $response->message = $tpl->getMessageHTML($lng->txt("cld_file_deleted"), "success");
132 $response->success = true;
133 } catch (Exception $e) {
134 $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
135 }
136 }
137 echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response)
138 . ");</script>";
139 exit;
140 }

References $_POST, $DIC, $lng, $tpl, ilJsonUtil\encode(), exit, and ilCloudFileTree\getFileTreeFromSession().

+ Here is the call graph for this function:

◆ initDeleteItem()

ilCloudPluginDeleteGUI::initDeleteItem ( )

Definition at line 81 of file class.ilCloudPluginDeleteGUI.php.

81 {
82 global $DIC;
83 $ilCtrl = $DIC['ilCtrl'];
84 $lng = $DIC['lng'];
85
86 include_once("Services/Utilities/classes/class.ilConfirmationTableGUI.php");
87 $this->gui = new ilConfirmationTableGUI(true);
88 $this->gui->setFormName("cld_delete_item");
89 $this->gui->getTemplateObject()->setVariable("ACTIONTARGET", "cld_blank_target");
90
91 $this->gui->addCommandButton('deleteItem', $lng->txt('confirm'));
92 $this->gui->addCommandButton('cancel', $lng->txt('cancel'));
93 $this->gui->setFormAction($ilCtrl->getFormAction($this));
94
95 if ($this->is_dir) {
96 $item[] = array(
97 "var" => 'id',
98 "id" => $this->id,
99 "text" => basename($this->path),
100 "img" => ilUtil::getImagePath('icon_dcl_fold.svg')
101 );
102 } else {
103 $item[] = array(
104 "var" => 'id',
105 "id" => $this->id,
106 "text" => basename($this->path),
107 "img" => ilUtil::getImagePath('icon_dcl_file.svg')
108 );
109 }
110 $this->gui->setData($item);
111 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18

References $DIC, $ilCtrl, $lng, and ilUtil\getImagePath().

Referenced by asyncDeleteItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $gui

ilCloudPluginDeleteGUI::$gui
protected

Definition at line 34 of file class.ilCloudPluginDeleteGUI.php.

◆ $id

ilCloudPluginDeleteGUI::$id = 0
protected

Definition at line 26 of file class.ilCloudPluginDeleteGUI.php.

◆ $is_dir

ilCloudPluginDeleteGUI::$is_dir
protected

Definition at line 30 of file class.ilCloudPluginDeleteGUI.php.

◆ $path

ilCloudPluginDeleteGUI::$path = "/"
protected

Definition at line 22 of file class.ilCloudPluginDeleteGUI.php.


The documentation for this class was generated from the following file: