ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 41 of file class.ilCloudPluginDeleteGUI.php.

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

42  {
43  global $DIC;
44  $tpl = $DIC['tpl'];
45  $lng = $DIC['lng'];
46  $response = new stdClass();
47  $response->success = null;
48  $response->message = null;
49  $response->content = null;
51  try {
52  $node = $file_tree->getNodeFromId($_POST["id"]);
53  if (!$node) {
55  } else {
56  $this->is_dir = $node->getIsDir();
57  }
58 
59  $this->path = $node->getPath();
60  $this->id = $node->getId();
61  if (!$this->is_dir) {
62  $this->path = rtrim($this->path, "/");
63  }
64  $this->initDeleteItem();
65  $response->content = "<div id = 'cld_delete_item' >";
66  if ($this->is_dir) {
67  $response->content .= $tpl->getMessageHTML($lng->txt("cld_confirm_delete_folder"), "question");
68  } else {
69  $response->content .= $tpl->getMessageHTML($lng->txt("cld_confirm_delete_file"), "question");
70  }
71  $response->content .= $this->gui->getHTML();
72  $response->content .= "</div >";
73  $response->success = true;
74  } catch (Exception $e) {
75  $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
76  }
77  header('Content-type: application/json');
79  exit;
80  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
const ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
static encode($mixed, $suppress_native=false)
Add a drawing to the header
Definition: 04printing.php:69
global $lng
Definition: privfeed.php:17
Class ilCloudException.
$response
$_POST["username"]
+ Here is the call graph for this function:

◆ cancel()

ilCloudPluginDeleteGUI::cancel ( )

Update properties.

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

References $response, ilJsonUtil\encode(), and exit.

151  {
152  $response = new stdClass();
153  $response->status = "cancel";
154 
155  echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response)
156  . ");</script>";
157  exit;
158  }
static encode($mixed, $suppress_native=false)
$response
+ Here is the call graph for this function:

◆ deleteItem()

ilCloudPluginDeleteGUI::deleteItem ( )

Update properties.

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

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

121  {
122  global $DIC;
123  $tpl = $DIC['tpl'];
124  $lng = $DIC['lng'];
125 
126  $response = new stdClass();
127  $response->success = null;
128  $response->message = null;
129 
130  if (true) {
131  try {
133  $node = $file_tree->getNodeFromId($_POST["id"]);
134  $file_tree->deleteFromService($node->getId());
135  $response->message = $tpl->getMessageHTML($lng->txt("cld_file_deleted"), "success");
136  $response->success = true;
137  } catch (Exception $e) {
138  $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
139  }
140  }
141  echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response)
142  . ");</script>";
143  exit;
144  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
static encode($mixed, $suppress_native=false)
global $lng
Definition: privfeed.php:17
$response
$_POST["username"]
+ Here is the call graph for this function:

◆ initDeleteItem()

ilCloudPluginDeleteGUI::initDeleteItem ( )

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

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

Referenced by asyncDeleteItem().

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

◆ $id

ilCloudPluginDeleteGUI::$id = 0
protected

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

◆ $is_dir

ilCloudPluginDeleteGUI::$is_dir
protected

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

◆ $path

ilCloudPluginDeleteGUI::$path = "/"
protected

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


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