ILIAS  release_4-3 Revision
 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

 getType ()
 Functions that must be overwritten.
 _forwards ()
 executeCommand ()
 execute command
 initSingleUploadForm ()
 FORM: Init single upload form.
 save ()
 save object
 saveAndMeta ()
 save object
 initZipUploadForm ($a_mode="create")
 FORM: Init zip upload form.
 saveUnzip ()
 saveUnzip object
 update ()
 updates object entry in object_data
 edit ()
 edit object
 sendFile ()
 versions ()
 file versions/history
 infoScreen ()
 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
 infoScreenForward ()
 show information screen
 setTabs ()
 create tabs (repository/workspace switch)
 _goto ($a_target, $a_additional=null)
 addLocatorItems ()
 Functions to be overwritten.
- Public Member Functions inherited from ilObject2GUI
 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 Constructor.
 delete ()
 Display delete confirmation form (repository/workspace switch)
 confirmedDelete ()
 Delete objects (repository/workspace switch)
 getHTML ()
 withReferences ()
 Final/Private declaration of unchanged parent methods.
 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
 isVisible ()
 trash ()
 undelete ()
 cancelDelete ()
 removeFromSystem ()
 cloneAll ()
 view ()
 view object content (repository/workspace switch)
 create ()
 Deleted in ilObject.
 cancel ()
 importFile ()
 Import.
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled
 cancelDeleteObject ()
 cancel deletion of object
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 createObject ()
 create new object form
 cancelCreation ()
 cancel create action and go back to repository parent
 saveObject ()
 save object
 editObject ()
 edit object
 updateObject ()
 updates object entry in object_data
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g.
 isVisible ($a_ref_id, $a_type)
 viewObject ()
 list childs of current object
 deleteObject ($a_error=false)
 Display deletion confirmation screen.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.

Protected Member Functions

 initCreationForms ()
 initPropertiesForm ()
- Protected Member Functions inherited from ilObject2GUI
 afterConstructor ()
 Do anything that should be done after constructor in here.
 assignObject ()
 create object instance as internal property (repository/workspace switch)
 getAccessHandler ()
 Get access handler.
 setLocator ()
 set Locator
 deleteConfirmation ()
 Display delete confirmation form (workspace specific)
 deleteConfirmedObjects ()
 Delete objects (workspace specific)
 prepareOutput ()
 prepare output
 setTitleAndDescription ()
 called by prepare output
 showUpperIcon ()
 omitLocator ($a_omit=true)
 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
 getCenterColumnHTML ()
 Get center column.
 getRightColumnHTML ()
 Display right column.
 setColumnSettings ($column_gui)
 May be overwritten in subclasses.
 checkPermission ($a_perm, $a_cmd="")
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 redirectToRefId ()
 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)
 searchCloneSource ()
 buildCloneSelect ($existing_objs)
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 getReturnLocation ()
 Deprecated functions.
 setReturnLocation ()
 showActions ()
 getTitlesByRefId ()
 getTabs ()
 __showButton ()
 hitsperpageObject ()
 __initTableGUI ()
 __setTableGUIBasicData ()
 __showClipboardTable ()
 initCreationForms ($a_new_type)
 Init creation froms.
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position.
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
 Check permission.
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu.
 redrawHeaderAction ()
 Updating icons after ajax call.
 getPermanentLinkWidget ($a_append=null, $a_center=false)
- Protected Member Functions inherited from ilObjectGUI
 insertHeaderAction ($a_list_gui)
 Insert header action into main template.
 addHeaderAction ()
 Add header action menu.
 redrawHeaderActionObject ()
 Ajax call: redraw action header only.
 setAdminTabs ()
 set admin tabs public
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion)
 initCreateForm ($a_new_type)
 Init object creation form.
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types.
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates.
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen.
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook.
 initEditForm ()
 Init object edit form.
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form.
 getEditFormValues ()
 Get values for edit form.
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields.
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object.
 afterUpdate ()
 Post (successful) object update hook.
 initImportForm ($a_new_type)
 Init object import form.
 importFileObject ($parent_id=null)
 Import.
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook.
 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
 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
 getTabs (&$tabs_gui)
 get tabs abstract method.
 __showButton ($a_cmd, $a_text, $a_target= '')
 __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="")
 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
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error.

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root.
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root.
- Data Fields inherited from ilObject2GUI
 $tree
const OBJECT_ID = 0
const REPOSITORY_NODE_ID = 1
const WORKSPACE_NODE_ID = 2
const REPOSITORY_OBJECT_ID = 3
const WORKSPACE_OBJECT_ID = 4
- Protected Attributes inherited from ilObject2GUI
 $object_id
 $node_id
 $creation_forms = array()
 $id_type = array()
 $parent_id
 $access_handler

Detailed Description

Member Function Documentation

ilObjFileGUI::_forwards ( )

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

{
return array();
}
ilObjFileGUI::_goto (   $a_target,
  $a_additional = null 
)

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

References $_GET, $ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, and ilUtil\sendFailure().

{
global $ilErr, $lng, $ilAccess;
if($a_additional && substr($a_additional, -3) == "wsp")
{
$_GET["baseClass"] = "ilsharedresourceGUI";
$_GET["wsp_id"] = $a_target;
include("ilias.php");
}
// static method, no workspace support yet
if ($ilAccess->checkAccess("visible", "", $a_target))
{
ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
}
else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
{
ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
}
$ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
}

+ Here is the call graph for this function:

ilObjFileGUI::addLocatorItems ( )

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

References ilObject2GUI\$node_id.

{
global $ilLocator;
if (is_object($this->object))
{
$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
}
}
ilObjFileGUI::edit ( )

edit object

public

Reimplemented from ilObject2GUI.

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

References $ilErr, ilObject2GUI\checkPermissionBool(), and initPropertiesForm().

{
global $ilTabs, $ilErr;
if (!$this->checkPermissionBool("write"))
{
$ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
}
$ilTabs->activateTab("settings");
$form = $this->initPropertiesForm();
$val = array();
$val['title'] = $this->object->getTitle();
$val['description'] = $this->object->getLongDescription();
$form->setValuesByArray($val);
// Edit ecs export settings
include_once 'Modules/File/classes/class.ilECSFileSettings.php';
$ecs = new ilECSFileSettings($this->object);
$ecs->addSettingsToForm($form, 'file');
$this->tpl->setContent($form->getHTML());
return true;
}

+ Here is the call graph for this function:

ilObjFileGUI::executeCommand ( )

execute command

Reimplemented from ilObject2GUI.

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

References $_GET, $cmd, $ilCtrl, $ilErr, $ilUser, $ret, ilPaymentBookings\_readBookingByTransaction(), ilPaymentObject\_requiresPurchaseToAccess(), ilObjectGUI\addHeaderAction(), ilMDEditorGUI\addObserver(), ilObject2GUI\checkPermissionBool(), ilObject2GUI\getAccessHandler(), ilObject2GUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreenForward(), ilObject2GUI\prepareOutput(), and ilObject2GUI\setLocator().

{
global $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs, $ilAccess, $ilErr;
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
if(!$this->getCreationMode())
{
// do not move this payment block!!
if(IS_PAYMENT_ENABLED)
{
include_once './Services/Payment/classes/class.ilPaymentObject.php';
if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']))
{
$transaction = $_GET['transaction'];
include_once './Services/Payment/classes/class.ilPaymentBookings.php';
$valid_transaction = ilPaymentBookings::_readBookingByTransaction($transaction);
}
if(ilPaymentObject::_requiresPurchaseToAccess($this->node_id, $type = (isset($_GET['purchasetype'])
? $_GET['purchasetype'] : NULL) ))
{
$this->setLocator();
$this->tpl->getStandardTemplate();
include_once './Services/Payment/classes/class.ilShopPurchaseGUI.php';
$pp = new ilShopPurchaseGUI((int)$this->node_id);
$ret = $this->ctrl->forwardCommand($pp);
return true;
}
}
else if($this->id_type == self::REPOSITORY_NODE_ID
&& $this->checkPermissionBool("read"))
{
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
$link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
// add entry to navigation history
$ilNavigationHistory->addItem($this->node_id,
$link, "file");
}
}
$this->prepareOutput();
switch ($next_class)
{
case "ilinfoscreengui":
$this->infoScreenForward(); // forwards command
break;
case 'ilmdeditorgui':
if(!$this->checkPermissionBool("write"))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
}
$ilTabs->activateTab("id_meta");
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;
// repository permissions
case 'ilpermissiongui':
$ilTabs->activateTab("id_permissions");
include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
$perm_gui =& new ilPermissionGUI($this);
$ret =& $this->ctrl->forwardCommand($perm_gui);
break;
case "ilexportgui":
$ilTabs->activateTab("export");
include_once("./Services/Export/classes/class.ilExportGUI.php");
$exp_gui = new ilExportGUI($this);
$exp_gui->addFormat("xml");
$ret = $this->ctrl->forwardCommand($exp_gui);
break;
case 'ilobjectcopygui':
include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
$cp = new ilObjectCopyGUI($this);
$cp->setType('file');
$this->ctrl->forwardCommand($cp);
break;
// personal workspace permissions
case "ilworkspaceaccessgui";
$ilTabs->activateTab("id_permissions");
include_once('./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
$wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
$this->ctrl->forwardCommand($wspacc);
break;
// personal workspace header actions
case "ilcommonactiondispatchergui":
include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
$this->ctrl->forwardCommand($gui);
break;
default:
// in personal workspace use object2gui
if($this->id_type == self::WORKSPACE_NODE_ID)
{
$this->addHeaderAction();
// coming from goto we need default command
if (empty($cmd))
{
$ilCtrl->setCmd("infoScreen");
}
$ilTabs->clearTargets();
}
if (empty($cmd))
{
$cmd = "infoScreen";
}
$this->$cmd();
break;
}
$this->addHeaderAction();
}

+ Here is the call graph for this function:

ilObjFileGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

{
return "file";
}
ilObjFileGUI::infoScreen ( )

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 676 of file class.ilObjFileGUI.php.

References infoScreenForward().

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

+ Here is the call graph for this function:

ilObjFileGUI::infoScreenForward ( )

show information screen

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

References $ilErr, ilHistory\_getEntriesForObject(), ilObjFile\_lookupFileSize(), ilObject2GUI\checkPermissionBool(), ilFormat\formatSize(), ilUserUtil\getNamePresentation(), and ilObject2GUI\getPermanentLinkWidget().

Referenced by executeCommand(), and infoScreen().

{
global $ilTabs, $ilErr;
$ilTabs->activateTab("id_info");
if (!$this->checkPermissionBool("visible"))
{
$ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
}
include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
$info = new ilInfoScreenGUI($this);
if ($this->checkPermissionBool("read", "sendfile"))
{
// 9876
$this->lng->loadLanguageModule("file");
$info->addButton($this->lng->txt("file_download"), $this->ctrl->getLinkTarget($this, "sendfile"));
}
$info->enablePrivateNotes();
if ($this->checkPermissionBool("read"))
{
$info->enableNews();
}
// no news editing for files, just notifications
$info->enableNewsEditing(false);
if ($this->checkPermissionBool("write"))
{
$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"),
ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()),'long'));
$info->addProperty($this->lng->txt("version"),
$this->object->getVersion());
include_once "./Services/History/classes/class.ilHistory.php";
$uploader = ilHistory::_getEntriesForObject($this->object->getId(), $this->object->getType());
$uploader = array_shift($uploader);
$uploader = $uploader["user_id"];
$this->lng->loadLanguageModule("file");
include_once "Services/User/classes/class.ilUserUtil.php";
$info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
if($this->id_type == self::WORKSPACE_NODE_ID)
{
$info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
}
// forward the command
// $this->ctrl->setCmd("showSummary");
// $this->ctrl->setCmdClass("ilinfoscreengui");
$this->ctrl->forwardCommand($info);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjFileGUI::initCreationForms ( )
protected

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

References ilObjectGUI\CFORM_CLONE, ilObject2GUI\fillCloneTemplate(), initSingleUploadForm(), and initZipUploadForm().

{
$forms = array();
$forms[] = $this->initSingleUploadForm();
$forms[] = $this->initZipUploadForm();
// repository only
if($this->id_type != self::WORKSPACE_NODE_ID)
{
$forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
}
return $forms;
}

+ Here is the call graph for this function:

ilObjFileGUI::initPropertiesForm ( )
protected
Parameters
@return

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

References $file, $title, ilRadioOption\setInfo(), and ilTextAreaInputGUI\setRows().

Referenced by edit(), and update().

{
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
$this->lng->loadLanguageModule('file');
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this),'update');
$form->setTitle($this->lng->txt('file_edit'));
$form->addCommandButton('update',$this->lng->txt('save'));
$form->addCommandButton('cancel',$this->lng->txt('cancel'));
$title = new ilTextInputGUI($this->lng->txt('title'),'title');
$title->setValue($this->object->getTitle());
$title->setInfo($this->lng->txt("if_no_title_then_filename"));
$form->addItem($title);
$file = new ilFileInputGUI($this->lng->txt('obj_file'),'file');
$file->setRequired(false);
// $file->enableFileNameSelection('title');
$form->addItem($file);
$group = new ilRadioGroupInputGUI('','replace');
$group->setValue(0);
$replace = new ilRadioOption($this->lng->txt('replace_file'),1);
$replace->setInfo($this->lng->txt('replace_file_info'));
$group->addOption($replace);
$keep = new ilRadioOption($this->lng->txt('file_new_version'),0);
$keep->setInfo($this->lng->txt('file_new_version_info'));
$group->addOption($keep);
$file->addSubItem($group);
$desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
$desc->setRows(3);
#$desc->setCols(40);
$form->addItem($desc);
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjFileGUI::initSingleUploadForm ( )

FORM: Init single upload form.

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

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

Referenced by initCreationForms(), and save().

{
global $lng;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$single_form_gui = new ilPropertyFormGUI();
$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);
$single_form_gui->addItem($in_title);
// File Description
$in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
$single_form_gui->addItem($in_descr);
// File
$in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
$in_file->setRequired(true);
$single_form_gui->addItem($in_file);
$single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
$single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
$single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
$single_form_gui->setTableWidth("600px");
$single_form_gui->setTarget($this->getTargetFrame("save"));
$single_form_gui->setTitle($this->lng->txt($this->type."_new"));
$single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.png'), $this->lng->txt('obj_file'));
$this->ctrl->setParameter($this, "new_type", "file");
$single_form_gui->setFormAction($this->ctrl->getFormAction($this, "save"));
return $single_form_gui;
}

+ 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.

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

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

Referenced by initCreationForms(), and saveUnzip().

{
global $lng;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$zip_form_gui = new ilPropertyFormGUI();
$zip_form_gui->setMultipart(true);
// File
$in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
$in_file->setRequired(true);
$in_file->setSuffixes(array("zip"));
$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"));
$zip_form_gui->addItem($in_str);
$zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
$zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
$zip_form_gui->setTableWidth("600px");
$zip_form_gui->setTarget($this->getTargetFrame("save"));
$zip_form_gui->setTitle($this->lng->txt("header_zip"));
$zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.png'), $this->lng->txt('obj_file'));
$this->ctrl->setParameter($this, "new_type", "file");
$zip_form_gui->setFormAction($this->ctrl->getFormAction($this, "saveUnzip"));
return $zip_form_gui;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjFileGUI::save ( )

save object

public

Reimplemented from ilObject2GUI.

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

References $ilUser, ilObjectGUI\$objDefinition, $title, ilObjFileAccess\_getFileExtension(), ilChangeEvent\_recordWriteEvent(), ilObject2GUI\checkPermissionBool(), ilMimeTypeUtil\getMimeType(), initSingleUploadForm(), ilObject2GUI\putObjectInTree(), ilUtil\redirect(), and ilUtil\sendSuccess().

Referenced by saveAndMeta().

{
if (!$this->checkPermissionBool("create", "", "file"))
{
$this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
}
$single_form_gui = $this->initSingleUploadForm();
if ($single_form_gui->checkInput())
{
$title = $single_form_gui->getInput("title");
$description = $single_form_gui->getInput("description");
$upload_file = $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"]);
$this->object_id = $fileObj->create();
$this->putObjectInTree($fileObj, $this->parent_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::sendSuccess($this->lng->txt("file_added"),true);
if ($this->ctrl->getCmd() == "saveAndMeta")
{
$this->ctrl->setParameter($this, "new_type", "");
$target = $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilmdeditorgui"), "listSection", "", false, false);
ilUtil::redirect($target);
}
else
{
$this->ctrl->returnToParent($this);
}
}
else
{
$single_form_gui->setValuesByPost();
$this->tpl->setContent($single_form_gui->getHTML());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjFileGUI::saveAndMeta ( )

save object

public

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

References save().

{
$this->save();
}

+ Here is the call graph for this function:

ilObjFileGUI::saveUnzip ( )

saveUnzip object

public

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

References ilObject2GUI\$access_handler, ilObject2GUI\$tree, ilObject\_lookupType(), ilObject2GUI\checkPermissionBool(), ilUtil\delDir(), ilObject2GUI\getAccessHandler(), ilUtil\ilTempnam(), initZipUploadForm(), ilUtil\makeDir(), ilFileUtils\processZipFile(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
$zip_form_gui = $this->initZipUploadForm();
if ($this->checkPermissionBool("create", "", "file"))
{
if ($zip_form_gui->checkInput())
{
$zip_file = $zip_form_gui->getInput("zip_file");
$adopt_structure = $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($this->id_type != self::WORKSPACE_NODE_ID)
{
$type = ilObject::_lookupType((int)$this->parent_id, true);
}
else
{
$type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
}
switch($type)
{
// workspace structure
case 'wfld':
case 'wsrt':
$permission = $this->checkPermissionBool("create", "", "wfld");
$containerType = "WorkspaceFolder";
break;
// use categories as structure
case 'cat':
case 'root':
$permission = $this->checkPermissionBool("create", "", "cat");
$containerType = "Category";
break;
// use folders as structure (in courses)
default:
$permission = $this->checkPermissionBool("create", "", "fold");
$containerType = "Folder";
break;
}
// 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),
$this->parent_id,
$containerType,
ilUtil::sendSuccess($this->lng->txt("file_added"),true);
}
{
ilUtil::sendFailure($e->getMessage(), true);
}
ilUtil::delDir($newDir);
$this->ctrl->returnToParent($this);
}
else
{
$zip_form_gui->setValuesByPost();
$this->tpl->setContent($zip_form_gui->getHTML());
}
}
else
{
$this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
}
}

+ Here is the call graph for this function:

ilObjFileGUI::sendFile ( )

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

References $_GET, $ilCtrl, $ilUser, ilChangeEvent\_recordReadEvent(), and ilObject2GUI\checkPermissionBool().

{
global $ilUser, $ilCtrl;
if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']) )
{
$this->object->sendFile($_GET["hist_id"]);
}
if ($this->checkPermissionBool("read"))
{
// 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->getType(), $this->object->getRefId(),
$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::setTabs ( )

create tabs (repository/workspace switch)

this had to be moved here because of the context-specific permission tab

Reimplemented from ilObject2GUI.

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

References ilObjectGUI\$lng, and ilObject2GUI\checkPermissionBool().

{
global $ilTabs, $lng, $ilHelp;
$ilHelp->setScreenIdComponent("file");
$this->ctrl->setParameter($this,"ref_id",$this->node_id);
if ($this->checkPermissionBool("visible"))
{
$ilTabs->addTab("id_info",
$lng->txt("info_short"),
$this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary"));
}
if ($this->checkPermissionBool("write"))
{
$ilTabs->addTab("settings",
$lng->txt("edit"),
$this->ctrl->getLinkTarget($this, "edit"));
}
if ($this->checkPermissionBool("write"))
{
$ilTabs->addTab("id_versions",
$lng->txt("versions"),
$this->ctrl->getLinkTarget($this, "versions"));
}
// meta data
if ($this->checkPermissionBool("write"))
{
$ilTabs->addTab("id_meta",
$lng->txt("meta_data"),
$this->ctrl->getLinkTargetByClass(array('ilobjfilegui','ilmdeditorgui'),'listSection'));
}
// export
if ($this->checkPermissionBool("write"))
{
$ilTabs->addTab("export",
$lng->txt("export"),
$this->ctrl->getLinkTargetByClass("ilexportgui", ""));
}
// will add permission tab if needed
}

+ Here is the call graph for this function:

ilObjFileGUI::update ( )

updates object entry in object_data

public

Reimplemented from ilObject2GUI.

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

References ilObjectGUI\$data, $filename, $ilUser, $title, ilChangeEvent\_catchupWriteEvents(), ilChangeEvent\_recordWriteEvent(), ilMimeTypeUtil\getMimeType(), initPropertiesForm(), ilUtil\redirect(), and ilUtil\sendSuccess().

{
global $ilTabs;
$form = $this->initPropertiesForm();
if(!$form->checkInput())
{
$ilTabs->activateTab("settings");
$form->setValuesByPost();
$this->tpl->setContent($form->getHTML());
return false;
}
$data = $form->getInput('file');
// delete trailing '/' in filename
while (substr($data["name"],-1) == '/')
{
$data["name"] = substr($data["name"],0,-1);
}
$filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
$title = $form->getInput('title');
if(strlen(trim($title)) == 0)
{
}
else
{
$title = $this->object->checkFileExtension($filename,$title);
}
$this->object->setTitle($title);
if (!empty($data["name"]))
{
switch($form->getInput('replace'))
{
case 1:
$this->object->deleteVersions();
$this->object->clearDataDirectory();
$this->object->replaceFile($data['tmp_name'],$data['name']);
break;
case 0:
$this->object->addFileVersion($data['tmp_name'],$data['name']);
break;
}
$this->object->setFileName($data['name']);
include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
$this->object->setFileType(ilMimeTypeUtil::getMimeType(
"", $data["name"], $data["type"]));
$this->object->setFileSize($data['size']);
}
$this->object->setDescription($form->getInput('description'));
$this->update = $this->object->update();
// BEGIN ChangeEvent: Record update event.
if (!empty($data["name"]))
{
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.
// Update ecs export settings
include_once 'Modules/File/classes/class.ilECSFileSettings.php';
$ecs = new ilECSFileSettings($this->object);
$ecs->handleSettingsUpdate();
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
ilUtil::redirect($this->ctrl->getLinkTarget($this,'edit','',false,false));
}

+ Here is the call graph for this function:

ilObjFileGUI::versions ( )

file versions/history

public

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

References $_GET, ilObject2GUI\checkPermissionBool(), and ilHistoryGUI\getVersionsTable().

{
global $ilTabs;
$ilTabs->activateTab("id_versions");
if (!$this->checkPermissionBool("write"))
{
$this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
}
require_once("./Services/History/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" => $this->node_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: