ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjFileGUI Class Reference

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)
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not)
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui
 getCreationMode ()
 get creation mode
 assignObject ()
 prepareOutput ()
 prepare output
 setTitleAndDescription ()
 called by prepare output
 showUpperIcon ()
 showMountWebfolderIcon ()
 setTabs ()
 set admin tabs public
 setAdminTabs ()
 set admin tabs public
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 getHTML ()
 setActions ($a_actions="")
 set possible actions for objects in list.
 setSubObjects ($a_sub_objects="")
 set possible subobjects for this object.
 setLocator ()
 set Locator
 omitLocator ($a_omit=true)
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 undeleteObject ()
 get object back from trash
 insertSavedNodes ($a_source_id, $a_dest_id, $a_tree_id, &$a_affected_ids)
 recursive method to insert all saved nodes of the clipboard (maybe this function could be moved to a rbac class ?)
 confirmedDeleteObject ()
 confirmed deletion if object -> objects are moved to trash
 cancelDeleteObject ()
 cancel deletion of object
 removeFromSystemObject ()
 remove objects from trash bin and all entries therefore every object needs a specific deleteObject() method
 removeDeletedNodes ($a_node_id, $a_checked, $a_delete_objects, &$a_affected_ids)
 remove already deleted objects within the objects in trash recursive function
 createObject ()
 create new object form
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 importObject ()
 import new object form
 displayEditForm ($fields)
 display edit form (usually called by editObject)
 afterUpdate ()
 permObject ()
 show permissions of current node
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g.
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g.
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command
 permSaveObject ()
 save permissions
 isVisible ($a_ref_id, $a_type)
 displayList ()
 display object list
 viewObject ()
 list childs of current object
 deleteObject ($a_error=false)
 display deletion confirmation screen only for referenced objects.
 trashObject ()
 show trash content of object
 addRoleObject ()
 adds a local role This method is only called when choose the option 'you may add local roles'.
 showActions ($with_subobjects=false)
 show possible action (form buttons)
 getActions ()
 Get Actions.
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste
 __showButton ($a_cmd, $a_text, $a_target= '')
 hitsperpageObject ()
__initTableGUI ()
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table
 __showClipboardTable ($a_result_set, $a_from="")
 infoObject ()
 __buildRoleFilterSelect ()
 __filterRoles ($a_roles, $a_filter)
 ownerObject ()
 changeOwnerObject ()
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning.
 fillCloneSearchTemplate ($a_tpl_varname, $a_type)
 Add an object search in case the number of existing objects is too big to offer a selection list.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.
 copyWizardHasOptions ($a_mode)
 Check if there is any modules specific option.
 getCenterColumnHTML ()
 Get center column.
 getRightColumnHTML ()
 Display right column.
 setColumnSettings ($column_gui)
 May be overwritten in subclasses.
 checkPermission ($a_perm, $a_cmd="")

Additional Inherited Members

- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 $ilias
 $objDefinition
 $tpl
 $tree
 $lng
 $data
 $object
 $ref_id
 $obj_id
 $maxcount
 $formaction
 $return_location
 $target_frame
 $tab_target_script
 $actions
 $sub_objects
 $omit_locator = false
- Protected Member Functions inherited from ilObjectGUI
 searchCloneSourceObject ()
 Search clone source by title.
 buildCloneSelect ($existing_objs)
 Build a select box for clonable objects (permission write)

Detailed Description

GUI class for file objects.

Author
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
Id:
class.ilObjFileGUI.php 22599 2009-12-16 10:53:42Z akill

ilObjFileGUI: ilMDEditorGUI, ilInfoScreenGUI, ilPermissionGUI, ilShopPurchaseGUI

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

Member Function Documentation

ilObjFileGUI::_forwards ( )

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

{
return array();
}
ilObjFileGUI::_goto (   $a_target)

Definition at line 735 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");
}
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"),
include("repository.php");
}
$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 764 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 139 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 516 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 57 of file class.ilObjFileGUI.php.

References $_GET, $cmd, $ret, ilPaymentObject\_hasAccess(), ilPaymentObject\_isBuyable(), ilMDEditorGUI\addObserver(), ilObjectGUI\getCreationMode(), infoScreen(), ilObjectGUI\prepareOutput(), and ilObjectGUI\setLocator().

{
global $ilAccess, $ilNavigationHistory;
// 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");
}
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
if(!$this->getCreationMode())
{
include_once 'payment/classes/class.ilPaymentObject.php';
if(ilPaymentObject::_isBuyable($this->object->getRefId()) &&
!ilPaymentObject::_hasAccess($this->object->getRefId()))
{
$this->setLocator();
$this->tpl->getStandardTemplate();
include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
$pp = new ilShopPurchaseGUI((int)$_GET['ref_id']);
$ret = $this->ctrl->forwardCommand($pp);
return true;
}
}
$this->prepareOutput();
//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
objectinstance of ilTabsGUI

Reimplemented from ilObjectGUI.

Definition at line 687 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 46 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 627 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());
// BEGIN WebDAV Guess file type.
$info->addProperty($this->lng->txt("type"),
$this->object->guessFileType());
// END WebDAV Guess file type.
$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 617 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 178 of file class.ilObjFileGUI.php.

References ilObjectGUI\$lng, ilUtil\getImagePath(), ilObjectGUI\getTargetFrame(), ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

Referenced by createObject(), and saveObject().

{
global $lng;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->single_form_gui = new ilPropertyFormGUI();
$this->single_form_gui->setMultipart(true);
// 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 232 of file class.ilObjFileGUI.php.

References ilObjectGUI\$lng, ilUtil\getImagePath(), ilObjectGUI\getTargetFrame(), ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

Referenced by createObject(), and saveUnzipObject().

{
global $lng;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->zip_form_gui = new ilPropertyFormGUI();
$this->zip_form_gui->setMultipart(true);
// 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 433 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 351 of file class.ilObjFileGUI.php.

References $_GET, ilObjectGUI\$objDefinition, $title, ilObjFileAccess\_getFileExtension(), ilChangeEvent\_isActive(), ilChangeEvent\_recordWriteEvent(), ilObjectGUI\createObject(), ilMimeTypeUtil\getMimeType(), ilObjectGUI\getReturnLocation(), initSingleUploadForm(), ilUtil\redirect(), and ilUtil\sendInfo().

Referenced by saveAndMetaObject().

{
global $rbacsystem, $objDefinition, $ilUser;
$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"];
}
else
{
// BEGIN WebDAV: Ensure that object title ends with the filename extension
$fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
{
$title .= '.'.$fileExtension;
}
// END WebDAV: Ensure that object title ends with the filename extension
}
// create and insert file in grp_tree
include_once("./Modules/File/classes/class.ilObjFile.php");
$fileObj = new ilObjFile();
$fileObj->setTitle($title);
$fileObj->setDescription($description);
$fileObj->setFileName($upload_file["name"]);
//$fileObj->setFileType($upload_file["type"]);
include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
$fileObj->setFileType(ilMimeTypeUtil::getMimeType(
"", $upload_file["name"], $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"]);
// BEGIN ChangeEvent: Record write event.
require_once('Services/Tracking/classes/class.ilChangeEvent.php');
{
ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
}
// END ChangeEvent: Record write event.
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 280 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 ($rbacsystem->checkAccess("create", $_GET["ref_id"], "file")) {
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);
}
{
ilUtil::sendInfo($e->getMessage(), true);
}
ilUtil::delDir($newDir);
$this->ctrl->returnToParent($this);
}
else
{
$this->zip_form_gui->setValuesByPost();
$this->createObject("zip_upload");
}
}
else
{
$this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
}
}

+ Here is the call graph for this function:

ilObjFileGUI::sendFileObject ( )

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

References $_GET, ilChangeEvent\_isActive(), and ilChangeEvent\_recordReadEvent().

{
global $ilAccess;
if ($ilAccess->checkAccess("read", "", $this->ref_id))
{
// BEGIN ChangeEvent: Record read event.
require_once('Services/Tracking/classes/class.ilChangeEvent.php');
{
global $ilUser;
// Record read event and catchup with write events
ilChangeEvent::_recordReadEvent($this->object->getId(), $ilUser->getId());
}
// END ChangeEvent: Record read event.
$this->object->sendFile($_GET["hist_id"]);
}
else
{
$this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
}
return true;
}

+ Here is the call graph for this function:

ilObjFileGUI::updateObject ( )

updates object entry in object_data

public

Reimplemented from ilObjectGUI.

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

References ilObjectGUI\$data, $filename, $title, ilChangeEvent\_catchupWriteEvents(), ilObjFileAccess\_getFileExtension(), ilChangeEvent\_isActive(), ilChangeEvent\_recordWriteEvent(), ilMimeTypeUtil\getMimeType(), 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);
}
$filename = empty($data["name"]["file"]) ? $this->object->getFileName() : $data["name"]["file"];
$title = ilUtil::stripSlashes($_POST["Fobject"]["title"]);
if(strlen(trim($title)) == 0)
{
}
else
{
// BEGIN WebDAV: Ensure that object title ends with the filename extension
if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
{
$title .= '.'.$fileExtension;
}
// END WebDAV: Ensure that object title ends with the filename extension
}
$this->object->setTitle($title);
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"]);
include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
$this->object->setFileType(ilMimeTypeUtil::getMimeType(
"", $_FILES["Fobject"]["name"]["file"], $_FILES["Fobject"]["type"]["file"]));
$this->object->setFileSize($_FILES["Fobject"]["size"]["file"]);
}
$this->object->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
$this->update = $this->object->update();
// BEGIN ChangeEvent: Record update event.
if (!empty($data["name"]["file"]))
{
require_once('Services/Tracking/classes/class.ilChangeEvent.php');
{
global $ilUser;
ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
}
}
// END ChangeEvent: Record update event.
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 590 of file class.ilObjFileGUI.php.

References $_GET, and ilHistoryGUI\getVersionsTable().

{
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);
}

+ Here is the call graph for this function:


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