ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 viewObject container presentation for "administration -> repository, trash, permissions" 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...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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...
 
 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
 
 $media_type
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

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

References $DIC, ilObjectGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), help(), and user().

78  {
79  global $DIC;
80 
81  $this->tpl = $DIC["tpl"];
82  $this->access = $DIC->access();
83  $this->error = $DIC["ilErr"];
84  $this->help = $DIC["ilHelp"];
85  $this->tabs = $DIC->tabs();
86  $this->toolbar = $DIC->toolbar();
87  $this->user = $DIC->user();
88  $lng = $DIC->language();
89  $ilCtrl = $DIC->ctrl();
90  $this->media_type = new ILIAS\MediaObjects\MediaType\MediaType();
91 
92  $this->ctrl = $ilCtrl;
93  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
94  $this->lng = $lng;
95  $this->back_title = "";
96  $this->type = "mob";
97 
98  $lng->loadLanguageModule("mob");
99  }
user()
Definition: user.php:4
help()
Definition: help.php:2
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ 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 1706 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().

1707  {
1708  global $DIC;
1709 
1710  $lng = $DIC->language();
1711 
1712  $tpl = new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
1713  $types = array("Standard", "Fullscreen");
1714  foreach ($types as $type) {
1715  if ($type == "Fullscreen" && !$a_mob->hasFullScreenItem()) {
1716  continue;
1717  }
1718 
1719  $med = $a_mob->getMediaItem($type);
1720  if (!$med) {
1721  return "";
1722  }
1723 
1724  $tpl->setCurrentBlock("media_info");
1725  if ($type == "Standard") {
1726  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1727  } else {
1728  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1729  }
1730  $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
1731  $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1732  if ($med->getLocationType() == "LocalFile") {
1733  $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
1734  if (is_file($file)) {
1735  $size = filesize($file);
1736  } else {
1737  $size = 0;
1738  }
1739  $tpl->setVariable("VAL_FILE_SIZE", " ($size " . $lng->txt("bytes") . ")");
1740  }
1741  $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1742  $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1743  if ($med->getWidth() != "" && $med->getHeight() != "") {
1744  $tpl->setCurrentBlock("size");
1745  $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1746  $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
1747  $tpl->parseCurrentBlock();
1748  }
1749 
1750  // original size
1751  if ($orig_size = $med->getOriginalSize()) {
1752  if ($orig_size["width"] != $med->getWidth() ||
1753  $orig_size["height"] != $med->getHeight()) {
1754  $tpl->setCurrentBlock("orig_size");
1755  $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1756  $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1757  $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1758  $tpl->parseCurrentBlock();
1759  }
1760  }
1761 
1762  // output caption
1763  if ($med && strlen($med->getCaption())) {
1764  $tpl->setCurrentBlock('additional_info');
1765  $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
1766  $tpl->parseCurrentBlock();
1767  }
1768 
1769  // output keywords
1770  if ($type == "Standard") {
1771  include_once './Services/MetaData/classes/class.ilMDKeyword.php';
1772  if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) {
1773  $tpl->setCurrentBlock('additional_info');
1774  $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws));
1775  $tpl->parseCurrentBlock();
1776  }
1777  }
1778 
1779  $tpl->setCurrentBlock("media_info");
1780  $tpl->parseCurrentBlock();
1781  }
1782 
1783  return $tpl->get();
1784  }
$size
Definition: RandomTest.php:84
$type
static _getDirectory($a_mob_id)
Get absolute directory.
global $DIC
Definition: goto.php:24
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 1566 of file class.ilObjMediaObjectGUI.php.

1567  {
1568  if (!$this->object->hasFullScreenItem()) {
1569  $std_item = $this->object->getMediaItem("Standard");
1570  $full_item = new ilMediaItem();
1571  $full_item->setMobId($std_item->getMobId());
1572  $full_item->setLocation($std_item->getLocation());
1573  $full_item->setLocationType($std_item->getLocationType());
1574  $full_item->setFormat($std_item->getFormat());
1575  $full_item->setWidth($std_item->getWidth());
1576  $full_item->setHeight($std_item->getHeight());
1577  $full_item->setCaption($std_item->getCaption());
1578  $full_item->setTextRepresentation($std_item->getTextRepresentation());
1579  $full_item->setPurpose("Fullscreen");
1580  $this->object->addMediaItem($full_item);
1581 
1582  $this->object->update();
1583  }
1584 
1585  $this->ctrl->redirect($this, "edit");
1586  }
Class ilMediaItem Media Item, component of a media object (file or reference)

◆ assignFullscreenObject()

ilObjMediaObjectGUI::assignFullscreenObject (   $a_file)

assign file to fullscreen view

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

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

1512  {
1513  // determine directory
1514  $cur_subdir = dirname($a_file);
1515  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1516  $cur_dir = (!empty($cur_subdir))
1517  ? $mob_dir . "/" . $cur_subdir
1518  : $mob_dir;
1519  $file = $cur_dir . "/" . basename($a_file);
1520  $location = $a_file;
1521 
1522  if (!is_file($file)) {
1523  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1524  }
1525 
1526  if (!$this->object->hasFullScreenItem()) { // create new fullscreen item
1527  $std_item = $this->object->getMediaItem("Standard");
1528  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1529  $file = $mob_dir . "/" . $location;
1530  $full_item = new ilMediaItem();
1531  $full_item->setMobId($std_item->getMobId());
1532  $full_item->setLocation($location);
1533  $full_item->setLocationType("LocalFile");
1534  $full_item->setFormat(ilObjMediaObject::getMimeType($file));
1535  $full_item->setPurpose("Fullscreen");
1536  $this->object->addMediaItem($full_item);
1537  } else { // alter existing fullscreen item
1538  $full_item = $this->object->getMediaItem("Fullscreen");
1539 
1540  $full_item->setLocationType("LocalFile");
1541  $full_item->setLocation($location);
1543  $full_item->setFormat($format);
1544  }
1545  $this->object->update();
1546  // $this->ctrl->saveParameter($this, "cdir");
1547  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1548  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$location
Definition: buildRTE.php:44
Class ilMediaItem Media Item, component of a media object (file or reference)
$format
Definition: metadata.php:218
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 207 of file class.ilObjMediaObjectGUI.php.

208  {
209  if ($this->id != 0) {
210  $this->object = new ilObjMediaObject($this->id);
211  }
212  }
Class ilObjMediaObject.

◆ assignStandardObject()

ilObjMediaObjectGUI::assignStandardObject (   $a_file)

assign file to standard view

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

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

1483  {
1484  // determine directory
1485  $cur_subdir = dirname($a_file);
1486  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1487  $cur_dir = (!empty($cur_subdir))
1488  ? $mob_dir . "/" . $cur_subdir
1489  : $mob_dir;
1490  $file = $cur_dir . "/" . basename($a_file);
1491  $location = $a_file;
1492 
1493  if (!is_file($file)) {
1494  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1495  }
1496 
1497  $std_item = $this->object->getMediaItem("Standard");
1498  $std_item->setLocationType("LocalFile");
1499  $std_item->setLocation($location);
1501  $std_item->setFormat($format);
1502  $this->object->update();
1503  // $this->ctrl->saveParameter($this, "cdir");
1504  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1505  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$location
Definition: buildRTE.php:44
$format
Definition: metadata.php:218
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 2136 of file class.ilObjMediaObjectGUI.php.

2137  {
2138  $this->object->clearMultiSrtDirectory();
2139  $this->ctrl->redirect($this, "listSubtitleFiles");
2140  }

◆ cancelObject()

ilObjMediaObjectGUI::cancelObject ( )

Cancel saving.

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

911  {
912  $this->ctrl->returnToParent($this);
913  }

◆ checkFixSize()

ilObjMediaObjectGUI::checkFixSize ( )
protected

Check fix size.

Parameters

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

References ilUtil\sendFailure().

Referenced by executeCommand().

597  {
598  $std_item = $this->object->getMediaItem("Standard");
599  if ($std_item->getWidth() == "" || $std_item->getHeight() == "") {
600  ilUtil::sendFailure($this->lng->txt("mob_no_fixed_size_map_editing"));
601  }
602  }
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 721 of file class.ilObjMediaObjectGUI.php.

722  {
723  if (!$this->form_gui->checkInput()) {
724  $this->form_gui->setValuesByPost();
725  return false;
726  }
727  return true;
728  }

◆ confirmSrtDeletionObject()

ilObjMediaObjectGUI::confirmSrtDeletionObject ( )

Confirm srt file deletion.

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

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

2036  {
2037  $ilCtrl = $this->ctrl;
2038  $tpl = $this->tpl;
2039  $lng = $this->lng;
2040 
2041  $lng->loadLanguageModule("meta");
2042 
2043  if (!is_array($_POST["srt"]) || count($_POST["srt"]) == 0) {
2044  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2045  $ilCtrl->redirect($this, "listSubtitleFiles");
2046  } else {
2047  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2048  $cgui = new ilConfirmationGUI();
2049  $cgui->setFormAction($ilCtrl->getFormAction($this));
2050  $cgui->setHeaderText($lng->txt("mob_really_delete_srt"));
2051  $cgui->setCancel($lng->txt("cancel"), "listSubtitleFiles");
2052  $cgui->setConfirm($lng->txt("delete"), "deleteSrtFiles");
2053 
2054  foreach ($_POST["srt"] as $i) {
2055  $cgui->addItem("srt[]", $i, "subtitle_" . $i . ".srt (" . $lng->txt("meta_l_" . $i) . ")");
2056  }
2057 
2058  $tpl->setContent($cgui->getHTML());
2059  }
2060  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
$i
Definition: metadata.php:24
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDirectoryObject()

ilObjMediaObjectGUI::createDirectoryObject ( )

create directory

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

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

1432  {
1433  //echo "cdir:".$_GET["cdir"].":<br>";
1434  // determine directory
1435  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1436  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1437  $cur_dir = (!empty($cur_subdir))
1438  ? $mob_dir . "/" . $cur_subdir
1439  : $mob_dir;
1440 
1441  $new_dir = str_replace(".", "", $_POST["new_dir"]);
1442  $new_dir = str_replace("/", "", $new_dir);
1443 
1444  if (!empty($new_dir)) {
1445  ilUtil::makeDir($cur_dir . "/" . $new_dir);
1446  }
1447  $this->ctrl->saveParameter($this, "cdir");
1448  $this->ctrl->redirect($this, "editFiles");
1449  }
$_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 309 of file class.ilObjMediaObjectGUI.php.

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

310  {
311  $tpl = $this->tpl;
312  $ilHelp = $this->help;
313 
314  $ilHelp->setScreenId("create");
315  $this->initForm();
316  $tpl->setContent($this->form_gui->getHTML());
317  }
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ deleteFileObject()

ilObjMediaObjectGUI::deleteFileObject ( )

delete object file

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

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

1593  {
1594  if (!isset($_POST["file"])) {
1595  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1596  }
1597 
1598  if (count($_POST["file"]) > 1) {
1599  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE);
1600  }
1601 
1602  if ($_POST["file"][0] == "..") {
1603  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1604  }
1605 
1606  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1607  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1608  $cur_dir = (!empty($cur_subdir))
1609  ? $mob_dir . "/" . $cur_subdir
1610  : $mob_dir;
1611  $file = $cur_dir . "/" . $_POST["file"][0];
1612  $location = (!empty($cur_subdir))
1613  ? $cur_subdir . "/" . $_POST["file"][0]
1614  : $_POST["file"][0];
1615 
1616  $full_item = $this->object->getMediaItem("Fullscreen");
1617  $std_item = $this->object->getMediaItem("Standard");
1618 
1619  if ($location == $std_item->getLocation()) {
1620  $this->ilias->raiseError($this->lng->txt("cont_cant_del_std"), $this->ilias->error_obj->MESSAGE);
1621  }
1622 
1623  if ($this->object->hasFullScreenItem()) {
1624  if ($location == $full_item->getLocation()) {
1625  $this->ilias->raiseError($this->lng->txt("cont_cant_del_full"), $this->ilias->error_obj->MESSAGE);
1626  }
1627  }
1628 
1629  if (@is_dir($file)) {
1630  if (substr($std_item->getLocation(), 0, strlen($location)) == $location) {
1631  $this->ilias->raiseError($this->lng->txt("cont_std_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1632  }
1633 
1634  if ($this->object->hasFullScreenItem()) {
1635  if (substr($full_item->getLocation(), 0, strlen($location)) == $location) {
1636  $this->ilias->raiseError($this->lng->txt("cont_full_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1637  }
1638  }
1639  }
1640 
1641  if (@is_file($file)) {
1642  unlink($file);
1643  }
1644 
1645  if (@is_dir($file)) {
1646  ilUtil::delDir($file);
1647  }
1648 
1649  $this->ctrl->saveParameter($this, "cdir");
1650  $this->ctrl->redirect($this, "editFiles");
1651  }
$_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 2065 of file class.ilObjMediaObjectGUI.php.

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

2066  {
2067  $lng = $this->lng;
2068  $ilCtrl = $this->ctrl;
2069 
2070  foreach ($_POST["srt"] as $i) {
2071  if (strlen($i) == 2 && !is_int(strpos($i, "."))) {
2072  $this->object->removeAdditionalFile("srt/subtitle_" . $i . ".srt");
2073  }
2074  }
2075  ilUtil::sendSuccess($lng->txt("mob_srt_files_deleted"), true);
2076  $ilCtrl->redirect($this, "listSubtitleFiles");
2077  }
$_POST["username"]
$i
Definition: metadata.php:24

◆ editFilesObject()

ilObjMediaObjectGUI::editFilesObject ( )

administrate files of media object

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

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

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

◆ editObject()

ilObjMediaObjectGUI::editObject ( )

edit media object properties

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

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

919  {
920  $tpl = $this->tpl;
921 
922  $this->setPropertiesSubTabs("general");
923 
924  $this->initForm("edit");
925  $this->getValues();
926  $tpl->setContent($this->form_gui->getHTML());
927  }
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 225 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().

226  {
227  $tpl = $this->tpl;
228  $ilAccess = $this->access;
230 
231  $next_class = $this->ctrl->getNextClass($this);
232  $cmd = $this->ctrl->getCmd();
233 
234  switch ($next_class) {
235  case 'ilobjectmetadatagui':
236  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
237  $md_gui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
238  // object is subtype, so we have to do it ourselves
239  $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
240 
241  // set adv metadata record dobject
242  if ($this->adv_type != "") {
243  $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
244  }
245 
246  $this->ctrl->forwardCommand($md_gui);
247  break;
248 
249  case "ilimagemapeditorgui":
250  require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
251  $image_map_edit = new ilImageMapEditorGUI($this->object);
252  $ret = $this->ctrl->forwardCommand($image_map_edit);
253  $tpl->setContent($ret);
254  $this->checkFixSize();
255  break;
256 
257  case "ilfilesystemgui":
258  include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
259  $fs_gui = new ilFileSystemGUI(ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId());
261  $fs_gui->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
262  $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
263  $fs_gui->setTableId("mobfs" . $this->object->getId());
264  $fs_gui->labelFile(
265  $this->object->getMediaItem("Standard")->getLocation(),
266  $this->lng->txt("cont_std_view")
267  );
268  if ($this->object->hasFullscreenItem()) {
269  $fs_gui->labelFile(
270  $this->object->getMediaItem("Fullscreen")->getLocation(),
271  $this->lng->txt("cont_fullscreen")
272  );
273  }
274  $fs_gui->addCommand($this, "assignStandardObject", $this->lng->txt("cont_assign_std"));
275  $fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full"));
276  ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
277  $ret = $this->ctrl->forwardCommand($fs_gui);
278  ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
279  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
280  ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
281  break;
282 
283 
284  default:
285  if (isset($_POST["editImagemapForward"]) ||
286  isset($_POST["editImagemapForward_x"]) ||
287  isset($_POST["editImagemapForward_y"])) {
288  $cmd = "editImagemapForward";
289  }
290  $cmd .= "Object";
291  $ret = $this->$cmd();
292  break;
293  }
294 
295  return $ret;
296  }
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 119 of file class.ilObjMediaObjectGUI.php.

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

120  {
121  if ($this->adv_type == null) {
122  return [$this->ref_id, $this->obj_type, $this->sub_type];
123  }
125  }

◆ getEnabledMapAreas()

ilObjMediaObjectGUI::getEnabledMapAreas ( )

Get Enable map areas.

Returns
boolean Enable map areas

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

References $enabledmapareas.

Referenced by getTabs().

153  {
154  return $this->enabledmapareas;
155  }
+ Here is the caller graph for this function:

◆ getForm()

ilObjMediaObjectGUI::getForm ( )

Get form.

Returns
object form gui class

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

203  {
204  return $this->form_gui;
205  }

◆ getFullscreenSizeObject()

ilObjMediaObjectGUI::getFullscreenSizeObject ( )

set original size of fullscreen file

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

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

1000  {
1001  $full_item = $this->object->getMediaItem("Fullscreen");
1002  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1003 
1004  if ($full_item->getLocationType() == "LocalFile") {
1005  $file = $mob_dir . "/" . $full_item->getLocation();
1006  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1008  $full_item->setWidth($size[0]);
1009  $full_item->setHeight($size[1]);
1010  $this->object->update();
1011  }
1012  $this->ctrl->redirect($this, "edit");
1013  }
$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 132 of file class.ilObjMediaObjectGUI.php.

References $header.

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

◆ getHeightPreset()

ilObjMediaObjectGUI::getHeightPreset ( )

Get height preset.

Returns
int height preset

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

Referenced by initForm().

193  {
194  return $this->height_preset;
195  }
+ Here is the caller graph for this function:

◆ getStandardSizeObject()

ilObjMediaObjectGUI::getStandardSizeObject ( )

set original size of standard file

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

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

978  {
979  $std_item = $this->object->getMediaItem("Standard");
980  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
981 
982  if ($std_item->getLocationType() == "LocalFile") {
983  $file = $mob_dir . "/" . $std_item->getLocation();
984 
985  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
987 
988  $std_item->setWidth($size[0]);
989  $std_item->setHeight($size[1]);
990  $this->object->update();
991  }
992  $this->ctrl->redirect($this, "edit");
993  }
$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 1812 of file class.ilObjMediaObjectGUI.php.

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

Referenced by setTabs().

1813  {
1814  $ilHelp = $this->help;
1815 
1816  $ilHelp->setScreenIdComponent("mob");
1817 
1818  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1819  && $this->object->getId() > 0) {
1820  // object properties
1821  $this->tabs_gui->addTarget(
1822  "cont_mob_def_prop",
1823  $this->ctrl->getLinkTarget($this, "edit"),
1824  "edit",
1825  get_class($this)
1826  );
1827 
1828  $st_item = $this->object->getMediaItem("Standard");
1829 
1830  // link areas
1831 
1832  if (is_object($st_item) && $this->getEnabledMapAreas()) {
1833  $format = $st_item->getFormat();
1834  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg"))) {
1835  $this->tabs_gui->addTarget(
1836  "cont_def_map_areas",
1837  $this->ctrl->getLinkTargetByClass(
1838  array("ilobjmediaobjectgui", "ilimagemapeditorgui"),
1839  "editMapAreas"
1840  ),
1841  "editMapAreas",
1842  "ilimagemapeditorgui"
1843  );
1844  }
1845  }
1846 
1847  // object usages
1848  $this->tabs_gui->addTarget(
1849  "cont_mob_usages",
1850  $this->ctrl->getLinkTarget($this, "showUsages"),
1851  "showUsages",
1852  get_class($this)
1853  );
1854 
1855  // object files
1856  $std_item = $this->object->getMediaItem("Standard");
1857  $full_item = $this->object->getMediaItem("Fullscreen");
1858  $mset = new ilSetting("mobs");
1859  if ($mset->get("file_manager_always") ||
1860  ($this->media_type->usesParameterProperty($std_item->getFormat()) ||
1861  (is_object($full_item) && $this->media_type->usesParameterProperty($full_item->getFormat())))
1862  ) {
1863  $this->tabs_gui->addTarget(
1864  "cont_files",
1865  $this->ctrl->getLinkTargetByClass(
1866  array("ilobjmediaobjectgui", "ilfilesystemgui"),
1867  "listFiles"
1868  ),
1869  "",
1870  "ilfilesystemgui"
1871  );
1872  }
1873 
1874  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1875  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1876  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1877  if ($mdtab) {
1878  $this->tabs_gui->addTarget(
1879  "meta_data",
1880  $mdtab,
1881  "",
1882  "ilmdeditorgui"
1883  );
1884  }
1885  }
1886 
1887  // back to upper context
1888  if ($this->back_title != "") {
1889  $this->tabs_gui->setBackTarget(
1890  $this->back_title,
1891  $this->ctrl->getParentReturn($this)
1892  );
1893  }
1894  }
Class ilObjectMetaDataGUI.
getEnabledMapAreas()
Get Enable map areas.
getTab($a_base_class=null)
Get tab link if available.
$format
Definition: metadata.php:218
+ 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 609 of file class.ilObjMediaObjectGUI.php.

Referenced by editObject().

610  {
611  $values = array();
612 
613  $values["standard_title"] = $this->object->getTitle();
614 
615  $std_item = $this->object->getMediaItem("Standard");
616  if ($std_item->getLocationType() == "LocalFile") {
617  $values["standard_type"] = "File";
618  $values["standard_file"] = $std_item->getLocation();
619  } else {
620  $values["standard_type"] = "Reference";
621  $values["standard_reference"] = $std_item->getLocation();
622  }
623  $values["standard_format"] = $std_item->getFormat();
624  $values["standard_width_height"]["width"] = $std_item->getWidth();
625  $values["standard_width_height"]["height"] = $std_item->getHeight();
626  $values["standard_width_height"]["constr_prop"] = true;
627 
628  $values["standard_size"] = "selected";
629 
630  $orig_size = $std_item->getOriginalSize();
631  if ($std_item->getWidth() == "" && $std_item->getHeight() == "") {
632  $values["standard_size"] = "original";
633  $values["standard_width_height"]["width"] = $orig_size["width"];
634  $values["standard_width_height"]["height"] = $orig_size["height"];
635  }
636 
637  $values["standard_caption"] = $std_item->getCaption();
638  $values["text_representation"] = $std_item->getTextRepresentation();
639  if ($this->media_type->usesAutoStartParameterOnly(
640  $std_item->getLocation(),
641  $std_item->getFormat()
642  )) {
643  /*$par = $std_item->getParameters();
644  if ($par["autostart"]) {
645  $values["standard_autostart"] = true;
646  }*/
647  } else {
648  $values["standard_parameters"] = $std_item->getParameterString();
649  }
650 
651  $values["full_type"] = "None";
652  $values["full_size"] = "original";
653  if ($this->object->hasFullScreenItem()) {
654  $full_item = $this->object->getMediaItem("Fullscreen");
655  if ($full_item->getLocationType() == "LocalFile") {
656  $values["full_type"] = "File";
657  $values["full_file"] = $full_item->getLocation();
658  } else {
659  $values["full_type"] = "Reference";
660  $values["full_reference"] = $full_item->getLocation();
661  }
662  $values["full_format"] = $full_item->getFormat();
663  $values["full_width_height"]["width"] = $full_item->getWidth();
664  $values["full_width_height"]["height"] = $full_item->getHeight();
665  $values["full_width_height"]["constr_prop"] = true;
666 
667  $values["full_size"] = "selected";
668 
669  $orig_size = $full_item->getOriginalSize();
670  if ($full_item->getWidth() == "" &&
671  $full_item->getHeight() == "") {
672  $values["full_size"] = "original";
673  $values["full_width_height"]["width"] = $orig_size["width"];
674  $values["full_width_height"]["height"] = $orig_size["height"];
675  }
676  $values["full_caption"] = $full_item->getCaption();
677  if ($this->media_type->usesAutoStartParameterOnly(
678  $full_item->getLocation(),
679  $full_item->getFormat()
680  )) {
681  /*$par = $full_item->getParameters();
682  if ($par["autostart"]) {
683  $values["full_autostart"] = true;
684  }*/
685  } else {
686  $values["full_parameters"] = $full_item->getParameterString();
687  }
688  $values["full_text_representation"] = $full_item->getTextRepresentation();
689  }
690 
691  $this->form_gui->setValuesByArray($values);
692  }
+ Here is the caller graph for this function:

◆ getWidthPreset()

ilObjMediaObjectGUI::getWidthPreset ( )

Get width preset.

Returns
int width preset

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

Referenced by initForm().

173  {
174  return $this->width_preset;
175  }
+ Here is the caller graph for this function:

◆ includePresentationJS()

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

Include media object presentation JS.

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

1922  {
1923  global $DIC;
1924 
1925  $tpl = $DIC["tpl"];
1926 
1927  if ($a_tpl == null) {
1928  $a_tpl = $tpl;
1929  }
1930 
1931  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1932  iljQueryUtil::initjQUery($a_tpl);
1933  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1934  $a_tpl->addJavascript(iljQueryUtil::getLocalMaphilightPath());
1935  $a_tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
1936 
1937  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1939  }
global $DIC
Definition: goto.php:24
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 322 of file class.ilObjMediaObjectGUI.php.

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

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

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

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

1979  {
1980  $ilToolbar = $this->toolbar;
1981  $tpl = $this->tpl;
1982  $ilCtrl = $this->ctrl;
1983  $lng = $this->lng;
1984  $ilUser = $this->user;
1985 
1986  $this->setPropertiesSubTabs("subtitles");
1987 
1988  // upload file
1989  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1990  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1991  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.srt)", "subtitle_file");
1992  $fi->setSuffixes(array("srt"));
1993  $ilToolbar->addInputItem($fi, true);
1994 
1995  // language
1996  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1997  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
1998  $options = ilMDLanguageItem::_getLanguages();
1999  $si = new ilSelectInputGUI($this->lng->txt("mob_language"), "language");
2000  $si->setOptions($options);
2001  $si->setValue($ilUser->getLanguage());
2002  $ilToolbar->addInputItem($si, true);
2003 
2004  $ilToolbar->addFormButton($lng->txt("upload"), "uploadSubtitleFile");
2005 
2006  $ilToolbar->addSeparator();
2007  $ilToolbar->addFormButton($lng->txt("mob_upload_multi_srt"), "uploadMultipleSubtitleFileForm");
2008 
2009  include_once("./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
2010  $tab = new ilMobSubtitleTableGUI($this, "listSubtitleFiles", $this->object);
2011 
2012  $tpl->setContent($tab->getHTML());
2013  }
TableGUI class for subtitle list.
This class represents a file property in a property form.
setPropertiesSubTabs($a_active)
Set subtabs for properties.
$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 1554 of file class.ilObjMediaObjectGUI.php.

1555  {
1556  $this->object->removeMediaItem("Fullscreen");
1557  $this->object->update();
1558 
1559  $this->ctrl->redirect($this, "edit");
1560  }

◆ resizeImagesObject()

ilObjMediaObjectGUI::resizeImagesObject ( )

resize images to specified size

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

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

934  {
935  // directory
936  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
937 
938  // standard item
939  $std_item = $this->object->getMediaItem("Standard");
940  if ($std_item->getLocationType() == "LocalFile" &&
941  is_int(strpos($std_item->getFormat(), "image"))
942  ) {
943  $file = $mob_dir . "/" . $std_item->getLocation();
945  $file,
946  $std_item->getWidth(),
947  $std_item->getHeight()
948  );
949  $std_item->setLocation($location);
950  $std_item->update();
951  }
952 
953  // fullscreen item
954  if ($this->object->hasFullScreenItem()) {
955  $full_item = $this->object->getMediaItem("Fullscreen");
956  if ($full_item->getLocationType() == "LocalFile" &&
957  is_int(strpos($full_item->getFormat(), "image"))
958  ) {
959  $file = $mob_dir . "/" . $full_item->getLocation();
961  $file,
962  $full_item->getWidth(),
963  $full_item->getHeight()
964  );
965  $full_item->setLocation($location);
966  $full_item->update();
967  }
968  }
969 
970  $this->ctrl->redirect($this, "edit");
971  }
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 214 of file class.ilObjMediaObjectGUI.php.

215  {
216  $this->ctrl->returnToParent($this);
217  }

◆ saveMultiSrtObject()

ilObjMediaObjectGUI::saveMultiSrtObject ( )

Save selected srt files as new srt files.

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

References $_POST, $ctrl, and Vendor\Package\$f.

2146  {
2147  $ilCtrl = $this->ctrl;
2148  $srt_files = $this->object->getMultiSrtFiles();
2149  if (is_array($_POST["file"])) {
2150  foreach ($_POST["file"] as $f) {
2151  foreach ($srt_files as $srt_file) {
2152  if ($f == $srt_file["filename"]) {
2153  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir() . "/" . $srt_file["filename"], $srt_file["lang"], "rename");
2154  }
2155  }
2156  }
2157  }
2158  $this->object->clearMultiSrtDirectory();
2159  $ilCtrl->redirect($this, "listSubtitleFiles");
2160  }
$_POST["username"]

◆ saveObject()

ilObjMediaObjectGUI::saveObject ( )

create new media object in dom and update page in db

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

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

698  {
699  $tpl = $this->tpl;
700  $lng = $this->lng;
701 
702  $this->initForm();
703  if ($this->form_gui->checkInput()) {
704  $this->object = new ilObjMediaObject();
706  ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
707  return $this->object;
708  } else {
709  $this->form_gui->setValuesByPost();
710  $tpl->setContent($this->form_gui->getHTML());
711  return false;
712  }
713  }
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 1018 of file class.ilObjMediaObjectGUI.php.

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

1019  {
1020  $lng = $this->lng;
1021  $tpl = $this->tpl;
1022 
1023  $this->initForm("edit");
1024  if ($this->form_gui->checkInput()) {
1025  $title = trim($_POST["standard_title"]);
1026  $this->object->setTitle($title);
1027 
1028  $std_item = $this->object->getMediaItem("Standard");
1029  $location = $std_item->getLocation();
1030  $format = $std_item->getFormat();
1031  if ($_POST["standard_type"] == "Reference") {
1032  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
1033  $std_item->setFormat($format);
1034  $std_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
1035  $std_item->setLocationType("Reference");
1036  }
1037  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1038  if ($_POST["standard_type"] == "File") {
1039  $resize = false;
1040  if ($_FILES['standard_file']['name'] != "") {
1041  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
1042  $file = $mob_dir . "/" . $file_name;
1044  $_FILES['standard_file']['tmp_name'],
1045  $file_name,
1046  $file
1047  );
1048 
1049  // get mime type
1051  $location = $file_name;
1052 
1053  $resize = true;
1054  } elseif ($_POST["standard_resize"]) {
1055  $file = $mob_dir . "/" . $location;
1056  $resize = true;
1057  }
1058 
1059  // resize
1060  if ($resize) {
1061  if ($_POST["standard_size"] != "original" &&
1062  is_int(strpos($format, "image"))) {
1064  $file,
1065  (int) $_POST["standard_width_height"]["width"],
1066  (int) $_POST["standard_width_height"]["height"],
1067  (boolean) $_POST["standard_width_height"]["contr_prop"]
1068  );
1069  }
1070  $std_item->setFormat($format);
1071  $std_item->setLocation($location);
1072  }
1073 
1074  $std_item->setLocationType("LocalFile");
1075  }
1076  $this->object->setDescription($format);
1077  // determine width and height of known image types
1079  $format,
1080  $_POST["standard_type"],
1081  $mob_dir . "/" . $location,
1082  $std_item->getLocation(),
1083  $_POST["standard_width_height"]["constr_prop"],
1084  ($_POST["standard_size"] == "original"),
1085  $_POST["standard_width_height"]["width"],
1086  $_POST["standard_width_height"]["height"]
1087  );
1088  if ($wh["info"] != "") {
1089  ilUtil::sendInfo($wh["info"], true);
1090  }
1091  $std_item->setWidth($wh["width"]);
1092  $std_item->setHeight($wh["height"]);
1093 
1094  // set caption
1095  $std_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
1096 
1097  // text representation
1098  $std_item->setTextRepresentation(ilUtil::stripSlashes($_POST["text_representation"]));
1099 
1100  // set parameters
1101  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1102  if ($this->media_type->usesAutoStartParameterOnly(
1103  $std_item->getLocation(),
1104  $std_item->getFormat()
1105  )) {
1106  /*
1107  if ($_POST["standard_autostart"]) { // save only autostart flag
1108  $std_item->setParameters('autostart="true"');
1109  } else {
1110  $std_item->setParameters("");
1111  }*/
1112  } else {
1113  $std_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_parameters"])));
1114  }
1115  }
1116 
1117  // "None" selected
1118  if ($_POST["full_type"] == "None") {
1119  if ($this->object->hasFullscreenItem()) { // delete existing
1120  $this->object->removeMediaItem("Fullscreen");
1121  }
1122  } else { // Not "None" -> we need one
1123  if ($this->object->hasFullscreenItem()) { // take existing one
1124  $full_item = $this->object->getMediaItem("Fullscreen");
1125  } else { // create one
1126  $full_item = new ilMediaItem();
1127  $this->object->addMediaItem($full_item);
1128  $full_item->setPurpose("Fullscreen");
1129  }
1130  $location = $full_item->getLocation();
1131  $format = $full_item->getFormat();
1132  if ($_POST["full_type"] == "Reference") {
1133  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["full_reference"]), true);
1134  $full_item->setFormat($format);
1135  $full_item->setLocationType("Reference");
1136  $location = ilUtil::stripSlashes($_POST["full_reference"]);
1137  $type = "Reference";
1138  }
1139  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1140  if ($_POST["full_type"] == "File") {
1141  $resize = false;
1142  if ($_FILES['full_file']['name'] != "") {
1143  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1144  $file = $mob_dir . "/" . $full_file_name;
1146  $_FILES['full_file']['tmp_name'],
1147  $full_file_name,
1148  $file
1149  );
1150 
1152  $location = $full_file_name;
1153 
1154  $resize = true;
1155  } elseif ($_POST["full_resize"]) {
1156  $file = $mob_dir . "/" . $location;
1157  $resize = true;
1158  }
1159 
1160  // resize
1161  if ($resize) {
1162  if ($_POST["full_size"] != "original" &&
1163  is_int(strpos($format, "image"))) {
1165  $file,
1166  (int) $_POST["full_width_height"]["width"],
1167  (int) $_POST["full_width_height"]["height"],
1168  (boolean) $_POST["full_width_height"]["contr_prop"]
1169  );
1170  }
1171  $full_item->setFormat($format);
1172  $full_item->setLocation($location);
1173  }
1174 
1175  $full_item->setLocationType("LocalFile");
1176  $type = "File";
1177  }
1178  if ($_POST["full_type"] == "Standard") {
1179  $format = $std_item->getFormat();
1180  $location = $std_item->getLocation();
1181  $full_item->setLocationType($std_item->getLocationType());
1182  $full_item->setFormat($format);
1183  $full_item->setLocation($location);
1184  $type = $std_item->getLocationType();
1185  if ($type == "LocalFile") {
1186  $type = "File";
1187  }
1188  // resize image
1189  //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1190  if ($_POST["full_size"] != "original" &&
1191  is_int(strpos($format, "image")) &&
1192  $full_item->getLocationType() == "LocalFile") {
1193  $file = $mob_dir . "/" . $location;
1195  $file,
1196  (int) $_POST["full_width_height"]["width"],
1197  (int) $_POST["full_width_height"]["height"],
1198  (boolean) $_POST["full_width_height"]["contr_prop"]
1199  );
1200  }
1201  }
1202 
1203  // determine width and height of known image types
1205  $format,
1206  $type,
1207  $mob_dir . "/" . $location,
1208  $full_item->getLocation(),
1209  $_POST["full_width_height"]["constr_prop"],
1210  ($_POST["full_size"] == "original"),
1211  $_POST["full_width_height"]["width"],
1212  $_POST["full_width_height"]["height"]
1213  );
1214  if ($wh["info"] != "") {
1215  ilUtil::sendInfo($wh["info"], true);
1216  }
1217 
1218  $full_item->setWidth($wh["width"]);
1219  $full_item->setHeight($wh["height"]);
1220  $full_item->setLocation($location);
1221 
1222  $full_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1223 
1224  // text representation
1225  $full_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1226 
1227 
1228  // set parameters
1229  if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1230  if ($this->media_type->usesAutoStartParameterOnly(
1231  $std_item->getLocation(),
1232  $std_item->getFormat()
1233  )) {
1234  /*
1235  if ($_POST["full_autostart"]) { // save only autostart flag
1236  $full_item->setParameters('autostart="true"');
1237  } else {
1238  $full_item->setParameters("");
1239  }*/
1240  } else {
1241  $full_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])));
1242  }
1243  }
1244  }
1245 
1247  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1248  ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
1249 
1250  $this->object->update();
1251  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1252  $this->ctrl->redirect($this, "edit");
1253  } else {
1254  $this->form_gui->setValuesByPost();
1255  $tpl->setContent($this->form_gui->getHTML());
1256  }
1257  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$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.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem Media Item, component of a media object (file or reference)
$format
Definition: metadata.php:218
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"]
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 107 of file class.ilObjMediaObjectGUI.php.

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

◆ setBackTitle()

ilObjMediaObjectGUI::setBackTitle (   $a_title)

set title for back tab

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

Referenced by ilPCMediaObjectGUI\executeCommand().

302  {
303  $this->back_title = $a_title;
304  }
+ 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 142 of file class.ilObjMediaObjectGUI.php.

143  {
144  $this->enabledmapareas = $a_enabledmapareas;
145  }

◆ setHeader()

ilObjMediaObjectGUI::setHeader (   $a_title = "")

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

128  {
129  $this->header = $a_title;
130  }

◆ setHeightPreset()

ilObjMediaObjectGUI::setHeightPreset (   $a_val)

Set height preset.

Parameters
intheight preset

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

183  {
184  $this->height_preset = $a_val;
185  }

◆ setObjectPerCreationForm()

static ilObjMediaObjectGUI::setObjectPerCreationForm (   $a_mob)
static

Set media object values from creation form.

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

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

Referenced by ilPCMediaObjectGUI\create(), ILIAS\COPage\Editor\Components\MediaObject\MediaObjectCommandActionHandler\insertCommand(), and saveObject().

735  {
736  // determinte title and format
737  if (trim($_POST["standard_title"]) != "") {
738  $title = trim($_POST["standard_title"]);
739  } else {
740  if ($_POST["standard_type"] == "File") {
741  $title = $_FILES['standard_file']['name'];
742  } else {
743  $title = ilUtil::stripSlashes($_POST["standard_reference"]);
744  }
745  }
746 
747  $a_mob->setTitle($title);
748  $a_mob->setDescription("");
749  $a_mob->create();
750 
751  // determine and create mob directory, move uploaded file to directory
752  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
753  $a_mob->createDirectory();
754  $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
755 
756  $media_item = new ilMediaItem();
757  $a_mob->addMediaItem($media_item);
758  $media_item->setPurpose("Standard");
759 
760  if ($_POST["standard_type"] == "File") {
761  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
762  $file = $mob_dir . "/" . $file_name;
764  $_FILES['standard_file']['tmp_name'],
765  $file_name,
766  $file
767  );
768 
769  // get mime type
771  $location = $file_name;
772 
773  // resize standard images
774  if ($_POST["standard_size"] != "original" &&
775  is_int(strpos($format, "image"))) {
777  $file,
778  (int) $_POST["standard_width_height"]["width"],
779  (int) $_POST["standard_width_height"]["height"],
780  (boolean) $_POST["standard_width_height"]["contr_prop"]
781  );
782  }
783 
784  // set real meta and object data
785  $media_item->setFormat($format);
786  $media_item->setLocation($location);
787  $media_item->setLocationType("LocalFile");
788  } else { // standard type: reference
789  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
790  $media_item->setFormat($format);
791  $media_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
792  $media_item->setLocationType("Reference");
793  }
794  $a_mob->setDescription($format);
795 
796  // determine width and height of known image types
798  $format,
799  $_POST["standard_type"],
800  $mob_dir . "/" . $location,
801  $media_item->getLocation(),
802  $_POST["standard_width_height"]["constr_prop"],
803  ($_POST["standard_size"] == "original"),
804  $_POST["standard_width_height"]["width"],
805  $_POST["standard_width_height"]["height"]
806  );
807  $media_item->setWidth($wh["width"]);
808  $media_item->setHeight($wh["height"]);
809  if ($wh["info"] != "") {
810  ilUtil::sendInfo($wh["info"], true);
811  }
812 
813  if ($_POST["standard_caption"] != "") {
814  $media_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
815  }
816 
817 
818  $media_item->setHAlign("Left");
819 
820  // fullscreen view
821  if ($_POST["full_type"] != "None") {
822  $media_item2 = new ilMediaItem();
823  $a_mob->addMediaItem($media_item2);
824  $media_item2->setPurpose("Fullscreen");
825 
826  // move file / set format and location
827  if ($_POST["full_type"] == "File") {
828  $format = $location = "";
829  if ($_FILES['full_file']['name'] != "") {
830  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
831  $file = $mob_dir . "/" . $full_file_name;
833  $_FILES['full_file']['tmp_name'],
834  $full_file_name,
835  $file
836  );
838  $location = $full_file_name;
839  }
840  } elseif ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File") {
841  $location = $file_name;
842  }
843 
844  // resize file
845  if ($_POST["full_type"] == "File" ||
846  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File")) {
847  if (($_POST["full_size"] != "original" &&
848  is_int(strpos($format, "image")))
849  ) {
851  $file,
852  (int) $_POST["full_width_height"]["width"],
853  (int) $_POST["full_width_height"]["height"],
854  (boolean) $_POST["full_width_height"]["constr_prop"]
855  );
856  }
857 
858  $media_item2->setFormat($format);
859  $media_item2->setLocation($location);
860  $media_item2->setLocationType("LocalFile");
861  $type = "File";
862  }
863 
864  if ($_POST["full_type"] == "Reference") {
865  $format = $location = "";
866  if ($_POST["full_reference"] != "") {
867  $format = ilObjMediaObject::getMimeType($_POST["full_reference"], true);
868  $location = ilUtil::stripSlashes($_POST["full_reference"]);
869  }
870  }
871 
872  if ($_POST["full_type"] == "Reference" ||
873  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "Reference")) {
874  $media_item2->setFormat($format);
875  $media_item2->setLocation($location);
876  $media_item2->setLocationType("Reference");
877  $type = "Reference";
878  }
879 
880  // determine width and height of known image types
882  $format,
883  $type,
884  $mob_dir . "/" . $location,
885  $media_item2->getLocation(),
886  $_POST["full_width_height"]["constr_prop"],
887  ($_POST["full_size"] == "original"),
888  $_POST["full_width_height"]["width"],
889  $_POST["full_width_height"]["height"]
890  );
891 
892  $media_item2->setWidth($wh["width"]);
893  $media_item2->setHeight($wh["height"]);
894 
895  if ($_POST["full_caption"] != "") {
896  $media_item2->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
897  }
898  }
899 
901  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
902  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
903  $a_mob->update();
904  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$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.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem Media Item, component of a media object (file or reference)
$format
Definition: metadata.php:218
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 1946 of file class.ilObjMediaObjectGUI.php.

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

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

1947  {
1948  $ilTabs = $this->tabs;
1949  $ilCtrl = $this->ctrl;
1950  $lng = $this->lng;
1951 
1952  $ilTabs->activateTab("cont_mob_def_prop");
1953 
1954  $ilTabs->addSubTab(
1955  "general",
1956  $lng->txt("mob_general"),
1957  $ilCtrl->getLinkTarget($this, "edit")
1958  );
1959 
1960  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1961  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4") {
1962  $ilTabs->addSubTab(
1963  "subtitles",
1964  $lng->txt("mob_subtitles"),
1965  $ilCtrl->getLinkTarget($this, "listSubtitleFiles")
1966  );
1967  }
1968 
1969  $ilTabs->activateSubTab($a_active);
1970  }
+ Here is the caller graph for this function:

◆ setTabs()

ilObjMediaObjectGUI::setTabs ( )

set admin tabs

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

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

1791  {
1792  //echo "setAdminTabs should not be called.";
1793 
1794  // catch feedback message
1795  $this->getTabs();
1796 
1797  //$this->tpl->clearHeader();
1798  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject") {
1799  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1800  $this->tpl->setTitle($this->object->getTitle());
1801  } else {
1802  //$title = $this->object->getTitle();
1803  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1804  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1805  }
1806  }
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 162 of file class.ilObjMediaObjectGUI.php.

163  {
164  $this->width_preset = $a_val;
165  }

◆ showAllUsagesObject()

ilObjMediaObjectGUI::showAllUsagesObject ( )

Show all media object usages (incl history)

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

References showUsagesObject().

1657  {
1658  $this->showUsagesObject(true);
1659  }
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 2122 of file class.ilObjMediaObjectGUI.php.

References ilObjectGUI\$tpl, and setPropertiesSubTabs().

2123  {
2124  $tpl = $this->tpl;
2125 
2126  $this->setPropertiesSubTabs("subtitles");
2127 
2128  include_once("./Services/MediaObjects/classes/class.ilMultiSrtConfirmationTable2GUI.php");
2129  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
2130  $tpl->setContent($tab->getHTML());
2131  }
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 1665 of file class.ilObjMediaObjectGUI.php.

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

Referenced by showAllUsagesObject().

1666  {
1667  $tpl = $this->tpl;
1668  $ilTabs = $this->tabs;
1669  $ilTabs = $this->tabs;
1670  $lng = $this->lng;
1671  $ilCtrl = $this->ctrl;
1672 
1673  $ilTabs->addSubTab(
1674  "current_usages",
1675  $lng->txt("cont_current_usages"),
1676  $ilCtrl->getLinkTarget($this, "showUsages")
1677  );
1678 
1679  $ilTabs->addSubTab(
1680  "all_usages",
1681  $lng->txt("cont_all_usages"),
1682  $ilCtrl->getLinkTarget($this, "showAllUsages")
1683  );
1684 
1685  if ($a_all) {
1686  $ilTabs->activateSubTab("all_usages");
1687  $cmd = "showAllUsages";
1688  } else {
1689  $ilTabs->activateSubTab("current_usages");
1690  $cmd = "showUsages";
1691  }
1692 
1693  include_once("./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1694  $usages_table = new ilMediaObjectUsagesTableGUI(
1695  $this,
1696  $cmd,
1697  $this->object,
1698  $a_all
1699  );
1700  $tpl->setContent($usages_table->getHTML());
1701  }
TableGUI class for media object usages listing.
+ Here is the caller graph for this function:

◆ showVideoToolObject()

ilObjMediaObjectGUI::showVideoToolObject ( )

Show video tools.

Parameters

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

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

1903  {
1904  $tpl = $this->tpl;
1905 
1906  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1907 
1908  /*$codecs = ilFFmpeg::getSupportedCodecsInfo();
1909  $codec_str = implode($codecs, "<br />");
1910  $tpl->setContent($codec_str);*/
1911 
1913  $formats_str = implode("<br />", $formats);
1914  $tpl->setContent($formats_str);
1915  }
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 1454 of file class.ilObjMediaObjectGUI.php.

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

1455  {
1456  // determine directory
1457  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1458  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1459  $cur_dir = (!empty($cur_subdir))
1460  ? $mob_dir . "/" . $cur_subdir
1461  : $mob_dir;
1462  if (is_file($_FILES["new_file"]["tmp_name"])) {
1463  $file_name = ilObjMediaObject::fixFilename($_FILES["new_file"]["name"]);
1464  $file = $cur_dir . "/" . $file_name;
1466  $_FILES['new_file']['tmp_name'],
1467  $file_name,
1468  $file
1469  );
1470  }
1472  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1473  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1474 
1475  $this->ctrl->saveParameter($this, "cdir");
1476  $this->ctrl->redirect($this, "editFiles");
1477  }
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 moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move 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 2085 of file class.ilObjMediaObjectGUI.php.

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

2086  {
2087  $ilToolbar = $this->toolbar;
2088  $lng = $this->lng;
2089  $ilCtrl = $this->ctrl;
2090 
2091  ilUtil::sendInfo($lng->txt("mob_upload_multi_srt_howto"));
2092 
2093  $this->setPropertiesSubTabs("subtitles");
2094 
2095  // upload file
2096  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
2097  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2098  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.zip)", "subtitle_file");
2099  $fi->setSuffixes(array("zip"));
2100  $ilToolbar->addInputItem($fi, true);
2101 
2102  $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
2103  }
This class represents a file property in a property form.
setPropertiesSubTabs($a_active)
Set subtabs for properties.
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 2108 of file class.ilObjMediaObjectGUI.php.

References Vendor\Package\$e, ilUtil\sendFailure(), and ilUtil\stripSlashesArray().

2109  {
2110  try {
2111  $this->object->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
2112  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
2113  } catch (ilMediaObjectsException $e) {
2114  ilUtil::sendFailure($e->getMessage(), true);
2115  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
2116  }
2117  }
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 2021 of file class.ilObjMediaObjectGUI.php.

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

2022  {
2023  $lng = $this->lng;
2024  $ilCtrl = $this->ctrl;
2025 
2026  if ($this->object->uploadSrtFile($_FILES["subtitle_file"]["tmp_name"], ilUtil::stripSlashes($_POST["language"]))) {
2027  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2028  }
2029  $ilCtrl->redirect($this, "listSubtitleFiles");
2030  }
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 75 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 73 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().

◆ $media_type

ilObjMediaObjectGUI::$media_type
protected

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

◆ $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 74 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: