ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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...
 
 redirectToFileList ()
 
- 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 ()
 
 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
ILIAS COPage Editor GUIService $editor_gui
 
ILIAS COPage InternalGUIService $gui
 
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
LOMServices $lom_services
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
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 = ""
 
DOMDocument $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 ()
 
 setEditorToolContext ()
 
 initEditor ()
 
 getEditorScriptTag (string $form_pc_id="", string $form_cname="")
 
- 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 = "" 
)

Reimplemented from ilPageContentGUI.

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

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 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ cancelAddFile()

ilPCFileItemGUI::cancelAddFile ( )

Cancel adding a file.

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

411 : void
412 {
413 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
414 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ deleteItem()

ilPCFileItemGUI::deleteItem ( )

delete a list item

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

341 : void
342 {
343 $this->content_obj->deleteItem();
344 $this->updateAndReturn();
345 }

References ilPageContentGUI\updateAndReturn().

+ Here is the call graph for this function:

◆ executeCommand()

ilPCFileItemGUI::executeCommand ( )

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

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 }

References ILIAS\Repository\ctrl().

+ 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.

149 {
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 }
This class represents a file property in a property form.
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 property form user interface.

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

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

+ 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.

178 : void
179 {
180 $ilTabs = $this->tabs;
181 $ilCtrl = $this->ctrl;
183
184 $this->setTabs($a_cmd);
185 $ilTabs->setSubTabActive("cont_file_from_repository");
186 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
187
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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTabs(string $a_cmd="")
output tabs
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.

References ilPageContentGUI\$ctrl, $tabs, ilPageContentGUI\$tpl, ILIAS\UICore\GlobalTemplate\setContent(), and setTabs().

Referenced by newItemAfter(), and newItemBefore().

+ 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.

203 : void
204 {
205 $ilTabs = $this->tabs;
206 $ilCtrl = $this->ctrl;
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 }
Explorer for selecting a personal workspace item.

References ilPageContentGUI\$ctrl, $tabs, ilPageContentGUI\$tpl, ILIAS\UICore\GlobalTemplate\setContent(), setTabs(), and ILIAS\Repository\user().

Referenced by newItemAfter(), and newItemBefore().

+ 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.

227 : void
228 {
229 $ilUser = $this->user;
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->redirectToFileList();
254 }
255 }
256
257 $this->newItemAfter();
258 }
Class ilObjFile.
newItemAfter()
insert new list item after current one
newFileItem()
insert new file item
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...
$res
Definition: ltiservices.php:69

References $res, $tree, $user, ilTree\getNodeData(), newFileItem(), newItemAfter(), and redirectToFileList().

Referenced by newItemAfter().

+ 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.

305 : void
306 {
307 $ilUser = $this->user;
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->redirectToFileList();
332 }
333 }
334
335 $this->newItemBefore();
336 }
newItemBefore()
insert new list item before current one

References $res, $tree, $user, ilTree\getNodeData(), newFileItem(), newItemBefore(), and redirectToFileList().

Referenced by newItemBefore().

+ 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 393 of file class.ilPCFileItemGUI.php.

393 : void
394 {
395 $this->content_obj->moveItemDown();
396 $this->updateAndReturn();
397 }

References ilPageContentGUI\updateAndReturn().

+ Here is the call graph for this function:

◆ moveItemUp()

ilPCFileItemGUI::moveItemUp ( )

move list item up

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

402 : void
403 {
404 $this->content_obj->moveItemUp();
405 $this->updateAndReturn();
406 }

References ilPageContentGUI\updateAndReturn().

+ Here is the call graph for this function:

◆ newFileItem()

ilPCFileItemGUI::newFileItem ( )

insert new file item

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

68 : bool
69 {
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 }
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.

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

Referenced by insertNewItemAfter(), and insertNewItemBefore().

+ 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.

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 }
insertFromRepository(string $a_cmd)
Insert file from repository.
insertFromWorkspace(string $a_cmd="insert")
Insert file from personal workspace.
insertNewItemAfter(int $a_file_ref_id=0)
insert new file item after another item

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

Referenced by insertNewItemAfter().

+ 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.

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 }
insertNewItemBefore(int $a_file_ref_id=0)
insert new list item before current one

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

Referenced by insertNewItemBefore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToFileList()

ilPCFileItemGUI::redirectToFileList ( )

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

416 : void
417 {
418 $this->pg_obj->stripHierIDs();
419 $this->pg_obj->addHierIDs();
420 $this->ctrl->setParameterByClass(ilPCFileListGUI::class, "pc_id", $this->content_obj->getListPCId());
421 $this->ctrl->redirectByClass(ilPCFileListGUI::class, "editFiles");
422 }

References ILIAS\Repository\ctrl().

Referenced by insertNewItemAfter(), and insertNewItemBefore().

+ 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.

350 : void
351 {
352 $ilTabs = $this->tabs;
353 $ilCtrl = $this->ctrl;
355
356 $ilTabs->setBackTarget(
357 $this->lng->txt("back"),
358 $this->ctrl->getLinkTarget($this, "redirectToFileList")
359 );
360
361 if ($a_cmd != "") {
362 $ilCtrl->setParameter($this, "subCmd", "insertNew");
363 $ilTabs->addSubTabTarget(
364 "cont_new_file",
365 $ilCtrl->getLinkTarget($this, $a_cmd),
366 $a_cmd
367 );
368
369 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
370 $ilTabs->addSubTabTarget(
371 "cont_file_from_repository",
372 $ilCtrl->getLinkTarget($this, $a_cmd),
373 $a_cmd
374 );
375 $ilCtrl->setParameter($this, "subCmd", "");
376
377 if (!$ilSetting->get("disable_personal_workspace") &&
378 !$ilSetting->get("disable_wsp_files")) {
379 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
380 $ilTabs->addSubTabTarget(
381 "cont_file_from_workspace",
382 $ilCtrl->getLinkTarget($this, $a_cmd),
383 $a_cmd
384 );
385 $ilCtrl->setParameter($this, "subCmd", "");
386 }
387 }
388 }
global $ilSetting
Definition: privfeed.php:31

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

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

+ 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.

Referenced by insertNewItemAfter(), and insertNewItemBefore().

◆ $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: