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

References $_POST, $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 140 of file class.ilCloudPluginDeleteGUI.php.

140 {
141 $response = new stdClass();
142 $response->status = "cancel";
143
144 echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response)
145 . ");</script>";
146 exit;
147 }

References ilJsonUtil\encode(), and exit.

+ Here is the call graph for this function:

◆ deleteItem()

ilCloudPluginDeleteGUI::deleteItem ( )

Update properties.

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

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

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

+ Here is the call graph for this function:

◆ initDeleteItem()

ilCloudPluginDeleteGUI::initDeleteItem ( )

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

79 {
80 global $ilCtrl, $lng;
81
82 include_once("Services/Utilities/classes/class.ilConfirmationTableGUI.php");
83 $this->gui = new ilConfirmationTableGUI(true);
84 $this->gui->setFormName("cld_delete_item");
85 $this->gui->getTemplateObject()->setVariable("ACTIONTARGET", "cld_blank_target");
86
87 $this->gui->addCommandButton('deleteItem', $lng->txt('confirm'));
88 $this->gui->addCommandButton('cancel', $lng->txt('cancel'));
89 $this->gui->setFormAction($ilCtrl->getFormAction($this));
90
91 if ($this->is_dir) {
92 $item[] = array(
93 "var" => 'id',
94 "id" => $this->id,
95 "text" => basename($this->path),
96 "img" => ilUtil::getImagePath('icon_dcl_fold.svg')
97 );
98 } else {
99 $item[] = array(
100 "var" => 'id',
101 "id" => $this->id,
102 "text" => basename($this->path),
103 "img" => ilUtil::getImagePath('icon_dcl_file.svg')
104 );
105 }
106 $this->gui->setData($item);
107 }
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 $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: