ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ilPCFileListGUI Class Reference

Class ilPCListGUI. More...

+ Inheritance diagram for ilPCFileListGUI:
+ Collaboration diagram for ilPCFileListGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 execute command More...
 
 insert (?ilPropertyFormGUI $a_form=null)
 insert new file list form More...
 
 selectFile ()
 
 insertFromRepository (string $a_cmd="insert")
 Insert file from repository. More...
 
 insertFromWorkspace (string $a_cmd="insert")
 Insert file from personal workspace. More...
 
 create ()
 create new file list in dom and update page in db More...
 
 afterCreation ()
 
 edit ()
 
 editProperties ()
 edit properties form More...
 
 initEditForm (string $a_mode="edit")
 Init edit form. More...
 
 saveProperties ()
 save table properties in db and return to page edit screen More...
 
 setTabs (bool $a_create=true)
 Set Tabs. More...
 
 addFileItem ()
 Add file item. More...
 
 deleteFileItem ()
 Delete file items from list. More...
 
 confirmDeletionFileItem ()
 
 savePositions ()
 Save positions of file items. More...
 
 editStyleClass (string $id)
 
 savePositionsAndClasses ()
 Save positions of file items and style classes. More...
 
 checkStyleSelection ()
 Checks whether style selection shoudl be available or not. More...
 
 newFileItem ()
 New file item (called, if there is no file item in an existing) More...
 
 insertNewFileItem (int $a_file_ref_id=0)
 insert new file item after another item More...
 
 createFileItem ()
 insert new file item More...
 
 setItemTabs (string $a_cmd="")
 output tabs 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 ()
 
 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 Member Functions

 getEditStyleForm (string $id)
 
 saveStyleClass ()
 
- 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="")
 

Protected Attributes

ILIAS COPage InternalDomainService $domain
 
string $requested_file_ref_id
 
ilObjUser $user
 
ilTabsGUI $tabs
 
ilTree $tree
 
ilToolbarGUI $toolbar
 
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
 
array bool null $updated = null
 
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;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

Detailed Description

Class ilPCListGUI.

User Interface for LM List Editing

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilPageContentGUI.

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

43 {
44 global $DIC;
45
46 $this->user = $DIC->user();
47 $this->tabs = $DIC->tabs();
48 $this->ctrl = $DIC->ctrl();
49 $this->tpl = $DIC["tpl"];
50 $this->tree = $DIC->repositoryTree();
51 $this->lng = $DIC->language();
52 $this->toolbar = $DIC->toolbar();
53 $this->settings = $DIC->settings();
54 $this->domain = $DIC->copage()->internal()->domain();
55 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
56 $this->setCharacteristics(array("FileListItem" => $this->lng->txt("cont_FileListItem")));
57 $this->requested_file_ref_id = $this->request->getString("file_ref_id");
58 }
setCharacteristics(array $a_chars)
__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(), ilPageContentGUI\setCharacteristics(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addFileItem()

ilPCFileListGUI::addFileItem ( )

Add file item.

This function is called from file list table and calls newItemAfter function.

Definition at line 519 of file class.ilPCFileListGUI.php.

519 : void
520 {
521 $ilCtrl = $this->ctrl;
522
523 $files = $this->content_obj->getFileList();
524
525 if (count($files) >= 1) {
526 $ilCtrl->setParameterByClass(
527 "ilpcfileitemgui",
528 "hier_id",
529 $files[count($files) - 1]["hier_id"]
530 );
531 $ilCtrl->setParameterByClass(
532 "ilpcfileitemgui",
533 "pc_id",
534 $files[count($files) - 1]["pc_id"]
535 );
536 $ilCtrl->redirectByClass("ilpcfileitemgui", "newItemAfter");
537 } else {
538 $ilCtrl->redirect($this, "newFileItem");
539 }
540 }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc

◆ afterCreation()

ilPCFileListGUI::afterCreation ( )

Definition at line 267 of file class.ilPCFileListGUI.php.

267 : void
268 {
269 $this->pg_obj->stripHierIDs();
270 $this->pg_obj->addHierIDs();
271 $this->ctrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
272 $this->ctrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
273 $this->ctrl->redirect($this, "editFiles");
274 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ checkStyleSelection()

ilPCFileListGUI::checkStyleSelection ( )

Checks whether style selection shoudl be available or not.

Definition at line 663 of file class.ilPCFileListGUI.php.

663 : bool
664 {
665 // check whether there is more than one style class
666 $chars = $this->getCharacteristics();
667
668 $classes = $this->content_obj->getAllClasses();
669 if (count($chars) > 1) {
670 return true;
671 }
672 foreach ($classes as $class) {
673 if ($class != "" && $class != "FileListItem") {
674 return true;
675 }
676 }
677 return false;
678 }

◆ confirmDeletionFileItem()

ilPCFileListGUI::confirmDeletionFileItem ( )

Definition at line 556 of file class.ilPCFileListGUI.php.

556 : void
557 {
558 $table = $this->getFileListTable();
559 $ids = $table->getItemIds();
560
561 if (count($ids) === 0) {
562 $this->ctrl->redirect($this, "editFiles");
563 }
564
565 $retrieval = $this->domain->pc()->fileListRetrieval($this->content_obj);
566 $data = $retrieval->getData([]);
567 foreach ($data as $row) {
568 if (in_array($row["id"], $ids)) {
569 $items[$row["id"]] = $row["file_name"];
570 }
571 }
572
573 $table->renderDeletionConfirmation(
574 $this->lng->txt("delete"),
575 $this->lng->txt("cont_delete_file_item_confirm"),
576 "deleteFileItem",
577 $items
578 );
579 }

References $data, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ create()

ilPCFileListGUI::create ( )

create new file list in dom and update page in db

Definition at line 201 of file class.ilPCFileListGUI.php.

201 : void
202 {
203 global $DIC;
204
205 $mode = ($this->requested_file_ref_id != "")
206 ? "select_file"
207 : "create";
208 $form = $this->initEditForm($mode);
209 if (!$form->checkInput()) {
210 $form->setValuesByPost();
211 $this->insert($form);
212 return;
213 }
214
215 // from personal workspace
216 if (substr($this->requested_file_ref_id, 0, 4) == "wsp_") {
217 $fileObj = new ilObjFile(substr($this->requested_file_ref_id, 4), false);
218 }
219 // upload
220 elseif ($this->requested_file_ref_id == "") {
221 $fileObj = new ilObjFile();
222 $fileObj->setType("file");
223 $fileObj->setTitle($_FILES["file"]["name"]);
224 $fileObj->setDescription("");
225 $fileObj->setFileName($_FILES["file"]["name"]);
226 $fileObj->setMode("filelist");
227 $fileObj->create();
228 // upload file to filesystem
229
230 $upload = $DIC->upload();
231 if ($upload->hasBeenProcessed() !== true) {
232 $upload->process();
233 }
234
235 $fileObj->getUploadFile(
236 $_FILES["file"]["tmp_name"],
237 $_FILES["file"]["name"]
238 );
239 }
240 // from repository
241 else {
242 $fileObj = new ilObjFile($this->requested_file_ref_id);
243 }
244 $this->setCurrentTextLang($form->getInput("flst_language"));
245
246 //echo "::".is_object($this->dom).":";
247 $this->content_obj = new ilPCFileList($this->getPage());
248 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
249 $this->content_obj->setListTitle(
250 $form->getInput("flst_title"),
251 $form->getInput("flst_language")
252 );
253 $this->content_obj->appendItem(
254 $fileObj->getId(),
255 $fileObj->getFileName(),
256 $fileObj->getFileType()
257 );
258
259 $this->updated = $this->pg_obj->update();
260 if ($this->updated === true) {
261 $this->afterCreation();
262 } else {
263 $this->insert();
264 }
265 }
Class ilObjFile.
initEditForm(string $a_mode="edit")
Init edit form.
insert(?ilPropertyFormGUI $a_form=null)
insert new file list form
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setCurrentTextLang(string $lang_key)

References $DIC.

◆ createFileItem()

ilPCFileListGUI::createFileItem ( )

insert new file item

Definition at line 771 of file class.ilPCFileListGUI.php.

771 : ?ilObjFile
772 {
773 global $DIC;
774
776
777 if ($_FILES["file"]["name"] == "") {
778 throw new ilCOPageFileHandlingException($lng->txt("upload_error_file_not_found"));
779 }
780
781 $form = $this->initEditForm();
782 // see #22541
783 // $form->checkInput();
784
785 $fileObj = new ilObjFile();
786 $fileObj->setType("file");
787 $fileObj->setTitle($_FILES["file"]["name"]);
788 $fileObj->setDescription("");
789 $fileObj->setFileName($_FILES["file"]["name"]);
790 $fileObj->setMode("filelist");
791 $fileObj->create();
792 // upload file to filesystem
793
794 $upload = $DIC->upload();
795 if ($upload->hasBeenProcessed() !== true) {
796 $upload->process();
797 }
798
799 $fileObj->getUploadFile(
800 $_FILES["file"]["tmp_name"],
801 $_FILES["file"]["name"]
802 );
803
804 return $fileObj;
805 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...

References $DIC, and $lng.

◆ deleteFileItem()

ilPCFileListGUI::deleteFileItem ( )

Delete file items from list.

Definition at line 545 of file class.ilPCFileListGUI.php.

545 : void
546 {
547 $table = $this->getFileListTable();
548 $ids = $table->getItemIds();
549 if (count($ids) > 0) {
550 $this->content_obj->deleteFileItems($ids);
551 }
552 $this->updated = $this->pg_obj->update();
553 $this->ctrl->redirect($this, "editFiles");
554 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ edit()

ilPCFileListGUI::edit ( )

Definition at line 276 of file class.ilPCFileListGUI.php.

276 : void
277 {
278 $this->editFiles();
279 }

◆ editProperties()

ilPCFileListGUI::editProperties ( )

edit properties form

Definition at line 284 of file class.ilPCFileListGUI.php.

284 : void
285 {
286 $this->setTabs(false);
287
288 $form = $this->initEditForm();
289 $this->tpl->setContent($form->getHTML());
290 }
setTabs(bool $a_create=true)
Set Tabs.

◆ editStyleClass()

ilPCFileListGUI::editStyleClass ( string  $id)

Definition at line 596 of file class.ilPCFileListGUI.php.

597 {
598 $form = $this->getEditStyleForm($id);
600 $this->gui->modal($lng->txt("copg_edit_style_class"))
601 ->form($form)
602 ->send();
603 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and $lng.

◆ executeCommand()

ilPCFileListGUI::executeCommand ( )

execute command

Definition at line 63 of file class.ilPCFileListGUI.php.

63 : void
64 {
65 // get next class that processes or forwards current command
66 $next_class = $this->ctrl->getNextClass($this);
67
68 $this->getCharacteristicsOfCurrentStyle(["flist_li"]); // scorm-2004
69
70 // get current command
71 $cmd = $this->ctrl->getCmd();
72
73 switch ($next_class) {
74 default:
75 $this->$cmd();
76 break;
77 }
78 }
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.

References ILIAS\Repository\ctrl(), and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

+ Here is the call graph for this function:

◆ getEditStyleForm()

ilPCFileListGUI::getEditStyleForm ( string  $id)
protected

Definition at line 605 of file class.ilPCFileListGUI.php.

606 {
608 $lng->loadLanguageModule("style");
609 $lng->loadLanguageModule("copg");
610
611 $this->ctrl->setParameterByClass(self::class, "file_item_id", $id);
612 $retrieval = $this->domain->pc()->fileListRetrieval($this->content_obj);
613 $options = $this->getCharacteristics();
614 $data = $retrieval->getData([]);
615 $value = null;
616 foreach ($data as $row) {
617 if ($row["id"] == $id && isset($options[$row["class"]])) {
618 $value = $row["class"];
619 }
620 }
621 return $this->gui->form([self::class], "saveStyleClass")
622 ->select("class", $lng->txt("sty_class"), $options, "", $value)
623 ->required();
624 }
loadLanguageModule(string $a_module)
Load language module.

References $data, $id, $lng, ILIAS\UI\Implementation\Component\Input\Field\$options, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ initEditForm()

ilPCFileListGUI::initEditForm ( string  $a_mode = "edit")

Init edit form.

Definition at line 295 of file class.ilPCFileListGUI.php.

296 {
298 $ilCtrl = $this->ctrl;
299 $ilUser = $this->user;
300
301 $ti = null;
302 $si = null;
303 $form = new ilPropertyFormGUI();
304
305 if ($a_mode != "add_file") {
306 // title
307 $ti = new ilTextInputGUI($lng->txt("title"), "flst_title");
308 $ti->setMaxLength(80);
309 $ti->setSize(40);
310 $form->addItem($ti);
311
312 // language
313 $languages = [];
314 foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
315 $languages[$language->value()] = $language->presentableLabel();
316 }
317 $si = new ilSelectInputGUI($lng->txt("language"), "flst_language");
318 $si->setOptions($languages);
319 $form->addItem($si);
320 }
321
322 if (in_array($a_mode, array("create", "add_file"))) {
323 // file
324 $fi = new ilFileInputGUI($lng->txt("file"), "file");
325 $fi->setRequired(true);
326 $form->addItem($fi);
327 } elseif (in_array($a_mode, array("select_file"))) {
328 // file
329 $ne = new ilNonEditableValueGUI($lng->txt("file"), "");
330
331 $file_ref_id = (int) $this->requested_file_ref_id;
332 $fl_wsp_id = $this->request->getInt("fl_wsp_id");
333
334 if ($file_ref_id > 0) {
335 $file_obj = new ilObjFile($file_ref_id);
336 if (is_object($file_obj)) {
337 // ref id as hidden input
338 $hi = new ilHiddenInputGUI("file_ref_id");
339 $hi->setValue($file_ref_id);
340 $form->addItem($hi);
341
342 $ne->setValue($file_obj->getTitle());
343 }
344 } elseif ($fl_wsp_id > 0) {
345 // we need the object id for the instance
346 $tree = new ilWorkspaceTree($ilUser->getId());
347 $node = $tree->getNodeData($fl_wsp_id);
348
349 $file_obj = new ilObjFile($node["obj_id"], false);
350 if (is_object($file_obj)) {
351 // ref id as hidden input
352 $hi = new ilHiddenInputGUI("file_ref_id");
353 $hi->setValue("wsp_" . (int) $node["obj_id"]);
354 $form->addItem($hi);
355
356 $ne->setValue($file_obj->getTitle());
357 }
358 $this->tpl->parseCurrentBlock();
359 }
360
361 $form->addItem($ne);
362 }
363
364
365 switch ($a_mode) {
366 case "edit":
367 $ti->setValue($this->content_obj->getListTitle());
368 $si->setValue($this->content_obj->getLanguage());
369 $form->addCommandButton("saveProperties", $lng->txt("save"));
370 $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
371 $form->setTitle($lng->txt("cont_edit_file_list_properties"));
372 break;
373
374 case "create":
375 case "select_file":
376 if ($this->getCurrentTextLang() != "") {
377 $s_lang = $this->getCurrentTextLang();
378 } else {
379 $s_lang = $ilUser->getLanguage();
380 }
381 $si->setValue($s_lang);
382 $form->addCommandButton("create", $lng->txt("save"));
383 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
384 $form->setTitle($lng->txt("cont_insert_file_list"));
385 break;
386
387 case "add_file":
388 $form->addCommandButton("insertNewFileItem", $lng->txt("save"));
389 $form->addCommandButton("editFiles", $lng->txt("cancel"));
390 $form->setTitle($lng->txt("cont_insert_file_item"));
391 break;
392 }
393
394 $form->setFormAction($ilCtrl->getFormAction($this));
395
396 return $form;
397 }
This class represents a file property in a property form.
This class represents a hidden form property in a property form.
This class represents a non editable value in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text property in a property form.
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...

References $lng, ilTree\getNodeData(), and ILIAS\Repository\int().

Referenced by insert(), and selectFile().

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

◆ insert()

ilPCFileListGUI::insert ( ?ilPropertyFormGUI  $a_form = null)

insert new file list form

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

83 : void
84 {
85 $ilTabs = $this->tabs;
87
88 if (in_array($sub_command, ["insertNew", "insertFromRepository", "insertFromWorkspace"])) {
89 $this->edit_repo->setSubCmd($sub_command);
90 }
91
92 if (($sub_command == "") && $this->edit_repo->getSubCmd() != "") {
93 $sub_command = $this->edit_repo->getSubCmd();
94 }
95
96 switch ($sub_command) {
97 case "insertFromWorkspace":
98 $this->insertFromWorkspace();
99 break;
100
101 case "insertFromRepository":
102 $this->insertFromRepository();
103 break;
104
105 case "selectFile":
106 $this->selectFile();
107 break;
108
109 default:
110 $this->setTabs();
111 $ilTabs->setSubTabActive("cont_new_file");
112
113 $this->displayValidationError();
114
115 if ($a_form != null) {
116 $form = $a_form;
117 } else {
118 $form = $this->initEditForm("create");
119 }
120 $this->tpl->setContent($form->getHTML());
121 break;
122 }
123 }
insertFromWorkspace(string $a_cmd="insert")
Insert file from personal workspace.
insertFromRepository(string $a_cmd="insert")
Insert file from repository.

References ilPageContentGUI\$sub_command, $tabs, ilPageContentGUI\displayValidationError(), initEditForm(), insertFromRepository(), insertFromWorkspace(), selectFile(), and setTabs().

+ Here is the call graph for this function:

◆ insertFromRepository()

ilPCFileListGUI::insertFromRepository ( string  $a_cmd = "insert")

Insert file from repository.

Definition at line 140 of file class.ilPCFileListGUI.php.

140 : void
141 {
142 $ilTabs = $this->tabs;
143 $ilCtrl = $this->ctrl;
145
146 if ($a_cmd == "insert") {
147 $this->setTabs();
148 } else {
149 $this->setItemTabs($a_cmd);
150 }
151
152 $ilTabs->setSubTabActive("cont_file_from_repository");
153 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
154
156 $this,
157 $a_cmd,
158 $this,
159 $a_cmd,
160 "file_ref_id"
161 );
162 if (!$exp->handleCommand()) {
163 $tpl->setContent($exp->getHTML());
164 }
165 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setItemTabs(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(), setItemTabs(), and setTabs().

Referenced by insert().

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

◆ insertFromWorkspace()

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

Insert file from personal workspace.

Definition at line 170 of file class.ilPCFileListGUI.php.

172 : void {
173 $ilTabs = $this->tabs;
174 $ilCtrl = $this->ctrl;
176 $ilUser = $this->user;
177
178 if ($a_cmd == "insert") {
179 $this->setTabs();
180 } else {
181 $this->setItemTabs($a_cmd);
182 }
183
184 $ilTabs->setSubTabActive("cont_file_from_workspace");
185
186 $exp = new ilWorkspaceExplorerGUI($ilUser->getId(), $this, $a_cmd, $this, $a_cmd, "fl_wsp_id");
187 $ilCtrl->setParameter($this, "subCmd", "selectFile");
188 $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
189 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
190 $exp->setTypeWhiteList(array("wsrt", "wfld", "file"));
191 $exp->setSelectableTypes(array("file"));
192 if ($exp->handleCommand()) {
193 return;
194 }
195 $tpl->setContent($exp->getHTML());
196 }
Explorer for selecting a personal workspace item.

References setTabs().

Referenced by insert().

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

◆ insertNewFileItem()

ilPCFileListGUI::insertNewFileItem ( int  $a_file_ref_id = 0)

insert new file item after another item

Definition at line 730 of file class.ilPCFileListGUI.php.

730 : void
731 {
732 $ilUser = $this->user;
733
734 $fl_wsp_id = $this->request->getInt("fl_wsp_id");
735
736 // from personal workspace
737 if ($fl_wsp_id > 0) {
738 // we need the object id for the instance
739 $tree = new ilWorkspaceTree($ilUser->getId());
740 $node = $tree->getNodeData($fl_wsp_id);
741
742 $file_obj = new ilObjFile($node["obj_id"], false);
743 }
744 // upload
745 elseif ($a_file_ref_id == 0) {
746 $file_obj = $this->createFileItem();
747 }
748 // from repository
749 else {
750 $file_obj = new ilObjFile($a_file_ref_id);
751 }
752 if (is_object($file_obj)) {
753 $this->content_obj->appendItem(
754 $file_obj->getId(),
755 $file_obj->getTitle(),
756 $file_obj->getFileType()
757 );
758 $this->updated = $this->pg_obj->update();
759 if ($this->updated === true) {
760 //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
761 $this->ctrl->redirect($this, "editFiles");
762 }
763 }
764
765 $this->newFileItem();
766 }
newFileItem()
New file item (called, if there is no file item in an existing)
createFileItem()
insert new file item

References ILIAS\Repository\ctrl(), and ilTree\getNodeData().

+ Here is the call graph for this function:

◆ newFileItem()

ilPCFileListGUI::newFileItem ( )

New file item (called, if there is no file item in an existing)

Definition at line 689 of file class.ilPCFileListGUI.php.

689 : void
690 {
691 $ilTabs = $this->tabs;
692
694 if (in_array($sub_command, ["insertNew", "insertFromRepository", "insertFromWorkspace"])) {
695 $this->edit_repo->setSubCmd($sub_command);
696 }
697
698 if (($sub_command == "") && $this->edit_repo->getSubCmd() != "") {
699 $sub_command = $this->edit_repo->getSubCmd();
700 }
701
702 switch ($sub_command) {
703 case "insertFromWorkspace":
704 $this->insertFromWorkspace("newFileItem");
705 break;
706
707 case "insertFromRepository":
708 $this->insertFromRepository("newFileItem");
709 break;
710
711 case "selectFile":
712 $this->insertNewFileItem($this->requested_file_ref_id);
713 break;
714
715 default:
716 $this->setItemTabs("newFileItem");
717 $ilTabs->setSubTabActive("cont_new_file");
718
719 $this->displayValidationError();
720
721 $form = $this->initEditForm("add_file");
722 $this->tpl->setContent($form->getHTML());
723 break;
724 }
725 }
insertNewFileItem(int $a_file_ref_id=0)
insert new file item after another item

◆ savePositions()

ilPCFileListGUI::savePositions ( )

Save positions of file items.

Definition at line 584 of file class.ilPCFileListGUI.php.

584 : void
585 {
586 $ilCtrl = $this->ctrl;
587 $table = $this->getFileListTable();
588 $pos = $table->getData();
589 if (is_array($pos) && count($pos) > 0) {
590 $this->content_obj->savePositions($pos);
591 }
592 $this->updated = $this->pg_obj->update();
593 $ilCtrl->redirect($this, "editFiles");
594 }

◆ savePositionsAndClasses()

ilPCFileListGUI::savePositionsAndClasses ( )

Save positions of file items and style classes.

Definition at line 644 of file class.ilPCFileListGUI.php.

644 : void
645 {
646 $ilCtrl = $this->ctrl;
647
648 $pos = $this->request->getIntArray("position");
649 $class = $this->request->getStringArray("class");
650 if (count($pos) > 0) {
651 $this->content_obj->savePositions($pos);
652 }
653 if (count($class) > 0) {
654 $this->content_obj->saveStyleClasses($class);
655 }
656 $this->updated = $this->pg_obj->update();
657 $ilCtrl->redirect($this, "editFiles");
658 }
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc

◆ saveProperties()

ilPCFileListGUI::saveProperties ( )

save table properties in db and return to page edit screen

Definition at line 403 of file class.ilPCFileListGUI.php.

403 : void
404 {
405 $form = $this->initEditForm("edit");
406 $form->checkInput();
407 $this->content_obj->setListTitle(
408 $form->getInput("flst_title"),
409 $form->getInput("flst_language")
410 );
411 $this->updated = $this->pg_obj->update();
412 if ($this->updated === true) {
413 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
414 $this->ctrl->redirect($this, "editProperties");
415 } else {
416 $this->pg_obj->addHierIDs();
417 $this->edit();
418 }
419 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveStyleClass()

ilPCFileListGUI::saveStyleClass ( )
protected

Definition at line 626 of file class.ilPCFileListGUI.php.

626 : void
627 {
628 $file_item_id = $this->request->getString("file_item_id");
629 $form = $this->getEditStyleForm($file_item_id);
630 if ($form->isValid()) {
631 $class = $form->getData("class");
632 $this->content_obj->saveStyleClass(
633 $file_item_id,
634 $class
635 );
636 $this->updated = $this->pg_obj->update();
637 $this->ctrl->redirect($this, "editFiles");
638 }
639 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ selectFile()

ilPCFileListGUI::selectFile ( )

Definition at line 125 of file class.ilPCFileListGUI.php.

125 : void
126 {
127 $ilTabs = $this->tabs;
128 $this->setTabs();
129 $ilTabs->setSubTabActive("cont_file_from_repository");
130
131 $this->displayValidationError();
132 $form = $this->initEditForm("select_file");
133
134 $this->tpl->setContent($form->getHTML());
135 }

References $tabs, ilPageContentGUI\displayValidationError(), initEditForm(), and setTabs().

Referenced by insert().

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

◆ setItemTabs()

ilPCFileListGUI::setItemTabs ( string  $a_cmd = "")

output tabs

Definition at line 811 of file class.ilPCFileListGUI.php.

811 : void
812 {
813 $ilTabs = $this->tabs;
814 $ilCtrl = $this->ctrl;
816
817 $ilTabs->addTarget(
818 "cont_back",
819 $this->ctrl->getParentReturn($this),
820 "",
821 ""
822 );
823
824 if ($a_cmd != "") {
825 $ilCtrl->setParameter($this, "subCmd", "insertNew");
826 $ilTabs->addSubTabTarget(
827 "cont_new_file",
828 $ilCtrl->getLinkTarget($this, $a_cmd),
829 $a_cmd
830 );
831
832 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
833 $ilTabs->addSubTabTarget(
834 "cont_file_from_repository",
835 $ilCtrl->getLinkTarget($this, $a_cmd),
836 $a_cmd
837 );
838 $ilCtrl->setParameter($this, "subCmd", "");
839
840 if (!$ilSetting->get("disable_personal_workspace") &&
841 !$ilSetting->get("disable_wsp_files")) {
842 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
843 $ilTabs->addSubTabTarget(
844 "cont_file_from_workspace",
845 $ilCtrl->getLinkTarget($this, $a_cmd),
846 $a_cmd
847 );
848 $ilCtrl->setParameter($this, "subCmd", "");
849 }
850 }
851 }
global $ilSetting
Definition: privfeed.php:26

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

Referenced by insertFromRepository().

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

◆ setTabs()

ilPCFileListGUI::setTabs ( bool  $a_create = true)

Set Tabs.

Definition at line 458 of file class.ilPCFileListGUI.php.

458 : void
459 {
460 $ilTabs = $this->tabs;
461 $ilCtrl = $this->ctrl;
464
465 if ($a_create) {
466 $cmd = "insert";
467
468 $ilCtrl->setParameter($this, "subCmd", "insertNew");
469 $ilTabs->addSubTabTarget(
470 "cont_new_file",
471 $ilCtrl->getLinkTarget($this, $cmd),
472 $cmd
473 );
474
475 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
476 $ilTabs->addSubTabTarget(
477 "cont_file_from_repository",
478 $ilCtrl->getLinkTarget($this, $cmd),
479 $cmd
480 );
481 $ilCtrl->setParameter($this, "subCmd", "");
482
483 if (!$ilSetting->get("disable_personal_workspace") &&
484 !$ilSetting->get("disable_wsp_files")) {
485 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
486 $ilTabs->addSubTabTarget(
487 "cont_file_from_workspace",
488 $ilCtrl->getLinkTarget($this, $cmd),
489 $cmd
490 );
491 $ilCtrl->setParameter($this, "subCmd", "");
492 }
493 } else {
494 $ilTabs->setBackTarget(
495 $lng->txt("pg"),
496 $this->ctrl->getParentReturn($this)
497 );
498
499 $ilTabs->addTarget(
500 "cont_ed_edit_files",
501 $ilCtrl->getLinkTarget($this, "editFiles"),
502 "editFiles",
503 get_class($this)
504 );
505
506 $ilTabs->addTarget(
507 "cont_ed_edit_prop",
508 $ilCtrl->getLinkTarget($this, "editProperties"),
509 "editProperties",
510 get_class($this)
511 );
512 }
513 }

References $ilSetting, and $lng.

Referenced by insert(), insertFromRepository(), insertFromWorkspace(), and selectFile().

+ Here is the caller graph for this function:

Field Documentation

◆ $domain

ILIAS COPage InternalDomainService ilPCFileListGUI::$domain
protected

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

◆ $requested_file_ref_id

string ilPCFileListGUI::$requested_file_ref_id
protected

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

◆ $settings

ilSetting ilPCFileListGUI::$settings
protected

Definition at line 36 of file class.ilPCFileListGUI.php.

◆ $tabs

ilTabsGUI ilPCFileListGUI::$tabs
protected

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

Referenced by insert(), insertFromRepository(), and selectFile().

◆ $toolbar

ilToolbarGUI ilPCFileListGUI::$toolbar
protected

Definition at line 35 of file class.ilPCFileListGUI.php.

◆ $tree

ilTree ilPCFileListGUI::$tree
protected

Definition at line 34 of file class.ilPCFileListGUI.php.

◆ $user

ilObjUser ilPCFileListGUI::$user
protected

Definition at line 32 of file class.ilPCFileListGUI.php.


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