ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCloudPluginDeleteGUI Class Reference

Class ilCloudPluginDeleteGUI. More...

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

Public Member Functions

 asyncDeleteItem ()
 
 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
 
- 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 18 of file class.ilCloudPluginDeleteGUI.php.

Member Function Documentation

◆ asyncDeleteItem()

ilCloudPluginDeleteGUI::asyncDeleteItem ( )

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

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

26  {
27  global $tpl, $lng;
28  $response = new stdClass();
29  $response->success = null;
30  $response->message = null;
31  $response->content = null;
33  try
34  {
35  $node = $file_tree->getNodeFromId($_POST["id"]);
36  if(!$node)
37  {
39  }
40  else
41  {
42  $this->is_dir = $node->getIsDir();
43  }
44 
45  $this->path = $node->getPath();
46  $this->id = $node->getId();
47  if(!$this->is_dir)
48  {
49  $this->path = rtrim($this->path, "/");
50  }
51  $this->initDeleteItem();
52  $response->content = "<div id = 'cld_delete_item' >";
53  if($this->is_dir)
54  {
55  $response->content .= $tpl->getMessageHTML($lng->txt("cld_confirm_delete_folder"), "question");
56  }
57  else
58  {
59  $response->content .= $tpl->getMessageHTML($lng->txt("cld_confirm_delete_file"), "question");
60  }
61  $response->content .= $this->gui->getHTML();
62  $response->content .= "</div >";
63  $response->success = true;
64 
65  } catch (Exception $e)
66  {
67  $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
68  }
69  header('Content-type: application/json');
70  echo ilJsonUtil::encode($response);
71  exit;
72 
73  }
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
const ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
static encode($mixed, $suppress_native=false)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
Class ilCloudException.
+ Here is the call graph for this function:

◆ cancel()

ilCloudPluginDeleteGUI::cancel ( )

Update properties.

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

References ilJsonUtil\encode(), and exit.

133  {
134  $response = new stdClass();
135  $response->status = "cancel";
136 
137  echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response) . ");</script>";
138  exit;
139 
140  }
exit
Definition: login.php:54
static encode($mixed, $suppress_native=false)
+ Here is the call graph for this function:

◆ deleteItem()

ilCloudPluginDeleteGUI::deleteItem ( )

Update properties.

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

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

103  {
104  global $tpl, $lng;
105 
106  $response = new stdClass();
107  $response->success = null;
108  $response->message = null;
109 
110  if (true)
111  {
112  try
113  {
115  $node = $file_tree->getNodeFromId($_POST["id"]);
116  $file_tree->deleteFromService($node->getId());
117  $response->message = $tpl->getMessageHTML($lng->txt("cld_file_deleted"), "success");
118  $response->success = true;
119  } catch (Exception $e)
120  {
121  $response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
122  }
123  }
124  echo "<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response) . ");</script>";
125  exit;
126 
127  }
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
static encode($mixed, $suppress_native=false)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ initDeleteItem()

ilCloudPluginDeleteGUI::initDeleteItem ( )

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

References $ilCtrl, and $lng.

Referenced by asyncDeleteItem().

76  {
77  global $ilCtrl, $lng;
78 
79  include_once("Services/Utilities/classes/class.ilConfirmationTableGUI.php");
80  $this->gui = new ilConfirmationTableGUI(true);
81  $this->gui->setFormName("cld_delete_item");
82  $this->gui->getTemplateObject()->setVariable("ACTIONTARGET","cld_blank_target");
83 
84  $this->gui->addCommandButton('deleteItem', $lng->txt('confirm'));
85  $this->gui->addCommandButton('cancel', $lng->txt('cancel'));
86  $this->gui->setFormAction($ilCtrl->getFormAction($this));
87 
88  if($this->is_dir)
89  {
90  $item[] = array("var" => 'id', "id" => $this->id, "text" => basename($this->path), "img" => "/Modules/Cloud/templates/images/icon_folder.png");
91  }
92  else
93  {
94  $item[] = array("var" => 'id', "id" => $this->id, "text" => basename($this->path), "img" => "/Modules/Cloud/templates/images/icon_file.png");
95  }
96  $this->gui->setData($item);
97  }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

Field Documentation

◆ $id

ilCloudPluginDeleteGUI::$id = 0
protected

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

◆ $is_dir

ilCloudPluginDeleteGUI::$is_dir
protected

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

◆ $path

ilCloudPluginDeleteGUI::$path = "/"
protected

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


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