ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 extractPreviewImageObject ()
 
 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] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _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 ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 addAdoptContentLinkToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 

Protected Attributes

ILIAS MediaObjects Video GUIService $video_gui
 
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
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

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 54 of file class.ilObjMediaObjectGUI.php.

References $DIC, ilObjectGUI\$lng, ILIAS\MetaData\Repository\Validation\Data\__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().

59  {
60  global $DIC;
61 
62  $this->access = $DIC->access();
63  $this->error = $DIC["ilErr"];
64  $this->help = $DIC["ilHelp"];
65  $this->tabs = $DIC->tabs();
66  $this->toolbar = $DIC->toolbar();
67  $this->user = $DIC->user();
68  $lng = $DIC->language();
69  $ilCtrl = $DIC->ctrl();
70  $this->media_type = $DIC->mediaObjects()
71  ->internal()
72  ->domain()
73  ->mediaType();
74 
75  $this->ctrl = $ilCtrl;
76  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
77  $this->lng = $lng;
78  $this->back_title = "";
79  $this->type = "mob";
80 
81  $this->sub_title_request = $DIC->mediaObjects()
82  ->internal()
83  ->gui()
84  ->subTitles()
85  ->request();
86 
87  $lng->loadLanguageModule("mob");
88  $this->file_service_settings = $DIC->fileServiceSettings();
89  $this->video_gui = $DIC->mediaObjects()->internal()->gui()->video();
90  }
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
ilLanguage $lng
__construct(VocabulariesInterface $vocabularies)
+ 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 1401 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().

1403  : string {
1404  global $DIC;
1405 
1406  $lng = $DIC->language();
1407 
1408  $tpl = new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
1409  $types = array("Standard", "Fullscreen");
1410  foreach ($types as $type) {
1411  if ($type == "Fullscreen" && !$a_mob->hasFullscreenItem()) {
1412  continue;
1413  }
1414 
1415  $med = $a_mob->getMediaItem($type);
1416  if (!$med) {
1417  return "";
1418  }
1419 
1420  $tpl->setCurrentBlock("media_info");
1421  if ($type == "Standard") {
1422  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1423  } else {
1424  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1425  }
1426  $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
1427  $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1428  if ($med->getLocationType() == "LocalFile") {
1429  $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
1430  if (is_file($file)) {
1431  $size = filesize($file);
1432  } else {
1433  $size = 0;
1434  }
1435  $tpl->setVariable("VAL_FILE_SIZE", " ($size " . $lng->txt("bytes") . ")");
1436  }
1437  $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1438  $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1439  if ($med->getWidth() != "" && $med->getHeight() != "") {
1440  $tpl->setCurrentBlock("size");
1441  $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1442  $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
1444  }
1445 
1446  // original size
1447  if ($orig_size = $med->getOriginalSize()) {
1448  if (($orig_size["width"] ?? "") !== $med->getWidth() ||
1449  ($orig_size["height"] ?? "") !== $med->getHeight()) {
1450  $tpl->setCurrentBlock("orig_size");
1451  $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1452  $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1453  $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1455  }
1456  }
1457 
1458  // output caption
1459  if (strlen($med->getCaption())) {
1460  $tpl->setCurrentBlock('additional_info');
1461  $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
1463  }
1464 
1465  // output keywords
1466  if ($type == "Standard") {
1467  if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) {
1468  $tpl->setCurrentBlock('additional_info');
1469  $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws));
1471  }
1472  }
1473 
1474  $tpl->setCurrentBlock("media_info");
1476  }
1477 
1478  return $tpl->get();
1479  }
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 1325 of file class.ilObjMediaObjectGUI.php.

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

1325  : void
1326  {
1327  if (!$this->object->hasFullscreenItem()) {
1328  $std_item = $this->object->getMediaItem("Standard");
1329  $full_item = new ilMediaItem();
1330  $full_item->setMobId($std_item->getMobId());
1331  $full_item->setLocation($std_item->getLocation());
1332  $full_item->setLocationType($std_item->getLocationType());
1333  $full_item->setFormat($std_item->getFormat());
1334  $full_item->setWidth($std_item->getWidth());
1335  $full_item->setHeight($std_item->getHeight());
1336  $full_item->setCaption($std_item->getCaption());
1337  $full_item->setTextRepresentation($std_item->getTextRepresentation());
1338  $full_item->setPurpose("Fullscreen");
1339  $this->object->addMediaItem($full_item);
1340 
1341  $this->object->update();
1342  }
1343 
1344  $this->ctrl->redirect($this, "edit");
1345  }
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 1270 of file class.ilObjMediaObjectGUI.php.

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

1272  : void {
1273  // determine directory
1274  $cur_subdir = dirname($a_file);
1275  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1276  $cur_dir = (!empty($cur_subdir))
1277  ? $mob_dir . "/" . $cur_subdir
1278  : $mob_dir;
1279  $file = $cur_dir . "/" . basename($a_file);
1280  $location = $a_file;
1281 
1282  if (!is_file($file)) {
1283  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1284  }
1285 
1286  if (!$this->object->hasFullscreenItem()) { // create new fullscreen item
1287  $std_item = $this->object->getMediaItem("Standard");
1288  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1289  $file = $mob_dir . "/" . $location;
1290  $full_item = new ilMediaItem();
1291  $full_item->setMobId($std_item->getMobId());
1292  $full_item->setLocation($location);
1293  $full_item->setLocationType("LocalFile");
1294  $full_item->setFormat(ilObjMediaObject::getMimeType($file));
1295  $full_item->setPurpose("Fullscreen");
1296  $this->object->addMediaItem($full_item);
1297  } else { // alter existing fullscreen item
1298  $full_item = $this->object->getMediaItem("Fullscreen");
1299 
1300  $full_item->setLocationType("LocalFile");
1301  $full_item->setLocation($location);
1302  $format = ilObjMediaObject::getMimeType($file);
1303  $full_item->setFormat($format);
1304  }
1305  $this->object->update();
1306  // $this->ctrl->saveParameter($this, "cdir");
1307  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1308  }
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...
header include for all ilias files.
+ Here is the call graph for this function:

◆ assignObject()

ilObjMediaObjectGUI::assignObject ( )
protected

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

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

◆ assignStandardObject()

ilObjMediaObjectGUI::assignStandardObject ( string  $a_file)

assign file to standard view

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

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

1242  : void {
1243  // determine directory
1244  $cur_subdir = dirname($a_file);
1245  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1246  $cur_dir = (!empty($cur_subdir))
1247  ? $mob_dir . "/" . $cur_subdir
1248  : $mob_dir;
1249  $file = $cur_dir . "/" . basename($a_file);
1250  $location = $a_file;
1251 
1252  if (!is_file($file)) {
1253  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1254  }
1255 
1256  $std_item = $this->object->getMediaItem("Standard");
1257  $std_item->setLocationType("LocalFile");
1258  $std_item->setLocation($location);
1259  $format = ilObjMediaObject::getMimeType($file);
1260  $std_item->setFormat($format);
1261  $this->object->update();
1262  // $this->ctrl->saveParameter($this, "cdir");
1263  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1264  }
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
header include for all ilias files.
+ Here is the call graph for this function:

◆ cancelMultiSrtObject()

ilObjMediaObjectGUI::cancelMultiSrtObject ( )

Cancel Multi Feedback.

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

References ILIAS\Repository\ctrl().

1779  : void
1780  {
1781  $this->object->clearMultiSrtDirectory();
1782  $this->ctrl->redirect($this, "listSubtitleFiles");
1783  }
+ Here is the call graph for this function:

◆ cancelObject()

ilObjMediaObjectGUI::cancelObject ( )

Cancel saving.

Exceptions
ilCtrlException

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

References ILIAS\Repository\ctrl().

874  : void
875  {
876  $this->ctrl->returnToParent($this);
877  }
+ Here is the call graph for this function:

◆ checkFixSize()

ilObjMediaObjectGUI::checkFixSize ( )
protected

Check fix size (for map editing hint)

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

References ILIAS\Repository\lng().

Referenced by returnToContextObject().

552  : void
553  {
554  $std_item = $this->object->getMediaItem("Standard");
555  if ($std_item->getWidth() == "" || $std_item->getHeight() == "") {
556  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("mob_no_fixed_size_map_editing"));
557  }
558  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkFormInput()

ilObjMediaObjectGUI::checkFormInput ( )

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

667  : bool
668  {
669  if (!$this->form_gui->checkInput()) {
670  $this->form_gui->setValuesByPost();
671  return false;
672  }
673  return true;
674  }

◆ confirmSrtDeletionObject()

ilObjMediaObjectGUI::confirmSrtDeletionObject ( )

Confirm srt file deletion.

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

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

1688  : void
1689  {
1690  $ilCtrl = $this->ctrl;
1691  $tpl = $this->tpl;
1692  $lng = $this->lng;
1693 
1694  $lng->loadLanguageModule("meta");
1695 
1696  $srts = $this->sub_title_request->getSrtFiles();
1697  if (count($srts) == 0) {
1698  $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
1699  $ilCtrl->redirect($this, "listSubtitleFiles");
1700  } else {
1701  $cgui = new ilConfirmationGUI();
1702  $cgui->setFormAction($ilCtrl->getFormAction($this));
1703  $cgui->setHeaderText($lng->txt("mob_really_delete_srt"));
1704  $cgui->setCancel($lng->txt("cancel"), "listSubtitleFiles");
1705  $cgui->setConfirm($lng->txt("delete"), "deleteSrtFiles");
1706 
1707  foreach ($srts as $i) {
1708  $cgui->addItem("srt[]", $i, "subtitle_" . $i . ".srt (" . $lng->txt("meta_l_" . $i) . ")");
1709  }
1710 
1711  $tpl->setContent($cgui->getHTML());
1712  }
1713  }
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.
+ Here is the call graph for this function:

◆ createObject()

ilObjMediaObjectGUI::createObject ( )

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

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

265  : void
266  {
267  $tpl = $this->tpl;
268  $ilHelp = $this->help;
269 
270  $ilHelp->setScreenId("create");
271  $this->initForm();
272  $tpl->setContent($this->form_gui->getHTML());
273  }
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 1718 of file class.ilObjMediaObjectGUI.php.

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

1718  : void
1719  {
1720  $lng = $this->lng;
1721  $ilCtrl = $this->ctrl;
1722 
1723  $srts = $this->sub_title_request->getSrtFiles();
1724  foreach ($srts as $i) {
1725  if (strlen($i) == 2 && !is_int(strpos($i, "."))) {
1726  $this->object->removeAdditionalFile("srt/subtitle_" . $i . ".srt");
1727  }
1728  }
1729  $this->tpl->setOnScreenMessage('success', $lng->txt("mob_srt_files_deleted"), true);
1730  $ilCtrl->redirect($this, "listSubtitleFiles");
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...
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:

◆ editObject()

ilObjMediaObjectGUI::editObject ( )

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

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

879  : void
880  {
881  $tpl = $this->tpl;
882 
883  $this->setPropertiesSubTabs("general");
884  $this->video_gui->addPreviewExtractionToToolbar(
885  $this->object->getId(),
886  self::class
887  );
888  $this->initForm("edit");
889  $this->getValues();
890  $tpl->setContent($this->form_gui->getHTML());
891  }
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:

◆ extractPreviewImageObject()

ilObjMediaObjectGUI::extractPreviewImageObject ( )

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

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

893  : void
894  {
895  $ilCtrl = $this->ctrl;
896  $this->video_gui->handleExtractionRequest(
897  $this->object->getId()
898  );
899  $ilCtrl->redirect($this, "edit");
900  }
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:

◆ getAdvMdRecordObject()

ilObjMediaObjectGUI::getAdvMdRecordObject ( )

Get adv md record type.

Exceptions
ilMediaObjectsException

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

References $adv_ref_id, $adv_subtype, and $adv_type.

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

◆ getEnabledMapAreas()

ilObjMediaObjectGUI::getEnabledMapAreas ( )

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

References $enabledmapareas.

Referenced by getTabs().

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

◆ getForm()

ilObjMediaObjectGUI::getForm ( )

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

References $form_gui.

169  {
170  return $this->form_gui;
171  }

◆ getFullscreenSizeObject()

ilObjMediaObjectGUI::getFullscreenSizeObject ( )

set original size of fullscreen file

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

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

970  : void
971  {
972  $full_item = $this->object->getMediaItem("Fullscreen");
973  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
974 
975  if ($full_item->getLocationType() == "LocalFile") {
976  $file = $mob_dir . "/" . $full_item->getLocation();
977  $size = ilMediaImageUtil::getImageSize($file);
978  $full_item->setWidth($size[0]);
979  $full_item->setHeight($size[1]);
980  $this->object->update();
981  }
982  $this->ctrl->redirect($this, "edit");
983  }
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 126 of file class.ilObjMediaObjectGUI.php.

References $header.

126  : string
127  {
128  return $this->header;
129  }

◆ getHeightPreset()

ilObjMediaObjectGUI::getHeightPreset ( )

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

References $height_preset.

Referenced by initForm().

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

◆ getStandardSizeObject()

ilObjMediaObjectGUI::getStandardSizeObject ( )

set original size of standard file

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

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

949  : void
950  {
951  $std_item = $this->object->getMediaItem("Standard");
952  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
953 
954  if ($std_item->getLocationType() == "LocalFile") {
955  $file = $mob_dir . "/" . $std_item->getLocation();
956 
957  $size = ilMediaImageUtil::getImageSize($file);
958 
959  $std_item->setWidth($size[0]);
960  $std_item->setHeight($size[1]);
961  $this->object->update();
962  }
963  $this->ctrl->redirect($this, "edit");
964  }
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 1500 of file class.ilObjMediaObjectGUI.php.

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

Referenced by setTabs().

1500  : void
1501  {
1502  $ilHelp = $this->help;
1503 
1504  $ilHelp->setScreenIdComponent("mob");
1505 
1506  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1507  && $this->object->getId() > 0) {
1508  // object properties
1509  $this->tabs_gui->addTarget(
1510  "cont_mob_def_prop",
1511  $this->ctrl->getLinkTarget($this, "edit"),
1512  "edit",
1513  get_class($this)
1514  );
1515 
1516  $st_item = $this->object->getMediaItem("Standard");
1517 
1518  // link areas
1519 
1520  if (is_object($st_item) && $this->getEnabledMapAreas()) {
1521  $format = $st_item->getFormat();
1522  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg"))) {
1523  $this->tabs_gui->addTarget(
1524  "cont_def_map_areas",
1525  $this->ctrl->getLinkTargetByClass(
1526  array("ilobjmediaobjectgui", "ilimagemapeditorgui"),
1527  "editMapAreas"
1528  ),
1529  "editMapAreas",
1530  "ilimagemapeditorgui"
1531  );
1532  }
1533  }
1534 
1535  // object usages
1536  $this->tabs_gui->addTarget(
1537  "cont_mob_usages",
1538  $this->ctrl->getLinkTarget($this, "showUsages"),
1539  "showUsages",
1540  get_class($this)
1541  );
1542 
1543  // object files
1544  $std_item = $this->object->getMediaItem("Standard");
1545  $full_item = $this->object->getMediaItem("Fullscreen");
1546  $mset = new ilSetting("mobs");
1547  if ($mset->get("file_manager_always") ||
1548  ($this->media_type->usesParameterProperty($std_item->getFormat()) ||
1549  (is_object($full_item) && $this->media_type->usesParameterProperty($full_item->getFormat())))
1550  ) {
1551  $this->tabs_gui->addTarget(
1552  "cont_files",
1553  $this->ctrl->getLinkTargetByClass(
1554  array("ilobjmediaobjectgui", "ilfilesystemgui"),
1555  "listFiles"
1556  ),
1557  "",
1558  "ilfilesystemgui"
1559  );
1560  }
1561 
1562  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1563  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1564  if ($mdtab) {
1565  $this->tabs_gui->addTarget(
1566  "meta_data",
1567  $mdtab,
1568  "",
1569  "ilmdeditorgui"
1570  );
1571  }
1572  }
1573 
1574  // back to upper context
1575  if ($this->back_title != "") {
1576  $this->tabs_gui->setBackTarget(
1577  $this->back_title,
1578  $this->ctrl->getParentReturn($this)
1579  );
1580  }
1581  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setScreenIdComponent(string $a_comp)
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 564 of file class.ilObjMediaObjectGUI.php.

References ILIAS\Repository\object().

Referenced by editObject().

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

◆ getWidthPreset()

ilObjMediaObjectGUI::getWidthPreset ( )

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

References $width_preset.

Referenced by initForm().

150  : int
151  {
152  return $this->width_preset;
153  }
+ 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 1586 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().

1588  : void {
1589  global $DIC;
1590 
1591  $tpl = $DIC["tpl"];
1592 
1593  if ($a_tpl == null) {
1594  $a_tpl = $tpl;
1595  }
1596 
1597  iljQueryUtil::initjQuery($a_tpl);
1599  $a_tpl->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1600 
1602  }
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 275 of file class.ilObjMediaObjectGUI.php.

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

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

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

◆ removeFullscreenObject()

ilObjMediaObjectGUI::removeFullscreenObject ( )

remove fullscreen view

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

References ILIAS\Repository\ctrl().

1314  : void
1315  {
1316  $this->object->removeMediaItem("Fullscreen");
1317  $this->object->update();
1318 
1319  $this->ctrl->redirect($this, "edit");
1320  }
+ Here is the call graph for this function:

◆ resizeImagesObject()

ilObjMediaObjectGUI::resizeImagesObject ( )

resize images to specified size

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

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

905  : void
906  {
907  // directory
908  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
909 
910  // standard item
911  $std_item = $this->object->getMediaItem("Standard");
912  if ($std_item->getLocationType() == "LocalFile" &&
913  is_int(strpos($std_item->getFormat(), "image"))
914  ) {
915  $file = $mob_dir . "/" . $std_item->getLocation();
917  $file,
918  $std_item->getWidth(),
919  $std_item->getHeight()
920  );
921  $std_item->setLocation($location);
922  $std_item->update();
923  }
924 
925  // fullscreen item
926  if ($this->object->hasFullscreenItem()) {
927  $full_item = $this->object->getMediaItem("Fullscreen");
928  if ($full_item->getLocationType() == "LocalFile" &&
929  is_int(strpos($full_item->getFormat(), "image"))
930  ) {
931  $file = $mob_dir . "/" . $full_item->getLocation();
933  $file,
934  $full_item->getWidth(),
935  $full_item->getHeight()
936  );
937  $full_item->setLocation($location);
938  $full_item->update();
939  }
940  }
941 
942  $this->ctrl->redirect($this, "edit");
943  }
$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 1788 of file class.ilObjMediaObjectGUI.php.

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

1788  : void
1789  {
1790  $ilCtrl = $this->ctrl;
1791  $srt_files = $this->object->getMultiSrtFiles();
1792  $files = $this->sub_title_request->getFiles();
1793  foreach ($files as $f) {
1794  foreach ($srt_files as $srt_file) {
1795  if ($f == $srt_file["filename"]) {
1796  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir() . "/" . $srt_file["filename"], $srt_file["lang"], "rename");
1797  }
1798  }
1799  }
1800  $this->object->clearMultiSrtDirectory();
1801  $ilCtrl->redirect($this, "listSubtitleFiles");
1802  }
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 652 of file class.ilObjMediaObjectGUI.php.

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

652  : void
653  {
654  $tpl = $this->tpl;
655  $lng = $this->lng;
656  $this->initForm();
657  if ($this->form_gui->checkInput()) {
658  $this->object = new ilObjMediaObject();
659  $this->setObjectPerCreationForm($this->object);
660  $this->tpl->setOnScreenMessage('success', $lng->txt("saved_media_object"), true);
661  } else {
662  $this->form_gui->setValuesByPost();
663  $tpl->setContent($this->form_gui->getHTML());
664  }
665  }
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 985 of file class.ilObjMediaObjectGUI.php.

References $form_gui, 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().

985  : void
986  {
987  $lng = $this->lng;
988  $tpl = $this->tpl;
989  $file = "";
990  $type = "";
991 
992  $this->initForm("edit");
993  $form = $this->form_gui;
994 
995  if ($form->checkInput()) {
996  $title = trim($form->getInput("standard_title"));
997  $this->object->setTitle($title);
998 
999  $std_item = $this->object->getMediaItem("Standard");
1000  $location = $std_item->getLocation();
1001  $format = $std_item->getFormat();
1002  if ($form->getInput("standard_type") == "Reference") {
1003  $format = ilObjMediaObject::getMimeType($form->getInput("standard_reference"), true);
1004  $std_item->setFormat($format);
1005  $std_item->setLocation(ilUtil::secureLink($form->getInput("standard_reference")));
1006  $std_item->setLocationType("Reference");
1007  }
1008  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1009  if ($form->getInput("standard_type") == "File") {
1010  $resize = false;
1011  if ($_FILES['standard_file']['name'] != "") {
1012  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
1013  $file = $mob_dir . "/" . $file_name;
1015  $_FILES['standard_file']['tmp_name'],
1016  $file_name,
1017  $file
1018  );
1019 
1020  // get mime type
1021  $format = ilObjMediaObject::getMimeType($file);
1022  $location = $file_name;
1023 
1024  $resize = true;
1025  } elseif ($form->getInput("standard_resize")) {
1026  $file = $mob_dir . "/" . $location;
1027  $resize = true;
1028  }
1029 
1030  // resize
1031  if ($resize) {
1032  if ($form->getInput("standard_size") != "original" &&
1033  is_int(strpos($format, "image"))) {
1034  $wh_input = $form->getInput("standard_width_height");
1036  $file,
1037  (int) $wh_input["width"],
1038  (int) $wh_input["height"],
1039  (bool) ($wh_input["constr_prop"] ?? false)
1040  );
1041  }
1042  $std_item->setFormat($format);
1043  $std_item->setLocation($location);
1044  }
1045 
1046  $std_item->setLocationType("LocalFile");
1047  }
1048  $this->object->setDescription($format);
1049  // determine width and height of known image types
1050  $wh_input = $form->getInput("standard_width_height");
1052  $format,
1053  $form->getInput("standard_type"),
1054  $mob_dir . "/" . $location,
1055  $std_item->getLocation(),
1056  (bool) ($wh_input["constr_prop"] ?? false),
1057  ($form->getInput("standard_size") == "original"),
1058  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
1059  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
1060  );
1061  if ($wh["info"] != "") {
1062  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
1063  }
1064  $std_item->setWidth($wh["width"]);
1065  $std_item->setHeight($wh["height"]);
1066 
1067  // set caption
1068  $std_item->setCaption($form->getInput("standard_caption"));
1069 
1070  // text representation
1071  $std_item->setTextRepresentation($form->getInput("text_representation"));
1072 
1073  $this->video_gui->savePreviewInput($form, $this->object->getId());
1074 
1075  // set parameters
1076  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1077  if ($this->media_type->usesAutoStartParameterOnly(
1078  $std_item->getLocation(),
1079  $std_item->getFormat()
1080  )) {
1081  /*
1082  if ($_POST["standard_autostart"]) { // save only autostart flag
1083  $std_item->setParameters('autostart="true"');
1084  } else {
1085  $std_item->setParameters("");
1086  }*/
1087  } else {
1088  $std_item->setParameters($form->getInput("standard_parameters"));
1089  }
1090  }
1091 
1092  // "None" selected
1093  if ($form->getInput("full_type") == "None") {
1094  if ($this->object->hasFullscreenItem()) { // delete existing
1095  $this->object->removeMediaItem("Fullscreen");
1096  }
1097  } else { // Not "None" -> we need one
1098  if ($this->object->hasFullscreenItem()) { // take existing one
1099  $full_item = $this->object->getMediaItem("Fullscreen");
1100  } else { // create one
1101  $full_item = new ilMediaItem();
1102  $this->object->addMediaItem($full_item);
1103  $full_item->setPurpose("Fullscreen");
1104  }
1105  $location = $full_item->getLocation();
1106  $format = $full_item->getFormat();
1107  if ($form->getInput("full_type") == "Reference") {
1108  $format = ilObjMediaObject::getMimeType($form->getInput("full_reference"), true);
1109  $full_item->setFormat($format);
1110  $full_item->setLocationType("Reference");
1111  $location = ilUtil::secureLink($form->getInput("full_reference"));
1112  $type = "Reference";
1113  $full_item->setLocation($location);
1114  }
1115  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1116  if ($form->getInput("full_type") == "File") {
1117  $resize = false;
1118  if ($_FILES['full_file']['name'] != "") {
1119  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1120  $file = $mob_dir . "/" . $full_file_name;
1122  $_FILES['full_file']['tmp_name'],
1123  $full_file_name,
1124  $file
1125  );
1126 
1127  $format = ilObjMediaObject::getMimeType($file);
1128  $location = $full_file_name;
1129 
1130  $resize = true;
1131  } elseif ($form->getInput("full_resize")) {
1132  $file = $mob_dir . "/" . $location;
1133  $resize = true;
1134  }
1135 
1136  // resize
1137  if ($resize) {
1138  if ($form->getInput("full_size") != "original" &&
1139  is_int(strpos($format, "image"))) {
1140  $wh_input = $form->getInput("full_width_height");
1142  $file,
1143  (int) $wh_input["width"],
1144  (int) $wh_input["height"],
1145  (bool) ($wh_input["constr_prop"] ?? false)
1146  );
1147  }
1148  $full_item->setFormat($format);
1149  $full_item->setLocation($location);
1150  }
1151 
1152  $full_item->setLocationType("LocalFile");
1153  $type = "File";
1154  }
1155  if ($form->getInput("full_type") == "Standard") {
1156  $format = $std_item->getFormat();
1157  $location = $std_item->getLocation();
1158  $full_item->setLocationType($std_item->getLocationType());
1159  $full_item->setFormat($format);
1160  $full_item->setLocation($location);
1161  $type = $std_item->getLocationType();
1162  if ($type == "LocalFile") {
1163  $type = "File";
1164  }
1165  // resize image
1166  //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1167  if ($form->getInput("full_size") != "original" &&
1168  is_int(strpos($format, "image")) &&
1169  $full_item->getLocationType() == "LocalFile") {
1170  $file = $mob_dir . "/" . $location;
1171  $wh_input = $form->getInput("full_width_height");
1173  $file,
1174  (int) $wh_input["width"],
1175  (int) $wh_input["height"],
1176  (bool) ($wh_input["constr_prop"] ?? false)
1177  );
1178  }
1179  }
1180 
1181  // determine width and height of known image types
1182  $wh_input = $form->getInput("full_width_height");
1184  $format,
1185  $type,
1186  $mob_dir . "/" . $location,
1187  $full_item->getLocation(),
1188  (bool) ($wh_input["constr_prop"] ?? false),
1189  ($form->getInput("full_size") == "original"),
1190  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
1191  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
1192  );
1193  if ($wh["info"] != "") {
1194  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
1195  }
1196 
1197  $full_item->setWidth($wh["width"]);
1198  $full_item->setHeight($wh["height"]);
1199  $full_item->setLocation($location);
1200 
1201  $full_item->setCaption($form->getInput("full_caption"));
1202 
1203  // text representation
1204  $full_item->setTextRepresentation($form->getInput("full_text_representation"));
1205 
1206 
1207  // set parameters
1208  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1209  if ($this->media_type->usesAutoStartParameterOnly(
1210  $std_item->getLocation(),
1211  $std_item->getFormat()
1212  )) {
1213  /*
1214  if ($_POST["full_autostart"]) { // save only autostart flag
1215  $full_item->setParameters('autostart="true"');
1216  } else {
1217  $full_item->setParameters("");
1218  }*/
1219  } else {
1220  $full_item->setParameters($form->getInput("full_parameters"));
1221  }
1222  }
1223  }
1224 
1227 
1228  $this->object->update();
1229  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1230  $this->ctrl->redirect($this, "edit");
1231  } else {
1232  $this->form_gui->setValuesByPost();
1233  $tpl->setContent($this->form_gui->getHTML());
1234  }
1235  }
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...
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 96 of file class.ilObjMediaObjectGUI.php.

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

◆ setBackTitle()

ilObjMediaObjectGUI::setBackTitle ( string  $a_title)

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

Referenced by ilPCMediaObjectGUI\getEnabledMapAreas().

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

◆ setEnabledMapAreas()

ilObjMediaObjectGUI::setEnabledMapAreas ( bool  $a_enabledmapareas)

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

133  : void {
134  $this->enabledmapareas = $a_enabledmapareas;
135  }

◆ setHeader()

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

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

References ILIAS\UI\examples\Symbol\Glyph\Header\header().

122  : void {
123  $this->header = $a_title;
124  }
+ Here is the call graph for this function:

◆ setHeightPreset()

ilObjMediaObjectGUI::setHeightPreset ( int  $a_val)

Set height preset (e.g.

set from media pool)

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

158  : void
159  {
160  $this->height_preset = $a_val;
161  }

◆ setObjectPerCreationForm()

ilObjMediaObjectGUI::setObjectPerCreationForm ( ilObjMediaObject  $a_mob)

Set media object values from creation form.

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

References Vendor\Package\$e, $form_gui, $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().

682  : void {
683  $form = $this->form_gui;
684 
685  $location = "";
686  $file_name = "";
687  $file = "";
688  $type = "";
689 
690  // determinte title and format
691  if (trim($form->getInput("standard_title")) != "") {
692  $title = trim($form->getInput("standard_title"));
693  } else {
694  if ($form->getInput("standard_type") == "File") {
695  $title = $_FILES['standard_file']['name'];
696  } else {
697  $title = $form->getInput("standard_reference");
698  }
699  }
700 
701  $a_mob->setTitle($title);
702  $a_mob->setDescription("");
703  $a_mob->create();
704 
705  // determine and create mob directory, move uploaded file to directory
706  //$mob_dir = ilFileUtils::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
707  $a_mob->createDirectory();
708  $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
709 
710  $media_item = new ilMediaItem();
711  $a_mob->addMediaItem($media_item);
712  $media_item->setPurpose("Standard");
713 
714  if ($form->getInput("standard_type") == "File") {
715  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
716  $file = $mob_dir . "/" . $file_name;
718  $_FILES['standard_file']['tmp_name'],
719  $file_name,
720  $file
721  );
722 
723  // get mime type
724  $format = ilObjMediaObject::getMimeType($file);
725  $location = $file_name;
726 
727  // resize standard images
728  if ($form->getInput("standard_size") != "original" &&
729  is_int(strpos($format, "image"))) {
730  $wh_input = $form->getInput("standard_width_height");
731 
733  $file,
734  (int) $wh_input["width"],
735  (int) $wh_input["height"],
736  (bool) ($wh_input["constr_prop"] ?? false)
737  );
738  }
739 
740  // set real meta and object data
741  $media_item->setFormat($format);
742  $media_item->setLocation($location);
743  $media_item->setLocationType("LocalFile");
744  $a_mob->generatePreviewPic(320, 240);
745  } else { // standard type: reference
746  $format = ilObjMediaObject::getMimeType($form->getInput("standard_reference"), true);
747  $media_item->setFormat($format);
748  $media_item->setLocation(ilUtil::secureLink($form->getInput("standard_reference")));
749  $media_item->setLocationType("Reference");
750 
751  try {
752  $a_mob->getExternalMetadata();
753  } catch (Exception $e) {
754  }
755  }
756 
757  // determine width and height of known image types
758  $wh_input = $form->getInput("standard_width_height");
760  $format,
761  $form->getInput("standard_type"),
762  $mob_dir . "/" . $location,
763  $media_item->getLocation(),
764  (bool) ($wh_input["constr_prop"] ?? false),
765  ($form->getInput("standard_size") == "original"),
766  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
767  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
768  );
769  $media_item->setWidth($wh["width"]);
770  $media_item->setHeight($wh["height"]);
771  if ($wh["info"] != "") {
772  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
773  }
774 
775  if ($form->getInput("standard_caption") != "") {
776  $media_item->setCaption($form->getInput("standard_caption"));
777  }
778 
779 
780  $media_item->setHAlign("Left");
781 
782  // fullscreen view
783  if ($form->getInput("full_type") != "None") {
784  $media_item2 = new ilMediaItem();
785  $a_mob->addMediaItem($media_item2);
786  $media_item2->setPurpose("Fullscreen");
787 
788  // move file / set format and location
789  if ($form->getInput("full_type") == "File") {
790  $format = $location = "";
791  if ($_FILES['full_file']['name'] != "") {
792  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
793  $file = $mob_dir . "/" . $full_file_name;
795  $_FILES['full_file']['tmp_name'],
796  $full_file_name,
797  $file
798  );
799  $format = ilObjMediaObject::getMimeType($file);
800  $location = $full_file_name;
801  }
802  } elseif ($form->getInput("full_type") == "Standard" && $form->getInput("standard_type") == "File") {
803  $location = $file_name;
804  }
805 
806  // resize file
807  if ($form->getInput("full_type") == "File" ||
808  ($form->getInput("full_type") == "Standard" && $form->getInput("standard_type") == "File")) {
809  if (($form->getInput("full_size") != "original" &&
810  is_int(strpos($format, "image")))
811  ) {
812  $full_wh_input = $form->getInput("full_width_height");
814  $file,
815  (int) $full_wh_input["width"],
816  (int) $full_wh_input["height"],
817  (bool) ($full_wh_input["constr_prop"] ?? false)
818  );
819  }
820 
821  $media_item2->setFormat($format);
822  $media_item2->setLocation($location);
823  $media_item2->setLocationType("LocalFile");
824  $type = "File";
825  }
826 
827  if ($form->getInput("full_type") == "Reference") {
828  $format = $location = "";
829  if ($form->getInput("full_reference") != "") {
830  $format = ilObjMediaObject::getMimeType($form->getInput("full_reference"), true);
831  $location = ilUtil::stripSlashes($form->getInput("full_reference"));
832  }
833  }
834 
835  if ($form->getInput("full_type") == "Reference" ||
836  ($form->getInput("full_type") == "Standard" && $form->getInput("standard_type") == "Reference")) {
837  $media_item2->setFormat($format);
838  $media_item2->setLocation($location);
839  $media_item2->setLocationType("Reference");
840  $type = "Reference";
841  }
842 
843  // determine width and height of known image types
844  $wh_input = $form->getInput("full_width_height");
846  $format,
847  $type,
848  $mob_dir . "/" . $location,
849  $media_item2->getLocation(),
850  (bool) ($wh_input["constr_prop"] ?? false),
851  ($form->getInput("full_size") == "original"),
852  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
853  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
854  );
855 
856  $media_item2->setWidth($wh["width"]);
857  $media_item2->setHeight($wh["height"]);
858 
859  if ($form->getInput("full_caption") != "") {
860  $media_item2->setCaption($form->getInput("full_caption"));
861  }
862  }
863 
865  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
866  $a_mob->update();
867  }
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)
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...
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)
setDescription(string $description)
+ 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 1604 of file class.ilObjMediaObjectGUI.php.

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

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

1606  : void {
1607  $ilTabs = $this->tabs;
1608  $ilCtrl = $this->ctrl;
1609  $lng = $this->lng;
1610 
1611  $ilTabs->activateTab("cont_mob_def_prop");
1612 
1613  $ilTabs->addSubTab(
1614  "general",
1615  $lng->txt("mob_general"),
1616  $ilCtrl->getLinkTarget($this, "edit")
1617  );
1618 
1619  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1620  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4") {
1621  $ilTabs->addSubTab(
1622  "subtitles",
1623  $lng->txt("mob_subtitles"),
1624  $ilCtrl->getLinkTarget($this, "listSubtitleFiles")
1625  );
1626  }
1627 
1628  $ilTabs->activateSubTab($a_active);
1629  }
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 1484 of file class.ilObjMediaObjectGUI.php.

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

1484  : void
1485  {
1486  // catch feedback message
1487  $this->getTabs();
1488 
1489  //$this->tpl->clearHeader();
1490  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject") {
1491  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_mob.svg"));
1492  $this->tpl->setTitle($this->object->getTitle());
1493  } else {
1494  //$title = $this->object->getTitle();
1495  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_mob.svg"));
1496  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1497  }
1498  }
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 145 of file class.ilObjMediaObjectGUI.php.

145  : void
146  {
147  $this->width_preset = $a_val;
148  }

◆ showAllUsagesObject()

ilObjMediaObjectGUI::showAllUsagesObject ( )

Show all media object usages (incl history)

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

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

1350  : void
1351  {
1352  $this->showUsagesObject(true);
1353  }
+ Here is the call graph for this function:

◆ showMultiSubtitleConfirmationTableObject()

ilObjMediaObjectGUI::showMultiSubtitleConfirmationTableObject ( )

List of srt files in zip file.

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

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

1766  : void
1767  {
1768  $tpl = $this->tpl;
1769 
1770  $this->setPropertiesSubTabs("subtitles");
1771 
1772  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
1773  $tpl->setContent($tab->getHTML());
1774  }
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 1733 of file class.ilObjMediaObjectGUI.php.

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

1733  : void
1734  {
1735  $ilToolbar = $this->toolbar;
1736  $lng = $this->lng;
1737  $ilCtrl = $this->ctrl;
1738 
1739  $this->tpl->setOnScreenMessage('info', $lng->txt("mob_upload_multi_srt_howto"));
1740 
1741  $this->setPropertiesSubTabs("subtitles");
1742 
1743  // upload file
1744  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1745  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.zip)", "subtitle_file");
1746  $fi->setSuffixes(array("zip"));
1747  $ilToolbar->addInputItem($fi, true);
1748 
1749  $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
1750  }
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 1752 of file class.ilObjMediaObjectGUI.php.

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

1752  : void
1753  {
1754  try {
1755  $this->object->uploadMultipleSubtitleFile(ilArrayUtil::stripSlashesArray($_FILES["subtitle_file"]));
1756  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
1757  } catch (ilMediaObjectsException $e) {
1758  $this->tpl->setOnScreenMessage('failure', $e->getMessage(), true);
1759  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
1760  }
1761  }
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 1671 of file class.ilObjMediaObjectGUI.php.

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

1671  : void
1672  {
1673  $lng = $this->lng;
1674  $ilCtrl = $this->ctrl;
1675 
1676  if ($this->object->uploadSrtFile(
1677  $_FILES["subtitle_file"]["tmp_name"],
1678  $this->sub_title_request->getLanguage()
1679  )) {
1680  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1681  }
1682  $ilCtrl->redirect($this, "listSubtitleFiles");
1683  }
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 43 of file class.ilObjMediaObjectGUI.php.

Referenced by getAdvMdRecordObject().

◆ $adv_subtype

string ilObjMediaObjectGUI::$adv_subtype = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_type

string ilObjMediaObjectGUI::$adv_type = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $back_title

string ilObjMediaObjectGUI::$back_title = ""
protected

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

◆ $enabledmapareas

bool ilObjMediaObjectGUI::$enabledmapareas = true

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

Referenced by getEnabledMapAreas().

◆ $error

ilErrorHandling ilObjMediaObjectGUI::$error
protected

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

◆ $file_service_settings

ilFileServicesSettings ilObjMediaObjectGUI::$file_service_settings
protected

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

◆ $form_gui

ilPropertyFormGUI ilObjMediaObjectGUI::$form_gui
protected

◆ $header

string ilObjMediaObjectGUI::$header = ""

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

Referenced by getHeader().

◆ $height_preset

int ilObjMediaObjectGUI::$height_preset = 0
protected

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

Referenced by getHeightPreset().

◆ $help

ilHelpGUI ilObjMediaObjectGUI::$help
protected

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

Referenced by createObject(), and getTabs().

◆ $media_type

ILIAS MediaObjects MediaType MediaTypeManager ilObjMediaObjectGUI::$media_type
protected

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

◆ $sub_title_request

SubtitlesGUIRequest ilObjMediaObjectGUI::$sub_title_request
protected

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

◆ $tabs

ilTabsGUI ilObjMediaObjectGUI::$tabs
protected

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

Referenced by setPropertiesSubTabs(), and showAllUsagesObject().

◆ $target_script

string ilObjMediaObjectGUI::$target_script = ""

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

◆ $video_gui

ILIAS MediaObjects Video GUIService ilObjMediaObjectGUI::$video_gui
protected

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

◆ $width_preset

int ilObjMediaObjectGUI::$width_preset = 0
protected

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

Referenced by getWidthPreset().


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