ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilObjFileGUI Class Reference

GUI class for file objects. More...

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

Public Member Functions

 __construct (int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
 Constructor. More...
 
 getType ()
 Functions that must be overwritten. More...
 
 getParentId ()
 
 initUploadForm ()
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 edit ()
 
 sendFile ()
 
 showSummary ()
 
 showSummaryForced ()
 
 versions ()
 
 unzipCurrentRevision ()
 
 infoScreenForward ()
 show information screen More...
 
 buildInfoScreen (bool $kiosk_mode)
 
- Public Member Functions inherited from ilObject2GUI
 __construct (int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
 
 executeCommand ()
 execute command More...
 
 getIdType ()
 
 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 (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 isVisible (int $ref_id, string $type)
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 CRUD. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- 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 $obj, ?int $callback_ref_id)
 After creation callback. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Data Fields

const UPLOAD_MAX_FILES = 100
 
const PARAM_FILES = 'files'
 
const PARAM_TITLE = 'title'
 
const PARAM_DESCRIPTION = 'description'
 
const PARAM_COPYRIGHT_ID = "copyright_id"
 
const PARAM_CREATION_MODE = 'creation_mode'
 
const PARAM_FILE_TYPE = 'file_type'
 
const CREATION_MODE_UPLOAD = 'upload'
 
const CREATION_MODE_EMPTY = 'empty'
 
const PARAM_UPLOAD_ORIGIN = 'origin'
 
const UPLOAD_ORIGIN_STANDARD = 'standard'
 
const UPLOAD_ORIGIN_DROPZONE = 'dropzone'
 
const CMD_EDIT = Capabilities::EDIT_SETTINGS->value
 
const CMD_VERSIONS = Capabilities::MANAGE_VERSIONS->value
 
const CMD_UPLOAD_FILES = "uploadFiles"
 
const CMD_SEND_FILE = Capabilities::DOWNLOAD->value
 
ilObject $object = null
 
ilLanguage $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 ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Protected Member Functions

 recordReadEvent ()
 
 updateLearningProgress ()
 
 addUIFormToAccordion (ilAccordionGUI $accordion, Standard $form, int $form_type)
 
 addLegacyFormToAccordion (ilAccordionGUI $accordion, ilPropertyFormGUI $form, int $form_type)
 
 initCreateForm (string $new_type)
 
 getCreatableSuffixes ()
 
 getCreatableFormatLabels ()
 
 hasEmptyContent ()
 
 uploadFiles ()
 MUST be protected, since this is Called from ilObject2GUI when used in Personal Workspace. More...
 
 createEmptyDocument (array $data, ?string $copyright_id)
 Creates a file object with an empty file of the chosen type and opens it in the WOPI client, which then fills it using its editnew action. More...
 
 initPropertiesForm ()
 
 editExternal ()
 
 viewExternal ()
 
 toggleLearningProgress ()
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 initSettingsTab ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initHeaderAction (?string $a_sub_type=null, ?int $a_sub_id=null)
 Add header action menu. More...
 
 getCtrl ()
 
 getFileObj ()
 
 getFileStakeholder ()
 
 getGeneralSettings ()
 
 getLanguage ()
 
 getNodeID ()
 
 getRefinery ()
 
 getUIFactory ()
 
 getUser ()
 
- 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 ()
 
 setLocator ()
 set Locator More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) This should probably be moved elsewhere as done with RepUtil. More...
 
 setTitleAndDescription ()
 
 omitLocator (bool $omit=true)
 
 getTargetFrame (string $cmd, string $target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 addAdminLocatorItems (bool $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 (string $cmd, string $location="")
 Deprecated functions. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 showActions ()
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $node_id=null)
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 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 More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

UIServices $ui
 
UploadHandler $upload_handler
 
ResourceStakeholder $stakeholder
 
Services $storage
 
ilLogger $log = null
 
ilObjectService $obj_service
 
ILIAS Refinery Factory $refinery
 
General $general_settings
 
FilesystemConfig $file_service_settings
 
IconDatabaseRepository $icon_repo
 
ILIAS UI Component Input Factory $inputs
 
Renderer $renderer
 
ServerRequestInterface $request
 
Factory $data_factory
 
LOMServices $lom_services
 
- Protected Attributes inherited from ilObject2GUI
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ilFavouritesManager $favourites
 
ilErrorHandling $error
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
Factory $refinery
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
int $request_ref_id
 
int $id_type
 
int $parent_id
 
string $type
 
string $html
 
int $object_id
 
int $node_id = null
 
array $creation_forms = []
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Attributes

CapabilityCollection $capabilities
 
ActionDBRepository $action_repo
 
bool $create_wopi_templates
 
CapabilityBuilder $capability_builder
 
int $created_node_id = null
 
int $created_object_id = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Reimplemented from ilObject2GUI.

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

113 {
114 global $DIC;
115 $this->refinery = $DIC->refinery();
116 $this->file_service_settings = $DIC->fileServiceSettings();
117 $this->user = $DIC->user();
118 $this->lng = $DIC->language();
120 $this->ui = $DIC->ui();
121 $this->storage = $DIC->resourceStorage();
122 $this->upload_handler = new ilObjFileUploadHandlerGUI();
123 $this->stakeholder = new ilObjFileStakeholder();
124 $this->general_settings = new General($DIC->database());
125 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
126 $this->obj_service = $DIC->object();
127 $this->lng->loadLanguageModule(ilObjFile::OBJECT_TYPE);
128 $this->icon_repo = new IconDatabaseRepository();
129 $this->inputs = $DIC->ui()->factory()->input();
130 $this->renderer = $DIC->ui()->renderer();
131 $this->request = $DIC->http()->request();
132 $this->data_factory = new Factory();
133 $this->action_repo = new ActionDBRepository($DIC->database());
134 $this->create_wopi_templates = $DIC->settings()->get('create_templates', '0') === '1';
135 $this->lom_services = $DIC->learningObjectMetadata();
136
137 $this->capability_builder = new CapabilityBuilder(
139 $this->access,
140 $this->ctrl,
141 $this->action_repo,
142 $DIC->http(),
143 $DIC['static_url.uri_builder']
144 );
145
146 $capability_context = new Context(
147 $this->object_id,
148 $this->ref_id,
149 ($a_id_type === self::WORKSPACE_NODE_ID) ? Context::CONTEXT_WORKSPACE : Context::CONTEXT_REPO
150 );
151
152 $this->capabilities = $this->capability_builder->get($capability_context);
153 }
renderer()
Builds data types.
Definition: Factory.php:36
static getLogger(string $a_component_id)
Get component logger.
Class ilObjFileStakeholder.
const OBJECT_TYPE
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), ILIAS\Repository\lng(), ilObjFile\OBJECT_TYPE, ILIAS\Repository\refinery(), renderer(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

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

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

1252 : void
1253 {
1254 global $DIC;
1255 $main_tpl = $DIC->ui()->mainTemplate();
1256 $ilErr = $DIC['ilErr'];
1257 $lng = $DIC['lng'];
1258 $ilAccess = $DIC['ilAccess'];
1259
1260 if ($a_additional && str_ends_with((string) $a_additional, "wsp")) {
1262 }
1263
1264 // added support for direct download goto links
1265 if ($a_additional && str_ends_with((string) $a_additional, "download")) {
1266 ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
1267 }
1268
1269 // static method, no workspace support yet
1270
1271 if ($ilAccess->checkAccess("visible", "", $a_target)
1272 || $ilAccess->checkAccess("read", "", $a_target)) {
1273 ilObjectGUI::_gotoRepositoryNode($a_target, Capabilities::INFO_PAGE->value);
1274 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1275 $main_tpl->setOnScreenMessage(
1276 'failure',
1277 sprintf(
1278 $lng->txt("msg_no_perm_read_item"),
1280 ),
1281 true
1282 );
1284 }
1285
1286 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1287 }
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _gotoSharedWorkspaceNode(int $wsp_id)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
const ROOT_FOLDER_ID
Definition: constants.php:32

References $DIC, $lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObjectGUI\_gotoSharedWorkspaceNode(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ROOT_FOLDER_ID.

+ Here is the call graph for this function:

◆ addLegacyFormToAccordion()

ilObjFileGUI::addLegacyFormToAccordion ( ilAccordionGUI  $accordion,
ilPropertyFormGUI  $form,
int  $form_type 
)
protected

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

431 : void {
432 // abort if form-type is unknown
433 if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
434 return;
435 }
436 $title = $form->getTitle();
437 $form->setTitle(''); // see https://mantis.ilias.de/view.php?id=37786
438
439 $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "components/ILIAS/ILIASObject");
440 $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $title);
441
442 $accordion->addItem($tpl->get(), $form->getHTML());
443 }
addItem(string $a_header, string $a_content, bool $a_force_open=false)
ilGlobalTemplateInterface $tpl
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

◆ addLocatorItems()

ilObjFileGUI::addLocatorItems ( )
protected

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

1292 : void
1293 {
1294 global $DIC;
1295 $ilLocator = $DIC['ilLocator'];
1296
1297 if (is_object($this->object)) {
1298 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
1299 }
1300 }

References $DIC, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ addUIFormToAccordion()

ilObjFileGUI::addUIFormToAccordion ( ilAccordionGUI  $accordion,
Standard  $form,
int  $form_type 
)
protected

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

410 : void {
411 // abort if form-type is unknown
412 if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
413 return;
414 }
415
416 $inputs = $form->getInputs();
417 // use label of first input as title, because UI Component forms don't support form-titles yet
418 $title = ($inputs === []) ?
419 '' : $inputs[array_key_first($inputs)]->getLabel();
420
421 $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "components/ILIAS/ILIASObject");
422 $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $title);
423
424 $accordion->addItem($tpl->get(), $this->ui->renderer()->render($form));
425 }
ILIAS UI Component Input Factory $inputs
getInputs()
Get the inputs contained in the container.

◆ buildInfoScreen()

ilObjFileGUI::buildInfoScreen ( bool  $kiosk_mode)

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

1020 {
1021 $info = new ilInfoScreenGUI($this);
1022
1023 if (!$kiosk_mode) { // in kiosk mode we don't want to show the following sections
1024 $info->enablePrivateNotes();
1025
1026 if ($this->capabilities->get(Capabilities::DOWNLOAD)->isUnlocked()) {
1027 $info->enableNews();
1028 }
1029
1030 // no news editing for files, just notifications
1031 $info->enableNewsEditing(false);
1032 if ($this->capabilities->get(Capabilities::MANAGE_VERSIONS)->isUnlocked()) {
1033 $news_set = new ilSetting("news");
1034 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1035
1036 if ($enable_internal_rss) {
1037 $info->setBlockProperty("news", "settings", true);
1038 $info->setBlockProperty("news", "public_notifications_option", true);
1039 }
1040 }
1041
1042 $obj_id = $this->object->getId();
1043 $record_gui = new ilAdvancedMDRecordGUI(
1045 'file',
1046 $obj_id,
1047 '',
1048 0,
1049 $this->call_by_reference
1050 );
1051 $record_gui->setInfoObject($info);
1052 $record_gui->parse();
1053 }
1054 // show rating is not possible in kiosk mode
1055
1056 // Important Information
1057 $important_info = $this->object->getImportantInfo();
1058 if (!empty($important_info)) {
1059 $group = new Group(new Factory(), $this->lng);
1060 $markdown_to_html = $group->markdown()->toHTML();
1061
1062 $info->addSection($this->lng->txt("important_info"));
1063 $info->addProperty("", $markdown_to_html->transform($important_info));
1064 }
1065
1066 // Download Launcher
1067 if ($this->capabilities->get(Capabilities::DOWNLOAD)->isUnlocked()) {
1068 // get permanent download link for repository
1069 if ($this->id_type === self::REPOSITORY_NODE_ID) {
1070 $download_target = ilObjFileAccess::_getPermanentDownloadLink($this->node_id);
1071 } else {
1072 $download_target = rtrim(ILIAS_HTTP_PATH, '/') . '/' . $this->ctrl->getLinkTarget(
1073 $this,
1074 self::CMD_SEND_FILE
1075 );
1076 }
1077 $url = $this->data_factory->uri($download_target);
1078 $link = $this->data_factory->link($this->lng->txt('file_download'), $url);
1079 $download_launcher = $this->ui->factory()->launcher()->inline($link);
1080 // create own section for download launcher if there is no important info section
1081 if (empty($important_info)) {
1082 $info->addSection("");
1083 }
1084 // add download launcher
1085 $info->addProperty("", $this->renderer->render($download_launcher));
1086 }
1087
1088 // standard meta data
1089 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1090
1091 // in kiosk mode we don't want to show the following sections
1092 // links to resource
1093 if (!$kiosk_mode && ($this->access->checkAccess("write", "", $this->ref_id) ||
1094 $this->access->checkAccess("edit_permissions", "", $this->ref_id))) {
1095 $rs = ilObject::_getAllReferences($this->obj_id);
1096 $refs = [];
1097 foreach ($rs as $r) {
1098 if ($this->tree->isInTree($r)) {
1099 $refs[] = $r;
1100 }
1101 }
1102 if (count($refs) > 1) {
1103 $links = $sep = "";
1104 foreach ($refs as $r) {
1105 $cont_loc = new ilLocatorGUI();
1106 $cont_loc->addContextItems($r, true);
1107 $links .= $sep . $cont_loc->getHTML();
1108 $sep = "<br />";
1109 }
1110
1111 $info->addProperty(
1112 $this->lng->txt("res_links"),
1113 '<div class="small">' . $links . '</div>'
1114 );
1115 }
1116 }
1117
1118 // File Info
1119 $info->addSection($this->lng->txt("file_info"));
1120 if ($kiosk_mode) {
1121 $file_info_for_users = $this->getFileInfoForUsers();
1122 foreach ($file_info_for_users as $file_info_entry_key => $file_info_entry_value) {
1123 if ($file_info_entry_value !== null) {
1124 $info->addProperty($file_info_entry_key, $file_info_entry_value);
1125 }
1126 }
1127 } else {
1128 $file_info = $this->getAllFileInfoForCurrentUser();
1129 foreach ($file_info as $file_info_block) {
1130 foreach ($file_info_block as $file_info_entry_key => $file_info_entry_value) {
1131 if ($file_info_entry_value !== null) {
1132 $info->addProperty($file_info_entry_key, $file_info_entry_value);
1133 }
1134 }
1135 }
1136 }
1137
1138 // only the kiosk mode is meant to be that lean: outside of it the sections added
1139 // while rendering, e.g. the read statistics of ilInfoScreenGUI::addObjectSections(),
1140 // would be hidden without any way to unfold them,
1141 // see https://mantis.ilias.de/view.php?id=45051
1142 if ($kiosk_mode) {
1143 $info->hideFurtherSections(false);
1144 }
1145
1146 return $info;
1147 }
Class ilInfoScreenGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getPermanentDownloadLink(int $ref_id)
Gets the permanent download link for the file.
static _getAllReferences(int $id)
get all reference ids for object ID
ILIAS Setting Class.
$info
Definition: entry_point.php:21

References $info, ilObject\_getAllReferences(), ilObjFileAccess\_getPermanentDownloadLink(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\ILIASObject\Creation\Group, ILIAS\Repository\lng(), ilAdvancedMDRecordGUI\MODE_INFO, ILIAS\Repository\object(), renderer(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ createEmptyDocument()

ilObjFileGUI::createEmptyDocument ( array  $data,
?string  $copyright_id 
)
protected

Creates a file object with an empty file of the chosen type and opens it in the WOPI client, which then fills it using its editnew action.

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

661 : void
662 {
663 $suffix = (string) $data[self::PARAM_FILE_TYPE];
664 if (!in_array($suffix, $this->getCreatableSuffixes(), true)) {
665 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
666 }
667 $title = trim((string) $data[self::PARAM_TITLE]);
668
669 $rid = $this->storage->manage()->stream(
670 Streams::ofString(''),
671 $this->stakeholder,
672 $title . '.' . $suffix
673 );
674
675 $processor = new ilObjFileProcessor(
676 $this->stakeholder,
677 $this,
678 $this->storage,
679 $this->file_service_settings
680 );
681 $processor->process($rid, $title, $data[self::PARAM_DESCRIPTION] ?? null, $copyright_id);
682
683 // the creation parameters must not end up in the link to the editor
684 $this->ctrl->clearParameterByClass(self::class, 'new_type');
685 $this->ctrl->clearParameterByClass(self::class, self::PARAM_UPLOAD_ORIGIN);
686 $edit = $this->capability_builder->get(
687 new Context(
688 (int) $this->created_object_id,
689 (int) $this->created_node_id,
690 ($this->id_type === self::WORKSPACE_NODE_ID) ? Context::CONTEXT_WORKSPACE : Context::CONTEXT_REPO
691 )
692 )->get(Capabilities::EDIT_EXTERNAL);
693
694 if ($edit !== false && $edit->isUnlocked() && $edit->getUri() !== null) {
695 $this->ctrl->redirectToURL((string) $edit->getUri());
696 }
697
698 $this->ctrl->redirectToURL(
699 match ($this->id_type) {
700 self::WORKSPACE_NODE_ID => $this->ctrl->getLinkTargetByClass(ilObjWorkspaceRootFolderGUI::class),
701 default => ilLink::_getLink($this->requested_ref_id),
702 }
703 );
704 }
Class ilObjFileProcessorInterface.

References $data, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ edit()

ilObjFileGUI::edit ( )

Reimplemented from ilObject2GUI.

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

777 : void
778 {
779 global $DIC;
780 $ilErr = $DIC['ilErr'];
781
782 if (!$this->capabilities->get(Capabilities::EDIT_SETTINGS)->isUnlocked()) {
783 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
784 }
785
786 $this->initSettingsTab();
787
788 $form = $this->initPropertiesForm();
789
790 // $ecs = new ilECSFileSettings($this->object);
791 // $ecs->addSettingsToForm($form, ilObjFile::OBJECT_TYPE); TODO: reintroduce usage of ECS file settings once they have been made compatible with the new ui components
792
793 $this->tpl->setContent($this->renderer->render($form));
794 }

References $DIC, ILIAS\Repository\lng(), and renderer().

+ Here is the call graph for this function:

◆ editExternal()

ilObjFileGUI::editExternal ( )
protected

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

940 : void
941 {
942 $this->ctrl->redirectToURL(
943 (string) $this->capabilities->get(Capabilities::EDIT_EXTERNAL)->getUri()
944 );
945 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getCreatableFormatLabels()

ilObjFileGUI::getCreatableFormatLabels ( )
protected
Returns
array<string, string> suffix => label such as "Excel (.xlsx)", sorted by the app

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

541 : array
542 {
543 $labels = [];
544 foreach ($this->action_repo->getCreatableFormats($this->create_wopi_templates) as $suffix => $app) {
545 $labels[$suffix] = $app === '' ? '.' . $suffix : sprintf('%s (.%s)', $app, $suffix);
546 }
547
548 return $labels;
549 }

◆ getCreatableSuffixes()

ilObjFileGUI::getCreatableSuffixes ( )
protected
Returns
string[] suffixes the WOPI client can create a new, empty document for

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

533 : array
534 {
535 return $this->action_repo->getCreatableSuffixes($this->create_wopi_templates);
536 }

◆ getCtrl()

ilObjFileGUI::getCtrl ( )
protected

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

1318 : \ilCtrl
1319 {
1320 return $this->ctrl;
1321 }
Class ilCtrl provides processing control methods.

◆ getFileObj()

ilObjFileGUI::getFileObj ( )
protected
Exceptions
ilFileException

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

1326 : ilObjFile
1327 {
1328 if (!$this->object instanceof ilObjFile) {
1329 throw new ilFileException("Error: object is not of type ilObjFile or doesn't exist");
1330 }
1331
1332 return $this->object;
1333 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjFile.

◆ getFileStakeholder()

ilObjFileGUI::getFileStakeholder ( )
protected

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

1336 {
1337 return $this->stakeholder;
1338 }
ResourceStakeholder $stakeholder

◆ getGeneralSettings()

ilObjFileGUI::getGeneralSettings ( )
protected

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

1340 : General
1341 {
1343 }
General $general_settings

◆ getLanguage()

ilObjFileGUI::getLanguage ( )
protected

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

1345 : \ilLanguage
1346 {
1347 return $this->lng;
1348 }
language handling

References $lng.

◆ getNodeID()

ilObjFileGUI::getNodeID ( )
protected

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

1350 : int
1351 {
1352 return $this->node_id;
1353 }

◆ getParentId()

ilObjFileGUI::getParentId ( )

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

185 : int
186 {
187 return $this->parent_id;
188 }

References ilObject2GUI\$parent_id.

◆ getRefinery()

ilObjFileGUI::getRefinery ( )
protected

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

1356 {
1357 return $this->refinery;
1358 }
ILIAS Refinery Factory $refinery

References ILIAS\UI\examples\Layout\Page\Mail\$refinery.

◆ getType()

ilObjFileGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

180 : string
181 {
183 }

References ilObjFile\OBJECT_TYPE.

◆ getUIFactory()

ilObjFileGUI::getUIFactory ( )
protected

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

1361 {
1362 return $this->ui->factory();
1363 }
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31

References ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getUser()

ilObjFileGUI::getUser ( )
protected

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

1365 : ilObjUser
1366 {
1367 return $this->user;
1368 }
User class.

◆ hasEmptyContent()

ilObjFileGUI::hasEmptyContent ( )
protected

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

551 : bool
552 {
553 $rid = $this->storage->manage()->find($this->object->getResourceId());
554 if ($rid === null) {
555 return false;
556 }
557
558 return $this->storage->manage()
559 ->getResource($rid)
560 ->getCurrentRevisionIncludingDraft()
561 ->getInformation()
562 ->getSize() === 0;
563 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

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

956 : void
957 {
958 $this->tabs_gui->activateTab("id_info");
959
960 if (!$this->capabilities->get(Capabilities::INFO_PAGE)->isUnlocked()) {
961 $GLOBALS['DIC']['ilErr']->raiseError(
962 $this->lng->txt("msg_no_perm_read"),
963 2
964 ); // TODO remove magic number and old ilErr call
965 }
966
967 // add set completed button, if LP mode is active
968 if ($this->object->getLPMode() === ilLPObjSettings::LP_MODE_MANUAL) {
969 if (ilLPStatus::_hasUserCompleted($this->object->getId(), $this->user->getId())) {
970 $label = $this->lng->txt('file_btn_lp_toggle_state_completed');
971 } else {
972 $label = $this->lng->txt('file_btn_lp_toggle_state_not_completed');
973 }
974 $this->toolbar->addComponent(
975 $this->ui->factory()->button()->standard(
976 $label,
977 $this->ctrl->getLinkTarget($this, 'toggleLearningProgress')
978 )
979 );
980 }
981
982 // Add WOPI editor Button
983 if ($this->capabilities->get(Capabilities::EDIT_EXTERNAL)->isUnlocked()) {
984 $external_editor = $this->ui->factory()
985 ->button()
986 ->standard(
987 $this->lng->txt('open_external_editor'),
988 $this->ctrl->getLinkTargetByClass(
989 \ilWOPIEmbeddedApplicationGUI::class,
991 )
992 );
993 $this->toolbar->addComponent($external_editor);
994 }
995
996 $info = $this->buildInfoScreen(false);
997 $this->ctrl->forwardCommand($info);
998 }
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
buildInfoScreen(bool $kiosk_mode)
$GLOBALS["DIC"]
Definition: wac.php:66

References $GLOBALS, $info, ilLPStatus\_hasUserCompleted(), ilWOPIEmbeddedApplicationGUI\CMD_EDIT, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_MANUAL, ILIAS\Repository\object(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ initCreateForm()

ilObjFileGUI::initCreateForm ( string  $new_type)
protected
Returns
array

Reimplemented from ilObjectGUI.

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

449 : Standard
450 {
451 return $this->initUploadForm();
452 }
This describes a standard form.
Definition: Standard.php:30

◆ initHeaderAction()

ilObjFileGUI::initHeaderAction ( ?string  $sub_type = null,
?int  $sub_id = null 
)
protected

Add header action menu.

Reimplemented from ilObject2GUI.

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

1304 {
1305 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1306 if ($lg instanceof ilObjectListGUI && $this->object->hasRating()) {
1307 $lg->enableRating(
1308 true,
1309 null,
1310 false,
1311 [ilCommonActionDispatcherGUI::class, ilRatingGUI::class]
1312 );
1313 }
1314
1315 return $lg;
1316 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ initPropertiesForm()

ilObjFileGUI::initPropertiesForm ( )
protected

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

796 : Standard
797 {
798 $title_and_description = $this->object->getObjectProperties()->getPropertyTitleAndDescription()->toForm(
799 $this->lng,
800 $this->ui->factory()->input()->field(),
801 $this->refinery
802 );
803
804 $important_info = $this->inputs->field()->markdown(
806 $this->lng->txt('important_info'),
807 $this->lng->txt('important_info_byline')
808 )->withValue(
809 $this->object->getImportantInfo() ?? ""
810 );
811
812 $on_click_action = $this->inputs->field()->radio(
813 $this->lng->txt('on_click_action')
814 )->withOption(
816 $this->lng->txt('file_action_download'),
817 $this->lng->txt('file_action_download_info'),
818 )->withOption(
820 $this->lng->txt('file_action_show'),
821 $this->lng->txt('file_action_show_info'),
822 )->withValue(
823 (string) $this->object->getOnClickMode()
824 );
825
826 $input_groups = array_filter([
827 "title_and_description" => $title_and_description,
828 "important_info" => $important_info,
829 "on_click_action" => $on_click_action
830 ], static fn(FormInput $input): bool => null !== $input);
831
832 $file_info_section = $this->inputs->field()->section(
833 $input_groups,
834 $this->lng->txt('file_info')
835 );
836
837 $online_status = $this->object->getObjectProperties()->getPropertyIsOnline()->toForm(
838 $this->lng,
839 $this->ui->factory()->input()->field(),
840 $this->refinery
841 );
842 $availability_section = $this->inputs->field()->section(
843 ["online_status" => $online_status],
844 $this->lng->txt('rep_activation_availability')
845 );
846
847 $presentation_section = null;
848 if ($this->id_type === self::REPOSITORY_NODE_ID) {
849 $tile_image = $this->object->getObjectProperties()->getPropertyTileImage()->toForm(
850 $this->lng,
851 $this->ui->factory()->input()->field(),
852 $this->refinery
853 );
854 $presentation_section = $this->inputs->field()->section(
855 ["tile_image" => $tile_image],
856 $this->lng->txt('settings_presentation_header')
857 );
858 }
859
860 $additional_features_section = null;
861 if ($this->id_type === self::REPOSITORY_NODE_ID) {
862 $this->lng->loadLanguageModule('rating');
863
864 $enable_rating = $this->inputs->field()->checkbox(
865 $this->lng->txt('rating_activate_rating'),
866 $this->lng->txt('rating_activate_rating_info')
867 )->withValue(
868 $this->object->hasRating()
869 );
870 $additional_features_section = $this->inputs->field()->section(
871 ["rating" => $enable_rating],
872 $this->lng->txt('obj_features')
873 );
874 }
875
876 $inputs = array_filter([
877 "file_info" => $file_info_section,
878 "availability" => $availability_section,
879 "presentation" => $presentation_section,
880 "obj_features" => $additional_features_section
881 ], static fn(?Section $input): bool => null !== $input);
882
883 return $this->inputs->container()->form()->standard(
884 $this->ctrl->getLinkTargetByClass(self::class, 'update'),
885 $inputs
886 );
887 }
const CLICK_MODE_DOWNLOAD
const CLICK_MODE_INFOPAGE
This describes inputs that can be used in forms.
Definition: FormInput.php:33
This describes section inputs.
Definition: Section.php:29

References ILIAS\UI\Implementation\Component\Input\$inputs, ilObjFile\CLICK_MODE_DOWNLOAD, ilObjFile\CLICK_MODE_INFOPAGE, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ initSettingsTab()

ilObjFileGUI::initSettingsTab ( )
protected

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

1232 : void
1233 {
1234 $this->tabs_gui->activateTab("settings");
1235 // add subtab for common settings
1236 $this->tabs_gui->addSubTab(
1237 'file_settings',
1238 $this->lng->txt('settings'),
1239 $this->ctrl->getLinkTargetByClass(self::class, self::CMD_EDIT)
1240 );
1241 if (in_array('file', ilAdvancedMDRecord::_getActivatedObjTypes(), true)) {
1242 $this->tabs_gui->addSubTab(
1243 'service_settings',
1244 $this->lng->txt('service_settings'),
1245 $this->ctrl->getLinkTargetByClass(ilFileCommonSettingsGUI::class, ilFileCommonSettingsGUI::CMD_EDIT)
1246 );
1247 }
1248
1249 $this->tabs_gui->activateSubTab("file_settings");
1250 }
static _getActivatedObjTypes()
get activated obj types

References ilAdvancedMDRecord\_getActivatedObjTypes(), ilFileCommonSettingsGUI\CMD_EDIT, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initUploadForm()

ilObjFileGUI::initUploadForm ( )

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

454 : Standard
455 {
456 $this->getLanguage()->loadLanguageModule('file');
457 $inputs = [];
458
459 $this->ctrl->setParameterByClass(self::class, 'new_type', $this->getType());
460 $this->ctrl->setParameterByClass(
461 self::class,
462 self::PARAM_UPLOAD_ORIGIN,
463 self::UPLOAD_ORIGIN_STANDARD
464 );
465
466
467 $file_input = $this->ui->factory()->input()->field()->file(
468 $this->upload_handler,
469 $this->lng->txt('upload_files'),
470 null,
471 $this->ui->factory()->input()->field()->group([
472 self::PARAM_TITLE => $this->ui->factory()->input()->field()->text(
473 $this->lng->txt('title')
474 )->withAdditionalTransformation(
475 $this->getEmptyStringToNullTransformation()
476 ),
477 self::PARAM_DESCRIPTION => $this->ui->factory()->input()->field()->textarea(
478 $this->lng->txt('description')
479 )->withAdditionalTransformation(
480 $this->getEmptyStringToNullTransformation()
481 ),
482 ])
483 )->withMaxFiles(
484 self::UPLOAD_MAX_FILES
485 )->withRequired(true);
486
487 $creatable_formats = $this->getCreatableFormatLabels();
488 if ($creatable_formats === []) {
489 $inputs[self::PARAM_FILES] = $file_input;
490 } else {
491 $field = $this->ui->factory()->input()->field();
492 $inputs[self::PARAM_CREATION_MODE] = $field->switchableGroup(
493 [
494 self::CREATION_MODE_UPLOAD => $field->group(
495 [self::PARAM_FILES => $file_input],
496 $this->lng->txt('upload_files')
497 ),
498 self::CREATION_MODE_EMPTY => $field->group(
499 [
500 self::PARAM_FILE_TYPE => $field->select(
501 $this->lng->txt('file_type'),
502 $creatable_formats
503 )->withRequired(true),
504 self::PARAM_TITLE => $field->text(
505 $this->lng->txt('title')
506 )->withRequired(true),
507 self::PARAM_DESCRIPTION => $field->textarea(
508 $this->lng->txt('description')
509 )->withAdditionalTransformation(
510 $this->getEmptyStringToNullTransformation()
511 ),
512 ],
513 $this->lng->txt('file_create_empty_document')
514 ),
515 ],
516 $this->lng->txt('file_creation_mode')
517 )->withValue(self::CREATION_MODE_UPLOAD);
518 }
519
520 if ($this->lom_services->copyrightHelper()->isCopyrightSelectionActive()) {
521 $inputs[self::PARAM_COPYRIGHT_ID] = $this->getCopyrightSelectionInput('set_license_for_all_files');
522 }
523
524 return $this->ui->factory()->input()->container()->form()->standard(
525 $this->ctrl->getFormActionByClass(self::class, self::CMD_UPLOAD_FILES),
526 $inputs
527 )->withSubmitLabel($this->lng->txt('create'));
528 }
getType()
Functions that must be overwritten.

References ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS\Repository\ctrl(), getLanguage(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ putObjectInTree()

ilObjFileGUI::putObjectInTree ( ilObject  $obj,
?int  $parent_node_id = null 
)

Add object to tree at given position.

Reimplemented from ilObject2GUI.

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

707 : void
708 {
709 // this is needed to support multi fileuploads in personal and shared resources
710 $backup_node_id = $this->node_id;
711 parent::putObjectInTree($obj, $parent_node_id);
712 $this->created_node_id = $this->node_id;
713 $this->created_object_id = $obj->getId();
714 $this->node_id = $backup_node_id;
715 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ recordReadEvent()

ilObjFileGUI::recordReadEvent ( )
protected

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

155 : void
156 {
157 // Record read event and catchup with write events
159 $this->object->getType(),
160 $this->object->getRefId(),
161 $this->object->getId(),
162 $this->user->getId()
163 );
164 $this->updateLearningProgress();
165 }
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, $a_ext_rc=null, $a_ext_time=null)

References ilChangeEvent\_recordReadEvent(), ILIAS\Repository\object(), and updateLearningProgress().

+ Here is the call graph for this function:

◆ sendFile()

ilObjFileGUI::sendFile ( )

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

889 : bool
890 {
891 $hist_entry_id = $this->request_wrapper->has('hist_id')
892 ? $this->request_wrapper->retrieve('hist_id', $this->refinery->kindlyTo()->int())
893 : null;
894 try {
895 if ($this->capabilities->get(Capabilities::DOWNLOAD)->isUnlocked()) {
896 // Record read event and catchup with write events
897 $this->recordReadEvent();
898
899 $this->object->sendFile($hist_entry_id);
900 } else {
901 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
902 }
903 } catch (FileNotFoundException $e) {
904 $this->error->raiseError($e->getMessage(), $this->error->MESSAGE);
905 }
906
907 return true;
908 }
Indicates that a file is missing or not found.

References Vendor\Package\$e, ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ setTabs()

ilObjFileGUI::setTabs ( )
protected

create tabs (repository/workspace switch)

this had to be moved here because of the context-specific permission tab

Reimplemented from ilObject2GUI.

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

1151 : void
1152 {
1153 global $DIC;
1154 $ilHelp = $DIC['ilHelp'];
1155 $ilHelp->setScreenIdComponent(ilObjFile::OBJECT_TYPE);
1156
1157 $this->ctrl->setParameter($this, "ref_id", $this->node_id);
1158
1159 if (($c = $this->capabilities->get(Capabilities::VIEW_EXTERNAL)) && $c->isUnlocked()) {
1160 $this->tabs_gui->addTab(
1161 "content",
1162 $this->lng->txt("content"),
1163 $c->getURI()
1164 );
1165 }
1166
1167 if (($c = $this->capabilities->get(Capabilities::MANAGE_VERSIONS)) && $c->isUnlocked()) {
1168 $this->tabs_gui->addTab(
1169 "id_versions",
1170 $this->lng->txt(self::CMD_VERSIONS),
1171 $this->ctrl->getLinkTargetByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_DEFAULT)
1172 );
1173 }
1174
1175 if (($c = $this->capabilities->get(Capabilities::INFO_PAGE)) && $c->isUnlocked()) {
1176 $this->tabs_gui->addTab(
1177 "id_info",
1178 $this->lng->txt("info_short"),
1179 $this->ctrl->getLinkTargetByClass(["ilobjfilegui", "ilinfoscreengui"], "showSummary")
1180 );
1181 }
1182
1183 if (($c = $this->capabilities->get(Capabilities::EDIT_SETTINGS)) && $c->isUnlocked()) {
1184 $this->tabs_gui->addTab(
1185 "settings",
1186 $this->lng->txt("settings"),
1187 $this->ctrl->getLinkTarget($this, self::CMD_EDIT)
1188 );
1189 }
1190
1191 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1192 $this->tabs_gui->addTab(
1193 'learning_progress',
1194 $this->lng->txt('learning_progress'),
1195 $this->ctrl->getLinkTargetByClass([self::class, 'illearningprogressgui'], '')
1196 );
1197 }
1198
1199 // meta data
1200 if (($c = $this->capabilities->get(Capabilities::EDIT_SETTINGS)) && $c->isUnlocked()) {
1201 $mdgui = new ilObjectMetaDataGUI($this->object, null, null, $this->call_by_reference);
1202 $mdtab = $mdgui->getTab();
1203 if ($mdtab) {
1204 $this->tabs_gui->addTab(
1205 "id_meta",
1206 $this->lng->txt("meta_data"),
1207 $mdtab
1208 );
1209 }
1210 }
1211
1212 // export
1213 if (($c = $this->capabilities->get(Capabilities::EDIT_SETTINGS)) && $c->isUnlocked()) {
1214 $this->tabs_gui->addTab(
1215 "export",
1216 $this->lng->txt("export"),
1217 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1218 );
1219 }
1220
1221 // Permissions-tabs, had to add it here, see https://mantis.ilias.de/view.php?id=47417
1222 if ($this->access->checkAccess('edit_permission', '', $this->ref_id)) {
1223 $this->tabs_gui->addTarget(
1224 "perm_settings",
1225 $this->ctrl->getLinkTargetByClass([self::class, ilPermissionGUI::class], "perm"),
1226 ["perm", "info", "owner"],
1227 ilPermissionGUI::class
1228 );
1229 }
1230 }
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
Class ilObjectMetaDataGUI.

References Vendor\Package\$c, $DIC, ILIAS\Repository\access(), ilLearningProgressAccess\checkAccess(), ilFileVersionsGUI\CMD_DEFAULT, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilObjFile\OBJECT_TYPE.

+ Here is the call graph for this function:

◆ showSummary()

ilObjFileGUI::showSummary ( )
Deprecated:
PROXY COMMAND

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

913 : void
914 {
915 $this->ctrl->redirectToURL(
916 (string) $this->capabilities->get(Capabilities::INFO_PAGE)->getUri()
917 );
918 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ showSummaryForced()

ilObjFileGUI::showSummaryForced ( )

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

919 : void
920 {
921 $this->ctrl->redirectToURL(
922 (string) $this->capabilities->get(Capabilities::FORCED_INFO_PAGE)->getUri()
923 );
924 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ toggleLearningProgress()

ilObjFileGUI::toggleLearningProgress ( )
protected

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

1000 : void
1001 {
1003 $this->user->getId(),
1004 $this->obj_id,
1005 $this->ref_id,
1006 'file'
1007 );
1008
1009 $lp_marks = new ilLPMarks($this->obj_id, $this->user->getId());
1010 $lp_marks->setCompleted(!ilLPStatus::_hasUserCompleted($this->object->getId(), $this->user->getId()));
1011 $lp_marks->update();
1012
1013 ilLPStatusWrapper::_updateStatus($this->obj_id, $this->user->getId());
1014
1015 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
1016 $this->ctrl->redirect($this, Capabilities::INFO_PAGE->value);
1017 }
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')

References ilLPStatus\_hasUserCompleted(), ilLearningProgress\_tracProgress(), ilLPStatusWrapper\_updateStatus(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ unzipCurrentRevision()

ilObjFileGUI::unzipCurrentRevision ( )

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

933 : void
934 {
935 $this->ctrl->redirectToURL(
936 (string) $this->capabilities->get(Capabilities::UNZIP)->getUri()
937 );
938 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ updateLearningProgress()

ilObjFileGUI::updateLearningProgress ( )
protected

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

167 : void
168 {
169 if ($this->object->getLPMode() === ilLPObjSettings::LP_MODE_CONTENT_VISITED) {
171 $this->object->getId(),
172 $this->user->getId(),
173 null,
174 false,
175 true
176 );
177 }
178 }
const int LP_MODE_CONTENT_VISITED

References ilLPStatusWrapper\_updateStatus(), ilLPObjSettings\LP_MODE_CONTENT_VISITED, and ILIAS\Repository\object().

Referenced by recordReadEvent().

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

◆ uploadFiles()

ilObjFileGUI::uploadFiles ( )
protected

MUST be protected, since this is Called from ilObject2GUI when used in Personal Workspace.

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

568 : void
569 {
570 if (!$this->checkPermissionBool("create", "", $this->getType())) {
571 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
572 }
573
574 $origin = ($this->request_wrapper->has(self::PARAM_UPLOAD_ORIGIN)) ?
575 $this->request_wrapper->retrieve(
576 self::PARAM_UPLOAD_ORIGIN,
577 $this->refinery->kindlyTo()->string()
578 ) : self::UPLOAD_ORIGIN_STANDARD;
579
580 if (self::UPLOAD_ORIGIN_DROPZONE === $origin) {
581 $dropzone = new ilObjFileUploadDropzone($this->parent_id);
582 $dropzone = $dropzone->getDropzone()->withRequest($this->request);
583 $data = $dropzone->getData();
584 } else {
585 $form = $this->initUploadForm()->withRequest($this->request);
586 $data = $form->getData();
587 }
588
590 if ($creation_mode === self::CREATION_MODE_EMPTY) {
591 $this->createEmptyDocument($creation_data, $data[self::PARAM_COPYRIGHT_ID] ?? null);
592 return;
593 }
594
595 $files = $creation_data[self::PARAM_FILES] ?? $data[0] ?? null;
596
597 if (empty($files)) {
598 $form = $this->initUploadForm()->withRequest($this->request);
599 $this->tpl->setContent($this->getCreationFormsHTML($form));
600 return;
601 }
602
603 $processor = new ilObjFileProcessor(
604 $this->stakeholder,
605 $this,
606 $this->storage,
607 $this->file_service_settings
608 );
609
610 $errors = false;
611 foreach ($files as $file_data) {
612 $rid = $this->storage->manage()->find($file_data[0]);
613 if (null !== $rid) {
614 try {
615 $processor->process(
616 $rid,
617 $file_data[1][self::PARAM_TITLE] ?? null,
618 $file_data[1][self::PARAM_DESCRIPTION] ?? null,
619 $data[self::PARAM_COPYRIGHT_ID] ?? null
620 );
621 } catch (Throwable $t) {
622 $errors = true;
623 if (null !== $this->log) {
624 $this->log->error($t->getMessage() . ": " . $t->getTraceAsString());
625 }
626 }
627 }
628 }
629
630 if ($errors) {
631 $this->ui->mainTemplate()->setOnScreenMessage(
632 'failure',
633 $this->lng->txt('could_not_create_file_objs'),
634 true
635 );
636 }
637
638 if ($processor->getInvalidFileNames() !== []) {
639 $this->ui->mainTemplate()->setOnScreenMessage(
640 'info',
641 sprintf(
642 $this->lng->txt('file_upload_info_file_with_critical_extension'),
643 implode(', ', $processor->getInvalidFileNames())
644 ),
645 true
646 );
647 }
648
649 $link = match ($this->id_type) {
650 self::WORKSPACE_NODE_ID => $this->ctrl->getLinkTargetByClass(ilObjWorkspaceRootFolderGUI::class),
651 default => ilLink::_getLink($this->requested_ref_id),
652 };
653
654 $this->ctrl->redirectToURL($link);
655 }
createEmptyDocument(array $data, ?string $copyright_id)
Creates a file object with an empty file of the chosen type and opens it in the WOPI client,...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
getCreationFormsHTML(StandardForm|ilPropertyFormGUI|array $form)

References $data, $files, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ versions()

ilObjFileGUI::versions ( )

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

926 : void
927 {
928 $this->ctrl->redirectToURL(
929 (string) $this->capabilities->get(Capabilities::MANAGE_VERSIONS)->getUri()
930 );
931 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ viewExternal()

ilObjFileGUI::viewExternal ( )
protected

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

946 : void
947 {
948 $this->ctrl->redirectToURL(
949 (string) $this->capabilities->get(Capabilities::VIEW_EXTERNAL)->getUri()
950 );
951 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

Field Documentation

◆ $action_repo

ActionDBRepository ilObjFileGUI::$action_repo
private

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

◆ $capabilities

CapabilityCollection ilObjFileGUI::$capabilities
private

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

◆ $capability_builder

CapabilityBuilder ilObjFileGUI::$capability_builder
private

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

◆ $create_wopi_templates

bool ilObjFileGUI::$create_wopi_templates
private

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

◆ $created_node_id

int ilObjFileGUI::$created_node_id = null
private

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

◆ $created_object_id

int ilObjFileGUI::$created_object_id = null
private

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

◆ $data_factory

Factory ilObjFileGUI::$data_factory
protected

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

◆ $file_service_settings

FilesystemConfig ilObjFileGUI::$file_service_settings
protected

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

◆ $general_settings

General ilObjFileGUI::$general_settings
protected

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

◆ $icon_repo

IconDatabaseRepository ilObjFileGUI::$icon_repo
protected

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

◆ $inputs

ILIAS UI Component Input Factory ilObjFileGUI::$inputs
protected

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

◆ $lng

ilLanguage ilObjFileGUI::$lng

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

◆ $log

ilLogger ilObjFileGUI::$log = null
protected

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

◆ $lom_services

LOMServices ilObjFileGUI::$lom_services
protected

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

◆ $obj_service

ilObjectService ilObjFileGUI::$obj_service
protected

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

◆ $object

ilObjFile null ilObjFileGUI::$object = null

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

◆ $refinery

ILIAS Refinery Factory ilObjFileGUI::$refinery
protected

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

◆ $renderer

Renderer ilObjFileGUI::$renderer
protected

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

◆ $request

ServerRequestInterface ilObjFileGUI::$request
protected

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

◆ $stakeholder

ResourceStakeholder ilObjFileGUI::$stakeholder
protected

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

◆ $storage

Services ilObjFileGUI::$storage
protected

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

◆ $ui

UIServices ilObjFileGUI::$ui
protected

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

◆ $upload_handler

UploadHandler ilObjFileGUI::$upload_handler
protected

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

◆ CMD_EDIT

const ilObjFileGUI::CMD_EDIT = Capabilities::EDIT_SETTINGS->value

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

◆ CMD_SEND_FILE

const ilObjFileGUI::CMD_SEND_FILE = Capabilities::DOWNLOAD->value

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

◆ CMD_UPLOAD_FILES

const ilObjFileGUI::CMD_UPLOAD_FILES = "uploadFiles"

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

◆ CMD_VERSIONS

const ilObjFileGUI::CMD_VERSIONS = Capabilities::MANAGE_VERSIONS->value

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

◆ CREATION_MODE_EMPTY

const ilObjFileGUI::CREATION_MODE_EMPTY = 'empty'

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

◆ CREATION_MODE_UPLOAD

const ilObjFileGUI::CREATION_MODE_UPLOAD = 'upload'

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

◆ PARAM_COPYRIGHT_ID

const ilObjFileGUI::PARAM_COPYRIGHT_ID = "copyright_id"

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

◆ PARAM_CREATION_MODE

const ilObjFileGUI::PARAM_CREATION_MODE = 'creation_mode'

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

◆ PARAM_DESCRIPTION

const ilObjFileGUI::PARAM_DESCRIPTION = 'description'

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

◆ PARAM_FILE_TYPE

const ilObjFileGUI::PARAM_FILE_TYPE = 'file_type'

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

◆ PARAM_FILES

const ilObjFileGUI::PARAM_FILES = 'files'

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

◆ PARAM_TITLE

const ilObjFileGUI::PARAM_TITLE = 'title'

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

◆ PARAM_UPLOAD_ORIGIN

const ilObjFileGUI::PARAM_UPLOAD_ORIGIN = 'origin'

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

◆ UPLOAD_MAX_FILES

const ilObjFileGUI::UPLOAD_MAX_FILES = 100

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

◆ UPLOAD_ORIGIN_DROPZONE

const ilObjFileGUI::UPLOAD_ORIGIN_DROPZONE = 'dropzone'

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

◆ UPLOAD_ORIGIN_STANDARD

const ilObjFileGUI::UPLOAD_ORIGIN_STANDARD = 'standard'

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


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