ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCFileItemGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPCFileItemGUI:
+ Collaboration diagram for ilPCFileItemGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 newFileItem ()
 insert new file item More...
 
 newItemAfter ()
 insert new list item after current one More...
 
 initAddFileForm (bool $a_before=true)
 Init add file form. More...
 
 insertFromRepository (string $a_cmd)
 Insert file from repository. More...
 
 insertFromWorkspace (string $a_cmd="insert")
 Insert file from personal workspace. More...
 
 insertNewItemAfter (int $a_file_ref_id=0)
 insert new file item after another item More...
 
 newItemBefore ()
 insert new list item before current one More...
 
 insertNewItemBefore (int $a_file_ref_id=0)
 insert new list item before current one More...
 
 deleteItem ()
 delete a list item More...
 
 setTabs (string $a_cmd="")
 output tabs More...
 
 moveItemDown ()
 move list item down More...
 
 moveItemUp ()
 move list item up More...
 
 cancelAddFile ()
 Cancel adding a file. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions (string $a_type="")
 Get table templates. More...
 

Protected Attributes

ilObjFile $file_object
 
ilTabsGUI $tabs
 
ilObjUser $user
 
ilTree $tree
 
ilSetting $settings
 
- Protected Attributes inherited from ilPageContentGUI
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
php4DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilPCFileItemGUI Handles user commands on items of file lists

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilPCFileItemGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Definition at line 33 of file class.ilPCFileItemGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

38  {
39  global $DIC;
40 
41  $this->lng = $DIC->language();
42  $this->tabs = $DIC->tabs();
43  $this->ctrl = $DIC->ctrl();
44  $this->user = $DIC->user();
45  $this->tpl = $DIC["tpl"];
46  $this->tree = $DIC->repositoryTree();
47  $this->settings = $DIC->settings();
48  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
49  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ cancelAddFile()

ilPCFileItemGUI::cancelAddFile ( )

Cancel adding a file.

Definition at line 413 of file class.ilPCFileItemGUI.php.

References ILIAS\Repository\ctrl().

413  : void
414  {
415  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
416  }
+ Here is the call graph for this function:

◆ deleteItem()

ilPCFileItemGUI::deleteItem ( )

delete a list item

Definition at line 341 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\updateAndReturn().

341  : void
342  {
343  $this->content_obj->deleteItem();
344  $this->updateAndReturn();
345  }
+ Here is the call graph for this function:

◆ executeCommand()

ilPCFileItemGUI::executeCommand ( )

Definition at line 51 of file class.ilPCFileItemGUI.php.

References ILIAS\Repository\ctrl().

51  : void
52  {
53  // get next class that processes or forwards current command
54  $next_class = $this->ctrl->getNextClass($this);
55 
56  // get current command
57  $cmd = $this->ctrl->getCmd();
58  switch ($next_class) {
59  default:
60  $this->$cmd();
61  break;
62  }
63  }
+ Here is the call graph for this function:

◆ initAddFileForm()

ilPCFileItemGUI::initAddFileForm ( bool  $a_before = true)

Init add file form.

Definition at line 148 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, ilFormPropertyGUI\setRequired(), and ilLanguage\txt().

Referenced by newFileItem(), newItemAfter(), and newItemBefore().

149  {
150  $lng = $this->lng;
151  $ilCtrl = $this->ctrl;
152 
153  $form = new ilPropertyFormGUI();
154 
155  // file
156  $fi = new ilFileInputGUI($lng->txt("file"), "file");
157  $fi->setRequired(true);
158  $form->addItem($fi);
159 
160  if ($a_before) {
161  $form->addCommandButton("insertNewItemBefore", $lng->txt("save"));
162  } else {
163  $form->addCommandButton("insertNewItemAfter", $lng->txt("save"));
164  }
165  $form->addCommandButton("cancelAddFile", $lng->txt("cancel"));
166 
167  $form->setTitle($lng->txt("cont_insert_file_item"));
168 
169  $form->setFormAction($ilCtrl->getFormAction($this));
170 
171  return $form;
172  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a file property in a property form.
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertFromRepository()

ilPCFileItemGUI::insertFromRepository ( string  $a_cmd)

Insert file from repository.

Definition at line 178 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\$ctrl, $tabs, ilPageContentGUI\$tpl, ilGlobalTemplateInterface\setContent(), and setTabs().

Referenced by newItemAfter(), and newItemBefore().

178  : void
179  {
180  $ilTabs = $this->tabs;
181  $ilCtrl = $this->ctrl;
182  $tpl = $this->tpl;
183 
184  $this->setTabs($a_cmd);
185  $ilTabs->setSubTabActive("cont_file_from_repository");
186  $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
187 
188  $exp = new ilPCFileItemFileSelectorGUI(
189  $this,
190  $a_cmd,
191  $this,
192  $a_cmd,
193  "file_ref_id"
194  );
195  if (!$exp->handleCommand()) {
196  $tpl->setContent($exp->getHTML());
197  }
198  }
setTabs(string $a_cmd="")
output tabs
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertFromWorkspace()

ilPCFileItemGUI::insertFromWorkspace ( string  $a_cmd = "insert")

Insert file from personal workspace.

Definition at line 203 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\$ctrl, $tabs, ilPageContentGUI\$tpl, ilGlobalTemplateInterface\setContent(), ilWorkspaceExplorerGUI\setCustomLinkTarget(), setTabs(), and ILIAS\Repository\user().

Referenced by newItemAfter(), and newItemBefore().

203  : void
204  {
205  $ilTabs = $this->tabs;
206  $ilCtrl = $this->ctrl;
207  $tpl = $this->tpl;
208 
209  $this->setTabs($a_cmd);
210  $ilTabs->setSubTabActive("cont_file_from_workspace");
211 
212  $exp = new ilWorkspaceExplorerGUI($this->user->getId(), $this, $a_cmd, $this, $a_cmd, "fl_wsp_id");
213  $ilCtrl->setParameter($this, "subCmd", "selectFile");
214  $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
215  $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
216  $exp->setTypeWhiteList(array("wsrt", "wfld", "file"));
217  $exp->setSelectableTypes(array("file"));
218  if ($exp->handleCommand()) {
219  return;
220  }
221  $tpl->setContent($exp->getHTML());
222  }
setTabs(string $a_cmd="")
output tabs
setContent(string $a_html)
Sets content for standard template.
Explorer for selecting a personal workspace item.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertNewItemAfter()

ilPCFileItemGUI::insertNewItemAfter ( int  $a_file_ref_id = 0)

insert new file item after another item

Definition at line 227 of file class.ilPCFileItemGUI.php.

References $ilUser, $res, $user, ILIAS\Repository\ctrl(), ilTree\getNodeData(), newFileItem(), and newItemAfter().

Referenced by newItemAfter().

227  : void
228  {
230 
231  $fl_wsp_id = $this->request->getInt("fl_wsp_id");
232 
233  $res = true;
234  if ($fl_wsp_id > 0) {
235  // we need the object id for the instance
236  $tree = new ilWorkspaceTree($ilUser->getId());
237  $node = $tree->getNodeData($fl_wsp_id);
238 
239  $this->file_object = new ilObjFile($node["obj_id"], false);
240  } elseif ($a_file_ref_id == 0) {
241  $res = $this->newFileItem();
242  } else {
243  $this->file_object = new ilObjFile($a_file_ref_id);
244  }
245  if ($res) {
246  $this->content_obj->newItemAfter(
247  $this->file_object->getId(),
248  $this->file_object->getFileName(),
249  $this->file_object->getFileType()
250  );
251  $this->updated = $this->pg_obj->update();
252  if ($this->updated === true) {
253  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
254  }
255  }
256 
257  $this->newItemAfter();
258  }
$res
Definition: ltiservices.php:69
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjFile.
newFileItem()
insert new file item
newItemAfter()
insert new list item after current one
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertNewItemBefore()

ilPCFileItemGUI::insertNewItemBefore ( int  $a_file_ref_id = 0)

insert new list item before current one

Definition at line 305 of file class.ilPCFileItemGUI.php.

References $ilUser, $res, $user, ILIAS\Repository\ctrl(), ilTree\getNodeData(), newFileItem(), and newItemBefore().

Referenced by newItemBefore().

305  : void
306  {
308 
309  $res = true;
310 
311  $fl_wsp_id = $this->request->getInt("fl_wsp_id");
312  if ($fl_wsp_id > 0) {
313  // we need the object id for the instance
314  $tree = new ilWorkspaceTree($ilUser->getId());
315  $node = $tree->getNodeData($fl_wsp_id);
316 
317  $this->file_object = new ilObjFile($node["obj_id"], false);
318  } elseif ($a_file_ref_id == 0) {
319  $res = $this->newFileItem();
320  } else {
321  $this->file_object = new ilObjFile($a_file_ref_id);
322  }
323  if ($res) {
324  $this->content_obj->newItemBefore(
325  $this->file_object->getId(),
326  $this->file_object->getTitle(),
327  $this->file_object->getFileType()
328  );
329  $this->updated = $this->pg_obj->update();
330  if ($this->updated === true) {
331  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
332  }
333  }
334 
335  $this->newItemBefore();
336  }
$res
Definition: ltiservices.php:69
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
newItemBefore()
insert new list item before current one
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjFile.
newFileItem()
insert new file item
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveItemDown()

ilPCFileItemGUI::moveItemDown ( )

move list item down

Definition at line 395 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\updateAndReturn().

395  : void
396  {
397  $this->content_obj->moveItemDown();
398  $this->updateAndReturn();
399  }
+ Here is the call graph for this function:

◆ moveItemUp()

ilPCFileItemGUI::moveItemUp ( )

move list item up

Definition at line 404 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\updateAndReturn().

404  : void
405  {
406  $this->content_obj->moveItemUp();
407  $this->updateAndReturn();
408  }
+ Here is the call graph for this function:

◆ newFileItem()

ilPCFileItemGUI::newFileItem ( )

insert new file item

Definition at line 68 of file class.ilPCFileItemGUI.php.

References $DIC, ilPageContentGUI\$lng, initAddFileForm(), and ilLanguage\txt().

Referenced by insertNewItemAfter(), and insertNewItemBefore().

68  : bool
69  {
70  $lng = $this->lng;
71 
72  if ($_FILES["file"]["name"] == "") {
73  throw new ilCOPageFileHandlingException($lng->txt("upload_error_file_not_found"));
74  }
75 
76  $form = $this->initAddFileForm();
77  $form->checkInput();
78 
79  $fileObj = new ilObjFile();
80  $fileObj->setType("file");
81  $fileObj->setTitle($_FILES["file"]["name"]);
82  $fileObj->setDescription("");
83  $fileObj->setFileName($_FILES["file"]["name"]);
84  $fileObj->setMode("filelist");
85  $fileObj->create();
86  // upload file to filesystem
87  global $DIC;
88  $upload = $DIC->upload();
89  if ($upload->hasBeenProcessed() !== true) {
90  $upload->process();
91  }
92  $fileObj->getUploadFile(
93  $_FILES["file"]["tmp_name"],
94  $_FILES["file"]["name"]
95  );
96 
97  $this->file_object = $fileObj;
98  return true;
99  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: feed.php:28
Class ilObjFile.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initAddFileForm(bool $a_before=true)
Init add file form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newItemAfter()

ilPCFileItemGUI::newItemAfter ( )

insert new list item after current one

Definition at line 105 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\$sub_command, $tabs, ilPageContentGUI\displayValidationError(), initAddFileForm(), insertFromRepository(), insertFromWorkspace(), insertNewItemAfter(), and setTabs().

Referenced by insertNewItemAfter().

105  : void
106  {
107  $ilTabs = $this->tabs;
108 
110 
111  if (in_array($sub_command, ["insertNew", "insertFromRepository", "insertFromWorkspace"])) {
112  $this->edit_repo->setSubCmd($sub_command);
113  }
114 
115  if (($sub_command == "") && $this->edit_repo->getSubCmd() != "") {
116  $sub_command = $this->edit_repo->getSubCmd();
117  }
118 
119  switch ($sub_command) {
120  case "insertFromWorkspace":
121  $this->insertFromWorkspace("newItemAfter");
122  break;
123 
124  case "insertFromRepository":
125  $this->insertFromRepository("newItemAfter");
126  break;
127 
128  case "selectFile":
129  $this->insertNewItemAfter(
130  $this->request->getInt("file_ref_id")
131  );
132  break;
133 
134  default:
135  $this->setTabs("newItemAfter");
136  $ilTabs->setSubTabActive("cont_new_file");
137 
138  $this->displayValidationError();
139  $form = $this->initAddFileForm(false);
140  $this->tpl->setContent($form->getHTML());
141  break;
142  }
143  }
insertFromWorkspace(string $a_cmd="insert")
Insert file from personal workspace.
insertNewItemAfter(int $a_file_ref_id=0)
insert new file item after another item
setTabs(string $a_cmd="")
output tabs
initAddFileForm(bool $a_before=true)
Init add file form.
insertFromRepository(string $a_cmd)
Insert file from repository.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newItemBefore()

ilPCFileItemGUI::newItemBefore ( )

insert new list item before current one

Definition at line 263 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\$sub_command, $tabs, ilPageContentGUI\displayValidationError(), initAddFileForm(), insertFromRepository(), insertFromWorkspace(), insertNewItemBefore(), and setTabs().

Referenced by insertNewItemBefore().

263  : void
264  {
265  $ilTabs = $this->tabs;
266 
268 
269  if (in_array($sub_command, ["insertNew", "insertFromRepository", "insertFromWorkspace"])) {
270  $this->edit_repo->setSubCmd($sub_command);
271  }
272 
273  if (($sub_command == "") && $this->edit_repo->getSubCmd() != "") {
274  $sub_command = $this->edit_repo->getSubCmd();
275  }
276 
277  switch ($sub_command) {
278  case "insertFromWorkspace":
279  $this->insertFromWorkspace("newItemBefore");
280  break;
281 
282  case "insertFromRepository":
283  $this->insertFromRepository("newItemBefore");
284  break;
285 
286  case "selectFile":
287  $this->insertNewItemBefore(
288  $this->request->getInt("file_ref_id")
289  );
290  break;
291 
292  default:
293  $this->setTabs("newItemBefore");
294  $ilTabs->setSubTabActive("cont_new_file");
295 
296  $this->displayValidationError();
297  $form = $this->initAddFileForm(true);
298  $this->tpl->setContent($form->getHTML());
299  }
300  }
insertFromWorkspace(string $a_cmd="insert")
Insert file from personal workspace.
setTabs(string $a_cmd="")
output tabs
insertNewItemBefore(int $a_file_ref_id=0)
insert new list item before current one
initAddFileForm(bool $a_before=true)
Init add file form.
insertFromRepository(string $a_cmd)
Insert file from repository.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTabs()

ilPCFileItemGUI::setTabs ( string  $a_cmd = "")

output tabs

Definition at line 350 of file class.ilPCFileItemGUI.php.

References ilPageContentGUI\$ctrl, $ilSetting, $settings, $tabs, and ILIAS\Repository\ctrl().

Referenced by insertFromRepository(), insertFromWorkspace(), newItemAfter(), and newItemBefore().

350  : void
351  {
352  $ilTabs = $this->tabs;
353  $ilCtrl = $this->ctrl;
355 
356  $ilTabs->addTarget(
357  "cont_back",
358  $this->ctrl->getParentReturn($this),
359  "",
360  ""
361  );
362 
363  if ($a_cmd != "") {
364  $ilCtrl->setParameter($this, "subCmd", "insertNew");
365  $ilTabs->addSubTabTarget(
366  "cont_new_file",
367  $ilCtrl->getLinkTarget($this, $a_cmd),
368  $a_cmd
369  );
370 
371  $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
372  $ilTabs->addSubTabTarget(
373  "cont_file_from_repository",
374  $ilCtrl->getLinkTarget($this, $a_cmd),
375  $a_cmd
376  );
377  $ilCtrl->setParameter($this, "subCmd", "");
378 
379  if (!$ilSetting->get("disable_personal_workspace") &&
380  !$ilSetting->get("disable_wsp_files")) {
381  $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
382  $ilTabs->addSubTabTarget(
383  "cont_file_from_workspace",
384  $ilCtrl->getLinkTarget($this, $a_cmd),
385  $a_cmd
386  );
387  $ilCtrl->setParameter($this, "subCmd", "");
388  }
389  }
390  }
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $file_object

ilObjFile ilPCFileItemGUI::$file_object
protected

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

◆ $settings

ilSetting ilPCFileItemGUI::$settings
protected

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

Referenced by setTabs().

◆ $tabs

ilTabsGUI ilPCFileItemGUI::$tabs
protected

◆ $tree

ilTree ilPCFileItemGUI::$tree
protected

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

◆ $user

ilObjUser ilPCFileItemGUI::$user
protected

Definition at line 28 of file class.ilPCFileItemGUI.php.

Referenced by insertNewItemAfter(), and insertNewItemBefore().


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