ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 getParentId ()
 
 initUploadForm ()
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 
 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)
 
 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 ()
 
 importFile ()
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 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)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 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_UPLOAD_ORIGIN = 'origin'
 
const UPLOAD_ORIGIN_STANDARD = 'standard'
 
const UPLOAD_ORIGIN_DROPZONE = 'dropzone'
 
const CMD_EDIT = 'edit'
 
const CMD_VERSIONS = 'versions'
 
const CMD_UPLOAD_FILES = "uploadFiles"
 
const CMD_SEND_FILE = 'sendFile'
 
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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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
 

Protected Member Functions

 addUIFormToAccordion (ilAccordionGUI $accordion, Standard $form, int $form_type)
 
 addLegacyFormToAccordion (ilAccordionGUI $accordion, ilPropertyFormGUI $form, int $form_type)
 
 getCreationFormsHTML (array $a_forms)
 
 initCreationForms ($a_new_type)
 
 uploadFiles ()
 MUST be protected, since this is Called from ilObject2GUI when used in Personal Workspace. More...
 
 initPropertiesForm ()
 
 editExternal ()
 
 viewExternal ()
 
 toggleLearningProgress ()
 
 setTabs ()
 
 initSettingsTab ()
 
 addLocatorItems ()
 
 initHeaderAction (?string $a_sub_type=null, ?int $a_sub_id=null)
 
 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="")
 
 setTargetFrame (string $cmd, string $target_frame)
 
 getCenterColumnHTML ()
 
 getRightColumnHTML ()
 
 checkPermission (string $perm, string $cmd="", string $type="", int $ref_id=null)
 
 showPossibleSubObjects ()
 
 redirectToRefId (int $ref_id, string $cmd="")
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation (string $cmd, string $location="")
 Deprecated functions. More...
 
 setReturnLocation (string $cmd, string $location)
 
 showActions ()
 
 getTabs ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initCreationForms (string $new_type)
 Init creation forms. 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...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 addAdoptContentLinkToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 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...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 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 ()
 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...
 

Protected Attributes

UIServices $ui
 
UploadHandler $upload_handler
 
ResourceStakeholder $stakeholder
 
Services $storage
 
ilLogger $log = null
 
ilObjectService $obj_service
 
ILIAS Refinery Factory $refinery
 
WrapperFactory $http
 
General $general_settings
 
ilFileServicesSettings $file_service_settings
 
IconDatabaseRepository $icon_repo
 
ILIAS UI Component Input Factory $inputs
 
Renderer $renderer
 
ServerRequestInterface $request
 
Factory $data_factory
 
- 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
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
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
 
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
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
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
 
UploadLimitResolver $upload_limit
 
ActionDBRepository $action_repo
 

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.

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

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilObjFile\OBJECT_TYPE, ILIAS\Repository\refinery(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

103  {
104  global $DIC;
105  $this->http = $DIC->http()->wrapper();
106  $this->request = $DIC->http()->request();
107  $this->refinery = $DIC->refinery();
108  $this->file_service_settings = $DIC->fileServiceSettings();
109  $this->user = $DIC->user();
110  $this->lng = $DIC->language();
112  $this->ui = $DIC->ui();
113  $this->storage = $DIC->resourceStorage();
114  $this->upload_handler = new ilObjFileUploadHandlerGUI();
115  $this->stakeholder = new ilObjFileStakeholder();
116  $this->general_settings = new General();
117  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
118  $this->obj_service = $DIC->object();
119  $this->lng->loadLanguageModule(ilObjFile::OBJECT_TYPE);
120  $this->icon_repo = new IconDatabaseRepository();
121  $this->upload_limit = $DIC['ui.upload_limit_resolver'];
122  $this->inputs = $DIC->ui()->factory()->input();
123  $this->renderer = $DIC->ui()->renderer();
124  $this->request = $DIC->http()->request();
125  $this->data_factory = new Factory();
126  $this->action_repo = new ActionDBRepository($DIC->database());
127 
128  $capability_builder = new CapabilityBuilder(
130  $this->access,
131  $this->ctrl,
132  $this->action_repo,
133  $DIC->http()
134  );
135 
136  $capability_context = new Context(
137  $this->object_id,
138  $this->ref_id,
139  ($a_id_type === self::WORKSPACE_NODE_ID) ? Context::CONTEXT_WORKSPACE : Context::CONTEXT_REPO
140  );
141 
142  $this->capabilities = $capability_builder->get($capability_context);
143  }
Class ilObjFileStakeholder.
static getLogger(string $a_component_id)
Get component logger.
const OBJECT_TYPE
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

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

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

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

1117  : void
1118  {
1119  global $DIC;
1120  $main_tpl = $DIC->ui()->mainTemplate();
1121  $ilErr = $DIC['ilErr'];
1122  $lng = $DIC['lng'];
1123  $ilAccess = $DIC['ilAccess'];
1124 
1125  if ($a_additional && str_ends_with((string) $a_additional, "wsp")) {
1126  ilObjectGUI::_gotoSharedWorkspaceNode((int) $a_target);
1127  }
1128 
1129  // added support for direct download goto links
1130  if ($a_additional && str_ends_with((string) $a_additional, "download")) {
1131  ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
1132  }
1133 
1134  // static method, no workspace support yet
1135 
1136  if ($ilAccess->checkAccess("visible", "", $a_target)
1137  || $ilAccess->checkAccess("read", "", $a_target)) {
1138  ilObjectGUI::_gotoRepositoryNode($a_target, Capabilities::INFO_PAGE->value);
1139  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1140  $main_tpl->setOnScreenMessage(
1141  'failure',
1142  sprintf(
1143  $lng->txt("msg_no_perm_read_item"),
1145  ),
1146  true
1147  );
1149  }
1150 
1151  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1152  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const ROOT_FOLDER_ID
Definition: constants.php:32
static _gotoRepositoryNode(int $ref_id, string $cmd="")
$ilErr
Definition: raiseError.php:17
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
static _gotoSharedWorkspaceNode(int $wsp_id)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
+ Here is the call graph for this function:

◆ addLegacyFormToAccordion()

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

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

References ilObject2GUI\$tpl, ilAccordionGUI\addItem(), ilGlobalTemplateInterface\get(), ilPropertyFormGUI\getHTML(), ilPropertyFormGUI\getTitle(), ILIAS\Repository\lng(), ilPropertyFormGUI\setTitle(), and ilGlobalTemplateInterface\setVariable().

Referenced by getCreationFormsHTML().

377  : void {
378  // abort if form-type is unknown
379  if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
380  return;
381  }
382  $title = $form->getTitle();
383  $form->setTitle(''); // see https://mantis.ilias.de/view.php?id=37786
384 
385  $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
386  $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $title);
387 
388  $accordion->addItem($tpl->get(), $form->getHTML());
389  }
addItem(string $a_header, string $a_content, bool $a_force_open=false)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjFileGUI::addLocatorItems ( )
protected

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

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

1157  : void
1158  {
1159  global $DIC;
1160  $ilLocator = $DIC['ilLocator'];
1161 
1162  if (is_object($this->object)) {
1163  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
1164  }
1165  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ addUIFormToAccordion()

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

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

References ilObject2GUI\$tpl, ilAccordionGUI\addItem(), ilGlobalTemplateInterface\get(), ILIAS\UI\Component\Input\Container\Container\getInputs(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setVariable(), and ILIAS\Repository\ui().

Referenced by getCreationFormsHTML().

356  : void {
357  // abort if form-type is unknown
358  if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
359  return;
360  }
361 
362  $inputs = $form->getInputs();
363  // use label of first input as title, because UI Component forms don't support form-titles yet
364  $title = ($inputs === []) ?
365  '' : $inputs[array_key_first($inputs)]->getLabel();
366 
367  $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
368  $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $title);
369 
370  $accordion->addItem($tpl->get(), $this->ui->renderer()->render($form));
371  }
addItem(string $a_header, string $a_content, bool $a_force_open=false)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ilGlobalTemplateInterface $tpl
ILIAS UI Component Input Factory $inputs
getInputs()
Get the inputs contained in the container.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildInfoScreen()

ilObjFileGUI::buildInfoScreen ( bool  $kiosk_mode)

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

References ilObjectGUI\$obj_id, $r, $url, ilObject\_getAllReferences(), ilObjFileAccess\_getPermanentDownloadLink(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\UI\Implementation\Component\Input\Group, ILIAS\Repository\lng(), ilAdvancedMDRecordGUI\MODE_INFO, ILIAS\Repository\object(), and ILIAS\Repository\ui().

Referenced by infoScreenForward().

899  {
900  $info = new ilInfoScreenGUI($this);
901 
902  if (!$kiosk_mode) { // in kiosk mode we don't want to show the following sections
903  $info->enablePrivateNotes();
904 
905  if ($this->capabilities->get(Capabilities::DOWNLOAD)->isUnlocked()) {
906  $info->enableNews();
907  }
908 
909  // no news editing for files, just notifications
910  $info->enableNewsEditing(false);
911  if ($this->capabilities->get(Capabilities::MANAGE_VERSIONS)->isUnlocked()) {
912  $news_set = new ilSetting("news");
913  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
914 
915  if ($enable_internal_rss) {
916  $info->setBlockProperty("news", "settings", true);
917  $info->setBlockProperty("news", "public_notifications_option", true);
918  }
919  }
920 
921  $obj_id = $this->object->getId();
922  $record_gui = new ilAdvancedMDRecordGUI(
924  'file',
925  $obj_id,
926  '',
927  0,
928  $this->call_by_reference
929  );
930  $record_gui->setInfoObject($info);
931  $record_gui->parse();
932  }
933  // show rating is not possible in kiosk mode
934 
935  // Important Information
936  $important_info = $this->object->getImportantInfo();
937  if (!empty($important_info)) {
938  $group = new Group(new Factory(), $this->lng);
939  $markdown_to_html = $group->markdown()->toHTML();
940 
941  $info->addSection($this->lng->txt("important_info"));
942  $info->addProperty("", $markdown_to_html->transform($important_info));
943  }
944 
945  // Download Launcher
946  if ($this->capabilities->get(Capabilities::DOWNLOAD)->isUnlocked()) {
947  // get permanent download link for repository
948  if ($this->id_type === self::REPOSITORY_NODE_ID) {
949  $download_target = ilObjFileAccess::_getPermanentDownloadLink($this->node_id);
950  } else {
951  $download_target = rtrim(ILIAS_HTTP_PATH, '/') . '/' . $this->ctrl->getLinkTarget(
952  $this,
953  self::CMD_SEND_FILE
954  );
955  }
956  $url = $this->data_factory->uri($download_target);
957  $link = $this->data_factory->link($this->lng->txt('file_download'), $url);
958  $download_launcher = $this->ui->factory()->launcher()->inline($link);
959  // create own section for download launcher if there is no important info section
960  if (empty($important_info)) {
961  $info->addSection("");
962  }
963  // add download launcher
964  $info->addProperty("", $this->renderer->render($download_launcher));
965  }
966 
967  // standard meta data
968  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
969 
970  // in kiosk mode we don't want to show the following sections
971  // links to resource
972  if (!$kiosk_mode && ($this->access->checkAccess("write", "", $this->ref_id) ||
973  $this->access->checkAccess("edit_permissions", "", $this->ref_id))) {
974  $rs = ilObject::_getAllReferences($this->obj_id);
975  $refs = [];
976  foreach ($rs as $r) {
977  if ($this->tree->isInTree($r)) {
978  $refs[] = $r;
979  }
980  }
981  if (count($refs) > 1) {
982  $links = $sep = "";
983  foreach ($refs as $r) {
984  $cont_loc = new ilLocatorGUI();
985  $cont_loc->addContextItems($r, true);
986  $links .= $sep . $cont_loc->getHTML();
987  $sep = "<br />";
988  }
989 
990  $info->addProperty(
991  $this->lng->txt("res_links"),
992  '<div class="small">' . $links . '</div>'
993  );
994  }
995  }
996 
997  // File Info
998  $info->addSection($this->lng->txt("file_info"));
999  if ($kiosk_mode) {
1000  $file_info_for_users = $this->getFileInfoForUsers();
1001  foreach ($file_info_for_users as $file_info_entry_key => $file_info_entry_value) {
1002  if ($file_info_entry_value !== null) {
1003  $info->addProperty($file_info_entry_key, $file_info_entry_value);
1004  }
1005  }
1006  } else {
1007  $file_info = $this->getAllFileInfoForCurrentUser();
1008  foreach ($file_info as $file_info_block) {
1009  foreach ($file_info_block as $file_info_entry_key => $file_info_entry_value) {
1010  if ($file_info_entry_value !== null) {
1011  $info->addProperty($file_info_entry_key, $file_info_entry_value);
1012  }
1013  }
1014  }
1015  }
1016 
1017  $info->hideFurtherSections(false);
1018 
1019  return $info;
1020  }
Class ilInfoScreenGUI.
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$url
Definition: ltiregstart.php:35
static _getPermanentDownloadLink(int $ref_id)
Gets the permanent download link for the file.
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit()

ilObjFileGUI::edit ( )

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

References $DIC, $ilErr, initPropertiesForm(), initSettingsTab(), and ILIAS\Repository\lng().

640  : void
641  {
642  global $DIC;
643  $ilErr = $DIC['ilErr'];
644 
645  if (!$this->capabilities->get(Capabilities::EDIT_SETTINGS)->isUnlocked()) {
646  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
647  }
648 
649  $this->initSettingsTab();
650 
651  $form = $this->initPropertiesForm();
652 
653  // $ecs = new ilECSFileSettings($this->object);
654  // $ecs->addSettingsToForm($form, ilObjFile::OBJECT_TYPE); TODO: reintroduce usage of ECS file settings once they have been made compatible with the new ui components
655 
656  $this->tpl->setContent($this->renderer->render($form));
657  }
$ilErr
Definition: raiseError.php:17
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ editExternal()

ilObjFileGUI::editExternal ( )
protected

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

References ILIAS\Repository\ctrl().

819  : void
820  {
821  $this->ctrl->redirectToURL(
822  (string) $this->capabilities->get(Capabilities::EDIT_EXTERNAL)->getUri()
823  );
824  }
+ Here is the call graph for this function:

◆ getCreationFormsHTML()

ilObjFileGUI::getCreationFormsHTML ( array  $a_forms)
protected

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

References ilObject2GUI\$type, addLegacyFormToAccordion(), addUIFormToAccordion(), ilAccordionGUI\FIRST_OPEN, and ILIAS\Repository\ui().

391  : string
392  {
393  // abort if empty array was passed
394  if ($a_forms === []) {
395  return '';
396  }
397 
398  if (1 === count($a_forms)) {
399  $creation_form = end($a_forms);
400  if ($creation_form instanceof Standard) {
401  return $this->ui->renderer()->render($creation_form);
402  }
403 
404  if ($creation_form instanceof ilPropertyFormGUI) {
405  return $creation_form->getHTML();
406  }
407  }
408 
409  $accordion = new ilAccordionGUI();
410  $accordion->setBehaviour(ilAccordionGUI::FIRST_OPEN);
411 
412  foreach ($a_forms as $type => $form) {
413  if ($form instanceof Standard) {
414  $this->addUIFormToAccordion($accordion, $form, $type);
415  }
416 
417  if ($form instanceof ilPropertyFormGUI) {
418  $this->addLegacyFormToAccordion($accordion, $form, $type);
419  }
420  }
421 
422  return "<div class='ilCreationFormSection'>{$accordion->getHTML()}</div>";
423  }
addLegacyFormToAccordion(ilAccordionGUI $accordion, ilPropertyFormGUI $form, int $form_type)
addUIFormToAccordion(ilAccordionGUI $accordion, Standard $form, int $form_type)
This describes a standard form.
Definition: Standard.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getCtrl()

ilObjFileGUI::getCtrl ( )
protected

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

References ilObject2GUI\$ctrl.

1182  : \ilCtrl
1183  {
1184  return $this->ctrl;
1185  }
Class ilCtrl provides processing control methods.

◆ getFileObj()

ilObjFileGUI::getFileObj ( )
protected
Exceptions
ilFileException

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

References $object.

1190  : ilObjFile
1191  {
1192  if (!$this->object instanceof ilObjFile) {
1193  throw new ilFileException("Error: object is not of type ilObjFile or doesn't exist");
1194  }
1195 
1196  return $this->object;
1197  }
Class ilObjFile.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getFileStakeholder()

ilObjFileGUI::getFileStakeholder ( )
protected

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

References $stakeholder.

1200  {
1201  return $this->stakeholder;
1202  }
Class ilObjFileStakeholder.
ResourceStakeholder $stakeholder

◆ getGeneralSettings()

ilObjFileGUI::getGeneralSettings ( )
protected

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

References $general_settings.

1204  : General
1205  {
1206  return $this->general_settings;
1207  }
General $general_settings

◆ getLanguage()

ilObjFileGUI::getLanguage ( )
protected

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

References $lng.

Referenced by initUploadForm().

1209  : \ilLanguage
1210  {
1211  return $this->lng;
1212  }
language handling
+ Here is the caller graph for this function:

◆ getNodeID()

ilObjFileGUI::getNodeID ( )
protected

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

References ilObject2GUI\$node_id.

1214  : int
1215  {
1216  return $this->node_id;
1217  }

◆ getParentId()

◆ getRefinery()

ilObjFileGUI::getRefinery ( )
protected

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

References $refinery.

1220  {
1221  return $this->refinery;
1222  }
Builds data types.
Definition: Factory.php:35
ILIAS Refinery Factory $refinery

◆ getType()

ilObjFileGUI::getType ( )

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

References ilObjFile\OBJECT_TYPE.

Referenced by initUploadForm().

145  : string
146  {
147  return ilObjFile::OBJECT_TYPE;
148  }
const OBJECT_TYPE
+ Here is the caller graph for this function:

◆ getUIFactory()

ilObjFileGUI::getUIFactory ( )
protected

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

References ILIAS\Repository\ui().

1225  {
1226  return $this->ui->factory();
1227  }
+ Here is the call graph for this function:

◆ getUser()

ilObjFileGUI::getUser ( )
protected

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

References ilObject2GUI\$user.

1229  : ilObjUser
1230  {
1231  return $this->user;
1232  }

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

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

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

Referenced by getParentId().

835  : void
836  {
837  $this->tabs_gui->activateTab("id_info");
838 
839  if (!$this->capabilities->get(Capabilities::INFO_PAGE)->isUnlocked()) {
840  $GLOBALS['DIC']['ilErr']->raiseError(
841  $this->lng->txt("msg_no_perm_read"),
842  2
843  ); // TODO remove magic number and old ilErr call
844  }
845 
846  // add set completed button, if LP mode is active
847  if ($this->object->getLPMode() === ilLPObjSettings::LP_MODE_MANUAL) {
848  if (ilLPStatus::_hasUserCompleted($this->object->getId(), $this->user->getId())) {
849  $label = $this->lng->txt('file_btn_lp_toggle_state_completed');
850  } else {
851  $label = $this->lng->txt('file_btn_lp_toggle_state_not_completed');
852  }
853  $this->toolbar->addComponent(
854  $this->ui->factory()->button()->standard(
855  $label,
856  $this->ctrl->getLinkTarget($this, 'toggleLearningProgress')
857  )
858  );
859  }
860 
861  // Add WOPI editor Button
862  if ($this->capabilities->get(Capabilities::EDIT_EXTERNAL)->isUnlocked()) {
863  $external_editor = $this->ui->factory()
864  ->button()
865  ->standard(
866  $this->lng->txt('open_external_editor'),
867  $this->ctrl->getLinkTargetByClass(
868  \ilWOPIEmbeddedApplicationGUI::class,
870  )
871  );
872  $this->toolbar->addComponent($external_editor);
873  }
874 
875  $info = $this->buildInfoScreen(false);
876  $this->ctrl->forwardCommand($info);
877  }
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
$GLOBALS["DIC"]
Definition: wac.php:31
buildInfoScreen(bool $kiosk_mode)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjFileGUI::initCreationForms (   $a_new_type)
protected
Returns
array

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

References ilObjectGUI\initImportForm(), initUploadForm(), and ilObjFile\OBJECT_TYPE.

428  : array
429  {
430  $forms = [];
431  $forms[self::CFORM_NEW] = $this->initUploadForm();
432 
433  // repository only
434  if ($this->id_type !== self::WORKSPACE_NODE_ID) {
435  $forms[self::CFORM_IMPORT] = $this->initImportForm(ilObjFile::OBJECT_TYPE);
436  }
437 
438  return $forms;
439  }
initImportForm(string $new_type)
const OBJECT_TYPE
+ Here is the call graph for this function:

◆ initHeaderAction()

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

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

References ILIAS\Repository\object().

1167  : ?\ilObjectListGUI
1168  {
1169  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1170  if ($lg instanceof ilObjectListGUI && $this->object->hasRating()) {
1171  $lg->enableRating(
1172  true,
1173  null,
1174  false,
1175  [ilCommonActionDispatcherGUI::class, ilRatingGUI::class]
1176  );
1177  }
1178 
1179  return $lg;
1180  }
+ Here is the call graph for this function:

◆ initPropertiesForm()

ilObjFileGUI::initPropertiesForm ( )
protected

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

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

Referenced by edit(), and putObjectInTree().

659  : Standard
660  {
661  $title_and_description = $this->object->getObjectProperties()->getPropertyTitleAndDescription()->toForm(
662  $this->lng,
663  $this->ui->factory()->input()->field(),
665  );
666 
667  $important_info = $this->inputs->field()->markdown(
669  $this->lng->txt('important_info'),
670  $this->lng->txt('important_info_byline')
671  )->withValue(
672  $this->object->getImportantInfo() ?? ""
673  );
674 
675  $on_click_action = $this->inputs->field()->radio(
676  $this->lng->txt('on_click_action')
677  )->withOption(
679  $this->lng->txt('action_download')
680  )->withOption(
682  $this->lng->txt('action_show')
683  )->withValue(
684  (string) $this->object->getOnClickMode()
685  );
686 
687  $input_groups = array_filter([
688  "title_and_description" => $title_and_description,
689  "important_info" => $important_info,
690  "on_click_action" => $on_click_action
691  ], static fn($input): bool => null !== $input);
692 
693  $file_info_section = $this->inputs->field()->section(
694  $input_groups,
695  $this->lng->txt('file_info')
696  );
697 
698  $online_status = $this->object->getObjectProperties()->getPropertyIsOnline()->toForm(
699  $this->lng,
700  $this->ui->factory()->input()->field(),
702  );
703  $availability_section = $this->inputs->field()->section(
704  ["online_status" => $online_status],
705  $this->lng->txt('rep_activation_availability')
706  );
707 
708  $presentation_section = null;
709  if ($this->id_type === self::REPOSITORY_NODE_ID) {
710  $tile_image = $this->object->getObjectProperties()->getPropertyTileImage()->toForm(
711  $this->lng,
712  $this->ui->factory()->input()->field(),
714  );
715  $presentation_section = $this->inputs->field()->section(
716  ["tile_image" => $tile_image],
717  $this->lng->txt('settings_presentation_header')
718  );
719  }
720 
721  $additional_features_section = null;
722  if ($this->id_type === self::REPOSITORY_NODE_ID) {
723  $this->lng->loadLanguageModule('rating');
724 
725  $enable_rating = $this->inputs->field()->checkbox(
726  $this->lng->txt('rating_activate_rating'),
727  $this->lng->txt('rating_activate_rating_info')
728  )->withValue(
729  $this->object->hasRating()
730  );
731  $additional_features_section = $this->inputs->field()->section(
732  ["rating" => $enable_rating],
733  $this->lng->txt('obj_features')
734  );
735  }
736 
737  $inputs = array_filter([
738  "file_info" => $file_info_section,
739  "availability" => $availability_section,
740  "presentation" => $presentation_section,
741  "obj_features" => $additional_features_section
742  ], static fn($input): bool => null !== $input);
743 
744  return $this->inputs->container()->form()->standard(
745  $this->ctrl->getLinkTargetByClass(self::class, 'update'),
746  $inputs
747  );
748  }
const CLICK_MODE_DOWNLOAD
ILIAS UI Component Input Factory $inputs
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:58
This describes a standard form.
Definition: Standard.php:26
ILIAS Refinery Factory $refinery
const CLICK_MODE_INFOPAGE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsTab()

ilObjFileGUI::initSettingsTab ( )
protected

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

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

Referenced by edit(), and getParentId().

1097  : void
1098  {
1099  $this->tabs_gui->activateTab("settings");
1100  // add subtab for common settings
1101  $this->tabs_gui->addSubTab(
1102  'file_settings',
1103  $this->lng->txt('settings'),
1104  $this->ctrl->getLinkTargetByClass(self::class, self::CMD_EDIT)
1105  );
1106  if (in_array('file', ilAdvancedMDRecord::_getActivatedObjTypes(), true)) {
1107  $this->tabs_gui->addSubTab(
1108  'service_settings',
1109  $this->lng->txt('service_settings'),
1110  $this->ctrl->getLinkTargetByClass(ilFileCommonSettingsGUI::class, ilFileCommonSettingsGUI::CMD_EDIT)
1111  );
1112  }
1113 
1114  $this->tabs_gui->activateSubTab("file_settings");
1115  }
static _getActivatedObjTypes()
get activated obj types
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUploadForm()

ilObjFileGUI::initUploadForm ( )

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

References $inputs, ilMDSettings\_getInstance(), ILIAS\Repository\ctrl(), getLanguage(), getType(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation().

Referenced by initCreationForms(), and uploadFiles().

441  : Standard
442  {
443  $this->getLanguage()->loadLanguageModule('file');
444  $inputs = [];
445 
446  $this->ctrl->setParameterByClass(self::class, 'new_type', $this->getType());
447  $this->ctrl->setParameterByClass(
448  self::class,
449  self::PARAM_UPLOAD_ORIGIN,
450  self::UPLOAD_ORIGIN_STANDARD
451  );
452 
453  // add file input
454  $size = new DataSize(
455  $this->upload_limit->getBestPossibleUploadLimitInBytes($this->upload_handler),
456  DataSize::MB
457  );
458 
459  $inputs[self::PARAM_FILES] = $this->ui->factory()->input()->field()->file(
460  $this->upload_handler,
461  $this->lng->txt('upload_files'),
462  sprintf(
463  $this->lng->txt('upload_files_limit'),
464  (string) $size
465  ),
466  $this->ui->factory()->input()->field()->group([
467  self::PARAM_TITLE => $this->ui->factory()->input()->field()->text(
468  $this->lng->txt('title')
470  $this->getEmptyStringToNullTransformation()
471  ),
472  self::PARAM_DESCRIPTION => $this->ui->factory()->input()->field()->textarea(
473  $this->lng->txt('description')
475  $this->getEmptyStringToNullTransformation()
476  ),
477  ])
478  )->withMaxFiles(
479  self::UPLOAD_MAX_FILES
480  )->withRequired(true);
481 
482  if (ilMDSettings::_getInstance()->isCopyrightSelectionActive()) {
483  $inputs[self::PARAM_COPYRIGHT_ID] = $this->getCopyrightSelectionInput('set_license_for_all_files');
484  }
485 
486  return $this->ui->factory()->input()->container()->form()->standard(
487  $this->ctrl->getFormActionByClass(self::class, self::CMD_UPLOAD_FILES),
488  $inputs
489  )->withSubmitLabel($this->lng->txt('upload_files'));
490  }
This class provides the data size with additional information to remove the work to calculate the siz...
Definition: DataSize.php:30
ILIAS UI Component Input Factory $inputs
This describes a standard form.
Definition: Standard.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ putObjectInTree()

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

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

References ilObjectGUI\$data, $DIC, $filename, ilObject2GUI\$node_id, ilChangeEvent\_catchupWriteEvents(), ilChangeEvent\_recordWriteEvent(), ILIAS\Repository\ctrl(), initPropertiesForm(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilObject2GUI\update().

573  : void
574  {
575  // this is needed to support multi fileuploads in personal and shared resources
576  $backup_node_id = $this->node_id;
577  parent::putObjectInTree($obj, $parent_node_id);
578  $this->node_id = $backup_node_id;
579  }
+ Here is the call graph for this function:

◆ sendFile()

ilObjFileGUI::sendFile ( )

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

References Vendor\Package\$e, ilChangeEvent\_recordReadEvent(), ilLPStatusWrapper\_updateStatus(), ANONYMOUS_USER_ID, ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_CONTENT_VISITED, ILIAS\Repository\object(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

750  : bool
751  {
752  $hist_entry_id = $this->http->query()->has('hist_id')
753  ? $this->http->query()->retrieve('hist_id', $this->refinery->kindlyTo()->int())
754  : null;
755  try {
756  if (ANONYMOUS_USER_ID === $this->user->getId() && $this->http->query()->has('transaction')) {
757  $this->object->sendFile($hist_entry_id);
758  }
759 
760  if ($this->capabilities->get(Capabilities::DOWNLOAD)->isUnlocked()) {
761  // Record read event and catchup with write events
763  $this->object->getType(),
764  $this->object->getRefId(),
765  $this->object->getId(),
766  $this->user->getId()
767  );
768  if ($this->object->getLPMode() === ilLPObjSettings::LP_MODE_CONTENT_VISITED) {
770  $this->object->getId(),
771  $this->user->getId(),
772  null,
773  false,
774  true
775  );
776  }
777 
778  $this->object->sendFile($hist_entry_id);
779  } else {
780  $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
781  }
782  } catch (FileNotFoundException $e) {
783  $this->error->raiseError($e->getMessage(), $this->error->MESSAGE);
784  }
785 
786  return true;
787  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
static http()
Fetches the global http state from ILIAS.
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
Indicates that a file is missing or not found.
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:

◆ setTabs()

ilObjFileGUI::setTabs ( )
protected

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

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

1023  : void
1024  {
1025  global $DIC;
1026  $ilHelp = $DIC['ilHelp'];
1027  $ilHelp->setScreenIdComponent(ilObjFile::OBJECT_TYPE);
1028 
1029  $this->ctrl->setParameter($this, "ref_id", $this->node_id);
1030 
1031  if (($c = $this->capabilities->get(Capabilities::VIEW_EXTERNAL)) && $c->isUnlocked()) {
1032  $this->tabs_gui->addTab(
1033  "content",
1034  $this->lng->txt("content"),
1035  $c->getURI()
1036  );
1037  }
1038 
1039  if (($c = $this->capabilities->get(Capabilities::MANAGE_VERSIONS)) && $c->isUnlocked()) {
1040  $this->tabs_gui->addTab(
1041  "id_versions",
1042  $this->lng->txt(self::CMD_VERSIONS),
1043  $this->ctrl->getLinkTargetByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_DEFAULT)
1044  );
1045  }
1046 
1047  if (($c = $this->capabilities->get(Capabilities::INFO_PAGE)) && $c->isUnlocked()) {
1048  $this->tabs_gui->addTab(
1049  "id_info",
1050  $this->lng->txt("info_short"),
1051  $this->ctrl->getLinkTargetByClass(["ilobjfilegui", "ilinfoscreengui"], "showSummary")
1052  );
1053  }
1054 
1055  if (($c = $this->capabilities->get(Capabilities::EDIT_SETTINGS)) && $c->isUnlocked()) {
1056  $this->tabs_gui->addTab(
1057  "settings",
1058  $this->lng->txt("settings"),
1059  $this->ctrl->getLinkTarget($this, self::CMD_EDIT)
1060  );
1061  }
1062 
1063  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1064  $this->tabs_gui->addTab(
1065  'learning_progress',
1066  $this->lng->txt('learning_progress'),
1067  $this->ctrl->getLinkTargetByClass([self::class, 'illearningprogressgui'], '')
1068  );
1069  }
1070 
1071  // meta data
1072  if (($c = $this->capabilities->get(Capabilities::EDIT_SETTINGS)) && $c->isUnlocked()) {
1073  $mdgui = new ilObjectMetaDataGUI($this->object, null, null, $this->call_by_reference);
1074  $mdtab = $mdgui->getTab();
1075  if ($mdtab) {
1076  $this->tabs_gui->addTab(
1077  "id_meta",
1078  $this->lng->txt("meta_data"),
1079  $mdtab
1080  );
1081  }
1082  }
1083 
1084  // export
1085  if (($c = $this->capabilities->get(Capabilities::EDIT_SETTINGS)) && $c->isUnlocked()) {
1086  $this->tabs_gui->addTab(
1087  "export",
1088  $this->lng->txt("export"),
1089  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1090  );
1091  }
1092 
1093  // will add permission tab if needed
1094  parent::setTabs();
1095  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const OBJECT_TYPE
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ showSummary()

ilObjFileGUI::showSummary ( )
Deprecated:
PROXY COMMAND

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

References ILIAS\Repository\ctrl().

792  : void
793  {
794  $this->ctrl->redirectToURL(
795  (string) $this->capabilities->get(Capabilities::INFO_PAGE)->getUri()
796  );
797  }
+ Here is the call graph for this function:

◆ showSummaryForced()

ilObjFileGUI::showSummaryForced ( )

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

References ILIAS\Repository\ctrl().

798  : void
799  {
800  $this->ctrl->redirectToURL(
801  (string) $this->capabilities->get(Capabilities::FORCED_INFO_PAGE)->getUri()
802  );
803  }
+ Here is the call graph for this function:

◆ toggleLearningProgress()

ilObjFileGUI::toggleLearningProgress ( )
protected

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

References ilObjectGUI\$obj_id, ilObjectGUI\$ref_id, ilLPStatus\_hasUserCompleted(), ilLearningProgress\_tracProgress(), ilLPStatusWrapper\_updateStatus(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilLPMarks\setCompleted(), and ILIAS\Repository\user().

879  : void
880  {
882  $this->user->getId(),
885  'file'
886  );
887 
888  $lp_marks = new ilLPMarks($this->obj_id, $this->user->getId());
889  $lp_marks->setCompleted(!ilLPStatus::_hasUserCompleted($this->object->getId(), $this->user->getId()));
890  $lp_marks->update();
891 
892  ilLPStatusWrapper::_updateStatus($this->obj_id, $this->user->getId());
893 
894  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
895  $this->ctrl->redirect($this, Capabilities::INFO_PAGE->value);
896  }
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
setCompleted(bool $a_status)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:

◆ unzipCurrentRevision()

ilObjFileGUI::unzipCurrentRevision ( )

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

References ILIAS\Repository\ctrl().

812  : void
813  {
814  $this->ctrl->redirectToURL(
815  (string) $this->capabilities->get(Capabilities::UNZIP)->getUri()
816  );
817  }
+ Here is the call 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 495 of file class.ilObjFileGUI.php.

References ilObjectGUI\$data, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initUploadForm(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\ui().

495  : void
496  {
497  $origin = ($this->http->query()->has(self::PARAM_UPLOAD_ORIGIN)) ?
498  $this->http->query()->retrieve(
499  self::PARAM_UPLOAD_ORIGIN,
500  $this->refinery->kindlyTo()->string()
501  ) : self::UPLOAD_ORIGIN_STANDARD;
502 
503  if (self::UPLOAD_ORIGIN_DROPZONE === $origin) {
504  $dropzone = new ilObjFileUploadDropzone($this->parent_id);
505  $dropzone = $dropzone->getDropzone()->withRequest($this->request);
506  $data = $dropzone->getData();
507  } else {
508  $form = $this->initUploadForm()->withRequest($this->request);
509  $data = $form->getData();
510  }
511  $files = $data[self::PARAM_FILES] ?? $data[0] ?? null;
512 
513  if (empty($files)) {
514  $form = $this->initUploadForm()->withRequest($this->request);
515  $this->tpl->setContent($this->ui->renderer()->render($form));
516  return;
517  }
518 
519  $processor = new ilObjFileProcessor(
520  $this->stakeholder,
521  $this,
522  $this->storage,
523  $this->file_service_settings
524  );
525 
526  $errors = false;
527  foreach ($files as $file_data) {
528  $rid = $this->storage->manage()->find($file_data[$this->upload_handler->getFileIdentifierParameterName()]);
529  if (null !== $rid) {
530  try {
531  $processor->process(
532  $rid,
533  $file_data[self::PARAM_TITLE] ?? null,
534  $file_data[self::PARAM_DESCRIPTION] ?? null,
535  $data[self::PARAM_COPYRIGHT_ID] ?? $data[1] ?? null
536  );
537  } catch (Throwable $t) {
538  $errors = true;
539  if (null !== $this->log) {
540  $this->log->error($t->getMessage() . ": " . $t->getTraceAsString());
541  }
542  }
543  }
544  }
545 
546  if ($errors) {
547  $this->ui->mainTemplate()->setOnScreenMessage(
548  'failure',
549  $this->lng->txt('could_not_create_file_objs'),
550  true
551  );
552  }
553 
554  if ($processor->getInvalidFileNames() !== []) {
555  $this->ui->mainTemplate()->setOnScreenMessage(
556  'info',
557  sprintf(
558  $this->lng->txt('file_upload_info_file_with_critical_extension'),
559  implode(', ', $processor->getInvalidFileNames())
560  ),
561  true
562  );
563  }
564 
565  $link = match ($this->id_type) {
566  self::WORKSPACE_NODE_ID => $this->ctrl->getLinkTargetByClass(ilObjWorkspaceRootFolderGUI::class),
567  default => ilLink::_getLink($this->requested_ref_id),
568  };
569 
570  $this->ctrl->redirectToURL($link);
571  }
Class ilObjFileProcessorInterface.
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ versions()

ilObjFileGUI::versions ( )

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

References ILIAS\Repository\ctrl().

805  : void
806  {
807  $this->ctrl->redirectToURL(
808  (string) $this->capabilities->get(Capabilities::MANAGE_VERSIONS)->getUri()
809  );
810  }
+ Here is the call graph for this function:

◆ viewExternal()

ilObjFileGUI::viewExternal ( )
protected

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

References ILIAS\Repository\ctrl().

825  : void
826  {
827  $this->ctrl->redirectToURL(
828  (string) $this->capabilities->get(Capabilities::VIEW_EXTERNAL)->getUri()
829  );
830  }
+ Here is the call graph for this function:

Field Documentation

◆ $action_repo

ActionDBRepository ilObjFileGUI::$action_repo
private

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

◆ $capabilities

CapabilityCollection ilObjFileGUI::$capabilities
private

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

◆ $data_factory

Factory ilObjFileGUI::$data_factory
protected

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

◆ $file_service_settings

ilFileServicesSettings ilObjFileGUI::$file_service_settings
protected

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

◆ $general_settings

General ilObjFileGUI::$general_settings
protected

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

Referenced by getGeneralSettings().

◆ $http

WrapperFactory ilObjFileGUI::$http
protected

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

◆ $icon_repo

IconDatabaseRepository ilObjFileGUI::$icon_repo
protected

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

◆ $inputs

ILIAS UI Component Input Factory ilObjFileGUI::$inputs
protected

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

Referenced by initPropertiesForm(), and initUploadForm().

◆ $lng

ilLanguage ilObjFileGUI::$lng

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

Referenced by getLanguage().

◆ $log

ilLogger ilObjFileGUI::$log = null
protected

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

◆ $obj_service

ilObjectService ilObjFileGUI::$obj_service
protected

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

◆ $object

ilObjFile null ilObjFileGUI::$object = null

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

Referenced by getFileObj(), and getParentId().

◆ $refinery

ILIAS Refinery Factory ilObjFileGUI::$refinery
protected

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

Referenced by getRefinery(), and initPropertiesForm().

◆ $renderer

Renderer ilObjFileGUI::$renderer
protected

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

◆ $request

ServerRequestInterface ilObjFileGUI::$request
protected

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

◆ $stakeholder

ResourceStakeholder ilObjFileGUI::$stakeholder
protected

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

Referenced by getFileStakeholder().

◆ $storage

Services ilObjFileGUI::$storage
protected

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

◆ $ui

UIServices ilObjFileGUI::$ui
protected

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

◆ $upload_handler

UploadHandler ilObjFileGUI::$upload_handler
protected

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

◆ $upload_limit

UploadLimitResolver ilObjFileGUI::$upload_limit
private

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

◆ CMD_EDIT

const ilObjFileGUI::CMD_EDIT = 'edit'

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

◆ CMD_SEND_FILE

const ilObjFileGUI::CMD_SEND_FILE = 'sendFile'

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

◆ CMD_UPLOAD_FILES

const ilObjFileGUI::CMD_UPLOAD_FILES = "uploadFiles"

◆ CMD_VERSIONS

const ilObjFileGUI::CMD_VERSIONS = 'versions'

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

◆ PARAM_COPYRIGHT_ID

const ilObjFileGUI::PARAM_COPYRIGHT_ID = "copyright_id"

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

◆ PARAM_DESCRIPTION

const ilObjFileGUI::PARAM_DESCRIPTION = 'description'

◆ PARAM_FILES

const ilObjFileGUI::PARAM_FILES = 'files'

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

◆ PARAM_TITLE

const ilObjFileGUI::PARAM_TITLE = 'title'

◆ PARAM_UPLOAD_ORIGIN

const ilObjFileGUI::PARAM_UPLOAD_ORIGIN = 'origin'

◆ UPLOAD_MAX_FILES

const ilObjFileGUI::UPLOAD_MAX_FILES = 100

◆ UPLOAD_ORIGIN_DROPZONE

const ilObjFileGUI::UPLOAD_ORIGIN_DROPZONE = 'dropzone'

◆ UPLOAD_ORIGIN_STANDARD

const ilObjFileGUI::UPLOAD_ORIGIN_STANDARD = 'standard'

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


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