ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancelAddFile()

ilPCFileItemGUI::cancelAddFile ( )

Cancel adding a file.

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

502 {
503 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
504 }

◆ deleteItem()

ilPCFileItemGUI::deleteItem ( )

delete a list item

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

427 {
428 $this->content_obj->deleteItem();
429 $_SESSION["il_pg_error"] = $this->pg_obj->update();
430 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
431 }
$_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 202 of file class.ilPCFileItemGUI.php.

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

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

235 {
236 $ilTabs = $this->tabs;
239
240 $this->setTabs($a_cmd);
241 $ilTabs->setSubTabActive("cont_file_from_repository");
242 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
243
244 include_once("./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
246 $this,
247 $a_cmd,
248 $this,
249 $a_cmd,
250 "file_ref_id"
251 );
252 if (!$exp->handleCommand()) {
253 $tpl->setContent($exp->getHTML());
254 }
255 }
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 260 of file class.ilPCFileItemGUI.php.

261 {
262 $ilTabs = $this->tabs;
267
268 $this->setTabs($a_cmd);
269 $ilTabs->setSubTabActive("cont_file_from_workspace");
270
271 include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
272 $exp = new ilWorkspaceExplorerGUI($this->user->getId(), $this, $a_cmd, $this, $a_cmd, "fl_wsp_id");
273 $ilCtrl->setParameter($this, "subCmd", "selectFile");
274 $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
275 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
276 $exp->setTypeWhiteList(array("wsrt", "wfld", "file"));
277 $exp->setSelectableTypes(array("file"));
278 if ($exp->handleCommand()) {
279 return;
280 }
281 $tpl->setContent($exp->getHTML());
282 }
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 287 of file class.ilPCFileItemGUI.php.

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

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

482 {
483 $this->content_obj->moveItemDown();
484 $_SESSION["il_pg_error"] = $this->pg_obj->update();
485 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
486 }

References $_SESSION.

◆ moveItemUp()

ilPCFileItemGUI::moveItemUp ( )

move list item up

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

492 {
493 $this->content_obj->moveItemUp();
494 $_SESSION["il_pg_error"] = $this->pg_obj->update();
495 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
496 }

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 $fileObj->getUploadFile(
127 $_FILES["file"]["tmp_name"],
128 $_FILES["file"]["name"]
129 );
130
131 $this->file_object = $fileObj;
132 return true;
133 }
initAddFileForm($a_before=true)
Init add file form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

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

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

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

437 {
438 $ilTabs = $this->tabs;
441
442 $ilTabs->addTarget(
443 "cont_back",
444 $this->ctrl->getParentReturn($this),
445 "",
446 ""
447 );
448
449 if ($a_cmd != "") {
450 $ilCtrl->setParameter($this, "subCmd", "insertNew");
451 $ilTabs->addSubTabTarget(
452 "cont_new_file",
453 $ilCtrl->getLinkTarget($this, $a_cmd),
454 $a_cmd
455 );
456
457 $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
458 $ilTabs->addSubTabTarget(
459 "cont_file_from_repository",
460 $ilCtrl->getLinkTarget($this, $a_cmd),
461 $a_cmd
462 );
463 $ilCtrl->setParameter($this, "subCmd", "");
464
465 if (!$ilSetting->get("disable_personal_workspace") &&
466 !$ilSetting->get("disable_wsp_files")) {
467 $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
468 $ilTabs->addSubTabTarget(
469 "cont_file_from_workspace",
470 $ilCtrl->getLinkTarget($this, $a_cmd),
471 $a_cmd
472 );
473 $ilCtrl->setParameter($this, "subCmd", "");
474 }
475 }
476 }
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: