ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjFileGUI Class Reference

GUI class for file objects. More...

+ Inheritance diagram for ilObjFileGUI:
+ Collaboration diagram for ilObjFileGUI:

Public Member Functions

 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 Constructor. More...
 
 getType ()
 Functions that must be overwritten. More...
 
 _forwards ()
 
 executeCommand ()
 execute command More...
 
 initSingleUploadForm ()
 FORM: Init single upload form. More...
 
 save ()
 save object More...
 
 saveAndMeta ()
 save object More...
 
 initZipUploadForm ($a_mode="create")
 FORM: Init zip upload form. More...
 
 saveUnzip ()
 saveUnzip object More...
 
 update ()
 updates object entry in object_data More...
 
 edit ()
 edit object More...
 
 sendFile ()
 
 versions ()
 file versions/history More...
 
 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 More...
 
 infoScreenForward ()
 show information screen More...
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initMultiUploadForm ()
 Initializes the upload form for multiple files. More...
 
 uploadFiles ()
 Called after a file was uploaded. More...
 
 deleteVersions ()
 Displays a confirmation screen with selected file versions that should be deleted. More...
 
 confirmDeleteVersions ()
 Deletes the file versions that were confirmed by the user. More...
 
 cancelDeleteVersions ()
 Cancels the file version deletion. More...
 
 confirmDeleteFile ()
 Deletes this file object. More...
 
 cancelDeleteFile ()
 Cancels the file deletion. More...
 
 compareHistoryIds ($v1, $v2)
 Compares two versions either by passing a history entry or an id. More...
 
 rollbackVersion ()
 Performs a rollback with the selected file version. More...
 
- Public Member Functions inherited from ilObject2GUI
 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 Constructor. More...
 
executeCommand ()
 execute command More...
 
 delete ()
 Display delete confirmation form (repository/workspace switch) More...
 
 confirmedDelete ()
 Delete objects (repository/workspace switch) More...
 
 getHTML ()
 
 withReferences ()
 Final/Private declaration of unchanged parent methods. More...
 
 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 More...
 
 getCreationMode ()
 get creation mode More...
 
 isVisible ()
 
 trash ()
 
 undelete ()
 
 cancelDelete ()
 
 removeFromSystem ()
 
 cloneAll ()
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 Deleted in ilObject. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 importFile ()
 Import. More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor @access public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 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 More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Static Public Member Functions

static _goto ($a_target, $a_additional=null)
 
- Static Public Member Functions inherited from ilObject2GUI
static handleAfterSaveCallback (ilObject $a_obj, $a_callback_ref_id)
 After creation callback. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Protected Member Functions

 initCreationForms ()
 
 initPropertiesForm ()
 
 handleFileUpload ($file_upload)
 Handles the upload of a single file and adds it to the parent object. More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
- Protected Member Functions inherited from ilObject2GUI
 afterConstructor ()
 Do anything that should be done after constructor in here. More...
 
 assignObject ()
 create object instance as internal property (repository/workspace switch) More...
 
 getAccessHandler ()
 Get access handler. More...
 
 setLocator ()
 set Locator More...
 
 deleteConfirmation ()
 Display delete confirmation form (workspace specific) More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) More...
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 showUpperIcon ()
 
 omitLocator ($a_omit=true)
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="")
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 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. More...
 
 fillCloneSearchTemplate ($a_tpl_varname, $a_type)
 
 searchCloneSource ()
 
 buildCloneSelect ($existing_objs)
 
 addAdminLocatorItems ()
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation ()
 Deprecated functions. More...
 
 setReturnLocation ()
 
 showActions ()
 
 getTitlesByRefId ()
 
 getTabs ()
 
 __showButton ()
 
 hitsperpageObject ()
 
 __initTableGUI ()
 
 __setTableGUIBasicData ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
 Check permission. More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
 getPermanentLinkWidget ($a_append=null, $a_center=false)
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __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 More...
 
 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 More...
 
 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. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $log = null
 
- Protected Attributes inherited from ilObject2GUI
 $object_id
 
 $node_id
 
 $creation_forms = array()
 
 $id_type = array()
 
 $parent_id
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 

Additional Inherited Members

- 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
 
const PORTFOLIO_OBJECT_ID = 5
 
- 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
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjFileGUI::__construct (   $a_id = 0,
  $a_id_type = self::REPOSITORY_NODE_ID,
  $a_parent_node_id = 0 
)

Constructor.

Parameters
int$a_id
int$a_id_type
int$a_parent_node_id

Reimplemented from ilObject2GUI.

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

33 {
34 $this->log = ilLoggerFactory::getLogger('file');
35 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
36 }
static getLogger($a_component_id)
Get component logger.

References ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

Member Function Documentation

◆ _forwards()

ilObjFileGUI::_forwards ( )

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

45 {
46 return array();
47 }

◆ _goto()

static ilObjFileGUI::_goto (   $a_target,
  $a_additional = null 
)
static

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

973 {
974 global $ilErr, $lng, $ilAccess;
975
976 if($a_additional && substr($a_additional, -3) == "wsp")
977 {
978 $_GET["baseClass"] = "ilsharedresourceGUI";
979 $_GET["wsp_id"] = $a_target;
980 include("ilias.php");
981 exit;
982 }
983
984 // added support for direct download goto links
985 if($a_additional && substr($a_additional, -8) == "download")
986 {
987 ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
988 }
989
990 // static method, no workspace support yet
991
992 if ($ilAccess->checkAccess("visible", "", $a_target) ||
993 $ilAccess->checkAccess("read", "", $a_target))
994 {
995 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
996 }
997 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
998 {
999 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1002 }
1003
1004 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1005 }
$_GET["client_id"]
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
exit
Definition: login.php:54

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

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjFileGUI::addLocatorItems ( )

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

1011 {
1012 global $ilLocator;
1013
1014 if (is_object($this->object))
1015 {
1016 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
1017 }
1018 }

◆ cancelDeleteFile()

ilObjFileGUI::cancelDeleteFile ( )

Cancels the file deletion.

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

1419 {
1420 $this->ctrl->redirect($this, "versions");
1421 }

◆ cancelDeleteVersions()

ilObjFileGUI::cancelDeleteVersions ( )

Cancels the file version deletion.

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

1390 {
1391 $this->ctrl->redirect($this, "versions");
1392 }

◆ compareHistoryIds()

ilObjFileGUI::compareHistoryIds (   $v1,
  $v2 
)

Compares two versions either by passing a history entry or an id.

Parameters
$v1The first version to compare.
$v2The second version to compare.
Returns

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

1431 {
1432 if (is_array($v1))
1433 $v1 = (int)$v1["hist_entry_id"];
1434 else if (!is_int($v1))
1435 $v1 = (int)$v1;
1436
1437 if (is_array($v2))
1438 $v2 = (int)$v2["hist_entry_id"];
1439 else if (!is_int($v2))
1440 $v2 = (int)$v2;
1441
1442 return $v1 - $v2;
1443 }

◆ confirmDeleteFile()

ilObjFileGUI::confirmDeleteFile ( )

Deletes this file object.

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

1398 {
1399 // has the user the rights to delete the file?
1400 if (!$this->checkPermissionBool("write"))
1401 {
1402 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1403 }
1404
1405 // delete this file object
1406 include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
1407 $ru = new ilRepUtilGUI($this);
1408 $ru->deleteObjects($this->parent_id, array($this->ref_id));
1409
1410 // redirect to parent object
1411 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_id);
1412 $this->ctrl->redirectByClass("ilrepositorygui");
1413 }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
Repository GUI Utilities.

References ilObject2GUI\checkPermissionBool().

+ Here is the call graph for this function:

◆ confirmDeleteVersions()

ilObjFileGUI::confirmDeleteVersions ( )

Deletes the file versions that were confirmed by the user.

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

1366 {
1367 global $ilTabs;
1368
1369 // has the user the rights to delete versions?
1370 if (!$this->checkPermissionBool("write"))
1371 {
1372 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1373 }
1374
1375 // delete versions after confirmation
1376 if (count($_POST["hist_id"]) > 0)
1377 {
1378 $this->object->deleteVersions($_POST["hist_id"]);
1379 ilUtil::sendSuccess($this->lng->txt("file_versions_deleted"), true);
1380 }
1381
1382 $this->ctrl->setParameter($this, "hist_id", "");
1383 $this->ctrl->redirect($this, "versions");
1384 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, ilObject2GUI\checkPermissionBool(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteVersions()

ilObjFileGUI::deleteVersions ( )

Displays a confirmation screen with selected file versions that should be deleted.

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

1308 {
1309 global $ilTabs, $ilLocator;
1310
1311 // get ids either from GET (if single item was clicked) or
1312 // from POST (if multiple items were selected)
1313 $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1314
1315 if (count($version_ids) < 1)
1316 {
1317 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1318 $this->ctrl->redirect($this, "versions");
1319 }
1320 else
1321 {
1322 $ilTabs->activateTab("id_versions");
1323
1324 // check if all versions are selected
1325 $versionsToKeep = array_udiff($this->object->getVersions(), $version_ids, array($this, "compareHistoryIds"));
1326 if (count($versionsToKeep) < 1)
1327 {
1328 // set our message
1329 ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_all_versions"));
1330
1331 // show confirmation gui
1332 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1333 $conf_gui = new ilConfirmationGUI();
1334 $conf_gui->setFormAction($this->ctrl->getFormAction($this, "versions"));
1335 $conf_gui->setCancel($this->lng->txt("cancel"), "cancelDeleteFile");
1336 $conf_gui->setConfirm($this->lng->txt("confirm"), "confirmDeleteFile");
1337
1338 $conf_gui->addItem("id[]", $this->ref_id, $this->object->getTitle(),
1339 ilObject::_getIcon($this->object->getId(), "small", $this->object->getType()),
1340 $this->lng->txt("icon")." ".$this->lng->txt("obj_".$this->object->getType()));
1341
1342 $html = $conf_gui->getHTML();
1343 }
1344 else
1345 {
1346 include_once("./Modules/File/classes/class.ilFileVersionTableGUI.php");
1347
1348 ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_versions"));
1349 $versions = $this->object->getVersions($version_ids);
1350
1351 $table = new ilFileVersionTableGUI($this, 'versions', true);
1352 $table->setMaxCount(sizeof($versions));
1353 $table->setData($versions);
1354
1355 $html = $table->getHTML();
1356 }
1357
1358 $this->tpl->setVariable('ADM_CONTENT', $html);
1359 }
1360 }
Confirmation screen class.
Class ilFileVersionTableGUI.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
$html
Definition: example_001.php:87

References $_GET, $_POST, $html, ilObject\_getIcon(), ilUtil\sendFailure(), and ilUtil\sendQuestion().

+ Here is the call graph for this function:

◆ edit()

ilObjFileGUI::edit ( )

edit object

@access public

Reimplemented from ilObject2GUI.

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

601 {
602 global $ilTabs, $ilErr;
603
604 if (!$this->checkPermissionBool("write"))
605 {
606 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
607 }
608
609 $ilTabs->activateTab("settings");
610
611 $form = $this->initPropertiesForm();
612
613 $val = array();
614 $val['title'] = $this->object->getTitle();
615 $val['description'] = $this->object->getLongDescription();
616 $val['rating'] = $this->object->hasRating();
617 $form->setValuesByArray($val);
618
619 // Edit ecs export settings
620 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
621 $ecs = new ilECSFileSettings($this->object);
622 $ecs->addSettingsToForm($form, 'file');
623
624 $this->tpl->setContent($form->getHTML());
625 return true;
626 }
Class ilECSFileSettings.

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

+ Here is the call graph for this function:

◆ executeCommand()

ilObjFileGUI::executeCommand ( )

execute command

Reimplemented from ilObject2GUI.

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

50 {
51 global $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs, $ilAccess, $ilErr;
52
53 $next_class = $this->ctrl->getNextClass($this);
54 $cmd = $this->ctrl->getCmd();
55
56 if($this->id_type == self::WORKSPACE_NODE_ID)
57 {
58 include_once "Services/Form/classes/class.ilFileInputGUI.php";
60 }
61
62 if(!$this->getCreationMode())
63 {
64 // do not move this payment block!!
65 if(IS_PAYMENT_ENABLED)
66 {
67 include_once './Services/Payment/classes/class.ilPaymentObject.php';
68 if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']))
69 {
70 $transaction = $_GET['transaction'];
71 include_once './Services/Payment/classes/class.ilPaymentBookings.php';
72 $valid_transaction = ilPaymentBookings::_readBookingByTransaction($transaction);
73 }
74
75 if(ilPaymentObject::_requiresPurchaseToAccess($this->node_id, $type = (isset($_GET['purchasetype'])
76 ? $_GET['purchasetype'] : NULL) ))
77 {
78 $this->setLocator();
79 $this->tpl->getStandardTemplate();
80
81 include_once './Services/Payment/classes/class.ilShopPurchaseGUI.php';
82 $pp = new ilShopPurchaseGUI((int)$this->node_id);
83 $ret = $this->ctrl->forwardCommand($pp);
84 return true;
85 }
86 }
87 else if($this->id_type == self::REPOSITORY_NODE_ID
88 && $this->checkPermissionBool("read"))
89 {
90 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
91 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
92 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
93
94 // add entry to navigation history
95 $ilNavigationHistory->addItem($this->node_id,
96 $link, "file");
97 }
98 }
99
100 $this->prepareOutput();
101
102 switch ($next_class)
103 {
104 case "ilinfoscreengui":
105 $this->infoScreenForward(); // forwards command
106 break;
107
108 case 'ilobjectmetadatagui':
109 if(!$this->checkPermissionBool("write"))
110 {
111 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
112 }
113
114 $ilTabs->activateTab("id_meta");
115
116 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
117 $md_gui = new ilObjectMetaDataGUI($this->object);
118
119 // todo: make this work
120 // $md_gui->addMDObserver($this->object,'MDUpdateListener','Technical');
121
122 $this->ctrl->forwardCommand($md_gui);
123 break;
124
125 // repository permissions
126 case 'ilpermissiongui':
127 $ilTabs->activateTab("id_permissions");
128 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
129 $perm_gui =& new ilPermissionGUI($this);
130 $ret =& $this->ctrl->forwardCommand($perm_gui);
131 break;
132
133 case "ilexportgui":
134 if(!$this->checkPermissionBool("write"))
135 {
136 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
137 }
138 $ilTabs->activateTab("export");
139 include_once("./Services/Export/classes/class.ilExportGUI.php");
140 $exp_gui = new ilExportGUI($this);
141 $exp_gui->addFormat("xml");
142 $ret = $this->ctrl->forwardCommand($exp_gui);
143 break;
144
145 case 'ilobjectcopygui':
146 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
147 $cp = new ilObjectCopyGUI($this);
148 $cp->setType('file');
149 $this->ctrl->forwardCommand($cp);
150 break;
151
152 // personal workspace permissions
153 case "ilworkspaceaccessgui";
154 $ilTabs->activateTab("id_permissions");
155 include_once('./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
156 $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
157 $this->ctrl->forwardCommand($wspacc);
158 break;
159
160 case "ilcommonactiondispatchergui":
161 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
163 $this->ctrl->forwardCommand($gui);
164 break;
165
166 case "illearningprogressgui":
167 $ilTabs->activateTab('learning_progress');
168 require_once 'Services/Tracking/classes/class.ilLearningProgressGUI.php';
169 $new_gui =& new ilLearningProgressGUI(
171 $this->object->getRefId(),
172 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
173 );
174 $this->ctrl->forwardCommand($new_gui);
175 $this->tabs_gui->setTabActive('learning_progress');
176 break;
177
178 default:
179 // in personal workspace use object2gui
180 if($this->id_type == self::WORKSPACE_NODE_ID)
181 {
182 $this->addHeaderAction();
183
184 // coming from goto we need default command
185 if (empty($cmd))
186 {
187 $ilCtrl->setCmd("infoScreen");
188 }
189 $ilTabs->clearTargets();
190 return parent::executeCommand();
191 }
192
193 if (empty($cmd))
194 {
195 $cmd = "infoScreen";
196 }
197
198 $this->$cmd();
199 break;
200 }
201
202 $this->addHeaderAction();
203 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
setPersonalWorkspaceQuotaCheck($a_value)
Class ilObjUserTrackingGUI.
infoScreenForward()
show information screen
getAccessHandler()
Get access handler.
prepareOutput()
prepare output
getCreationMode()
get creation mode
setLocator()
set Locator
GUI class for the workflow of copying objects.
addHeaderAction()
Add header action menu.
Class ilObjectMetaDataGUI.
static _readBookingByTransaction($a_transaction)
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Class ilShopPurchaseGUI.
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ getType()

ilObjFileGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

39 {
40 return "file";
41 }

◆ handleFileUpload()

ilObjFileGUI::handleFileUpload (   $file_upload)
protected

Handles the upload of a single file and adds it to the parent object.

Parameters
array$file_uploadAn array containing the file upload parameters.
Returns
object The response object.

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

1133 {
1134 global $ilUser;
1135 require_once('./Services/Utilities/classes/class.ilFileUtils.php');
1136 // file upload params
1138 $type = ilUtil::stripSlashes($file_upload["type"]);
1140 $temp_name = $file_upload["tmp_name"];
1141
1142 // additional params
1143 $title = ilUtil::stripSlashes($file_upload["title"]);
1144 $description = ilUtil::stripSlashes($file_upload["description"]);
1145 $extract = ilUtil::stripSlashes($file_upload["extract"]);
1146 $keep_structure = ilUtil::stripSlashes($file_upload["keep_structure"]);
1147
1148 // create answer object
1149 $response = new stdClass();
1150 $response->fileName = $filename;
1151 $response->fileSize = intval($size);
1152 $response->fileType = $type;
1153 $response->fileUnzipped = $extract;
1154 $response->error = null;
1155
1156 // extract archive?
1157 if ($extract)
1158 {
1159 $zip_file = $filename;
1160 $adopt_structure = $keep_structure;
1161
1162 include_once ("Services/Utilities/classes/class.ilFileUtils.php");
1163
1164 // Create unzip-directory
1165 $newDir = ilUtil::ilTempnam();
1166 ilUtil::makeDir($newDir);
1167
1168 // Check if permission is granted for creation of object, if necessary
1169 if($this->id_type != self::WORKSPACE_NODE_ID)
1170 {
1171 $type = ilObject::_lookupType((int)$this->parent_id, true);
1172 }
1173 else
1174 {
1175 $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
1176 }
1177
1178 $tree = $access_handler = null;
1179 switch($type)
1180 {
1181 // workspace structure
1182 case 'wfld':
1183 case 'wsrt':
1184 $permission = $this->checkPermissionBool("create", "", "wfld");
1185 $containerType = "WorkspaceFolder";
1188 break;
1189
1190 // use categories as structure
1191 case 'cat':
1192 case 'root':
1193 $permission = $this->checkPermissionBool("create", "", "cat");
1194 $containerType = "Category";
1195 break;
1196
1197 // use folders as structure (in courses)
1198 default:
1199 $permission = $this->checkPermissionBool("create", "", "fold");
1200 $containerType = "Folder";
1201 break;
1202 }
1203
1204 try
1205 {
1206 // processZipFile (
1207 // Dir to unzip,
1208 // Path to uploaded file,
1209 // should a structure be created (+ permission check)?
1210 // ref_id of parent
1211 // object that contains files (folder or category)
1212 // should sendInfo be persistent?)
1214 $newDir,
1215 $temp_name,
1216 ($adopt_structure && $permission),
1217 $this->parent_id,
1218 $containerType,
1219 $tree,
1221 }
1222 catch (ilFileUtilsException $e)
1223 {
1224 $response->error = $e->getMessage();
1225 }
1226 catch (Exception $ex)
1227 {
1228 $response->error = $ex->getMessage();
1229 }
1230
1231 ilUtil::delDir($newDir);
1232
1233 // #15404
1234 if($this->id_type != self::WORKSPACE_NODE_ID)
1235 {
1236 foreach(ilFileUtils::getNewObjects() as $parent_ref_id => $objects)
1237 {
1238 if($parent_ref_id != $this->parent_id)
1239 {
1240 continue;
1241 }
1242
1243 foreach($objects as $object)
1244 {
1245 $this->after_creation_callback_objects[] = $object;
1246 }
1247 }
1248 }
1249 }
1250 else
1251 {
1252 if (trim($title) == "")
1253 {
1254 $title = $filename;
1255 }
1256 else
1257 {
1258 // BEGIN WebDAV: Ensure that object title ends with the filename extension
1260 $titleExtension = ilObjFileAccess::_getFileExtension($title);
1261 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
1262 {
1263 $title .= '.'.$fileExtension;
1264 }
1265 // END WebDAV: Ensure that object title ends with the filename extension
1266 }
1267
1268 // create and insert file in grp_tree
1269 include_once("./Modules/File/classes/class.ilObjFile.php");
1270 $fileObj = new ilObjFile();
1271 $fileObj->setTitle($title);
1272 $fileObj->setDescription($description);
1273 $fileObj->setFileName($filename);
1274
1275 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1276 $fileObj->setFileType(ilMimeTypeUtil::getMimeType("", $filename, $type));
1277 $fileObj->setFileSize($size);
1278 $this->object_id = $fileObj->create();
1279
1280 $this->putObjectInTree($fileObj, $this->parent_id);
1281
1282 // see uploadFiles()
1283 if(is_array($this->after_creation_callback_objects))
1284 {
1285 $this->after_creation_callback_objects[] = $fileObj;
1286 }
1287
1288 // upload file to filesystem
1289 $fileObj->createDirectory();
1290 $fileObj->raiseUploadError(false);
1291 $fileObj->getUploadFile($temp_name, $filename, false);
1292
1293 $this->handleAutoRating($fileObj);
1294
1295 // BEGIN ChangeEvent: Record write event.
1296 require_once('./Services/Tracking/classes/class.ilChangeEvent.php');
1297 ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
1298 // END ChangeEvent: Record write event.
1299 }
1300
1301 return $response;
1302 }
$size
Definition: RandomTest.php:79
$filename
Definition: buildRTE.php:89
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
Class to report exception.
static getValidFilename($a_filename)
Get valid filename.
static getNewObjects()
processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
static getMimeType($a_file='', $a_filename='', $a_mime='')
static _getFileExtension($a_file_name)
Gets the file extension of the specified file name.
Class ilObjFile.
handleAutoRating(ilObject $a_new_obj)
Activate rating automatically if parent container setting.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
static _lookupType($a_id, $a_reference=false)
lookup object type
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References ilObject2GUI\$access_handler, $filename, $ilUser, ilObjectGUI\$object, $size, ilObject2GUI\$tree, ilObjFileAccess\_getFileExtension(), ilObject\_lookupType(), ilChangeEvent\_recordWriteEvent(), ilObject2GUI\checkPermissionBool(), ilUtil\delDir(), ilObject2GUI\getAccessHandler(), ilMimeTypeUtil\getMimeType(), ilFileUtils\getNewObjects(), ilFileUtils\getValidFilename(), ilObject2GUI\handleAutoRating(), ilUtil\ilTempnam(), ilUtil\makeDir(), ilFileUtils\processZipFile(), ilObject2GUI\putObjectInTree(), and ilUtil\stripSlashes().

Referenced by uploadFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreen()

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

767 {
768 $this->ctrl->setCmd("showSummary");
769 $this->ctrl->setCmdClass("ilinfoscreengui");
770 $this->infoScreenForward();
771 }

References infoScreenForward().

+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

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

777 {
778 global $ilTabs, $ilErr, $ilToolbar;
779
780 $ilTabs->activateTab("id_info");
781
782 if (!$this->checkPermissionBool("visible"))
783 {
784 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
785 }
786
787 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
788 $info = new ilInfoScreenGUI($this);
789
790 if ($this->checkPermissionBool("read", "sendfile"))
791 {
792 // #9876
793 $this->lng->loadLanguageModule("file");
794
795 // #14378
796 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
797 $button = ilLinkButton::getInstance();
798 $button->setCaption("file_download");
799 $button->setPrimary(true);
800
801 // get permanent download link for repository
802 if ($this->id_type == self::REPOSITORY_NODE_ID)
803 {
804 $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
805 }
806 else
807 {
808 $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
809 }
810
811 $ilToolbar->addButtonInstance($button);
812 }
813
814 $info->enablePrivateNotes();
815
816 if ($this->checkPermissionBool("read"))
817 {
818 $info->enableNews();
819 }
820
821 // no news editing for files, just notifications
822 $info->enableNewsEditing(false);
823 if ($this->checkPermissionBool("write"))
824 {
825 $news_set = new ilSetting("news");
826 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
827
828 if ($enable_internal_rss)
829 {
830 $info->setBlockProperty("news", "settings", true);
831 $info->setBlockProperty("news", "public_notifications_option", true);
832 }
833 }
834
835
836 // standard meta data
837 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
838
839 $info->addSection($this->lng->txt("file_info"));
840 $info->addProperty($this->lng->txt("filename"),
841 $this->object->getFileName());
842 // BEGIN WebDAV Guess file type.
843 $info->addProperty($this->lng->txt("type"),
844 $this->object->guessFileType());
845 // END WebDAV Guess file type.
846 $info->addProperty($this->lng->txt("size"),
847 ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()),'long'));
848 $info->addProperty($this->lng->txt("version"),
849 $this->object->getVersion());
850
851 // using getVersions function instead of ilHistory direct
852 $uploader = $this->object->getVersions();
853 $uploader = array_shift($uploader);
854 $uploader = $uploader["user_id"];
855
856 $this->lng->loadLanguageModule("file");
857 include_once "Services/User/classes/class.ilUserUtil.php";
858 $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
859
860 // download link added in repository
861 if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile"))
862 {
863 $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
864 $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
865 $info->addProperty($this->lng->txt("download_link"), $tpl->get());
866 }
867
868 if($this->id_type == self::WORKSPACE_NODE_ID)
869 {
870 $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
871 }
872
873 // display previews
874 include_once("./Services/Preview/classes/class.ilPreview.php");
875 if (!$this->ctrl->isAsynch() &&
876 ilPreview::hasPreview($this->object->getId(), $this->object->getType()) &&
877 $this->checkPermissionBool("read"))
878 {
879 include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
880
881 // get context for access checks later on
882 $context;
883 switch ($this->id_type)
884 {
888 break;
889
890 default:
892 break;
893 }
894
895 $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
896 $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
897 }
898
899 // forward the command
900 // $this->ctrl->setCmd("showSummary");
901 // $this->ctrl->setCmdClass("ilinfoscreengui");
902 $this->ctrl->forwardCommand($info);
903 }
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
Class ilInfoScreenGUI.
static getInstance()
Factory.
static _getPermanentDownloadLink($ref_id)
Gets the permanent download link for the file.
static _lookupFileSize($a_id)
Lookups the file size of the file in bytes.
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
ILIAS Setting Class.
special template class to simplify handling of ITX/PEAR
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
$info
Definition: example_052.php:80
$preview

References $ilErr, $info, $preview, ilObjectGUI\$tpl, ilObjFileAccess\_getPermanentDownloadLink(), ilObjFile\_lookupFileSize(), ilObject2GUI\checkPermissionBool(), ilPreviewGUI\CONTEXT_REPOSITORY, ilPreviewGUI\CONTEXT_WORKSPACE, ilFormat\formatSize(), ilLinkButton\getInstance(), ilUserUtil\getNamePresentation(), ilPreview\hasPreview(), ilObject2GUI\WORKSPACE_NODE_ID, and ilObject2GUI\WORKSPACE_OBJECT_ID.

Referenced by executeCommand(), and infoScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjFileGUI::initCreationForms ( )
protected

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

206 {
207 $forms = array();
208
209 if($this->id_type == self::WORKSPACE_NODE_ID)
210 {
211 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
213 {
214 $this->lng->loadLanguageModule("file");
215 ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
216 $this->ctrl->redirect($this, "cancel");
217 }
218 }
219
220 // use drag-and-drop upload if configured
221 require_once("Services/FileUpload/classes/class.ilFileUploadSettings.php");
223 {
224 $forms[] = $this->initMultiUploadForm();
225 }
226 else
227 {
228 $forms[] = $this->initSingleUploadForm();
229 $forms[] = $this->initZipUploadForm();
230 }
231
232 // repository only
233 if($this->id_type != self::WORKSPACE_NODE_ID)
234 {
235 $forms[self::CFORM_IMPORT] = $this->initImportForm('file');
236 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
237 }
238
239 return $forms;
240 }
static isUploadPossible($a_additional_size=null)
static isDragAndDropUploadEnabled()
Gets whether drag and drop file upload is enabled.
initSingleUploadForm()
FORM: Init single upload form.
initMultiUploadForm()
Initializes the upload form for multiple files.
initZipUploadForm($a_mode="create")
FORM: Init zip upload form.
fillCloneTemplate($a_tpl_varname, $a_type)
Fill object clone template This method can be called from any object GUI class that wants to offer ob...
initImportForm($a_new_type)
Init object import form.

References ilObjectGUI\CFORM_CLONE, ilObjectGUI\CFORM_IMPORT, ilObject2GUI\fillCloneTemplate(), ilObjectGUI\initImportForm(), initMultiUploadForm(), initSingleUploadForm(), initZipUploadForm(), ilFileUploadSettings\isDragAndDropUploadEnabled(), ilDiskQuotaHandler\isUploadPossible(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ initHeaderAction()

ilObjFileGUI::initHeaderAction (   $a_sub_type = null,
  $a_sub_id = null 
)
protected

Add header action menu.

Parameters
string$a_sub_type
int$a_sub_id
Returns
ilObjectListGUI

Reimplemented from ilObject2GUI.

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

1477 {
1478 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1479 if(is_object($lg))
1480 {
1481 if($this->object->hasRating())
1482 {
1483 $lg->enableRating(true, null, false,
1484 array("ilcommonactiondispatchergui", "ilratinggui"));
1485 }
1486 }
1487 return $lg;
1488 }
$lg
Definition: example_018.php:62

References $lg.

◆ initMultiUploadForm()

ilObjFileGUI::initMultiUploadForm ( )

Initializes the upload form for multiple files.

Returns
object The created property form.

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

1026 {
1027 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1028 $dnd_form_gui = new ilPropertyFormGUI();
1029 $dnd_form_gui->setMultipart(true);
1030 $dnd_form_gui->setHideLabels();
1031
1032 // file input
1033 include_once("Services/Form/classes/class.ilDragDropFileInputGUI.php");
1034 $dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files");
1035 $dnd_input->setArchiveSuffixes(array("zip"));
1036 $dnd_input->setCommandButtonNames("uploadFiles", "cancel");
1037 $dnd_form_gui->addItem($dnd_input);
1038
1039 // add commands
1040 $dnd_form_gui->addCommandButton("uploadFiles", $this->lng->txt("upload_files"));
1041 $dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
1042
1043 $dnd_form_gui->setTableWidth("100%");
1044 $dnd_form_gui->setTarget($this->getTargetFrame("save"));
1045 $dnd_form_gui->setTitle($this->lng->txt("upload_files_title"));
1046 $dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
1047
1048 $this->ctrl->setParameter($this, "new_type", "file");
1049 $dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, "uploadFiles"));
1050
1051 return $dnd_form_gui;
1052 }
This class represents a file input property where multiple files can be dopped in a property form.
getTargetFrame($a_cmd, $a_target_frame="")
get target frame for command (command is method name without "Object", e.g.
This class represents a property form user interface.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References ilUtil\getImagePath(), and ilObject2GUI\getTargetFrame().

Referenced by initCreationForms(), and uploadFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPropertiesForm()

ilObjFileGUI::initPropertiesForm ( )
protected
Parameters

return

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

634 {
635 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
636
637 $this->lng->loadLanguageModule('file');
638
639 $form = new ilPropertyFormGUI();
640 $form->setFormAction($this->ctrl->getFormAction($this),'update');
641 $form->setTitle($this->lng->txt('file_edit'));
642 $form->addCommandButton('update',$this->lng->txt('save'));
643 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
644
645 $title = new ilTextInputGUI($this->lng->txt('title'),'title');
646 $title->setValue($this->object->getTitle());
647 $title->setInfo($this->lng->txt("if_no_title_then_filename"));
648 $form->addItem($title);
649
650 $upload_possible = true;
651 if($this->id_type == self::WORKSPACE_NODE_ID)
652 {
653 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
654 $upload_possible = ilDiskQuotaHandler::isUploadPossible();
655 }
656
657 if($upload_possible)
658 {
659 $file = new ilFileInputGUI($this->lng->txt('obj_file'),'file');
660 $file->setRequired(false);
661 // $file->enableFileNameSelection('title');
662 $form->addItem($file);
663
664 $group = new ilRadioGroupInputGUI('','replace');
665 $group->setValue(0);
666
667 $replace = new ilRadioOption($this->lng->txt('replace_file'),1);
668 $replace->setInfo($this->lng->txt('replace_file_info'));
669 $group->addOption($replace);
670
671
672 $keep = new ilRadioOption($this->lng->txt('file_new_version'),0);
673 $keep->setInfo($this->lng->txt('file_new_version_info'));
674 $group->addOption($keep);
675
676 $file->addSubItem($group);
677 }
678 else
679 {
680 $file = new ilNonEditableValueGUI($this->lng->txt('obj_file'));
681 $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning"));
682 $form->addItem($file);
683 }
684
685 $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
686 $desc->setRows(3);
687 #$desc->setCols(40);
688 $form->addItem($desc);
689
690 if($this->id_type == self::REPOSITORY_NODE_ID)
691 {
692 $this->lng->loadLanguageModule('rating');
693 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
694 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
695 $form->addItem($rate);
696 }
697
698 return $form;
699 }
print $file
This class represents a checkbox property in a property form.
This class represents a file property in a property form.
This class represents a non editable value in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $file, and ilDiskQuotaHandler\isUploadPossible().

Referenced by edit(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSingleUploadForm()

ilObjFileGUI::initSingleUploadForm ( )

FORM: Init single upload form.

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

246 {
247 global $lng;
248
249 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
250 $single_form_gui = new ilPropertyFormGUI();
251 $single_form_gui->setMultipart(true);
252
253 // File Title
254 $in_title = new ilTextInputGUI($lng->txt("title"), "title");
255 $in_title->setInfo($this->lng->txt("if_no_title_then_filename"));
256 $in_title->setSize(min(40, ilObject::TITLE_LENGTH));
257 $in_title->setMaxLength(ilObject::TITLE_LENGTH);
258 $single_form_gui->addItem($in_title);
259
260 // File Description
261 $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
262 $single_form_gui->addItem($in_descr);
263
264 // File
265 $in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
266 $in_file->setRequired(true);
267 $single_form_gui->addItem($in_file);
268
269 $single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
270 $single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
271 $single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
272
273 $single_form_gui->setTableWidth("600px");
274 $single_form_gui->setTarget($this->getTargetFrame("save"));
275 $single_form_gui->setTitle($this->lng->txt($this->type."_new"));
276 $single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
277
278 $this->ctrl->setParameter($this, "new_type", "file");
279
280 $single_form_gui->setFormAction($this->ctrl->getFormAction($this, "save"));
281
282 return $single_form_gui;
283 }
const TITLE_LENGTH
max length of object title

References ilObjectGUI\$lng, ilUtil\getImagePath(), ilObject2GUI\getTargetFrame(), and ilObject\TITLE_LENGTH.

Referenced by initCreationForms(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initZipUploadForm()

ilObjFileGUI::initZipUploadForm (   $a_mode = "create")

FORM: Init zip upload form.

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

384 {
385 global $lng;
386
387 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
388 $zip_form_gui = new ilPropertyFormGUI();
389 $zip_form_gui->setMultipart(true);
390
391 // File
392 $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
393 $in_file->setRequired(true);
394 $in_file->setSuffixes(array("zip"));
395 $zip_form_gui->addItem($in_file);
396
397 // Take over structure
398 $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
399 $in_str->setInfo($this->lng->txt("take_over_structure_info"));
400 $zip_form_gui->addItem($in_str);
401
402 $zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
403 $zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
404
405 $zip_form_gui->setTableWidth("600px");
406 $zip_form_gui->setTarget($this->getTargetFrame("save"));
407 $zip_form_gui->setTitle($this->lng->txt("header_zip"));
408 $zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
409
410 $this->ctrl->setParameter($this, "new_type", "file");
411
412 $zip_form_gui->setFormAction($this->ctrl->getFormAction($this, "saveUnzip"));
413
414 return $zip_form_gui;
415 }

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

Referenced by initCreationForms(), and saveUnzip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rollbackVersion()

ilObjFileGUI::rollbackVersion ( )

Performs a rollback with the selected file version.

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

1449 {
1450 global $ilTabs;
1451
1452 // has the user the rights to delete the file?
1453 if (!$this->checkPermissionBool("write"))
1454 {
1455 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1456 }
1457
1458 // get ids either from GET (if single item was clicked) or
1459 // from POST (if multiple items were selected)
1460 $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1461
1462 // more than one entry selected?
1463 if (count($version_ids) != 1)
1464 {
1465 ilUtil::sendInfo($this->lng->txt("file_rollback_select_exact_one"), true);
1466 $this->ctrl->redirect($this, "versions");
1467 }
1468
1469 // rollback the version
1470 $new_version = $this->object->rollback($version_ids[0]);
1471
1472 ilUtil::sendSuccess(sprintf($this->lng->txt("file_rollback_done"), $new_version["rollback_version"]), true);
1473 $this->ctrl->redirect($this, "versions");
1474 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, $_POST, ilObject2GUI\checkPermissionBool(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ save()

ilObjFileGUI::save ( )

save object

@access public

Reimplemented from ilObject2GUI.

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

291 {
292 global $objDefinition, $ilUser;
293
294 if (!$this->checkPermissionBool("create", "", "file"))
295 {
296 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
297 }
298
299 $single_form_gui = $this->initSingleUploadForm();
300
301 if ($single_form_gui->checkInput())
302 {
303 $title = $single_form_gui->getInput("title");
304 $description = $single_form_gui->getInput("description");
305 $upload_file = $single_form_gui->getInput("upload_file");
306
307 if (trim($title) == "")
308 {
309 $title = $upload_file["name"];
310 }
311 else
312 {
313 // BEGIN WebDAV: Ensure that object title ends with the filename extension
314 $fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
315 $titleExtension = ilObjFileAccess::_getFileExtension($title);
316 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
317 {
318 $title .= '.'.$fileExtension;
319 }
320 // END WebDAV: Ensure that object title ends with the filename extension
321 }
322
323 // create and insert file in grp_tree
324 include_once("./Modules/File/classes/class.ilObjFile.php");
325 $fileObj = new ilObjFile();
326 $fileObj->setTitle($title);
327 $fileObj->setDescription($description);
328 $fileObj->setFileName($upload_file["name"]);
329 //$fileObj->setFileType($upload_file["type"]);
330 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
331 $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
332 "", $upload_file["name"], $upload_file["type"]));
333 $fileObj->setFileSize($upload_file["size"]);
334 $this->object_id = $fileObj->create();
335
336 $this->putObjectInTree($fileObj, $this->parent_id);
337
338 // upload file to filesystem
339 $fileObj->createDirectory();
340 $fileObj->getUploadFile($upload_file["tmp_name"],
341 $upload_file["name"]);
342
343 $this->handleAutoRating($fileObj);
344
345 // BEGIN ChangeEvent: Record write event.
346 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
347 ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
348 // END ChangeEvent: Record write event.
349
350 ilUtil::sendSuccess($this->lng->txt("file_added"),true);
351
352 if ($this->ctrl->getCmd() == "saveAndMeta")
353 {
354 $this->ctrl->setParameter($this, "new_type", "");
355 $target = $this->ctrl->getLinkTargetByClass(array("ilobjectmetadatagui", "ilmdeditorgui"), "listSection", "", false, false);
356 ilUtil::redirect($target);
357 }
358 else
359 {
360 $this->ctrl->returnToParent($this);
361 }
362 }
363 else
364 {
365 $single_form_gui->setValuesByPost();
366 $this->tpl->setContent($single_form_gui->getHTML());
367 }
368 }
static redirect($a_script)
http redirect to other script

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

Referenced by saveAndMeta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAndMeta()

ilObjFileGUI::saveAndMeta ( )

save object

@access public

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

376 {
377 $this->save();
378 }
save()
save object

References save().

+ Here is the call graph for this function:

◆ saveUnzip()

ilObjFileGUI::saveUnzip ( )

saveUnzip object

@access public

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

423 {
424 $zip_form_gui = $this->initZipUploadForm();
425
426 if ($this->checkPermissionBool("create", "", "file"))
427 {
428 if ($zip_form_gui->checkInput())
429 {
430 $zip_file = $zip_form_gui->getInput("zip_file");
431 $adopt_structure = $zip_form_gui->getInput("adopt_structure");
432
433 include_once ("Services/Utilities/classes/class.ilFileUtils.php");
434
435 // Create unzip-directory
436 $newDir = ilUtil::ilTempnam();
437 ilUtil::makeDir($newDir);
438
439 // Check if permission is granted for creation of object, if necessary
440 if($this->id_type != self::WORKSPACE_NODE_ID)
441 {
442
443 $type = ilObject::_lookupType((int)$this->parent_id, true);
444 }
445 else
446 {
447 $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
448 }
449
450 $tree = $access_handler = null;
451 switch($type)
452 {
453 // workspace structure
454 case 'wfld':
455 case 'wsrt':
456 $permission = $this->checkPermissionBool("create", "", "wfld");
457 $containerType = "WorkspaceFolder";
460 break;
461
462 // use categories as structure
463 case 'cat':
464 case 'root':
465 $permission = $this->checkPermissionBool("create", "", "cat");
466 $containerType = "Category";
467 break;
468
469 // use folders as structure (in courses)
470 default:
471 $permission = $this->checkPermissionBool("create", "", "fold");
472 $containerType = "Folder";
473 break;
474 }
475 // processZipFile (
476 // Dir to unzip,
477 // Path to uploaded file,
478 // should a structure be created (+ permission check)?
479 // ref_id of parent
480 // object that contains files (folder or category)
481 // should sendInfo be persistent?)
482 try
483 {
484 $processDone = ilFileUtils::processZipFile( $newDir,
485 $zip_file["tmp_name"],
486 ($adopt_structure && $permission),
487 $this->parent_id,
488 $containerType,
489 $tree,
491 ilUtil::sendSuccess($this->lng->txt("file_added"),true);
492 }
493 catch (ilFileUtilsException $e)
494 {
495 ilUtil::sendFailure($e->getMessage(), true);
496 }
497
498 ilUtil::delDir($newDir);
499 $this->ctrl->returnToParent($this);
500 }
501 else
502 {
503 $zip_form_gui->setValuesByPost();
504 $this->tpl->setContent($zip_form_gui->getHTML());
505 }
506 }
507 else
508 {
509 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
510 }
511 }

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().

+ Here is the call graph for this function:

◆ sendFile()

ilObjFileGUI::sendFile ( )

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

702 {
703 global $ilUser, $ilCtrl;
704
705 if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']) )
706 {
707 $this->object->sendFile($_GET["hist_id"]);
708 }
709
710 if ($this->checkPermissionBool("read"))
711 {
712 // BEGIN ChangeEvent: Record read event.
713 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
714 global $ilUser;
715 // Record read event and catchup with write events
716 ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
717 $this->object->getId(), $ilUser->getId());
718 // END ChangeEvent: Record read event.
719
720 require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
721 ilLPStatusWrapper::_updateStatus($this->object->getId(), $ilUser->getId());
722
723 $this->object->sendFile($_GET["hist_id"]);
724 }
725 else
726 {
727 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
728 }
729 return true;
730 }
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.

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

+ Here is the call graph for this function:

◆ setTabs()

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

908 {
909 global $ilTabs, $lng, $ilHelp;
910
911 $ilHelp->setScreenIdComponent("file");
912
913 $this->ctrl->setParameter($this,"ref_id",$this->node_id);
914
915 if ($this->checkPermissionBool("visible"))
916 {
917 $ilTabs->addTab("id_info",
918 $lng->txt("info_short"),
919 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary"));
920 }
921
922 if ($this->checkPermissionBool("write"))
923 {
924 $ilTabs->addTab("settings",
925 $lng->txt("edit"),
926 $this->ctrl->getLinkTarget($this, "edit"));
927 }
928
929 if ($this->checkPermissionBool("write"))
930 {
931 $ilTabs->addTab("id_versions",
932 $lng->txt("versions"),
933 $this->ctrl->getLinkTarget($this, "versions"));
934 }
935
936 require_once 'Services/Tracking/classes/class.ilLearningProgressAccess.php';
937 if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
938 {
939 $ilTabs->addTab(
940 'learning_progress',
941 $lng->txt('learning_progress'),
942 $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'),'')
943 );
944 }
945
946 // meta data
947 if ($this->checkPermissionBool("write"))
948 {
949 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
950 $mdgui = new ilObjectMetaDataGUI($this->object);
951 $mdtab = $mdgui->getTab();
952 if($mdtab)
953 {
954 $ilTabs->addTab("id_meta",
955 $lng->txt("meta_data"),
956 $mdtab);
957 }
958 }
959
960 // export
961 if ($this->checkPermissionBool("write"))
962 {
963 $ilTabs->addTab("export",
964 $lng->txt("export"),
965 $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
966 }
967
968 // will add permission tab if needed
969 parent::setTabs();
970 }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress

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

+ Here is the call graph for this function:

◆ update()

ilObjFileGUI::update ( )

updates object entry in object_data

@access public

Reimplemented from ilObject2GUI.

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

519 {
520 global $ilTabs;
521
522 $form = $this->initPropertiesForm();
523 if(!$form->checkInput())
524 {
525 $ilTabs->activateTab("settings");
526 $form->setValuesByPost();
527 $this->tpl->setContent($form->getHTML());
528 return false;
529 }
530
531 $data = $form->getInput('file');
532
533 // delete trailing '/' in filename
534 while (substr($data["name"],-1) == '/')
535 {
536 $data["name"] = substr($data["name"],0,-1);
537 }
538
539 $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
540 $title = $form->getInput('title');
541 if(strlen(trim($title)) == 0)
542 {
543 $title = $filename;
544 }
545 else
546 {
547 $title = $this->object->checkFileExtension($filename,$title);
548 }
549 $this->object->setTitle($title);
550
551 if (!empty($data["name"]))
552 {
553 switch($form->getInput('replace'))
554 {
555 case 1:
556 $this->object->deleteVersions();
557 $this->object->clearDataDirectory();
558 $this->object->replaceFile($data['tmp_name'],$data['name']);
559 break;
560 case 0:
561 $this->object->addFileVersion($data['tmp_name'],$data['name']);
562 break;
563 }
564 $this->object->setFileName($data['name']);
565 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
566 $this->object->setFileType(ilMimeTypeUtil::getMimeType(
567 "", $data["name"], $data["type"]));
568 $this->object->setFileSize($data['size']);
569 }
570
571 $this->object->setDescription($form->getInput('description'));
572 $this->object->setRating($form->getInput('rating'));
573
574 $this->update = $this->object->update();
575
576 // BEGIN ChangeEvent: Record update event.
577 if (!empty($data["name"]))
578 {
579 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
580 global $ilUser;
581 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
582 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
583 }
584 // END ChangeEvent: Record update event.
585
586 // Update ecs export settings
587 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
588 $ecs = new ilECSFileSettings($this->object);
589 $ecs->handleSettingsUpdate();
590
591 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
592 ilUtil::redirect($this->ctrl->getLinkTarget($this,'edit','',false,false));
593 }
_catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
update()
updates object entry in object_data

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

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadFiles()

ilObjFileGUI::uploadFiles ( )

Called after a file was uploaded.

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

1058 {
1059 include_once("./Services/JSON/classes/class.ilJsonUtil.php");
1060
1061 $response = new stdClass();
1062 $response->error = null;
1063 $response->debug = null;
1064
1065 $files = $_FILES;
1066
1067 // #14249 - race conditions because of concurrent uploads
1068 $after_creation_callback = (int)$_REQUEST["crtcb"];
1069 if($after_creation_callback)
1070 {
1071 $this->after_creation_callback_objects = array();
1072 unset($_REQUEST["crtcb"]);
1073 }
1074
1075 // load form
1076 $dnd_form_gui = $this->initMultiUploadForm();
1077 if ($dnd_form_gui->checkInput())
1078 {
1079 try
1080 {
1081 if (!$this->checkPermissionBool("create", "", "file"))
1082 {
1083 $response->error = $this->lng->txt("permission_denied");
1084 }
1085 else
1086 {
1087 // handle the file
1088 $inp = $dnd_form_gui->getInput("upload_files");
1089 $this->log->debug("ilObjFileGUI::uploadFiles ".print_r($_POST, true));
1090 $this->log->debug("ilObjFileGUI::uploadFiles ".print_r($_FILES, true));
1091 $fileresult = $this->handleFileUpload($inp);
1092 if ($fileresult)
1093 $response = (object)array_merge((array)$response, (array)$fileresult);
1094 }
1095 }
1096 catch (Exception $ex)
1097 {
1098 $response->error = $ex->getMessage() . " ## " . $ex->getTraceAsString();
1099 }
1100 }
1101 else
1102 {
1103 $dnd_input = $dnd_form_gui->getItemByPostVar("upload_files");
1104 $response->error = $dnd_input->getAlert();
1105 }
1106
1107 if($after_creation_callback &&
1108 sizeof($this->after_creation_callback_objects))
1109 {
1110 foreach($this->after_creation_callback_objects as $new_file_obj)
1111 {
1112 ilObject2GUI::handleAfterSaveCallback($new_file_obj, $after_creation_callback);
1113 }
1114 unset($this->after_creation_callback_objects);
1115 }
1116
1117 // send response object (don't use 'application/json' as IE wants to download it!)
1118 header('Vary: Accept');
1119 header('Content-type: text/plain');
1120 echo ilJsonUtil::encode($response);
1121
1122 // no further processing!
1123 exit;
1124 }
static encode($mixed, $suppress_native=false)
handleFileUpload($file_upload)
Handles the upload of a single file and adds it to the parent object.
static handleAfterSaveCallback(ilObject $a_obj, $a_callback_ref_id)
After creation callback.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_POST, $_REQUEST, ilObject2GUI\checkPermissionBool(), ilJsonUtil\encode(), exit, ilObject2GUI\handleAfterSaveCallback(), handleFileUpload(), and initMultiUploadForm().

+ Here is the call graph for this function:

◆ versions()

ilObjFileGUI::versions ( )

file versions/history

@access public

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

739 {
740 global $ilTabs;
741
742 $ilTabs->activateTab("id_versions");
743
744 if (!$this->checkPermissionBool("write"))
745 {
746 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
747 }
748
749 // get versions
750 $versions = $this->object->getVersions();
751
752 // build versions table
753 require_once("Modules/File/classes/class.ilFileVersionTableGUI.php");
754 $table = new ilFileVersionTableGUI($this, "versions");
755 $table->setMaxCount(sizeof($versions));
756 $table->setData($versions);
757
758 $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
759 }

References ilObject2GUI\checkPermissionBool().

+ Here is the call graph for this function:

Field Documentation

◆ $log

ilObjFileGUI::$log = null
protected

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


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