ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 ()
 
 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
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _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 ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Protected Member Functions

 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...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

ILIAS MediaObjects MediaObjectManager $media_manager
 
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
 
MetadataManager $md
 
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
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

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, ilContainerResourceGUI

Definition at line 30 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 59 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().

64  {
65  global $DIC;
66 
67  $this->access = $DIC->access();
68  $this->error = $DIC["ilErr"];
69  $this->help = $DIC["ilHelp"];
70  $this->tabs = $DIC->tabs();
71  $this->toolbar = $DIC->toolbar();
72  $this->user = $DIC->user();
73  $lng = $DIC->language();
74  $ilCtrl = $DIC->ctrl();
75  $domain = $DIC->mediaObjects()
76  ->internal()
77  ->domain();
78  $this->media_type = $domain->mediaType();
79 
80  $this->ctrl = $ilCtrl;
81  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
82  $this->lng = $lng;
83  $this->back_title = "";
84  $this->type = "mob";
85 
86  $this->sub_title_request = $DIC->mediaObjects()
87  ->internal()
88  ->gui()
89  ->subTitles()
90  ->request();
91 
92  $lng->loadLanguageModule("mob");
93  $this->file_service_settings = $DIC->fileServiceSettings();
94  $this->video_gui = $DIC->mediaObjects()->internal()->gui()->video();
95  $this->md = $DIC->mediaObjects()->internal()->domain()->metadata();
96  $this->media_manager = $domain->mediaObject();
97  }
loadLanguageModule(string $a_module)
Load language module.
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
__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 1373 of file class.ilObjMediaObjectGUI.php.

References $DIC, Vendor\Package\$e, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilObjectGUI\$type, ILIAS\UICore\GlobalTemplate\get(), ilObjMediaObject\getMediaItem(), ilObjMediaObject\hasFullscreenItem(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\setVariable(), and ilLanguage\txt().

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

1375  : string {
1376  global $DIC;
1377 
1378  $lng = $DIC->language();
1379  $lom_services = $DIC->learningObjectMetadata();
1380  $media_manager = $DIC->mediaObjects()->internal()->domain()->mediaObject();
1381 
1382  $tpl = new ilTemplate("tpl.media_info.html", true, true, "components/ILIAS/MediaObjects");
1383  $types = array("Standard", "Fullscreen");
1384  foreach ($types as $type) {
1385  if ($type == "Fullscreen" && !$a_mob->hasFullscreenItem()) {
1386  continue;
1387  }
1388 
1389  $med = $a_mob->getMediaItem($type);
1390  if (!$med) {
1391  return "";
1392  }
1393 
1394  $tpl->setCurrentBlock("media_info");
1395  if ($type == "Standard") {
1396  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1397  } else {
1398  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1399  }
1400  $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
1401  $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1402  if ($med->getLocationType() == "LocalFile") {
1403 
1404  try {
1405  $info = $media_manager->getInfoOfEntry($med->getMobId(), "/" . $med->getLocation());
1406  } catch (Exception $e) {
1407  }
1408 
1409  $size = $info["size"] ?? 0;
1410  $tpl->setVariable("VAL_FILE_SIZE", " ($size " . $lng->txt("bytes") . ")");
1411  }
1412  $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1413  $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1414  if ($med->getWidth() != "" && $med->getHeight() != "") {
1415  $tpl->setCurrentBlock("size");
1416  $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1417  $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
1419  }
1420 
1421  // original size
1422  if ($orig_size = $med->getOriginalSize()) {
1423  if (($orig_size["width"] ?? "") !== $med->getWidth() ||
1424  ($orig_size["height"] ?? "") !== $med->getHeight()) {
1425  $tpl->setCurrentBlock("orig_size");
1426  $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1427  $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1428  $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1430  }
1431  }
1432 
1433  // output caption
1434  if (strlen($med->getCaption())) {
1435  $tpl->setCurrentBlock('additional_info');
1436  $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
1438  }
1439 
1440  // output keywords
1441  if ($type == "Standard") {
1442  $keyword_data = $lom_services
1443  ->read(0, $med->getMobId(), 'mob', $lom_services->paths()->keywords())
1444  ->allData($lom_services->paths()->keywords());
1445  $presentable_keywords = $lom_services->dataHelper()->makePresentableAsList(
1446  ', ',
1447  ...$keyword_data
1448  );
1449  if ($presentable_keywords !== '') {
1450  $tpl->setCurrentBlock('additional_info');
1451  $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . $presentable_keywords);
1453  }
1454  }
1455 
1456  $tpl->setCurrentBlock("media_info");
1458  }
1459 
1460  return $tpl->get();
1461  }
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
ILIAS MediaObjects MediaObjectManager $media_manager
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...
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ilLanguage $lng
ilGlobalTemplateInterface $tpl
global $DIC
Definition: shib_login.php:22
getMediaItem(string $a_purpose)
get item for media purpose
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
+ 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 1297 of file class.ilObjMediaObjectGUI.php.

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

1297  : void
1298  {
1299  if (!$this->object->hasFullscreenItem()) {
1300  $std_item = $this->object->getMediaItem("Standard");
1301  $full_item = new ilMediaItem();
1302  $full_item->setMobId($std_item->getMobId());
1303  $full_item->setLocation($std_item->getLocation());
1304  $full_item->setLocationType($std_item->getLocationType());
1305  $full_item->setFormat($std_item->getFormat());
1306  $full_item->setWidth($std_item->getWidth());
1307  $full_item->setHeight($std_item->getHeight());
1308  $full_item->setCaption($std_item->getCaption());
1309  $full_item->setTextRepresentation($std_item->getTextRepresentation());
1310  $full_item->setPurpose("Fullscreen");
1311  $this->object->addMediaItem($full_item);
1312 
1313  $this->object->update();
1314  }
1315 
1316  $this->ctrl->redirect($this, "edit");
1317  }
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the call graph for this function:

◆ assignFullscreenObject()

ilObjMediaObjectGUI::assignFullscreenObject ( string  $a_file)

assign file to fullscreen view

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

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

1244  : void {
1245  // determine directory
1246  $cur_subdir = dirname($a_file);
1247  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1248  $cur_dir = (!empty($cur_subdir))
1249  ? $mob_dir . "/" . $cur_subdir
1250  : $mob_dir;
1251  $file = $cur_dir . "/" . basename($a_file);
1252  $location = $a_file;
1253 
1254  if (!is_file($file)) {
1255  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1256  }
1257 
1258  if (!$this->object->hasFullscreenItem()) { // create new fullscreen item
1259  $std_item = $this->object->getMediaItem("Standard");
1260  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1261  $file = $mob_dir . "/" . $location;
1262  $full_item = new ilMediaItem();
1263  $full_item->setMobId($std_item->getMobId());
1264  $full_item->setLocation($location);
1265  $full_item->setLocationType("LocalFile");
1266  $full_item->setFormat(ilObjMediaObject::getMimeType($file));
1267  $full_item->setPurpose("Fullscreen");
1268  $this->object->addMediaItem($full_item);
1269  } else { // alter existing fullscreen item
1270  $full_item = $this->object->getMediaItem("Fullscreen");
1271 
1272  $full_item->setLocationType("LocalFile");
1273  $full_item->setLocation($location);
1274  $format = ilObjMediaObject::getMimeType($file);
1275  $full_item->setFormat($format);
1276  }
1277  $this->object->update();
1278  // $this->ctrl->saveParameter($this, "cdir");
1279  $this->ctrl->redirectByClass(ilContainerResourceGUI::class, "listFiles");
1280  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$location
Definition: buildRTE.php:22
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
Class ilMediaItem Media Item, component of a media object (file or reference)
Class ilObjForumAdministration.
+ Here is the call graph for this function:

◆ assignObject()

ilObjMediaObjectGUI::assignObject ( )
protected

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

180  : void
181  {
182  if ($this->id != 0) {
183  $this->object = new ilObjMediaObject($this->id);
184  }
185  }

◆ assignStandardObject()

ilObjMediaObjectGUI::assignStandardObject ( string  $a_file)

assign file to standard view

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

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

1214  : void {
1215  // determine directory
1216  $cur_subdir = dirname($a_file);
1217  $mob_dir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1218  $cur_dir = (!empty($cur_subdir))
1219  ? $mob_dir . "/" . $cur_subdir
1220  : $mob_dir;
1221  $file = $cur_dir . "/" . basename($a_file);
1222  $location = $a_file;
1223 
1224  if (!is_file($file)) {
1225  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1226  }
1227 
1228  $std_item = $this->object->getMediaItem("Standard");
1229  $std_item->setLocationType("LocalFile");
1230  $std_item->setLocation($location);
1231  $format = ilObjMediaObject::getMimeType($file);
1232  $std_item->setFormat($format);
1233  $this->object->update();
1234  // $this->ctrl->saveParameter($this, "cdir");
1235  $this->ctrl->redirectByClass(ilContainerResourceGUI::class, "listFiles");
1236  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$location
Definition: buildRTE.php:22
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
Class ilObjForumAdministration.
+ Here is the call graph for this function:

◆ cancelMultiSrtObject()

ilObjMediaObjectGUI::cancelMultiSrtObject ( )

Cancel Multi Feedback.

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

References ILIAS\Repository\ctrl().

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

◆ cancelObject()

ilObjMediaObjectGUI::cancelObject ( )

Cancel saving.

Exceptions
ilCtrlException

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

References ILIAS\Repository\ctrl().

861  : void
862  {
863  $this->ctrl->returnToParent($this);
864  }
+ Here is the call graph for this function:

◆ checkFixSize()

ilObjMediaObjectGUI::checkFixSize ( )
protected

Check fix size (for map editing hint)

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

References ILIAS\Repository\lng().

Referenced by returnToContextObject().

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

◆ checkFormInput()

ilObjMediaObjectGUI::checkFormInput ( )

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

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

◆ confirmSrtDeletionObject()

ilObjMediaObjectGUI::confirmSrtDeletionObject ( )

Confirm srt file deletion.

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

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

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

◆ deleteSrtFilesObject()

ilObjMediaObjectGUI::deleteSrtFilesObject ( )

Delete srt files.

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

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

1700  : void
1701  {
1702  $lng = $this->lng;
1703  $ilCtrl = $this->ctrl;
1704 
1705  $srts = $this->sub_title_request->getSrtFiles();
1706  foreach ($srts as $i) {
1707  if (strlen($i) == 2 && !is_int(strpos($i, "."))) {
1708  $this->object->removeAdditionalFile("srt/subtitle_" . $i . ".srt");
1709  }
1710  }
1711  $this->tpl->setOnScreenMessage('success', $lng->txt("mob_srt_files_deleted"), true);
1712  $ilCtrl->redirect($this, "listSubtitleFiles");
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...
ilLanguage $lng
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:

◆ editObject()

ilObjMediaObjectGUI::editObject ( )

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

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

866  : void
867  {
868  $tpl = $this->tpl;
869 
870  $this->setPropertiesSubTabs("general");
871  $this->video_gui->addPreviewExtractionToToolbar(
872  $this->object->getId(),
873  self::class
874  );
875  $this->initForm("edit");
876  $this->getValues();
877  $tpl->setContent($this->form_gui->getHTML());
878  }
setPropertiesSubTabs(string $a_active)
setContent(string $a_html)
Sets content for standard template.
getValues()
Get values for form.
ilGlobalTemplateInterface $tpl
initForm(string $a_mode="create")
+ Here is the call graph for this function:

◆ extractPreviewImageObject()

ilObjMediaObjectGUI::extractPreviewImageObject ( )

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

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

880  : void
881  {
882  $ilCtrl = $this->ctrl;
883  $this->video_gui->handleExtractionRequest(
884  $this->object->getId()
885  );
886  $ilCtrl->redirect($this, "edit");
887  }
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 117 of file class.ilObjMediaObjectGUI.php.

References $adv_ref_id, $adv_subtype, $adv_type, and null.

117  : ?array
118  {
119  if ($this->adv_type == null) {
120  throw new ilMediaObjectsException("Missing obj type (getAdvMdRecordObject)");
121  // seems to be obsolete, since $this->obj_type is non-existent
122  //return [$this->ref_id, $this->obj_type, $this->sub_type];
123  }
125  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getEnabledMapAreas()

ilObjMediaObjectGUI::getEnabledMapAreas ( )

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

References $enabledmapareas.

Referenced by getTabs().

144  : bool
145  {
146  return $this->enabledmapareas;
147  }
+ Here is the caller graph for this function:

◆ getForm()

ilObjMediaObjectGUI::getForm ( )

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

References $form_gui.

176  {
177  return $this->form_gui;
178  }

◆ getFullscreenSizeObject()

ilObjMediaObjectGUI::getFullscreenSizeObject ( )

set original size of fullscreen file

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

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

957  : void
958  {
959  $full_item = $this->object->getMediaItem("Fullscreen");
960  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
961 
962  if ($full_item->getLocationType() == "LocalFile") {
963  $file = $mob_dir . "/" . $full_item->getLocation();
964  $size = ilMediaImageUtil::getImageSize($file);
965  $full_item->setWidth($size[0]);
966  $full_item->setHeight($size[1]);
967  $this->object->update();
968  }
969  $this->ctrl->redirect($this, "edit");
970  }
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 133 of file class.ilObjMediaObjectGUI.php.

References $header.

133  : string
134  {
135  return $this->header;
136  }

◆ getHeightPreset()

ilObjMediaObjectGUI::getHeightPreset ( )

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

References $height_preset.

Referenced by initForm().

170  : int
171  {
172  return $this->height_preset;
173  }
+ Here is the caller graph for this function:

◆ getStandardSizeObject()

ilObjMediaObjectGUI::getStandardSizeObject ( )

set original size of standard file

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

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

936  : void
937  {
938  $std_item = $this->object->getMediaItem("Standard");
939  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
940 
941  if ($std_item->getLocationType() == "LocalFile") {
942  $file = $mob_dir . "/" . $std_item->getLocation();
943 
944  $size = ilMediaImageUtil::getImageSize($file);
945 
946  $std_item->setWidth($size[0]);
947  $std_item->setHeight($size[1]);
948  $this->object->update();
949  }
950  $this->ctrl->redirect($this, "edit");
951  }
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 1482 of file class.ilObjMediaObjectGUI.php.

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

Referenced by setTabs().

1482  : void
1483  {
1484  $ilHelp = $this->help;
1485 
1486  $ilHelp->setScreenIdComponent("mob");
1487 
1488  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1489  && $this->object->getId() > 0) {
1490  // object properties
1491  $this->tabs_gui->addTarget(
1492  "cont_mob_def_prop",
1493  $this->ctrl->getLinkTarget($this, "edit"),
1494  "edit",
1495  get_class($this)
1496  );
1497 
1498  $st_item = $this->object->getMediaItem("Standard");
1499 
1500  // link areas
1501 
1502  if (is_object($st_item) && $this->getEnabledMapAreas()) {
1503  $format = $st_item->getFormat();
1504  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg"))) {
1505  $this->tabs_gui->addTarget(
1506  "cont_def_map_areas",
1507  $this->ctrl->getLinkTargetByClass(
1508  array("ilobjmediaobjectgui", "ilimagemapeditorgui"),
1509  "editMapAreas"
1510  ),
1511  "editMapAreas",
1512  "ilimagemapeditorgui"
1513  );
1514  }
1515  }
1516 
1517  // object usages
1518  $this->tabs_gui->addTarget(
1519  "cont_mob_usages",
1520  $this->ctrl->getLinkTarget($this, "showUsages"),
1521  "showUsages",
1522  get_class($this)
1523  );
1524 
1525  // object files
1526  $std_item = $this->object->getMediaItem("Standard");
1527  $full_item = $this->object->getMediaItem("Fullscreen");
1528  $mset = new ilSetting("mobs");
1529  if ($mset->get("file_manager_always") ||
1530  ($this->media_type->usesParameterProperty($std_item->getFormat()) ||
1531  (is_object($full_item) && $this->media_type->usesParameterProperty($full_item->getFormat())))
1532  ) {
1533  $this->tabs_gui->addTarget(
1534  "cont_files",
1535  $this->ctrl->getLinkTargetByClass(
1536  array("ilobjmediaobjectgui", ilContainerResourceGUI::class),
1537  ""
1538  ),
1539  "",
1540  "ilContainerResourceGUI"
1541  );
1542  }
1543 
1544  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1545  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1546  if ($mdtab) {
1547  $this->tabs_gui->addTarget(
1548  "meta_data",
1549  $mdtab,
1550  "",
1551  "ilmdeditorgui"
1552  );
1553  }
1554  }
1555 
1556  // back to upper context
1557  if ($this->back_title != "") {
1558  $this->tabs_gui->setBackTarget(
1559  $this->back_title,
1560  $this->ctrl->getParentReturn($this)
1561  );
1562  }
1563  }
Class ilObjectMetaDataGUI.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 562 of file class.ilObjMediaObjectGUI.php.

References ILIAS\Repository\object().

Referenced by editObject().

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

◆ getWidthPreset()

ilObjMediaObjectGUI::getWidthPreset ( )

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

References $width_preset.

Referenced by initForm().

157  : int
158  {
159  return $this->width_preset;
160  }
+ 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 1568 of file class.ilObjMediaObjectGUI.php.

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

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

1570  : void {
1571  global $DIC;
1572 
1573  $tpl = $DIC["tpl"];
1574 
1575  if ($a_tpl == null) {
1576  $a_tpl = $tpl;
1577  }
1578 
1579  iljQueryUtil::initjQuery($a_tpl);
1580  $a_tpl->addJavaScript(iljQueryUtil::getLocalMaphilightPath());
1581  $a_tpl->addJavaScript("components/ILIAS/COPage/js/ilCOPagePres.js");
1582 
1583  //ilPlayerUtil::initMediaElementJs($a_tpl);
1584  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilGlobalTemplateInterface $tpl
static initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
global $DIC
Definition: shib_login.php:22
static getLocalMaphilightPath()
Get local path of maphilight file.
+ 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, ilObjectGUI\$lng, ilSubEnabledFormPropertyGUI\addSubItem(), ilRadioOption\addSubItem(), getHeightPreset(), getWidthPreset(), null, 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(iterator_to_array($this->media_type->getAllowedSuffixes()));
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  if ($this->object) {
385  $this->video_gui->addPreviewInput($this->form_gui, $this->object->getId());
386  }
387 
388  // standard parameters
389  if ($a_mode == "edit" &&
390  $this->media_type->usesParameterProperty($std_item->getFormat())) {
391  if ($this->media_type->usesAutoStartParameterOnly(
392  $std_item->getLocation(),
393  $std_item->getFormat()
394  )) { // autostart
395  /*$auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "standard_autostart");
396  $this->form_gui->addItem($auto);*/
397  } else { // parameters
398  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "standard_parameters");
399  $par->setRows(5);
400  $par->setCols(50);
401  $this->form_gui->addItem($par);
402  }
403  }
404 
405  if ($a_mode == "edit") {
406  $full_item = $this->object->getMediaItem("Fullscreen");
407  }
408 
409  // fullscreen view resource
410  $fs_sec = new ilFormSectionHeaderGUI();
411  $fs_sec->setTitle($lng->txt("cont_fullscreen"));
412  $this->form_gui->addItem($fs_sec);
413 
414  $radio_prop2 = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "full_type");
415  $op1 = new ilRadioOption($lng->txt("cont_none"), "None");
416  $radio_prop2->addOption($op1);
417  $op4 = new ilRadioOption($lng->txt("cont_use_same_resource_as_above"), "Standard");
418  $radio_prop2->addOption($op4);
419  $op2 = new ilRadioOption($lng->txt("cont_file"), "File");
420  $up = new ilFileInputGUI("", "full_file");
421  $up->setSuffixes(iterator_to_array($this->media_type->getAllowedSuffixes()));
422  //$up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
423  $up->setInfo("");
424  if ($a_mode == "create" || !$full_item || $full_item->getLocationType() != "LocalFile") {
425  $up->setRequired(true);
426  }
427  $op2->addSubItem($up);
428  $radio_prop2->addOption($op2);
429  $op3 = new ilRadioOption($lng->txt("url"), "Reference");
430  $ref = new ilUriInputGUI("", "full_reference");
431  $ref->setInfo($lng->txt("cont_ref_helptext"));
432  $ref->setRequired(true);
433  $op3->addSubItem($ref);
434  $radio_prop2->addOption($op3);
435  $radio_prop2->setValue("None");
436  $this->form_gui->addItem($radio_prop2);
437 
438  // fullscreen format
439  if ($a_mode == "edit") {
440  if ($this->object->hasFullscreenItem()) {
441  $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "full_format");
442  $format->setValue($full_item->getFormat());
443  $this->form_gui->addItem($format);
444  }
445  }
446 
447  // fullscreen size
448  $full_support_constraint_props = false;
449  $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_size");
450  if ($a_mode == "edit") {
451  $add_str = "";
452  if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
453  $add_str = " (" . ($orig_size["width"] ?? "") . " x " . ($orig_size["height"] ?? "") . ")";
454 
455  if (is_int(strpos($full_item->getFormat(), "image"))
456  && $full_item->getLocationType() == "LocalFile") {
457  $full_support_constraint_props = true;
458  }
459  }
460  $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
461  $op1->setInfo($lng->txt("cont_resource_size_info"));
462  $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
463  } else {
464  $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
465  $op1->setInfo($lng->txt("cont_resource_size_info"));
466  $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
467  }
468  $radio_size->addOption($op1);
469 
470  // width/height
471  $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") .
472  " / " . $lng->txt("cont_height"), "full_width_height");
473  if ($full_support_constraint_props) {
474  $width_height->setSupportConstraintsProps(true);
475  $width_height->setConstrainProportions(true);
476  }
477  $op2->addSubItem($width_height);
478 
479  // resize image
480  if ($a_mode == "edit") {
481  $full_item = $this->object->getMediaItem("Fullscreen");
482  if ($this->object->hasFullscreenItem() &&
483  is_int(strpos($full_item->getFormat(), "image")) &&
484  $full_item->getLocationType() == "LocalFile") {
485  $resize = new ilCheckboxInputGUI(
486  $lng->txt("cont_resize_img"),
487  "full_resize"
488  );
489  $op2->addSubItem($resize);
490  }
491  }
492 
493  $radio_size->setValue("original");
494  $radio_size->addOption($op2);
495  $this->form_gui->addItem($radio_size);
496 
497  // fullscreen caption
498  $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "full_caption");
499  $caption->setCols(30);
500  $caption->setRows(2);
501  $this->form_gui->addItem($caption);
502 
503  /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "full_caption");
504  $caption->setSize(40);
505  $caption->setMaxLength(200);
506  $this->form_gui->addItem($caption);*/
507 
508  // text representation (alt text)
509  if ($a_mode == "edit" && $this->object->hasFullscreenItem() && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
510  $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "full_text_representation");
511  $ta->setCols(30);
512  $ta->setRows(2);
513  $ta->setInfo($lng->txt("text_repr_info"));
514  $this->form_gui->addItem($ta);
515  }
516 
517 
518  // fullscreen parameters
519  if ($a_mode == "edit" && $this->object->hasFullscreenItem() &&
520  $this->media_type->usesParameterProperty($full_item->getFormat())) {
521  if ($this->media_type->usesAutoStartParameterOnly(
522  $full_item->getLocation(),
523  $full_item->getFormat()
524  )) {
525  /*$auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "full_autostart");
526  $this->form_gui->addItem($auto);*/
527  } else {
528  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "full_parameters");
529  $par->setRows(5);
530  $par->setCols(50);
531  $this->form_gui->addItem($par);
532  }
533  }
534 
535 
536  if ($a_mode == "edit") {
537  $this->form_gui->setTitle($lng->txt("cont_edit_mob"));
538  $this->form_gui->addCommandButton("saveProperties", $lng->txt("save"));
539  } else {
540  $this->form_gui->setTitle($lng->txt("cont_insert_mob"));
541  $this->form_gui->addCommandButton("save", $lng->txt("save"));
542  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
543  }
544  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
545  }
This class represents an option in a radio group.
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 1286 of file class.ilObjMediaObjectGUI.php.

References ILIAS\Repository\ctrl().

1286  : void
1287  {
1288  $this->object->removeMediaItem("Fullscreen");
1289  $this->object->update();
1290 
1291  $this->ctrl->redirect($this, "edit");
1292  }
+ Here is the call graph for this function:

◆ resizeImagesObject()

ilObjMediaObjectGUI::resizeImagesObject ( )

resize images to specified size

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

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

892  : void
893  {
894  // directory
895  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
896 
897  // standard item
898  $std_item = $this->object->getMediaItem("Standard");
899  if ($std_item->getLocationType() == "LocalFile" &&
900  is_int(strpos($std_item->getFormat(), "image"))
901  ) {
902  $file = $mob_dir . "/" . $std_item->getLocation();
904  $file,
905  $std_item->getWidth(),
906  $std_item->getHeight()
907  );
908  $std_item->setLocation($location);
909  $std_item->update();
910  }
911 
912  // fullscreen item
913  if ($this->object->hasFullscreenItem()) {
914  $full_item = $this->object->getMediaItem("Fullscreen");
915  if ($full_item->getLocationType() == "LocalFile" &&
916  is_int(strpos($full_item->getFormat(), "image"))
917  ) {
918  $file = $mob_dir . "/" . $full_item->getLocation();
920  $file,
921  $full_item->getWidth(),
922  $full_item->getHeight()
923  );
924  $full_item->setLocation($location);
925  $full_item->update();
926  }
927  }
928 
929  $this->ctrl->redirect($this, "edit");
930  }
$location
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 1770 of file class.ilObjMediaObjectGUI.php.

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

1770  : void
1771  {
1772  $ilCtrl = $this->ctrl;
1773  $srt_files = $this->object->getMultiSrtFiles();
1774  $files = $this->sub_title_request->getFiles();
1775  foreach ($files as $f) {
1776  foreach ($srt_files as $srt_file) {
1777  if ($f == $srt_file["filename"]) {
1778  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir() . "/" . $srt_file["filename"], $srt_file["lang"], "rename");
1779  }
1780  }
1781  }
1782  $this->object->clearMultiSrtDirectory();
1783  $ilCtrl->redirect($this, "listSubtitleFiles");
1784  }
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 650 of file class.ilObjMediaObjectGUI.php.

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

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

◆ savePropertiesObject()

ilObjMediaObjectGUI::savePropertiesObject ( )

Definition at line 972 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\getMimeType(), initForm(), ILIAS\Repository\int(), null, ILIAS\Repository\object(), ilUtil\secureLink(), ILIAS\UICore\GlobalTemplate\setContent(), ilPropertyFormGUI\setTitle(), and ilLanguage\txt().

972  : void
973  {
974  $lng = $this->lng;
975  $tpl = $this->tpl;
976  $file = "";
977  $type = "";
978 
979  $this->initForm("edit");
980  $form = $this->form_gui;
981 
982  if ($form->checkInput()) {
983  $title = trim($form->getInput("standard_title"));
984  $this->object->setTitle($title);
985 
986  $std_item = $this->object->getMediaItem("Standard");
987  $location = $std_item->getLocation();
988  $format = $std_item->getFormat();
989  if ($form->getInput("standard_type") == "Reference") {
990  $format = ilObjMediaObject::getMimeType($form->getInput("standard_reference"), true);
991  $std_item->setFormat($format);
992  $std_item->setLocation(ilUtil::secureLink($form->getInput("standard_reference")));
993  $std_item->setLocationType("Reference");
994  }
995  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
996  if ($form->getInput("standard_type") == "File") {
997  $resize = false;
998  if ($_FILES['standard_file']['name'] != "") {
999  //$file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
1000  $file_name = $_FILES['standard_file']['name'];
1001  $this->media_manager->addFileFromLegacyUpload(
1002  $this->object->getId(),
1003  $_FILES['standard_file']['tmp_name']
1004  );
1005 
1006  // get mime type
1007  $format = ilObjMediaObject::getMimeType($file_name, true);
1008  $location = $file_name;
1009 
1010  $resize = true;
1011  } elseif ($form->getInput("standard_resize")) {
1012  $file = $mob_dir . "/" . $location;
1013  $resize = true;
1014  }
1015 
1016  // resize
1017  if ($resize) {
1018  if ($form->getInput("standard_size") != "original" &&
1019  is_int(strpos($format, "image"))) {
1020  $wh_input = $form->getInput("standard_width_height");
1022  $file,
1023  (int) $wh_input["width"],
1024  (int) $wh_input["height"],
1025  (bool) ($wh_input["constr_prop"] ?? false)
1026  );
1027  }
1028  $std_item->setFormat($format);
1029  $std_item->setLocation($location);
1030  }
1031 
1032  $std_item->setLocationType("LocalFile");
1033  }
1034  $this->object->setDescription($format);
1035  // determine width and height of known image types
1036  $wh_input = $form->getInput("standard_width_height");
1038  $format,
1039  $form->getInput("standard_type"),
1040  $mob_dir . "/" . $location,
1041  $std_item->getLocation(),
1042  (bool) ($wh_input["constr_prop"] ?? false),
1043  ($form->getInput("standard_size") == "original"),
1044  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
1045  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
1046  );
1047  if ($wh["info"] != "") {
1048  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
1049  }
1050  $std_item->setWidth($wh["width"]);
1051  $std_item->setHeight($wh["height"]);
1052 
1053  // set caption
1054  $std_item->setCaption($form->getInput("standard_caption"));
1055 
1056  // text representation
1057  $std_item->setTextRepresentation($form->getInput("text_representation"));
1058 
1059  $this->video_gui->savePreviewInput($form, $this->object->getId());
1060 
1061  // set parameters
1062  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1063  if (!$this->media_type->usesAutoStartParameterOnly(
1064  $std_item->getLocation(),
1065  $std_item->getFormat()
1066  )) {
1067  $std_item->setParameters($form->getInput("standard_parameters"));
1068  }
1069  }
1070 
1071  // "None" selected
1072  if ($form->getInput("full_type") == "None") {
1073  if ($this->object->hasFullscreenItem()) { // delete existing
1074  $this->object->removeMediaItem("Fullscreen");
1075  }
1076  } else { // Not "None" -> we need one
1077  if ($this->object->hasFullscreenItem()) { // take existing one
1078  $full_item = $this->object->getMediaItem("Fullscreen");
1079  } else { // create one
1080  $full_item = new ilMediaItem();
1081  $this->object->addMediaItem($full_item);
1082  $full_item->setPurpose("Fullscreen");
1083  }
1084  $location = $full_item->getLocation();
1085  $format = $full_item->getFormat();
1086  if ($form->getInput("full_type") == "Reference") {
1087  $format = ilObjMediaObject::getMimeType($form->getInput("full_reference"), true);
1088  $full_item->setFormat($format);
1089  $full_item->setLocationType("Reference");
1090  $location = ilUtil::secureLink($form->getInput("full_reference"));
1091  $type = "Reference";
1092  $full_item->setLocation($location);
1093  }
1094  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1095  if ($form->getInput("full_type") == "File") {
1096  $resize = false;
1097  if ($_FILES['full_file']['name'] != "") {
1098  //$full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1099  $full_file_name = $_FILES['full_file']['name'];
1100  $this->media_manager->addFileFromLegacyUpload(
1101  $this->object->getId(),
1102  $_FILES['full_file']['tmp_name']
1103  );
1104 
1105  $format = ilObjMediaObject::getMimeType($file);
1106  $location = $full_file_name;
1107 
1108  $resize = true;
1109  } elseif ($form->getInput("full_resize")) {
1110  $file = $mob_dir . "/" . $location;
1111  $resize = true;
1112  }
1113 
1114  // resize
1115  if ($resize) {
1116  if ($form->getInput("full_size") != "original" &&
1117  is_int(strpos($format, "image"))) {
1118  $wh_input = $form->getInput("full_width_height");
1120  $file,
1121  (int) $wh_input["width"],
1122  (int) $wh_input["height"],
1123  (bool) ($wh_input["constr_prop"] ?? false)
1124  );
1125  }
1126  $full_item->setFormat($format);
1127  $full_item->setLocation($location);
1128  }
1129 
1130  $full_item->setLocationType("LocalFile");
1131  $type = "File";
1132  }
1133  if ($form->getInput("full_type") == "Standard") {
1134  $format = $std_item->getFormat();
1135  $location = $std_item->getLocation();
1136  $full_item->setLocationType($std_item->getLocationType());
1137  $full_item->setFormat($format);
1138  $full_item->setLocation($location);
1139  $type = $std_item->getLocationType();
1140  if ($type == "LocalFile") {
1141  $type = "File";
1142  }
1143  // resize image
1144  if ($form->getInput("full_size") != "original" &&
1145  is_int(strpos($format, "image")) &&
1146  $full_item->getLocationType() == "LocalFile") {
1147  $file = $mob_dir . "/" . $location;
1148  $wh_input = $form->getInput("full_width_height");
1150  $file,
1151  (int) $wh_input["width"],
1152  (int) $wh_input["height"],
1153  (bool) ($wh_input["constr_prop"] ?? false)
1154  );
1155  }
1156  }
1157 
1158  // determine width and height of known image types
1159  $wh_input = $form->getInput("full_width_height");
1161  $format,
1162  $type,
1163  $mob_dir . "/" . $location,
1164  $full_item->getLocation(),
1165  (bool) ($wh_input["constr_prop"] ?? false),
1166  ($form->getInput("full_size") == "original"),
1167  ($wh_input["width"] == "") ? null : (int) $wh_input["width"],
1168  ($wh_input["height"] == "") ? null : (int) $wh_input["height"]
1169  );
1170  if ($wh["info"] != "") {
1171  $this->tpl->setOnScreenMessage('info', $wh["info"], true);
1172  }
1173 
1174  $full_item->setWidth($wh["width"]);
1175  $full_item->setHeight($wh["height"]);
1176  $full_item->setLocation($location);
1177 
1178  $full_item->setCaption($form->getInput("full_caption"));
1179 
1180  // text representation
1181  $full_item->setTextRepresentation($form->getInput("full_text_representation"));
1182 
1183 
1184  // set parameters
1185  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1186  if (!$this->media_type->usesAutoStartParameterOnly(
1187  $std_item->getLocation(),
1188  $std_item->getFormat()
1189  )) {
1190  $full_item->setParameters($form->getInput("full_parameters"));
1191  }
1192  }
1193  }
1194 
1195  /*
1196  ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId()));
1197  ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId()));
1198  */ // see #20339
1199 
1200  $this->object->update();
1201  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1202  $this->ctrl->redirect($this, "edit");
1203  } else {
1204  $this->form_gui->setValuesByPost();
1205  $tpl->setContent($this->form_gui->getHTML());
1206  }
1207  }
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
Definition: buildRTE.php:22
setContent(string $a_html)
Sets content for standard template.
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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
Class ilMediaItem Media Item, component of a media object (file or reference)
initForm(string $a_mode="create")
+ 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 103 of file class.ilObjMediaObjectGUI.php.

107  : void {
108  $this->adv_ref_id = $a_adv_ref_id;
109  $this->adv_type = $a_adv_type;
110  $this->adv_subtype = $a_adv_subtype;
111  }

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

140  : void {
141  $this->enabledmapareas = $a_enabledmapareas;
142  }

◆ setHeader()

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

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

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

129  : void {
130  $this->header = $a_title;
131  }
header()
expected output: > ILIAS shows the rendered Component.
Definition: header.php:29
+ 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 165 of file class.ilObjMediaObjectGUI.php.

165  : void
166  {
167  $this->height_preset = $a_val;
168  }

◆ setObjectPerCreationForm()

ilObjMediaObjectGUI::setObjectPerCreationForm ( ilObjMediaObject  $a_mob)

Set media object values from creation form.

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

References Vendor\Package\$e, $form_gui, $location, ilObjectGUI\$type, ilObjMediaObject\_resizeImage(), ilObjMediaObject\addMediaItem(), ilObjMediaObject\addMediaItemFromLegacyUpload(), ilObjMediaObject\create(), ilObjMediaObject\fixFilename(), ilObjMediaObject\getExternalMetadata(), ilObjMediaObject\getMimeType(), ILIAS\Repository\int(), ilFileUtils\moveUploadedFile(), ilUtil\secureLink(), ilObject\setDescription(), ilObject\setTitle(), ilUtil\stripSlashes(), and ilObjMediaObject\update().

Referenced by saveObject().

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

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

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

1588  : void {
1589  $ilTabs = $this->tabs;
1590  $ilCtrl = $this->ctrl;
1591  $lng = $this->lng;
1592 
1593  $ilTabs->activateTab("cont_mob_def_prop");
1594 
1595  $ilTabs->addSubTab(
1596  "general",
1597  $lng->txt("mob_general"),
1598  $ilCtrl->getLinkTarget($this, "edit")
1599  );
1600 
1601  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1602  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4") {
1603  $ilTabs->addSubTab(
1604  "subtitles",
1605  $lng->txt("mob_subtitles"),
1606  $ilCtrl->getLinkTarget($this, "listSubtitleFiles")
1607  );
1608  }
1609 
1610  $ilTabs->activateSubTab($a_active);
1611  }
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 1466 of file class.ilObjMediaObjectGUI.php.

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

1466  : void
1467  {
1468  // catch feedback message
1469  $this->getTabs();
1470 
1471  //$this->tpl->clearHeader();
1472  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject") {
1473  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_mob.svg"));
1474  $this->tpl->setTitle($this->object->getTitle());
1475  } else {
1476  //$title = $this->object->getTitle();
1477  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_mob.svg"));
1478  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1479  }
1480  }
static getImagePath(string $image_name, 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 152 of file class.ilObjMediaObjectGUI.php.

152  : void
153  {
154  $this->width_preset = $a_val;
155  }

◆ showAllUsagesObject()

ilObjMediaObjectGUI::showAllUsagesObject ( )

Show all media object usages (incl history)

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

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

1322  : void
1323  {
1324  $this->showUsagesObject(true);
1325  }
+ Here is the call graph for this function:

◆ showMultiSubtitleConfirmationTableObject()

ilObjMediaObjectGUI::showMultiSubtitleConfirmationTableObject ( )

List of srt files in zip file.

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

References ilObjectGUI\$tpl, ILIAS\UICore\GlobalTemplate\setContent(), and setPropertiesSubTabs().

1748  : void
1749  {
1750  $tpl = $this->tpl;
1751 
1752  $this->setPropertiesSubTabs("subtitles");
1753 
1754  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
1755  $tpl->setContent($tab->getHTML());
1756  }
setPropertiesSubTabs(string $a_active)
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...
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:

◆ uploadMultipleSubtitleFileFormObject()

ilObjMediaObjectGUI::uploadMultipleSubtitleFileFormObject ( )

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

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

1715  : void
1716  {
1717  $ilToolbar = $this->toolbar;
1718  $lng = $this->lng;
1719  $ilCtrl = $this->ctrl;
1720 
1721  $this->tpl->setOnScreenMessage('info', $lng->txt("mob_upload_multi_srt_howto"));
1722 
1723  $this->setPropertiesSubTabs("subtitles");
1724 
1725  // upload file
1726  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1727  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.zip)", "subtitle_file");
1728  $fi->setSuffixes(array("zip"));
1729  $ilToolbar->addInputItem($fi, true);
1730 
1731  $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
1732  }
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 1734 of file class.ilObjMediaObjectGUI.php.

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

1734  : void
1735  {
1736  try {
1737  $this->object->uploadMultipleSubtitleFile(ilArrayUtil::stripSlashesArray($_FILES["subtitle_file"]));
1738  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
1739  } catch (ilMediaObjectsException $e) {
1740  $this->tpl->setOnScreenMessage('failure', $e->getMessage(), true);
1741  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
1742  }
1743  }
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 1653 of file class.ilObjMediaObjectGUI.php.

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

1653  : void
1654  {
1655  $lng = $this->lng;
1656  $ilCtrl = $this->ctrl;
1657 
1658  if ($this->object->uploadSrtFile(
1659  $_FILES["subtitle_file"]["tmp_name"],
1660  $this->sub_title_request->getLanguage()
1661  )) {
1662  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1663  }
1664  $ilCtrl->redirect($this, "listSubtitleFiles");
1665  }
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
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:

Field Documentation

◆ $adv_ref_id

int ilObjMediaObjectGUI::$adv_ref_id = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_subtype

string ilObjMediaObjectGUI::$adv_subtype = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_type

string ilObjMediaObjectGUI::$adv_type = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $back_title

string ilObjMediaObjectGUI::$back_title = ""
protected

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

◆ $enabledmapareas

bool ilObjMediaObjectGUI::$enabledmapareas = true

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

Referenced by getEnabledMapAreas().

◆ $error

ilErrorHandling ilObjMediaObjectGUI::$error
protected

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

◆ $file_service_settings

ilFileServicesSettings ilObjMediaObjectGUI::$file_service_settings
protected

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

◆ $form_gui

ilPropertyFormGUI ilObjMediaObjectGUI::$form_gui
protected

◆ $header

string ilObjMediaObjectGUI::$header = ""

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

Referenced by getHeader().

◆ $height_preset

int ilObjMediaObjectGUI::$height_preset = 0
protected

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

Referenced by getHeightPreset().

◆ $help

ilHelpGUI ilObjMediaObjectGUI::$help
protected

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

Referenced by createObject(), and getTabs().

◆ $md

MetadataManager ilObjMediaObjectGUI::$md
protected

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

◆ $media_manager

ILIAS MediaObjects MediaObjectManager ilObjMediaObjectGUI::$media_manager
protected

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

◆ $media_type

ILIAS MediaObjects MediaType MediaTypeManager ilObjMediaObjectGUI::$media_type
protected

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

◆ $sub_title_request

SubtitlesGUIRequest ilObjMediaObjectGUI::$sub_title_request
protected

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

◆ $tabs

ilTabsGUI ilObjMediaObjectGUI::$tabs
protected

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

Referenced by setPropertiesSubTabs(), and showAllUsagesObject().

◆ $target_script

string ilObjMediaObjectGUI::$target_script = ""

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

◆ $video_gui

ILIAS MediaObjects Video GUIService ilObjMediaObjectGUI::$video_gui
protected

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

◆ $width_preset

int ilObjMediaObjectGUI::$width_preset = 0
protected

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

Referenced by getWidthPreset().


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