ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjMediaObjectGUI Class Reference

Editing User Interface for MediaObjects within LMs (see ILIAS DTD) More...

+ Inheritance diagram for ilObjMediaObjectGUI:
+ Collaboration diagram for ilObjMediaObjectGUI:

Public Member Functions

 __construct ( $a_data, int $a_id=0, bool $a_call_by_reference=false, bool $a_prepare_output=false)
 
 setAdvMdRecordObject (int $a_adv_ref_id, string $a_adv_type, string $a_adv_subtype="-")
 Set object, that defines the adv md records being used. More...
 
 getAdvMdRecordObject ()
 Get adv md record type. More...
 
 setHeader (string $a_title="")
 
 getHeader ()
 
 setEnabledMapAreas (bool $a_enabledmapareas)
 
 getEnabledMapAreas ()
 
 setWidthPreset (int $a_val)
 Set width preset (e.g. More...
 
 getWidthPreset ()
 
 setHeightPreset (int $a_val)
 Set height preset (e.g. More...
 
 getHeightPreset ()
 
 getForm ()
 
 returnToContextObject ()
 
 setBackTitle (string $a_title)
 
 createObject ()
 
 initForm (string $a_mode="create")
 
 getValues ()
 Get values for form. More...
 
 saveObject ()
 create new media object More...
 
 checkFormInput ()
 
 setObjectPerCreationForm (ilObjMediaObject $a_mob)
 Set media object values from creation form. More...
 
 cancelObject ()
 Cancel saving. More...
 
 editObject ()
 
 resizeImagesObject ()
 resize images to specified size More...
 
 getStandardSizeObject ()
 set original size of standard file More...
 
 getFullscreenSizeObject ()
 set original size of fullscreen file More...
 
 savePropertiesObject ()
 
 assignStandardObject (string $a_file)
 assign file to standard view More...
 
 assignFullscreenObject (string $a_file)
 assign file to fullscreen view More...
 
 removeFullscreenObject ()
 remove fullscreen view More...
 
 addFullscreenObject ()
 add fullscreen view More...
 
 showAllUsagesObject ()
 Show all media object usages (incl history) More...
 
 setTabs ()
 set admin tabs More...
 
 getTabs ()
 
 setPropertiesSubTabs (string $a_active)
 
 uploadSubtitleFileObject ()
 
 confirmSrtDeletionObject ()
 Confirm srt file deletion. More...
 
 deleteSrtFilesObject ()
 Delete srt files. More...
 
 uploadMultipleSubtitleFileFormObject ()
 
 uploadMultipleSubtitleFileObject ()
 
 showMultiSubtitleConfirmationTableObject ()
 List of srt files in zip file. More...
 
 cancelMultiSrtObject ()
 Cancel Multi Feedback. More...
 
 saveMultiSrtObject ()
 Save selected srt files as new srt files. 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 _getMediaInfoHTML (ilObjMediaObject $a_mob)
 get media info as html More...
 
static includePresentationJS (ilGlobalTemplateInterface $a_tpl=null)
 Include media object presentation JS. 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

string $header = ""
 
string $target_script = ""
 
bool $enabledmapareas = true
 
- 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

 assignObject ()
 
 checkFixSize ()
 Check fix size (for map editing hint) More...
 
- 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

ilFileServicesSettings $file_service_settings
 
SubtitlesGUIRequest $sub_title_request
 
ilPropertyFormGUI $form_gui
 
int $height_preset = 0
 
int $width_preset = 0
 
string $back_title = ""
 
ilErrorHandling $error
 
ilHelpGUI $help
 
ilTabsGUI $tabs
 
int $adv_ref_id = null
 
string $adv_type = null
 
string $adv_subtype = null
 
ILIAS MediaObjects MediaType MediaTypeManager $media_type
 
- 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

Editing User Interface for MediaObjects within LMs (see ILIAS DTD)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilObjMediaObjectGUI: ilObjectMetaDataGUI, ilImageMapEditorGUI, ilFileSystemGUI

Definition at line 27 of file class.ilObjMediaObjectGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaObjectGUI::__construct (   $a_data,
int  $a_id = 0,
bool  $a_call_by_reference = false,
bool  $a_prepare_output = false 
)
Parameters
mixed$data

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

References $DIC, ilObjectGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilLanguage\loadLanguageModule(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

58  {
59  global $DIC;
60 
61  $this->access = $DIC->access();
62  $this->error = $DIC["ilErr"];
63  $this->help = $DIC["ilHelp"];
64  $this->tabs = $DIC->tabs();
65  $this->toolbar = $DIC->toolbar();
66  $this->user = $DIC->user();
67  $lng = $DIC->language();
68  $ilCtrl = $DIC->ctrl();
69  $this->media_type = $DIC->mediaObjects()
70  ->internal()
71  ->domain()
72  ->mediaType();
73 
74  $this->ctrl = $ilCtrl;
75  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
76  $this->lng = $lng;
77  $this->back_title = "";
78  $this->type = "mob";
79 
80  $this->sub_title_request = $DIC->mediaObjects()
81  ->internal()
82  ->gui()
83  ->subTitles()
84  ->request();
85 
86  $lng->loadLanguageModule("mob");
87  $this->file_service_settings = $DIC->fileServiceSettings();
88  }
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
ilLanguage $lng
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getMediaInfoHTML()

static ilObjMediaObjectGUI::_getMediaInfoHTML ( ilObjMediaObject  $a_mob)
static

get media info as html

Definition at line 1382 of file class.ilObjMediaObjectGUI.php.

References $DIC, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilObjectGUI\$type, ilObjMediaObject\_getDirectory(), ilGlobalTemplateInterface\get(), ilObjMediaObject\getMediaItem(), ilObjMediaObject\hasFullscreenItem(), ilMDKeyword\lookupKeywords(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), ilGlobalTemplateInterface\setVariable(), and ilLanguage\txt().

Referenced by ilClipboardTableGUI\fillRow(), and ilMediaPoolTableGUI\fillRow().

1384  : string {
1385  global $DIC;
1386 
1387  $lng = $DIC->language();
1388 
1389  $tpl = new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
1390  $types = array("Standard", "Fullscreen");
1391  foreach ($types as $type) {
1392  if ($type == "Fullscreen" && !$a_mob->hasFullscreenItem()) {
1393  continue;
1394  }
1395 
1396  $med = $a_mob->getMediaItem($type);
1397  if (!$med) {
1398  return "";
1399  }
1400 
1401  $tpl->setCurrentBlock("media_info");
1402  if ($type == "Standard") {
1403  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1404  } else {
1405  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1406  }
1407  $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
1408  $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1409  if ($med->getLocationType() == "LocalFile") {
1410  $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
1411  if (is_file($file)) {
1412  $size = filesize($file);
1413  } else {
1414  $size = 0;
1415  }
1416  $tpl->setVariable("VAL_FILE_SIZE", " ($size " . $lng->txt("bytes") . ")");
1417  }
1418  $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1419  $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1420  if ($med->getWidth() != "" && $med->getHeight() != "") {
1421  $tpl->setCurrentBlock("size");
1422  $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1423  $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
1425  }
1426 
1427  // original size
1428  if ($orig_size = $med->getOriginalSize()) {
1429  if (($orig_size["width"] ?? "") !== $med->getWidth() ||
1430  ($orig_size["height"] ?? "") !== $med->getHeight()) {
1431  $tpl->setCurrentBlock("orig_size");
1432  $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1433  $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1434  $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1436  }
1437  }
1438 
1439  // output caption
1440  if (strlen($med->getCaption())) {
1441  $tpl->setCurrentBlock('additional_info');
1442  $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
1444  }
1445 
1446  // output keywords
1447  if ($type == "Standard") {
1448  if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) {
1449  $tpl->setCurrentBlock('additional_info');
1450  $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws));
1452  }
1453  }
1454 
1455  $tpl->setCurrentBlock("media_info");
1457  }
1458 
1459  return $tpl->get();
1460  }
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...
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.
global $DIC
Definition: feed.php:28
ilLanguage $lng
static _getDirectory(int $a_mob_id)
Get absolute directory.
ilGlobalTemplateInterface $tpl
getMediaItem(string $a_purpose)
get item for media purpose
static lookupKeywords(int $a_rbac_id, int $a_obj_id, bool $a_return_ids=false)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFullscreenObject()

ilObjMediaObjectGUI::addFullscreenObject ( )

add fullscreen view

Definition at line 1306 of file class.ilObjMediaObjectGUI.php.

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

1306  : void
1307  {
1308  if (!$this->object->hasFullscreenItem()) {
1309  $std_item = $this->object->getMediaItem("Standard");
1310  $full_item = new ilMediaItem();
1311  $full_item->setMobId($std_item->getMobId());
1312  $full_item->setLocation($std_item->getLocation());
1313  $full_item->setLocationType($std_item->getLocationType());
1314  $full_item->setFormat($std_item->getFormat());
1315  $full_item->setWidth($std_item->getWidth());
1316  $full_item->setHeight($std_item->getHeight());
1317  $full_item->setCaption($std_item->getCaption());
1318  $full_item->setTextRepresentation($std_item->getTextRepresentation());
1319  $full_item->setPurpose("Fullscreen");
1320  $this->object->addMediaItem($full_item);
1321 
1322  $this->object->update();
1323  }
1324 
1325  $this->ctrl->redirect($this, "edit");
1326  }
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:

◆ assignFullscreenObject()

ilObjMediaObjectGUI::assignFullscreenObject ( string  $a_file)

assign file to fullscreen view

Definition at line 1251 of file class.ilObjMediaObjectGUI.php.

References $format, $location, ILIAS\Repository\ctrl(), ilObjMediaObject\getMimeType(), ilFileUtils\getWebspaceDir(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

1253  : void {
1254  // determine directory
1255  $cur_subdir = dirname($a_file);
1256  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1257  $cur_dir = (!empty($cur_subdir))
1258  ? $mob_dir . "/" . $cur_subdir
1259  : $mob_dir;
1260  $file = $cur_dir . "/" . basename($a_file);
1261  $location = $a_file;
1262 
1263  if (!is_file($file)) {
1264  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1265  }
1266 
1267  if (!$this->object->hasFullscreenItem()) { // create new fullscreen item
1268  $std_item = $this->object->getMediaItem("Standard");
1269  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1270  $file = $mob_dir . "/" . $location;
1271  $full_item = new ilMediaItem();
1272  $full_item->setMobId($std_item->getMobId());
1273  $full_item->setLocation($location);
1274  $full_item->setLocationType("LocalFile");
1275  $full_item->setFormat(ilObjMediaObject::getMimeType($file));
1276  $full_item->setPurpose("Fullscreen");
1277  $this->object->addMediaItem($full_item);
1278  } else { // alter existing fullscreen item
1279  $full_item = $this->object->getMediaItem("Fullscreen");
1280 
1281  $full_item->setLocationType("LocalFile");
1282  $full_item->setLocation($location);
1284  $full_item->setFormat($format);
1285  }
1286  $this->object->update();
1287  // $this->ctrl->saveParameter($this, "cdir");
1288  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1289  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$format
Definition: metadata.php:235
header include for all ilias files.
+ Here is the call graph for this function:

◆ assignObject()

ilObjMediaObjectGUI::assignObject ( )
protected

Definition at line 171 of file class.ilObjMediaObjectGUI.php.

171  : void
172  {
173  if ($this->id != 0) {
174  $this->object = new ilObjMediaObject($this->id);
175  }
176  }

◆ assignStandardObject()

ilObjMediaObjectGUI::assignStandardObject ( string  $a_file)

assign file to standard view

Definition at line 1221 of file class.ilObjMediaObjectGUI.php.

References $format, $location, ILIAS\Repository\ctrl(), ilObjMediaObject\getMimeType(), ilFileUtils\getWebspaceDir(), and ILIAS\Repository\lng().

1223  : void {
1224  // determine directory
1225  $cur_subdir = dirname($a_file);
1226  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1227  $cur_dir = (!empty($cur_subdir))
1228  ? $mob_dir . "/" . $cur_subdir
1229  : $mob_dir;
1230  $file = $cur_dir . "/" . basename($a_file);
1231  $location = $a_file;
1232 
1233  if (!is_file($file)) {
1234  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1235  }
1236 
1237  $std_item = $this->object->getMediaItem("Standard");
1238  $std_item->setLocationType("LocalFile");
1239  $std_item->setLocation($location);
1241  $std_item->setFormat($format);
1242  $this->object->update();
1243  // $this->ctrl->saveParameter($this, "cdir");
1244  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1245  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
$format
Definition: metadata.php:235
header include for all ilias files.
+ Here is the call graph for this function:

◆ cancelMultiSrtObject()

ilObjMediaObjectGUI::cancelMultiSrtObject ( )

Cancel Multi Feedback.

Definition at line 1760 of file class.ilObjMediaObjectGUI.php.

References ILIAS\Repository\ctrl().

1760  : void
1761  {
1762  $this->object->clearMultiSrtDirectory();
1763  $this->ctrl->redirect($this, "listSubtitleFiles");
1764  }
+ Here is the call graph for this function:

◆ cancelObject()

ilObjMediaObjectGUI::cancelObject ( )

Cancel saving.

Exceptions
ilCtrlException

Definition at line 868 of file class.ilObjMediaObjectGUI.php.

References ILIAS\Repository\ctrl().

868  : void
869  {
870  $this->ctrl->returnToParent($this);
871  }
+ Here is the call graph for this function:

◆ checkFixSize()

ilObjMediaObjectGUI::checkFixSize ( )
protected

Check fix size (for map editing hint)

Definition at line 546 of file class.ilObjMediaObjectGUI.php.

References ILIAS\Repository\lng().

Referenced by returnToContextObject().

546  : void
547  {
548  $std_item = $this->object->getMediaItem("Standard");
549  if ($std_item->getWidth() == "" || $std_item->getHeight() == "") {
550  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("mob_no_fixed_size_map_editing"));
551  }
552  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkFormInput()

ilObjMediaObjectGUI::checkFormInput ( )

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

661  : bool
662  {
663  if (!$this->form_gui->checkInput()) {
664  $this->form_gui->setValuesByPost();
665  return false;
666  }
667  return true;
668  }

◆ confirmSrtDeletionObject()

ilObjMediaObjectGUI::confirmSrtDeletionObject ( )

Confirm srt file deletion.

Definition at line 1669 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, $i, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilLanguage\loadLanguageModule(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

1669  : void
1670  {
1671  $ilCtrl = $this->ctrl;
1672  $tpl = $this->tpl;
1673  $lng = $this->lng;
1674 
1675  $lng->loadLanguageModule("meta");
1676 
1677  $srts = $this->sub_title_request->getSrtFiles();
1678  if (count($srts) == 0) {
1679  $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
1680  $ilCtrl->redirect($this, "listSubtitleFiles");
1681  } else {
1682  $cgui = new ilConfirmationGUI();
1683  $cgui->setFormAction($ilCtrl->getFormAction($this));
1684  $cgui->setHeaderText($lng->txt("mob_really_delete_srt"));
1685  $cgui->setCancel($lng->txt("cancel"), "listSubtitleFiles");
1686  $cgui->setConfirm($lng->txt("delete"), "deleteSrtFiles");
1687 
1688  foreach ($srts as $i) {
1689  $cgui->addItem("srt[]", $i, "subtitle_" . $i . ".srt (" . $lng->txt("meta_l_" . $i) . ")");
1690  }
1691 
1692  $tpl->setContent($cgui->getHTML());
1693  }
1694  }
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...
loadLanguageModule(string $a_module)
Load language module.
ilLanguage $lng
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
$i
Definition: metadata.php:41
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:

◆ createObject()

ilObjMediaObjectGUI::createObject ( )

Definition at line 263 of file class.ilObjMediaObjectGUI.php.

References $help, ilObjectGUI\$tpl, initForm(), ilGlobalTemplateInterface\setContent(), and ilHelpGUI\setScreenId().

263  : void
264  {
265  $tpl = $this->tpl;
266  $ilHelp = $this->help;
267 
268  $ilHelp->setScreenId("create");
269  $this->initForm();
270  $tpl->setContent($this->form_gui->getHTML());
271  }
ilGlobalTemplateInterface $tpl
setScreenId(string $a_id)
setContent(string $a_html)
Sets content for standard template.
initForm(string $a_mode="create")
+ Here is the call graph for this function:

◆ deleteSrtFilesObject()

ilObjMediaObjectGUI::deleteSrtFilesObject ( )

Delete srt files.

Definition at line 1699 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, $i, ilObjectGUI\$lng, ilCtrl\redirect(), and ilLanguage\txt().

1699  : void
1700  {
1701  $lng = $this->lng;
1702  $ilCtrl = $this->ctrl;
1703 
1704  $srts = $this->sub_title_request->getSrtFiles();
1705  foreach ($srts as $i) {
1706  if (strlen($i) == 2 && !is_int(strpos($i, "."))) {
1707  $this->object->removeAdditionalFile("srt/subtitle_" . $i . ".srt");
1708  }
1709  }
1710  $this->tpl->setOnScreenMessage('success', $lng->txt("mob_srt_files_deleted"), true);
1711  $ilCtrl->redirect($this, "listSubtitleFiles");
1712  }
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
ilLanguage $lng
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ editObject()

ilObjMediaObjectGUI::editObject ( )

Definition at line 873 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$tpl, getValues(), initForm(), ilGlobalTemplateInterface\setContent(), and setPropertiesSubTabs().

873  : void
874  {
875  $tpl = $this->tpl;
876 
877  $this->setPropertiesSubTabs("general");
878 
879  $this->initForm("edit");
880  $this->getValues();
881  $tpl->setContent($this->form_gui->getHTML());
882  }
setPropertiesSubTabs(string $a_active)
getValues()
Get values for form.
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
initForm(string $a_mode="create")
+ Here is the call graph for this function:

◆ getAdvMdRecordObject()

ilObjMediaObjectGUI::getAdvMdRecordObject ( )

Get adv md record type.

Exceptions
ilMediaObjectsException

Definition at line 108 of file class.ilObjMediaObjectGUI.php.

References $adv_ref_id, $adv_subtype, and $adv_type.

108  : ?array
109  {
110  if ($this->adv_type == null) {
111  throw new ilMediaObjectsException("Missing obj type (getAdvMdRecordObject)");
112  // seems to be obsolete, since $this->obj_type is non-existent
113  //return [$this->ref_id, $this->obj_type, $this->sub_type];
114  }
116  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getEnabledMapAreas()

ilObjMediaObjectGUI::getEnabledMapAreas ( )

Definition at line 135 of file class.ilObjMediaObjectGUI.php.

References $enabledmapareas.

Referenced by getTabs().

135  : bool
136  {
137  return $this->enabledmapareas;
138  }
+ Here is the caller graph for this function:

◆ getForm()

ilObjMediaObjectGUI::getForm ( )

Definition at line 166 of file class.ilObjMediaObjectGUI.php.

References $form_gui.

167  {
168  return $this->form_gui;
169  }

◆ getFullscreenSizeObject()

ilObjMediaObjectGUI::getFullscreenSizeObject ( )

set original size of fullscreen file

Definition at line 953 of file class.ilObjMediaObjectGUI.php.

References ilObjMediaObject\_getDirectory(), ILIAS\Repository\ctrl(), ilMediaImageUtil\getImageSize(), and ILIAS\Repository\object().

953  : void
954  {
955  $full_item = $this->object->getMediaItem("Fullscreen");
956  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
957 
958  if ($full_item->getLocationType() == "LocalFile") {
959  $file = $mob_dir . "/" . $full_item->getLocation();
960  $size = ilMediaImageUtil::getImageSize($file);
961  $full_item->setWidth($size[0]);
962  $full_item->setHeight($size[1]);
963  $this->object->update();
964  }
965  $this->ctrl->redirect($this, "edit");
966  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getImageSize(string $a_location)
Get image size from location.
+ Here is the call graph for this function:

◆ getHeader()

ilObjMediaObjectGUI::getHeader ( )

Definition at line 124 of file class.ilObjMediaObjectGUI.php.

References $header.

124  : string
125  {
126  return $this->header;
127  }

◆ getHeightPreset()

ilObjMediaObjectGUI::getHeightPreset ( )

Definition at line 161 of file class.ilObjMediaObjectGUI.php.

References $height_preset.

Referenced by initForm().

161  : int
162  {
163  return $this->height_preset;
164  }
+ Here is the caller graph for this function:

◆ getStandardSizeObject()

ilObjMediaObjectGUI::getStandardSizeObject ( )

set original size of standard file

Definition at line 932 of file class.ilObjMediaObjectGUI.php.

References ilObjMediaObject\_getDirectory(), ILIAS\Repository\ctrl(), ilMediaImageUtil\getImageSize(), and ILIAS\Repository\object().

932  : void
933  {
934  $std_item = $this->object->getMediaItem("Standard");
935  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
936 
937  if ($std_item->getLocationType() == "LocalFile") {
938  $file = $mob_dir . "/" . $std_item->getLocation();
939 
940  $size = ilMediaImageUtil::getImageSize($file);
941 
942  $std_item->setWidth($size[0]);
943  $std_item->setHeight($size[1]);
944  $this->object->update();
945  }
946  $this->ctrl->redirect($this, "edit");
947  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getImageSize(string $a_location)
Get image size from location.
+ Here is the call graph for this function:

◆ getTabs()

ilObjMediaObjectGUI::getTabs ( )

Definition at line 1481 of file class.ilObjMediaObjectGUI.php.

References $format, $help, ILIAS\Repository\ctrl(), getEnabledMapAreas(), ilObjectMetaDataGUI\getTab(), ILIAS\Repository\object(), and ilHelpGUI\setScreenIdComponent().

Referenced by setTabs().

1481  : void
1482  {
1483  $ilHelp = $this->help;
1484 
1485  $ilHelp->setScreenIdComponent("mob");
1486 
1487  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1488  && $this->object->getId() > 0) {
1489  // object properties
1490  $this->tabs_gui->addTarget(
1491  "cont_mob_def_prop",
1492  $this->ctrl->getLinkTarget($this, "edit"),
1493  "edit",
1494  get_class($this)
1495  );
1496 
1497  $st_item = $this->object->getMediaItem("Standard");
1498 
1499  // link areas
1500 
1501  if (is_object($st_item) && $this->getEnabledMapAreas()) {
1502  $format = $st_item->getFormat();
1503  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg"))) {
1504  $this->tabs_gui->addTarget(
1505  "cont_def_map_areas",
1506  $this->ctrl->getLinkTargetByClass(
1507  array("ilobjmediaobjectgui", "ilimagemapeditorgui"),
1508  "editMapAreas"
1509  ),
1510  "editMapAreas",
1511  "ilimagemapeditorgui"
1512  );
1513  }
1514  }
1515 
1516  // object usages
1517  $this->tabs_gui->addTarget(
1518  "cont_mob_usages",
1519  $this->ctrl->getLinkTarget($this, "showUsages"),
1520  "showUsages",
1521  get_class($this)
1522  );
1523 
1524  // object files
1525  $std_item = $this->object->getMediaItem("Standard");
1526  $full_item = $this->object->getMediaItem("Fullscreen");
1527  $mset = new ilSetting("mobs");
1528  if ($mset->get("file_manager_always") ||
1529  ($this->media_type->usesParameterProperty($std_item->getFormat()) ||
1530  (is_object($full_item) && $this->media_type->usesParameterProperty($full_item->getFormat())))
1531  ) {
1532  $this->tabs_gui->addTarget(
1533  "cont_files",
1534  $this->ctrl->getLinkTargetByClass(
1535  array("ilobjmediaobjectgui", "ilfilesystemgui"),
1536  "listFiles"
1537  ),
1538  "",
1539  "ilfilesystemgui"
1540  );
1541  }
1542 
1543  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1544  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1545  if ($mdtab) {
1546  $this->tabs_gui->addTarget(
1547  "meta_data",
1548  $mdtab,
1549  "",
1550  "ilmdeditorgui"
1551  );
1552  }
1553  }
1554 
1555  // back to upper context
1556  if ($this->back_title != "") {
1557  $this->tabs_gui->setBackTarget(
1558  $this->back_title,
1559  $this->ctrl->getParentReturn($this)
1560  );
1561  }
1562  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setScreenIdComponent(string $a_comp)
$format
Definition: metadata.php:235
getTab(string $base_class=null)
Get tab link if available.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValues()

ilObjMediaObjectGUI::getValues ( )

Get values for form.

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

References ILIAS\Repository\object().

Referenced by editObject().

558  : void
559  {
560  $values = array();
561 
562  $values["standard_title"] = $this->object->getTitle();
563 
564  $std_item = $this->object->getMediaItem("Standard");
565  if ($std_item->getLocationType() == "LocalFile") {
566  $values["standard_type"] = "File";
567  $values["standard_file"] = $std_item->getLocation();
568  } else {
569  $values["standard_type"] = "Reference";
570  $values["standard_reference"] = $std_item->getLocation();
571  }
572  $values["standard_format"] = $std_item->getFormat();
573  $values["standard_width_height"]["width"] = $std_item->getWidth();
574  $values["standard_width_height"]["height"] = $std_item->getHeight();
575  $values["standard_width_height"]["constr_prop"] = true;
576 
577  $values["standard_size"] = "selected";
578 
579  $orig_size = $std_item->getOriginalSize();
580  if ($std_item->getWidth() == "" && $std_item->getHeight() == "") {
581  $values["standard_size"] = "original";
582  $values["standard_width_height"]["width"] = $orig_size["width"] ?? "";
583  $values["standard_width_height"]["height"] = $orig_size["height"] ?? "";
584  }
585 
586  $values["standard_caption"] = $std_item->getCaption();
587  $values["text_representation"] = $std_item->getTextRepresentation();
588  if ($this->media_type->usesAutoStartParameterOnly(
589  $std_item->getLocation(),
590  $std_item->getFormat()
591  )) {
592  /*$par = $std_item->getParameters();
593  if ($par["autostart"]) {
594  $values["standard_autostart"] = true;
595  }*/
596  } else {
597  $values["standard_parameters"] = $std_item->getParameterString();
598  }
599 
600  $values["full_type"] = "None";
601  $values["full_size"] = "original";
602  if ($this->object->hasFullscreenItem()) {
603  $full_item = $this->object->getMediaItem("Fullscreen");
604  if ($full_item->getLocationType() == "LocalFile") {
605  $values["full_type"] = "File";
606  $values["full_file"] = $full_item->getLocation();
607  } else {
608  $values["full_type"] = "Reference";
609  $values["full_reference"] = $full_item->getLocation();
610  }
611  $values["full_format"] = $full_item->getFormat();
612  $values["full_width_height"]["width"] = $full_item->getWidth();
613  $values["full_width_height"]["height"] = $full_item->getHeight();
614  $values["full_width_height"]["constr_prop"] = true;
615 
616  $values["full_size"] = "selected";
617 
618  $orig_size = $full_item->getOriginalSize();
619  if ($full_item->getWidth() == "" &&
620  $full_item->getHeight() == "") {
621  $values["full_size"] = "original";
622  $values["full_width_height"]["width"] = $orig_size["width"] ?? "";
623  $values["full_width_height"]["height"] = $orig_size["height"] ?? "";
624  }
625  $values["full_caption"] = $full_item->getCaption();
626  if ($this->media_type->usesAutoStartParameterOnly(
627  $full_item->getLocation(),
628  $full_item->getFormat()
629  )) {
630  /*$par = $full_item->getParameters();
631  if ($par["autostart"]) {
632  $values["full_autostart"] = true;
633  }*/
634  } else {
635  $values["full_parameters"] = $full_item->getParameterString();
636  }
637  $values["full_text_representation"] = $full_item->getTextRepresentation();
638  }
639 
640  $this->form_gui->setValuesByArray($values);
641  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWidthPreset()

ilObjMediaObjectGUI::getWidthPreset ( )

Definition at line 148 of file class.ilObjMediaObjectGUI.php.

References $width_preset.

Referenced by initForm().

148  : int
149  {
150  return $this->width_preset;
151  }
+ Here is the caller graph for this function:

◆ includePresentationJS()

static ilObjMediaObjectGUI::includePresentationJS ( ilGlobalTemplateInterface  $a_tpl = null)
static

Include media object presentation JS.

Definition at line 1567 of file class.ilObjMediaObjectGUI.php.

References $DIC, ilObjectGUI\$tpl, iljQueryUtil\getLocalMaphilightPath(), iljQueryUtil\initjQuery(), and ilPlayerUtil\initMediaElementJs().

Referenced by ilPageObjectGUI\displayMedia(), ilImageMapEditorGUI\executeCommand(), ilObjMediaPoolGUI\getPreviewModalHTML(), ilLMPresentationGUI\ilMedia(), ilObjMediaPoolGUI\showMedia(), and ilPageObjectGUI\showPage().

1569  : void {
1570  global $DIC;
1571 
1572  $tpl = $DIC["tpl"];
1573 
1574  if ($a_tpl == null) {
1575  $a_tpl = $tpl;
1576  }
1577 
1578  iljQueryUtil::initjQuery($a_tpl);
1580  $a_tpl->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1581 
1583  }
global $DIC
Definition: feed.php:28
ilGlobalTemplateInterface $tpl
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static getLocalMaphilightPath()
Get local path of maphilight file.
static initMediaElementJs(ilGlobalTemplateInterface $a_tpl=null)
Init mediaelement.js scripts.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilObjMediaObjectGUI::initForm ( string  $a_mode = "create")

Definition at line 273 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, $format, ilObjectGUI\$lng, ilSubEnabledFormPropertyGUI\addSubItem(), ilRadioOption\addSubItem(), ilObjMediaObject\getForbiddenFileTypes(), getHeightPreset(), ilObjMediaObject\getRestrictedFileTypes(), getWidthPreset(), ILIAS\Repository\object(), ilTextAreaInputGUI\setCols(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilTextAreaInputGUI\setRows(), ilWidthHeightInputGUI\setSupportConstraintsProps(), and ilLanguage\txt().

Referenced by createObject(), editObject(), saveObject(), and savePropertiesObject().

273  : void
274  {
275  $lng = $this->lng;
276  $ilCtrl = $this->ctrl;
277  $add_str = "";
278 
279  $std_item = null;
280  $full_item = null;
281  if ($a_mode == "edit") {
282  $std_item = $this->object->getMediaItem("Standard");
283  }
284 
285  $this->form_gui = new ilPropertyFormGUI();
286 
287  // standard view resource
288  $title = new ilTextInputGUI($lng->txt("title"), "standard_title");
289  $title->setSize(40);
290  $title->setMaxLength(120);
291  $this->form_gui->addItem($title);
292  $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "standard_type");
293  $op1 = new ilRadioOption($lng->txt("cont_file"), "File");
294  $up = new ilFileInputGUI("", "standard_file");
295  $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
296  $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
297  $up->setInfo("");
298  if ($a_mode == "create" || $std_item->getLocationType() != "LocalFile") {
299  $up->setRequired(true);
300  }
301  $op1->addSubItem($up);
302  $radio_prop->addOption($op1);
303  $op2 = new ilRadioOption($lng->txt("url"), "Reference");
304  $ref = new ilUriInputGUI("", "standard_reference");
305  $ref->setInfo($lng->txt("cont_ref_helptext"));
306  $ref->setRequired(true);
307  $op2->addSubItem($ref);
308  $radio_prop->addOption($op2);
309  $radio_prop->setValue("File");
310  $this->form_gui->addItem($radio_prop);
311 
312  // standard format
313  if ($a_mode == "edit") {
314  $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "standard_format");
315  $format->setValue($std_item->getFormat());
316  $this->form_gui->addItem($format);
317  }
318 
319  // standard size
320  $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "standard_size");
321  if ($a_mode == "edit") {
322  if ($orig_size = $std_item->getOriginalSize()) {
323  $add_str = " (" . ($orig_size["width"] ?? "") . " x " . ($orig_size["height"] ?? "") . ")";
324  }
325  $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
326  $op1->setInfo($lng->txt("cont_resource_size_info"));
327  $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
328  } else {
329  $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
330  $op1->setInfo($lng->txt("cont_resource_size_info"));
331  $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
332  }
333  $radio_size->addOption($op1);
334 
335  // width height
336  $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") .
337  " / " . $lng->txt("cont_height"), "standard_width_height");
338  if ($a_mode == "edit" && is_int(strpos($std_item->getFormat(), "image"))
339  && $std_item->getLocationType() == "LocalFile") {
340  $width_height->setSupportConstraintsProps(true);
341  $width_height->setConstrainProportions(true);
342  }
343  $op2->addSubItem($width_height);
344 
345  // resize image
346  if ($a_mode == "edit") {
347  $std_item = $this->object->getMediaItem("Standard");
348  if (is_int(strpos($std_item->getFormat(), "image"))
349  && $std_item->getLocationType() == "LocalFile") {
350  $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"), "standard_resize");
351  $op2->addSubItem($resize);
352  }
353  }
354 
355  $radio_size->setValue("original");
356  if ($a_mode == "create" && ($this->getHeightPreset() > 0 || $this->getWidthPreset() > 0)) {
357  $radio_size->setValue("selected");
358  $width_height->setWidth($this->getWidthPreset());
359  $width_height->setHeight($this->getHeightPreset());
360  }
361  $radio_size->addOption($op2);
362  $this->form_gui->addItem($radio_size);
363 
364  // standard caption
365  $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "standard_caption");
366  $caption->setCols(30);
367  $caption->setRows(2);
368  $this->form_gui->addItem($caption);
369 
370  /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "standard_caption");
371  $caption->setSize(40);
372  $caption->setMaxLength(200);
373  $this->form_gui->addItem($caption);*/
374 
375  // text representation (alt text)
376  if ($a_mode == "edit" && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
377  $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "text_representation");
378  $ta->setCols(30);
379  $ta->setRows(2);
380  $ta->setInfo($lng->txt("text_repr_info"));
381  $this->form_gui->addItem($ta);
382  }
383 
384  // standard parameters
385  if ($a_mode == "edit" &&
386  $this->media_type->usesParameterProperty($std_item->getFormat())) {
387  if ($this->media_type->usesAutoStartParameterOnly(
388  $std_item->getLocation(),
389  $std_item->getFormat()
390  )) { // autostart
391  /*$auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "standard_autostart");
392  $this->form_gui->addItem($auto);*/
393  } else { // parameters
394  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "standard_parameters");
395  $par->setRows(5);
396  $par->setCols(50);
397  $this->form_gui->addItem($par);
398  }
399  }
400 
401  if ($a_mode == "edit") {
402  $full_item = $this->object->getMediaItem("Fullscreen");
403  }
404 
405  // fullscreen view resource
406  $fs_sec = new ilFormSectionHeaderGUI();
407  $fs_sec->setTitle($lng->txt("cont_fullscreen"));
408  $this->form_gui->addItem($fs_sec);
409 
410  $radio_prop2 = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "full_type");
411  $op1 = new ilRadioOption($lng->txt("cont_none"), "None");
412  $radio_prop2->addOption($op1);
413  $op4 = new ilRadioOption($lng->txt("cont_use_same_resource_as_above"), "Standard");
414  $radio_prop2->addOption($op4);
415  $op2 = new ilRadioOption($lng->txt("cont_file"), "File");
416  $up = new ilFileInputGUI("", "full_file");
417  $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
418  $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
419  $up->setInfo("");
420  if ($a_mode == "create" || !$full_item || $full_item->getLocationType() != "LocalFile") {
421  $up->setRequired(true);
422  }
423  $op2->addSubItem($up);
424  $radio_prop2->addOption($op2);
425  $op3 = new ilRadioOption($lng->txt("url"), "Reference");
426  $ref = new ilUriInputGUI("", "full_reference");
427  $ref->setInfo($lng->txt("cont_ref_helptext"));
428  $ref->setRequired(true);
429  $op3->addSubItem($ref);
430  $radio_prop2->addOption($op3);
431  $radio_prop2->setValue("None");
432  $this->form_gui->addItem($radio_prop2);
433 
434  // fullscreen format
435  if ($a_mode == "edit") {
436  if ($this->object->hasFullscreenItem()) {
437  $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "full_format");
438  $format->setValue($full_item->getFormat());
439  $this->form_gui->addItem($format);
440  }
441  }
442 
443  // fullscreen size
444  $full_support_constraint_props = false;
445  $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_size");
446  if ($a_mode == "edit") {
447  $add_str = "";
448  if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
449  $add_str = " (" . ($orig_size["width"] ?? "") . " x " . ($orig_size["height"] ?? "") . ")";
450 
451  if (is_int(strpos($full_item->getFormat(), "image"))
452  && $full_item->getLocationType() == "LocalFile") {
453  $full_support_constraint_props = true;
454  }
455  }
456  $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
457  $op1->setInfo($lng->txt("cont_resource_size_info"));
458  $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
459  } else {
460  $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
461  $op1->setInfo($lng->txt("cont_resource_size_info"));
462  $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
463  }
464  $radio_size->addOption($op1);
465 
466  // width/height
467  $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") .
468  " / " . $lng->txt("cont_height"), "full_width_height");
469  if ($full_support_constraint_props) {
470  $width_height->setSupportConstraintsProps(true);
471  $width_height->setConstrainProportions(true);
472  }
473  $op2->addSubItem($width_height);
474 
475  // resize image
476  if ($a_mode == "edit") {
477  $full_item = $this->object->getMediaItem("Fullscreen");
478  if ($this->object->hasFullscreenItem() &&
479  is_int(strpos($full_item->getFormat(), "image")) &&
480  $full_item->getLocationType() == "LocalFile") {
481  $resize = new ilCheckboxInputGUI(
482  $lng->txt("cont_resize_img"),
483  "full_resize"
484  );
485  $op2->addSubItem($resize);
486  }
487  }
488 
489  $radio_size->setValue("original");
490  $radio_size->addOption($op2);
491  $this->form_gui->addItem($radio_size);
492 
493  // fullscreen caption
494  $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "full_caption");
495  $caption->setCols(30);
496  $caption->setRows(2);
497  $this->form_gui->addItem($caption);
498 
499  /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "full_caption");
500  $caption->setSize(40);
501  $caption->setMaxLength(200);
502  $this->form_gui->addItem($caption);*/
503 
504  // text representation (alt text)
505  if ($a_mode == "edit" && $this->object->hasFullscreenItem() && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
506  $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "full_text_representation");
507  $ta->setCols(30);
508  $ta->setRows(2);
509  $ta->setInfo($lng->txt("text_repr_info"));
510  $this->form_gui->addItem($ta);
511  }
512 
513 
514  // fullscreen parameters
515  if ($a_mode == "edit" && $this->object->hasFullscreenItem() &&
516  $this->media_type->usesParameterProperty($full_item->getFormat())) {
517  if ($this->media_type->usesAutoStartParameterOnly(
518  $full_item->getLocation(),
519  $full_item->getFormat()
520  )) {
521  /*$auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "full_autostart");
522  $this->form_gui->addItem($auto);*/
523  } else {
524  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "full_parameters");
525  $par->setRows(5);
526  $par->setCols(50);
527  $this->form_gui->addItem($par);
528  }
529  }
530 
531 
532  if ($a_mode == "edit") {
533  $this->form_gui->setTitle($lng->txt("cont_edit_mob"));
534  $this->form_gui->addCommandButton("saveProperties", $lng->txt("save"));
535  } else {
536  $this->form_gui->setTitle($lng->txt("cont_insert_mob"));
537  $this->form_gui->addCommandButton("save", $lng->txt("save"));
538  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
539  }
540  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
541  }
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a file property in a property form.
setInfo(string $a_info)
This class represents a checkbox property in a property form.
ilLanguage $lng
This class represents a property in a property form.
Legacy Uri input.
$format
Definition: metadata.php:235
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getForbiddenFileTypes()
Get forbidden file types.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRestrictedFileTypes()
Get restricted file types (this is for the input form, this list will be empty, if "allowed list" is ...
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:

◆ removeFullscreenObject()

ilObjMediaObjectGUI::removeFullscreenObject ( )

remove fullscreen view

Definition at line 1295 of file class.ilObjMediaObjectGUI.php.

References ILIAS\Repository\ctrl().

1295  : void
1296  {
1297  $this->object->removeMediaItem("Fullscreen");
1298  $this->object->update();
1299 
1300  $this->ctrl->redirect($this, "edit");
1301  }
+ Here is the call graph for this function:

◆ resizeImagesObject()

ilObjMediaObjectGUI::resizeImagesObject ( )

resize images to specified size

Definition at line 888 of file class.ilObjMediaObjectGUI.php.

References $location, ilObjMediaObject\_getDirectory(), ilObjMediaObject\_resizeImage(), ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

888  : void
889  {
890  // directory
891  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
892 
893  // standard item
894  $std_item = $this->object->getMediaItem("Standard");
895  if ($std_item->getLocationType() == "LocalFile" &&
896  is_int(strpos($std_item->getFormat(), "image"))
897  ) {
898  $file = $mob_dir . "/" . $std_item->getLocation();
900  $file,
901  $std_item->getWidth(),
902  $std_item->getHeight()
903  );
904  $std_item->setLocation($location);
905  $std_item->update();
906  }
907 
908  // fullscreen item
909  if ($this->object->hasFullscreenItem()) {
910  $full_item = $this->object->getMediaItem("Fullscreen");
911  if ($full_item->getLocationType() == "LocalFile" &&
912  is_int(strpos($full_item->getFormat(), "image"))
913  ) {
914  $file = $mob_dir . "/" . $full_item->getLocation();
916  $file,
917  $full_item->getWidth(),
918  $full_item->getHeight()
919  );
920  $full_item->setLocation($location);
921  $full_item->update();
922  }
923  }
924 
925  $this->ctrl->redirect($this, "edit");
926  }
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static _resizeImage(string $a_file, int $a_width, int $a_height, bool $a_constrain_prop=false)
Resize image and return new image file ("_width_height" string appended)
static _getDirectory(int $a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:

◆ returnToContextObject()

◆ saveMultiSrtObject()

ilObjMediaObjectGUI::saveMultiSrtObject ( )

Save selected srt files as new srt files.

Definition at line 1769 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, Vendor\Package\$f, ILIAS\Repository\object(), and ilCtrl\redirect().

1769  : void
1770  {
1771  $ilCtrl = $this->ctrl;
1772  $srt_files = $this->object->getMultiSrtFiles();
1773  $files = $this->sub_title_request->getFiles();
1774  foreach ($files as $f) {
1775  foreach ($srt_files as $srt_file) {
1776  if ($f == $srt_file["filename"]) {
1777  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir() . "/" . $srt_file["filename"], $srt_file["lang"], "rename");
1778  }
1779  }
1780  }
1781  $this->object->clearMultiSrtDirectory();
1782  $ilCtrl->redirect($this, "listSubtitleFiles");
1783  }
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
+ Here is the call graph for this function:

◆ saveObject()

ilObjMediaObjectGUI::saveObject ( )

create new media object

Definition at line 646 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$lng, ilObjectGUI\$tpl, initForm(), ilGlobalTemplateInterface\setContent(), setObjectPerCreationForm(), and ilLanguage\txt().

646  : void
647  {
648  $tpl = $this->tpl;
649  $lng = $this->lng;
650  $this->initForm();
651  if ($this->form_gui->checkInput()) {
652  $this->object = new ilObjMediaObject();
653  $this->setObjectPerCreationForm($this->object);
654  $this->tpl->setOnScreenMessage('success', $lng->txt("saved_media_object"), true);
655  } else {
656  $this->form_gui->setValuesByPost();
657  $tpl->setContent($this->form_gui->getHTML());
658  }
659  }
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...
setObjectPerCreationForm(ilObjMediaObject $a_mob)
Set media object values from creation form.
ilLanguage $lng
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
initForm(string $a_mode="create")
+ Here is the call graph for this function:

◆ savePropertiesObject()

ilObjMediaObjectGUI::savePropertiesObject ( )

Definition at line 968 of file class.ilObjMediaObjectGUI.php.

References $form_gui, $format, ilObjectGUI\$lng, $location, ilObjectGUI\$tpl, ilObjectGUI\$type, ilObjMediaObject\_determineWidthHeight(), ilObjMediaObject\_getDirectory(), ilObjMediaObject\_resizeImage(), ILIAS\Repository\ctrl(), ilObjMediaObject\fixFilename(), ilObjMediaObject\getMimeType(), initForm(), ILIAS\Repository\int(), ilFileUtils\moveUploadedFile(), ILIAS\Repository\object(), ilObjMediaObject\renameExecutables(), ilMediaSvgSanitizer\sanitizeDir(), ilUtil\secureLink(), ilGlobalTemplateInterface\setContent(), ilPropertyFormGUI\setTitle(), and ilLanguage\txt().

968  : void
969  {
970  $lng = $this->lng;
971  $tpl = $this->tpl;
972  $file = "";
973  $type = "";
974 
975  $this->initForm("edit");
976  $form = $this->form_gui;
977 
978  if ($form->checkInput()) {
979  $title = trim($form->getInput("standard_title"));
980  $this->object->setTitle($title);
981 
982  $std_item = $this->object->getMediaItem("Standard");
983  $location = $std_item->getLocation();
984  $format = $std_item->getFormat();
985  if ($form->getInput("standard_type") == "Reference") {
986  $format = ilObjMediaObject::getMimeType($form->getInput("standard_reference"), true);
987  $std_item->setFormat($format);
988  $std_item->setLocation(ilUtil::secureLink($form->getInput("standard_reference")));
989  $std_item->setLocationType("Reference");
990  }
991  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
992  if ($form->getInput("standard_type") == "File") {
993  $resize = false;
994  if ($_FILES['standard_file']['name'] != "") {
995  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
996  $file = $mob_dir . "/" . $file_name;
998  $_FILES['standard_file']['tmp_name'],
999  $file_name,
1000  $file
1001  );
1002 
1003  // get mime type
1005  $location = $file_name;
1006 
1007  $resize = true;
1008  } elseif ($form->getInput("standard_resize")) {
1009  $file = $mob_dir . "/" . $location;
1010  $resize = true;
1011  }
1012 
1013  // resize
1014  if ($resize) {
1015  if ($form->getInput("standard_size") != "original" &&
1016  is_int(strpos($format, "image"))) {
1017  $wh_input = $form->getInput("standard_width_height");
1019  $file,
1020  (int) $wh_input["width"],
1021  (int) $wh_input["height"],
1022  (bool) ($wh_input["constr_prop"] ?? false)
1023  );
1024  }
1025  $std_item->setFormat($format);
1026  $std_item->setLocation($location);
1027  }
1028 
1029  $std_item->setLocationType("LocalFile");
1030  }
1031  $this->object->setDescription($format);
1032  // determine width and height of known image types
1033  $wh_input = $form->getInput("standard_width_height");
1035  $format,
1036  $form->getInput("standard_type"),
1037  $mob_dir . "/" . $location,
1038  $std_item->getLocation(),
1039  (bool) ($wh_input["constr_prop"] ?? false),
1040  ($form->getInput("standard_size") == "original"),
1041  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
1042  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
1043  );
1044  if ($wh["info"] != "") {
1045  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
1046  }
1047  $std_item->setWidth($wh["width"]);
1048  $std_item->setHeight($wh["height"]);
1049 
1050  // set caption
1051  $std_item->setCaption($form->getInput("standard_caption"));
1052 
1053  // text representation
1054  $std_item->setTextRepresentation($form->getInput("text_representation"));
1055 
1056  // set parameters
1057  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1058  if ($this->media_type->usesAutoStartParameterOnly(
1059  $std_item->getLocation(),
1060  $std_item->getFormat()
1061  )) {
1062  /*
1063  if ($_POST["standard_autostart"]) { // save only autostart flag
1064  $std_item->setParameters('autostart="true"');
1065  } else {
1066  $std_item->setParameters("");
1067  }*/
1068  } else {
1069  $std_item->setParameters(utf8_decode($form->getInput("standard_parameters")));
1070  }
1071  }
1072 
1073  // "None" selected
1074  if ($form->getInput("full_type") == "None") {
1075  if ($this->object->hasFullscreenItem()) { // delete existing
1076  $this->object->removeMediaItem("Fullscreen");
1077  }
1078  } else { // Not "None" -> we need one
1079  if ($this->object->hasFullscreenItem()) { // take existing one
1080  $full_item = $this->object->getMediaItem("Fullscreen");
1081  } else { // create one
1082  $full_item = new ilMediaItem();
1083  $this->object->addMediaItem($full_item);
1084  $full_item->setPurpose("Fullscreen");
1085  }
1086  $location = $full_item->getLocation();
1087  $format = $full_item->getFormat();
1088  if ($form->getInput("full_type") == "Reference") {
1089  $format = ilObjMediaObject::getMimeType($form->getInput("full_reference"), true);
1090  $full_item->setFormat($format);
1091  $full_item->setLocationType("Reference");
1092  $location = ilUtil::secureLink($form->getInput("full_reference"));
1093  $type = "Reference";
1094  $full_item->setLocation($location);
1095  }
1096  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1097  if ($form->getInput("full_type") == "File") {
1098  $resize = false;
1099  if ($_FILES['full_file']['name'] != "") {
1100  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1101  $file = $mob_dir . "/" . $full_file_name;
1103  $_FILES['full_file']['tmp_name'],
1104  $full_file_name,
1105  $file
1106  );
1107 
1109  $location = $full_file_name;
1110 
1111  $resize = true;
1112  } elseif ($form->getInput("full_resize")) {
1113  $file = $mob_dir . "/" . $location;
1114  $resize = true;
1115  }
1116 
1117  // resize
1118  if ($resize) {
1119  if ($form->getInput("full_size") != "original" &&
1120  is_int(strpos($format, "image"))) {
1121  $wh_input = $form->getInput("full_width_height");
1123  $file,
1124  (int) $wh_input["width"],
1125  (int) $wh_input["height"],
1126  (bool) ($wh_input["constr_prop"] ?? false)
1127  );
1128  }
1129  $full_item->setFormat($format);
1130  $full_item->setLocation($location);
1131  }
1132 
1133  $full_item->setLocationType("LocalFile");
1134  $type = "File";
1135  }
1136  if ($form->getInput("full_type") == "Standard") {
1137  $format = $std_item->getFormat();
1138  $location = $std_item->getLocation();
1139  $full_item->setLocationType($std_item->getLocationType());
1140  $full_item->setFormat($format);
1141  $full_item->setLocation($location);
1142  $type = $std_item->getLocationType();
1143  if ($type == "LocalFile") {
1144  $type = "File";
1145  }
1146  // resize image
1147  //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1148  if ($form->getInput("full_size") != "original" &&
1149  is_int(strpos($format, "image")) &&
1150  $full_item->getLocationType() == "LocalFile") {
1151  $file = $mob_dir . "/" . $location;
1152  $wh_input = $form->getInput("full_width_height");
1154  $file,
1155  (int) $wh_input["width"],
1156  (int) $wh_input["height"],
1157  (bool) ($wh_input["constr_prop"] ?? false)
1158  );
1159  }
1160  }
1161 
1162  // determine width and height of known image types
1163  $wh_input = $form->getInput("full_width_height");
1165  $format,
1166  $type,
1167  $mob_dir . "/" . $location,
1168  $full_item->getLocation(),
1169  (bool) ($wh_input["constr_prop"] ?? false),
1170  ($form->getInput("full_size") == "original"),
1171  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
1172  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
1173  );
1174  if ($wh["info"] != "") {
1175  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
1176  }
1177 
1178  $full_item->setWidth($wh["width"]);
1179  $full_item->setHeight($wh["height"]);
1180  $full_item->setLocation($location);
1181 
1182  $full_item->setCaption($form->getInput("full_caption"));
1183 
1184  // text representation
1185  $full_item->setTextRepresentation($form->getInput("full_text_representation"));
1186 
1187 
1188  // set parameters
1189  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1190  if ($this->media_type->usesAutoStartParameterOnly(
1191  $std_item->getLocation(),
1192  $std_item->getFormat()
1193  )) {
1194  /*
1195  if ($_POST["full_autostart"]) { // save only autostart flag
1196  $full_item->setParameters('autostart="true"');
1197  } else {
1198  $full_item->setParameters("");
1199  }*/
1200  } else {
1201  $full_item->setParameters(utf8_decode($form->getInput("full_parameters")));
1202  }
1203  }
1204  }
1205 
1208 
1209  $this->object->update();
1210  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1211  $this->ctrl->redirect($this, "edit");
1212  } else {
1213  $this->form_gui->setValuesByPost();
1214  $tpl->setContent($this->form_gui->getHTML());
1215  }
1216  }
static sanitizeDir(string $a_path)
Sanitize directory recursively.
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...
static _determineWidthHeight(string $a_format, string $a_type, string $a_file, string $a_reference, bool $a_constrain_proportions, bool $a_use_original, ?int $a_user_width=null, ?int $a_user_height=null)
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static _resizeImage(string $a_file, int $a_width, int $a_height, bool $a_constrain_prop=false)
Resize image and return new image file ("_width_height" string appended)
static secureLink(string $a_str)
static renameExecutables(string $a_dir)
ilLanguage $lng
static _getDirectory(int $a_mob_id)
Get absolute directory.
ilGlobalTemplateInterface $tpl
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$format
Definition: metadata.php:235
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
initForm(string $a_mode="create")
static fixFilename(string $a_name)
Fix filename of uploaded file.
+ Here is the call graph for this function:

◆ setAdvMdRecordObject()

ilObjMediaObjectGUI::setAdvMdRecordObject ( int  $a_adv_ref_id,
string  $a_adv_type,
string  $a_adv_subtype = "-" 
)

Set object, that defines the adv md records being used.

Default is $this->object, but the context may set another object (e.g. media pool for media objects)

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

98  : void {
99  $this->adv_ref_id = $a_adv_ref_id;
100  $this->adv_type = $a_adv_type;
101  $this->adv_subtype = $a_adv_subtype;
102  }

◆ setBackTitle()

ilObjMediaObjectGUI::setBackTitle ( string  $a_title)

Definition at line 258 of file class.ilObjMediaObjectGUI.php.

Referenced by ilPCMediaObjectGUI\getEnabledMapAreas().

258  : void
259  {
260  $this->back_title = $a_title;
261  }
+ Here is the caller graph for this function:

◆ setEnabledMapAreas()

ilObjMediaObjectGUI::setEnabledMapAreas ( bool  $a_enabledmapareas)

Definition at line 129 of file class.ilObjMediaObjectGUI.php.

131  : void {
132  $this->enabledmapareas = $a_enabledmapareas;
133  }

◆ setHeader()

ilObjMediaObjectGUI::setHeader ( string  $a_title = "")

Definition at line 118 of file class.ilObjMediaObjectGUI.php.

120  : void {
121  $this->header = $a_title;
122  }

◆ setHeightPreset()

ilObjMediaObjectGUI::setHeightPreset ( int  $a_val)

Set height preset (e.g.

set from media pool)

Definition at line 156 of file class.ilObjMediaObjectGUI.php.

156  : void
157  {
158  $this->height_preset = $a_val;
159  }

◆ setObjectPerCreationForm()

ilObjMediaObjectGUI::setObjectPerCreationForm ( ilObjMediaObject  $a_mob)

Set media object values from creation form.

Definition at line 674 of file class.ilObjMediaObjectGUI.php.

References Vendor\Package\$e, $form_gui, $format, $location, ilObjectGUI\$type, ilObjMediaObject\_determineWidthHeight(), ilObjMediaObject\_getDirectory(), ilObjMediaObject\_resizeImage(), ilObjMediaObject\addMediaItem(), ilObjMediaObject\create(), ilObjMediaObject\createDirectory(), ilObjMediaObject\fixFilename(), ilObjMediaObject\getExternalMetadata(), ilObject\getId(), ilObjMediaObject\getMimeType(), ILIAS\Repository\int(), ilFileUtils\moveUploadedFile(), ilObjMediaObject\renameExecutables(), ilMediaSvgSanitizer\sanitizeDir(), ilUtil\secureLink(), ilObject\setDescription(), ilObject\setTitle(), ilUtil\stripSlashes(), and ilObjMediaObject\update().

Referenced by saveObject().

676  : void {
677  $form = $this->form_gui;
678 
679  $location = "";
680  $file_name = "";
681  $file = "";
682  $type = "";
683 
684  // determinte title and format
685  if (trim($form->getInput("standard_title")) != "") {
686  $title = trim($form->getInput("standard_title"));
687  } else {
688  if ($form->getInput("standard_type") == "File") {
689  $title = $_FILES['standard_file']['name'];
690  } else {
691  $title = $form->getInput("standard_reference");
692  }
693  }
694 
695  $a_mob->setTitle($title);
696  $a_mob->setDescription("");
697  $a_mob->create();
698 
699  // determine and create mob directory, move uploaded file to directory
700  //$mob_dir = ilFileUtils::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
701  $a_mob->createDirectory();
702  $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
703 
704  $media_item = new ilMediaItem();
705  $a_mob->addMediaItem($media_item);
706  $media_item->setPurpose("Standard");
707 
708  if ($form->getInput("standard_type") == "File") {
709  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
710  $file = $mob_dir . "/" . $file_name;
712  $_FILES['standard_file']['tmp_name'],
713  $file_name,
714  $file
715  );
716 
717  // get mime type
719  $location = $file_name;
720 
721  // resize standard images
722  if ($form->getInput("standard_size") != "original" &&
723  is_int(strpos($format, "image"))) {
724  $wh_input = $form->getInput("standard_width_height");
725 
727  $file,
728  (int) $wh_input["width"],
729  (int) $wh_input["height"],
730  (bool) ($wh_input["constr_prop"] ?? false)
731  );
732  }
733 
734  // set real meta and object data
735  $media_item->setFormat($format);
736  $media_item->setLocation($location);
737  $media_item->setLocationType("LocalFile");
738  $a_mob->generatePreviewPic(320, 240);
739  } else { // standard type: reference
740  $format = ilObjMediaObject::getMimeType($form->getInput("standard_reference"), true);
741  $media_item->setFormat($format);
742  $media_item->setLocation(ilUtil::secureLink($form->getInput("standard_reference")));
743  $media_item->setLocationType("Reference");
744 
745  try {
746  $a_mob->getExternalMetadata();
747  } catch (Exception $e) {
748  }
749  }
750 
751  // determine width and height of known image types
752  $wh_input = $form->getInput("standard_width_height");
754  $format,
755  $form->getInput("standard_type"),
756  $mob_dir . "/" . $location,
757  $media_item->getLocation(),
758  (bool) ($wh_input["constr_prop"] ?? false),
759  ($form->getInput("standard_size") == "original"),
760  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
761  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
762  );
763  $media_item->setWidth($wh["width"]);
764  $media_item->setHeight($wh["height"]);
765  if ($wh["info"] != "") {
766  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
767  }
768 
769  if ($form->getInput("standard_caption") != "") {
770  $media_item->setCaption($form->getInput("standard_caption"));
771  }
772 
773 
774  $media_item->setHAlign("Left");
775 
776  // fullscreen view
777  if ($form->getInput("full_type") != "None") {
778  $media_item2 = new ilMediaItem();
779  $a_mob->addMediaItem($media_item2);
780  $media_item2->setPurpose("Fullscreen");
781 
782  // move file / set format and location
783  if ($form->getInput("full_type") == "File") {
784  $format = $location = "";
785  if ($_FILES['full_file']['name'] != "") {
786  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
787  $file = $mob_dir . "/" . $full_file_name;
789  $_FILES['full_file']['tmp_name'],
790  $full_file_name,
791  $file
792  );
794  $location = $full_file_name;
795  }
796  } elseif ($form->getInput("full_type") == "Standard" && $form->getInput("standard_type") == "File") {
797  $location = $file_name;
798  }
799 
800  // resize file
801  if ($form->getInput("full_type") == "File" ||
802  ($form->getInput("full_type") == "Standard" && $form->getInput("standard_type") == "File")) {
803  if (($form->getInput("full_size") != "original" &&
804  is_int(strpos($format, "image")))
805  ) {
806  $full_wh_input = $form->getInput("full_width_height");
808  $file,
809  (int) $full_wh_input["width"],
810  (int) $full_wh_input["height"],
811  (bool) ($full_wh_input["constr_prop"] ?? false)
812  );
813  }
814 
815  $media_item2->setFormat($format);
816  $media_item2->setLocation($location);
817  $media_item2->setLocationType("LocalFile");
818  $type = "File";
819  }
820 
821  if ($form->getInput("full_type") == "Reference") {
822  $format = $location = "";
823  if ($form->getInput("full_reference") != "") {
824  $format = ilObjMediaObject::getMimeType($form->getInput("full_reference"), true);
825  $location = ilUtil::stripSlashes($form->getInput("full_reference"));
826  }
827  }
828 
829  if ($form->getInput("full_type") == "Reference" ||
830  ($form->getInput("full_type") == "Standard" && $form->getInput("standard_type") == "Reference")) {
831  $media_item2->setFormat($format);
832  $media_item2->setLocation($location);
833  $media_item2->setLocationType("Reference");
834  $type = "Reference";
835  }
836 
837  // determine width and height of known image types
838  $wh_input = $form->getInput("full_width_height");
840  $format,
841  $type,
842  $mob_dir . "/" . $location,
843  $media_item2->getLocation(),
844  (bool) ($wh_input["constr_prop"] ?? false),
845  ($form->getInput("full_size") == "original"),
846  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
847  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
848  );
849 
850  $media_item2->setWidth($wh["width"]);
851  $media_item2->setHeight($wh["height"]);
852 
853  if ($form->getInput("full_caption") != "") {
854  $media_item2->setCaption($form->getInput("full_caption"));
855  }
856  }
857 
859  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
860  $a_mob->update();
861  }
static sanitizeDir(string $a_path)
Sanitize directory recursively.
static _determineWidthHeight(string $a_format, string $a_type, string $a_file, string $a_reference, bool $a_constrain_proportions, bool $a_use_original, ?int $a_user_width=null, ?int $a_user_height=null)
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
addMediaItem(ilMediaItem $a_item)
createDirectory()
Create file directory of media object.
setTitle(string $title)
static _resizeImage(string $a_file, int $a_width, int $a_height, bool $a_constrain_prop=false)
Resize image and return new image file ("_width_height" string appended)
static secureLink(string $a_str)
static renameExecutables(string $a_dir)
setDescription(string $desc)
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
update(bool $a_upload=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$format
Definition: metadata.php:235
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static fixFilename(string $a_name)
Fix filename of uploaded file.
create(bool $a_create_meta_data=false, bool $a_save_media_items=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPropertiesSubTabs()

ilObjMediaObjectGUI::setPropertiesSubTabs ( string  $a_active)

Definition at line 1585 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, $ilUser, ilObjectGUI\$lng, ilObjectGUI\$object, $tabs, ilObjectGUI\$toolbar, ilObjectGUI\$tpl, ilObjectGUI\$user, ilMDLanguageItem\_getLanguages(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilGlobalTemplateInterface\setContent(), ilGlobalTemplateInterface\setOnScreenMessage(), ilFileInputGUI\setSuffixes(), and ilLanguage\txt().

Referenced by editObject(), showMultiSubtitleConfirmationTableObject(), and uploadMultipleSubtitleFileFormObject().

1587  : void {
1588  $ilTabs = $this->tabs;
1589  $ilCtrl = $this->ctrl;
1590  $lng = $this->lng;
1591 
1592  $ilTabs->activateTab("cont_mob_def_prop");
1593 
1594  $ilTabs->addSubTab(
1595  "general",
1596  $lng->txt("mob_general"),
1597  $ilCtrl->getLinkTarget($this, "edit")
1598  );
1599 
1600  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1601  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4") {
1602  $ilTabs->addSubTab(
1603  "subtitles",
1604  $lng->txt("mob_subtitles"),
1605  $ilCtrl->getLinkTarget($this, "listSubtitleFiles")
1606  );
1607  }
1608 
1609  $ilTabs->activateSubTab($a_active);
1610  }
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...
ilLanguage $lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTabs()

ilObjMediaObjectGUI::setTabs ( )

set admin tabs

Definition at line 1465 of file class.ilObjMediaObjectGUI.php.

References ilUtil\getImagePath(), getTabs(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

1465  : void
1466  {
1467  // catch feedback message
1468  $this->getTabs();
1469 
1470  //$this->tpl->clearHeader();
1471  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject") {
1472  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1473  $this->tpl->setTitle($this->object->getTitle());
1474  } else {
1475  //$title = $this->object->getTitle();
1476  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1477  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1478  }
1479  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ setWidthPreset()

ilObjMediaObjectGUI::setWidthPreset ( int  $a_val)

Set width preset (e.g.

set from media pool)

Definition at line 143 of file class.ilObjMediaObjectGUI.php.

143  : void
144  {
145  $this->width_preset = $a_val;
146  }

◆ showAllUsagesObject()

ilObjMediaObjectGUI::showAllUsagesObject ( )

Show all media object usages (incl history)

Definition at line 1331 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, ilObjectGUI\$object, $tabs, ilObjectGUI\$tpl, ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

1331  : void
1332  {
1333  $this->showUsagesObject(true);
1334  }
+ Here is the call graph for this function:

◆ showMultiSubtitleConfirmationTableObject()

ilObjMediaObjectGUI::showMultiSubtitleConfirmationTableObject ( )

List of srt files in zip file.

Definition at line 1747 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$tpl, ilGlobalTemplateInterface\setContent(), and setPropertiesSubTabs().

1747  : void
1748  {
1749  $tpl = $this->tpl;
1750 
1751  $this->setPropertiesSubTabs("subtitles");
1752 
1753  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
1754  $tpl->setContent($tab->getHTML());
1755  }
setPropertiesSubTabs(string $a_active)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
+ Here is the call graph for this function:

◆ uploadMultipleSubtitleFileFormObject()

ilObjMediaObjectGUI::uploadMultipleSubtitleFileFormObject ( )

Definition at line 1714 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, ilObjectGUI\$toolbar, setPropertiesSubTabs(), ilFileInputGUI\setSuffixes(), and ilLanguage\txt().

1714  : void
1715  {
1716  $ilToolbar = $this->toolbar;
1717  $lng = $this->lng;
1718  $ilCtrl = $this->ctrl;
1719 
1720  $this->tpl->setOnScreenMessage('info', $lng->txt("mob_upload_multi_srt_howto"));
1721 
1722  $this->setPropertiesSubTabs("subtitles");
1723 
1724  // upload file
1725  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1726  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.zip)", "subtitle_file");
1727  $fi->setSuffixes(array("zip"));
1728  $ilToolbar->addInputItem($fi, true);
1729 
1730  $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
1731  }
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...
This class represents a file property in a property form.
setPropertiesSubTabs(string $a_active)
setSuffixes(array $a_suffixes)
ilLanguage $lng
ilToolbarGUI $toolbar
+ Here is the call graph for this function:

◆ uploadMultipleSubtitleFileObject()

ilObjMediaObjectGUI::uploadMultipleSubtitleFileObject ( )

Definition at line 1733 of file class.ilObjMediaObjectGUI.php.

References Vendor\Package\$e, ILIAS\Repository\ctrl(), and ilArrayUtil\stripSlashesArray().

1733  : void
1734  {
1735  try {
1736  $this->object->uploadMultipleSubtitleFile(ilArrayUtil::stripSlashesArray($_FILES["subtitle_file"]));
1737  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
1738  } catch (ilMediaObjectsException $e) {
1739  $this->tpl->setOnScreenMessage('failure', $e->getMessage(), true);
1740  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
1741  }
1742  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashesArray(array $a_arr, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:

◆ uploadSubtitleFileObject()

ilObjMediaObjectGUI::uploadSubtitleFileObject ( )

Definition at line 1652 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, ILIAS\Repository\object(), ilCtrl\redirect(), and ilLanguage\txt().

1652  : void
1653  {
1654  $lng = $this->lng;
1655  $ilCtrl = $this->ctrl;
1656 
1657  if ($this->object->uploadSrtFile(
1658  $_FILES["subtitle_file"]["tmp_name"],
1659  $this->sub_title_request->getLanguage()
1660  )) {
1661  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1662  }
1663  $ilCtrl->redirect($this, "listSubtitleFiles");
1664  }
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
ilLanguage $lng
+ Here is the call graph for this function:

Field Documentation

◆ $adv_ref_id

int ilObjMediaObjectGUI::$adv_ref_id = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_subtype

string ilObjMediaObjectGUI::$adv_subtype = null
protected

Definition at line 44 of file class.ilObjMediaObjectGUI.php.

Referenced by getAdvMdRecordObject().

◆ $adv_type

string ilObjMediaObjectGUI::$adv_type = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $back_title

string ilObjMediaObjectGUI::$back_title = ""
protected

Definition at line 34 of file class.ilObjMediaObjectGUI.php.

◆ $enabledmapareas

bool ilObjMediaObjectGUI::$enabledmapareas = true

Definition at line 48 of file class.ilObjMediaObjectGUI.php.

Referenced by getEnabledMapAreas().

◆ $error

ilErrorHandling ilObjMediaObjectGUI::$error
protected

Definition at line 35 of file class.ilObjMediaObjectGUI.php.

◆ $file_service_settings

ilFileServicesSettings ilObjMediaObjectGUI::$file_service_settings
protected

Definition at line 29 of file class.ilObjMediaObjectGUI.php.

◆ $form_gui

ilPropertyFormGUI ilObjMediaObjectGUI::$form_gui
protected

◆ $header

string ilObjMediaObjectGUI::$header = ""

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

Referenced by getHeader().

◆ $height_preset

int ilObjMediaObjectGUI::$height_preset = 0
protected

Definition at line 32 of file class.ilObjMediaObjectGUI.php.

Referenced by getHeightPreset().

◆ $help

ilHelpGUI ilObjMediaObjectGUI::$help
protected

Definition at line 36 of file class.ilObjMediaObjectGUI.php.

Referenced by createObject(), and getTabs().

◆ $media_type

ILIAS MediaObjects MediaType MediaTypeManager ilObjMediaObjectGUI::$media_type
protected

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

◆ $sub_title_request

SubtitlesGUIRequest ilObjMediaObjectGUI::$sub_title_request
protected

Definition at line 30 of file class.ilObjMediaObjectGUI.php.

◆ $tabs

ilTabsGUI ilObjMediaObjectGUI::$tabs
protected

Definition at line 37 of file class.ilObjMediaObjectGUI.php.

Referenced by setPropertiesSubTabs(), and showAllUsagesObject().

◆ $target_script

string ilObjMediaObjectGUI::$target_script = ""

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

◆ $width_preset

int ilObjMediaObjectGUI::$width_preset = 0
protected

Definition at line 33 of file class.ilObjMediaObjectGUI.php.

Referenced by getWidthPreset().


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