ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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...
 
 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
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- 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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46

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

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

◆ deleteItem()

ilPCFileItemGUI::deleteItem ( )

delete a list item

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

432 {
433 $this->content_obj->deleteItem();
434 $_SESSION["il_pg_error"] = $this->pg_obj->update();
435 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
436 }
$_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 207 of file class.ilPCFileItemGUI.php.

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

References ilPageContentGUI\$ctrl, $ilCtrl, $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 239 of file class.ilPCFileItemGUI.php.

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

References ilPageContentGUI\$ctrl, $ilCtrl, $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 265 of file class.ilPCFileItemGUI.php.

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

References ilPageContentGUI\$ctrl, $ilCtrl, $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 292 of file class.ilPCFileItemGUI.php.

293 {
295
296 $res = true;
297 if (isset($_GET["fl_wsp_id"])) {
298 // we need the object id for the instance
299 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
300 $tree = new ilWorkspaceTree($ilUser->getId());
301 $node = $tree->getNodeData($_GET["fl_wsp_id"]);
302
303 include_once("./Modules/File/classes/class.ilObjFile.php");
304 $this->file_object = new ilObjFile($node["obj_id"], false);
305 } elseif ($a_file_ref_id == 0) {
306 $res = $this->newFileItem();
307 } else {
308 include_once("./Modules/File/classes/class.ilObjFile.php");
309 $this->file_object = new ilObjFile($a_file_ref_id);
310 }
311 if ($res) {
312 $this->content_obj->newItemAfter(
313 $this->file_object->getId(),
314 $this->file_object->getTitle(),
315 $this->file_object->getFileType()
316 );
317 $this->updated = $this->pg_obj->update();
318 if ($this->updated === true) {
319 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
320 }
321 }
322
323 $_GET["subCmd"] = "-";
324 $this->newItemAfter();
325 }
$_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 393 of file class.ilPCFileItemGUI.php.

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

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

References $_SESSION.

◆ moveItemUp()

ilPCFileItemGUI::moveItemUp ( )

move list item up

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

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

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 $fileObj->raiseUploadError(false);
124 // upload file to filesystem
125 $fileObj->createDirectory();
126 global $DIC;
127 $upload = $DIC->upload();
128 if ($upload->hasBeenProcessed() !== true) {
129 $upload->process();
130 }
131 $fileObj->getUploadFile(
132 $_FILES["file"]["tmp_name"],
133 $_FILES["file"]["name"]
134 );
135
136 $this->file_object = $fileObj;
137 return true;
138 }
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 144 of file class.ilPCFileItemGUI.php.

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

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

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

References ilPageContentGUI\$ctrl, $ilCtrl, $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: