4require_once(
"./Services/COPage/classes/class.ilPCFileList.php");
 
    5require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
 
   49    public function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id = 
"")
 
   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();
 
   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")));
 
   71        $next_class = $this->ctrl->getNextClass($this);
 
   76        $cmd = $this->ctrl->getCmd();
 
   78        switch ($next_class) {
 
   90    public function insert($a_form = 
null)
 
   95        if (
$_GET[
"subCmd"] == 
"insertNew") {
 
   96            $_SESSION[
"cont_file_insert"] = 
"insertNew";
 
   98        if (
$_GET[
"subCmd"] == 
"insertFromRepository") {
 
   99            $_SESSION[
"cont_file_insert"] = 
"insertFromRepository";
 
  101        if (
$_GET[
"subCmd"] == 
"insertFromWorkspace") {
 
  102            $_SESSION[
"cont_file_insert"] = 
"insertFromWorkspace";
 
  104        if ((
$_GET[
"subCmd"] == 
"") && 
$_SESSION[
"cont_file_insert"] != 
"") {
 
  108        switch (
$_GET[
"subCmd"]) {
 
  109            case "insertFromWorkspace":
 
  113            case "insertFromRepository":
 
  123                $ilTabs->setSubTabActive(
"cont_new_file");
 
  127                if ($a_form != 
null) {
 
  132                $this->tpl->setContent(
$form->getHTML());
 
  146        $ilTabs->setSubTabActive(
"cont_file_from_repository");
 
  151        $this->tpl->setContent(
$form->getHTML());
 
  163        if ($a_cmd == 
"insert") {
 
  169        $ilTabs->setSubTabActive(
"cont_file_from_repository");
 
  170        $ilCtrl->setParameter($this, 
"subCmd", 
"insertFromRepository");
 
  172        include_once(
"./Services/COPage/classes/class.ilPCFileItemFileSelectorGUI.php");
 
  180        if (!$exp->handleCommand()) {
 
  181            $tpl->setContent($exp->getHTML());
 
  196        if ($a_cmd == 
"insert") {
 
  202        $ilTabs->setSubTabActive(
"cont_file_from_workspace");
 
  204        include_once(
"./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
 
  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()) {
 
  214        $tpl->setContent($exp->getHTML());
 
  224        include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  226        $mode = (
$_POST[
"file_ref_id"] != 
"")
 
  230        if (!
$form->checkInput()) {
 
  231            $form->setValuesByPost();
 
  237        if (substr(
$_POST[
"file_ref_id"], 0, 4) == 
"wsp_") {
 
  241        elseif (
$_POST[
"file_ref_id"] == 0) {
 
  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");
 
  252            $fileObj->createDirectory();
 
  253            $fileObj->raiseUploadError(
false);
 
  255            $upload = 
$DIC->upload();
 
  256            if ($upload->hasBeenProcessed() !== 
true) {
 
  260            $fileObj->getUploadFile(
 
  261                $_FILES[
"file"][
"tmp_name"],
 
  262                $_FILES[
"file"][
"name"]
 
  273        $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
 
  275        $this->content_obj->appendItem(
 
  277            $fileObj->getFileName(),
 
  278            $fileObj->getFileType()
 
  281        $this->updated = $this->pg_obj->update();
 
  282        if ($this->updated === 
true) {
 
  283            $this->ctrl->returnToParent($this, 
"jump" . $this->hier_id);
 
  297        $this->tpl->setContent(
$form->getHTML());
 
  311        include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
 
  314        if ($a_mode != 
"add_file") {
 
  317            $ti->setMaxLength(80);
 
  322            require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
 
  329        if (in_array($a_mode, array(
"create", 
"add_file"))) {
 
  332            $fi->setRequired(
true);
 
  334        } elseif (in_array($a_mode, array(
"select_file"))) {
 
  338            if (isset(
$_GET[
"file_ref_id"])) {
 
  339                include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  341                if (is_object($file_obj)) {
 
  344                    $hi->setValue((
int) 
$_GET[
"file_ref_id"]);
 
  347                    $ne->setValue($file_obj->getTitle());
 
  349            } elseif (isset(
$_GET[
"fl_wsp_id"])) {
 
  351                include_once 
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
 
  353                $node = 
$tree->getNodeData((
int) 
$_GET[
"fl_wsp_id"]);
 
  355                include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  356                $file_obj = 
new ilObjFile($node[
"obj_id"], 
false);
 
  357                if (is_object($file_obj)) {
 
  360                    $hi->setValue(
"wsp_" . (
int) $node[
"obj_id"]);
 
  363                    $ne->setValue($file_obj->getTitle());
 
  365                $this->tpl->parseCurrentBlock();
 
  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"));
 
  386                    $s_lang = 
$ilUser->getLanguage();
 
  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"));
 
  395                $form->addCommandButton(
"insertNewFileItem", 
$lng->txt(
"save"));
 
  396                $form->addCommandButton(
"editFiles", 
$lng->txt(
"cancel"));
 
  397                $form->setTitle(
$lng->txt(
"cont_insert_file_item"));
 
  412        $this->content_obj->setListTitle(
 
  416        $this->updated = $this->pg_obj->update();
 
  417        if ($this->updated === 
true) {
 
  418            $this->ctrl->returnToParent($this, 
"jump" . $this->hier_id);
 
  420            $this->pg_obj->addHierIDs();
 
  437        $ilToolbar->addButton(
 
  438            $lng->txt(
"cont_add_file"),
 
  439            $ilCtrl->getLinkTarget($this, 
"addFileItem")
 
  442        include_once(
"./Services/COPage/classes/class.ilPCFileListTableGUI.php");
 
  444        $tpl->setContent($table_gui->getHTML());
 
  460            $ilCtrl->setParameter($this, 
"subCmd", 
"insertNew");
 
  461            $ilTabs->addSubTabTarget(
 
  463                $ilCtrl->getLinkTarget($this, $cmd),
 
  467            $ilCtrl->setParameter($this, 
"subCmd", 
"insertFromRepository");
 
  468            $ilTabs->addSubTabTarget(
 
  469                "cont_file_from_repository",
 
  470                $ilCtrl->getLinkTarget($this, $cmd),
 
  473            $ilCtrl->setParameter($this, 
"subCmd", 
"");
 
  475            if (!
$ilSetting->get(
"disable_personal_workspace") &&
 
  477                $ilCtrl->setParameter($this, 
"subCmd", 
"insertFromWorkspace");
 
  478                $ilTabs->addSubTabTarget(
 
  479                    "cont_file_from_workspace",
 
  480                    $ilCtrl->getLinkTarget($this, $cmd),
 
  483                $ilCtrl->setParameter($this, 
"subCmd", 
"");
 
  486            $ilTabs->setBackTarget(
 
  488                $this->ctrl->getParentReturn($this)
 
  492                "cont_ed_edit_files",
 
  493                $ilCtrl->getLinkTarget($this, 
"editFiles"),
 
  500                $ilCtrl->getLinkTarget($this, 
"edit"),
 
  515        $files = $this->content_obj->getFileList();
 
  528            $ilCtrl->redirectByClass(
"ilpcfileitemgui", 
"newItemAfter");
 
  530            $ilCtrl->redirect($this, 
"newFileItem");
 
  541        if (is_array(
$_POST[
"fid"])) {
 
  543            foreach (
$_POST[
"fid"] as $k => $v) {
 
  546            $this->content_obj->deleteFileItems($ids);
 
  548        $this->updated = $this->pg_obj->update();
 
  549        $ilCtrl->redirect($this, 
"editFiles");
 
  559        if (is_array(
$_POST[
"position"])) {
 
  560            $this->content_obj->savePositions(
$_POST[
"position"]);
 
  562        $this->updated = $this->pg_obj->update();
 
  563        $ilCtrl->redirect($this, 
"editFiles");
 
  573        if (is_array(
$_POST[
"position"])) {
 
  574            $this->content_obj->savePositions(
$_POST[
"position"]);
 
  576        if (is_array(
$_POST[
"class"])) {
 
  577            $this->content_obj->saveStyleClasses(
$_POST[
"class"]);
 
  579        $this->updated = $this->pg_obj->update();
 
  580        $ilCtrl->redirect($this, 
"editFiles");
 
  591        $classes = $this->content_obj->getAllClasses();
 
  592        if (count($chars) > 1) {
 
  595        foreach ($classes as $class) {
 
  596            if ($class != 
"" && $class != 
"FileListItem") {
 
  619        if (
$_GET[
"subCmd"] == 
"insertNew") {
 
  620            $_SESSION[
"cont_file_insert"] = 
"insertNew";
 
  622        if (
$_GET[
"subCmd"] == 
"insertFromRepository") {
 
  623            $_SESSION[
"cont_file_insert"] = 
"insertFromRepository";
 
  625        if (
$_GET[
"subCmd"] == 
"insertFromWorkspace") {
 
  626            $_SESSION[
"cont_file_insert"] = 
"insertFromWorkspace";
 
  628        if ((
$_GET[
"subCmd"] == 
"") && 
$_SESSION[
"cont_file_insert"] != 
"") {
 
  632        switch (
$_GET[
"subCmd"]) {
 
  633            case "insertFromWorkspace":
 
  637            case "insertFromRepository":
 
  647                $ilTabs->setSubTabActive(
"cont_new_file");
 
  652                $this->tpl->setContent(
$form->getHTML());
 
  665        if (isset(
$_GET[
"fl_wsp_id"])) {
 
  667            include_once 
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
 
  669            $node = 
$tree->getNodeData(
$_GET[
"fl_wsp_id"]);
 
  671            include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  672            $file_obj = 
new ilObjFile($node[
"obj_id"], 
false);
 
  675        elseif ($a_file_ref_id == 0) {
 
  680            include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  681            $file_obj = 
new ilObjFile($a_file_ref_id);
 
  683        if (is_object($file_obj)) {
 
  684            $this->content_obj->appendItem(
 
  686                $file_obj->getTitle(),
 
  687                $file_obj->getFileType()
 
  689            $this->updated = $this->pg_obj->update();
 
  690            if ($this->updated === 
true) {
 
  692                $this->ctrl->redirect($this, 
"editFiles");
 
  696        $_GET[
"subCmd"] = 
"-";
 
  709        if ($_FILES[
"file"][
"name"] == 
"") {
 
  710            $_GET[
"subCmd"] = 
"-";
 
  719        include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  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");
 
  731        $fileObj->createDirectory();
 
  732        $fileObj->raiseUploadError(
false);
 
  733        $fileObj->getUploadFile($_FILES[
"file"][
"tmp_name"], $_FILES[
"file"][
"name"]);
 
  751            $this->ctrl->getParentReturn($this),
 
  757            $ilCtrl->setParameter($this, 
"subCmd", 
"insertNew");
 
  758            $ilTabs->addSubTabTarget(
 
  760                $ilCtrl->getLinkTarget($this, $a_cmd),
 
  764            $ilCtrl->setParameter($this, 
"subCmd", 
"insertFromRepository");
 
  765            $ilTabs->addSubTabTarget(
 
  766                "cont_file_from_repository",
 
  767                $ilCtrl->getLinkTarget($this, $a_cmd),
 
  770            $ilCtrl->setParameter($this, 
"subCmd", 
"");
 
  772            if (!
$ilSetting->get(
"disable_personal_workspace") &&
 
  774                $ilCtrl->setParameter($this, 
"subCmd", 
"insertFromWorkspace");
 
  775                $ilTabs->addSubTabTarget(
 
  776                    "cont_file_from_workspace",
 
  777                    $ilCtrl->getLinkTarget($this, $a_cmd),
 
  780                $ilCtrl->setParameter($this, 
"subCmd", 
"");
 
An exception for terminatinating execution or to throw for unit testing.
This class represents a non editable value in a property form.
Select files for file list.
insertFromRepository($a_cmd="insert")
Insert file from repository.
executeCommand()
execute command
insert($a_form=null)
insert new file list form
setTabs($a_create=true)
Set Tabs.
addFileItem()
Add file item.
insertFromWorkspace($a_cmd="insert")
Insert file from personal workspace.
newFileItem()
New file item (called, if there is no file item in an existing)
__construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
setItemTabs($a_cmd="")
output tabs
initEditForm($a_mode="edit")
Init edit form.
savePositions()
Save positions of file items.
savePositionsAndClasses()
Save positions of file items and style classes.
checkStyleSelection()
Checks whether style selection shoudl be available or not.
saveProperties()
save table properties in db and return to page edit screen
edit()
edit properties form
create()
create new file list in dom and update page in db
deleteFileItem()
Delete file items from list.
createFileItem()
insert new file item
insertNewFileItem($a_file_ref_id=0)
insert new file item after another item
TableGUI class for file list.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
displayValidationError()
display validation errors
getCharacteristics()
Get characteristics.
setCharacteristics($a_chars)
Set Characteristics.
This class represents a text property in a property form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Explorer for selecting a personal workspace item.
Tree handler for personal workspace.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
if(isset($_POST['submit'])) $form