ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjMediaObjectGUI Class Reference

Class ilObjMediaObjectGUI. More...

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

Public Member Functions

 __construct ($a_data, $a_id=0, $a_call_by_reference=false, $a_prepare_output=false)
 
 setAdvMdRecordObject ($a_adv_ref_id, $a_adv_type, $a_adv_subtype="-")
 Set object, that defines the adv md records being used. More...
 
 getAdvMdRecordObject ()
 Get adv md record type. More...
 
 setHeader ($a_title="")
 
 getHeader ()
 
 setEnabledMapAreas ($a_enabledmapareas)
 Set Enable map areas. More...
 
 getEnabledMapAreas ()
 Get Enable map areas. More...
 
 setWidthPreset ($a_val)
 Set width preset. More...
 
 getWidthPreset ()
 Get width preset. More...
 
 setHeightPreset ($a_val)
 Set height preset. More...
 
 getHeightPreset ()
 Get height preset. More...
 
 getForm ()
 Get form. More...
 
 assignObject ()
 
 returnToContextObject ()
 
 executeCommand ()
 Execute current command. More...
 
 setBackTitle ($a_title)
 set title for back tab More...
 
 createObject ()
 create new media object form More...
 
 initForm ($a_mode="create")
 Init creation form. More...
 
 getValues ()
 Get values for form. More...
 
 saveObject ()
 create new media object in dom and update page in db More...
 
 checkFormInput ()
 chechInputForm More...
 
 cancelObject ()
 Cancel saving. More...
 
 editObject ()
 edit media object properties More...
 
 resizeImagesObject ()
 resize images to specified size More...
 
 getStandardSizeObject ()
 set original size of standard file More...
 
 getFullscreenSizeObject ()
 set original size of fullscreen file More...
 
 savePropertiesObject ()
 save properties in db and return to page edit screen More...
 
 editFilesObject ()
 administrate files of media object More...
 
 createDirectoryObject ()
 create directory More...
 
 uploadFileObject ()
 upload file More...
 
 assignStandardObject ($a_file)
 assign file to standard view More...
 
 assignFullscreenObject ($a_file)
 assign file to fullscreen view More...
 
 removeFullscreenObject ()
 remove fullscreen view More...
 
 addFullscreenObject ()
 add fullscreen view More...
 
 deleteFileObject ()
 delete object file More...
 
 showAllUsagesObject ()
 Show all media object usages (incl history) More...
 
 showUsagesObject ($a_all=false)
 show all usages of mob More...
 
 setTabs ()
 set admin tabs More...
 
 getTabs ()
 Get Tabs. More...
 
 showVideoToolObject ()
 Show video tools. More...
 
 setPropertiesSubTabs ($a_active)
 Set subtabs for properties. More...
 
 listSubtitleFilesObject ()
 List subtitls files. More...
 
 uploadSubtitleFileObject ()
 Upload srt file. More...
 
 confirmSrtDeletionObject ()
 Confirm srt file deletion. More...
 
 deleteSrtFilesObject ()
 Delete srt files. More...
 
 uploadMultipleSubtitleFileFormObject ()
 Upload multiple stubtitles. More...
 
 uploadMultipleSubtitleFileObject ()
 Upload multiple subtitles. More...
 
 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
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 

Static Public Member Functions

static setObjectPerCreationForm ($a_mob)
 Set media object values from creation form. More...
 
static _getMediaInfoHTML (&$a_mob)
 get media info as html More...
 
static includePresentationJS ($a_tpl=null)
 Include media object presentation JS. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Data Fields

 $ctrl
 
 $header
 
 $target_script
 
 $enabledmapareas = true
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 checkFixSize ()
 Check fix size. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_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 $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $access
 
 $error
 
 $help
 
 $tabs
 
 $toolbar
 
 $user
 
 $adv_ref_id = null
 
 $adv_type = null
 
 $adv_subtype = null
 
- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 

Detailed Description

Class ilObjMediaObjectGUI.

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

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ ilObjMediaObjectGUI: ilObjectMetaDataGUI, ilImageMapEditorGUI, ilFileSystemGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaObjectGUI::__construct (   $a_data,
  $a_id = 0,
  $a_call_by_reference = false,
  $a_prepare_output = false 
)

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

References $DIC, $ilCtrl, ilObjectGUI\$lng, and user().

74  {
75  global $DIC;
76 
77  $this->tpl = $DIC["tpl"];
78  $this->access = $DIC->access();
79  $this->error = $DIC["ilErr"];
80  $this->help = $DIC["ilHelp"];
81  $this->tabs = $DIC->tabs();
82  $this->toolbar = $DIC->toolbar();
83  $this->user = $DIC->user();
84  $lng = $DIC->language();
85  $ilCtrl = $DIC->ctrl();
86 
87  $this->ctrl = $ilCtrl;
88  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
89  $this->lng = $lng;
90  $this->back_title = "";
91  $this->type = "mob";
92 
93  $lng->loadLanguageModule("mob");
94  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ _getMediaInfoHTML()

static ilObjMediaObjectGUI::_getMediaInfoHTML ( $a_mob)
static

get media info as html

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

References $DIC, ilObjectGUI\$lng, $size, ilObjectGUI\$tpl, $type, ilObjMediaObject\_getDirectory(), and ilMDKeyword\lookupKeywords().

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

1687  {
1688  global $DIC;
1689 
1690  $lng = $DIC->language();
1691 
1692  $tpl = new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
1693  $types = array("Standard", "Fullscreen");
1694  foreach ($types as $type) {
1695  if ($type == "Fullscreen" && !$a_mob->hasFullScreenItem()) {
1696  continue;
1697  }
1698 
1699  $med = $a_mob->getMediaItem($type);
1700  if (!$med) {
1701  return "";
1702  }
1703 
1704  $tpl->setCurrentBlock("media_info");
1705  if ($type == "Standard") {
1706  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1707  } else {
1708  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1709  }
1710  $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
1711  $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1712  if ($med->getLocationType() == "LocalFile") {
1713  $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
1714  if (is_file($file)) {
1715  $size = filesize($file);
1716  } else {
1717  $size = 0;
1718  }
1719  $tpl->setVariable("VAL_FILE_SIZE", " ($size " . $lng->txt("bytes") . ")");
1720  }
1721  $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1722  $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1723  if ($med->getWidth() != "" && $med->getHeight() != "") {
1724  $tpl->setCurrentBlock("size");
1725  $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1726  $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
1727  $tpl->parseCurrentBlock();
1728  }
1729 
1730  // original size
1731  if ($orig_size = $med->getOriginalSize()) {
1732  if ($orig_size["width"] != $med->getWidth() ||
1733  $orig_size["height"] != $med->getHeight()) {
1734  $tpl->setCurrentBlock("orig_size");
1735  $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1736  $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1737  $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1738  $tpl->parseCurrentBlock();
1739  }
1740  }
1741 
1742  // output caption
1743  if ($med && strlen($med->getCaption())) {
1744  $tpl->setCurrentBlock('additional_info');
1745  $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
1746  $tpl->parseCurrentBlock();
1747  }
1748 
1749  // output keywords
1750  if ($type == "Standard") {
1751  include_once './Services/MetaData/classes/class.ilMDKeyword.php';
1752  if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) {
1753  $tpl->setCurrentBlock('additional_info');
1754  $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws));
1755  $tpl->parseCurrentBlock();
1756  }
1757  }
1758 
1759  $tpl->setCurrentBlock("media_info");
1760  $tpl->parseCurrentBlock();
1761  }
1762 
1763  return $tpl->get();
1764  }
$size
Definition: RandomTest.php:84
$type
global $DIC
Definition: saml.php:7
static _getDirectory($a_mob_id)
Get absolute directory.
special template class to simplify handling of ITX/PEAR
static lookupKeywords($a_rbac_id, $a_obj_id, $a_return_ids=false)
Lookup Keywords.
+ 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 1546 of file class.ilObjMediaObjectGUI.php.

1547  {
1548  if (!$this->object->hasFullScreenItem()) {
1549  $std_item = $this->object->getMediaItem("Standard");
1550  $full_item = new ilMediaItem();
1551  $full_item->setMobId($std_item->getMobId());
1552  $full_item->setLocation($std_item->getLocation());
1553  $full_item->setLocationType($std_item->getLocationType());
1554  $full_item->setFormat($std_item->getFormat());
1555  $full_item->setWidth($std_item->getWidth());
1556  $full_item->setHeight($std_item->getHeight());
1557  $full_item->setCaption($std_item->getCaption());
1558  $full_item->setTextRepresentation($std_item->getTextRepresentation());
1559  $full_item->setPurpose("Fullscreen");
1560  $this->object->addMediaItem($full_item);
1561 
1562  $this->object->update();
1563  }
1564 
1565  $this->ctrl->redirect($this, "edit");
1566  }
Class ilMediaItem.

◆ assignFullscreenObject()

ilObjMediaObjectGUI::assignFullscreenObject (   $a_file)

assign file to fullscreen view

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

References $format, $location, ilObjMediaObject\getMimeType(), and ilUtil\getWebspaceDir().

1492  {
1493  // determine directory
1494  $cur_subdir = dirname($a_file);
1495  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1496  $cur_dir = (!empty($cur_subdir))
1497  ? $mob_dir . "/" . $cur_subdir
1498  : $mob_dir;
1499  $file = $cur_dir . "/" . basename($a_file);
1500  $location = $a_file;
1501 
1502  if (!is_file($file)) {
1503  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1504  }
1505 
1506  if (!$this->object->hasFullScreenItem()) { // create new fullscreen item
1507  $std_item = $this->object->getMediaItem("Standard");
1508  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1509  $file = $mob_dir . "/" . $location;
1510  $full_item = new ilMediaItem();
1511  $full_item->setMobId($std_item->getMobId());
1512  $full_item->setLocation($location);
1513  $full_item->setLocationType("LocalFile");
1514  $full_item->setFormat(ilObjMediaObject::getMimeType($file));
1515  $full_item->setPurpose("Fullscreen");
1516  $this->object->addMediaItem($full_item);
1517  } else { // alter existing fullscreen item
1518  $full_item = $this->object->getMediaItem("Fullscreen");
1519 
1520  $full_item->setLocationType("LocalFile");
1521  $full_item->setLocation($location);
1523  $full_item->setFormat($format);
1524  }
1525  $this->object->update();
1526  // $this->ctrl->saveParameter($this, "cdir");
1527  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1528  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$location
Definition: buildRTE.php:44
Class ilMediaItem.
redirection script todo: (a better solution should control the processing via a xml file) ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ assignObject()

ilObjMediaObjectGUI::assignObject ( )

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

203  {
204  if ($this->id != 0) {
205  $this->object = new ilObjMediaObject($this->id);
206  }
207  }
Class ilObjMediaObject.

◆ assignStandardObject()

ilObjMediaObjectGUI::assignStandardObject (   $a_file)

assign file to standard view

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

References $format, $location, ilObjMediaObject\getMimeType(), and ilUtil\getWebspaceDir().

1463  {
1464  // determine directory
1465  $cur_subdir = dirname($a_file);
1466  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1467  $cur_dir = (!empty($cur_subdir))
1468  ? $mob_dir . "/" . $cur_subdir
1469  : $mob_dir;
1470  $file = $cur_dir . "/" . basename($a_file);
1471  $location = $a_file;
1472 
1473  if (!is_file($file)) {
1474  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1475  }
1476 
1477  $std_item = $this->object->getMediaItem("Standard");
1478  $std_item->setLocationType("LocalFile");
1479  $std_item->setLocation($location);
1481  $std_item->setFormat($format);
1482  $this->object->update();
1483  // $this->ctrl->saveParameter($this, "cdir");
1484  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1485  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$location
Definition: buildRTE.php:44
redirection script todo: (a better solution should control the processing via a xml file) ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ cancelMultiSrtObject()

ilObjMediaObjectGUI::cancelMultiSrtObject ( )

Cancel Multi Feedback.

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

2121  {
2122  $this->object->clearMultiSrtDirectory();
2123  $this->ctrl->redirect($this, "listSubtitleFiles");
2124  }

◆ cancelObject()

ilObjMediaObjectGUI::cancelObject ( )

Cancel saving.

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

893  {
894  $this->ctrl->returnToParent($this);
895  }

◆ checkFixSize()

ilObjMediaObjectGUI::checkFixSize ( )
protected

Check fix size.

Parameters

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

References ilUtil\sendFailure().

Referenced by executeCommand().

579  {
580  $std_item = $this->object->getMediaItem("Standard");
581  if ($std_item->getWidth() == "" || $std_item->getHeight() == "") {
582  ilUtil::sendFailure($this->lng->txt("mob_no_fixed_size_map_editing"));
583  }
584  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkFormInput()

ilObjMediaObjectGUI::checkFormInput ( )

chechInputForm

Parameters

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

704  {
705  if (!$this->form_gui->checkInput()) {
706  $this->form_gui->setValuesByPost();
707  return false;
708  }
709  return true;
710  }

◆ confirmSrtDeletionObject()

ilObjMediaObjectGUI::confirmSrtDeletionObject ( )

Confirm srt file deletion.

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

References $_POST, $ctrl, $i, $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, and ilUtil\sendInfo().

2020  {
2021  $ilCtrl = $this->ctrl;
2022  $tpl = $this->tpl;
2023  $lng = $this->lng;
2024 
2025  $lng->loadLanguageModule("meta");
2026 
2027  if (!is_array($_POST["srt"]) || count($_POST["srt"]) == 0) {
2028  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2029  $ilCtrl->redirect($this, "listSubtitleFiles");
2030  } else {
2031  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2032  $cgui = new ilConfirmationGUI();
2033  $cgui->setFormAction($ilCtrl->getFormAction($this));
2034  $cgui->setHeaderText($lng->txt("mob_really_delete_srt"));
2035  $cgui->setCancel($lng->txt("cancel"), "listSubtitleFiles");
2036  $cgui->setConfirm($lng->txt("delete"), "deleteSrtFiles");
2037 
2038  foreach ($_POST["srt"] as $i) {
2039  $cgui->addItem("srt[]", $i, "subtitle_" . $i . ".srt (" . $lng->txt("meta_l_" . $i) . ")");
2040  }
2041 
2042  $tpl->setContent($cgui->getHTML());
2043  }
2044  }
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$i
Definition: disco.tpl.php:19
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDirectoryObject()

ilObjMediaObjectGUI::createDirectoryObject ( )

create directory

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

References $_GET, $_POST, ilUtil\getWebspaceDir(), and ilUtil\makeDir().

1412  {
1413  //echo "cdir:".$_GET["cdir"].":<br>";
1414  // determine directory
1415  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1416  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1417  $cur_dir = (!empty($cur_subdir))
1418  ? $mob_dir . "/" . $cur_subdir
1419  : $mob_dir;
1420 
1421  $new_dir = str_replace(".", "", $_POST["new_dir"]);
1422  $new_dir = str_replace("/", "", $new_dir);
1423 
1424  if (!empty($new_dir)) {
1425  ilUtil::makeDir($cur_dir . "/" . $new_dir);
1426  }
1427  $this->ctrl->saveParameter($this, "cdir");
1428  $this->ctrl->redirect($this, "editFiles");
1429  }
$_GET["client_id"]
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getWebspaceDir($mode="filesystem")
get webspace directory
$_POST["username"]
+ Here is the call graph for this function:

◆ createObject()

ilObjMediaObjectGUI::createObject ( )

create new media object form

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

References $help, ilObjectGUI\$tpl, and initForm().

305  {
306  $tpl = $this->tpl;
307  $ilHelp = $this->help;
308 
309  $ilHelp->setScreenId("create");
310  $this->initForm();
311  $tpl->setContent($this->form_gui->getHTML());
312  }
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ deleteFileObject()

ilObjMediaObjectGUI::deleteFileObject ( )

delete object file

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

References $_GET, $_POST, $location, ilUtil\delDir(), and ilUtil\getWebspaceDir().

1573  {
1574  if (!isset($_POST["file"])) {
1575  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1576  }
1577 
1578  if (count($_POST["file"]) > 1) {
1579  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE);
1580  }
1581 
1582  if ($_POST["file"][0] == "..") {
1583  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1584  }
1585 
1586  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1587  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1588  $cur_dir = (!empty($cur_subdir))
1589  ? $mob_dir . "/" . $cur_subdir
1590  : $mob_dir;
1591  $file = $cur_dir . "/" . $_POST["file"][0];
1592  $location = (!empty($cur_subdir))
1593  ? $cur_subdir . "/" . $_POST["file"][0]
1594  : $_POST["file"][0];
1595 
1596  $full_item = $this->object->getMediaItem("Fullscreen");
1597  $std_item = $this->object->getMediaItem("Standard");
1598 
1599  if ($location == $std_item->getLocation()) {
1600  $this->ilias->raiseError($this->lng->txt("cont_cant_del_std"), $this->ilias->error_obj->MESSAGE);
1601  }
1602 
1603  if ($this->object->hasFullScreenItem()) {
1604  if ($location == $full_item->getLocation()) {
1605  $this->ilias->raiseError($this->lng->txt("cont_cant_del_full"), $this->ilias->error_obj->MESSAGE);
1606  }
1607  }
1608 
1609  if (@is_dir($file)) {
1610  if (substr($std_item->getLocation(), 0, strlen($location)) == $location) {
1611  $this->ilias->raiseError($this->lng->txt("cont_std_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1612  }
1613 
1614  if ($this->object->hasFullScreenItem()) {
1615  if (substr($full_item->getLocation(), 0, strlen($location)) == $location) {
1616  $this->ilias->raiseError($this->lng->txt("cont_full_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1617  }
1618  }
1619  }
1620 
1621  if (@is_file($file)) {
1622  unlink($file);
1623  }
1624 
1625  if (@is_dir($file)) {
1626  ilUtil::delDir($file);
1627  }
1628 
1629  $this->ctrl->saveParameter($this, "cdir");
1630  $this->ctrl->redirect($this, "editFiles");
1631  }
$_GET["client_id"]
$location
Definition: buildRTE.php:44
redirection script todo: (a better solution should control the processing via a xml file) ...
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteSrtFilesObject()

ilObjMediaObjectGUI::deleteSrtFilesObject ( )

Delete srt files.

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

References $_POST, $ctrl, $i, $ilCtrl, and ilObjectGUI\$lng.

2050  {
2051  $lng = $this->lng;
2052  $ilCtrl = $this->ctrl;
2053 
2054  foreach ($_POST["srt"] as $i) {
2055  if (strlen($i) == 2 && !is_int(strpos($i, "."))) {
2056  $this->object->removeAdditionalFile("srt/subtitle_" . $i . ".srt");
2057  }
2058  }
2059  ilUtil::sendSuccess($lng->txt("mob_srt_files_deleted"), true);
2060  $ilCtrl->redirect($this, "listSubtitleFiles");
2061  }
global $ilCtrl
Definition: ilias.php:18
$i
Definition: disco.tpl.php:19
$_POST["username"]

◆ editFilesObject()

ilObjMediaObjectGUI::editFilesObject ( )

administrate files of media object

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

References $_GET, $cols, $i, $tbl, ilUtil\getDir(), ilUtil\getImagePath(), ilUtil\getWebspaceDir(), and ilUtil\switchColor().

1244  {
1245  // standard item
1246  $std_item = $this->object->getMediaItem("Standard");
1247  if ($this->object->hasFullscreenItem()) {
1248  $full_item = $this->object->getMediaItem("Fullscreen");
1249  }
1250 
1251  // create table
1252  require_once("./Services/Table/classes/class.ilTableGUI.php");
1253  $tbl = new ilTableGUI();
1254 
1255  // determine directory
1256  $cur_subdir = $_GET["cdir"];
1257  if ($_GET["newdir"] == "..") {
1258  $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
1259  } else {
1260  if (!empty($_GET["newdir"])) {
1261  if (!empty($cur_subdir)) {
1262  $cur_subdir = $cur_subdir . "/" . $_GET["newdir"];
1263  } else {
1264  $cur_subdir = $_GET["newdir"];
1265  }
1266  }
1267  }
1268 
1269  $cur_subdir = str_replace(".", "", $cur_subdir);
1270  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1271  $cur_dir = (!empty($cur_subdir))
1272  ? $mob_dir . "/" . $cur_subdir
1273  : $mob_dir;
1274 
1275  // load files templates
1276  $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.mob_files.html", "Services/MediaObjects");
1277 
1278  $this->ctrl->setParameter($this, "cdir", urlencode($cur_subdir));
1279  $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
1280  //echo "--".$this->getTargetScript().
1281  //"&hier_id=".$_GET["hier_id"]."&cdir=".$cur_subdir."&cmd=post"."--<br>";
1282  $this->tpl->setVariable("TXT_NEW_DIRECTORY", $this->lng->txt("cont_new_dir"));
1283  $this->tpl->setVariable("TXT_NEW_FILE", $this->lng->txt("cont_new_file"));
1284  $this->tpl->setVariable("CMD_NEW_DIR", "createDirectory");
1285  $this->tpl->setVariable("CMD_NEW_FILE", "uploadFile");
1286  $this->tpl->setVariable("BTN_NEW_DIR", $this->lng->txt("create"));
1287  $this->tpl->setVariable("BTN_NEW_FILE", $this->lng->txt("upload"));
1288 
1289  //
1290  $this->tpl->addBlockfile("FILE_TABLE", "files", "tpl.table.html");
1291 
1292  // load template for table content data
1293  $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mob_file_row.html", "Services/MediaObjects");
1294 
1295  $num = 0;
1296 
1297  $obj_str = ($this->call_by_reference) ? "" : "&obj_id=" . $this->obj_id;
1298  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1299 
1300  $tbl->setTitle($this->lng->txt("cont_files") . " " . $cur_subdir);
1301  //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
1302 
1303  $tbl->setHeaderNames(array("", "", $this->lng->txt("cont_dir_file"),
1304  $this->lng->txt("cont_size"), $this->lng->txt("cont_purpose")));
1305 
1306  $cols = array("", "", "dir_file", "size", "purpose");
1307  $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
1308  "cmd" => "editFiles", "hier_id" => $_GET["hier_id"], "item_id" => $_GET["item_id"]);
1309  $tbl->setHeaderVars($cols, $header_params);
1310  $tbl->setColumnWidth(array("1%", "1%", "33%", "33%", "32%"));
1311 
1312  // control
1313  $tbl->setOrderColumn($_GET["sort_by"]);
1314  $tbl->setOrderDirection($_GET["sort_order"]);
1315  $tbl->setLimit($_GET["limit"]);
1316  $tbl->setOffset($_GET["offset"]);
1317  $tbl->setMaxCount($this->maxcount); // ???
1318  //$tbl->setMaxCount(30); // ???
1319 
1320  $this->tpl->setVariable("COLUMN_COUNTS", 5);
1321 
1322  // delete button
1323  $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1324  $this->tpl->setCurrentBlock("tbl_action_btn");
1325  $this->tpl->setVariable("BTN_NAME", "deleteFile");
1326  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
1327  $this->tpl->parseCurrentBlock();
1328 
1329  $this->tpl->setCurrentBlock("tbl_action_btn");
1330  $this->tpl->setVariable("BTN_NAME", "assignStandard");
1331  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_std"));
1332  $this->tpl->parseCurrentBlock();
1333 
1334  $this->tpl->setCurrentBlock("tbl_action_btn");
1335  $this->tpl->setVariable("BTN_NAME", "assignFullscreen");
1336  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_full"));
1337  $this->tpl->parseCurrentBlock();
1338 
1339  // footer
1340  $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1341  //$tbl->disable("footer");
1342 
1343  $entries = ilUtil::getDir($cur_dir);
1344 
1345  //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
1346  $tbl->setMaxCount(count($entries));
1347  $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
1348 
1349  $tbl->render();
1350  if (count($entries) > 0) {
1351  $i = 0;
1352  foreach ($entries as $entry) {
1353  if (($entry["entry"] == ".") || ($entry["entry"] == ".." && empty($cur_subdir))) {
1354  continue;
1355  }
1356 
1357  //$this->tpl->setVariable("ICON", $obj["title"]);
1358  if ($entry["type"] == "dir") {
1359  $this->tpl->setCurrentBlock("FileLink");
1360  $this->ctrl->setParameter($this, "cdir", $cur_subdir);
1361  $this->ctrl->setParameter($this, "newdir", rawurlencode($entry["entry"]));
1362  $this->tpl->setVariable("LINK_FILENAME", $this->ctrl->getLinkTarget($this, "editFiles"));
1363  $this->tpl->setVariable("TXT_FILENAME", $entry["entry"]);
1364  $this->tpl->parseCurrentBlock();
1365 
1366  $this->tpl->setVariable("ICON", "<img src=\"" .
1367  ilUtil::getImagePath("icon_cat.svg") . "\">");
1368  } else {
1369  $this->tpl->setCurrentBlock("File");
1370  $this->tpl->setVariable("TXT_FILENAME2", $entry["entry"]);
1371  $this->tpl->parseCurrentBlock();
1372  }
1373 
1374  $this->tpl->setCurrentBlock("tbl_content");
1375  $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
1376  $this->tpl->setVariable("CSS_ROW", $css_row);
1377 
1378  $this->tpl->setVariable("TXT_SIZE", $entry["size"]);
1379  $this->tpl->setVariable("CHECKBOX_ID", $entry["entry"]);
1380  $compare = (!empty($cur_subdir))
1381  ? $cur_subdir . "/" . $entry["entry"]
1382  : $entry["entry"];
1383  $purpose = array();
1384  if ($std_item->getLocation() == $compare) {
1385  $purpose[] = $this->lng->txt("cont_std_view");
1386  }
1387  if ($this->object->hasFullscreenItem()) {
1388  if ($full_item->getLocation() == $compare) {
1389  $purpose[] = $this->lng->txt("cont_fullscreen");
1390  }
1391  }
1392  $this->tpl->setVariable("TXT_PURPOSE", implode($purpose, ", "));
1393 
1394  $this->tpl->parseCurrentBlock();
1395  }
1396  } //if is_array
1397  else {
1398  $this->tpl->setCurrentBlock("notfound");
1399  $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
1400  $this->tpl->setVariable("NUM_COLS", 4);
1401  $this->tpl->parseCurrentBlock();
1402  }
1403 
1404  $this->tpl->parseCurrentBlock();
1405  }
$_GET["client_id"]
$tbl
Definition: example_048.php:81
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
Class ilTableGUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
$i
Definition: disco.tpl.php:19
static getWebspaceDir($mode="filesystem")
get webspace directory
$cols
Definition: xhr_table.php:11
+ Here is the call graph for this function:

◆ editObject()

ilObjMediaObjectGUI::editObject ( )

edit media object properties

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

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

901  {
902  $tpl = $this->tpl;
903 
904  $this->setPropertiesSubTabs("general");
905 
906  $this->initForm("edit");
907  $this->getValues();
908  $tpl->setContent($this->form_gui->getHTML());
909  }
setPropertiesSubTabs($a_active)
Set subtabs for properties.
getValues()
Get values for form.
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ executeCommand()

ilObjMediaObjectGUI::executeCommand ( )

Execute current command.

Returns
bool|mixed
Exceptions
ilCtrlException

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

References $_POST, $access, $error, ilObjectGUI\$ilErr, $ret, ilObjectGUI\$tpl, ilObjMediaObject\_getDirectory(), ilObjectMetaDataGUI\addMDObserver(), checkFixSize(), ilObjMediaObject\getForbiddenFileTypes(), ilObjMediaObject\getRestrictedFileTypes(), ilUtil\getWebspaceDir(), ilObjMediaObject\renameExecutables(), ilMediaSvgSanitizer\sanitizeDir(), and ilFileSystemGUI\setAllowedSuffixes().

221  {
222  $tpl = $this->tpl;
223  $ilAccess = $this->access;
225 
226  $next_class = $this->ctrl->getNextClass($this);
227  $cmd = $this->ctrl->getCmd();
228 
229  switch ($next_class) {
230  case 'ilobjectmetadatagui':
231  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
232  $md_gui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
233  // object is subtype, so we have to do it ourselves
234  $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
235 
236  // set adv metadata record dobject
237  if ($this->adv_type != "") {
238  $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
239  }
240 
241  $this->ctrl->forwardCommand($md_gui);
242  break;
243 
244  case "ilimagemapeditorgui":
245  require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
246  $image_map_edit = new ilImageMapEditorGUI($this->object);
247  $ret = $this->ctrl->forwardCommand($image_map_edit);
248  $tpl->setContent($ret);
249  $this->checkFixSize();
250  break;
251 
252  case "ilfilesystemgui":
253  include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
254  $fs_gui = new ilFileSystemGUI(ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId());
256  $fs_gui->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
257  $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
258  $fs_gui->setTableId("mobfs" . $this->object->getId());
259  $fs_gui->labelFile(
260  $this->object->getMediaItem("Standard")->getLocation(),
261  $this->lng->txt("cont_std_view")
262  );
263  if ($this->object->hasFullscreenItem()) {
264  $fs_gui->labelFile(
265  $this->object->getMediaItem("Fullscreen")->getLocation(),
266  $this->lng->txt("cont_fullscreen")
267  );
268  }
269  $fs_gui->addCommand($this, "assignStandardObject", $this->lng->txt("cont_assign_std"));
270  $fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full"));
271  ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
272  $ret = $this->ctrl->forwardCommand($fs_gui);
273  ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
274  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
275  ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
276  break;
277 
278 
279  default:
280  if (isset($_POST["editImagemapForward"]) ||
281  isset($_POST["editImagemapForward_x"]) ||
282  isset($_POST["editImagemapForward_y"])) {
283  $cmd = "editImagemapForward";
284  }
285  $cmd .= "Object";
286  $ret = $this->$cmd();
287  break;
288  }
289 
290  return $ret;
291  }
Class ilObjectMetaDataGUI.
static sanitizeDir($a_path)
Sanitize directory recursively.
addMDObserver($a_class, $a_method, $a_section)
static _getDirectory($a_mob_id)
Get absolute directory.
static renameExecutables($a_dir)
Rename executables.
setAllowedSuffixes($a_suffixes)
Set allowed Suffixes.
static getForbiddenFileTypes()
Get forbidden file types.
User interface class for map editor.
static getRestrictedFileTypes()
Get restricted file types (this is for the input form, this list will be empty, if "allowed list" is ...
$ret
Definition: parser.php:6
File System Explorer GUI class.
static getWebspaceDir($mode="filesystem")
get webspace directory
$_POST["username"]
+ Here is the call graph for this function:

◆ getAdvMdRecordObject()

ilObjMediaObjectGUI::getAdvMdRecordObject ( )

Get adv md record type.

Returns
array adv type

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

References $adv_ref_id, $adv_subtype, $adv_type, and ilObjectGUI\$ref_id.

115  {
116  if ($this->adv_type == null) {
117  return [$this->ref_id, $this->obj_type, $this->sub_type];
118  }
120  }

◆ getEnabledMapAreas()

ilObjMediaObjectGUI::getEnabledMapAreas ( )

Get Enable map areas.

Returns
boolean Enable map areas

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

References $enabledmapareas.

Referenced by getTabs().

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

◆ getForm()

ilObjMediaObjectGUI::getForm ( )

Get form.

Returns
object form gui class

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

198  {
199  return $this->form_gui;
200  }

◆ getFullscreenSizeObject()

ilObjMediaObjectGUI::getFullscreenSizeObject ( )

set original size of fullscreen file

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

References $size, ilObjMediaObject\_getDirectory(), and ilMediaImageUtil\getImageSize().

982  {
983  $full_item = $this->object->getMediaItem("Fullscreen");
984  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
985 
986  if ($full_item->getLocationType() == "LocalFile") {
987  $file = $mob_dir . "/" . $full_item->getLocation();
988  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
990  $full_item->setWidth($size[0]);
991  $full_item->setHeight($size[1]);
992  $this->object->update();
993  }
994  $this->ctrl->redirect($this, "edit");
995  }
$size
Definition: RandomTest.php:84
static getImageSize($a_location)
Get image size from location.
static _getDirectory($a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:

◆ getHeader()

ilObjMediaObjectGUI::getHeader ( )

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

References $header.

128  {
129  return $this->header;
130  }

◆ getHeightPreset()

ilObjMediaObjectGUI::getHeightPreset ( )

Get height preset.

Returns
int height preset

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

Referenced by initForm().

188  {
189  return $this->height_preset;
190  }
+ Here is the caller graph for this function:

◆ getStandardSizeObject()

ilObjMediaObjectGUI::getStandardSizeObject ( )

set original size of standard file

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

References $size, ilObjMediaObject\_getDirectory(), and ilMediaImageUtil\getImageSize().

960  {
961  $std_item = $this->object->getMediaItem("Standard");
962  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
963 
964  if ($std_item->getLocationType() == "LocalFile") {
965  $file = $mob_dir . "/" . $std_item->getLocation();
966 
967  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
969 
970  $std_item->setWidth($size[0]);
971  $std_item->setHeight($size[1]);
972  $this->object->update();
973  }
974  $this->ctrl->redirect($this, "edit");
975  }
$size
Definition: RandomTest.php:84
static getImageSize($a_location)
Get image size from location.
static _getDirectory($a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:

◆ getTabs()

ilObjMediaObjectGUI::getTabs ( )

Get Tabs.

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

References $format, $help, ilObjMediaObject\_getSimpleMimeTypes(), getEnabledMapAreas(), and ilObjectMetaDataGUI\getTab().

Referenced by setTabs().

1793  {
1794  $ilHelp = $this->help;
1795 
1796  $ilHelp->setScreenIdComponent("mob");
1797 
1798  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1799  && $this->object->getId() > 0) {
1800  // object properties
1801  $this->tabs_gui->addTarget(
1802  "cont_mob_def_prop",
1803  $this->ctrl->getLinkTarget($this, "edit"),
1804  "edit",
1805  get_class($this)
1806  );
1807 
1808  $st_item = $this->object->getMediaItem("Standard");
1809 
1810  // link areas
1811 
1812  if (is_object($st_item) && $this->getEnabledMapAreas()) {
1813  $format = $st_item->getFormat();
1814  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg"))) {
1815  $this->tabs_gui->addTarget(
1816  "cont_def_map_areas",
1817  $this->ctrl->getLinkTargetByClass(
1818  array("ilobjmediaobjectgui", "ilimagemapeditorgui"),
1819  "editMapAreas"
1820  ),
1821  "editMapAreas",
1822  "ilimagemapeditorgui"
1823  );
1824  }
1825  }
1826 
1827  // object usages
1828  $this->tabs_gui->addTarget(
1829  "cont_mob_usages",
1830  $this->ctrl->getLinkTarget($this, "showUsages"),
1831  "showUsages",
1832  get_class($this)
1833  );
1834 
1835  // object files
1836  $std_item = $this->object->getMediaItem("Standard");
1837  $full_item = $this->object->getMediaItem("Fullscreen");
1838  $mset = new ilSetting("mobs");
1839  if ($mset->get("file_manager_always") ||
1840  (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()) ||
1841  (is_object($full_item) && !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())))
1842  ) {
1843  // $ilTabs->addTarget("cont_files",
1844  // $this->ctrl->getLinkTarget($this, "editFiles"), "editFiles",
1845  // get_class($this));
1846 
1847  $this->tabs_gui->addTarget(
1848  "cont_files",
1849  $this->ctrl->getLinkTargetByClass(
1850  array("ilobjmediaobjectgui", "ilfilesystemgui"),
1851  "listFiles"
1852  ),
1853  "",
1854  "ilfilesystemgui"
1855  );
1856  }
1857 
1858  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1859  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1860  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1861  if ($mdtab) {
1862  $this->tabs_gui->addTarget(
1863  "meta_data",
1864  $mdtab,
1865  "",
1866  "ilmdeditorgui"
1867  );
1868  }
1869  }
1870 
1871  // back to upper context
1872  if ($this->back_title != "") {
1873  $this->tabs_gui->setBackTarget(
1874  $this->back_title,
1875  $this->ctrl->getParentReturn($this)
1876  );
1877  }
1878  }
Class ilObjectMetaDataGUI.
$format
Definition: metadata.php:141
getEnabledMapAreas()
Get Enable map areas.
getTab($a_base_class=null)
Get tab link if available.
static _getSimpleMimeTypes()
Get simple mime types that deactivate parameter property files tab in ILIAS.
+ 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 591 of file class.ilObjMediaObjectGUI.php.

References $values, and ilObjMediaObject\_useAutoStartParameterOnly().

Referenced by editObject().

592  {
593  $values = array();
594 
595  $values["standard_title"] = $this->object->getTitle();
596 
597  $std_item = $this->object->getMediaItem("Standard");
598  if ($std_item->getLocationType() == "LocalFile") {
599  $values["standard_type"] = "File";
600  $values["standard_file"] = $std_item->getLocation();
601  } else {
602  $values["standard_type"] = "Reference";
603  $values["standard_reference"] = $std_item->getLocation();
604  }
605  $values["standard_format"] = $std_item->getFormat();
606  $values["standard_width_height"]["width"] = $std_item->getWidth();
607  $values["standard_width_height"]["height"] = $std_item->getHeight();
608  $values["standard_width_height"]["constr_prop"] = true;
609 
610  $values["standard_size"] = "selected";
611 
612  $orig_size = $std_item->getOriginalSize();
613  if ($std_item->getWidth() == "" && $std_item->getHeight() == "") {
614  $values["standard_size"] = "original";
615  $values["standard_width_height"]["width"] = $orig_size["width"];
616  $values["standard_width_height"]["height"] = $orig_size["height"];
617  }
618 
619  $values["standard_caption"] = $std_item->getCaption();
620  $values["text_representation"] = $std_item->getTextRepresentation();
622  $std_item->getLocation(),
623  $std_item->getFormat()
624  )) {
625  $par = $std_item->getParameters();
626  if ($par["autostart"]) {
627  $values["standard_autostart"] = true;
628  }
629  } else {
630  $values["standard_parameters"] = $std_item->getParameterString();
631  }
632 
633  $values["full_type"] = "None";
634  $values["full_size"] = "original";
635  if ($this->object->hasFullScreenItem()) {
636  $full_item = $this->object->getMediaItem("Fullscreen");
637  if ($full_item->getLocationType() == "LocalFile") {
638  $values["full_type"] = "File";
639  $values["full_file"] = $full_item->getLocation();
640  } else {
641  $values["full_type"] = "Reference";
642  $values["full_reference"] = $full_item->getLocation();
643  }
644  $values["full_format"] = $full_item->getFormat();
645  $values["full_width_height"]["width"] = $full_item->getWidth();
646  $values["full_width_height"]["height"] = $full_item->getHeight();
647  $values["full_width_height"]["constr_prop"] = true;
648 
649  $values["full_size"] = "selected";
650 
651  $orig_size = $full_item->getOriginalSize();
652  if ($full_item->getWidth() == "" &&
653  $full_item->getHeight() == "") {
654  $values["full_size"] = "original";
655  $values["full_width_height"]["width"] = $orig_size["width"];
656  $values["full_width_height"]["height"] = $orig_size["height"];
657  }
658  $values["full_caption"] = $full_item->getCaption();
660  $full_item->getLocation(),
661  $full_item->getFormat()
662  )) {
663  $par = $full_item->getParameters();
664  if ($par["autostart"]) {
665  $values["full_autostart"] = true;
666  }
667  } else {
668  $values["full_parameters"] = $full_item->getParameterString();
669  }
670  $values["full_text_representation"] = $full_item->getTextRepresentation();
671  }
672 
673  $this->form_gui->setValuesByArray($values);
674  }
$values
static _useAutoStartParameterOnly($a_loc, $a_format)
Check whether only autostart parameter should be supported (instead of parameters input field...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWidthPreset()

ilObjMediaObjectGUI::getWidthPreset ( )

Get width preset.

Returns
int width preset

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

Referenced by initForm().

168  {
169  return $this->width_preset;
170  }
+ Here is the caller graph for this function:

◆ includePresentationJS()

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

Include media object presentation JS.

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

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

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

1906  {
1907  global $DIC;
1908 
1909  $tpl = $DIC["tpl"];
1910 
1911  if ($a_tpl == null) {
1912  $a_tpl = $tpl;
1913  }
1914 
1915  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1916  iljQueryUtil::initjQUery($a_tpl);
1917  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1918  $a_tpl->addJavascript(iljQueryUtil::getLocalMaphilightPath());
1919  $a_tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
1920 
1921  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1923  }
global $DIC
Definition: saml.php:7
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
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 (   $a_mode = "create")

Init creation form.

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

References $ctrl, $format, $ilCtrl, ilObjectGUI\$lng, $title, ilObjMediaObject\_getSimpleMimeTypes(), ilObjMediaObject\_useAutoStartParameterOnly(), ilSubEnabledFormPropertyGUI\addSubItem(), ilRadioOption\addSubItem(), ilObjMediaObject\getForbiddenFileTypes(), getHeightPreset(), ilObjMediaObject\getRestrictedFileTypes(), getWidthPreset(), ilTextAreaInputGUI\setCols(), ilWidthHeightInputGUI\setConstrainProportions(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), and ilTextAreaInputGUI\setRows().

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

318  {
319  $lng = $this->lng;
321 
322  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
323 
324  if ($a_mode == "edit") {
325  $std_item = $this->object->getMediaItem("Standard");
326  }
327 
328  $this->form_gui = new ilPropertyFormGUI();
329 
330  // standard view resource
331  $title = new ilTextInputGUI($lng->txt("title"), "standard_title");
332  $title->setSize(40);
333  $title->setMaxLength(120);
334  $this->form_gui->addItem($title);
335  $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "standard_type");
336  $op1 = new ilRadioOption($lng->txt("cont_file"), "File");
337  $up = new ilFileInputGUI("", "standard_file");
338  $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
339  $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
340  $up->setInfo("");
341  if ($a_mode == "create" || $std_item->getLocationType() != "LocalFile") {
342  $up->setRequired(true);
343  }
344  $op1->addSubItem($up);
345  $radio_prop->addOption($op1);
346  $op2 = new ilRadioOption($lng->txt("url"), "Reference");
347  $ref = new ilTextInputGUI("", "standard_reference");
348  $ref->setInfo($lng->txt("cont_ref_helptext"));
349  $ref->setRequired(true);
350  $op2->addSubItem($ref);
351  $radio_prop->addOption($op2);
352  $radio_prop->setValue("File");
353  $this->form_gui->addItem($radio_prop);
354 
355  // standard format
356  if ($a_mode == "edit") {
357  $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "standard_format");
358  $format->setValue($std_item->getFormat());
359  $this->form_gui->addItem($format);
360  }
361 
362  // standard size
363  $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "standard_size");
364  if ($a_mode == "edit") {
365  if ($orig_size = $std_item->getOriginalSize()) {
366  $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")";
367  }
368  $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
369  $op1->setInfo($lng->txt("cont_resource_size_info"));
370  $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
371  } else {
372  $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
373  $op1->setInfo($lng->txt("cont_resource_size_info"));
374  $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
375  }
376  $radio_size->addOption($op1);
377 
378  // width height
379  include_once("./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
380  $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") .
381  " / " . $lng->txt("cont_height"), "standard_width_height");
382  $width_height->setConstrainProportions(true);
383  $op2->addSubItem($width_height);
384 
385  // resize image
386  if ($a_mode == "edit") {
387  $std_item = $this->object->getMediaItem("Standard");
388  if (is_int(strpos($std_item->getFormat(), "image"))
389  && $std_item->getLocationType() == "LocalFile") {
390  $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"), "standard_resize");
391  $op2->addSubItem($resize);
392  }
393  }
394 
395  $radio_size->setValue("original");
396  if ($a_mode == "create" && ($this->getHeightPreset() > 0 || $this->getWidthPreset() > 0)) {
397  $radio_size->setValue("selected");
398  $width_height->setWidth($this->getWidthPreset());
399  $width_height->setHeight($this->getHeightPreset());
400  }
401  $radio_size->addOption($op2);
402  $this->form_gui->addItem($radio_size);
403 
404  // standard caption
405  $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "standard_caption");
406  $caption->setCols(30);
407  $caption->setRows(2);
408  $this->form_gui->addItem($caption);
409 
410  /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "standard_caption");
411  $caption->setSize(40);
412  $caption->setMaxLength(200);
413  $this->form_gui->addItem($caption);*/
414 
415  // text representation (alt text)
416  if ($a_mode == "edit" && is_int(strpos($std_item->getFormat(), "image"))) {
417  $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "text_representation");
418  $ta->setCols(30);
419  $ta->setRows(2);
420  $ta->setInfo($lng->txt("text_repr_info"));
421  $this->form_gui->addItem($ta);
422  }
423 
424  // standard parameters
425  if ($a_mode == "edit" &&
426  !in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
428  $std_item->getLocation(),
429  $std_item->getFormat()
430  )) { // autostart
431  $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "standard_autostart");
432  $this->form_gui->addItem($auto);
433  } else { // parameters
434  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "standard_parameters");
435  $par->setRows(5);
436  $par->setCols(50);
437  $this->form_gui->addItem($par);
438  }
439  }
440 
441  if ($a_mode == "edit") {
442  $full_item = $this->object->getMediaItem("Fullscreen");
443  }
444 
445  // fullscreen view resource
446  $fs_sec = new ilFormSectionHeaderGUI();
447  $fs_sec->setTitle($lng->txt("cont_fullscreen"));
448  $this->form_gui->addItem($fs_sec);
449 
450  $radio_prop2 = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "full_type");
451  $op1 = new ilRadioOption($lng->txt("cont_none"), "None");
452  $radio_prop2->addOption($op1);
453  $op4 = new ilRadioOption($lng->txt("cont_use_same_resource_as_above"), "Standard");
454  $radio_prop2->addOption($op4);
455  $op2 = new ilRadioOption($lng->txt("cont_file"), "File");
456  $up = new ilFileInputGUI("", "full_file");
457  $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
458  $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
459  $up->setInfo("");
460  if ($a_mode == "create" || !$full_item || $full_item->getLocationType() != "LocalFile") {
461  $up->setRequired(true);
462  }
463  $op2->addSubItem($up);
464  $radio_prop2->addOption($op2);
465  $op3 = new ilRadioOption($lng->txt("url"), "Reference");
466  $ref = new ilTextInputGUI("", "full_reference");
467  $ref->setInfo($lng->txt("cont_ref_helptext"));
468  $ref->setRequired(true);
469  $op3->addSubItem($ref);
470  $radio_prop2->addOption($op3);
471  $radio_prop2->setValue("None");
472  $this->form_gui->addItem($radio_prop2);
473 
474  // fullscreen format
475  if ($a_mode == "edit") {
476  if ($this->object->hasFullscreenItem()) {
477  $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "full_format");
478  $format->setValue($full_item->getFormat());
479  $this->form_gui->addItem($format);
480  }
481  }
482 
483  // fullscreen size
484  $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_size");
485  if ($a_mode == "edit") {
486  $add_str = "";
487  if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
488  $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")";
489  }
490  $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
491  $op1->setInfo($lng->txt("cont_resource_size_info"));
492  $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
493  } else {
494  $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
495  $op1->setInfo($lng->txt("cont_resource_size_info"));
496  $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
497  }
498  $radio_size->addOption($op1);
499 
500  // width/height
501  $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") .
502  " / " . $lng->txt("cont_height"), "full_width_height");
503  $width_height->setConstrainProportions(true);
504  $op2->addSubItem($width_height);
505 
506  // resize image
507  if ($a_mode == "edit") {
508  $full_item = $this->object->getMediaItem("Fullscreen");
509  if ($this->object->hasFullscreenItem() &&
510  is_int(strpos($full_item->getFormat(), "image")) &&
511  $full_item->getLocationType() == "LocalFile") {
512  $resize = new ilCheckboxInputGUI(
513  $lng->txt("cont_resize_img"),
514  "full_resize"
515  );
516  $op2->addSubItem($resize);
517  }
518  }
519 
520  $radio_size->setValue("original");
521  $radio_size->addOption($op2);
522  $this->form_gui->addItem($radio_size);
523 
524  // fullscreen caption
525  $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "full_caption");
526  $caption->setCols(30);
527  $caption->setRows(2);
528  $this->form_gui->addItem($caption);
529 
530  /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "full_caption");
531  $caption->setSize(40);
532  $caption->setMaxLength(200);
533  $this->form_gui->addItem($caption);*/
534 
535  // text representation (alt text)
536  if ($a_mode == "edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(), "image"))) {
537  $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "full_text_representation");
538  $ta->setCols(30);
539  $ta->setRows(2);
540  $ta->setInfo($lng->txt("text_repr_info"));
541  $this->form_gui->addItem($ta);
542  }
543 
544 
545  // fullscreen parameters
546  if ($a_mode == "edit" && $this->object->hasFullscreenItem() &&
547  !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
549  $full_item->getLocation(),
550  $full_item->getFormat()
551  )) {
552  $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "full_autostart");
553  $this->form_gui->addItem($auto);
554  } else {
555  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "full_parameters");
556  $par->setRows(5);
557  $par->setCols(50);
558  $this->form_gui->addItem($par);
559  }
560  }
561 
562  $this->form_gui->setTitle($lng->txt("cont_insert_mob"));
563  if ($a_mode == "edit") {
564  $this->form_gui->addCommandButton("saveProperties", $lng->txt("save"));
565  } else {
566  $this->form_gui->addCommandButton("save", $lng->txt("save"));
567  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
568  }
569  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
570  }
This class represents an option in a radio group.
$format
Definition: metadata.php:141
This class represents a property form user interface.
This class represents a section header in a property form.
This class represents a file property in a property form.
getWidthPreset()
Get width preset.
This class represents a checkbox property in a property form.
setConstrainProportions($a_constrainproportions)
Set Constrain Proportions.
setInfo($a_info)
Set Info.
getHeightPreset()
Get height preset.
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
addSubItem($a_item)
Add Subitem.
This class represents a text property in a property form.
This class represents a width/height item in a property form.
static getForbiddenFileTypes()
Get forbidden file types.
This class represents a non editable value in a property form.
static getRestrictedFileTypes()
Get restricted file types (this is for the input form, this list will be empty, if "allowed list" is ...
This class represents a text area property in a property form.
static _useAutoStartParameterOnly($a_loc, $a_format)
Check whether only autostart parameter should be supported (instead of parameters input field...
static _getSimpleMimeTypes()
Get simple mime types that deactivate parameter property files tab in ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listSubtitleFilesObject()

ilObjMediaObjectGUI::listSubtitleFilesObject ( )

List subtitls files.

Parameters

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

References $ctrl, $ilCtrl, $ilUser, ilObjectGUI\$lng, PHPMailer\PHPMailer\$options, $si, $tab, $toolbar, ilObjectGUI\$tpl, $user, ilMDLanguageItem\_getLanguages(), setPropertiesSubTabs(), and ilFileInputGUI\setSuffixes().

1963  {
1964  $ilToolbar = $this->toolbar;
1965  $tpl = $this->tpl;
1966  $ilCtrl = $this->ctrl;
1967  $lng = $this->lng;
1968  $ilUser = $this->user;
1969 
1970  $this->setPropertiesSubTabs("subtitles");
1971 
1972  // upload file
1973  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1974  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1975  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.srt)", "subtitle_file");
1976  $fi->setSuffixes(array("srt"));
1977  $ilToolbar->addInputItem($fi, true);
1978 
1979  // language
1980  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1981  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
1983  $si = new ilSelectInputGUI($this->lng->txt("mob_language"), "language");
1984  $si->setOptions($options);
1985  $si->setValue($ilUser->getLanguage());
1986  $ilToolbar->addInputItem($si, true);
1987 
1988  $ilToolbar->addFormButton($lng->txt("upload"), "uploadSubtitleFile");
1989 
1990  $ilToolbar->addSeparator();
1991  $ilToolbar->addFormButton($lng->txt("mob_upload_multi_srt"), "uploadMultipleSubtitleFileForm");
1992 
1993  include_once("./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1994  $tab = new ilMobSubtitleTableGUI($this, "listSubtitleFiles", $this->object);
1995 
1996  $tpl->setContent($tab->getHTML());
1997  }
TableGUI class for subtitle list.
This class represents a selection list property in a property form.
This class represents a file property in a property form.
setPropertiesSubTabs($a_active)
Set subtabs for properties.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:

◆ removeFullscreenObject()

ilObjMediaObjectGUI::removeFullscreenObject ( )

remove fullscreen view

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

1535  {
1536  $this->object->removeMediaItem("Fullscreen");
1537  $this->object->update();
1538 
1539  $this->ctrl->redirect($this, "edit");
1540  }

◆ resizeImagesObject()

ilObjMediaObjectGUI::resizeImagesObject ( )

resize images to specified size

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

References $location, ilObjMediaObject\_getDirectory(), and ilObjMediaObject\_resizeImage().

916  {
917  // directory
918  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
919 
920  // standard item
921  $std_item = $this->object->getMediaItem("Standard");
922  if ($std_item->getLocationType() == "LocalFile" &&
923  is_int(strpos($std_item->getFormat(), "image"))
924  ) {
925  $file = $mob_dir . "/" . $std_item->getLocation();
927  $file,
928  $std_item->getWidth(),
929  $std_item->getHeight()
930  );
931  $std_item->setLocation($location);
932  $std_item->update();
933  }
934 
935  // fullscreen item
936  if ($this->object->hasFullScreenItem()) {
937  $full_item = $this->object->getMediaItem("Fullscreen");
938  if ($full_item->getLocationType() == "LocalFile" &&
939  is_int(strpos($full_item->getFormat(), "image"))
940  ) {
941  $file = $mob_dir . "/" . $full_item->getLocation();
943  $file,
944  $full_item->getWidth(),
945  $full_item->getHeight()
946  );
947  $full_item->setLocation($location);
948  $full_item->update();
949  }
950  }
951 
952  $this->ctrl->redirect($this, "edit");
953  }
static _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
$location
Definition: buildRTE.php:44
static _getDirectory($a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:

◆ returnToContextObject()

ilObjMediaObjectGUI::returnToContextObject ( )

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

210  {
211  $this->ctrl->returnToParent($this);
212  }

◆ saveMultiSrtObject()

ilObjMediaObjectGUI::saveMultiSrtObject ( )

Save selected srt files as new srt files.

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

References $_POST, $ctrl, $f, and $ilCtrl.

2130  {
2131  $ilCtrl = $this->ctrl;
2132  $srt_files = $this->object->getMultiSrtFiles();
2133  if (is_array($_POST["file"])) {
2134  foreach ($_POST["file"] as $f) {
2135  foreach ($srt_files as $srt_file) {
2136  if ($f == $srt_file["filename"]) {
2137  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir() . "/" . $srt_file["filename"], $srt_file["lang"], "rename");
2138  }
2139  }
2140  }
2141  }
2142  $this->object->clearMultiSrtDirectory();
2143  $ilCtrl->redirect($this, "listSubtitleFiles");
2144  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ saveObject()

ilObjMediaObjectGUI::saveObject ( )

create new media object in dom and update page in db

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

References ilObjectGUI\$lng, ilObjectGUI\$object, ilObjectGUI\$tpl, initForm(), and setObjectPerCreationForm().

680  {
681  $tpl = $this->tpl;
682  $lng = $this->lng;
683 
684  $this->initForm();
685  if ($this->form_gui->checkInput()) {
686  $this->object = new ilObjMediaObject();
688  ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
689  return $this->object;
690  } else {
691  $this->form_gui->setValuesByPost();
692  $tpl->setContent($this->form_gui->getHTML());
693  return false;
694  }
695  }
static setObjectPerCreationForm($a_mob)
Set media object values from creation form.
Class ilObjMediaObject.
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ savePropertiesObject()

ilObjMediaObjectGUI::savePropertiesObject ( )

save properties in db and return to page edit screen

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

References $_POST, $format, ilObjectGUI\$lng, $location, $title, ilObjectGUI\$tpl, $type, ilObjMediaObject\_determineWidthHeight(), ilObjMediaObject\_getDirectory(), ilObjMediaObject\_getSimpleMimeTypes(), ilObjMediaObject\_resizeImage(), ilObjMediaObject\_useAutoStartParameterOnly(), ilObjMediaObject\fixFilename(), ilObjMediaObject\getMimeType(), initForm(), ilObjMediaObject\renameExecutables(), ilMediaSvgSanitizer\sanitizeDir(), ilUtil\secureLink(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

1001  {
1002  $lng = $this->lng;
1003  $tpl = $this->tpl;
1004 
1005  $this->initForm("edit");
1006  if ($this->form_gui->checkInput()) {
1007  $title = trim($_POST["standard_title"]);
1008  $this->object->setTitle($title);
1009 
1010  $std_item = $this->object->getMediaItem("Standard");
1011  $location = $std_item->getLocation();
1012  $format = $std_item->getFormat();
1013  if ($_POST["standard_type"] == "Reference") {
1014  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
1015  $std_item->setFormat($format);
1016  $std_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
1017  $std_item->setLocationType("Reference");
1018  }
1019  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1020  if ($_POST["standard_type"] == "File") {
1021  $resize = false;
1022  if ($_FILES['standard_file']['name'] != "") {
1023  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
1024  $file = $mob_dir . "/" . $file_name;
1025  ilUtil::moveUploadedFile(
1026  $_FILES['standard_file']['tmp_name'],
1027  $file_name,
1028  $file
1029  );
1030 
1031  // get mime type
1033  $location = $file_name;
1034 
1035  $resize = true;
1036  } elseif ($_POST["standard_resize"]) {
1037  $file = $mob_dir . "/" . $location;
1038  $resize = true;
1039  }
1040 
1041  // resize
1042  if ($resize) {
1043  if ($_POST["standard_size"] != "original" &&
1044  is_int(strpos($format, "image"))) {
1046  $file,
1047  (int) $_POST["standard_width_height"]["width"],
1048  (int) $_POST["standard_width_height"]["height"],
1049  (boolean) $_POST["standard_width_height"]["contr_prop"]
1050  );
1051  }
1052  $std_item->setFormat($format);
1053  $std_item->setLocation($location);
1054  }
1055 
1056  $std_item->setLocationType("LocalFile");
1057  }
1058  $this->object->setDescription($format);
1059  // determine width and height of known image types
1061  $format,
1062  $_POST["standard_type"],
1063  $mob_dir . "/" . $location,
1064  $std_item->getLocation(),
1065  $_POST["standard_width_height"]["constr_prop"],
1066  ($_POST["standard_size"] == "original"),
1067  $_POST["standard_width_height"]["width"],
1068  $_POST["standard_width_height"]["height"]
1069  );
1070  if ($wh["info"] != "") {
1071  ilUtil::sendInfo($wh["info"], true);
1072  }
1073  $std_item->setWidth($wh["width"]);
1074  $std_item->setHeight($wh["height"]);
1075 
1076  // set caption
1077  $std_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
1078 
1079  // text representation
1080  $std_item->setTextRepresentation(ilUtil::stripSlashes($_POST["text_representation"]));
1081 
1082  // set parameters
1083  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
1085  $std_item->getLocation(),
1086  $std_item->getFormat()
1087  )) {
1088  if ($_POST["standard_autostart"]) { // save only autostart flag
1089  $std_item->setParameters('autostart="true"');
1090  } else {
1091  $std_item->setParameters("");
1092  }
1093  } else {
1094  $std_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_parameters"])));
1095  }
1096  }
1097 
1098  // "None" selected
1099  if ($_POST["full_type"] == "None") {
1100  if ($this->object->hasFullscreenItem()) { // delete existing
1101  $this->object->removeMediaItem("Fullscreen");
1102  }
1103  } else { // Not "None" -> we need one
1104  if ($this->object->hasFullscreenItem()) { // take existing one
1105  $full_item = $this->object->getMediaItem("Fullscreen");
1106  } else { // create one
1107  $full_item = new ilMediaItem();
1108  $this->object->addMediaItem($full_item);
1109  $full_item->setPurpose("Fullscreen");
1110  }
1111  $location = $full_item->getLocation();
1112  $format = $full_item->getFormat();
1113  if ($_POST["full_type"] == "Reference") {
1114  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["full_reference"]), true);
1115  $full_item->setFormat($format);
1116  $full_item->setLocationType("Reference");
1117  $location = ilUtil::stripSlashes($_POST["full_reference"]);
1118  $type = "Reference";
1119  }
1120  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1121  if ($_POST["full_type"] == "File") {
1122  $resize = false;
1123  if ($_FILES['full_file']['name'] != "") {
1124  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1125  $file = $mob_dir . "/" . $full_file_name;
1126  ilUtil::moveUploadedFile(
1127  $_FILES['full_file']['tmp_name'],
1128  $full_file_name,
1129  $file
1130  );
1131 
1133  $location = $full_file_name;
1134 
1135  $resize = true;
1136  } elseif ($_POST["full_resize"]) {
1137  $file = $mob_dir . "/" . $location;
1138  $resize = true;
1139  }
1140 
1141  // resize
1142  if ($resize) {
1143  if ($_POST["full_size"] != "original" &&
1144  is_int(strpos($format, "image"))) {
1146  $file,
1147  (int) $_POST["full_width_height"]["width"],
1148  (int) $_POST["full_width_height"]["height"],
1149  (boolean) $_POST["full_width_height"]["contr_prop"]
1150  );
1151  }
1152  $full_item->setFormat($format);
1153  $full_item->setLocation($location);
1154  }
1155 
1156  $full_item->setLocationType("LocalFile");
1157  $type = "File";
1158  }
1159  if ($_POST["full_type"] == "Standard") {
1160  $format = $std_item->getFormat();
1161  $location = $std_item->getLocation();
1162  $full_item->setLocationType($std_item->getLocationType());
1163  $full_item->setFormat($format);
1164  $full_item->setLocation($location);
1165  $type = $std_item->getLocationType();
1166  if ($type == "LocalFile") {
1167  $type = "File";
1168  }
1169  // resize image
1170  //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1171  if ($_POST["full_size"] != "original" &&
1172  is_int(strpos($format, "image")) &&
1173  $full_item->getLocationType() == "LocalFile") {
1174  $file = $mob_dir . "/" . $location;
1176  $file,
1177  (int) $_POST["full_width_height"]["width"],
1178  (int) $_POST["full_width_height"]["height"],
1179  (boolean) $_POST["full_width_height"]["contr_prop"]
1180  );
1181  }
1182  }
1183 
1184  // determine width and height of known image types
1186  $format,
1187  $type,
1188  $mob_dir . "/" . $location,
1189  $full_item->getLocation(),
1190  $_POST["full_width_height"]["constr_prop"],
1191  ($_POST["full_size"] == "original"),
1192  $_POST["full_width_height"]["width"],
1193  $_POST["full_width_height"]["height"]
1194  );
1195  if ($wh["info"] != "") {
1196  ilUtil::sendInfo($wh["info"], true);
1197  }
1198 
1199  $full_item->setWidth($wh["width"]);
1200  $full_item->setHeight($wh["height"]);
1201  $full_item->setLocation($location);
1202 
1203  $full_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1204 
1205  // text representation
1206  $full_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1207 
1208 
1209  // set parameters
1210  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
1212  $std_item->getLocation(),
1213  $std_item->getFormat()
1214  )) {
1215  if ($_POST["full_autostart"]) { // save only autostart flag
1216  $full_item->setParameters('autostart="true"');
1217  } else {
1218  $full_item->setParameters("");
1219  }
1220  } else {
1221  $full_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])));
1222  }
1223  }
1224  }
1225 
1227  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1228  ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
1229 
1230  $this->object->update();
1231  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1232  $this->ctrl->redirect($this, "edit");
1233  } else {
1234  $this->form_gui->setValuesByPost();
1235  $tpl->setContent($this->form_gui->getHTML());
1236  }
1237  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$type
static sanitizeDir($a_path)
Sanitize directory recursively.
static _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
$location
Definition: buildRTE.php:44
static _getDirectory($a_mob_id)
Get absolute directory.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
Class ilMediaItem.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static secureLink($a_str)
static _useAutoStartParameterOnly($a_loc, $a_format)
Check whether only autostart parameter should be supported (instead of parameters input field...
static _getSimpleMimeTypes()
Get simple mime types that deactivate parameter property files tab in ILIAS.
static _determineWidthHeight( $a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
Determine width and height.
$_POST["username"]
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ setAdvMdRecordObject()

ilObjMediaObjectGUI::setAdvMdRecordObject (   $a_adv_ref_id,
  $a_adv_type,
  $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)

Parameters
string$a_valadv type

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

103  {
104  $this->adv_ref_id = $a_adv_ref_id;
105  $this->adv_type = $a_adv_type;
106  $this->adv_subtype = $a_adv_subtype;
107  }

◆ setBackTitle()

ilObjMediaObjectGUI::setBackTitle (   $a_title)

set title for back tab

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

Referenced by ilPCMediaObjectGUI\executeCommand().

297  {
298  $this->back_title = $a_title;
299  }
+ Here is the caller graph for this function:

◆ setEnabledMapAreas()

ilObjMediaObjectGUI::setEnabledMapAreas (   $a_enabledmapareas)

Set Enable map areas.

Parameters
boolean$a_enabledmapareasEnable map areas

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

138  {
139  $this->enabledmapareas = $a_enabledmapareas;
140  }

◆ setHeader()

ilObjMediaObjectGUI::setHeader (   $a_title = "")

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

123  {
124  $this->header = $a_title;
125  }

◆ setHeightPreset()

ilObjMediaObjectGUI::setHeightPreset (   $a_val)

Set height preset.

Parameters
intheight preset

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

178  {
179  $this->height_preset = $a_val;
180  }

◆ setObjectPerCreationForm()

static ilObjMediaObjectGUI::setObjectPerCreationForm (   $a_mob)
static

Set media object values from creation form.

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

References $_POST, $format, $location, $title, $type, ilObjMediaObject\_determineWidthHeight(), ilObjMediaObject\_getDirectory(), ilObjMediaObject\_resizeImage(), ilObjMediaObject\fixFilename(), ilObjMediaObject\getMimeType(), ilObjMediaObject\renameExecutables(), ilMediaSvgSanitizer\sanitizeDir(), ilUtil\secureLink(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

Referenced by ilPCMediaObjectGUI\create(), and saveObject().

717  {
718  // determinte title and format
719  if (trim($_POST["standard_title"]) != "") {
720  $title = trim($_POST["standard_title"]);
721  } else {
722  if ($_POST["standard_type"] == "File") {
723  $title = $_FILES['standard_file']['name'];
724  } else {
725  $title = ilUtil::stripSlashes($_POST["standard_reference"]);
726  }
727  }
728 
729  $a_mob->setTitle($title);
730  $a_mob->setDescription("");
731  $a_mob->create();
732 
733  // determine and create mob directory, move uploaded file to directory
734  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
735  $a_mob->createDirectory();
736  $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
737 
738  $media_item = new ilMediaItem();
739  $a_mob->addMediaItem($media_item);
740  $media_item->setPurpose("Standard");
741 
742  if ($_POST["standard_type"] == "File") {
743  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
744  $file = $mob_dir . "/" . $file_name;
745  ilUtil::moveUploadedFile(
746  $_FILES['standard_file']['tmp_name'],
747  $file_name,
748  $file
749  );
750 
751  // get mime type
753  $location = $file_name;
754 
755  // resize standard images
756  if ($_POST["standard_size"] != "original" &&
757  is_int(strpos($format, "image"))) {
759  $file,
760  (int) $_POST["standard_width_height"]["width"],
761  (int) $_POST["standard_width_height"]["height"],
762  (boolean) $_POST["standard_width_height"]["contr_prop"]
763  );
764  }
765 
766  // set real meta and object data
767  $media_item->setFormat($format);
768  $media_item->setLocation($location);
769  $media_item->setLocationType("LocalFile");
770  } else { // standard type: reference
771  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
772  $media_item->setFormat($format);
773  $media_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
774  $media_item->setLocationType("Reference");
775  }
776  $a_mob->setDescription($format);
777 
778  // determine width and height of known image types
780  $format,
781  $_POST["standard_type"],
782  $mob_dir . "/" . $location,
783  $media_item->getLocation(),
784  $_POST["standard_width_height"]["constr_prop"],
785  ($_POST["standard_size"] == "original"),
786  $_POST["standard_width_height"]["width"],
787  $_POST["standard_width_height"]["height"]
788  );
789  $media_item->setWidth($wh["width"]);
790  $media_item->setHeight($wh["height"]);
791  if ($wh["info"] != "") {
792  ilUtil::sendInfo($wh["info"], true);
793  }
794 
795  if ($_POST["standard_caption"] != "") {
796  $media_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
797  }
798 
799 
800  $media_item->setHAlign("Left");
801 
802  // fullscreen view
803  if ($_POST["full_type"] != "None") {
804  $media_item2 = new ilMediaItem();
805  $a_mob->addMediaItem($media_item2);
806  $media_item2->setPurpose("Fullscreen");
807 
808  // move file / set format and location
809  if ($_POST["full_type"] == "File") {
810  $format = $location = "";
811  if ($_FILES['full_file']['name'] != "") {
812  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
813  $file = $mob_dir . "/" . $full_file_name;
814  ilUtil::moveUploadedFile(
815  $_FILES['full_file']['tmp_name'],
816  $full_file_name,
817  $file
818  );
820  $location = $full_file_name;
821  }
822  } elseif ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File") {
823  $location = $file_name;
824  }
825 
826  // resize file
827  if ($_POST["full_type"] == "File" ||
828  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File")) {
829  if (($_POST["full_size"] != "original" &&
830  is_int(strpos($format, "image")))
831  ) {
833  $file,
834  (int) $_POST["full_width_height"]["width"],
835  (int) $_POST["full_width_height"]["height"],
836  (boolean) $_POST["full_width_height"]["constr_prop"]
837  );
838  }
839 
840  $media_item2->setFormat($format);
841  $media_item2->setLocation($location);
842  $media_item2->setLocationType("LocalFile");
843  $type = "File";
844  }
845 
846  if ($_POST["full_type"] == "Reference") {
847  $format = $location = "";
848  if ($_POST["full_reference"] != "") {
849  $format = ilObjMediaObject::getMimeType($_POST["full_reference"], true);
850  $location = ilUtil::stripSlashes($_POST["full_reference"]);
851  }
852  }
853 
854  if ($_POST["full_type"] == "Reference" ||
855  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "Reference")) {
856  $media_item2->setFormat($format);
857  $media_item2->setLocation($location);
858  $media_item2->setLocationType("Reference");
859  $type = "Reference";
860  }
861 
862  // determine width and height of known image types
864  $format,
865  $type,
866  $mob_dir . "/" . $location,
867  $media_item2->getLocation(),
868  $_POST["full_width_height"]["constr_prop"],
869  ($_POST["full_size"] == "original"),
870  $_POST["full_width_height"]["width"],
871  $_POST["full_width_height"]["height"]
872  );
873 
874  $media_item2->setWidth($wh["width"]);
875  $media_item2->setHeight($wh["height"]);
876 
877  if ($_POST["full_caption"] != "") {
878  $media_item2->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
879  }
880  }
881 
883  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
884  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
885  $a_mob->update();
886  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$type
static sanitizeDir($a_path)
Sanitize directory recursively.
static _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
$location
Definition: buildRTE.php:44
static _getDirectory($a_mob_id)
Get absolute directory.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
Class ilMediaItem.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static secureLink($a_str)
static _determineWidthHeight( $a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
Determine width and height.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPropertiesSubTabs()

ilObjMediaObjectGUI::setPropertiesSubTabs (   $a_active)

Set subtabs for properties.

Parameters
string$a_activeactive tab id

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

References $ctrl, $ilCtrl, ilObjectGUI\$lng, and $tabs.

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

1931  {
1932  $ilTabs = $this->tabs;
1933  $ilCtrl = $this->ctrl;
1934  $lng = $this->lng;
1935 
1936  $ilTabs->activateTab("cont_mob_def_prop");
1937 
1938  $ilTabs->addSubTab(
1939  "general",
1940  $lng->txt("mob_general"),
1941  $ilCtrl->getLinkTarget($this, "edit")
1942  );
1943 
1944  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1945  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4") {
1946  $ilTabs->addSubTab(
1947  "subtitles",
1948  $lng->txt("mob_subtitles"),
1949  $ilCtrl->getLinkTarget($this, "listSubtitleFiles")
1950  );
1951  }
1952 
1953  $ilTabs->activateSubTab($a_active);
1954  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ setTabs()

ilObjMediaObjectGUI::setTabs ( )

set admin tabs

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

References ilUtil\getImagePath(), and getTabs().

1771  {
1772  //echo "setAdminTabs should not be called.";
1773 
1774  // catch feedback message
1775  $this->getTabs();
1776 
1777  $this->tpl->clearHeader();
1778  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject") {
1779  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1780  $this->tpl->setTitle($this->object->getTitle());
1781  } else {
1782  //$title = $this->object->getTitle();
1783  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1784  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1785  }
1786  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ setWidthPreset()

ilObjMediaObjectGUI::setWidthPreset (   $a_val)

Set width preset.

Parameters
intwidth preset

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

158  {
159  $this->width_preset = $a_val;
160  }

◆ showAllUsagesObject()

ilObjMediaObjectGUI::showAllUsagesObject ( )

Show all media object usages (incl history)

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

References showUsagesObject().

1637  {
1638  $this->showUsagesObject(true);
1639  }
showUsagesObject($a_all=false)
show all usages of mob
+ Here is the call graph for this function:

◆ showMultiSubtitleConfirmationTableObject()

ilObjMediaObjectGUI::showMultiSubtitleConfirmationTableObject ( )

List of srt files in zip file.

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

References $tab, ilObjectGUI\$tpl, and setPropertiesSubTabs().

2107  {
2108  $tpl = $this->tpl;
2109 
2110  $this->setPropertiesSubTabs("subtitles");
2111 
2112  include_once("./Services/MediaObjects/classes/class.ilMultiSrtConfirmationTable2GUI.php");
2113  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
2114  $tpl->setContent($tab->getHTML());
2115  }
setPropertiesSubTabs($a_active)
Set subtabs for properties.
List srt files from zip file for upload confirmation.
+ Here is the call graph for this function:

◆ showUsagesObject()

ilObjMediaObjectGUI::showUsagesObject (   $a_all = false)

show all usages of mob

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

References $ctrl, $ilCtrl, ilObjectGUI\$lng, $tabs, and ilObjectGUI\$tpl.

Referenced by showAllUsagesObject().

1646  {
1647  $tpl = $this->tpl;
1648  $ilTabs = $this->tabs;
1649  $ilTabs = $this->tabs;
1650  $lng = $this->lng;
1651  $ilCtrl = $this->ctrl;
1652 
1653  $ilTabs->addSubTab(
1654  "current_usages",
1655  $lng->txt("cont_current_usages"),
1656  $ilCtrl->getLinkTarget($this, "showUsages")
1657  );
1658 
1659  $ilTabs->addSubTab(
1660  "all_usages",
1661  $lng->txt("cont_all_usages"),
1662  $ilCtrl->getLinkTarget($this, "showAllUsages")
1663  );
1664 
1665  if ($a_all) {
1666  $ilTabs->activateSubTab("all_usages");
1667  $cmd = "showAllUsages";
1668  } else {
1669  $ilTabs->activateSubTab("current_usages");
1670  $cmd = "showUsages";
1671  }
1672 
1673  include_once("./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1674  $usages_table = new ilMediaObjectUsagesTableGUI(
1675  $this,
1676  $cmd,
1677  $this->object,
1678  $a_all
1679  );
1680  $tpl->setContent($usages_table->getHTML());
1681  }
TableGUI class for media object usages listing.
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ showVideoToolObject()

ilObjMediaObjectGUI::showVideoToolObject ( )

Show video tools.

Parameters

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

References $formats, ilObjectGUI\$tpl, and ilFFmpeg\getSupportedFormatsInfo().

1887  {
1888  $tpl = $this->tpl;
1889 
1890  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1891 
1892  /*$codecs = ilFFmpeg::getSupportedCodecsInfo();
1893  $codec_str = implode($codecs, "<br />");
1894  $tpl->setContent($codec_str);*/
1895 
1897  $formats_str = implode($formats, "<br />");
1898  $tpl->setContent($formats_str);
1899  }
static getSupportedFormatsInfo()
Get all supported formats.
$formats
Definition: date.php:77
+ Here is the call graph for this function:

◆ uploadFileObject()

ilObjMediaObjectGUI::uploadFileObject ( )

upload file

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

References $_GET, ilObjMediaObject\fixFilename(), ilUtil\getWebspaceDir(), ilObjMediaObject\renameExecutables(), and ilMediaSvgSanitizer\sanitizeDir().

1435  {
1436  // determine directory
1437  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1438  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1439  $cur_dir = (!empty($cur_subdir))
1440  ? $mob_dir . "/" . $cur_subdir
1441  : $mob_dir;
1442  if (is_file($_FILES["new_file"]["tmp_name"])) {
1443  $file_name = ilObjMediaObject::fixFilename($_FILES["new_file"]["name"]);
1444  $file = $cur_dir . "/" . $file_name;
1445  ilUtil::moveUploadedFile(
1446  $_FILES['new_file']['tmp_name'],
1447  $file_name,
1448  $file
1449  );
1450  }
1452  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1453  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1454 
1455  $this->ctrl->saveParameter($this, "cdir");
1456  $this->ctrl->redirect($this, "editFiles");
1457  }
static sanitizeDir($a_path)
Sanitize directory recursively.
$_GET["client_id"]
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ uploadMultipleSubtitleFileFormObject()

ilObjMediaObjectGUI::uploadMultipleSubtitleFileFormObject ( )

Upload multiple stubtitles.

Parameters

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

References $ctrl, $ilCtrl, ilObjectGUI\$lng, $toolbar, ilUtil\sendInfo(), setPropertiesSubTabs(), and ilFileInputGUI\setSuffixes().

2070  {
2071  $ilToolbar = $this->toolbar;
2072  $lng = $this->lng;
2073  $ilCtrl = $this->ctrl;
2074 
2075  ilUtil::sendInfo($lng->txt("mob_upload_multi_srt_howto"));
2076 
2077  $this->setPropertiesSubTabs("subtitles");
2078 
2079  // upload file
2080  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
2081  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2082  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.zip)", "subtitle_file");
2083  $fi->setSuffixes(array("zip"));
2084  $ilToolbar->addInputItem($fi, true);
2085 
2086  $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
2087  }
This class represents a file property in a property form.
setPropertiesSubTabs($a_active)
Set subtabs for properties.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:

◆ uploadMultipleSubtitleFileObject()

ilObjMediaObjectGUI::uploadMultipleSubtitleFileObject ( )

Upload multiple subtitles.

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

References ilUtil\sendFailure(), and ilUtil\stripSlashesArray().

2093  {
2094  try {
2095  $this->object->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
2096  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
2097  } catch (ilMediaObjectsException $e) {
2098  ilUtil::sendFailure($e->getMessage(), true);
2099  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
2100  }
2101  }
General exception class for media objects.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
+ Here is the call graph for this function:

◆ uploadSubtitleFileObject()

ilObjMediaObjectGUI::uploadSubtitleFileObject ( )

Upload srt file.

Parameters

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

References $_POST, $ctrl, $ilCtrl, ilObjectGUI\$lng, and ilUtil\stripSlashes().

2006  {
2007  $lng = $this->lng;
2008  $ilCtrl = $this->ctrl;
2009 
2010  if ($this->object->uploadSrtFile($_FILES["subtitle_file"]["tmp_name"], ilUtil::stripSlashes($_POST["language"]))) {
2011  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2012  }
2013  $ilCtrl->redirect($this, "listSubtitleFiles");
2014  }
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjMediaObjectGUI::$access
protected

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

Referenced by executeCommand().

◆ $adv_ref_id

ilObjMediaObjectGUI::$adv_ref_id = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_subtype

ilObjMediaObjectGUI::$adv_subtype = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_type

ilObjMediaObjectGUI::$adv_type = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $ctrl

◆ $enabledmapareas

ilObjMediaObjectGUI::$enabledmapareas = true

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

Referenced by getEnabledMapAreas().

◆ $error

ilObjMediaObjectGUI::$error
protected

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

Referenced by executeCommand().

◆ $header

ilObjMediaObjectGUI::$header

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

Referenced by getHeader().

◆ $help

ilObjMediaObjectGUI::$help
protected

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

Referenced by createObject(), and getTabs().

◆ $tabs

ilObjMediaObjectGUI::$tabs
protected

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

Referenced by setPropertiesSubTabs(), and showUsagesObject().

◆ $target_script

ilObjMediaObjectGUI::$target_script

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

◆ $toolbar

ilObjMediaObjectGUI::$toolbar
protected

◆ $user

ilObjMediaObjectGUI::$user
protected

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

Referenced by listSubtitleFilesObject().


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