ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 update ()
 updates object entry in object_data More...
 
 edit ()
 
 sendFile ()
 
 versions ()
 
 unzipCurrentRevision ()
 
 infoScreen ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 infoScreenForward ()
 show information screen More...
 
- 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)
 
 cancelDelete ()
 
 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] don't belong to the current 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...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 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 = 0
 
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"
 
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

 render ()
 This Method is needed if called from personal resources. More...
 
 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 ()
 
 setTabs ()
 
 addLocatorItems ()
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 
- 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="")
 
 fillCloneTemplate (?string $tpl_varname, string $type)
 
 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...
 
 getPermanentLinkWidget (string $append=null, bool $center=false)
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 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...
 
 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...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 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...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

UIServices $ui
 
UploadHandler $upload_handler
 
ResourceStakeholder $stakeholder
 
Services $storage
 
ilLogger $log = null
 
ilObjectService $obj_service
 
ILIAS Refinery Factory $refinery
 
ILIAS HTTP Wrapper WrapperFactory $http
 
ilFileServicesSettings $file_service_settings
 
- Protected Attributes inherited from ilObject2GUI
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ilObjectService $object_service
 
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 = array()
 
 $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
 
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 = ""
 

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

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

65  {
66  global $DIC;
67  $this->http = $DIC->http()->wrapper();
68  $this->request = $DIC->http()->request();
69  $this->refinery = $DIC->refinery();
70  $this->file_service_settings = $DIC->fileServiceSettings();
71  $this->user = $DIC->user();
72  $this->lng = $DIC->language();
74  $this->ui = $DIC->ui();
75  $this->storage = $DIC->resourceStorage();
76  $this->upload_handler = new ilObjFileUploadHandlerGUI();
77  $this->stakeholder = new ilObjFileStakeholder();
78  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
79  $this->obj_service = $DIC->object();
80  $this->lng->loadLanguageModule(ilObjFile::OBJECT_TYPE);
81  }
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(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

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

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

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

800  : void
801  {
802  global $DIC;
803  $main_tpl = $DIC->ui()->mainTemplate();
804  $ilErr = $DIC['ilErr'];
805  $lng = $DIC['lng'];
806  $ilAccess = $DIC['ilAccess'];
807 
808  if ($a_additional && substr($a_additional, -3) == "wsp") {
809  ilObjectGUI::_gotoSharedWorkspaceNode((int) $a_target);
810  }
811 
812  // added support for direct download goto links
813  if ($a_additional && substr($a_additional, -8) === "download") {
814  ilObjectGUI::_gotoRepositoryNode((int) $a_target, "sendfile");
815  }
816 
817  // static method, no workspace support yet
818 
819  if ($ilAccess->checkAccess("visible", "", $a_target)
820  || $ilAccess->checkAccess("read", "", $a_target)
821  ) {
822  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
823  } else {
824  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
825  $main_tpl->setOnScreenMessage('failure', sprintf(
826  $lng->txt("msg_no_perm_read_item"),
828  ), true);
830  }
831  }
832 
833  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
834  }
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 255 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().

259  : void {
260  // abort if form-type is unknown
261  if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
262  return;
263  }
264 
265  // see bug #0016217
266  if (method_exists($this, "getCreationFormTitle")) {
267  if (!empty(($title = $this->getCreationFormTitle($form_type)))) {
268  $form->setTitle($title);
269  }
270  }
271 
272  $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
273  $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $form->getTitle());
274 
275  $accordion->addItem($tpl->get(), $form->getHTML());
276  }
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 839 of file class.ilObjFileGUI.php.

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

839  : void
840  {
841  global $DIC;
842  $ilLocator = $DIC['ilLocator'];
843 
844  if (is_object($this->object)) {
845  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
846  }
847  }
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 237 of file class.ilObjFileGUI.php.

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

Referenced by getCreationFormsHTML().

237  : void
238  {
239  // abort if form-type is unknown
240  if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
241  return;
242  }
243 
244  $inputs = $form->getInputs();
245  // use label of first input as title, because UI Component forms don't support form-titles yet
246  $title = (!empty($inputs)) ?
247  $inputs[array_key_first($inputs)]->getLabel() : '';
248 
249  $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
250  $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $title);
251 
252  $accordion->addItem($tpl->get(), $this->ui->renderer()->render($form));
253  }
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:

◆ edit()

ilObjFileGUI::edit ( )

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

References $DIC, $ilErr, ilObject2GUI\checkPermissionBool(), initPropertiesForm(), ILIAS\Repository\lng(), and ilObjFile\OBJECT_TYPE.

496  : void
497  {
498  global $DIC;
499  $ilTabs = $DIC['ilTabs'];
500  $ilErr = $DIC['ilErr'];
501 
502  if (!$this->checkPermissionBool("write")) {
503  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
504  }
505 
506  $ilTabs->activateTab("settings");
507 
508  $form = $this->initPropertiesForm();
509 
510  $val = [];
511  $val['title'] = $this->object->getTitle();
512  $val['description'] = $this->object->getLongDescription();
513  $val['rating'] = $this->object->hasRating();
514  $form->setValuesByArray($val);
515  $ecs = new ilECSFileSettings($this->object);
516  $ecs->addSettingsToForm($form, ilObjFile::OBJECT_TYPE);
517 
518  $this->tpl->setContent($form->getHTML());
519  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const OBJECT_TYPE
$ilErr
Definition: raiseError.php:17
global $DIC
Definition: feed.php:28
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
+ Here is the call graph for this function:

◆ getCreationFormsHTML()

ilObjFileGUI::getCreationFormsHTML ( array  $a_forms)
protected

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

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

278  : string
279  {
280  // abort if empty array was passed
281  if (empty($a_forms)) {
282  return '';
283  }
284 
285  if (1 === count($a_forms)) {
286  $creation_form = end($a_forms);
287  if ($creation_form instanceof Standard) {
288  return $this->ui->renderer()->render($creation_form);
289  }
290 
291  if ($creation_form instanceof ilPropertyFormGUI) {
292  return $creation_form->getHTML();
293  }
294  }
295 
296  $accordion = new ilAccordionGUI();
297  $accordion->setBehaviour(ilAccordionGUI::FIRST_OPEN);
298 
299  foreach ($a_forms as $type => $form) {
300  if ($form instanceof Standard) {
301  $this->addUIFormToAccordion($accordion, $form, $type);
302  }
303 
304  if ($form instanceof ilPropertyFormGUI) {
305  $this->addLegacyFormToAccordion($accordion, $form, $type);
306  }
307  }
308 
309  return "<div class='ilCreationFormSection'>{$accordion->getHTML()}</div>";
310  }
addLegacyFormToAccordion(ilAccordionGUI $accordion, ilPropertyFormGUI $form, int $form_type)
addUIFormToAccordion(ilAccordionGUI $accordion, Standard $form, int $form_type)
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:

◆ getParentId()

◆ getType()

ilObjFileGUI::getType ( )

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

References ilObjFile\OBJECT_TYPE.

Referenced by initUploadForm().

83  : string
84  {
86  }
const OBJECT_TYPE
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjFileGUI::infoScreen ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

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

References ILIAS\Repository\ctrl(), and infoScreenForward().

Referenced by render().

607  : void
608  {
609  $this->ctrl->setCmd("showSummary");
610  $this->ctrl->setCmdClass("ilinfoscreengui");
611  $this->infoScreenForward();
612  }
infoScreenForward()
show information screen
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

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

References ilObject2GUI\$access_handler, $context, $GLOBALS, $preview, ilObject2GUI\$tpl, $version, ilObjFileAccess\_getPermanentDownloadLink(), ilObject2GUI\checkPermissionBool(), ilPreviewGUI\CONTEXT_REPOSITORY, ilPreviewGUI\CONTEXT_WORKSPACE, ILIAS\Repository\ctrl(), ilUtil\formatSize(), ilGlobalTemplateInterface\get(), ilLinkButton\getInstance(), ilUserUtil\getNamePresentation(), ilObject2GUI\getPermanentLinkWidget(), ilPreview\hasPreview(), IL_CAL_DATETIME, ILIAS\Repository\lng(), ILIAS\Repository\object(), ilGlobalTemplateInterface\setVariable(), and ILIAS\Repository\toolbar().

Referenced by getParentId(), and infoScreen().

617  : void
618  {
619  $this->tabs_gui->activateTab("id_info");
620 
621  if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
622  $GLOBALS['DIC']['ilErr']->raiseError($this->lng->txt("msg_no_perm_read"));
623  }
624 
625  $info = new ilInfoScreenGUI($this);
626 
627  if ($this->checkPermissionBool("read", "sendfile")) {
628  $button = ilLinkButton::getInstance();
629  $button->setTarget('_blank');
630  $button->setCaption("file_download");
631  $button->setPrimary(true);
632 
633  // get permanent download link for repository
634  if ($this->id_type === self::REPOSITORY_NODE_ID) {
635  $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
636  } else {
637  $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
638  }
639 
640  $this->toolbar->addButtonInstance($button);
641  }
642 
643  $info->enablePrivateNotes();
644 
645  if ($this->checkPermissionBool("read")) {
646  $info->enableNews();
647  }
648 
649  // no news editing for files, just notifications
650  $info->enableNewsEditing(false);
651  if ($this->checkPermissionBool("write")) {
652  $news_set = new ilSetting("news");
653  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
654 
655  if ($enable_internal_rss) {
656  $info->setBlockProperty("news", "settings", true);
657  $info->setBlockProperty("news", "public_notifications_option", true);
658  }
659  }
660 
661  // standard meta data
662  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
663 
664  // File Info
665  $info->addSection($this->lng->txt("file_info"));
666  $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
667  $info->addProperty($this->lng->txt("type"), $this->object->getFileType());
668  $info->addProperty($this->lng->txt("resource_id"), $this->object->getResourceId());
669  $info->addProperty($this->lng->txt("storage_id"), $this->object->getStorageID());
670 
671  $info->addProperty(
672  $this->lng->txt("size"),
673  ilUtil::formatSize($this->object->getFileSize(), 'long')
674  );
675  $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
676 
677  $version = $this->object->getVersions([$this->object->getVersion()]);
678  $version = end($version);
679  if ($version instanceof ilObjFileVersion) {
680  $info->addProperty(
681  $this->lng->txt("version_uploaded"),
682  (new ilDateTime($version->getDate(), IL_CAL_DATETIME))->get(IL_CAL_DATETIME)
683  );
684  }
685 
686  if ($this->object->getPageCount() > 0) {
687  $info->addProperty($this->lng->txt("page_count"), $this->object->getPageCount());
688  }
689 
690  // using getVersions function instead of ilHistory direct
691  $version_uploader = $version["user_id"] ?? -1; // unknown uploader
692  $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($version_uploader));
693 
694  // download link added in repository
695  if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
696  $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
698  $info->addProperty($this->lng->txt("download_link"), $tpl->get());
699  }
700 
701  if ($this->id_type == self::WORKSPACE_NODE_ID) {
702  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
703  }
704  if (!$this->ctrl->isAsynch()
705  && ilPreview::hasPreview($this->object->getId(), $this->object->getType())
706  && $this->checkPermissionBool("read")
707  ) {
708  // get context for access checks later on
709  switch ($this->id_type) {
710  case self::WORKSPACE_NODE_ID:
711  case self::WORKSPACE_OBJECT_ID:
713  break;
714 
715  default:
717  break;
718  }
719 
720  $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
721  $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
722  }
723 
724  // forward the command
725  // $this->ctrl->setCmd("showSummary");
726  // $this->ctrl->setCmdClass("ilinfoscreengui");
727  $this->ctrl->forwardCommand($info);
728  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilInfoScreenGUI.
$context
Definition: webdav.php:29
const IL_CAL_DATETIME
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
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.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
$preview
Definition: imgupload.php:81
static formatSize(int $size, string $a_mode='short', ?ilLanguage $a_lng=null)
Returns the specified file size value in a human friendly form.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
ilGlobalTemplateInterface $tpl
getPermanentLinkWidget(string $append=null, bool $center=false)
static hasPreview(int $a_obj_id, string $a_type="")
Determines whether the object with the specified reference id has a preview.
static _getPermanentDownloadLink(int $ref_id)
Gets the permanent download link for the file.
$version
Definition: plugin.php:24
+ 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 315 of file class.ilObjFileGUI.php.

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

315  : array
316  {
317  $forms[self::CFORM_NEW] = $this->initUploadForm();
318 
319  // repository only
320  if ($this->id_type !== self::WORKSPACE_NODE_ID) {
321  $forms[self::CFORM_IMPORT] = $this->initImportForm(ilObjFile::OBJECT_TYPE);
322  $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, ilObjFile::OBJECT_TYPE);
323  }
324 
325  return $forms;
326  }
initImportForm(string $new_type)
fillCloneTemplate(?string $tpl_varname, string $type)
const OBJECT_TYPE
+ Here is the call graph for this function:

◆ initHeaderAction()

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

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

References ILIAS\Repository\object().

850  {
851  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
852  if ($lg instanceof ilObjectListGUI && $this->object->hasRating()) {
853  $lg->enableRating(
854  true,
855  null,
856  false,
857  [ilCommonActionDispatcherGUI::class, ilRatingGUI::class]
858  );
859  }
860 
861  return $lg;
862  }
+ Here is the call graph for this function:

◆ initPropertiesForm()

ilObjFileGUI::initPropertiesForm ( )
protected

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilFormPropertyGUI\setInfo(), ilTextAreaInputGUI\setRows(), and ilNonEditableValueGUI\setValue().

Referenced by edit(), and update().

522  {
523  $form = new ilPropertyFormGUI();
524  $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
525 
526  $form->setTitle($this->lng->txt('file_edit'));
527  $form->addCommandButton('update', $this->lng->txt('save'));
528  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
529 
530  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
531  $title->setValue($this->object->getTitle());
532  $title->setInfo($this->lng->txt("if_no_title_then_filename"));
533  $form->addItem($title);
534 
535  $o = new ilNonEditableValueGUI($this->lng->txt('upload_info'));
536  $o->setValue($this->lng->txt('upload_info_desc'));
537  $form->addItem($o);
538 
539  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
540  $desc->setRows(3);
541  $form->addItem($desc);
542 
543  if ($this->id_type === self::REPOSITORY_NODE_ID) {
544  $this->lng->loadLanguageModule('rating');
545  $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
546  $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
547  $form->addItem($rate);
548  }
549 
550  $presentationHeader = new ilFormSectionHeaderGUI();
551  $presentationHeader->setTitle($this->lng->txt('settings_presentation_header'));
552  $form->addItem($presentationHeader);
553  $this->obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
554 
555  return $form;
556  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUploadForm()

ilObjFileGUI::initUploadForm ( )

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

References ILIAS\Repository\ctrl(), getType(), ilFileUtils\getUploadSizeLimitBytes(), ILIAS\Repository\lng(), ilObjFileProcessorInterface\OPTION_DESCRIPTION, ilObjFileProcessorInterface\OPTION_FILENAME, and ILIAS\Repository\ui().

Referenced by initCreationForms(), and uploadFiles().

328  : Standard
329  {
330  $this->ctrl->setParameterByClass(self::class, 'new_type', $this->getType());
331  $this->ctrl->setParameterByClass(
332  self::class,
333  self::PARAM_UPLOAD_ORIGIN,
334  self::UPLOAD_ORIGIN_STANDARD
335  );
336 
337  return $this->ui->factory()->input()->container()->form()->standard(
338  $this->ctrl->getFormActionByClass(self::class, self::CMD_UPLOAD_FILES),
339  [
340  self::PARAM_FILES => $this->ui->factory()->input()->field()->file(
341  $this->upload_handler,
342  $this->lng->txt('upload_files'),
343  null,
344  $this->ui->factory()->input()->field()->group([
345  ilObjFileProcessorInterface::OPTION_FILENAME => $this->ui->factory()->input()->field()->text($this->lng->txt('title')),
346  ilObjFileProcessorInterface::OPTION_DESCRIPTION => $this->ui->factory()->input()->field()->textarea($this->lng->txt('description')),
347  ])
348  )->withMaxFiles(self::UPLOAD_MAX_FILES)
349  ->withMaxFileSize((int) ilFileUtils::getUploadSizeLimitBytes())
350  ->withRequired(true),
351  ]
352  )->withSubmitCaption($this->lng->txt('upload_files'));
353  }
static getUploadSizeLimitBytes()
+ 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 439 of file class.ilObjFileGUI.php.

References ilObject2GUI\$node_id.

439  : void
440  {
441  // this is needed to support multi fileuploads in personal and shared resources
442  $backup_node_id = $this->node_id;
443  parent::putObjectInTree($obj, $parent_node_id);
444  $this->node_id = $backup_node_id;
445  }

◆ render()

ilObjFileGUI::render ( )
protected

This Method is needed if called from personal resources.

See also
executeCommand() line 162

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

References infoScreen().

232  : void
233  {
234  $this->infoScreen();
235  }
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
+ Here is the call graph for this function:

◆ sendFile()

ilObjFileGUI::sendFile ( )

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

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

558  : bool
559  {
560  $hist_entry_id = $this->http->query()->has('hist_id')
561  ? $this->http->query()->retrieve('hist_id', $this->refinery->kindlyTo()->int())
562  : null;
563  try {
564  if (ANONYMOUS_USER_ID === $this->user->getId() && $this->http->query()->has('transaction')) {
565  $this->object->sendFile($hist_entry_id);
566  }
567 
568  if ($this->checkPermissionBool("read")) {
569  // Record read event and catchup with write events
571  $this->object->getType(),
572  $this->object->getRefId(),
573  $this->object->getId(),
574  $this->user->getId()
575  );
576  ilLPStatusWrapper::_updateStatus($this->object->getId(), $this->user->getId());
577 
578  $this->object->sendFile($hist_entry_id);
579  } else {
580  $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
581  }
582  } catch (\ILIAS\Filesystem\Exception\FileNotFoundException $e) {
583  $this->error->raiseError($e->getMessage(), $this->error->MESSAGE);
584  }
585 
586  return true;
587  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
Class ChatMainBarProvider .
static http()
Fetches the global http state from ILIAS.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
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)
Class FlySystemFileAccessTest disabled disabled disabled.
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 731 of file class.ilObjFileGUI.php.

References $DIC, ilLearningProgressAccess\checkAccess(), ilObject2GUI\checkPermissionBool(), ilFileVersionsGUI\CMD_DEFAULT, ILIAS\Repository\ctrl(), ILIAS\Repository\object(), ilObjFile\OBJECT_TYPE, and ilLanguage\txt().

731  : void
732  {
733  global $DIC;
734  $ilTabs = $DIC['ilTabs'];
735  $lng = $DIC['lng'];
736  $ilHelp = $DIC['ilHelp'];
737 
738  $ilHelp->setScreenIdComponent(ilObjFile::OBJECT_TYPE);
739 
740  $this->ctrl->setParameter($this, "ref_id", $this->node_id);
741 
742  if ($this->checkPermissionBool("write")) {
743  $ilTabs->addTab(
744  "id_versions",
745  $lng->txt(self::CMD_VERSIONS),
746  $this->ctrl->getLinkTargetByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_DEFAULT)
747  );
748  }
749 
750  if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read")) {
751  $ilTabs->addTab(
752  "id_info",
753  $lng->txt("info_short"),
754  $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary")
755  );
756  }
757 
758  if ($this->checkPermissionBool("write")) {
759  $ilTabs->addTab(
760  "settings",
761  $lng->txt("settings"),
762  $this->ctrl->getLinkTarget($this, self::CMD_EDIT)
763  );
764  }
765 
766  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
767  $ilTabs->addTab(
768  'learning_progress',
769  $lng->txt('learning_progress'),
770  $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'), '')
771  );
772  }
773 
774  // meta data
775  if ($this->checkPermissionBool("write")) {
776  $mdgui = new ilObjectMetaDataGUI($this->object);
777  $mdtab = $mdgui->getTab();
778  if ($mdtab) {
779  $ilTabs->addTab(
780  "id_meta",
781  $lng->txt("meta_data"),
782  $mdtab
783  );
784  }
785  }
786 
787  // export
788  if ($this->checkPermissionBool("write")) {
789  $ilTabs->addTab(
790  "export",
791  $lng->txt("export"),
792  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
793  );
794  }
795 
796  // will add permission tab if needed
797  parent::setTabs();
798  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 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
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
+ Here is the call graph for this function:

◆ unzipCurrentRevision()

ilObjFileGUI::unzipCurrentRevision ( )

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

References ilFileVersionsGUI\CMD_UNZIP_CURRENT_REVISION, and ILIAS\Repository\ctrl().

597  : void
598  {
599  $this->ctrl->redirectByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_UNZIP_CURRENT_REVISION);
600  }
+ Here is the call graph for this function:

◆ update()

ilObjFileGUI::update ( )

updates object entry in object_data

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

References ilObjectGUI\$data, $DIC, $filename, $ilUser, ilChangeEvent\_catchupWriteEvents(), ilChangeEvent\_recordWriteEvent(), ILIAS\Repository\ctrl(), initPropertiesForm(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilUtil\redirect().

450  : void
451  {
452  global $DIC;
453  $ilTabs = $DIC['ilTabs'];
454 
455  $form = $this->initPropertiesForm();
456  if (!$form->checkInput()) {
457  $ilTabs->activateTab("settings");
458  $form->setValuesByPost();
459  $this->tpl->setContent($form->getHTML());
460 
461  return;
462  }
463 
464  $title = $form->getInput('title');
465  // bugfix mantis 26045:
466  $filename = $this->object->getFileName();
467  if (trim($title) === '') {
468  $title = $filename;
469  }
470  $title = $this->object->appendSuffixToTitle($title, $filename);
471 
472  $this->object->handleChangedObjectTitle($title);
473  $this->object->setDescription($form->getInput('description'));
474  $this->object->setRating($form->getInput('rating'));
475 
476  $this->object->update();
477  $this->obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
478 
479  // BEGIN ChangeEvent: Record update event.
480  if (!empty($data["name"])) {
481  global $DIC;
482  $ilUser = $DIC['ilUser'];
483  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
484  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
485  }
486  // END ChangeEvent: Record update event.
487 
488  // Update ecs export settings
489  $ecs = new ilECSFileSettings($this->object);
490  $ecs->handleSettingsUpdate();
491 
492  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
493  ilUtil::redirect($this->ctrl->getLinkTarget($this, self::CMD_EDIT, '', false, false));
494  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
$filename
Definition: buildRTE.php:78
static redirect(string $a_script)
$ilUser
Definition: imgupload.php:34
static _catchupWriteEvents(int $obj_id, int $usr_id, ?string $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
+ 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 358 of file class.ilObjFileGUI.php.

References $errors, ilLink\_getLink(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initUploadForm(), ILIAS\Repository\lng(), ilObjFileProcessorInterface\OPTION_DESCRIPTION, ilObjFileProcessorInterface\OPTION_FILENAME, ILIAS\Repository\refinery(), and ILIAS\Repository\ui().

358  : void
359  {
360  $origin = ($this->http->query()->has(self::PARAM_UPLOAD_ORIGIN)) ?
361  $this->http->query()->retrieve(
362  self::PARAM_UPLOAD_ORIGIN,
363  $this->refinery->kindlyTo()->string()
364  ) : self::UPLOAD_ORIGIN_STANDARD;
365 
366  if (self::UPLOAD_ORIGIN_DROPZONE === $origin) {
367  $dropzone = new ilObjFileUploadDropzone($this->parent_id);
368  $dropzone = $dropzone->getDropzone()->withRequest($this->request);
369  $files = $dropzone->getData()[self::PARAM_FILES] ?? null;
370  ;
371  } else {
372  $form = $this->initUploadForm()->withRequest($this->request);
373  $files = $form->getData()[self::PARAM_FILES] ?? null;
374  }
375 
376  if (empty($files)) {
377  $form = $this->initUploadForm()->withRequest($this->request);
378  $this->tpl->setContent($this->ui->renderer()->render($form));
379  return;
380  }
381 
382  $processor = new ilObjFileProcessor(
383  $this->stakeholder,
384  $this,
385  $this->storage,
386  $this->file_service_settings
387  );
388 
389  $errors = false;
390  foreach ($files as $file_data) {
391  $rid = $this->storage->manage()->find($file_data[$this->upload_handler->getFileIdentifierParameterName()]);
392  if (null !== $rid) {
393  try {
394  $processor->process($rid, [
397  ]);
398  } catch (Throwable $t) {
399  $errors = true;
400  if (null !== $this->log) {
401  $this->log->error($t->getMessage() . ": " . $t->getTraceAsString());
402  }
403  }
404  }
405  }
406 
407  if ($errors) {
408  $this->ui->mainTemplate()->setOnScreenMessage(
409  'failure',
410  $this->lng->txt('could_not_create_file_objs'),
411  true
412  );
413  }
414 
415  if ($processor->getInvalidFileNames() !== []) {
416  $this->ui->mainTemplate()->setOnScreenMessage(
417  'info',
418  sprintf(
419  $this->lng->txt('file_upload_info_file_with_critical_extension'),
420  implode(', ', $processor->getInvalidFileNames())
421  ),
422  true
423  );
424  }
425 
426  switch ($this->id_type) {
427  case self::WORKSPACE_NODE_ID:
428  $link = $this->ctrl->getLinkTargetByClass(ilObjWorkspaceRootFolderGUI::class);
429  break;
430  case self::REPOSITORY_NODE_ID:
431  default:
432  $link = ilLink::_getLink($this->requested_ref_id);
433  break;
434  }
435 
436  $this->ctrl->redirectToURL($link);
437  }
$errors
Definition: imgupload.php:65
Class ilObjFileProcessorInterface.
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ versions()

ilObjFileGUI::versions ( )
Deprecated:

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

References ILIAS\Repository\ctrl().

592  : void
593  {
594  $this->ctrl->redirectByClass(ilFileVersionsGUI::class);
595  }
+ Here is the call graph for this function:

Field Documentation

◆ $file_service_settings

ilFileServicesSettings ilObjFileGUI::$file_service_settings
protected

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

◆ $http

ILIAS HTTP Wrapper WrapperFactory ilObjFileGUI::$http
protected

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

◆ $lng

ilLanguage ilObjFileGUI::$lng

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

◆ $log

ilLogger ilObjFileGUI::$log = null
protected

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

◆ $obj_service

ilObjectService ilObjFileGUI::$obj_service
protected

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

◆ $object

ilObject ilObjFileGUI::$object = null

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

Referenced by getParentId().

◆ $refinery

ILIAS Refinery Factory ilObjFileGUI::$refinery
protected

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

◆ $stakeholder

ResourceStakeholder ilObjFileGUI::$stakeholder
protected

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

◆ $storage

Services ilObjFileGUI::$storage
protected

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

◆ $ui

UIServices ilObjFileGUI::$ui
protected

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

◆ $upload_handler

UploadHandler ilObjFileGUI::$upload_handler
protected

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

◆ CMD_EDIT

const ilObjFileGUI::CMD_EDIT = "edit"

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

◆ CMD_UPLOAD_FILES

const ilObjFileGUI::CMD_UPLOAD_FILES = "uploadFiles"

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

Referenced by ilObjFileUploadDropzone\__construct().

◆ CMD_VERSIONS

const ilObjFileGUI::CMD_VERSIONS = "versions"

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

◆ PARAM_FILES

const ilObjFileGUI::PARAM_FILES = 0

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

◆ PARAM_UPLOAD_ORIGIN

const ilObjFileGUI::PARAM_UPLOAD_ORIGIN = 'origin'

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

Referenced by ilObjFileUploadDropzone\__construct().

◆ UPLOAD_MAX_FILES

const ilObjFileGUI::UPLOAD_MAX_FILES = 100

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

Referenced by ilObjFileUploadDropzone\__construct().

◆ UPLOAD_ORIGIN_DROPZONE

const ilObjFileGUI::UPLOAD_ORIGIN_DROPZONE = 'dropzone'

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

Referenced by ilObjFileUploadDropzone\__construct().

◆ UPLOAD_ORIGIN_STANDARD

const ilObjFileGUI::UPLOAD_ORIGIN_STANDARD = 'standard'

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


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