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

Class ilCloudFileTree. More...

+ Inheritance diagram for ilCloudPluginFileTreeGUI:
+ Collaboration diagram for ilCloudPluginFileTreeGUI:

Public Member Functions

 __construct ($plugin_service_class, ilCloudFileTree $file_tree)
 
 setFileTree (ilCloudFileTree $file_tree)
 
 getFileTree ()
 
 getFolderHtml (ilObjCloudGUI $gui_class, $id, $delete_files=false, $delete_folder=false, $download=false, $files_visible=false, $folders_visible=false)
 
 setTreeVariablePlugin (ilTemplate $tree_tpl, ilObjCloudGUI $gui_class, $id, $delete_files=false, $delete_folder=false, $download=false, $files_visible=false, $folders_visible=false)
 
 getItemHtml (ilCloudFileNode $node, ilObjCloudGUI $gui_class, $delete_files=false, $delete_folder=false, $download=false)
 
 getLocatorHtml (ilCloudFileNode $node)
 
- Public Member Functions inherited from ilCloudPluginGUI
 __construct ($plugin_service_class)
 
 getPluginObject ()
 
 getPluginHookObject ()
 
 getAdminConfigObject ()
 
 getService ()
 
 txt ($var="")
 
 executeCommand ()
 

Static Public Member Functions

static getLinkToFolder (ilCloudFileNode $node)
 

Protected Member Functions

 setBlockVariablePlugin (ilTemplate $block)
 
 setItemVariablePlugin (ilTemplate $item, ilCloudFileNode $node)
 
 addDropZone ()
 

Protected Attributes

 $file_tree
 
- Protected Attributes inherited from ilCloudPluginGUI
 $service = null
 

Detailed Description

Class ilCloudFileTree.

Class for drawing the file tree.

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 19 of file class.ilCloudPluginFileTreeGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCloudPluginFileTreeGUI::__construct (   $plugin_service_class,
ilCloudFileTree  $file_tree 
)
Parameters
ilCloudFileTree$file_tree

Definition at line 29 of file class.ilCloudPluginFileTreeGUI.php.

References setFileTree().

30  {
31  parent::__construct($plugin_service_class);
32  $this->setFileTree($file_tree);
33  }
setFileTree(ilCloudFileTree $file_tree)
+ Here is the call graph for this function:

Member Function Documentation

◆ addDropZone()

ilCloudPluginFileTreeGUI::addDropZone ( )
protected

Definition at line 244 of file class.ilCloudPluginFileTreeGUI.php.

References $options, and ilJsonUtil\encode().

245  {
246  $options = new stdClass();
247  $options->dropZone = ".ilFileUploadDropZone_1";
248  $options->fileInput = "#ilFileUploadInput_1";
249  $options->submitButton = "uploadFiles";
250  $options->cancelButton = "cancelAll";
251  $options->dropArea = ".ilFileDropTarget";
252  $options->fileList = "#ilFileUploadList_1";
253  $options->fileSelectButton = "#ilFileUploadFileSelect_1";
254  echo "<script language='javascript' type='text/javascript'>var fileUpload1 = new ilFileUpload(1, " . ilJsonUtil::encode($options) . ");</script>";
255  }
static encode($mixed, $suppress_native=false)
if(!is_array($argv)) $options
+ Here is the call graph for this function:

◆ getFileTree()

ilCloudPluginFileTreeGUI::getFileTree ( )
Returns
ilCloudFileTree

Definition at line 50 of file class.ilCloudPluginFileTreeGUI.php.

References $file_tree.

Referenced by getFolderHtml(), and getLocatorHtml().

+ Here is the caller graph for this function:

◆ getFolderHtml()

ilCloudPluginFileTreeGUI::getFolderHtml ( ilObjCloudGUI  $gui_class,
  $id,
  $delete_files = false,
  $delete_folder = false,
  $download = false,
  $files_visible = false,
  $folders_visible = false 
)
Parameters
ilObjCloudGUI$gui_class
$id
bool$delete_files
bool$delete_folder
bool$download
bool$files_visible
bool$folders_visible
Returns
string
Exceptions
ilCloudException

Definition at line 66 of file class.ilCloudPluginFileTreeGUI.php.

References $lng, $path, getFileTree(), getItemHtml(), ilCloudException\ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION, setBlockVariablePlugin(), and setTreeVariablePlugin().

67  {
68  global $lng;
69 
70  $node = null;
71 
72  $node = $this->getFileTree()->getNodeFromId($id);
73  if (!$node)
74  {
76  }
77  $tree_tpl = new ilTemplate("tpl.cloud_block.html", true, true, "Modules/Cloud/");
78 
79  if ($files_visible || $folders_visible)
80  {
81  $tree_tpl->setVariable("NODE_ID", $node->getId());
82 
83  $block = new ilTemplate("tpl.container_list_block.html", true, true, "Services/Container/");
84 
85  if ($node->hasChildren())
86  {
87  $block->setVariable("BLOCK_HEADER_CONTENT", $lng->txt("content"));
88 
89  $children = $this->getFileTree()->getSortedListOfChildren($node);
90  foreach ($children as $path)
91  {
92  $child_node = $this->getFileTree()->getNodeFromPath($path);
93  if (($child_node->getIsDir() && $folders_visible) || (!$child_node->getIsDir() && $files_visible))
94  {
95 
96  $block->setCurrentBlock("container_standard_row");
97  if ($child_node->getIsDir())
98  {
99  $block->setVariable("ROW_ID", "id=xcld_folder_" . $child_node->getId());
100  } else
101  {
102  $block->setVariable("ROW_ID", "id=xcld_file_" . $child_node->getId());
103  }
104  $block->setVariable("BLOCK_ROW_CONTENT", $this->getItemHtml($child_node, $gui_class, $delete_files, $delete_folder, $download));
105  $block->parseCurrentBlock();
106  }
107 
108  }
109 
110  }
111  $this->setBlockVariablePlugin($block);
112  $tree_tpl->setVariable("CONTENT", $block->get());
113  } else
114  {
115  // Nothing is visible
116  // $tree_tpl->setVariable("CONTENT", $lng->txt("file_folder_not_visible"));
117  }
118  $this->setTreeVariablePlugin($tree_tpl, $gui_class, $id, $delete_files, $delete_folder, $download , $files_visible , $folders_visible );
119  return $tree_tpl->get();
120  }
setTreeVariablePlugin(ilTemplate $tree_tpl, ilObjCloudGUI $gui_class, $id, $delete_files=false, $delete_folder=false, $download=false, $files_visible=false, $folders_visible=false)
const ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
special template class to simplify handling of ITX/PEAR
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22
getItemHtml(ilCloudFileNode $node, ilObjCloudGUI $gui_class, $delete_files=false, $delete_folder=false, $download=false)
Class ilCloudException.
+ Here is the call graph for this function:

◆ getItemHtml()

ilCloudPluginFileTreeGUI::getItemHtml ( ilCloudFileNode  $node,
ilObjCloudGUI  $gui_class,
  $delete_files = false,
  $delete_folder = false,
  $download = false 
)
Parameters
ilCloudFileNode$node
ilObjCloudGUI$gui_class
bool$delete_files
bool$delete_folder
bool$download
Returns
string

else { $item->setVariable("HREF_TITLE_LINKED", $ilCtrl->getLinkTarget($gui_class, "render") . "&current_id=" . $node->getId() . "&current_path=" . $node->getPath()); }

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

References $ilCtrl, ilDatePresentation\formatDate(), ilCloudConnector\getActionListGUIClass(), ilCloudFileNode\getIconPath(), ilCloudFileNode\getId(), ilCloudFileNode\getIsDir(), getLinkToFolder(), ilCloudFileNode\getModified(), ilCloudFileNode\getPath(), ilCloudPluginGUI\getService(), ilCloudFileNode\getSize(), IL_CAL_UNIX, and setItemVariablePlugin().

Referenced by getFolderHtml().

147  {
148  global $ilCtrl;
149 
150 
151  $item = new ilTemplate("tpl.container_list_item.html", true, true, "Services/Container/");
152 
153  $action_list_gui = ilCloudConnector::getActionListGUIClass($this->getService());
154  $item->setVariable("COMMAND_SELECTION_LIST", $action_list_gui->getSelectionListItemsHTML($delete_files, $delete_folder, $node));
155 
156  $item->setVariable("DIV_CLASS", "ilContainerListItemOuter");
157  $item->touchBlock("d_1");
158 
159  include_once('./Services/Calendar/classes/class.ilDate.php');
161 
162  if ($node->getIconPath() != "")
163  {
164  $item->setVariable("SRC_ICON", $node->getIconPath());
165  }
166 
167  //Folder with content
168  if ($node->getIsDir())
169  {
170  if($node->getIconPath() == "")
171  {
172  $item->setVariable("SRC_ICON", "./Modules/Cloud/templates/images/icon_folder_b.png");
173  }
174  $item->setVariable("TXT_TITLE_LINKED", basename($node->getPath()));
175 
176  //if ($this->getPluginObject()->getAsyncDrawing())
177  {
178  $item->setVariable("HREF_TITLE_LINKED", $this->getLinkToFolder($node));
179 
180  }
185  //$item->setVariable("TXT_DESC", $modified);
186  } //File
187  else
188  {
189  if ($node->getIconPath() == "")
190  {
191  $item->setVariable("SRC_ICON", "./Modules/Cloud/templates/images/icon_file_b.png");
192  }
193 
194  $item->setVariable("TXT_DESC", pathinfo($node->getPath(), PATHINFO_EXTENSION) . "&nbsp;&nbsp;&nbsp;" . $node->getSize() . "&nbsp;&nbsp;&nbsp;" . $modified);
195  if ($download)
196  {
197  $item->setVariable("TXT_TITLE_LINKED", basename($node->getPath()));
198  $item->setVariable("HREF_TITLE_LINKED", $ilCtrl->getLinkTarget($gui_class, "getFile") . "&id=" . $node->getId());
199  } else
200  {
201  $item->setVariable("TXT_TITLE", basename($node->getPath()));
202  }
203  }
204 
205  $this->setItemVariablePlugin($item, $node);
206  return $item->get();
207  }
static getActionListGUIClass(ilCloudPluginService $plugin_service_class)
const IL_CAL_UNIX
global $ilCtrl
Definition: ilias.php:18
setItemVariablePlugin(ilTemplate $item, ilCloudFileNode $node)
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
static getLinkToFolder(ilCloudFileNode $node)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLinkToFolder()

static ilCloudPluginFileTreeGUI::getLinkToFolder ( ilCloudFileNode  $node)
static
Parameters
ilCloudFileNode$node
Returns
string

Definition at line 239 of file class.ilCloudPluginFileTreeGUI.php.

References ilCloudFileNode\getId(), ilCloudFileNode\getParentId(), and ilCloudFileNode\getPath().

Referenced by ilCloudPluginInitGUI\addToolbar(), getItemHtml(), and getLocatorHtml().

240  {
241  return "#/open_folder?id_parent=" . $node->getParentId() . "&current_id=" . $node->getId(). "&current_path=" . $node->getPath();
242  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocatorHtml()

ilCloudPluginFileTreeGUI::getLocatorHtml ( ilCloudFileNode  $node)
Parameters
ilCloudFileNode$node
Returns
string

Definition at line 219 of file class.ilCloudPluginFileTreeGUI.php.

References getFileTree(), ilCloudFileNode\getId(), getLinkToFolder(), ilCloudFileNode\getParentId(), ilCloudFileNode\getPath(), and ilCloudPluginGUI\getPluginObject().

220  {
221  global $ilLocator;
222 
223  if ($node == $this->getFileTree()->getRootNode())
224  {
225  $ilLocator = new ilLocatorGUI();
226  $ilLocator->addItem($this->getPluginObject()->getCloudModulObject()->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($node));
227  } else
228  {
229  $this->getLocatorHtml($this->getFileTree()->getNodeFromId($node->getParentId()));
230  $ilLocator->addItem(basename($node->getPath()), $this->getLinkToFolder($node));
231  }
232  return "<DIV class='xcld_locator' id='xcld_locator_" . $node->getId() . "'>" . $ilLocator->getHTML() . "</DIV>";
233  }
locator handling class
static getLinkToFolder(ilCloudFileNode $node)
+ Here is the call graph for this function:

◆ setBlockVariablePlugin()

ilCloudPluginFileTreeGUI::setBlockVariablePlugin ( ilTemplate  $block)
protected
Parameters
ilTemplate$block

Definition at line 136 of file class.ilCloudPluginFileTreeGUI.php.

Referenced by getFolderHtml().

136 {}
+ Here is the caller graph for this function:

◆ setFileTree()

ilCloudPluginFileTreeGUI::setFileTree ( ilCloudFileTree  $file_tree)
Parameters
ilCloudFileTree$file_tree

Definition at line 38 of file class.ilCloudPluginFileTreeGUI.php.

References $file_tree.

Referenced by __construct().

39  {
40  if ($file_tree)
41  {
42  $this->file_tree = $file_tree;
43  }
44 
45  }
+ Here is the caller graph for this function:

◆ setItemVariablePlugin()

ilCloudPluginFileTreeGUI::setItemVariablePlugin ( ilTemplate  $item,
ilCloudFileNode  $node 
)
protected
Parameters
ilTemplate$item
ilCloudFileNode$node

Definition at line 213 of file class.ilCloudPluginFileTreeGUI.php.

Referenced by getItemHtml().

213 {}
+ Here is the caller graph for this function:

◆ setTreeVariablePlugin()

ilCloudPluginFileTreeGUI::setTreeVariablePlugin ( ilTemplate  $tree_tpl,
ilObjCloudGUI  $gui_class,
  $id,
  $delete_files = false,
  $delete_folder = false,
  $download = false,
  $files_visible = false,
  $folders_visible = false 
)
Parameters
ilObjCloudGUI$gui_class
$id
bool$delete_files
bool$delete_folder
bool$download
bool$files_visible
bool$folders_visible

Definition at line 131 of file class.ilCloudPluginFileTreeGUI.php.

Referenced by getFolderHtml().

131 {}
+ Here is the caller graph for this function:

Field Documentation

◆ $file_tree

ilCloudPluginFileTreeGUI::$file_tree
protected

Definition at line 24 of file class.ilCloudPluginFileTreeGUI.php.

Referenced by getFileTree(), and setFileTree().


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