ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 update ()
 updates object entry in object_data @access public More...
 
 edit ()
 edit object @access public 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...
 
- 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 ()
 viewObject container presentation for "administration -> repository, trash, permissions" 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...
 
 addToDeskObject ()
 @inheritDoc More...
 
 removeFromDeskObject ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

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"
 
const CMD_UPLOAD_FILES = "uploadFiles"
 
 $object
 
 $lng
 
- Data Fields inherited from ilObject2GUI
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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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

 render ()
 This Method is needed if called from personal resources. More...
 
 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...
 
 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...
 
 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
 
 $obj_service
 
- Protected Attributes inherited from ilObject2GUI
 $object_id
 
 $node_id
 
 $creation_forms = array()
 
 $id_type = array()
 
 $parent_id
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

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 global $DIC;
38 $this->lng = $DIC->language();
39 $this->log = ilLoggerFactory::getLogger('file');
40 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
41 $this->obj_service = $DIC->object();
42 $this->lng->loadLanguageModule("file");
43 }
static getLogger($a_component_id)
Get component logger.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and 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 685 of file class.ilObjFileGUI.php.

686 {
687 global $DIC;
688 $ilErr = $DIC['ilErr'];
689 $lng = $DIC['lng'];
690 $ilAccess = $DIC['ilAccess'];
691
692 if ($a_additional && substr($a_additional, -3) == "wsp") {
693 $_GET["baseClass"] = "ilsharedresourceGUI";
694 $_GET["wsp_id"] = $a_target;
695 include("ilias.php");
696 exit;
697 }
698
699 // added support for direct download goto links
700 if ($a_additional && substr($a_additional, -8) == "download") {
701 ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
702 }
703
704 // static method, no workspace support yet
705
706 if ($ilAccess->checkAccess("visible", "", $a_target)
707 || $ilAccess->checkAccess("read", "", $a_target)
708 ) {
709 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
710 } else {
711 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
712 ilUtil::sendFailure(sprintf(
713 $lng->txt("msg_no_perm_read_item"),
715 ), true);
717 }
718 }
719
720 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
721 }
$_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.
const ROOT_FOLDER_ID
Definition: constants.php:30
exit
Definition: login.php:29

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

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjFileGUI::addLocatorItems ( )

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

727 {
728 global $DIC;
729 $ilLocator = $DIC['ilLocator'];
730
731 if (is_object($this->object)) {
732 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
733 }
734 }

References $DIC.

◆ edit()

ilObjFileGUI::edit ( )

edit object @access public

Reimplemented from ilObject2GUI.

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

342 {
343 global $DIC;
344 $ilTabs = $DIC['ilTabs'];
345 $ilErr = $DIC['ilErr'];
346
347 if (!$this->checkPermissionBool("write")) {
348 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
349 }
350
351 $ilTabs->activateTab("settings");
352
353 $form = $this->initPropertiesForm(self::CMD_EDIT);
354
355 $val = array();
356 $val['title'] = $this->object->getTitle();
357 $val['description'] = $this->object->getLongDescription();
358 $val['rating'] = $this->object->hasRating();
359 $form->setValuesByArray($val);
360
361 // Edit ecs export settings
362 include_once 'Modules/File/classes/class.ilECSFileSettings.php';
363 $ecs = new ilECSFileSettings($this->object);
364 $ecs->addSettingsToForm($form, 'file');
365
366 $this->tpl->setContent($form->getHTML());
367
368 return true;
369 }
Class ilECSFileSettings.
initPropertiesForm($mode="create")
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.

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

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

References $_GET, $DIC, ilObjectGUI\$ilErr, $ilUser, $ret, ilObjectGUI\addHeaderAction(), ilObject2GUI\checkPermissionBool(), ilObject2GUI\getAccessHandler(), ilObject2GUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreenForward(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, and ilObject2GUI\prepareOutput().

+ Here is the call graph for this function:

◆ getType()

ilObjFileGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

46 {
47 return "file";
48 }

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

484 {
485 $this->ctrl->setCmd("showSummary");
486 $this->ctrl->setCmdClass("ilinfoscreengui");
487 $this->infoScreenForward();
488 }

References infoScreenForward().

Referenced by render().

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

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

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

494 {
495 global $DIC;
496 $ilTabs = $DIC['ilTabs'];
497 $ilErr = $DIC['ilErr'];
498 $ilToolbar = $DIC['ilToolbar'];
499
500 $ilTabs->activateTab("id_info");
501
502 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
503 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
504 }
505
506 $info = new ilInfoScreenGUI($this);
507
508 if ($this->checkPermissionBool("read", "sendfile")) {
509 $button = ilLinkButton::getInstance();
510 $button->setCaption("file_download");
511 $button->setPrimary(true);
512
513 // get permanent download link for repository
514 if ($this->id_type === self::REPOSITORY_NODE_ID) {
515 $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
516 } else {
517 $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
518 }
519
520 $ilToolbar->addButtonInstance($button);
521 }
522
523 $info->enablePrivateNotes();
524
525 if ($this->checkPermissionBool("read")) {
526 $info->enableNews();
527 }
528
529 // no news editing for files, just notifications
530 $info->enableNewsEditing(false);
531 if ($this->checkPermissionBool("write")) {
532 $news_set = new ilSetting("news");
533 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
534
535 if ($enable_internal_rss) {
536 $info->setBlockProperty("news", "settings", true);
537 $info->setBlockProperty("news", "public_notifications_option", true);
538 }
539 }
540
541 // standard meta data
542 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
543
544 // File Info
545 $info->addSection($this->lng->txt("file_info"));
546 $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
547 $info->addProperty($this->lng->txt("type"), $this->object->getFileType());
548 $info->addProperty($this->lng->txt("resource_id"), $this->object->getResourceId());
549 $info->addProperty($this->lng->txt("storage_id"), $this->object->getStorageID());
550
551 $info->addProperty($this->lng->txt("size"),
552 ilUtil::formatSize(ilObjFileAccess::_lookupFileSize($this->object->getId()), 'long'));
553 $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
554
555 $version = $this->object->getVersions([$this->object->getVersion()]);
556 $version = end($version);
557 if($version instanceof ilObjFileVersion) {
558 $info->addProperty($this->lng->txt("version_uploaded"), (new ilDateTime($version->getDate(), IL_CAL_DATETIME))->get(IL_CAL_DATETIME));
559 }
560
561
562 if ($this->object->getPageCount() > 0) {
563 $info->addProperty($this->lng->txt("page_count"), $this->object->getPageCount());
564 }
565
566 // using getVersions function instead of ilHistory direct
567 $uploader = $this->object->getVersions();
568 $uploader = array_shift($uploader);
569 $uploader = $uploader["user_id"];
570
571 include_once "Services/User/classes/class.ilUserUtil.php";
572 $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
573
574 // download link added in repository
575 if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
576 $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
577 $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
578 $info->addProperty($this->lng->txt("download_link"), $tpl->get());
579 }
580
581 if ($this->id_type == self::WORKSPACE_NODE_ID) {
582 $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
583 }
584
585 // display previews
586 include_once("./Services/Preview/classes/class.ilPreview.php");
587 if (!$this->ctrl->isAsynch()
588 && ilPreview::hasPreview($this->object->getId(), $this->object->getType())
589 && $this->checkPermissionBool("read")
590 ) {
591 include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
592
593 // get context for access checks later on
594 switch ($this->id_type) {
598 break;
599
600 default:
602 break;
603 }
604
605 $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
606 $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
607 }
608
609 // forward the command
610 // $this->ctrl->setCmd("showSummary");
611 // $this->ctrl->setCmdClass("ilinfoscreengui");
612 $this->ctrl->forwardCommand($info);
613 }
const IL_CAL_DATETIME
@classDescription Date and time handling
Class ilInfoScreenGUI.
static getInstance()
Factory.
static _lookupFileSize($a_id)
static _getPermanentDownloadLink($ref_id)
Gets the permanent download link for the file.
Class ilObjFileVersion.
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.
$preview
Definition: imgupload.php:55
$context
Definition: webdav.php:26

References $context, $DIC, ilObjectGUI\$ilErr, $preview, ilObjectGUI\$tpl, ilObjFileAccess\_getPermanentDownloadLink(), ilObjFileAccess\_lookupFileSize(), ilObject2GUI\checkPermissionBool(), ilPreviewGUI\CONTEXT_REPOSITORY, ilPreviewGUI\CONTEXT_WORKSPACE, ilUtil\formatSize(), ilLinkButton\getInstance(), ilUserUtil\getNamePresentation(), ilPreview\hasPreview(), IL_CAL_DATETIME, 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
Returns
array

Reimplemented from ilObject2GUI.

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

189 : array
190 {
191 $forms = [];
192 $forms[] = $this->initMultiUploadForm();
193
194 // repository only
195 if ((int) $this->id_type !== self::WORKSPACE_NODE_ID) {
196 $forms[self::CFORM_IMPORT] = $this->initImportForm('file');
197 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
198 }
199
200 return $forms;
201 }
initMultiUploadForm()
Initializes the upload form for multiple files.
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(), and initMultiUploadForm().

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

770 {
771 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
772 if ($lg instanceof ilObjectListGUI && $this->object->hasRating()) {
773 $lg->enableRating(
774 true,
775 null,
776 false,
777 [ilCommonActionDispatcherGUI::class, ilRatingGUI::class]
778 );
779 }
780
781 return $lg;
782 }
Class ilObjectListGUI.

◆ initMultiUploadForm()

ilObjFileGUI::initMultiUploadForm ( )

Initializes the upload form for multiple files.

Returns
object The created property form.

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

741 {
742 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
743 $dnd_form_gui = new ilPropertyFormGUI();
744 $dnd_form_gui->setMultipart(true);
745 $dnd_form_gui->setHideLabels();
746
747 // file input
748 include_once("Services/Form/classes/class.ilDragDropFileInputGUI.php");
749 $dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files");
750 $dnd_input->setArchiveSuffixes(["zip"]);
751 $dnd_input->setCommandButtonNames(self::CMD_UPLOAD_FILES, "cancel");
752 $dnd_form_gui->addItem($dnd_input);
753
754 // add commands
755 $dnd_form_gui->addCommandButton(self::CMD_UPLOAD_FILES, $this->lng->txt("upload_files"));
756 $dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
757
758 $dnd_form_gui->setTableWidth("100%");
759 $dnd_form_gui->setTarget($this->getTargetFrame("save"));
760 $dnd_form_gui->setTitle($this->lng->txt("upload_files_title"));
761 $dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'));
762
763 $this->ctrl->setParameter($this, "new_type", "file");
764 $dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, self::CMD_UPLOAD_FILES));
765
766 return $dnd_form_gui;
767 }
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().

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

376 {
377 $form = new ilPropertyFormGUI();
378 $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
379
380 $form->setTitle($this->lng->txt('file_edit'));
381 $form->addCommandButton('update', $this->lng->txt('save'));
382 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
383
384 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
385 $title->setValue($this->object->getTitle());
386 $title->setInfo($this->lng->txt("if_no_title_then_filename"));
387 $form->addItem($title);
388
389 if ($mode === 'create') {
390
391 $file = new ilFileStandardDropzoneInputGUI($this->lng->txt('obj_file'), 'file');
392 $file->setRequired(false);
393 $form->addItem($file);
394
395 $group = new ilRadioGroupInputGUI('', 'replace');
396 $group->setValue(0);
397
398 $replace = new ilRadioOption($this->lng->txt('replace_file'), 1);
399 $replace->setInfo($this->lng->txt('replace_file_info'));
400 $group->addOption($replace);
401
402 $keep = new ilRadioOption($this->lng->txt('file_new_version'), 0);
403 $keep->setInfo($this->lng->txt('file_new_version_info'));
404 $group->addOption($keep);
405
406 $file->addSubItem($group);
407
408 } else {
409 $o = new ilNonEditableValueGUI($this->lng->txt('upload_info'));
410 $o->setValue($this->lng->txt('upload_info_desc'));
411 $form->addItem($o);
412 }
413 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
414 $desc->setRows(3);
415 $form->addItem($desc);
416
417 if ($this->id_type == self::REPOSITORY_NODE_ID) {
418 $this->lng->loadLanguageModule('rating');
419 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
420 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
421 $form->addItem($rate);
422 }
423
424 $presentationHeader = new ilFormSectionHeaderGUI();
425 $presentationHeader->setTitle($this->lng->txt('settings_presentation_header'));
426 $form->addItem($presentationHeader);
427 $this->obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
428
429 return $form;
430 }
This class represents a checkbox property in a property form.
Class ilFileStandardDropzoneInputGUI.
This class represents a section header 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.

Referenced by edit(), and update().

+ Here is the caller graph for this function:

◆ render()

ilObjFileGUI::render ( )
protected

This Method is needed if called from personal resources.

See also
executeCommand() line 162

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

180 : void
181 {
182 $this->infoScreen();
183 }
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...

References infoScreen().

+ Here is the call graph for this function:

◆ sendFile()

ilObjFileGUI::sendFile ( )

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

433 {
434 global $DIC;
435
436 try {
437 if (ANONYMOUS_USER_ID == $DIC->user()->getId() && isset($_GET['transaction'])) {
438 $a_hist_entry_id = isset($_GET["hist_id"]) ? $_GET["hist_id"] : null;
439 $this->object->sendFile($a_hist_entry_id);
440 }
441
442 if ($this->checkPermissionBool("read")) {
443 // BEGIN ChangeEvent: Record read event.
444 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
445
446 // Record read event and catchup with write events
448 $this->object->getType(),
449 $this->object->getRefId(),
450 $this->object->getId(),
451 $DIC->user()->getId()
452 );
453 // END ChangeEvent: Record read event.
454
455 require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
456 ilLPStatusWrapper::_updateStatus($this->object->getId(), $DIC->user()->getId());
457
458 $a_hist_entry_id = isset($_GET["hist_id"]) ? $_GET["hist_id"] : null;
459 $this->object->sendFile($a_hist_entry_id);
460 } else {
461 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
462 }
463 } catch (\ILIAS\Filesystem\Exception\FileNotFoundException $e) {
464 $this->ilErr->raiseError($e->getMessage(), $this->ilErr->MESSAGE);
465 }
466
467 return true;
468 }
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.
const ANONYMOUS_USER_ID
Definition: constants.php:25
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...
Class ChatMainBarProvider \MainMenu\Provider.

References $_GET, $DIC, Vendor\Package\$e, ilChangeEvent\_recordReadEvent(), ilLPStatusWrapper\_updateStatus(), ANONYMOUS_USER_ID, 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 616 of file class.ilObjFileGUI.php.

617 {
618 global $DIC;
619 $ilTabs = $DIC['ilTabs'];
620 $lng = $DIC['lng'];
621 $ilHelp = $DIC['ilHelp'];
622
623 $ilHelp->setScreenIdComponent("file");
624
625 $this->ctrl->setParameter($this, "ref_id", $this->node_id);
626
627 if ($this->checkPermissionBool("write")) {
628 $ilTabs->addTab(
629 "id_versions",
630 $lng->txt(self::CMD_VERSIONS),
631 $this->ctrl->getLinkTargetByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_DEFAULT)
632 );
633 }
634
635 if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read")) {
636 $ilTabs->addTab(
637 "id_info",
638 $lng->txt("info_short"),
639 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary")
640 );
641 }
642
643 if ($this->checkPermissionBool("write")) {
644 $ilTabs->addTab(
645 "settings",
646 $lng->txt("settings"),
647 $this->ctrl->getLinkTarget($this, self::CMD_EDIT)
648 );
649 }
650
651 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
652 $ilTabs->addTab(
653 'learning_progress',
654 $lng->txt('learning_progress'),
655 $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'), '')
656 );
657 }
658
659 // meta data
660 if ($this->checkPermissionBool("write")) {
661 $mdgui = new ilObjectMetaDataGUI($this->object);
662 $mdtab = $mdgui->getTab();
663 if ($mdtab) {
664 $ilTabs->addTab(
665 "id_meta",
666 $lng->txt("meta_data"),
667 $mdtab
668 );
669 }
670 }
671
672 // export
673 if ($this->checkPermissionBool("write")) {
674 $ilTabs->addTab(
675 "export",
676 $lng->txt("export"),
677 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
678 );
679 }
680
681 // will add permission tab if needed
682 parent::setTabs();
683 }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress

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

291 {
292 global $DIC;
293 $ilTabs = $DIC['ilTabs'];
294
295 $form = $this->initPropertiesForm();
296 if (!$form->checkInput()) {
297 $ilTabs->activateTab("settings");
298 $form->setValuesByPost();
299 $this->tpl->setContent($form->getHTML());
300
301 return false;
302 }
303
304 $title = $form->getInput('title');
305 // bugfix mantis 26045:
306 $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
307 if (strlen(trim($title)) == 0) {
308 $title = $filename;
309 } else {
310 $title = $this->object->checkFileExtension($filename, $title);
311 }
312
313 $this->object->handleChangedObjectTitle($title);
314 $this->object->setDescription($form->getInput('description'));
315 $this->object->setRating($form->getInput('rating'));
316
317 $this->update = $this->object->update();
318 $this->obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
319
320 // BEGIN ChangeEvent: Record update event.
321 if (!empty($data["name"])) {
322 global $DIC;
323 $ilUser = $DIC['ilUser'];
324 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
325 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
326 }
327 // END ChangeEvent: Record update event.
328
329 // Update ecs export settings
330 $ecs = new ilECSFileSettings($this->object);
331 $ecs->handleSettingsUpdate();
332
333 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
334 ilUtil::redirect($this->ctrl->getLinkTarget($this, self::CMD_EDIT, '', false, false));
335 }
$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.
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
update()
updates object entry in object_data @access public
static redirect($a_script)

References ilObjectGUI\$data, $DIC, $filename, $ilUser, 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:

◆ versions()

ilObjFileGUI::versions ( )
Deprecated:

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

474 {
475 $this->ctrl->redirectByClass(ilFileVersionsGUI::class);
476 }

Field Documentation

◆ $lng

ilObjFileGUI::$lng

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

Referenced by _goto(), and setTabs().

◆ $log

ilObjFileGUI::$log = null
protected

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

◆ $obj_service

ilObjFileGUI::$obj_service
protected

Definition at line 27 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 18 of file class.ilObjFileGUI.php.

◆ CMD_UPLOAD_FILES

const ilObjFileGUI::CMD_UPLOAD_FILES = "uploadFiles"

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

◆ CMD_VERSIONS

const ilObjFileGUI::CMD_VERSIONS = "versions"

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


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