ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 isVisible ($a_ref_id, $a_type)
 
 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
 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...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 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 ()
 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 ($a_new_type)
 
 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...
 
 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 (ilColumnGUI $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...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) 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...
 
 fillCloneSearchTemplate ($a_tpl_varname, $a_type)
 
 searchCloneSource ()
 
 buildCloneSelect ($existing_objs)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation ($a_cmd, $a_location="")
 Deprecated functions. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 showActions ()
 
 getTabs ()
 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...
 
 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 ()
 
 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...
 
 getTabs ()
 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 (ilColumnGUI $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
 
 $tabs_gui = null
 
 $ctrl
 

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

◆ _goto()

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

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

940 {
941 global $ilErr, $lng, $ilAccess;
942
943 if($a_additional && substr($a_additional, -3) == "wsp")
944 {
945 $_GET["baseClass"] = "ilsharedresourceGUI";
946 $_GET["wsp_id"] = $a_target;
947 include("ilias.php");
948 exit;
949 }
950
951 // added support for direct download goto links
952 if($a_additional && substr($a_additional, -8) == "download")
953 {
954 ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
955 }
956
957 // static method, no workspace support yet
958
959 if ($ilAccess->checkAccess("visible", "", $a_target) ||
960 $ilAccess->checkAccess("read", "", $a_target))
961 {
962 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
963 }
964 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
965 {
966 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
969 }
970
971 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
972 }
sprintf('%.4f', $callTime)
$_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.
global $ilErr
Definition: raiseError.php:16

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

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjFileGUI::addLocatorItems ( )

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

978 {
979 global $ilLocator;
980
981 if (is_object($this->object))
982 {
983 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
984 }
985 }

◆ cancelDeleteFile()

ilObjFileGUI::cancelDeleteFile ( )

Cancels the file deletion.

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

1386 {
1387 $this->ctrl->redirect($this, "versions");
1388 }

◆ cancelDeleteVersions()

ilObjFileGUI::cancelDeleteVersions ( )

Cancels the file version deletion.

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

1357 {
1358 $this->ctrl->redirect($this, "versions");
1359 }

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

1398 {
1399 if (is_array($v1))
1400 $v1 = (int)$v1["hist_entry_id"];
1401 else if (!is_int($v1))
1402 $v1 = (int)$v1;
1403
1404 if (is_array($v2))
1405 $v2 = (int)$v2["hist_entry_id"];
1406 else if (!is_int($v2))
1407 $v2 = (int)$v2;
1408
1409 return $v1 - $v2;
1410 }

◆ confirmDeleteFile()

ilObjFileGUI::confirmDeleteFile ( )

Deletes this file object.

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

1365 {
1366 // has the user the rights to delete the file?
1367 if (!$this->checkPermissionBool("write"))
1368 {
1369 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1370 }
1371
1372 // delete this file object
1373 include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
1374 $ru = new ilRepUtilGUI($this);
1375 $ru->deleteObjects($this->parent_id, array($this->ref_id));
1376
1377 // redirect to parent object
1378 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_id);
1379 $this->ctrl->redirectByClass("ilrepositorygui");
1380 }
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 1332 of file class.ilObjFileGUI.php.

1333 {
1334 global $ilTabs;
1335
1336 // has the user the rights to delete versions?
1337 if (!$this->checkPermissionBool("write"))
1338 {
1339 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1340 }
1341
1342 // delete versions after confirmation
1343 if (count($_POST["hist_id"]) > 0)
1344 {
1345 $this->object->deleteVersions($_POST["hist_id"]);
1346 ilUtil::sendSuccess($this->lng->txt("file_versions_deleted"), true);
1347 }
1348
1349 $this->ctrl->setParameter($this, "hist_id", "");
1350 $this->ctrl->redirect($this, "versions");
1351 }
$_POST["username"]
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

1275 {
1276 global $ilTabs, $ilLocator;
1277
1278 // get ids either from GET (if single item was clicked) or
1279 // from POST (if multiple items were selected)
1280 $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1281
1282 if (count($version_ids) < 1)
1283 {
1284 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1285 $this->ctrl->redirect($this, "versions");
1286 }
1287 else
1288 {
1289 $ilTabs->activateTab("id_versions");
1290
1291 // check if all versions are selected
1292 $versionsToKeep = array_udiff($this->object->getVersions(), $version_ids, array($this, "compareHistoryIds"));
1293 if (count($versionsToKeep) < 1)
1294 {
1295 // set our message
1296 ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_all_versions"));
1297
1298 // show confirmation gui
1299 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1300 $conf_gui = new ilConfirmationGUI();
1301 $conf_gui->setFormAction($this->ctrl->getFormAction($this, "versions"));
1302 $conf_gui->setCancel($this->lng->txt("cancel"), "cancelDeleteFile");
1303 $conf_gui->setConfirm($this->lng->txt("confirm"), "confirmDeleteFile");
1304
1305 $conf_gui->addItem("id[]", $this->ref_id, $this->object->getTitle(),
1306 ilObject::_getIcon($this->object->getId(), "small", $this->object->getType()),
1307 $this->lng->txt("icon")." ".$this->lng->txt("obj_".$this->object->getType()));
1308
1309 $html = $conf_gui->getHTML();
1310 }
1311 else
1312 {
1313 include_once("./Modules/File/classes/class.ilFileVersionTableGUI.php");
1314
1315 ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_versions"));
1316 $versions = $this->object->getVersions($version_ids);
1317
1318 $table = new ilFileVersionTableGUI($this, 'versions', true);
1319 $table->setMaxCount(sizeof($versions));
1320 $table->setData($versions);
1321
1322 $html = $table->getHTML();
1323 }
1324
1325 $this->tpl->setVariable('ADM_CONTENT', $html);
1326 }
1327 }
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 567 of file class.ilObjFileGUI.php.

568 {
569 global $ilTabs, $ilErr;
570
571 if (!$this->checkPermissionBool("write"))
572 {
573 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
574 }
575
576 $ilTabs->activateTab("settings");
577
578 $form = $this->initPropertiesForm();
579
580 $val = array();
581 $val['title'] = $this->object->getTitle();
582 $val['description'] = $this->object->getLongDescription();
583 $val['rating'] = $this->object->hasRating();
584 $form->setValuesByArray($val);
585
586 // Edit ecs export settings
587 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
588 $ecs = new ilECSFileSettings($this->object);
589 $ecs->addSettingsToForm($form, 'file');
590
591 $this->tpl->setContent($form->getHTML());
592 return true;
593 }
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 43 of file class.ilObjFileGUI.php.

44 {
45 global $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs, $ilAccess, $ilErr;
46
47 $next_class = $this->ctrl->getNextClass($this);
48 $cmd = $this->ctrl->getCmd();
49
50 if($this->id_type == self::WORKSPACE_NODE_ID)
51 {
52 include_once "Services/Form/classes/class.ilFileInputGUI.php";
54 }
55
56 if(!$this->getCreationMode())
57 {
58 if($this->id_type == self::REPOSITORY_NODE_ID
59 && $this->checkPermissionBool("read"))
60 {
61 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
62 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
63 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
64
65 // add entry to navigation history
66 $ilNavigationHistory->addItem($this->node_id,
67 $link, "file");
68 }
69 }
70
71 $this->prepareOutput();
72
73 switch ($next_class)
74 {
75 case "ilinfoscreengui":
76 $this->infoScreenForward(); // forwards command
77 break;
78
79 case 'ilobjectmetadatagui':
80 if(!$this->checkPermissionBool("write"))
81 {
82 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
83 }
84
85 $ilTabs->activateTab("id_meta");
86
87 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
88 $md_gui = new ilObjectMetaDataGUI($this->object);
89
90 // todo: make this work
91 // $md_gui->addMDObserver($this->object,'MDUpdateListener','Technical');
92
93 $this->ctrl->forwardCommand($md_gui);
94 break;
95
96 // repository permissions
97 case 'ilpermissiongui':
98 $ilTabs->activateTab("id_permissions");
99 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
100 $perm_gui = new ilPermissionGUI($this);
101 $ret = $this->ctrl->forwardCommand($perm_gui);
102 break;
103
104 case "ilexportgui":
105 $ilTabs->activateTab("export");
106 include_once("./Services/Export/classes/class.ilExportGUI.php");
107 $exp_gui = new ilExportGUI($this);
108 $exp_gui->addFormat("xml");
109 $ret = $this->ctrl->forwardCommand($exp_gui);
110 break;
111
112 case 'ilobjectcopygui':
113 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
114 $cp = new ilObjectCopyGUI($this);
115 $cp->setType('file');
116 $this->ctrl->forwardCommand($cp);
117 break;
118
119 // personal workspace permissions
120 case "ilworkspaceaccessgui";
121 $ilTabs->activateTab("id_permissions");
122 include_once('./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
123 $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
124 $this->ctrl->forwardCommand($wspacc);
125 break;
126
127 case "ilcommonactiondispatchergui":
128 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
130 $this->ctrl->forwardCommand($gui);
131 break;
132
133 case "illearningprogressgui":
134 $ilTabs->activateTab('learning_progress');
135 require_once 'Services/Tracking/classes/class.ilLearningProgressGUI.php';
136 $new_gui = new ilLearningProgressGUI(
138 $this->object->getRefId(),
139 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
140 );
141 $this->ctrl->forwardCommand($new_gui);
142 $this->tabs_gui->setTabActive('learning_progress');
143 break;
144
145 default:
146 // in personal workspace use object2gui
147 if($this->id_type == self::WORKSPACE_NODE_ID)
148 {
149 $this->addHeaderAction();
150
151 // coming from goto we need default command
152 if (empty($cmd))
153 {
154 $ilCtrl->setCmd("infoScreen");
155 }
156 $ilTabs->clearTargets();
157 return parent::executeCommand();
158 }
159
160 if (empty($cmd))
161 {
162 $cmd = "infoScreen";
163 }
164
165 $this->$cmd();
166 break;
167 }
168
169 $this->addHeaderAction();
170 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
static setPersonalWorkspaceQuotaCheck($a_value)
Class ilObjUserTrackingGUI.
infoScreenForward()
show information screen
getAccessHandler()
Get access handler.
prepareOutput($a_show_subobjects=true)
prepare output
getCreationMode()
get creation mode
GUI class for the workflow of copying objects.
addHeaderAction()
Add header action menu.
Class ilObjectMetaDataGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35
$ilUser
Definition: imgupload.php:18

References $_GET, $cmd, $ilCtrl, $ilErr, $ilUser, $ret, ilObjectGUI\addHeaderAction(), ilObject2GUI\checkPermissionBool(), ilObject2GUI\getAccessHandler(), ilObject2GUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreenForward(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ilObject2GUI\prepareOutput(), 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 1099 of file class.ilObjFileGUI.php.

1100 {
1101 global $ilUser;
1102 require_once('./Services/Utilities/classes/class.ilFileUtils.php');
1103 // file upload params
1105 $type = ilUtil::stripSlashes($file_upload["type"]);
1107 $temp_name = $file_upload["tmp_name"];
1108
1109 // additional params
1110 $title = ilUtil::stripSlashes($file_upload["title"]);
1111 $description = ilUtil::stripSlashes($file_upload["description"]);
1112 $extract = ilUtil::stripSlashes($file_upload["extract"]);
1113 $keep_structure = ilUtil::stripSlashes($file_upload["keep_structure"]);
1114
1115 // create answer object
1116 $response = new stdClass();
1117 $response->fileName = $filename;
1118 $response->fileSize = intval($size);
1119 $response->fileType = $type;
1120 $response->fileUnzipped = $extract;
1121 $response->error = null;
1122
1123 // extract archive?
1124 if ($extract)
1125 {
1126 $zip_file = $filename;
1127 $adopt_structure = $keep_structure;
1128
1129 include_once ("Services/Utilities/classes/class.ilFileUtils.php");
1130
1131 // Create unzip-directory
1132 $newDir = ilUtil::ilTempnam();
1133 ilUtil::makeDir($newDir);
1134
1135 // Check if permission is granted for creation of object, if necessary
1136 if($this->id_type != self::WORKSPACE_NODE_ID)
1137 {
1138 $type = ilObject::_lookupType((int)$this->parent_id, true);
1139 }
1140 else
1141 {
1142 $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
1143 }
1144
1145 $tree = $access_handler = null;
1146 switch($type)
1147 {
1148 // workspace structure
1149 case 'wfld':
1150 case 'wsrt':
1151 $permission = $this->checkPermissionBool("create", "", "wfld");
1152 $containerType = "WorkspaceFolder";
1155 break;
1156
1157 // use categories as structure
1158 case 'cat':
1159 case 'root':
1160 $permission = $this->checkPermissionBool("create", "", "cat");
1161 $containerType = "Category";
1162 break;
1163
1164 // use folders as structure (in courses)
1165 default:
1166 $permission = $this->checkPermissionBool("create", "", "fold");
1167 $containerType = "Folder";
1168 break;
1169 }
1170
1171 try
1172 {
1173 // processZipFile (
1174 // Dir to unzip,
1175 // Path to uploaded file,
1176 // should a structure be created (+ permission check)?
1177 // ref_id of parent
1178 // object that contains files (folder or category)
1179 // should sendInfo be persistent?)
1181 $newDir,
1182 $temp_name,
1183 ($adopt_structure && $permission),
1184 $this->parent_id,
1185 $containerType,
1186 $tree,
1188 }
1189 catch (ilFileUtilsException $e)
1190 {
1191 $response->error = $e->getMessage();
1192 }
1193 catch (Exception $ex)
1194 {
1195 $response->error = $ex->getMessage();
1196 }
1197
1198 ilUtil::delDir($newDir);
1199
1200 // #15404
1201 if($this->id_type != self::WORKSPACE_NODE_ID)
1202 {
1203 foreach(ilFileUtils::getNewObjects() as $parent_ref_id => $objects)
1204 {
1205 if($parent_ref_id != $this->parent_id)
1206 {
1207 continue;
1208 }
1209
1210 foreach($objects as $object)
1211 {
1212 $this->after_creation_callback_objects[] = $object;
1213 }
1214 }
1215 }
1216 }
1217 else
1218 {
1219 if (trim($title) == "")
1220 {
1221 $title = $filename;
1222 }
1223 else
1224 {
1225 // BEGIN WebDAV: Ensure that object title ends with the filename extension
1227 $titleExtension = ilObjFileAccess::_getFileExtension($title);
1228 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
1229 {
1230 $title .= '.'.$fileExtension;
1231 }
1232 // END WebDAV: Ensure that object title ends with the filename extension
1233 }
1234
1235 // create and insert file in grp_tree
1236 include_once("./Modules/File/classes/class.ilObjFile.php");
1237 $fileObj = new ilObjFile();
1238 $fileObj->setTitle($title);
1239 $fileObj->setDescription($description);
1240 $fileObj->setFileName($filename);
1241
1242 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1243 $fileObj->setFileType(ilMimeTypeUtil::getMimeType("", $filename, $type));
1244 $fileObj->setFileSize($size);
1245 $this->object_id = $fileObj->create();
1246
1247 $this->putObjectInTree($fileObj, $this->parent_id);
1248
1249 // see uploadFiles()
1250 if(is_array($this->after_creation_callback_objects))
1251 {
1252 $this->after_creation_callback_objects[] = $fileObj;
1253 }
1254
1255 // upload file to filesystem
1256 $fileObj->createDirectory();
1257 $fileObj->raiseUploadError(false);
1258 $fileObj->getUploadFile($temp_name, $filename, false);
1259
1260 $this->handleAutoRating($fileObj);
1261
1262 // BEGIN ChangeEvent: Record write event.
1263 require_once('./Services/Tracking/classes/class.ilChangeEvent.php');
1264 ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
1265 // END ChangeEvent: Record write event.
1266 }
1267
1268 return $response;
1269 }
$size
Definition: RandomTest.php:79
static _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 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 getNewObjects()
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, $title, 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 733 of file class.ilObjFileGUI.php.

734 {
735 $this->ctrl->setCmd("showSummary");
736 $this->ctrl->setCmdClass("ilinfoscreengui");
737 $this->infoScreenForward();
738 }

References infoScreenForward().

+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

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

744 {
745 global $ilTabs, $ilErr, $ilToolbar;
746
747 $ilTabs->activateTab("id_info");
748
749 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read"))
750 {
751 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
752 }
753
754 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
755 $info = new ilInfoScreenGUI($this);
756
757 if ($this->checkPermissionBool("read", "sendfile"))
758 {
759 // #9876
760 $this->lng->loadLanguageModule("file");
761
762 // #14378
763 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
764 $button = ilLinkButton::getInstance();
765 $button->setCaption("file_download");
766 $button->setPrimary(true);
767
768 // get permanent download link for repository
769 if ($this->id_type == self::REPOSITORY_NODE_ID)
770 {
771 $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
772 }
773 else
774 {
775 $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
776 }
777
778 $ilToolbar->addButtonInstance($button);
779 }
780
781 $info->enablePrivateNotes();
782
783 if ($this->checkPermissionBool("read"))
784 {
785 $info->enableNews();
786 }
787
788 // no news editing for files, just notifications
789 $info->enableNewsEditing(false);
790 if ($this->checkPermissionBool("write"))
791 {
792 $news_set = new ilSetting("news");
793 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
794
795 if ($enable_internal_rss)
796 {
797 $info->setBlockProperty("news", "settings", true);
798 $info->setBlockProperty("news", "public_notifications_option", true);
799 }
800 }
801
802
803 // standard meta data
804 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
805
806 $info->addSection($this->lng->txt("file_info"));
807 $info->addProperty($this->lng->txt("filename"),
808 $this->object->getFileName());
809 // BEGIN WebDAV Guess file type.
810 $info->addProperty($this->lng->txt("type"),
811 $this->object->guessFileType());
812 // END WebDAV Guess file type.
813 $info->addProperty($this->lng->txt("size"),
814 ilUtil::formatSize(ilObjFile::_lookupFileSize($this->object->getId()),'long'));
815 $info->addProperty($this->lng->txt("version"),
816 $this->object->getVersion());
817
818 // using getVersions function instead of ilHistory direct
819 $uploader = $this->object->getVersions();
820 $uploader = array_shift($uploader);
821 $uploader = $uploader["user_id"];
822
823 $this->lng->loadLanguageModule("file");
824 include_once "Services/User/classes/class.ilUserUtil.php";
825 $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
826
827 // download link added in repository
828 if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile"))
829 {
830 $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
831 $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
832 $info->addProperty($this->lng->txt("download_link"), $tpl->get());
833 }
834
835 if($this->id_type == self::WORKSPACE_NODE_ID)
836 {
837 $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
838 }
839
840 // display previews
841 include_once("./Services/Preview/classes/class.ilPreview.php");
842 if (!$this->ctrl->isAsynch() &&
843 ilPreview::hasPreview($this->object->getId(), $this->object->getType()) &&
844 $this->checkPermissionBool("read"))
845 {
846 include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
847
848 // get context for access checks later on
849 $context;
850 switch ($this->id_type)
851 {
855 break;
856
857 default:
859 break;
860 }
861
862 $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
863 $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
864 }
865
866 // forward the command
867 // $this->ctrl->setCmd("showSummary");
868 // $this->ctrl->setCmdClass("ilinfoscreengui");
869 $this->ctrl->forwardCommand($info);
870 }
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:
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
$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, ilUtil\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 (   $a_new_type)
protected
Parameters
string$a_new_type

Reimplemented from ilObject2GUI.

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

176 {
177 $forms = array();
178
179 if($this->id_type == self::WORKSPACE_NODE_ID)
180 {
181 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
183 {
184 $this->lng->loadLanguageModule("file");
185 ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
186 $this->ctrl->redirect($this, "cancel");
187 }
188 }
189
190 // use drag-and-drop upload if configured
191 require_once("Services/FileUpload/classes/class.ilFileUploadSettings.php");
193 {
194 $forms[] = $this->initMultiUploadForm();
195 }
196 else
197 {
198 $forms[] = $this->initSingleUploadForm();
199 $forms[] = $this->initZipUploadForm();
200 }
201
202 // repository only
203 if($this->id_type != self::WORKSPACE_NODE_ID)
204 {
205 $forms[self::CFORM_IMPORT] = $this->initImportForm('file');
206 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
207 }
208
209 return $forms;
210 }
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 1443 of file class.ilObjFileGUI.php.

1444 {
1445 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1446 if(is_object($lg))
1447 {
1448 if($this->object->hasRating())
1449 {
1450 $lg->enableRating(true, null, false,
1451 array("ilcommonactiondispatchergui", "ilratinggui"));
1452 }
1453 }
1454 return $lg;
1455 }
$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 992 of file class.ilObjFileGUI.php.

993 {
994 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
995 $dnd_form_gui = new ilPropertyFormGUI();
996 $dnd_form_gui->setMultipart(true);
997 $dnd_form_gui->setHideLabels();
998
999 // file input
1000 include_once("Services/Form/classes/class.ilDragDropFileInputGUI.php");
1001 $dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files");
1002 $dnd_input->setArchiveSuffixes(array("zip"));
1003 $dnd_input->setCommandButtonNames("uploadFiles", "cancel");
1004 $dnd_form_gui->addItem($dnd_input);
1005
1006 // add commands
1007 $dnd_form_gui->addCommandButton("uploadFiles", $this->lng->txt("upload_files"));
1008 $dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
1009
1010 $dnd_form_gui->setTableWidth("100%");
1011 $dnd_form_gui->setTarget($this->getTargetFrame("save"));
1012 $dnd_form_gui->setTitle($this->lng->txt("upload_files_title"));
1013 $dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
1014
1015 $this->ctrl->setParameter($this, "new_type", "file");
1016 $dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, "uploadFiles"));
1017
1018 return $dnd_form_gui;
1019 }
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 600 of file class.ilObjFileGUI.php.

601 {
602 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
603
604 $this->lng->loadLanguageModule('file');
605
606 $form = new ilPropertyFormGUI();
607 $form->setFormAction($this->ctrl->getFormAction($this),'update');
608 $form->setTitle($this->lng->txt('file_edit'));
609 $form->addCommandButton('update',$this->lng->txt('save'));
610 $form->addCommandButton('cancel',$this->lng->txt('cancel'));
611
612 $title = new ilTextInputGUI($this->lng->txt('title'),'title');
613 $title->setValue($this->object->getTitle());
614 $title->setInfo($this->lng->txt("if_no_title_then_filename"));
615 $form->addItem($title);
616
617 $upload_possible = true;
618 if($this->id_type == self::WORKSPACE_NODE_ID)
619 {
620 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
621 $upload_possible = ilDiskQuotaHandler::isUploadPossible();
622 }
623
624 if($upload_possible)
625 {
626 $file = new ilFileInputGUI($this->lng->txt('obj_file'),'file');
627 $file->setRequired(false);
628 // $file->enableFileNameSelection('title');
629 $form->addItem($file);
630
631 $group = new ilRadioGroupInputGUI('','replace');
632 $group->setValue(0);
633
634 $replace = new ilRadioOption($this->lng->txt('replace_file'),1);
635 $replace->setInfo($this->lng->txt('replace_file_info'));
636 $group->addOption($replace);
637
638
639 $keep = new ilRadioOption($this->lng->txt('file_new_version'),0);
640 $keep->setInfo($this->lng->txt('file_new_version_info'));
641 $group->addOption($keep);
642
643 $file->addSubItem($group);
644 }
645 else
646 {
647 $file = new ilNonEditableValueGUI($this->lng->txt('obj_file'));
648 $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning"));
649 $form->addItem($file);
650 }
651
652 $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
653 $desc->setRows(3);
654 #$desc->setCols(40);
655 $form->addItem($desc);
656
657 if($this->id_type == self::REPOSITORY_NODE_ID)
658 {
659 $this->lng->loadLanguageModule('rating');
660 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
661 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
662 $form->addItem($rate);
663 }
664
665 return $form;
666 }
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.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $title, 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 215 of file class.ilObjFileGUI.php.

216 {
217 global $lng;
218
219 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
220 $single_form_gui = new ilPropertyFormGUI();
221 $single_form_gui->setMultipart(true);
222
223 // File Title
224 $in_title = new ilTextInputGUI($lng->txt("title"), "title");
225 $in_title->setInfo($this->lng->txt("if_no_title_then_filename"));
226 $in_title->setSize(min(40, ilObject::TITLE_LENGTH));
227 $in_title->setMaxLength(ilObject::TITLE_LENGTH);
228 $single_form_gui->addItem($in_title);
229
230 // File Description
231 $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
232 $single_form_gui->addItem($in_descr);
233
234 // File
235 $in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
236 $in_file->setRequired(true);
237 $single_form_gui->addItem($in_file);
238
239 $single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
240 $single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
241 $single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
242
243 $single_form_gui->setTableWidth("600px");
244 $single_form_gui->setTarget($this->getTargetFrame("save"));
245 $single_form_gui->setTitle($this->lng->txt($this->type."_new"));
246 $single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
247
248 $this->ctrl->setParameter($this, "new_type", "file");
249
250 $single_form_gui->setFormAction($this->ctrl->getFormAction($this, "save"));
251
252 return $single_form_gui;
253 }
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 353 of file class.ilObjFileGUI.php.

354 {
355 global $lng;
356
357 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
358 $zip_form_gui = new ilPropertyFormGUI();
359 $zip_form_gui->setMultipart(true);
360
361 // File
362 $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
363 $in_file->setRequired(true);
364 $in_file->setSuffixes(array("zip"));
365 $zip_form_gui->addItem($in_file);
366
367 // Take over structure
368 $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
369 $in_str->setInfo($this->lng->txt("take_over_structure_info"));
370 $zip_form_gui->addItem($in_str);
371
372 $zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
373 $zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
374
375 $zip_form_gui->setTableWidth("600px");
376 $zip_form_gui->setTarget($this->getTargetFrame("save"));
377 $zip_form_gui->setTitle($this->lng->txt("header_zip"));
378 $zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.svg'), $this->lng->txt('obj_file'));
379
380 $this->ctrl->setParameter($this, "new_type", "file");
381
382 $zip_form_gui->setFormAction($this->ctrl->getFormAction($this, "saveUnzip"));
383
384 return $zip_form_gui;
385 }

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

1416 {
1417 global $ilTabs;
1418
1419 // has the user the rights to delete the file?
1420 if (!$this->checkPermissionBool("write"))
1421 {
1422 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1423 }
1424
1425 // get ids either from GET (if single item was clicked) or
1426 // from POST (if multiple items were selected)
1427 $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1428
1429 // more than one entry selected?
1430 if (count($version_ids) != 1)
1431 {
1432 ilUtil::sendInfo($this->lng->txt("file_rollback_select_exact_one"), true);
1433 $this->ctrl->redirect($this, "versions");
1434 }
1435
1436 // rollback the version
1437 $new_version = $this->object->rollback($version_ids[0]);
1438
1439 ilUtil::sendSuccess(sprintf($this->lng->txt("file_rollback_done"), $new_version["rollback_version"]), true);
1440 $this->ctrl->redirect($this, "versions");
1441 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ Here is the call graph for this function:

◆ save()

ilObjFileGUI::save ( )

save object

@access public

Reimplemented from ilObject2GUI.

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

261 {
262 global $objDefinition, $ilUser;
263
264 if (!$this->checkPermissionBool("create", "", "file"))
265 {
266 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
267 }
268
269 $single_form_gui = $this->initSingleUploadForm();
270
271 if ($single_form_gui->checkInput())
272 {
273 $title = $single_form_gui->getInput("title");
274 $description = $single_form_gui->getInput("description");
275 $upload_file = $single_form_gui->getInput("upload_file");
276
277 if (trim($title) == "")
278 {
279 $title = $upload_file["name"];
280 }
281 else
282 {
283 // BEGIN WebDAV: Ensure that object title ends with the filename extension
284 $fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
286 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
287 {
288 $title .= '.'.$fileExtension;
289 }
290 // END WebDAV: Ensure that object title ends with the filename extension
291 }
292
293 // create and insert file in grp_tree
294 include_once("./Modules/File/classes/class.ilObjFile.php");
295 $fileObj = new ilObjFile();
296 $fileObj->setTitle($title);
297 $fileObj->setDescription($description);
298 $fileObj->setFileName($upload_file["name"]);
299 //$fileObj->setFileType($upload_file["type"]);
300 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
301 $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
302 "", $upload_file["name"], $upload_file["type"]));
303 $fileObj->setFileSize($upload_file["size"]);
304 $this->object_id = $fileObj->create();
305
306 $this->putObjectInTree($fileObj, $this->parent_id);
307
308 // upload file to filesystem
309 $fileObj->createDirectory();
310 $fileObj->getUploadFile($upload_file["tmp_name"],
311 $upload_file["name"]);
312
313 $this->handleAutoRating($fileObj);
314
315 // BEGIN ChangeEvent: Record write event.
316 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
317 ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
318 // END ChangeEvent: Record write event.
319
320 ilUtil::sendSuccess($this->lng->txt("file_added"),true);
321
322 if ($this->ctrl->getCmd() == "saveAndMeta")
323 {
324 $this->ctrl->setParameter($this, "new_type", "");
325 $target = $this->ctrl->getLinkTargetByClass(array("ilobjectmetadatagui", "ilmdeditorgui"), "listSection", "", false, false);
327 }
328 else
329 {
330 $this->ctrl->returnToParent($this);
331 }
332 }
333 else
334 {
335 $single_form_gui->setValuesByPost();
336 $this->tpl->setContent($single_form_gui->getHTML());
337 }
338 }
static redirect($a_script)
http redirect to other script

References $ilUser, ilObjectGUI\$objDefinition, $target, $title, 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 345 of file class.ilObjFileGUI.php.

346 {
347 $this->save();
348 }
save()
save object

References save().

+ Here is the call graph for this function:

◆ saveUnzip()

ilObjFileGUI::saveUnzip ( )

saveUnzip object

@access public

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

393 {
394 $zip_form_gui = $this->initZipUploadForm();
395
396 if ($this->checkPermissionBool("create", "", "file"))
397 {
398 if ($zip_form_gui->checkInput())
399 {
400 $zip_file = $zip_form_gui->getInput("zip_file");
401 $adopt_structure = $zip_form_gui->getInput("adopt_structure");
402
403 include_once ("Services/Utilities/classes/class.ilFileUtils.php");
404
405 // Create unzip-directory
406 $newDir = ilUtil::ilTempnam();
407 ilUtil::makeDir($newDir);
408
409 // Check if permission is granted for creation of object, if necessary
410 if($this->id_type != self::WORKSPACE_NODE_ID)
411 {
412
413 $type = ilObject::_lookupType((int)$this->parent_id, true);
414 }
415 else
416 {
417 $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
418 }
419
420 $tree = $access_handler = null;
421 switch($type)
422 {
423 // workspace structure
424 case 'wfld':
425 case 'wsrt':
426 $permission = $this->checkPermissionBool("create", "", "wfld");
427 $containerType = "WorkspaceFolder";
430 break;
431
432 // use categories as structure
433 case 'cat':
434 case 'root':
435 $permission = $this->checkPermissionBool("create", "", "cat");
436 $containerType = "Category";
437 break;
438
439 // use folders as structure (in courses)
440 default:
441 $permission = $this->checkPermissionBool("create", "", "fold");
442 $containerType = "Folder";
443 break;
444 }
445 // processZipFile (
446 // Dir to unzip,
447 // Path to uploaded file,
448 // should a structure be created (+ permission check)?
449 // ref_id of parent
450 // object that contains files (folder or category)
451 // should sendInfo be persistent?)
452 try
453 {
454 $processDone = ilFileUtils::processZipFile( $newDir,
455 $zip_file["tmp_name"],
456 ($adopt_structure && $permission),
457 $this->parent_id,
458 $containerType,
459 $tree,
461 ilUtil::sendSuccess($this->lng->txt("file_added"),true);
462 }
463 catch (ilFileUtilsException $e)
464 {
465 ilUtil::sendFailure($e->getMessage(), true);
466 }
467
468 ilUtil::delDir($newDir);
469 $this->ctrl->returnToParent($this);
470 }
471 else
472 {
473 $zip_form_gui->setValuesByPost();
474 $this->tpl->setContent($zip_form_gui->getHTML());
475 }
476 }
477 else
478 {
479 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
480 }
481 }

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

669 {
670 global $ilUser, $ilCtrl;
671
672 if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']) )
673 {
674 $this->object->sendFile($_GET["hist_id"]);
675 }
676
677 if ($this->checkPermissionBool("read"))
678 {
679 // BEGIN ChangeEvent: Record read event.
680 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
681 global $ilUser;
682 // Record read event and catchup with write events
683 ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
684 $this->object->getId(), $ilUser->getId());
685 // END ChangeEvent: Record read event.
686
687 require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
688 ilLPStatusWrapper::_updateStatus($this->object->getId(), $ilUser->getId());
689
690 $this->object->sendFile($_GET["hist_id"]);
691 }
692 else
693 {
694 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
695 }
696 return true;
697 }
static _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 874 of file class.ilObjFileGUI.php.

875 {
876 global $ilTabs, $lng, $ilHelp;
877
878 $ilHelp->setScreenIdComponent("file");
879
880 $this->ctrl->setParameter($this,"ref_id",$this->node_id);
881
882 if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read"))
883 {
884 $ilTabs->addTab("id_info",
885 $lng->txt("info_short"),
886 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary"));
887 }
888
889 if ($this->checkPermissionBool("write"))
890 {
891 $ilTabs->addTab("settings",
892 $lng->txt("edit"),
893 $this->ctrl->getLinkTarget($this, "edit"));
894 }
895
896 if ($this->checkPermissionBool("write"))
897 {
898 $ilTabs->addTab("id_versions",
899 $lng->txt("versions"),
900 $this->ctrl->getLinkTarget($this, "versions"));
901 }
902
903 require_once 'Services/Tracking/classes/class.ilLearningProgressAccess.php';
904 if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
905 {
906 $ilTabs->addTab(
907 'learning_progress',
908 $lng->txt('learning_progress'),
909 $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'),'')
910 );
911 }
912
913 // meta data
914 if ($this->checkPermissionBool("write"))
915 {
916 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
917 $mdgui = new ilObjectMetaDataGUI($this->object);
918 $mdtab = $mdgui->getTab();
919 if($mdtab)
920 {
921 $ilTabs->addTab("id_meta",
922 $lng->txt("meta_data"),
923 $mdtab);
924 }
925 }
926
927 // export
928 if ($this->checkPermissionBool("write"))
929 {
930 $ilTabs->addTab("export",
931 $lng->txt("export"),
932 $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
933 }
934
935 // will add permission tab if needed
936 parent::setTabs();
937 }
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 488 of file class.ilObjFileGUI.php.

489 {
490 global $ilTabs;
491
492 $form = $this->initPropertiesForm();
493 if(!$form->checkInput())
494 {
495 $ilTabs->activateTab("settings");
496 $form->setValuesByPost();
497 $this->tpl->setContent($form->getHTML());
498 return false;
499 }
500
501 $data = $form->getInput('file');
502
503 // delete trailing '/' in filename
504 $data["name"] = rtrim($data["name"], '/');
505
506 $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
507 $title = $form->getInput('title');
508 if(strlen(trim($title)) == 0)
509 {
511 }
512 else
513 {
514 $title = $this->object->checkFileExtension($filename,$title);
515 }
516 $this->object->setTitle($title);
517
518 if (!empty($data["name"]))
519 {
520 switch($form->getInput('replace'))
521 {
522 case 1:
523 $this->object->deleteVersions();
524 $this->object->clearDataDirectory();
525 $this->object->replaceFile($data['tmp_name'],$data['name']);
526 break;
527 case 0:
528 $this->object->addFileVersion($data['tmp_name'],$data['name']);
529 break;
530 }
531 $this->object->setFileName($data['name']);
532 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
533 $this->object->setFileType(ilMimeTypeUtil::getMimeType(
534 "", $data["name"], $data["type"]));
535 $this->object->setFileSize($data['size']);
536 }
537
538 $this->object->setDescription($form->getInput('description'));
539 $this->object->setRating($form->getInput('rating'));
540
541 $this->update = $this->object->update();
542
543 // BEGIN ChangeEvent: Record update event.
544 if (!empty($data["name"]))
545 {
546 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
547 global $ilUser;
548 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
549 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
550 }
551 // END ChangeEvent: Record update event.
552
553 // Update ecs export settings
554 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
555 $ecs = new ilECSFileSettings($this->object);
556 $ecs->handleSettingsUpdate();
557
558 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
559 ilUtil::redirect($this->ctrl->getLinkTarget($this,'edit','',false,false));
560 }
static _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, $title, 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 1024 of file class.ilObjFileGUI.php.

1025 {
1026 include_once("./Services/JSON/classes/class.ilJsonUtil.php");
1027
1028 $response = new stdClass();
1029 $response->error = null;
1030 $response->debug = null;
1031
1032 $files = $_FILES;
1033
1034 // #14249 - race conditions because of concurrent uploads
1035 $after_creation_callback = (int)$_REQUEST["crtcb"];
1036 if($after_creation_callback)
1037 {
1038 $this->after_creation_callback_objects = array();
1039 unset($_REQUEST["crtcb"]);
1040 }
1041
1042 // load form
1043 $dnd_form_gui = $this->initMultiUploadForm();
1044 if ($dnd_form_gui->checkInput())
1045 {
1046 try
1047 {
1048 if (!$this->checkPermissionBool("create", "", "file"))
1049 {
1050 $response->error = $this->lng->txt("permission_denied");
1051 }
1052 else
1053 {
1054 // handle the file
1055 $inp = $dnd_form_gui->getInput("upload_files");
1056 $this->log->debug("ilObjFileGUI::uploadFiles ".print_r($_POST, true));
1057 $this->log->debug("ilObjFileGUI::uploadFiles ".print_r($_FILES, true));
1058 $fileresult = $this->handleFileUpload($inp);
1059 if ($fileresult)
1060 $response = (object)array_merge((array)$response, (array)$fileresult);
1061 }
1062 }
1063 catch (Exception $ex)
1064 {
1065 $response->error = $ex->getMessage() . " ## " . $ex->getTraceAsString();
1066 }
1067 }
1068 else
1069 {
1070 $dnd_input = $dnd_form_gui->getItemByPostVar("upload_files");
1071 $response->error = $dnd_input->getAlert();
1072 }
1073
1074 if($after_creation_callback &&
1075 sizeof($this->after_creation_callback_objects))
1076 {
1077 foreach($this->after_creation_callback_objects as $new_file_obj)
1078 {
1079 ilObject2GUI::handleAfterSaveCallback($new_file_obj, $after_creation_callback);
1080 }
1081 unset($this->after_creation_callback_objects);
1082 }
1083
1084 // send response object (don't use 'application/json' as IE wants to download it!)
1085 header('Vary: Accept');
1086 header('Content-type: text/plain');
1087 echo ilJsonUtil::encode($response);
1088
1089 // no further processing!
1090 exit;
1091 }
$files
Definition: add-vimline.php:18
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.

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

706 {
707 global $ilTabs;
708
709 $ilTabs->activateTab("id_versions");
710
711 if (!$this->checkPermissionBool("write"))
712 {
713 $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
714 }
715
716 // get versions
717 $versions = $this->object->getVersions();
718
719 // build versions table
720 require_once("Modules/File/classes/class.ilFileVersionTableGUI.php");
721 $table = new ilFileVersionTableGUI($this, "versions");
722 $table->setMaxCount(sizeof($versions));
723 $table->setData($versions);
724
725 $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
726 }

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: