ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPCFileListGUI Class Reference

Class ilPCListGUI. More...

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

Public Member Functions

 __construct (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 insert ($a_form=null)
 insert new file list form More...
 
 selectFile ()
 Select file. More...
 
 insertFromRepository ($a_cmd="insert")
 Insert file from repository. More...
 
 insertFromWorkspace ($a_cmd="insert")
 Insert file from personal workspace. More...
 
 create ()
 create new file list in dom and update page in db More...
 
 edit ()
 edit properties form More...
 
 initEditForm ($a_mode="edit")
 Init edit form. More...
 
 saveProperties ()
 save table properties in db and return to page edit screen More...
 
 editFiles ()
 Edit Files. More...
 
 setTabs ($a_create=true)
 Set Tabs. More...
 
 addFileItem ()
 Add file item. More...
 
 deleteFileItem ()
 Delete file items from list. More...
 
 savePositions ()
 Save positions of file items. More...
 
 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 ($a_file_ref_id=0)
 insert new file item after another item More...
 
 createFileItem ()
 insert new file item More...
 
 setItemTabs ($a_cmd="")
 output tabs More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor 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

 $user
 
 $tabs
 
 $tree
 
 $toolbar
 
 $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 ilPCListGUI.

User Interface for LM List Editing

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor public.

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

References $DIC, ilPageContentGUI\setCharacteristics(), settings(), and user().

50  {
51  global $DIC;
52 
53  $this->user = $DIC->user();
54  $this->tabs = $DIC->tabs();
55  $this->ctrl = $DIC->ctrl();
56  $this->tpl = $DIC["tpl"];
57  $this->tree = $DIC->repositoryTree();
58  $this->lng = $DIC->language();
59  $this->toolbar = $DIC->toolbar();
60  $this->settings = $DIC->settings();
61  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
62  $this->setCharacteristics(array("FileListItem" => $this->lng->txt("cont_FileListItem")));
63  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
setCharacteristics($a_chars)
Set Characteristics.
+ 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 511 of file class.ilPCFileListGUI.php.

References ilPageContentGUI\$ctrl, $files, and $ilCtrl.

512  {
514 
515  $files = $this->content_obj->getFileList();
516 
517  if (count($files) >= 1) {
518  $ilCtrl->setParameterByClass(
519  "ilpcfileitemgui",
520  "hier_id",
521  $files[count($files) - 1]["hier_id"]
522  );
523  $ilCtrl->setParameterByClass(
524  "ilpcfileitemgui",
525  "pc_id",
526  $files[count($files) - 1]["pc_id"]
527  );
528  $ilCtrl->redirectByClass("ilpcfileitemgui", "newItemAfter");
529  } else {
530  $ilCtrl->redirect($this, "newFileItem");
531  }
532  }
$files
Definition: metarefresh.php:49
global $ilCtrl
Definition: ilias.php:18

◆ checkStyleSelection()

ilPCFileListGUI::checkStyleSelection ( )

Checks whether style selection shoudl be available or not.

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

References ilPageContentGUI\getCharacteristics().

587  {
588  // check whether there is more than one style class
589  $chars = $this->getCharacteristics();
590 
591  $classes = $this->content_obj->getAllClasses();
592  if (count($chars) > 1) {
593  return true;
594  }
595  foreach ($classes as $class) {
596  if ($class != "" && $class != "FileListItem") {
597  return true;
598  }
599  }
600  return false;
601  }
getCharacteristics()
Get characteristics.
+ 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 220 of file class.ilPCFileListGUI.php.

References $_GET, $_POST, $_SESSION, $DIC, $form, ilPageContentGUI\getPage(), initEditForm(), insert(), and ilUtil\stripSlashes().

221  {
222  global $DIC;
223 
224  include_once("./Modules/File/classes/class.ilObjFile.php");
225 
226  $mode = ($_POST["file_ref_id"] != "")
227  ? "select_file"
228  : "create";
229  $form = $this->initEditForm($mode);
230  if (!$form->checkInput()) {
231  $form->setValuesByPost();
232  $this->insert($form);
233  return;
234  }
235 
236  // from personal workspace
237  if (substr($_POST["file_ref_id"], 0, 4) == "wsp_") {
238  $fileObj = new ilObjFile(substr($_POST["file_ref_id"], 4), false);
239  }
240  // upload
241  elseif ($_POST["file_ref_id"] == 0) {
242  $fileObj = new ilObjFile();
243  $fileObj->setType("file");
244  $fileObj->setTitle($_FILES["file"]["name"]);
245  $fileObj->setDescription("");
246  $fileObj->setFileName($_FILES["file"]["name"]);
247  $fileObj->setFileType($_FILES["file"]["type"]);
248  $fileObj->setFileSize($_FILES["file"]["size"]);
249  $fileObj->setMode("filelist");
250  $fileObj->create();
251  // upload file to filesystem
252  $fileObj->createDirectory();
253  $fileObj->raiseUploadError(false);
254 
255  $upload = $DIC->upload();
256  if ($upload->hasBeenProcessed() !== true) {
257  $upload->process();
258  }
259 
260  $fileObj->getUploadFile(
261  $_FILES["file"]["tmp_name"],
262  $_FILES["file"]["name"]
263  );
264  }
265  // from repository
266  else {
267  $fileObj = new ilObjFile($_POST["file_ref_id"]);
268  }
269  $_SESSION["il_text_lang_" . $_GET["ref_id"]] = $_POST["flst_language"];
270 
271  //echo "::".is_object($this->dom).":";
272  $this->content_obj = new ilPCFileList($this->getPage());
273  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
274  $this->content_obj->setListTitle(ilUtil::stripSlashes($_POST["flst_title"]), $_POST["flst_language"]);
275  $this->content_obj->appendItem(
276  $fileObj->getId(),
277  $fileObj->getFileName(),
278  $fileObj->getFileType()
279  );
280 
281  $this->updated = $this->pg_obj->update();
282  if ($this->updated === true) {
283  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
284  } else {
285  $this->insert();
286  }
287  }
$_SESSION["AccountId"]
initEditForm($a_mode="edit")
Init edit form.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
insert($a_form=null)
insert new file list form
if(isset($_POST['submit'])) $form
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Class ilPCFileList.
$_POST["username"]
+ Here is the call graph for this function:

◆ createFileItem()

ilPCFileListGUI::createFileItem ( )

insert new file item

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

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

Referenced by insertNewFileItem().

704  {
705  global $DIC;
706 
707  $lng = $this->lng;
708 
709  if ($_FILES["file"]["name"] == "") {
710  $_GET["subCmd"] = "-";
711  ilUtil::sendFailure($lng->txt("upload_error_file_not_found"));
712  return false;
713  }
714 
715  $form = $this->initEditForm();
716  // see #22541
717  // $form->checkInput();
718 
719  include_once("./Modules/File/classes/class.ilObjFile.php");
720  $fileObj = new ilObjFile();
721  $fileObj->setType("file");
722  $fileObj->setTitle($_FILES["file"]["name"]);
723  $fileObj->setDescription("");
724  $fileObj->setVersion(0);
725  $fileObj->setMaxVersion(0);
726  $fileObj->setFileName($_FILES["file"]["name"]);
727  $fileObj->setFileType($_FILES["file"]["type"]);
728  $fileObj->setFileSize($_FILES["file"]["size"]);
729  $fileObj->setMode("filelist");
730  $fileObj->create();
731  $fileObj->createDirectory();
732  $fileObj->raiseUploadError(false);
733  $fileObj->getUploadFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
734  // upload file to filesystem
735 
736  return $fileObj;
737  }
initEditForm($a_mode="edit")
Init edit form.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
if(isset($_POST['submit'])) $form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFileItem()

ilPCFileListGUI::deleteFileItem ( )

Delete file items from list.

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

References $_POST, ilPageContentGUI\$ctrl, and $ilCtrl.

538  {
540 
541  if (is_array($_POST["fid"])) {
542  $ids = array();
543  foreach ($_POST["fid"] as $k => $v) {
544  $ids[] = $k;
545  }
546  $this->content_obj->deleteFileItems($ids);
547  }
548  $this->updated = $this->pg_obj->update();
549  $ilCtrl->redirect($this, "editFiles");
550  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ edit()

ilPCFileListGUI::edit ( )

edit properties form

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

References $form, initEditForm(), and setTabs().

Referenced by saveProperties().

293  {
294  $this->setTabs(false);
295 
296  $form = $this->initEditForm();
297  $this->tpl->setContent($form->getHTML());
298  }
setTabs($a_create=true)
Set Tabs.
initEditForm($a_mode="edit")
Init edit form.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editFiles()

ilPCFileListGUI::editFiles ( )

Edit Files.

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

References ilPageContentGUI\$ctrl, $ilCtrl, ilPageContentGUI\$lng, $toolbar, ilPageContentGUI\$tpl, and setTabs().

429  {
430  $tpl = $this->tpl;
431  $ilToolbar = $this->toolbar;
433  $lng = $this->lng;
434 
435  $this->setTabs(false);
436 
437  $ilToolbar->addButton(
438  $lng->txt("cont_add_file"),
439  $ilCtrl->getLinkTarget($this, "addFileItem")
440  );
441 
442  include_once("./Services/COPage/classes/class.ilPCFileListTableGUI.php");
443  $table_gui = new ilPCFileListTableGUI($this, "editFiles", $this->content_obj);
444  $tpl->setContent($table_gui->getHTML());
445  }
setTabs($a_create=true)
Set Tabs.
global $ilCtrl
Definition: ilias.php:18
TableGUI class for file list.
+ Here is the call graph for this function:

◆ executeCommand()

ilPCFileListGUI::executeCommand ( )

execute command

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

References $ret, and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

69  {
70  // get next class that processes or forwards current command
71  $next_class = $this->ctrl->getNextClass($this);
72 
73  $this->getCharacteristicsOfCurrentStyle("flist_li"); // scorm-2004
74 
75  // get current command
76  $cmd = $this->ctrl->getCmd();
77 
78  switch ($next_class) {
79  default:
80  $ret = $this->$cmd();
81  break;
82  }
83 
84  return $ret;
85  }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ initEditForm()

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

Init edit form.

Parameters
int$a_modeEdit Mode

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

References $_GET, $_SESSION, ilPageContentGUI\$ctrl, $form, $ilCtrl, $ilUser, $lang, ilPageContentGUI\$lng, $si, $tree, $user, ilMDLanguageItem\_getLanguages(), ilTextInputGUI\setMaxLength(), and ilFormPropertyGUI\setRequired().

Referenced by create(), createFileItem(), edit(), insert(), newFileItem(), and selectFile().

306  {
307  $lng = $this->lng;
310 
311  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
312  $form = new ilPropertyFormGUI();
313 
314  if ($a_mode != "add_file") {
315  // title
316  $ti = new ilTextInputGUI($lng->txt("title"), "flst_title");
317  $ti->setMaxLength(80);
318  $ti->setSize(40);
319  $form->addItem($ti);
320 
321  // language
322  require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
324  $si = new ilSelectInputGUI($lng->txt("language"), "flst_language");
325  $si->setOptions($lang);
326  $form->addItem($si);
327  }
328 
329  if (in_array($a_mode, array("create", "add_file"))) {
330  // file
331  $fi = new ilFileInputGUI($lng->txt("file"), "file");
332  $fi->setRequired(true);
333  $form->addItem($fi);
334  } elseif (in_array($a_mode, array("select_file"))) {
335  // file
336  $ne = new ilNonEditableValueGUI($lng->txt("file"), "");
337 
338  if (isset($_GET["file_ref_id"])) {
339  include_once("./Modules/File/classes/class.ilObjFile.php");
340  $file_obj = new ilObjFile((int) $_GET["file_ref_id"]);
341  if (is_object($file_obj)) {
342  // ref id as hidden input
343  $hi = new ilHiddenInputGUI("file_ref_id");
344  $hi->setValue((int) $_GET["file_ref_id"]);
345  $form->addItem($hi);
346 
347  $ne->setValue($file_obj->getTitle());
348  }
349  } elseif (isset($_GET["fl_wsp_id"])) {
350  // we need the object id for the instance
351  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
352  $tree = new ilWorkspaceTree($ilUser->getId());
353  $node = $tree->getNodeData((int) $_GET["fl_wsp_id"]);
354 
355  include_once("./Modules/File/classes/class.ilObjFile.php");
356  $file_obj = new ilObjFile($node["obj_id"], false);
357  if (is_object($file_obj)) {
358  // ref id as hidden input
359  $hi = new ilHiddenInputGUI("file_ref_id");
360  $hi->setValue("wsp_" . (int) $node["obj_id"]);
361  $form->addItem($hi);
362 
363  $ne->setValue($file_obj->getTitle());
364  }
365  $this->tpl->parseCurrentBlock();
366  }
367 
368  $form->addItem($ne);
369  }
370 
371 
372  switch ($a_mode) {
373  case "edit":
374  $ti->setValue($this->content_obj->getListTitle());
375  $si->setValue($this->content_obj->getLanguage());
376  $form->addCommandButton("saveProperties", $lng->txt("save"));
377  $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
378  $form->setTitle($lng->txt("cont_edit_file_list_properties"));
379  break;
380 
381  case "create":
382  case "select_file":
383  if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
384  $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
385  } else {
386  $s_lang = $ilUser->getLanguage();
387  }
388  $si->setValue($s_lang);
389  $form->addCommandButton("create_flst", $lng->txt("save"));
390  $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
391  $form->setTitle($lng->txt("cont_insert_file_list"));
392  break;
393 
394  case "add_file":
395  $form->addCommandButton("insertNewFileItem", $lng->txt("save"));
396  $form->addCommandButton("editFiles", $lng->txt("cancel"));
397  $form->setTitle($lng->txt("cont_insert_file_item"));
398  break;
399  }
400 
401  $form->setFormAction($ilCtrl->getFormAction($this));
402 
403  return $form;
404  }
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
This class represents a property form user interface.
$_GET["client_id"]
This class represents a file property in a property form.
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
setMaxLength($a_maxlength)
Set Max Length.
This class represents a non editable value in a property form.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCFileListGUI::insert (   $a_form = null)

insert new file list form

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

References $_GET, $_SESSION, $form, $ilUser, $tabs, $user, ilPageContentGUI\displayValidationError(), initEditForm(), insertFromRepository(), insertFromWorkspace(), selectFile(), and setTabs().

Referenced by create().

91  {
93  $ilTabs = $this->tabs;
94 
95  if ($_GET["subCmd"] == "insertNew") {
96  $_SESSION["cont_file_insert"] = "insertNew";
97  }
98  if ($_GET["subCmd"] == "insertFromRepository") {
99  $_SESSION["cont_file_insert"] = "insertFromRepository";
100  }
101  if ($_GET["subCmd"] == "insertFromWorkspace") {
102  $_SESSION["cont_file_insert"] = "insertFromWorkspace";
103  }
104  if (($_GET["subCmd"] == "") && $_SESSION["cont_file_insert"] != "") {
105  $_GET["subCmd"] = $_SESSION["cont_file_insert"];
106  }
107 
108  switch ($_GET["subCmd"]) {
109  case "insertFromWorkspace":
110  $this->insertFromWorkspace();
111  break;
112 
113  case "insertFromRepository":
114  $this->insertFromRepository();
115  break;
116 
117  case "selectFile":
118  $this->selectFile();
119  break;
120 
121  default:
122  $this->setTabs();
123  $ilTabs->setSubTabActive("cont_new_file");
124 
125  $this->displayValidationError();
126 
127  if ($a_form != null) {
128  $form = $a_form;
129  } else {
130  $form = $this->initEditForm("create");
131  }
132  $this->tpl->setContent($form->getHTML());
133  break;
134  }
135  }
insertFromWorkspace($a_cmd="insert")
Insert file from personal workspace.
$_SESSION["AccountId"]
setTabs($a_create=true)
Set Tabs.
initEditForm($a_mode="edit")
Init edit form.
selectFile()
Select file.
$_GET["client_id"]
if(isset($_POST['submit'])) $form
displayValidationError()
display validation errors
$ilUser
Definition: imgupload.php:18
insertFromRepository($a_cmd="insert")
Insert file from repository.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertFromRepository()

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

Insert file from repository.

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

References ilPageContentGUI\$ctrl, $ilCtrl, $tabs, ilPageContentGUI\$tpl, setItemTabs(), and setTabs().

Referenced by insert(), and newFileItem().

158  {
159  $ilTabs = $this->tabs;
161  $tpl = $this->tpl;
162 
163  if ($a_cmd == "insert") {
164  $this->setTabs();
165  } else {
166  $this->setItemTabs($a_cmd);
167  }
168 
169  $ilTabs->setSubTabActive("cont_file_from_repository");
170  $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
171 
172  include_once("./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
173  $exp = new ilPCFileItemFileSelectorGUI(
174  $this,
175  $a_cmd,
176  $this,
177  $a_cmd,
178  "file_ref_id"
179  );
180  if (!$exp->handleCommand()) {
181  $tpl->setContent($exp->getHTML());
182  }
183  }
setTabs($a_create=true)
Set Tabs.
setItemTabs($a_cmd="")
output tabs
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertFromWorkspace()

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

Insert file from personal workspace.

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

References ilPageContentGUI\$ctrl, $ilCtrl, $ilUser, $tabs, ilPageContentGUI\$tpl, $tree, $user, setItemTabs(), and setTabs().

Referenced by insert(), and newFileItem().

189  {
190  $ilTabs = $this->tabs;
191  $tree = $this->tree;
193  $tpl = $this->tpl;
195 
196  if ($a_cmd == "insert") {
197  $this->setTabs();
198  } else {
199  $this->setItemTabs($a_cmd);
200  }
201 
202  $ilTabs->setSubTabActive("cont_file_from_workspace");
203 
204  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
205  $exp = new ilWorkspaceExplorerGUI($ilUser->getId(), $this, $a_cmd, $this, $a_cmd, "fl_wsp_id");
206  $ilCtrl->setParameter($this, "subCmd", "selectFile");
207  $exp->setCustomLinkTarget($ilCtrl->getLinkTarget($this, $a_cmd));
208  $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
209  $exp->setTypeWhiteList(array("wsrt", "wfld", "file"));
210  $exp->setSelectableTypes(array("file"));
211  if ($exp->handleCommand()) {
212  return;
213  }
214  $tpl->setContent($exp->getHTML());
215  }
setTabs($a_create=true)
Set Tabs.
setItemTabs($a_cmd="")
output tabs
global $ilCtrl
Definition: ilias.php:18
Explorer for selecting a personal workspace item.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertNewFileItem()

ilPCFileListGUI::insertNewFileItem (   $a_file_ref_id = 0)

insert new file item after another item

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

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

Referenced by newFileItem().

661  {
663 
664  // from personal workspace
665  if (isset($_GET["fl_wsp_id"])) {
666  // we need the object id for the instance
667  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
668  $tree = new ilWorkspaceTree($ilUser->getId());
669  $node = $tree->getNodeData($_GET["fl_wsp_id"]);
670 
671  include_once("./Modules/File/classes/class.ilObjFile.php");
672  $file_obj = new ilObjFile($node["obj_id"], false);
673  }
674  // upload
675  elseif ($a_file_ref_id == 0) {
676  $file_obj = $this->createFileItem();
677  }
678  // from repository
679  else {
680  include_once("./Modules/File/classes/class.ilObjFile.php");
681  $file_obj = new ilObjFile($a_file_ref_id);
682  }
683  if (is_object($file_obj)) {
684  $this->content_obj->appendItem(
685  $file_obj->getId(),
686  $file_obj->getTitle(),
687  $file_obj->getFileType()
688  );
689  $this->updated = $this->pg_obj->update();
690  if ($this->updated === true) {
691  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
692  $this->ctrl->redirect($this, "editFiles");
693  }
694  }
695 
696  $_GET["subCmd"] = "-";
697  $this->newFileItem();
698  }
newFileItem()
New file item (called, if there is no file item in an existing)
createFileItem()
insert new file item
$_GET["client_id"]
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newFileItem()

ilPCFileListGUI::newFileItem ( )

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

Parameters

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

References $_GET, $_SESSION, $form, $tabs, ilPageContentGUI\displayValidationError(), initEditForm(), insertFromRepository(), insertFromWorkspace(), insertNewFileItem(), and setItemTabs().

Referenced by insertNewFileItem().

616  {
617  $ilTabs = $this->tabs;
618 
619  if ($_GET["subCmd"] == "insertNew") {
620  $_SESSION["cont_file_insert"] = "insertNew";
621  }
622  if ($_GET["subCmd"] == "insertFromRepository") {
623  $_SESSION["cont_file_insert"] = "insertFromRepository";
624  }
625  if ($_GET["subCmd"] == "insertFromWorkspace") {
626  $_SESSION["cont_file_insert"] = "insertFromWorkspace";
627  }
628  if (($_GET["subCmd"] == "") && $_SESSION["cont_file_insert"] != "") {
629  $_GET["subCmd"] = $_SESSION["cont_file_insert"];
630  }
631 
632  switch ($_GET["subCmd"]) {
633  case "insertFromWorkspace":
634  $this->insertFromWorkspace("newFileItem");
635  break;
636 
637  case "insertFromRepository":
638  $this->insertFromRepository("newFileItem");
639  break;
640 
641  case "selectFile":
642  $this->insertNewFileItem($_GET["file_ref_id"]);
643  break;
644 
645  default:
646  $this->setItemTabs("newFileItem");
647  $ilTabs->setSubTabActive("cont_new_file");
648 
649  $this->displayValidationError();
650 
651  $form = $this->initEditForm("add_file");
652  $this->tpl->setContent($form->getHTML());
653  break;
654  }
655  }
insertFromWorkspace($a_cmd="insert")
Insert file from personal workspace.
$_SESSION["AccountId"]
setItemTabs($a_cmd="")
output tabs
initEditForm($a_mode="edit")
Init edit form.
$_GET["client_id"]
insertNewFileItem($a_file_ref_id=0)
insert new file item after another item
if(isset($_POST['submit'])) $form
displayValidationError()
display validation errors
insertFromRepository($a_cmd="insert")
Insert file from repository.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePositions()

ilPCFileListGUI::savePositions ( )

Save positions of file items.

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

References $_POST, ilPageContentGUI\$ctrl, and $ilCtrl.

556  {
558 
559  if (is_array($_POST["position"])) {
560  $this->content_obj->savePositions($_POST["position"]);
561  }
562  $this->updated = $this->pg_obj->update();
563  $ilCtrl->redirect($this, "editFiles");
564  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ savePositionsAndClasses()

ilPCFileListGUI::savePositionsAndClasses ( )

Save positions of file items and style classes.

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

References $_POST, ilPageContentGUI\$ctrl, and $ilCtrl.

570  {
572 
573  if (is_array($_POST["position"])) {
574  $this->content_obj->savePositions($_POST["position"]);
575  }
576  if (is_array($_POST["class"])) {
577  $this->content_obj->saveStyleClasses($_POST["class"]);
578  }
579  $this->updated = $this->pg_obj->update();
580  $ilCtrl->redirect($this, "editFiles");
581  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ saveProperties()

ilPCFileListGUI::saveProperties ( )

save table properties in db and return to page edit screen

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

References $_POST, edit(), and ilUtil\stripSlashes().

411  {
412  $this->content_obj->setListTitle(
413  ilUtil::stripSlashes($_POST["flst_title"]),
414  ilUtil::stripSlashes($_POST["flst_language"])
415  );
416  $this->updated = $this->pg_obj->update();
417  if ($this->updated === true) {
418  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
419  } else {
420  $this->pg_obj->addHierIDs();
421  $this->edit();
422  }
423  }
edit()
edit properties form
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ selectFile()

ilPCFileListGUI::selectFile ( )

Select file.

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

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

Referenced by insert().

141  {
142  $ilTabs = $this->tabs;
144 
145  $this->setTabs();
146  $ilTabs->setSubTabActive("cont_file_from_repository");
147 
148  $this->displayValidationError();
149  $form = $this->initEditForm("select_file");
150 
151  $this->tpl->setContent($form->getHTML());
152  }
setTabs($a_create=true)
Set Tabs.
initEditForm($a_mode="edit")
Init edit form.
if(isset($_POST['submit'])) $form
displayValidationError()
display validation errors
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setItemTabs()

ilPCFileListGUI::setItemTabs (   $a_cmd = "")

output tabs

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

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

Referenced by insertFromRepository(), insertFromWorkspace(), and newFileItem().

744  {
745  $ilTabs = $this->tabs;
748 
749  $ilTabs->addTarget(
750  "cont_back",
751  $this->ctrl->getParentReturn($this),
752  "",
753  ""
754  );
755 
756  if ($a_cmd != "") {
757  $ilCtrl->setParameter($this, "subCmd", "insertNew");
758  $ilTabs->addSubTabTarget(
759  "cont_new_file",
760  $ilCtrl->getLinkTarget($this, $a_cmd),
761  $a_cmd
762  );
763 
764  $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
765  $ilTabs->addSubTabTarget(
766  "cont_file_from_repository",
767  $ilCtrl->getLinkTarget($this, $a_cmd),
768  $a_cmd
769  );
770  $ilCtrl->setParameter($this, "subCmd", "");
771 
772  if (!$ilSetting->get("disable_personal_workspace") &&
773  !$ilSetting->get("disable_wsp_files")) {
774  $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
775  $ilTabs->addSubTabTarget(
776  "cont_file_from_workspace",
777  $ilCtrl->getLinkTarget($this, $a_cmd),
778  $a_cmd
779  );
780  $ilCtrl->setParameter($this, "subCmd", "");
781  }
782  }
783  }
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ setTabs()

ilPCFileListGUI::setTabs (   $a_create = true)

Set Tabs.

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

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

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

451  {
452  $ilTabs = $this->tabs;
454  $lng = $this->lng;
456 
457  if ($a_create) {
458  $cmd = "insert";
459 
460  $ilCtrl->setParameter($this, "subCmd", "insertNew");
461  $ilTabs->addSubTabTarget(
462  "cont_new_file",
463  $ilCtrl->getLinkTarget($this, $cmd),
464  $cmd
465  );
466 
467  $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
468  $ilTabs->addSubTabTarget(
469  "cont_file_from_repository",
470  $ilCtrl->getLinkTarget($this, $cmd),
471  $cmd
472  );
473  $ilCtrl->setParameter($this, "subCmd", "");
474 
475  if (!$ilSetting->get("disable_personal_workspace") &&
476  !$ilSetting->get("disable_wsp_files")) {
477  $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
478  $ilTabs->addSubTabTarget(
479  "cont_file_from_workspace",
480  $ilCtrl->getLinkTarget($this, $cmd),
481  $cmd
482  );
483  $ilCtrl->setParameter($this, "subCmd", "");
484  }
485  } else {
486  $ilTabs->setBackTarget(
487  $lng->txt("pg"),
488  $this->ctrl->getParentReturn($this)
489  );
490 
491  $ilTabs->addTarget(
492  "cont_ed_edit_files",
493  $ilCtrl->getLinkTarget($this, "editFiles"),
494  "editFiles",
495  get_class($this)
496  );
497 
498  $ilTabs->addTarget(
499  "cont_ed_edit_prop",
500  $ilCtrl->getLinkTarget($this, "edit"),
501  "edit",
502  get_class($this)
503  );
504  }
505  }
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

Field Documentation

◆ $settings

ilPCFileListGUI::$settings
protected

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

Referenced by setItemTabs(), and setTabs().

◆ $tabs

ilPCFileListGUI::$tabs
protected

◆ $toolbar

ilPCFileListGUI::$toolbar
protected

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

Referenced by editFiles().

◆ $tree

ilPCFileListGUI::$tree
protected

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

Referenced by initEditForm(), insertFromWorkspace(), and insertNewFileItem().

◆ $user

ilPCFileListGUI::$user
protected

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