ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPCFileItemGUI Class Reference

Class ilPCFileItemGUI. More...

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

Public Member Functions

 __construct (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor @access public. More...
 
 executeCommand ()
 execute command More...
 
 newFileItem ()
 insert new file item More...
 
 newItemAfter ()
 insert new list item after current one More...
 
 initAddFileForm ($a_before=true)
 Init add file form. More...
 
 insertFromRepository ($a_cmd)
 Insert file from repository. More...
 
 insertFromWorkspace ($a_cmd="insert")
 Insert file from personal workspace. More...
 
 insertNewItemAfter ($a_file_ref_id=0)
 insert new file item after another item More...
 
 newItemBefore ()
 insert new list item before current one More...
 
 insertNewItemBefore ($a_file_ref_id=0)
 insert new list item before current one More...
 
 deleteItem ()
 delete a list item More...
 
 setTabs ($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 ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor @access public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 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 ()
 display validation errors More...
 
 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 ($a_type)
 Get table templates. More...
 

Protected Attributes

 $tabs
 
 $user
 
 $tree
 
 $settings
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static $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 ($hier_id="")
 Redirect to parent. More...
 
 getParentReturn ($hier_id="")
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

Class ilPCFileItemGUI.

Handles user commands on items of file lists

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$I$

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

Constructor & Destructor Documentation

◆ __construct()

ilPCFileItemGUI::__construct ( $a_pg_obj,
$a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor @access public.

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

65 {
66 global $DIC;
67
68 $this->lng = $DIC->language();
69 $this->tabs = $DIC->tabs();
70 $this->ctrl = $DIC->ctrl();
71 $this->user = $DIC->user();
72 $this->tpl = $DIC["tpl"];
73 $this->tree = $DIC->repositoryTree();
74 $this->settings = $DIC->settings();
75 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
76 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancelAddFile()

ilPCFileItemGUI::cancelAddFile ( )

Cancel adding a file.

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

506 {
507 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
508 }

◆ deleteItem()

ilPCFileItemGUI::deleteItem ( )

delete a list item

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

431 {
432 $this->content_obj->deleteItem();
433 $_SESSION["il_pg_error"] = $this->pg_obj->update();
434 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
435 }
$_SESSION["AccountId"]

References $_SESSION.

◆ executeCommand()

ilPCFileItemGUI::executeCommand ( )

execute command

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

82 {
83 // get next class that processes or forwards current command
84 $next_class = $this->ctrl->getNextClass($this);
85
86 // get current command
87 $cmd = $this->ctrl->getCmd();
88 switch ($next_class) {
89 default:
90 $ret = $this->$cmd();
91 break;
92 }
93
94 return $ret;
95 }
$ret
Definition: parser.php:6

References $ret.

◆ initAddFileForm()

ilPCFileItemGUI::initAddFileForm (   $a_before = true)

Init add file form.

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

207 {
209 $ilCtrl = $this->ctrl;
211
212 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
213 $form = new ilPropertyFormGUI();
214
215 // file
216 $fi = new ilFileInputGUI($lng->txt("file"), "file");
217 $fi->setRequired(true);
218 $form->addItem($fi);
219
220 if ($a_before) {
221 $form->addCommandButton("insertNewItemBefore", $lng->txt("save"));
222 } else {
223 $form->addCommandButton("insertNewItemAfter", $lng->txt("save"));
224 }
225 $form->addCommandButton("cancelAddFile", $lng->txt("cancel"));
226
227 $form->setTitle($lng->txt("cont_insert_file_item"));
228
229 $form->setFormAction($ilCtrl->getFormAction($this));
230
231 return $form;
232 }
This class represents a file property in a property form.
This class represents a property form user interface.
$ilUser
Definition: imgupload.php:18

References ilPageContentGUI\$ctrl, $ilUser, ilPageContentGUI\$lng, and $user.

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

+ Here is the caller graph for this function:

◆ insertFromRepository()

ilPCFileItemGUI::insertFromRepository (   $a_cmd)

Insert file from repository.

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

239 {
240 $ilTabs = $this->tabs;
241 $ilCtrl = $this->ctrl;
243
244 $this->setTabs($a_cmd);
245 $ilTabs->setSubTabActive("cont_file_from_repository");
246 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
247
248 include_once("./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
250 $this,
251 $a_cmd,
252 $this,
253 $a_cmd,
254 "file_ref_id"
255 );
256 if (!$exp->handleCommand()) {
257 $tpl->setContent($exp->getHTML());
258 }
259 }
setTabs($a_cmd="")
output tabs

References ilPageContentGUI\$ctrl, $tabs, ilPageContentGUI\$tpl, 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 (   $a_cmd = "insert")

Insert file from personal workspace.

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

265 {
266 $ilTabs = $this->tabs;
268 $ilCtrl = $this->ctrl;
271
272 $this->setTabs($a_cmd);
273 $ilTabs->setSubTabActive("cont_file_from_workspace");
274
275 include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
276 $exp = new ilWorkspaceExplorerGUI($this->user->getId(), $this, $a_cmd, $this, $a_cmd, "fl_wsp_id");
277 $ilCtrl->setParameter($this, "subCmd", "selectFile");
278 $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
279 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
280 $exp->setTypeWhiteList(array("wsrt", "wfld", "file"));
281 $exp->setSelectableTypes(array("file"));
282 if ($exp->handleCommand()) {
283 return;
284 }
285 $tpl->setContent($exp->getHTML());
286 }
Explorer for selecting a personal workspace item.

References ilPageContentGUI\$ctrl, $ilUser, $tabs, ilPageContentGUI\$tpl, $tree, $user, setTabs(), and 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 (   $a_file_ref_id = 0)

insert new file item after another item

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

292 {
294
295 $res = true;
296 if (isset($_GET["fl_wsp_id"])) {
297 // we need the object id for the instance
298 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
299 $tree = new ilWorkspaceTree($ilUser->getId());
300 $node = $tree->getNodeData($_GET["fl_wsp_id"]);
301
302 include_once("./Modules/File/classes/class.ilObjFile.php");
303 $this->file_object = new ilObjFile($node["obj_id"], false);
304 } elseif ($a_file_ref_id == 0) {
305 $res = $this->newFileItem();
306 } else {
307 include_once("./Modules/File/classes/class.ilObjFile.php");
308 $this->file_object = new ilObjFile($a_file_ref_id);
309 }
310 if ($res) {
311 $this->content_obj->newItemAfter(
312 $this->file_object->getId(),
313 $this->file_object->getTitle(),
314 $this->file_object->getFileType()
315 );
316 $this->updated = $this->pg_obj->update();
317 if ($this->updated === true) {
318 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
319 }
320 }
321
322 $_GET["subCmd"] = "-";
323 $this->newItemAfter();
324 }
$_GET["client_id"]
Class ilObjFile.
newItemAfter()
insert new list item after current one
newFileItem()
insert new file item
Tree handler for personal workspace.
foreach($_POST as $key=> $value) $res

References $_GET, $ilUser, $res, $tree, $user, newFileItem(), and newItemAfter().

Referenced by newItemAfter().

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

◆ insertNewItemBefore()

ilPCFileItemGUI::insertNewItemBefore (   $a_file_ref_id = 0)

insert new list item before current one

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

393 {
395
396 $res = true;
397 if (isset($_GET["fl_wsp_id"])) {
398 // we need the object id for the instance
399 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
400 $tree = new ilWorkspaceTree($ilUser->getId());
401 $node = $tree->getNodeData($_GET["fl_wsp_id"]);
402
403 include_once("./Modules/File/classes/class.ilObjFile.php");
404 $this->file_object = new ilObjFile($node["obj_id"], false);
405 } elseif ($a_file_ref_id == 0) {
406 $res = $this->newFileItem();
407 } else {
408 include_once("./Modules/File/classes/class.ilObjFile.php");
409 $this->file_object = new ilObjFile($a_file_ref_id);
410 }
411 if ($res) {
412 $this->content_obj->newItemBefore(
413 $this->file_object->getId(),
414 $this->file_object->getTitle(),
415 $this->file_object->getFileType()
416 );
417 $this->updated = $this->pg_obj->update();
418 if ($this->updated === true) {
419 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
420 }
421 }
422
423 $_GET["subCmd"] = "-";
424 $this->newItemBefore();
425 }
newItemBefore()
insert new list item before current one

References $_GET, $ilUser, $res, $tree, $user, newFileItem(), and newItemBefore().

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

486 {
487 $this->content_obj->moveItemDown();
488 $_SESSION["il_pg_error"] = $this->pg_obj->update();
489 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
490 }

References $_SESSION.

◆ moveItemUp()

ilPCFileItemGUI::moveItemUp ( )

move list item up

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

496 {
497 $this->content_obj->moveItemUp();
498 $_SESSION["il_pg_error"] = $this->pg_obj->update();
499 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
500 }

References $_SESSION.

◆ newFileItem()

ilPCFileItemGUI::newFileItem ( )

insert new file item

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

101 {
103
104 if ($_FILES["file"]["name"] == "") {
105 $_GET["subCmd"] = "-";
106 ilUtil::sendFailure($lng->txt("upload_error_file_not_found"));
107 return false;
108 }
109
110 $form = $this->initAddFileForm();
111 $form->checkInput();
112
113 include_once("./Modules/File/classes/class.ilObjFile.php");
114 $fileObj = new ilObjFile();
115 $fileObj->setType("file");
116 $fileObj->setTitle($_FILES["file"]["name"]);
117 $fileObj->setDescription("");
118 $fileObj->setFileName($_FILES["file"]["name"]);
119 $fileObj->setFileType($_FILES["file"]["type"]);
120 $fileObj->setFileSize($_FILES["file"]["size"]);
121 $fileObj->setMode("filelist");
122 $fileObj->create();
123 // upload file to filesystem
124 $fileObj->createDirectory();
125 global $DIC;
126 $upload = $DIC->upload();
127 if ($upload->hasBeenProcessed() !== true) {
128 $upload->process();
129 }
130 $fileObj->getUploadFile(
131 $_FILES["file"]["tmp_name"],
132 $_FILES["file"]["name"]
133 );
134
135 $this->file_object = $fileObj;
136 return true;
137 }
initAddFileForm($a_before=true)
Init add file form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_GET, $DIC, ilPageContentGUI\$lng, initAddFileForm(), and ilUtil\sendFailure().

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

144 {
145 $ilTabs = $this->tabs;
146
147 if ($_GET["subCmd"] == "insertNew") {
148 $_SESSION["cont_file_insert"] = "insertNew";
149 }
150 if ($_GET["subCmd"] == "insertFromRepository") {
151 $_SESSION["cont_file_insert"] = "insertFromRepository";
152 }
153 if ($_GET["subCmd"] == "insertFromWorkspace") {
154 $_SESSION["cont_file_insert"] = "insertFromWorkspace";
155 }
156 if (($_GET["subCmd"] == "") && $_SESSION["cont_file_insert"] != "") {
157 $_GET["subCmd"] = $_SESSION["cont_file_insert"];
158 }
159
160 switch ($_GET["subCmd"]) {
161 case "insertFromWorkspace":
162 $this->insertFromWorkspace("newItemAfter");
163 break;
164
165 case "insertFromRepository":
166 $this->insertFromRepository("newItemAfter");
167 break;
168
169 case "selectFile":
170 $this->insertNewItemAfter($_GET["file_ref_id"]);
171 break;
172
173 default:
174 $this->setTabs("newItemAfter");
175 $ilTabs->setSubTabActive("cont_new_file");
176
177 $this->displayValidationError();
178 $form = $this->initAddFileForm(false);
179 $this->tpl->setContent($form->getHTML());
180break;
181
182 // new file list form
183 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.file_item_edit.html", "Services/COPage");
184 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_file_item"));
185 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
186
187 $this->displayValidationError();
188
189 // file
190 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file"));
191
192 $this->tpl->parseCurrentBlock();
193
194 // operations
195 $this->tpl->setCurrentBlock("commands");
196 $this->tpl->setVariable("BTN_NAME", "insertNewItemAfter");
197 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
198 $this->tpl->parseCurrentBlock();
199 break;
200 }
201 }
insertNewItemAfter($a_file_ref_id=0)
insert new file item after another item
insertFromRepository($a_cmd)
Insert file from repository.
insertFromWorkspace($a_cmd="insert")
Insert file from personal workspace.
displayValidationError()
display validation errors

References $_GET, $_SESSION, $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 329 of file class.ilPCFileItemGUI.php.

330 {
331 $ilTabs = $this->tabs;
332
333 if ($_GET["subCmd"] == "insertNew") {
334 $_SESSION["cont_file_insert"] = "insertNew";
335 }
336 if ($_GET["subCmd"] == "insertFromRepository") {
337 $_SESSION["cont_file_insert"] = "insertFromRepository";
338 }
339 if ($_GET["subCmd"] == "insertFromWorkspace") {
340 $_SESSION["cont_file_insert"] = "insertFromWorkspace";
341 }
342 if (($_GET["subCmd"] == "") && $_SESSION["cont_file_insert"] != "") {
343 $_GET["subCmd"] = $_SESSION["cont_file_insert"];
344 }
345
346 switch ($_GET["subCmd"]) {
347 case "insertFromWorkspace":
348 $this->insertFromWorkspace("newItemBefore");
349 break;
350
351 case "insertFromRepository":
352 $this->insertFromRepository("newItemBefore");
353 break;
354
355 case "selectFile":
356 $this->insertNewItemBefore($_GET["file_ref_id"]);
357 break;
358
359 default:
360 $this->setTabs("newItemBefore");
361 $ilTabs->setSubTabActive("cont_new_file");
362
363 $this->displayValidationError();
364 $form = $this->initAddFileForm(true);
365 $this->tpl->setContent($form->getHTML());
366break;
367
368 // new file list form
369 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.file_item_edit.html", "Services/COPage");
370 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_file_item"));
371 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
372
373 $this->displayValidationError();
374
375 // file
376 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file"));
377
378 $this->tpl->parseCurrentBlock();
379
380 // operations
381 $this->tpl->setCurrentBlock("commands");
382 $this->tpl->setVariable("BTN_NAME", "insertNewItemBefore");
383 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
384 $this->tpl->parseCurrentBlock();
385 break;
386 }
387 }
insertNewItemBefore($a_file_ref_id=0)
insert new list item before current one

References $_GET, $_SESSION, $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:

◆ setTabs()

ilPCFileItemGUI::setTabs (   $a_cmd = "")

output tabs

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

441 {
442 $ilTabs = $this->tabs;
443 $ilCtrl = $this->ctrl;
445
446 $ilTabs->addTarget(
447 "cont_back",
448 $this->ctrl->getParentReturn($this),
449 "",
450 ""
451 );
452
453 if ($a_cmd != "") {
454 $ilCtrl->setParameter($this, "subCmd", "insertNew");
455 $ilTabs->addSubTabTarget(
456 "cont_new_file",
457 $ilCtrl->getLinkTarget($this, $a_cmd),
458 $a_cmd
459 );
460
461 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
462 $ilTabs->addSubTabTarget(
463 "cont_file_from_repository",
464 $ilCtrl->getLinkTarget($this, $a_cmd),
465 $a_cmd
466 );
467 $ilCtrl->setParameter($this, "subCmd", "");
468
469 if (!$ilSetting->get("disable_personal_workspace") &&
470 !$ilSetting->get("disable_wsp_files")) {
471 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
472 $ilTabs->addSubTabTarget(
473 "cont_file_from_workspace",
474 $ilCtrl->getLinkTarget($this, $a_cmd),
475 $a_cmd
476 );
477 $ilCtrl->setParameter($this, "subCmd", "");
478 }
479 }
480 }
global $ilSetting
Definition: privfeed.php:17

References ilPageContentGUI\$ctrl, $ilSetting, $settings, and $tabs.

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

+ Here is the caller graph for this function:

Field Documentation

◆ $settings

ilPCFileItemGUI::$settings
protected

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

Referenced by setTabs().

◆ $tabs

ilPCFileItemGUI::$tabs
protected

◆ $tree

ilPCFileItemGUI::$tree
protected

◆ $user

ilPCFileItemGUI::$user
protected

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