ILIAS  Release_4_0_x_branch Revision 61816
 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
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 getHTML ()
 undeleteObject ()
 Get objects back from trash.
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled
 cancelDeleteObject ()
 cancel deletion of object
 removeFromSystemObject ()
 remove objects from trash bin and all entries therefore every object needs a specific deleteObject() method
 createObject ()
 create new object form
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 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.
 trashObject ()
 Show trash content of object.
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.
 copyWizardHasOptions ($a_mode)
 Check if there is any modules specific option.

Protected Member Functions

 getPropertiesValues ($a_mode= 'edit')
 initPropertiesForm ($a_mode)
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 prepareOutput ()
 prepare output
 setTitleAndDescription ()
 called by prepare output
 showUpperIcon ()
 setTabs ()
 set admin tabs public
 setAdminTabs ()
 set admin tabs public
 setLocator ()
 set Locator
 omitLocator ($a_omit=true)
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 displayEditForm ($fields)
 display edit form (usually called by editObject)
 afterUpdate ()
 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
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 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="")
 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.
 searchCloneSourceObject ()
 Search clone source by title.
 buildCloneSelect ($existing_objs)
 Build a select box for clonable objects (permission write)
 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

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 23335 2010-03-23 14:10:15Z smeyer

ilObjFileGUI: ilMDEditorGUI, ilInfoScreenGUI, ilPermissionGUI, ilShopPurchaseGUI, ilObjectCopyGUI

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

Member Function Documentation

ilObjFileGUI::_forwards ( )

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

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

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

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

{
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::sendFailure(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 845 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 148 of file class.ilObjFileGUI.php.

References $_GET, $_POST, $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 530 of file class.ilObjFileGUI.php.

References $_SESSION, ilObjectGUI\getFormAction(), getPropertiesValues(), ilObjectGUI\getTargetFrame(), ilObjectGUI\getTemplateFile(), initPropertiesForm(), 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);
}
$this->tabs_gui->setTabActive('edit');
$this->initPropertiesForm('edit');
$this->getPropertiesValues('edit');
$this->tpl->setContent($this->form->getHTML());
return true;
$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 58 of file class.ilObjFileGUI.php.

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

{
global $ilAccess, $ilNavigationHistory,$ilCtrl;
// 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("Services/AccessControl/classes/class.ilPermissionGUI.php");
$perm_gui =& new ilPermissionGUI($this);
$ret =& $this->ctrl->forwardCommand($perm_gui);
break;
case 'ilobjectcopygui':
include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
$cp = new ilObjectCopyGUI($this);
$cp->setType('file');
$this->ctrl->forwardCommand($cp);
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::getPropertiesValues (   $a_mode = 'edit')
protected

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

Referenced by editObject().

{
if($a_mode == 'edit')
{
$val['title'] = $this->object->getTitle();
$val['description'] = $this->object->getLongDescription();
$this->form->setValuesByArray($val);
}
return true;
}

+ Here is the caller 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 768 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);
$this->lng->loadLanguageModule('file');
}

+ Here is the call graph for this function:

ilObjFileGUI::infoScreen ( )

show information screen

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

References $_GET, ilObjFile\_lookupFileSize(), and ilFormat\formatSize().

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"),
ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()),'long'));
$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 698 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::initPropertiesForm (   $a_mode)
protected
Parameters
@return

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

References $desc, $file, ilObjectGUI\$lng, $title, and ilRadioOption\setInfo().

Referenced by editObject(), and updateObject().

{
global $lng;
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this),'update');
$this->form->setTitle($this->lng->txt('file_edit'));
$this->form->addCommandButton('update',$this->lng->txt('save'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
$title = new ilTextInputGUI($this->lng->txt('title'),'title');
$title->setValue($this->object->getTitle());
$title->setInfo($lng->txt("if_no_title_then_filename"));
$this->form->addItem($title);
$file = new ilFileInputGUI($this->lng->txt('obj_file'),'file');
$file->setRequired(false);
// $file->enableFileNameSelection('title');
$this->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);
$this->form->addItem($desc);
}

+ Here is the call graph for this function:

+ Here is the caller 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 187 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 241 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 443 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 361 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\sendSuccess().

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::sendSuccess($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 289 of file class.ilObjFileGUI.php.

References $_GET, $type, ilObject\_lookupType(), ilObjectGUI\createObject(), ilUtil\delDir(), ilUtil\ilTempnam(), initZipUploadForm(), ilUtil\makeDir(), ilFileUtils\processZipFile(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
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
$type = ilObject::_lookupType((int) $_GET['ref_id'],true);
if($type == 'cat' or $type == 'root')
{
$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::sendSuccess($this->lng->txt("file_added"),true);
}
{
ilUtil::sendFailure($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 640 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 453 of file class.ilObjFileGUI.php.

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

{
$this->tabs_gui->setTabActive('edit');
$this->initPropertiesForm('edit');
if(!$this->form->checkInput())
{
$this->form->setValuesByPost();
$this->tpl->setContent($this->form->getHTML());
return false;
}
$data = $this->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 = $this->form->getInput('title');
if(strlen(trim($title)) == 0)
{
}
else
{
$title = $this->object->checkFileExtension($filename,$title);
}
$this->object->setTitle($title);
if (!empty($data["name"]))
{
switch($this->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($this->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.
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
ilUtil::redirect($this->ctrl->getLinkTarget($this,'edit'));
}

+ Here is the call graph for this function:

ilObjFileGUI::versionsObject ( )

file versions/history

public

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

References $_GET, and ilHistoryGUI\getVersionsTable().

{
global $rbacsystem, $ilAccess;
if (!$ilAccess->checkAccess("write", "", $_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: