ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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, array, 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  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
setCharacteristics($a_chars)
Set Characteristics.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ 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 503 of file class.ilPCFileListGUI.php.

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

504  {
506 
507  $files = $this->content_obj->getFileList();
508 
509  if (count($files) >= 1) {
510  $ilCtrl->setParameterByClass(
511  "ilpcfileitemgui",
512  "hier_id",
513  $files[count($files) - 1]["hier_id"]
514  );
515  $ilCtrl->setParameterByClass(
516  "ilpcfileitemgui",
517  "pc_id",
518  $files[count($files) - 1]["pc_id"]
519  );
520  $ilCtrl->redirectByClass("ilpcfileitemgui", "newItemAfter");
521  } else {
522  $ilCtrl->redirect($this, "newFileItem");
523  }
524  }
$files
Definition: add-vimline.php:18
global $ilCtrl
Definition: ilias.php:18

◆ checkStyleSelection()

ilPCFileListGUI::checkStyleSelection ( )

Checks whether style selection shoudl be available or not.

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

References ilPageContentGUI\getCharacteristics().

579  {
580  // check whether there is more than one style class
581  $chars = $this->getCharacteristics();
582 
583  $classes = $this->content_obj->getAllClasses();
584  if (count($chars) > 1) {
585  return true;
586  }
587  foreach ($classes as $class) {
588  if ($class != "" && $class != "FileListItem") {
589  return true;
590  }
591  }
592  return false;
593  }
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, $form, ilPageContentGUI\getPage(), initEditForm(), insert(), and ilUtil\stripSlashes().

221  {
222  include_once("./Modules/File/classes/class.ilObjFile.php");
223 
224  $mode = ($_POST["file_ref_id"] != "")
225  ? "select_file"
226  : "create";
227  $form = $this->initEditForm($mode);
228  if (!$form->checkInput()) {
229  $form->setValuesByPost();
230  $this->insert($form);
231  return;
232  }
233 
234  // from personal workspace
235  if (substr($_POST["file_ref_id"], 0, 4) == "wsp_") {
236  $fileObj = new ilObjFile(substr($_POST["file_ref_id"], 4), false);
237  }
238  // upload
239  elseif ($_POST["file_ref_id"] == 0) {
240  $fileObj = new ilObjFile();
241  $fileObj->setType("file");
242  $fileObj->setTitle($_FILES["file"]["name"]);
243  $fileObj->setDescription("");
244  $fileObj->setFileName($_FILES["file"]["name"]);
245  $fileObj->setFileType($_FILES["file"]["type"]);
246  $fileObj->setFileSize($_FILES["file"]["size"]);
247  $fileObj->setMode("filelist");
248  $fileObj->create();
249  // upload file to filesystem
250  $fileObj->createDirectory();
251  $fileObj->raiseUploadError(false);
252  $fileObj->getUploadFile(
253  $_FILES["file"]["tmp_name"],
254  $_FILES["file"]["name"]
255  );
256  }
257  // from repository
258  else {
259  $fileObj = new ilObjFile($_POST["file_ref_id"]);
260  }
261  $_SESSION["il_text_lang_" . $_GET["ref_id"]] = $_POST["flst_language"];
262 
263  //echo "::".is_object($this->dom).":";
264  $this->content_obj = new ilPCFileList($this->getPage());
265  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
266  $this->content_obj->setListTitle(ilUtil::stripSlashes($_POST["flst_title"]), $_POST["flst_language"]);
267  $this->content_obj->appendItem(
268  $fileObj->getId(),
269  $fileObj->getFileName(),
270  $fileObj->getFileType()
271  );
272 
273  $this->updated = $this->pg_obj->update();
274  if ($this->updated === true) {
275  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
276  } else {
277  $this->insert();
278  }
279  }
$_SESSION["AccountId"]
initEditForm($a_mode="edit")
Init edit form.
$_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 695 of file class.ilPCFileListGUI.php.

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

Referenced by insertNewFileItem().

696  {
697  $lng = $this->lng;
698 
699  if ($_FILES["file"]["name"] == "") {
700  $_GET["subCmd"] = "-";
701  ilUtil::sendFailure($lng->txt("upload_error_file_not_found"));
702  return false;
703  }
704 
705  $form = $this->initEditForm();
706  // see #22541
707  // $form->checkInput();
708 
709  include_once("./Modules/File/classes/class.ilObjFile.php");
710  $fileObj = new ilObjFile();
711  $fileObj->setType("file");
712  $fileObj->setTitle($_FILES["file"]["name"]);
713  $fileObj->setDescription("");
714  $fileObj->setFileName($_FILES["file"]["name"]);
715  $fileObj->setFileType($_FILES["file"]["type"]);
716  $fileObj->setFileSize($_FILES["file"]["size"]);
717  $fileObj->setMode("filelist");
718  $fileObj->create();
719  $fileObj->raiseUploadError(false);
720  // upload file to filesystem
721  $fileObj->createDirectory();
722  $fileObj->getUploadFile(
723  $_FILES["file"]["tmp_name"],
724  $_FILES["file"]["name"]
725  );
726 
727  return $fileObj;
728  }
initEditForm($a_mode="edit")
Init edit form.
$_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 529 of file class.ilPCFileListGUI.php.

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

530  {
532 
533  if (is_array($_POST["fid"])) {
534  $ids = array();
535  foreach ($_POST["fid"] as $k => $v) {
536  $ids[] = $k;
537  }
538  $this->content_obj->deleteFileItems($ids);
539  }
540  $this->updated = $this->pg_obj->update();
541  $ilCtrl->redirect($this, "editFiles");
542  }
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
$_POST["username"]

◆ edit()

ilPCFileListGUI::edit ( )

edit properties form

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

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

Referenced by saveProperties().

285  {
286  $this->setTabs(false);
287 
288  $form = $this->initEditForm();
289  $this->tpl->setContent($form->getHTML());
290  }
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 420 of file class.ilPCFileListGUI.php.

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

421  {
422  $tpl = $this->tpl;
423  $ilToolbar = $this->toolbar;
425  $lng = $this->lng;
426 
427  $this->setTabs(false);
428 
429  $ilToolbar->addButton(
430  $lng->txt("cont_add_file"),
431  $ilCtrl->getLinkTarget($this, "addFileItem")
432  );
433 
434  include_once("./Services/COPage/classes/class.ilPCFileListTableGUI.php");
435  $table_gui = new ilPCFileListTableGUI($this, "editFiles", $this->content_obj);
436  $tpl->setContent($table_gui->getHTML());
437  }
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 297 of file class.ilPCFileListGUI.php.

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

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

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

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

Referenced by newFileItem().

653  {
655 
656  // from personal workspace
657  if (isset($_GET["fl_wsp_id"])) {
658  // we need the object id for the instance
659  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
660  $tree = new ilWorkspaceTree($ilUser->getId());
661  $node = $tree->getNodeData($_GET["fl_wsp_id"]);
662 
663  include_once("./Modules/File/classes/class.ilObjFile.php");
664  $file_obj = new ilObjFile($node["obj_id"], false);
665  }
666  // upload
667  elseif ($a_file_ref_id == 0) {
668  $file_obj = $this->createFileItem();
669  }
670  // from repository
671  else {
672  include_once("./Modules/File/classes/class.ilObjFile.php");
673  $file_obj = new ilObjFile($a_file_ref_id);
674  }
675  if (is_object($file_obj)) {
676  $this->content_obj->appendItem(
677  $file_obj->getId(),
678  $file_obj->getTitle(),
679  $file_obj->getFileType()
680  );
681  $this->updated = $this->pg_obj->update();
682  if ($this->updated === true) {
683  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
684  $this->ctrl->redirect($this, "editFiles");
685  }
686  }
687 
688  $_GET["subCmd"] = "-";
689  $this->newFileItem();
690  }
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 607 of file class.ilPCFileListGUI.php.

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

Referenced by insertNewFileItem().

608  {
609  $ilTabs = $this->tabs;
610 
611  if ($_GET["subCmd"] == "insertNew") {
612  $_SESSION["cont_file_insert"] = "insertNew";
613  }
614  if ($_GET["subCmd"] == "insertFromRepository") {
615  $_SESSION["cont_file_insert"] = "insertFromRepository";
616  }
617  if ($_GET["subCmd"] == "insertFromWorkspace") {
618  $_SESSION["cont_file_insert"] = "insertFromWorkspace";
619  }
620  if (($_GET["subCmd"] == "") && $_SESSION["cont_file_insert"] != "") {
621  $_GET["subCmd"] = $_SESSION["cont_file_insert"];
622  }
623 
624  switch ($_GET["subCmd"]) {
625  case "insertFromWorkspace":
626  $this->insertFromWorkspace("newFileItem");
627  break;
628 
629  case "insertFromRepository":
630  $this->insertFromRepository("newFileItem");
631  break;
632 
633  case "selectFile":
634  $this->insertNewFileItem($_GET["file_ref_id"]);
635  break;
636 
637  default:
638  $this->setItemTabs("newFileItem");
639  $ilTabs->setSubTabActive("cont_new_file");
640 
641  $this->displayValidationError();
642 
643  $form = $this->initEditForm("add_file");
644  $this->tpl->setContent($form->getHTML());
645  break;
646  }
647  }
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 547 of file class.ilPCFileListGUI.php.

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

548  {
550 
551  if (is_array($_POST["position"])) {
552  $this->content_obj->savePositions($_POST["position"]);
553  }
554  $this->updated = $this->pg_obj->update();
555  $ilCtrl->redirect($this, "editFiles");
556  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ savePositionsAndClasses()

ilPCFileListGUI::savePositionsAndClasses ( )

Save positions of file items and style classes.

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

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

562  {
564 
565  if (is_array($_POST["position"])) {
566  $this->content_obj->savePositions($_POST["position"]);
567  }
568  if (is_array($_POST["class"])) {
569  $this->content_obj->saveStyleClasses($_POST["class"]);
570  }
571  $this->updated = $this->pg_obj->update();
572  $ilCtrl->redirect($this, "editFiles");
573  }
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 402 of file class.ilPCFileListGUI.php.

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

403  {
404  $this->content_obj->setListTitle(
405  ilUtil::stripSlashes($_POST["flst_title"]),
406  ilUtil::stripSlashes($_POST["flst_language"])
407  );
408  $this->updated = $this->pg_obj->update();
409  if ($this->updated === true) {
410  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
411  } else {
412  $this->pg_obj->addHierIDs();
413  $this->edit();
414  }
415  }
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 734 of file class.ilPCFileListGUI.php.

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

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

735  {
736  $ilTabs = $this->tabs;
739 
740  $ilTabs->addTarget(
741  "cont_back",
742  $this->ctrl->getParentReturn($this),
743  "",
744  ""
745  );
746 
747  if ($a_cmd != "") {
748  $ilCtrl->setParameter($this, "subCmd", "insertNew");
749  $ilTabs->addSubTabTarget(
750  "cont_new_file",
751  $ilCtrl->getLinkTarget($this, $a_cmd),
752  $a_cmd
753  );
754 
755  $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
756  $ilTabs->addSubTabTarget(
757  "cont_file_from_repository",
758  $ilCtrl->getLinkTarget($this, $a_cmd),
759  $a_cmd
760  );
761  $ilCtrl->setParameter($this, "subCmd", "");
762 
763  if (!$ilSetting->get("disable_personal_workspace") &&
764  !$ilSetting->get("disable_wsp_files")) {
765  $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
766  $ilTabs->addSubTabTarget(
767  "cont_file_from_workspace",
768  $ilCtrl->getLinkTarget($this, $a_cmd),
769  $a_cmd
770  );
771  $ilCtrl->setParameter($this, "subCmd", "");
772  }
773  }
774  }
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 442 of file class.ilPCFileListGUI.php.

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

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

443  {
444  $ilTabs = $this->tabs;
446  $lng = $this->lng;
448 
449  if ($a_create) {
450  $cmd = "insert";
451 
452  $ilCtrl->setParameter($this, "subCmd", "insertNew");
453  $ilTabs->addSubTabTarget(
454  "cont_new_file",
455  $ilCtrl->getLinkTarget($this, $cmd),
456  $cmd
457  );
458 
459  $ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
460  $ilTabs->addSubTabTarget(
461  "cont_file_from_repository",
462  $ilCtrl->getLinkTarget($this, $cmd),
463  $cmd
464  );
465  $ilCtrl->setParameter($this, "subCmd", "");
466 
467  if (!$ilSetting->get("disable_personal_workspace") &&
468  !$ilSetting->get("disable_wsp_files")) {
469  $ilCtrl->setParameter($this, "subCmd", "insertFromWorkspace");
470  $ilTabs->addSubTabTarget(
471  "cont_file_from_workspace",
472  $ilCtrl->getLinkTarget($this, $cmd),
473  $cmd
474  );
475  $ilCtrl->setParameter($this, "subCmd", "");
476  }
477  } else {
478  $ilTabs->setBackTarget(
479  $lng->txt("pg"),
480  $this->ctrl->getParentReturn($this)
481  );
482 
483  $ilTabs->addTarget(
484  "cont_ed_edit_files",
485  $ilCtrl->getLinkTarget($this, "editFiles"),
486  "editFiles",
487  get_class($this)
488  );
489 
490  $ilTabs->addTarget(
491  "cont_ed_edit_prop",
492  $ilCtrl->getLinkTarget($this, "edit"),
493  "edit",
494  get_class($this)
495  );
496  }
497  }
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: