Public Member Functions

ilObjFileGUI Class Reference
[Modules/File]

GUI class for file objects. More...

Inheritance diagram for ilObjFileGUI:
Collaboration diagram for ilObjFileGUI:

Public Member Functions

 ilObjFileGUI ($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 _forwards ()
executeCommand ()
 execute command
 createObject ($a_reload_form="")
 create new object form
 initSingleUploadForm ($a_mode="create")
 FORM: Init single upload form.
 initZipUploadForm ($a_mode="create")
 FORM: Init zip upload form.
 saveUnzipObject ()
 saveUnzip object
 saveObject ()
 save object
 saveAndMetaObject ()
 save object
 updateObject ()
 updates object entry in object_data
 editObject ()
 edit object
 sendFileObject ()
 versionsObject ()
 file versions/history
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed
 infoScreen ()
 show information screen
 getTabs (&$tabs_gui)
 get tabs abstract method.
 _goto ($a_target)
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)

Detailed Description

GUI class for file objects.

Author:
Sascha Hofmann <shofmann@databay.de>
Version:
Id:
class.ilObjFileGUI.php 16044 2008-02-22 08:48:18Z akill

ilObjFileGUI: ilMDEditorGUI, ilInfoScreenGUI, ilPermissionGUI

Definition at line 39 of file class.ilObjFileGUI.php.


Member Function Documentation

ilObjFileGUI::_forwards (  ) 

Definition at line 51 of file class.ilObjFileGUI.php.

        {
                return array();
        }

ilObjFileGUI::_goto ( a_target  ) 

Definition at line 648 of file class.ilObjFileGUI.php.

References $_GET, $ilErr, ilObjectGUI::$lng, ilObject::_lookupObjId(), ilObject::_lookupTitle(), exit, and ilUtil::sendInfo().

        {
                global $ilAccess, $ilErr, $lng;

                if ($ilAccess->checkAccess("visible", "", $a_target))
                {
                        $_GET["cmd"] = "infoScreen";
                        $_GET["ref_id"] = $a_target;
                        include("repository.php");
                        exit;
                }
                else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
                {
                        $_GET["cmd"] = "frameset";
                        $_GET["target"] = "";
                        $_GET["ref_id"] = ROOT_FOLDER_ID;
                        ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
                                ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
                        include("repository.php");
                        exit;
                }

                $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);

        }

Here is the call graph for this function:

ilObjFileGUI::addLocatorItems (  ) 

should be overwritten to add object specific items (repository items are preloaded)

Reimplemented from ilObjectGUI.

Definition at line 677 of file class.ilObjFileGUI.php.

References $_GET.

        {
                global $ilLocator;
                
                if (is_object($this->object))
                {
                        $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
                }
        }

ilObjFileGUI::createObject ( a_reload_form = ""  ) 

create new object form

public

Definition at line 120 of file class.ilObjFileGUI.php.

References $_GET, $ilCtrl, ilObjectGUI::fillCloneTemplate(), ilObjectGUI::getTemplateFile(), initSingleUploadForm(), and initZipUploadForm().

        {
                global $rbacsystem, $ilCtrl;

                $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];

                if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
                {
                        $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
                }

                // fill in saved values in case of error
                $this->getTemplateFile("new",$this->type);

                if ($a_reload_form != "single_upload")
                {
                        $this->initSingleUploadForm("create");
                }
                $this->tpl->setVariable("SINGLE_UPLOAD_FORM", $this->single_form_gui->getHtml());

                if ($a_reload_form != "zip_upload")
                {
                        $this->initZipUploadForm("create");
                }

                $this->tpl->setVariable("ZIP_UPLOAD_FORM", $this->zip_form_gui->getHtml());

                $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
                $this->tpl->setVariable("TXT_TAKE_OVER_STRUCTURE", $this->lng->txt("take_over_structure"));
                $this->tpl->setVariable("TXT_HEADER_ZIP", $this->lng->txt("header_zip"));
                
                $this->fillCloneTemplate('DUPLICATE','file');
        }

Here is the call graph for this function:

ilObjFileGUI::editObject (  ) 

edit object

public

Reimplemented from ilObjectGUI.

Definition at line 441 of file class.ilObjFileGUI.php.

References $_SESSION, ilObjectGUI::getFormAction(), ilObjectGUI::getTargetFrame(), ilObjectGUI::getTemplateFile(), and ilUtil::prepareFormOutput().

        {
                global $rbacsystem, $ilAccess;

                if (!$ilAccess->checkAccess("write", "", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
                }

                $fields = array();

                if ($_SESSION["error_post_vars"])
                {
                        // fill in saved values in case of error
                        $fields["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
                        $fields["desc"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["desc"], true);
                }
                else
                {
                        $fields["title"] = ilUtil::prepareFormOutput($this->object->getTitle());
                        $fields["desc"] = ilUtil::prepareFormOutput($this->object->getLongDescription());
                }
                
                $this->getTemplateFile("edit");
                $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
                $this->tpl->setVariable("TITLE", $fields["title"]);
                $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
                $this->tpl->setVariable("DESC", $fields["desc"]);
                $this->tpl->setVariable("TXT_REPLACE_FILE", $this->lng->txt("replace_file"));
                //$this->tpl->parseCurrentBlock();

                $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;

                $this->tpl->setVariable("FORMACTION", $this->getFormAction("update",$this->ctrl->getFormAction($this, "update").$obj_str));
                $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType()."_edit"));
                $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
                $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
                $this->tpl->setVariable("CMD_SUBMIT", "update");
                $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
                //$this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

& ilObjFileGUI::executeCommand (  ) 

execute command

Reimplemented from ilObjectGUI.

Definition at line 56 of file class.ilObjFileGUI.php.

References $_GET, $cmd, $ret, ilObjectGUI::getCreationMode(), infoScreen(), and ilObjectGUI::prepareOutput().

        {
                global $ilAccess, $ilNavigationHistory;
                
                $next_class = $this->ctrl->getNextClass($this);
                $cmd = $this->ctrl->getCmd();
                $this->prepareOutput();
                
                // add entry to navigation history
                if (!$this->getCreationMode() &&
                        $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
                {
                        $ilNavigationHistory->addItem($_GET["ref_id"],
                                "repository.php?cmd=infoScreen&ref_id=".$_GET["ref_id"], "file");
                }
//var_dump($_GET);
//var_dump($_POST);
//var_dump($_SESSION);
//echo "-$cmd-";
                switch ($next_class)
                {
                        case "ilinfoscreengui":
                                $this->infoScreen();    // forwards command
                                break;

                        case 'ilmdeditorgui':

                                include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';

                                $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
                                $md_gui->addObserver($this->object,'MDUpdateListener','General');
                                
                                // todo: make this work
                                $md_gui->addObserver($this->object,'MDUpdateListener','Technical');
                                
                                $this->ctrl->forwardCommand($md_gui);
                                break;
                                
                        case 'ilpermissiongui':
                                include_once("./classes/class.ilPermissionGUI.php");
                                $perm_gui =& new ilPermissionGUI($this);
                                $ret =& $this->ctrl->forwardCommand($perm_gui);
                                break;

                        default:
                                if (empty($cmd))
                                {
                                        // does not seem to work
                                        //$this->ctrl->returnToParent($this);
                                        //$cmd = "view";
                                        $cmd = "infoScreen";
                                }

                                $cmd .= "Object";
                                $this->$cmd();
                                break;
                }               
        }

Here is the call graph for this function:

ilObjFileGUI::getTabs ( &$  tabs_gui  ) 

get tabs abstract method.

overwrite in derived GUI class of your object type public

Parameters:
object instance of ilTabsGUI

Reimplemented from ilObjectGUI.

Definition at line 600 of file class.ilObjFileGUI.php.

References $_GET.

        {
                global $rbacsystem, $ilAccess;
                
//echo "-".$this->ctrl->getCmd()."-";

                $this->ctrl->setParameter($this,"ref_id",$this->ref_id);

                if ($ilAccess->checkAccess("visible", "", $this->ref_id))
                {
                        $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
                                || strtolower($_GET["cmdClass"]) == "ilnotegui")
                                ? true
                                : false;
                        $tabs_gui->addTarget("info_short",
                                 $this->ctrl->getLinkTargetByClass(
                                 array("ilobjfilegui", "ilinfoscreengui"), "showSummary"),
                                 array("showSummary","", "infoScreen"),
                                 "", "", $force_active);
                }

                if ($ilAccess->checkAccess("write", "", $this->ref_id))
                {
                        $tabs_gui->addTarget("edit",
                                $this->ctrl->getLinkTarget($this, "edit"), "edit", "");
                }
                
                // meta data 
                if ($ilAccess->checkAccess("write", "", $this->ref_id))
                {
                        $tabs_gui->addTarget("meta_data",
                                 $this->ctrl->getLinkTargetByClass(array('ilobjfilegui','ilmdeditorgui'),'listSection'),
                                 "", 'ilmdeditorgui');
                }

                if ($ilAccess->checkAccess("write", "", $this->ref_id))
                {
                        $tabs_gui->addTarget("versions",
                                $this->ctrl->getLinkTarget($this, "versions"), "versions", get_class($this));
                }

                if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id))
                {
                        $tabs_gui->addTarget("perm_settings",
                                $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
                }
        }

ilObjFileGUI::ilObjFileGUI ( a_data,
a_id,
a_call_by_reference = true,
a_prepare_output = true 
)

Constructor public.

Definition at line 45 of file class.ilObjFileGUI.php.

References ilObjectGUI::ilObjectGUI().

        {
                $this->type = "file";
                $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
        }

Here is the call graph for this function:

ilObjFileGUI::infoScreen (  ) 

show information screen

Definition at line 542 of file class.ilObjFileGUI.php.

References $_GET, and ilObjFile::_lookupFileSize().

Referenced by executeCommand(), and infoScreenObject().

        {
                global $ilAccess;

                if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }

                include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
                $info = new ilInfoScreenGUI($this);

                if ($ilAccess->checkAccess("read", "sendfile", $this->ref_id))
                {
                        $info->addButton($this->lng->txt("file_read"), $this->ctrl->getLinkTarget($this, "sendfile"));
                }
                
                $info->enablePrivateNotes();
                
                if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
                {
                        $info->enableNews();
                }

                // no news editing for files, just notifications
                $info->enableNewsEditing(false);
                if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
                {
                        $news_set = new ilSetting("news");
                        $enable_internal_rss = $news_set->get("enable_rss_for_internal");
                        
                        if ($enable_internal_rss)
                        {
                                $info->setBlockProperty("news", "settings", true);
                                $info->setBlockProperty("news", "public_notifications_option", true);
                        }
                }

                
                // standard meta data
                $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
                
                $info->addSection($this->lng->txt("file_info"));
                $info->addProperty($this->lng->txt("filename"),
                        $this->object->getFileName());
                $info->addProperty($this->lng->txt("type"),
                        $this->object->getFileType());
                $info->addProperty($this->lng->txt("size"),
                        ilObjFile::_lookupFileSize($this->object->getId(), true));
                $info->addProperty($this->lng->txt("version"),
                        $this->object->getVersion());

                // forward the command
                $this->ctrl->forwardCommand($info);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjFileGUI::infoScreenObject (  ) 

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

Definition at line 532 of file class.ilObjFileGUI.php.

References infoScreen().

        {
                $this->ctrl->setCmd("showSummary");
                $this->ctrl->setCmdClass("ilinfoscreengui");
                $this->infoScreen();
        }

Here is the call graph for this function:

ilObjFileGUI::initSingleUploadForm ( a_mode = "create"  ) 

FORM: Init single upload form.

Parameters:
int $a_mode "create" / "update" (not implemented)

Definition at line 159 of file class.ilObjFileGUI.php.

References ilObjectGUI::$lng, ilUtil::getImagePath(), and ilObjectGUI::getTargetFrame().

Referenced by createObject(), and saveObject().

        {
                global $lng;
                
                include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
                $this->single_form_gui = new ilPropertyFormGUI();
                
                // File Title
                $in_title = new ilTextInputGUI($lng->txt("title"), "title");
                $in_title->setInfo($this->lng->txt("if_no_title_then_filename"));
                $in_title->setMaxLength(128);
                $in_title->setSize(40);
                $this->single_form_gui->addItem($in_title);
                
                // File Description
                $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
                $this->single_form_gui->addItem($in_descr);
                
                // File
                $in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
                $in_file->setRequired(true);
                $this->single_form_gui->addItem($in_file);
                
                // save and cancel commands
                if ($a_mode == "create")
                {
                        $this->single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
                        $this->single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
                        $this->single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
                }
                else
                {
                        //$this->single_form_gui->addCommandButton("update", $lng->txt("save"));
                        //$this->single_form_gui->addCommandButton("cancelUpdate", $lng->txt("cancel"));
                }
                
                $this->single_form_gui->setTableWidth("60%");
                $this->single_form_gui->setTarget($this->getTargetFrame("save"));
                $this->single_form_gui->setTitle($this->lng->txt($this->type."_new"));
                $this->single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
                
                if ($a_mode == "create")
                {
                        $this->ctrl->setParameter($this, "new_type", "file");
                }
                $this->single_form_gui->setFormAction($this->ctrl->getFormAction($this));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjFileGUI::initZipUploadForm ( a_mode = "create"  ) 

FORM: Init zip upload form.

Parameters:
int $a_mode "create" / "update" (not implemented)

Definition at line 212 of file class.ilObjFileGUI.php.

References ilObjectGUI::$lng, ilUtil::getImagePath(), and ilObjectGUI::getTargetFrame().

Referenced by createObject(), and saveUnzipObject().

        {
                global $lng;
                
                include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
                $this->zip_form_gui = new ilPropertyFormGUI();
                                
                // File
                $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
                $in_file->setRequired(true);
                $in_file->setSuffixes(array("zip"));
                $this->zip_form_gui->addItem($in_file);

                // Take over structure
                $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
                $in_str->setInfo($this->lng->txt("take_over_structure_info"));
                $this->zip_form_gui->addItem($in_str);
                
                // save and cancel commands
                if ($a_mode == "create")
                {
                        $this->zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
                        $this->zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
                }
                else
                {
                        //$this->zip_form_gui->addCommandButton("update", $lng->txt("save"));
                        //$this->zip_form_gui->addCommandButton("cancelUpdate", $lng->txt("cancel"));
                }
                
                $this->zip_form_gui->setTableWidth("60%");
                $this->zip_form_gui->setTarget($this->getTargetFrame("save"));
                $this->zip_form_gui->setTitle($this->lng->txt("header_zip"));
                $this->zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
                
                if ($a_mode == "create")
                {
                        $this->ctrl->setParameter($this, "new_type", "file");
                }
                $this->zip_form_gui->setFormAction($this->ctrl->getFormAction($this));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjFileGUI::saveAndMetaObject (  ) 

save object

public

Definition at line 387 of file class.ilObjFileGUI.php.

References saveObject().

        {
                $this->saveObject();
        }

Here is the call graph for this function:

ilObjFileGUI::saveObject (  ) 

save object

public

Reimplemented from ilObjectGUI.

Definition at line 325 of file class.ilObjFileGUI.php.

References $_GET, ilObjectGUI::$objDefinition, $title, ilObjectGUI::createObject(), ilObjectGUI::getReturnLocation(), initSingleUploadForm(), ilUtil::redirect(), and ilUtil::sendInfo().

Referenced by saveAndMetaObject().

        {
                global $rbacsystem, $objDefinition;

                $this->initSingleUploadForm("create");
                
                if ($this->single_form_gui->checkInput())
                {
                        $title = $this->single_form_gui->getInput("title");
                        $description = $this->single_form_gui->getInput("description");
                        $upload_file = $this->single_form_gui->getInput("upload_file");

                        if (trim($title) == "")
                        {
                                $title = $upload_file["name"];
                        }

                        // create and insert file in grp_tree
                        include_once("./Modules/File/classes/class.ilObjFile.php");
                        $fileObj = new ilObjFile();
                        $fileObj->setType($this->type);
                        $fileObj->setTitle($title);
                        $fileObj->setDescription($description);
                        $fileObj->setFileName($upload_file["name"]);
                        $fileObj->setFileType($upload_file["type"]);
                        $fileObj->setFileSize($upload_file["size"]);
                        $fileObj->create();
                        $fileObj->createReference();
                        $fileObj->putInTree($_GET["ref_id"]);
                        $fileObj->setPermissions($_GET["ref_id"]);
                        // upload file to filesystem
                        $fileObj->createDirectory();
                        $fileObj->getUploadFile($upload_file["tmp_name"],
                                $upload_file["name"]);
        
                        ilUtil::sendInfo($this->lng->txt("file_added"),true);
                        
                        $this->ctrl->setParameter($this, "ref_id", $fileObj->getRefId());
                        if ($this->ctrl->getCmd() == "saveAndMeta")
                        {
                                $target =
                                        $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilmdeditorgui"), "listSection");
                                $target = str_replace("new_type=", "nt=", $target);
                                ilUtil::redirect($this->getReturnLocation("save", $target));
                        }
                        else
                        {
                                $this->ctrl->returnToParent($this);
                        }
                }
                else
                {
                        $this->single_form_gui->setValuesByPost();
                        $this->createObject("single_upload");
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjFileGUI::saveUnzipObject (  ) 

saveUnzip object

public

Definition at line 259 of file class.ilObjFileGUI.php.

References $_GET, ilObject::_lookupType(), ilObjectGUI::createObject(), ilUtil::delDir(), ilUtil::ilTempnam(), initZipUploadForm(), ilUtil::makeDir(), ilFileUtils::processZipFile(), and ilUtil::sendInfo().

        {
                global $rbacsystem;
                
                $this->initZipUploadForm("create");
                
                if ($this->zip_form_gui->checkInput())
                {
                        $zip_file = $this->zip_form_gui->getInput("zip_file");
                        $adopt_structure = $this->zip_form_gui->getInput("adopt_structure");

                        include_once ("Services/Utilities/classes/class.ilFileUtils.php");

                        // Create unzip-directory
                        $newDir = ilUtil::ilTempnam();
                        ilUtil::makeDir($newDir);
                
                        // Check if permission is granted for creation of object, if necessary
                        if (ilObject::_lookupType($_GET["ref_id"], TRUE) == "cat")
                        {
                                $permission = $rbacsystem->checkAccess("create", $_GET["ref_id"], "cat");
                                $containerType = "Category";
                        }
                        else {
                                $permission = $rbacsystem->checkAccess("create", $_GET["ref_id"], "fold");
                                $containerType = "Folder";                      
                        }
                
                        //      processZipFile ( 
                        //              Dir to unzip, 
                        //              Path to uploaded file, 
                        //              should a structure be created (+ permission check)?
                        //              ref_id of parent
                        //              object that contains files (folder or category)  
                        //              should sendInfo be persistent?)
                        
                        try 
                        {
                                $processDone = ilFileUtils::processZipFile( $newDir, 
                                        $zip_file["tmp_name"],
                                        ($adopt_structure && $permission),
                                        $_GET["ref_id"],
                                        $containerType,
                                        true);
                                ilUtil::sendInfo($this->lng->txt("file_added"),true);                                   
                        }
                        catch (ilFileUtilsException $e) 
                        {
                                ilUtil::sendInfo($e->getMessage(), true);
                        }
                
                        ilUtil::delDir($newDir);
                        $this->ctrl->returnToParent($this);
                }
                else
                {
                        $this->zip_form_gui->setValuesByPost();
                        $this->createObject("zip_upload");
                }
        }

Here is the call graph for this function:

ilObjFileGUI::sendFileObject (  ) 

Definition at line 484 of file class.ilObjFileGUI.php.

References $_GET.

        {
                global $ilAccess;
                
                if ($ilAccess->checkAccess("read", "", $this->ref_id))
                {
                        $this->object->sendFile($_GET["hist_id"]);
                }
                else
                {
                        $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
                }
                return true;
        }

ilObjFileGUI::updateObject (  ) 

updates object entry in object_data

public

Reimplemented from ilObjectGUI.

Definition at line 397 of file class.ilObjFileGUI.php.

References ilObjectGUI::$data, ilObjectGUI::getReturnLocation(), ilUtil::redirect(), ilUtil::sendInfo(), and ilUtil::stripSlashes().

        {
                $data = $_FILES["Fobject"];

                // delete trailing '/' in filename
                while (substr($data["name"]["file"],-1) == '/')
                {
                        $data["name"]["file"] = substr($data["name"]["file"],0,-1);
                }

                if (empty($data["name"]["file"]) && empty($_POST["Fobject"]["title"]))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_title"),$this->ilias->error_obj->MESSAGE);
                }

                if (empty($_POST["Fobject"]["title"]))
                {
                        $_POST["Fobject"]["title"] = $_FILES["Fobject"]["name"]["file"];
                }

                if (!empty($data["name"]["file"]))
                {
                        $this->object->replaceFile($_FILES["Fobject"]["tmp_name"]["file"],$_FILES["Fobject"]["name"]["file"]);
                        $this->object->setFileName($_FILES["Fobject"]["name"]["file"]);
                        $this->object->setFileType($_FILES["Fobject"]["type"]["file"]);
                        $this->object->setFileSize($_FILES["Fobject"]["size"]["file"]);
                }
                
                $this->object->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
                $this->object->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));

                $this->update = $this->object->update();

                ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
//echo "-".$this->ctrl->getLinkTarget($this)."-";
                ilUtil::redirect($this->getReturnLocation("update",$this->ctrl->getLinkTarget($this, "edit")));
        }

Here is the call graph for this function:

ilObjFileGUI::versionsObject (  ) 

file versions/history

public

Definition at line 505 of file class.ilObjFileGUI.php.

References $_GET.

        {
                global $rbacsystem, $ilAccess;

                if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))
                {
                        $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
                }

                require_once("classes/class.ilHistoryGUI.php");
                
                $hist_gui =& new ilHistoryGUI($this->object->getId());
                
                // not nice, should be changed, if ilCtrl handling
                // has been introduced to administration
                $hist_html = $hist_gui->getVersionsTable(
                        array("ref_id" => $_GET["ref_id"], "cmd" => "versions",
                        "cmdClass" =>$_GET["cmdClass"], "cmdNode" =>$_GET["cmdNode"]));
                
                $this->tpl->setVariable("ADM_CONTENT", $hist_html);
        }


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