ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
 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...
 
- 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...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. 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...
 
 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...
 
 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...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. 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...
 

Data Fields

const CMD_EDIT = "edit"
 
const CMD_VERSIONS = "versions"
 
 $object
 
- 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
 
 $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
 

Protected Member Functions

 initCreationForms ($a_new_type)
 
 initPropertiesForm ($mode="create")
 
 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...
 
 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)
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 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...
 
 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
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 

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

36 {
37 $this->log = ilLoggerFactory::getLogger('file');
38 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
39 $this->lng->loadLanguageModule('file');
40 }
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 882 of file class.ilObjFileGUI.php.

883 {
884 global $DIC;
885 $ilErr = $DIC['ilErr'];
886 $lng = $DIC['lng'];
887 $ilAccess = $DIC['ilAccess'];
888
889 if ($a_additional && substr($a_additional, -3) == "wsp") {
890 $_GET["baseClass"] = "ilsharedresourceGUI";
891 $_GET["wsp_id"] = $a_target;
892 include("ilias.php");
893 exit;
894 }
895
896 // added support for direct download goto links
897 if ($a_additional && substr($a_additional, -8) == "download") {
898 ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
899 }
900
901 // static method, no workspace support yet
902
903 if ($ilAccess->checkAccess("visible", "", $a_target)
904 || $ilAccess->checkAccess("read", "", $a_target)
905 ) {
906 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
907 } else {
908 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
909 ilUtil::sendFailure(sprintf(
910 $lng->txt("msg_no_perm_read_item"),
912 ), true);
914 }
915 }
916
917 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
918 }
exit
Definition: backend.php:16
$_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 $DIC
Definition: saml.php:7

References $_GET, $DIC, ilObjectGUI\$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 924 of file class.ilObjFileGUI.php.

925 {
926 global $DIC;
927 $ilLocator = $DIC['ilLocator'];
928
929 if (is_object($this->object)) {
930 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
931 }
932 }

References $DIC.

◆ edit()

ilObjFileGUI::edit ( )

edit object

@access public

Reimplemented from ilObject2GUI.

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

529 {
530 global $DIC;
531 $ilTabs = $DIC['ilTabs'];
532 $ilErr = $DIC['ilErr'];
533
534 if (!$this->checkPermissionBool("write")) {
535 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
536 }
537
538 $ilTabs->activateTab("settings");
539
540 $form = $this->initPropertiesForm(self::CMD_EDIT);
541
542 $val = array();
543 $val['title'] = $this->object->getTitle();
544 $val['description'] = $this->object->getLongDescription();
545 $val['rating'] = $this->object->hasRating();
546 $form->setValuesByArray($val);
547
548 // Edit ecs export settings
549 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
550 $ecs = new ilECSFileSettings($this->object);
551 $ecs->addSettingsToForm($form, 'file');
552
553 $this->tpl->setContent($form->getHTML());
554
555 return true;
556 }
Class ilECSFileSettings.
initPropertiesForm($mode="create")
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
if(isset($_POST['submit'])) $form

References $DIC, $form, ilObjectGUI\$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 $DIC;
52 $ilNavigationHistory = $DIC['ilNavigationHistory'];
53 $ilCtrl = $DIC['ilCtrl'];
54 $ilUser = $DIC['ilUser'];
55 $ilTabs = $DIC['ilTabs'];
56 $ilAccess = $DIC['ilAccess'];
57 $ilErr = $DIC['ilErr'];
58
59 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61
62 if ($this->id_type == self::WORKSPACE_NODE_ID) {
64 }
65
66 if (!$this->getCreationMode()) {
67 if ($this->id_type == self::REPOSITORY_NODE_ID
68 && $this->checkPermissionBool("read")
69 ) {
70 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
71 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
72 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
73
74 // add entry to navigation history
75 $ilNavigationHistory->addItem(
76 $this->node_id,
77 $link,
78 "file"
79 );
80 }
81 }
82
83 $this->prepareOutput();
84
85 switch ($next_class) {
86 case "ilinfoscreengui":
87 $this->infoScreenForward(); // forwards command
88 break;
89
90 case 'ilobjectmetadatagui':
91 if (!$this->checkPermissionBool("write")) {
92 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
93 }
94
95 $ilTabs->activateTab("id_meta");
96
97 $md_gui = new ilObjectMetaDataGUI($this->object);
98
99 // todo: make this work
100 // $md_gui->addMDObserver($this->object,'MDUpdateListener','Technical');
101
102 $this->ctrl->forwardCommand($md_gui);
103 break;
104
105 // repository permissions
106 case 'ilpermissiongui':
107 $ilTabs->activateTab("id_permissions");
108 $perm_gui = new ilPermissionGUI($this);
109 $ret = $this->ctrl->forwardCommand($perm_gui);
110 break;
111
112 case "ilexportgui":
113 $ilTabs->activateTab("export");
114 $exp_gui = new ilExportGUI($this);
115 $exp_gui->addFormat("xml");
116 $ret = $this->ctrl->forwardCommand($exp_gui);
117 break;
118
119 case 'ilobjectcopygui':
120 $cp = new ilObjectCopyGUI($this);
121 $cp->setType('file');
122 $this->ctrl->forwardCommand($cp);
123 break;
124
125 // personal workspace permissions
126 case "ilworkspaceaccessgui":
127 $ilTabs->activateTab("id_permissions");
128 $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
129 $this->ctrl->forwardCommand($wspacc);
130 break;
131
132 case "ilcommonactiondispatchergui":
134 $this->ctrl->forwardCommand($gui);
135 break;
136
137 case "illearningprogressgui":
138 $ilTabs->activateTab('learning_progress');
139 $new_gui = new ilLearningProgressGUI(
141 $this->object->getRefId(),
142 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
143 );
144 $this->ctrl->forwardCommand($new_gui);
145 $this->tabs_gui->setTabActive('learning_progress');
146 break;
147 case strtolower(ilFileVersionsGUI::class):
148 $this->tabs_gui->activateTab("id_versions");
149
150 if (!$this->checkPermissionBool("write")) {
151 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
152 }
153 $this->ctrl->forwardCommand(new ilFileVersionsGUI($this->object));
154 break;
155
156 default:
157 // in personal workspace use object2gui
158 if ($this->id_type == self::WORKSPACE_NODE_ID) {
159 $this->addHeaderAction();
160
161 // coming from goto we need default command
162 if (empty($cmd)) {
163 $ilCtrl->setCmd("infoScreen");
164 }
165 $ilTabs->clearTargets();
166
167 return parent::executeCommand();
168 }
169
170 if (empty($cmd)) {
171 $cmd = "infoScreen";
172 }
173
174 $this->$cmd();
175 break;
176 }
177
178 $this->addHeaderAction();
179 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
static setPersonalWorkspaceQuotaCheck($a_value)
Class ilFileVersionsGUI.
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
$ilUser
Definition: imgupload.php:18

References $_GET, $DIC, $ilCtrl, ilObjectGUI\$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 43 of file class.ilObjFileGUI.php.

44 {
45 return "file";
46 }

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

684 {
685 $this->ctrl->setCmd("showSummary");
686 $this->ctrl->setCmdClass("ilinfoscreengui");
687 $this->infoScreenForward();
688 }

References infoScreenForward().

+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

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

695 {
696 global $DIC;
697 $ilTabs = $DIC['ilTabs'];
698 $ilErr = $DIC['ilErr'];
699 $ilToolbar = $DIC['ilToolbar'];
700
701 $ilTabs->activateTab("id_info");
702
703 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
704 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
705 }
706
707 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
708 $info = new ilInfoScreenGUI($this);
709
710 if ($this->checkPermissionBool("read", "sendfile")) {
711 // #14378
712 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
713 $button = ilLinkButton::getInstance();
714 $button->setCaption("file_download");
715 $button->setPrimary(true);
716
717 // get permanent download link for repository
718 if ($this->id_type == self::REPOSITORY_NODE_ID) {
719 $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
720 } else {
721 $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
722 }
723
724 $ilToolbar->addButtonInstance($button);
725 }
726
727 $info->enablePrivateNotes();
728
729 if ($this->checkPermissionBool("read")) {
730 $info->enableNews();
731 }
732
733 // no news editing for files, just notifications
734 $info->enableNewsEditing(false);
735 if ($this->checkPermissionBool("write")) {
736 $news_set = new ilSetting("news");
737 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
738
739 if ($enable_internal_rss) {
740 $info->setBlockProperty("news", "settings", true);
741 $info->setBlockProperty("news", "public_notifications_option", true);
742 }
743 }
744
745 // standard meta data
746 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
747
748 // File Info
749 $info->addSection($this->lng->txt("file_info"));
750 $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
751 $info->addProperty($this->lng->txt("type"), $this->object->guessFileType());
752
753 $info->addProperty($this->lng->txt("size"), ilUtil::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long'));
754 $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
755
756 if ($this->object->getPageCount() > 0) {
757 $info->addProperty($this->lng->txt("page_count"), $this->object->getPageCount());
758 }
759
760 // using getVersions function instead of ilHistory direct
761 $uploader = $this->object->getVersions();
762 $uploader = array_shift($uploader);
763 $uploader = $uploader["user_id"];
764
765 include_once "Services/User/classes/class.ilUserUtil.php";
766 $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
767
768 // download link added in repository
769 if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
770 $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
771 $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
772 $info->addProperty($this->lng->txt("download_link"), $tpl->get());
773 }
774
775 if ($this->id_type == self::WORKSPACE_NODE_ID) {
776 $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
777 }
778
779 // display previews
780 include_once("./Services/Preview/classes/class.ilPreview.php");
781 if (!$this->ctrl->isAsynch()
782 && ilPreview::hasPreview($this->object->getId(), $this->object->getType())
783 && $this->checkPermissionBool("read")
784 ) {
785 include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
786
787 // get context for access checks later on
788 $context;
789 switch ($this->id_type) {
793 break;
794
795 default:
797 break;
798 }
799
800 $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
801 $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
802 }
803
804 // forward the command
805 // $this->ctrl->setCmd("showSummary");
806 // $this->ctrl->setCmdClass("ilinfoscreengui");
807 $this->ctrl->forwardCommand($info);
808 }
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, $a_ctrl_path="ilpublicuserprofilegui")
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: index.php:5
$preview
$context
Definition: webdav.php:25

References $context, $DIC, ilObjectGUI\$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 185 of file class.ilObjFileGUI.php.

186 {
187 $forms = array();
188
189 if ($this->id_type == self::WORKSPACE_NODE_ID) {
191 ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
192 $this->ctrl->redirect($this, "cancel");
193 }
194 }
195
196 // use drag-and-drop upload if configured
198 $forms[] = $this->initMultiUploadForm();
199 } else {
200 $forms[] = $this->initSingleUploadForm();
201 $forms[] = $this->initZipUploadForm();
202 }
203
204 // repository only
205 if ($this->id_type != self::WORKSPACE_NODE_ID) {
206 $forms[self::CFORM_IMPORT] = $this->initImportForm('file');
207 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
208 }
209
210 return $forms;
211 }
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 1217 of file class.ilObjFileGUI.php.

1218 {
1219 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1220 if (is_object($lg)) {
1221 if ($this->object->hasRating()) {
1222 $lg->enableRating(
1223 true,
1224 null,
1225 false,
1226 array("ilcommonactiondispatchergui", "ilratinggui")
1227 );
1228 }
1229 }
1230
1231 return $lg;
1232 }
$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 940 of file class.ilObjFileGUI.php.

941 {
942 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
943 $dnd_form_gui = new ilPropertyFormGUI();
944 $dnd_form_gui->setMultipart(true);
945 $dnd_form_gui->setHideLabels();
946
947 // file input
948 include_once("Services/Form/classes/class.ilDragDropFileInputGUI.php");
949 $dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files");
950 $dnd_input->setArchiveSuffixes(array("zip"));
951 $dnd_input->setCommandButtonNames("uploadFiles", "cancel");
952 $dnd_form_gui->addItem($dnd_input);
953
954 // add commands
955 $dnd_form_gui->addCommandButton("uploadFiles", $this->lng->txt("upload_files"));
956 $dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
957
958 $dnd_form_gui->setTableWidth("100%");
959 $dnd_form_gui->setTarget($this->getTargetFrame("save"));
960 $dnd_form_gui->setTitle($this->lng->txt("upload_files_title"));
961 $dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
962
963 $this->ctrl->setParameter($this, "new_type", "file");
964 $dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, "uploadFiles"));
965
966 return $dnd_form_gui;
967 }
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 (   $mode = "create")
protected
Parameters

return

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

566 {
567 $form = new ilPropertyFormGUI();
568 $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
569 $form->setTitle($this->lng->txt('file_edit'));
570 $form->addCommandButton('update', $this->lng->txt('save'));
571 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
572
573 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
574 $title->setValue($this->object->getTitle());
575 $title->setInfo($this->lng->txt("if_no_title_then_filename"));
576 $form->addItem($title);
577
578 if ($mode === 'create') {
579 $upload_possible = true;
580 if ($this->id_type == self::WORKSPACE_NODE_ID) {
581 $upload_possible = ilDiskQuotaHandler::isUploadPossible();
582 }
583
584 if ($upload_possible) {
586 'cancel',
587 $this->lng->txt('obj_file'),
588 'file'
589 );
590 $file->setRequired(false);
591 $form->addItem($file);
592
593 $group = new ilRadioGroupInputGUI('', 'replace');
594 $group->setValue(0);
595
596 $replace = new ilRadioOption($this->lng->txt('replace_file'), 1);
597 $replace->setInfo($this->lng->txt('replace_file_info'));
598 $group->addOption($replace);
599
600 $keep = new ilRadioOption($this->lng->txt('file_new_version'), 0);
601 $keep->setInfo($this->lng->txt('file_new_version_info'));
602 $group->addOption($keep);
603
604 $file->addSubItem($group);
605 } elseif ($mode == 'create') {
606 $file = new ilNonEditableValueGUI($this->lng->txt('obj_file'));
607 $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning"));
608 $form->addItem($file);
609 }
610 } else {
611 $o = new ilNonEditableValueGUI($this->lng->txt('upload_info'));
612 $o->setValue($this->lng->txt('upload_info_desc'));
613 $form->addItem($o);
614 }
615 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
616 $desc->setRows(3);
617 $form->addItem($desc);
618
619 if ($this->id_type == self::REPOSITORY_NODE_ID) {
620 $this->lng->loadLanguageModule('rating');
621 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
622 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
623 $form->addItem($rate);
624 }
625
626 return $form;
627 }
This class represents a checkbox property in a property form.
Class ilFileStandardDropzoneInputGUI.
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 $form, $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 217 of file class.ilObjFileGUI.php.

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

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

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

References $DIC, 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:

◆ save()

ilObjFileGUI::save ( )

save object

@access public

Reimplemented from ilObject2GUI.

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

265 {
266 global $DIC;
267 $ilUser = $DIC->user();
268
269 if (!$this->checkPermissionBool("create", "", "file")) {
270 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
271 }
272
273 $single_form_gui = $this->initSingleUploadForm();
274
275 if ($single_form_gui->checkInput()) {
276 $title = $single_form_gui->getInput("title");
277 $description = $single_form_gui->getInput("description");
278 $upload_file = $single_form_gui->getInput("upload_file");
279
280 if (trim($title) == "") {
281 $title = $upload_file["name"];
282 } else {
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 $title .= '.' . $fileExtension;
288 }
289 // END WebDAV: Ensure that object title ends with the filename extension
290 }
291
292 // create and insert file in grp_tree
293
294 $fileObj = new ilObjFile();
295 $fileObj->setTitle($title);
296 $fileObj->setDescription($description);
297 $fileObj->setFileName($upload_file["name"]);
298
299 $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
300 "",
301 $upload_file["name"],
302 $upload_file["type"]
303 ));
304 $fileObj->setFileSize($upload_file["size"]);
305 $this->object_id = $fileObj->create();
306
307 $this->putObjectInTree($fileObj, $this->parent_id);
308
309 // upload file to filesystem
310 $fileObj->createDirectory();
311 if ($result = $fileObj->getUploadFile($upload_file["tmp_name"], $upload_file["name"])) {
312 $fileObj->setFileName($result->getName());
313 }
314
315 $this->handleAutoRating($fileObj);
316
317 // BEGIN ChangeEvent: Record write event.
318 ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
319 // END ChangeEvent: Record write event.
320
321 ilUtil::sendSuccess($this->lng->txt("file_added"), true);
322
323 if ($this->ctrl->getCmd() == "saveAndMeta") {
324 $this->ctrl->setParameter($this, "new_type", "");
325 $target = $this->ctrl->getLinkTargetByClass(array("ilobjectmetadatagui", "ilmdeditorgui"), "listSection", "", false, false);
327 } else {
328 $this->ctrl->returnToParent($this);
329 }
330 } else {
331 $single_form_gui->setValuesByPost();
332 $this->tpl->setContent($single_form_gui->getHTML());
333 }
334 }
$result
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
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)
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
static redirect($a_script)
$target
Definition: test.php:19

References $description, $DIC, $ilUser, $result, $target, $title, ilObjFileAccess\_getFileExtension(), ilChangeEvent\_recordWriteEvent(), ilObject2GUI\checkPermissionBool(), ilMimeTypeUtil\getMimeType(), ilObject2GUI\handleAutoRating(), initSingleUploadForm(), ilObject2GUI\putObjectInTree(), and ilUtil\redirect().

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

343 {
344 $this->save();
345 }
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 if ($zip_form_gui->checkInput()) {
398 $zip_file = $zip_form_gui->getInput("zip_file");
399 $adopt_structure = $zip_form_gui->getInput("adopt_structure");
400
401 include_once("Services/Utilities/classes/class.ilFileUtils.php");
402
403 // Create unzip-directory
404 $newDir = ilUtil::ilTempnam();
405 ilUtil::makeDir($newDir);
406
407 // Check if permission is granted for creation of object, if necessary
408 if ($this->id_type != self::WORKSPACE_NODE_ID) {
409 $type = ilObject::_lookupType((int) $this->parent_id, true);
410 } else {
411 $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
412 }
413
414 $tree = $access_handler = null;
415 switch ($type) {
416 // workspace structure
417 case 'wfld':
418 case 'wsrt':
419 $permission = $this->checkPermissionBool("create", "", "wfld");
420 $containerType = "WorkspaceFolder";
423 break;
424
425 // use categories as structure
426 case 'cat':
427 case 'root':
428 $permission = $this->checkPermissionBool("create", "", "cat");
429 $containerType = "Category";
430 break;
431
432 // use folders as structure (in courses)
433 default:
434 $permission = $this->checkPermissionBool("create", "", "fold");
435 $containerType = "Folder";
436 break;
437 }
438 // processZipFile (
439 // Dir to unzip,
440 // Path to uploaded file,
441 // should a structure be created (+ permission check)?
442 // ref_id of parent
443 // object that contains files (folder or category)
444 // should sendInfo be persistent?)
445 try {
446 $processDone = ilFileUtils::processZipFile(
447 $newDir,
448 $zip_file["tmp_name"],
449 ($adopt_structure && $permission),
450 $this->parent_id,
451 $containerType,
452 $tree,
454 );
455 ilUtil::sendSuccess($this->lng->txt("file_added"), true);
456 } catch (ilFileUtilsException $e) {
457 ilUtil::sendFailure($e->getMessage(), true);
458 }
459
460 ilUtil::delDir($newDir);
461 $this->ctrl->returnToParent($this);
462 } else {
463 $zip_form_gui->setValuesByPost();
464 $this->tpl->setContent($zip_form_gui->getHTML());
465 }
466 } else {
467 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
468 }
469 }
Class to report exception.
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 _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)
Returns a unique and non existing Path for e temporary file or directory.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
$type

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

+ Here is the call graph for this function:

◆ sendFile()

ilObjFileGUI::sendFile ( )

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

631 {
632 global $DIC;
633
634 try {
635 if (ANONYMOUS_USER_ID == $DIC->user()->getId() && isset($_GET['transaction'])) {
636 $a_hist_entry_id = isset($_GET["hist_id"]) ? $_GET["hist_id"] : null;
637 $this->object->sendFile($a_hist_entry_id);
638 }
639
640 if ($this->checkPermissionBool("read")) {
641 // BEGIN ChangeEvent: Record read event.
642 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
643
644 // Record read event and catchup with write events
646 $this->object->getType(),
647 $this->object->getRefId(),
648 $this->object->getId(),
649 $DIC->user()->getId()
650 );
651 // END ChangeEvent: Record read event.
652
653 require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
654 ilLPStatusWrapper::_updateStatus($this->object->getId(), $DIC->user()->getId());
655
656 $a_hist_entry_id = isset($_GET["hist_id"]) ? $_GET["hist_id"] : null;
657 $this->object->sendFile($a_hist_entry_id);
658 } else {
659 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
660 }
661 } catch (\ILIAS\Filesystem\Exception\FileNotFoundException $e) {
662 $this->ilErr->raiseError($e->getMessage(), $this->ilErr->MESSAGE);
663 }
664
665 return true;
666 }
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.
Class FlySystemFileAccessTest.
Class BaseForm.

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

813 {
814 global $DIC;
815 $ilTabs = $DIC['ilTabs'];
816 $lng = $DIC['lng'];
817 $ilHelp = $DIC['ilHelp'];
818
819 $ilHelp->setScreenIdComponent("file");
820
821 $this->ctrl->setParameter($this, "ref_id", $this->node_id);
822
823 if ($this->checkPermissionBool("write")) {
824 $ilTabs->addTab(
825 "id_versions",
826 $lng->txt(self::CMD_VERSIONS),
827 $this->ctrl->getLinkTargetByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_DEFAULT)
828 );
829 }
830
831 if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read")) {
832 $ilTabs->addTab(
833 "id_info",
834 $lng->txt("info_short"),
835 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary")
836 );
837 }
838
839 if ($this->checkPermissionBool("write")) {
840 $ilTabs->addTab(
841 "settings",
842 $lng->txt("settings"),
843 $this->ctrl->getLinkTarget($this, self::CMD_EDIT)
844 );
845 }
846
847 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
848 $ilTabs->addTab(
849 'learning_progress',
850 $lng->txt('learning_progress'),
851 $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'), '')
852 );
853 }
854
855 // meta data
856 if ($this->checkPermissionBool("write")) {
857 $mdgui = new ilObjectMetaDataGUI($this->object);
858 $mdtab = $mdgui->getTab();
859 if ($mdtab) {
860 $ilTabs->addTab(
861 "id_meta",
862 $lng->txt("meta_data"),
863 $mdtab
864 );
865 }
866 }
867
868 // export
869 if ($this->checkPermissionBool("write")) {
870 $ilTabs->addTab(
871 "export",
872 $lng->txt("export"),
873 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
874 );
875 }
876
877 // will add permission tab if needed
878 parent::setTabs();
879 }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress

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

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

478 {
479 global $DIC;
480 $ilTabs = $DIC['ilTabs'];
481
482 $form = $this->initPropertiesForm(self::CMD_EDIT);
483 if (!$form->checkInput()) {
484 $ilTabs->activateTab("settings");
485 $form->setValuesByPost();
486 $this->tpl->setContent($form->getHTML());
487
488 return false;
489 }
490
491 $title = $form->getInput('title');
492 // bugfix mantis 26045:
493 $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
494 if (strlen(trim($title)) == 0) {
496 } else {
497 $title = $this->object->checkFileExtension($filename, $title);
498 }
499 $this->object->setTitle($title);
500 $this->object->setDescription($form->getInput('description'));
501 $this->object->setRating($form->getInput('rating'));
502
503 $this->update = $this->object->update();
504
505 // BEGIN ChangeEvent: Record update event.
506 if (!empty($data["name"])) {
507 global $DIC;
508 $ilUser = $DIC['ilUser'];
509 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
510 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
511 }
512 // END ChangeEvent: Record update event.
513
514 // Update ecs export settings
515 $ecs = new ilECSFileSettings($this->object);
516 $ecs->handleSettingsUpdate();
517
518 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
519 ilUtil::redirect($this->ctrl->getLinkTarget($this, self::CMD_EDIT, '', false, false));
520 }
$filename
Definition: buildRTE.php:89
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, $DIC, $filename, $form, $ilUser, $title, ilChangeEvent\_catchupWriteEvents(), ilChangeEvent\_recordWriteEvent(), initPropertiesForm(), ilUtil\redirect(), 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 973 of file class.ilObjFileGUI.php.

974 {
975 global $DIC;
976
977 include_once("./Services/JSON/classes/class.ilJsonUtil.php");
978
979 $response = new stdClass();
980 $response->error = null;
981 $response->debug = null;
982
983 $files = $_FILES;
984
985 // #14249 - race conditions because of concurrent uploads
986 $after_creation_callback = (int) $_REQUEST["crtcb"];
987 if ($after_creation_callback) {
988 $this->after_creation_callback_objects = array();
989 unset($_REQUEST["crtcb"]);
990 }
991
992 // load form
993 $dnd_form_gui = $this->initMultiUploadForm();
994 if ($dnd_form_gui->checkInput()) {
995 try {
996 if (!$this->checkPermissionBool("create", "", "file")) {
997 $response->error = $this->lng->txt("permission_denied");
998 } else {
999 // handle the file
1000 $inp = $dnd_form_gui->getInput("upload_files");
1001 $this->log->debug("ilObjFileGUI::uploadFiles " . print_r($_POST, true));
1002 $this->log->debug("ilObjFileGUI::uploadFiles " . print_r($_FILES, true));
1003 $fileresult = $this->handleFileUpload($inp);
1004 if ($fileresult) {
1005 $response = (object) array_merge((array) $response, (array) $fileresult);
1006 }
1007 }
1008 } catch (Exception $ex) {
1009 $response->error = $this->lng->txt('general_upload_error_occured');
1010 }
1011 } else {
1012 $dnd_input = $dnd_form_gui->getItemByPostVar("upload_files");
1013 $response->error = $dnd_input->getAlert();
1014 }
1015
1016 if ($after_creation_callback
1017 && sizeof($this->after_creation_callback_objects)
1018 ) {
1019 foreach ($this->after_creation_callback_objects as $new_file_obj) {
1020 ilObject2GUI::handleAfterSaveCallback($new_file_obj, $after_creation_callback);
1021 }
1022 unset($this->after_creation_callback_objects);
1023 }
1024
1025 // send response object (don't use 'application/json' as IE wants to download it!)
1026 header('Vary: Accept');
1027 header('Content-type: text/plain');
1028
1029 if ($DIC->upload()->hasBeenProcessed()) {
1030 foreach ($DIC->upload()->getResults() as $result) {
1031 if (!ilFileUtils::hasValidExtension($result->getName())) {
1033 $this->lng->txt('file_upload_info_file_with_critical_extension'),
1034 true
1035 );
1036 }
1037 }
1038 }
1039 echo json_encode($response);
1040 // no further processing!
1041 exit;
1042 }
$_POST["username"]
static hasValidExtension($a_filename)
static handleAfterSaveCallback(ilObject $a_obj, $a_callback_ref_id)
After creation callback.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$files
Definition: metarefresh.php:49
$response

References $_POST, $DIC, $files, $response, $result, ilObject2GUI\checkPermissionBool(), exit, ilObject2GUI\handleAfterSaveCallback(), ilFileUtils\hasValidExtension(), initMultiUploadForm(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ versions()

ilObjFileGUI::versions ( )
Deprecated:

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

673 {
674 $this->ctrl->redirectByClass(ilFileVersionsGUI::class);
675 }

Field Documentation

◆ $log

ilObjFileGUI::$log = null
protected

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

◆ $object

ilObjFileGUI::$object

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

◆ CMD_EDIT

const ilObjFileGUI::CMD_EDIT = "edit"

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

◆ CMD_VERSIONS

const ilObjFileGUI::CMD_VERSIONS = "versions"

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


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