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

Static Public Member Functions

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

Data Fields

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

Protected Member Functions

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

Protected Attributes

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

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

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

57  {
58  global $DIC;
59 
60  $this->tpl = $DIC["tpl"];
61  $this->access = $DIC->access();
62  $this->error = $DIC["ilErr"];
63  $this->help = $DIC["ilHelp"];
64  $this->tabs = $DIC->tabs();
65  $this->toolbar = $DIC->toolbar();
66  $this->user = $DIC->user();
67  $lng = $DIC->language();
68  $ilCtrl = $DIC->ctrl();
69 
70  $this->ctrl = $ilCtrl;
71  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
72  $this->lng = $lng;
73  $this->back_title = "";
74  $this->type = "mob";
75 
76  $lng->loadLanguageModule("mob");
77  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ _getMediaInfoHTML()

static ilObjMediaObjectGUI::_getMediaInfoHTML ( $a_mob)
static

get media info as html

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

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

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

1636  {
1637  global $DIC;
1638 
1639  $lng = $DIC->language();
1640 
1641  $tpl = new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
1642  $types = array("Standard", "Fullscreen");
1643  foreach ($types as $type) {
1644  if ($type == "Fullscreen" && !$a_mob->hasFullScreenItem()) {
1645  continue;
1646  }
1647 
1648  $med = $a_mob->getMediaItem($type);
1649  if (!$med) {
1650  return "";
1651  }
1652 
1653  $tpl->setCurrentBlock("media_info");
1654  if ($type == "Standard") {
1655  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1656  } else {
1657  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1658  }
1659  $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
1660  $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1661  if ($med->getLocationType() == "LocalFile") {
1662  $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
1663  if (is_file($file)) {
1664  $size = filesize($file);
1665  } else {
1666  $size = 0;
1667  }
1668  $tpl->setVariable("VAL_FILE_SIZE", " ($size " . $lng->txt("bytes") . ")");
1669  }
1670  $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1671  $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1672  if ($med->getWidth() != "" && $med->getHeight() != "") {
1673  $tpl->setCurrentBlock("size");
1674  $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1675  $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
1676  $tpl->parseCurrentBlock();
1677  }
1678 
1679  // original size
1680  if ($orig_size = $med->getOriginalSize()) {
1681  if ($orig_size["width"] != $med->getWidth() ||
1682  $orig_size["height"] != $med->getHeight()) {
1683  $tpl->setCurrentBlock("orig_size");
1684  $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1685  $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1686  $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1687  $tpl->parseCurrentBlock();
1688  }
1689  }
1690 
1691  // output caption
1692  if ($med && strlen($med->getCaption())) {
1693  $tpl->setCurrentBlock('additional_info');
1694  $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
1695  $tpl->parseCurrentBlock();
1696  }
1697 
1698  // output keywords
1699  if ($type == "Standard") {
1700  include_once './Services/MetaData/classes/class.ilMDKeyword.php';
1701  if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) {
1702  $tpl->setCurrentBlock('additional_info');
1703  $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws));
1704  $tpl->parseCurrentBlock();
1705  }
1706  }
1707 
1708  $tpl->setCurrentBlock("media_info");
1709  $tpl->parseCurrentBlock();
1710  }
1711 
1712  return $tpl->get();
1713  }
$size
Definition: RandomTest.php:84
$type
global $DIC
Definition: saml.php:7
static _getDirectory($a_mob_id)
get directory for files of media object (static)
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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 1495 of file class.ilObjMediaObjectGUI.php.

References object.

1496  {
1497  if (!$this->object->hasFullScreenItem()) {
1498  $std_item = $this->object->getMediaItem("Standard");
1499  $full_item = new ilMediaItem();
1500  $full_item->setMobId($std_item->getMobId());
1501  $full_item->setLocation($std_item->getLocation());
1502  $full_item->setLocationType($std_item->getLocationType());
1503  $full_item->setFormat($std_item->getFormat());
1504  $full_item->setWidth($std_item->getWidth());
1505  $full_item->setHeight($std_item->getHeight());
1506  $full_item->setCaption($std_item->getCaption());
1507  $full_item->setTextRepresentation($std_item->getTextRepresentation());
1508  $full_item->setPurpose("Fullscreen");
1509  $this->object->addMediaItem($full_item);
1510 
1511  $this->object->update();
1512  }
1513 
1514  $this->ctrl->redirect($this, "edit");
1515  }
Class ilMediaItem.
Create new PHPExcel object
obj_idprivate

◆ assignFullscreenObject()

ilObjMediaObjectGUI::assignFullscreenObject (   $a_file)

assign file to fullscreen view

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

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

1441  {
1442  // determine directory
1443  $cur_subdir = dirname($a_file);
1444  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1445  $cur_dir = (!empty($cur_subdir))
1446  ? $mob_dir . "/" . $cur_subdir
1447  : $mob_dir;
1448  $file = $cur_dir . "/" . basename($a_file);
1449  $location = $a_file;
1450 
1451  if (!is_file($file)) {
1452  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1453  }
1454 
1455  if (!$this->object->hasFullScreenItem()) { // create new fullscreen item
1456  $std_item = $this->object->getMediaItem("Standard");
1457  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1458  $file = $mob_dir . "/" . $location;
1459  $full_item = new ilMediaItem();
1460  $full_item->setMobId($std_item->getMobId());
1461  $full_item->setLocation($location);
1462  $full_item->setLocationType("LocalFile");
1463  $full_item->setFormat(ilObjMediaObject::getMimeType($file));
1464  $full_item->setPurpose("Fullscreen");
1465  $this->object->addMediaItem($full_item);
1466  } else { // alter existing fullscreen item
1467  $full_item = $this->object->getMediaItem("Fullscreen");
1468 
1469  $full_item->setLocationType("LocalFile");
1470  $full_item->setLocation($location);
1472  $full_item->setFormat($format);
1473  }
1474  $this->object->update();
1475  // $this->ctrl->saveParameter($this, "cdir");
1476  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1477  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$location
Definition: buildRTE.php:44
Class ilMediaItem.
redirection script todo: (a better solution should control the processing via a xml file) ...
Create new PHPExcel object
obj_idprivate
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ assignObject()

ilObjMediaObjectGUI::assignObject ( )

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

160  {
161  if ($this->id != 0) {
162  $this->object = new ilObjMediaObject($this->id);
163  }
164  }
Class ilObjMediaObject.

◆ assignStandardObject()

ilObjMediaObjectGUI::assignStandardObject (   $a_file)

assign file to standard view

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

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

1412  {
1413  // determine directory
1414  $cur_subdir = dirname($a_file);
1415  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1416  $cur_dir = (!empty($cur_subdir))
1417  ? $mob_dir . "/" . $cur_subdir
1418  : $mob_dir;
1419  $file = $cur_dir . "/" . basename($a_file);
1420  $location = $a_file;
1421 
1422  if (!is_file($file)) {
1423  $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1424  }
1425 
1426  $std_item = $this->object->getMediaItem("Standard");
1427  $std_item->setLocationType("LocalFile");
1428  $std_item->setLocation($location);
1430  $std_item->setFormat($format);
1431  $this->object->update();
1432  // $this->ctrl->saveParameter($this, "cdir");
1433  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1434  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$location
Definition: buildRTE.php:44
redirection script todo: (a better solution should control the processing via a xml file) ...
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $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 2071 of file class.ilObjMediaObjectGUI.php.

2072  {
2073  $this->object->clearMultiSrtDirectory();
2074  $this->ctrl->redirect($this, "listSubtitleFiles");
2075  }

◆ cancelObject()

ilObjMediaObjectGUI::cancelObject ( )

Cancel saving.

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

842  {
843  $this->ctrl->returnToParent($this);
844  }

◆ checkFixSize()

ilObjMediaObjectGUI::checkFixSize ( )
protected

Check fix size.

Parameters

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

References ilUtil\sendFailure().

Referenced by executeCommand().

528  {
529  $std_item = $this->object->getMediaItem("Standard");
530  if ($std_item->getWidth() == "" || $std_item->getHeight() == "") {
531  ilUtil::sendFailure($this->lng->txt("mob_no_fixed_size_map_editing"));
532  }
533  }
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 652 of file class.ilObjMediaObjectGUI.php.

653  {
654  if (!$this->form_gui->checkInput()) {
655  $this->form_gui->setValuesByPost();
656  return false;
657  }
658  return true;
659  }

◆ confirmSrtDeletionObject()

ilObjMediaObjectGUI::confirmSrtDeletionObject ( )

Confirm srt file deletion.

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

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

1971  {
1972  $ilCtrl = $this->ctrl;
1973  $tpl = $this->tpl;
1974  $lng = $this->lng;
1975 
1976  $lng->loadLanguageModule("meta");
1977 
1978  if (!is_array($_POST["srt"]) || count($_POST["srt"]) == 0) {
1979  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1980  $ilCtrl->redirect($this, "listSubtitleFiles");
1981  } else {
1982  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1983  $cgui = new ilConfirmationGUI();
1984  $cgui->setFormAction($ilCtrl->getFormAction($this));
1985  $cgui->setHeaderText($lng->txt("mob_really_delete_srt"));
1986  $cgui->setCancel($lng->txt("cancel"), "listSubtitleFiles");
1987  $cgui->setConfirm($lng->txt("delete"), "deleteSrtFiles");
1988 
1989  foreach ($_POST["srt"] as $i) {
1990  $cgui->addItem("srt[]", $i, "subtitle_" . $i . ".srt (" . $lng->txt("meta_l_" . $i) . ")");
1991  }
1992 
1993  $tpl->setContent($cgui->getHTML());
1994  }
1995  }
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$i
Definition: disco.tpl.php:19
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDirectoryObject()

ilObjMediaObjectGUI::createDirectoryObject ( )

create directory

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

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

1361  {
1362  //echo "cdir:".$_GET["cdir"].":<br>";
1363  // determine directory
1364  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1365  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1366  $cur_dir = (!empty($cur_subdir))
1367  ? $mob_dir . "/" . $cur_subdir
1368  : $mob_dir;
1369 
1370  $new_dir = str_replace(".", "", $_POST["new_dir"]);
1371  $new_dir = str_replace("/", "", $new_dir);
1372 
1373  if (!empty($new_dir)) {
1374  ilUtil::makeDir($cur_dir . "/" . $new_dir);
1375  }
1376  $this->ctrl->saveParameter($this, "cdir");
1377  $this->ctrl->redirect($this, "editFiles");
1378  }
$_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 253 of file class.ilObjMediaObjectGUI.php.

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

254  {
255  $tpl = $this->tpl;
256  $ilHelp = $this->help;
257 
258  $ilHelp->setScreenId("create");
259  $this->initForm();
260  $tpl->setContent($this->form_gui->getHTML());
261  }
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ deleteFileObject()

ilObjMediaObjectGUI::deleteFileObject ( )

delete object file

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

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

1522  {
1523  if (!isset($_POST["file"])) {
1524  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1525  }
1526 
1527  if (count($_POST["file"]) > 1) {
1528  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE);
1529  }
1530 
1531  if ($_POST["file"][0] == "..") {
1532  $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1533  }
1534 
1535  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1536  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1537  $cur_dir = (!empty($cur_subdir))
1538  ? $mob_dir . "/" . $cur_subdir
1539  : $mob_dir;
1540  $file = $cur_dir . "/" . $_POST["file"][0];
1541  $location = (!empty($cur_subdir))
1542  ? $cur_subdir . "/" . $_POST["file"][0]
1543  : $_POST["file"][0];
1544 
1545  $full_item = $this->object->getMediaItem("Fullscreen");
1546  $std_item = $this->object->getMediaItem("Standard");
1547 
1548  if ($location == $std_item->getLocation()) {
1549  $this->ilias->raiseError($this->lng->txt("cont_cant_del_std"), $this->ilias->error_obj->MESSAGE);
1550  }
1551 
1552  if ($this->object->hasFullScreenItem()) {
1553  if ($location == $full_item->getLocation()) {
1554  $this->ilias->raiseError($this->lng->txt("cont_cant_del_full"), $this->ilias->error_obj->MESSAGE);
1555  }
1556  }
1557 
1558  if (@is_dir($file)) {
1559  if (substr($std_item->getLocation(), 0, strlen($location)) == $location) {
1560  $this->ilias->raiseError($this->lng->txt("cont_std_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1561  }
1562 
1563  if ($this->object->hasFullScreenItem()) {
1564  if (substr($full_item->getLocation(), 0, strlen($location)) == $location) {
1565  $this->ilias->raiseError($this->lng->txt("cont_full_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1566  }
1567  }
1568  }
1569 
1570  if (@is_file($file)) {
1571  unlink($file);
1572  }
1573 
1574  if (@is_dir($file)) {
1576  }
1577 
1578  $this->ctrl->saveParameter($this, "cdir");
1579  $this->ctrl->redirect($this, "editFiles");
1580  }
$_GET["client_id"]
$location
Definition: buildRTE.php:44
redirection script todo: (a better solution should control the processing via a xml file) ...
Create new PHPExcel object
obj_idprivate
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $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 2000 of file class.ilObjMediaObjectGUI.php.

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

2001  {
2002  $lng = $this->lng;
2003  $ilCtrl = $this->ctrl;
2004 
2005  foreach ($_POST["srt"] as $i) {
2006  if (strlen($i) == 2 && !is_int(strpos($i, "."))) {
2007  $this->object->removeAdditionalFile("srt/subtitle_" . $i . ".srt");
2008  }
2009  }
2010  ilUtil::sendSuccess($lng->txt("mob_srt_files_deleted"), true);
2011  $ilCtrl->redirect($this, "listSubtitleFiles");
2012  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$i
Definition: disco.tpl.php:19
$_POST["username"]
+ Here is the call graph for this function:

◆ editFilesObject()

ilObjMediaObjectGUI::editFilesObject ( )

administrate files of media object

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

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

1193  {
1194  // standard item
1195  $std_item = $this->object->getMediaItem("Standard");
1196  if ($this->object->hasFullscreenItem()) {
1197  $full_item = $this->object->getMediaItem("Fullscreen");
1198  }
1199 
1200  // create table
1201  require_once("./Services/Table/classes/class.ilTableGUI.php");
1202  $tbl = new ilTableGUI();
1203 
1204  // determine directory
1205  $cur_subdir = $_GET["cdir"];
1206  if ($_GET["newdir"] == "..") {
1207  $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
1208  } else {
1209  if (!empty($_GET["newdir"])) {
1210  if (!empty($cur_subdir)) {
1211  $cur_subdir = $cur_subdir . "/" . $_GET["newdir"];
1212  } else {
1213  $cur_subdir = $_GET["newdir"];
1214  }
1215  }
1216  }
1217 
1218  $cur_subdir = str_replace(".", "", $cur_subdir);
1219  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1220  $cur_dir = (!empty($cur_subdir))
1221  ? $mob_dir . "/" . $cur_subdir
1222  : $mob_dir;
1223 
1224  // load files templates
1225  $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.mob_files.html", "Services/MediaObjects");
1226 
1227  $this->ctrl->setParameter($this, "cdir", urlencode($cur_subdir));
1228  $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
1229  //echo "--".$this->getTargetScript().
1230  //"&hier_id=".$_GET["hier_id"]."&cdir=".$cur_subdir."&cmd=post"."--<br>";
1231  $this->tpl->setVariable("TXT_NEW_DIRECTORY", $this->lng->txt("cont_new_dir"));
1232  $this->tpl->setVariable("TXT_NEW_FILE", $this->lng->txt("cont_new_file"));
1233  $this->tpl->setVariable("CMD_NEW_DIR", "createDirectory");
1234  $this->tpl->setVariable("CMD_NEW_FILE", "uploadFile");
1235  $this->tpl->setVariable("BTN_NEW_DIR", $this->lng->txt("create"));
1236  $this->tpl->setVariable("BTN_NEW_FILE", $this->lng->txt("upload"));
1237 
1238  //
1239  $this->tpl->addBlockfile("FILE_TABLE", "files", "tpl.table.html");
1240 
1241  // load template for table content data
1242  $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mob_file_row.html", "Services/MediaObjects");
1243 
1244  $num = 0;
1245 
1246  $obj_str = ($this->call_by_reference) ? "" : "&obj_id=" . $this->obj_id;
1247  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1248 
1249  $tbl->setTitle($this->lng->txt("cont_files") . " " . $cur_subdir);
1250  //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
1251 
1252  $tbl->setHeaderNames(array("", "", $this->lng->txt("cont_dir_file"),
1253  $this->lng->txt("cont_size"), $this->lng->txt("cont_purpose")));
1254 
1255  $cols = array("", "", "dir_file", "size", "purpose");
1256  $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
1257  "cmd" => "editFiles", "hier_id" => $_GET["hier_id"], "item_id" => $_GET["item_id"]);
1258  $tbl->setHeaderVars($cols, $header_params);
1259  $tbl->setColumnWidth(array("1%", "1%", "33%", "33%", "32%"));
1260 
1261  // control
1262  $tbl->setOrderColumn($_GET["sort_by"]);
1263  $tbl->setOrderDirection($_GET["sort_order"]);
1264  $tbl->setLimit($_GET["limit"]);
1265  $tbl->setOffset($_GET["offset"]);
1266  $tbl->setMaxCount($this->maxcount); // ???
1267  //$tbl->setMaxCount(30); // ???
1268 
1269  $this->tpl->setVariable("COLUMN_COUNTS", 5);
1270 
1271  // delete button
1272  $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1273  $this->tpl->setCurrentBlock("tbl_action_btn");
1274  $this->tpl->setVariable("BTN_NAME", "deleteFile");
1275  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
1276  $this->tpl->parseCurrentBlock();
1277 
1278  $this->tpl->setCurrentBlock("tbl_action_btn");
1279  $this->tpl->setVariable("BTN_NAME", "assignStandard");
1280  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_std"));
1281  $this->tpl->parseCurrentBlock();
1282 
1283  $this->tpl->setCurrentBlock("tbl_action_btn");
1284  $this->tpl->setVariable("BTN_NAME", "assignFullscreen");
1285  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_full"));
1286  $this->tpl->parseCurrentBlock();
1287 
1288  // footer
1289  $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1290  //$tbl->disable("footer");
1291 
1292  $entries = ilUtil::getDir($cur_dir);
1293 
1294  //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
1295  $tbl->setMaxCount(count($entries));
1296  $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
1297 
1298  $tbl->render();
1299  if (count($entries) > 0) {
1300  $i=0;
1301  foreach ($entries as $entry) {
1302  if (($entry["entry"] == ".") || ($entry["entry"] == ".." && empty($cur_subdir))) {
1303  continue;
1304  }
1305 
1306  //$this->tpl->setVariable("ICON", $obj["title"]);
1307  if ($entry["type"] == "dir") {
1308  $this->tpl->setCurrentBlock("FileLink");
1309  $this->ctrl->setParameter($this, "cdir", $cur_subdir);
1310  $this->ctrl->setParameter($this, "newdir", rawurlencode($entry["entry"]));
1311  $this->tpl->setVariable("LINK_FILENAME", $this->ctrl->getLinkTarget($this, "editFiles"));
1312  $this->tpl->setVariable("TXT_FILENAME", $entry["entry"]);
1313  $this->tpl->parseCurrentBlock();
1314 
1315  $this->tpl->setVariable("ICON", "<img src=\"" .
1316  ilUtil::getImagePath("icon_cat.svg") . "\">");
1317  } else {
1318  $this->tpl->setCurrentBlock("File");
1319  $this->tpl->setVariable("TXT_FILENAME2", $entry["entry"]);
1320  $this->tpl->parseCurrentBlock();
1321  }
1322 
1323  $this->tpl->setCurrentBlock("tbl_content");
1324  $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
1325  $this->tpl->setVariable("CSS_ROW", $css_row);
1326 
1327  $this->tpl->setVariable("TXT_SIZE", $entry["size"]);
1328  $this->tpl->setVariable("CHECKBOX_ID", $entry["entry"]);
1329  $compare = (!empty($cur_subdir))
1330  ? $cur_subdir . "/" . $entry["entry"]
1331  : $entry["entry"];
1332  $purpose = array();
1333  if ($std_item->getLocation() == $compare) {
1334  $purpose[] = $this->lng->txt("cont_std_view");
1335  }
1336  if ($this->object->hasFullscreenItem()) {
1337  if ($full_item->getLocation() == $compare) {
1338  $purpose[] = $this->lng->txt("cont_fullscreen");
1339  }
1340  }
1341  $this->tpl->setVariable("TXT_PURPOSE", implode($purpose, ", "));
1342 
1343  $this->tpl->parseCurrentBlock();
1344  }
1345  } //if is_array
1346  else {
1347  $this->tpl->setCurrentBlock("notfound");
1348  $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
1349  $this->tpl->setVariable("NUM_COLS", 4);
1350  $this->tpl->parseCurrentBlock();
1351  }
1352 
1353  $this->tpl->parseCurrentBlock();
1354  }
$_GET["client_id"]
$tbl
Definition: example_048.php:81
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
Class ilTableGUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
$i
Definition: disco.tpl.php:19
static getWebspaceDir($mode="filesystem")
get webspace directory
$cols
Definition: xhr_table.php:11
+ Here is the call graph for this function:

◆ editObject()

ilObjMediaObjectGUI::editObject ( )

edit media object properties

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

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

850  {
851  $tpl = $this->tpl;
852 
853  $this->setPropertiesSubTabs("general");
854 
855  $this->initForm("edit");
856  $this->getValues();
857  $tpl->setContent($this->form_gui->getHTML());
858  }
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.

Definition at line 175 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(), object, ilObjMediaObject\renameExecutables(), ilMediaSvgSanitizer\sanitizeDir(), and ilFileSystemGUI\setAllowedSuffixes().

176  {
177  $tpl = $this->tpl;
178  $ilAccess = $this->access;
180 
181  $next_class = $this->ctrl->getNextClass($this);
182  $cmd = $this->ctrl->getCmd();
183 
184  switch ($next_class) {
185  case 'ilobjectmetadatagui':
186  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
187  $md_gui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
188  // object is subtype, so we have to do it ourselves
189  $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
190  $this->ctrl->forwardCommand($md_gui);
191  break;
192 
193  case "ilimagemapeditorgui":
194  require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
195  $image_map_edit = new ilImageMapEditorGUI($this->object);
196  $ret = $this->ctrl->forwardCommand($image_map_edit);
197  $tpl->setContent($ret);
198  $this->checkFixSize();
199  break;
200 
201  case "ilfilesystemgui":
202  include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
203  $fs_gui = new ilFileSystemGUI(ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId());
205  $fs_gui->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
206  $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
207  $fs_gui->setTableId("mobfs" . $this->object->getId());
208  $fs_gui->labelFile(
209  $this->object->getMediaItem("Standard")->getLocation(),
210  $this->lng->txt("cont_std_view")
211  );
212  if ($this->object->hasFullscreenItem()) {
213  $fs_gui->labelFile(
214  $this->object->getMediaItem("Fullscreen")->getLocation(),
215  $this->lng->txt("cont_fullscreen")
216  );
217  }
218  $fs_gui->addCommand($this, "assignStandardObject", $this->lng->txt("cont_assign_std"));
219  $fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full"));
221  $ret = $this->ctrl->forwardCommand($fs_gui);
223  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
225  break;
226 
227 
228  default:
229  if (isset($_POST["editImagemapForward"]) ||
230  isset($_POST["editImagemapForward_x"]) ||
231  isset($_POST["editImagemapForward_y"])) {
232  $cmd = "editImagemapForward";
233  }
234  $cmd.= "Object";
235  $ret = $this->$cmd();
236  break;
237  }
238 
239  return $ret;
240  }
Class ilObjectMetaDataGUI.
static sanitizeDir($a_path)
Sanitize directory recursively.
addMDObserver($a_class, $a_method, $a_section)
static _getDirectory($a_mob_id)
get directory for files of media object (static)
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 ...
Create new PHPExcel object
obj_idprivate
$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:

◆ getEnabledMapAreas()

ilObjMediaObjectGUI::getEnabledMapAreas ( )

Get Enable map areas.

Returns
boolean Enable map areas

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

References $enabledmapareas.

Referenced by getTabs().

105  {
106  return $this->enabledmapareas;
107  }
+ Here is the caller graph for this function:

◆ getForm()

ilObjMediaObjectGUI::getForm ( )

Get form.

Returns
object form gui class

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

155  {
156  return $this->form_gui;
157  }

◆ getFullscreenSizeObject()

ilObjMediaObjectGUI::getFullscreenSizeObject ( )

set original size of fullscreen file

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

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

931  {
932  $full_item = $this->object->getMediaItem("Fullscreen");
933  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
934 
935  if ($full_item->getLocationType() == "LocalFile") {
936  $file = $mob_dir . "/" . $full_item->getLocation();
937  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
939  $full_item->setWidth($size[0]);
940  $full_item->setHeight($size[1]);
941  $this->object->update();
942  }
943  $this->ctrl->redirect($this, "edit");
944  }
$size
Definition: RandomTest.php:84
static getImageSize($a_location)
Get image size from location.
static _getDirectory($a_mob_id)
get directory for files of media object (static)
Create new PHPExcel object
obj_idprivate
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getHeader()

ilObjMediaObjectGUI::getHeader ( )

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

References $header.

85  {
86  return $this->header;
87  }

◆ getHeightPreset()

ilObjMediaObjectGUI::getHeightPreset ( )

Get height preset.

Returns
int height preset

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

Referenced by initForm().

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

◆ getStandardSizeObject()

ilObjMediaObjectGUI::getStandardSizeObject ( )

set original size of standard file

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

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

909  {
910  $std_item = $this->object->getMediaItem("Standard");
911  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
912 
913  if ($std_item->getLocationType() == "LocalFile") {
914  $file = $mob_dir . "/" . $std_item->getLocation();
915 
916  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
918 
919  $std_item->setWidth($size[0]);
920  $std_item->setHeight($size[1]);
921  $this->object->update();
922  }
923  $this->ctrl->redirect($this, "edit");
924  }
$size
Definition: RandomTest.php:84
static getImageSize($a_location)
Get image size from location.
static _getDirectory($a_mob_id)
get directory for files of media object (static)
Create new PHPExcel object
obj_idprivate
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getTabs()

ilObjMediaObjectGUI::getTabs ( )

Get Tabs.

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

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

Referenced by setTabs().

1743  {
1744  $ilHelp = $this->help;
1745 
1746  $ilHelp->setScreenIdComponent("mob");
1747 
1748  //$this->tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
1749  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1750  && $this->object->getId() > 0) {
1751  // object properties
1752  $this->tabs_gui->addTarget(
1753  "cont_mob_def_prop",
1754  $this->ctrl->getLinkTarget($this, "edit"),
1755  "edit",
1756  get_class($this)
1757  );
1758 
1759  $st_item = $this->object->getMediaItem("Standard");
1760 
1761  // link areas
1762 
1763  if (is_object($st_item) && $this->getEnabledMapAreas()) {
1764  $format = $st_item->getFormat();
1765  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg"))) {
1766  $this->tabs_gui->addTarget(
1767  "cont_def_map_areas",
1768  $this->ctrl->getLinkTargetByClass(
1769  array("ilobjmediaobjectgui", "ilimagemapeditorgui"),
1770  "editMapAreas"
1771  ),
1772  "editMapAreas",
1773  "ilimagemapeditorgui"
1774  );
1775  }
1776  }
1777 
1778  // object usages
1779  $this->tabs_gui->addTarget(
1780  "cont_mob_usages",
1781  $this->ctrl->getLinkTarget($this, "showUsages"),
1782  "showUsages",
1783  get_class($this)
1784  );
1785 
1786  // object files
1787  $std_item = $this->object->getMediaItem("Standard");
1788  $full_item = $this->object->getMediaItem("Fullscreen");
1789  $mset = new ilSetting("mobs");
1790  if ($mset->get("file_manager_always") ||
1791  (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()) ||
1792  (is_object($full_item) && !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())))
1793  ) {
1794  // $ilTabs->addTarget("cont_files",
1795  // $this->ctrl->getLinkTarget($this, "editFiles"), "editFiles",
1796  // get_class($this));
1797 
1798  $this->tabs_gui->addTarget(
1799  "cont_files",
1800  $this->ctrl->getLinkTargetByClass(
1801  array("ilobjmediaobjectgui", "ilfilesystemgui"),
1802  "listFiles"
1803  ),
1804  "",
1805  "ilfilesystemgui"
1806  );
1807  }
1808 
1809  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1810  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1811  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1812  if ($mdtab) {
1813  $this->tabs_gui->addTarget(
1814  "meta_data",
1815  $mdtab,
1816  "",
1817  "ilmdeditorgui"
1818  );
1819  }
1820  }
1821 
1822  // back to upper context
1823  if ($this->back_title != "") {
1824  $this->tabs_gui->setBackTarget(
1825  $this->back_title,
1826  $this->ctrl->getParentReturn($this)
1827  );
1828  }
1829  }
Class ilObjectMetaDataGUI.
$format
Definition: metadata.php:141
getEnabledMapAreas()
Get Enable map areas.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
static _getSimpleMimeTypes()
Get simple mime types that deactivate parameter property files tab in ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValues()

ilObjMediaObjectGUI::getValues ( )

Get values for form.

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

References ilObjMediaObject\_useAutoStartParameterOnly(), array, and object.

Referenced by editObject().

541  {
542  $values = array();
543 
544  $values["standard_title"] = $this->object->getTitle();
545 
546  $std_item = $this->object->getMediaItem("Standard");
547  if ($std_item->getLocationType() == "LocalFile") {
548  $values["standard_type"] = "File";
549  $values["standard_file"] = $std_item->getLocation();
550  } else {
551  $values["standard_type"] = "Reference";
552  $values["standard_reference"] = $std_item->getLocation();
553  }
554  $values["standard_format"] = $std_item->getFormat();
555  $values["standard_width_height"]["width"] = $std_item->getWidth();
556  $values["standard_width_height"]["height"] = $std_item->getHeight();
557  $values["standard_width_height"]["constr_prop"] = true;
558 
559  $values["standard_size"] = "selected";
560 
561  $orig_size = $std_item->getOriginalSize();
562  if ($std_item->getWidth() == "" && $std_item->getHeight() == "") {
563  $values["standard_size"] = "original";
564  $values["standard_width_height"]["width"] = $orig_size["width"];
565  $values["standard_width_height"]["height"] = $orig_size["height"];
566  }
567 
568  $values["standard_caption"] = $std_item->getCaption();
569  $values["text_representation"] = $std_item->getTextRepresentation();
571  $std_item->getLocation(),
572  $std_item->getFormat()
573  )) {
574  $par = $std_item->getParameters();
575  if ($par["autostart"]) {
576  $values["standard_autostart"] = true;
577  }
578  } else {
579  $values["standard_parameters"] = $std_item->getParameterString();
580  }
581 
582  $values["full_type"] = "None";
583  $values["full_size"] = "original";
584  if ($this->object->hasFullScreenItem()) {
585  $full_item = $this->object->getMediaItem("Fullscreen");
586  if ($full_item->getLocationType() == "LocalFile") {
587  $values["full_type"] = "File";
588  $values["full_file"] = $full_item->getLocation();
589  } else {
590  $values["full_type"] = "Reference";
591  $values["full_reference"] = $full_item->getLocation();
592  }
593  $values["full_format"] = $full_item->getFormat();
594  $values["full_width_height"]["width"] = $full_item->getWidth();
595  $values["full_width_height"]["height"] = $full_item->getHeight();
596  $values["full_width_height"]["constr_prop"] = true;
597 
598  $values["full_size"] = "selected";
599 
600  $orig_size = $full_item->getOriginalSize();
601  if ($full_item->getWidth() == "" &&
602  $full_item->getHeight() == "") {
603  $values["full_size"] = "original";
604  $values["full_width_height"]["width"] = $orig_size["width"];
605  $values["full_width_height"]["height"] = $orig_size["height"];
606  }
607  $values["full_caption"] = $full_item->getCaption();
609  $full_item->getLocation(),
610  $full_item->getFormat()
611  )) {
612  $par = $full_item->getParameters();
613  if ($par["autostart"]) {
614  $values["full_autostart"] = true;
615  }
616  } else {
617  $values["full_parameters"] = $full_item->getParameterString();
618  }
619  $values["full_text_representation"] = $full_item->getTextRepresentation();
620  }
621 
622  $this->form_gui->setValuesByArray($values);
623  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
static _useAutoStartParameterOnly($a_loc, $a_format)
Check whether only autostart parameter should be supported (instead of parameters input field...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWidthPreset()

ilObjMediaObjectGUI::getWidthPreset ( )

Get width preset.

Returns
int width preset

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

Referenced by initForm().

125  {
126  return $this->width_preset;
127  }
+ Here is the caller graph for this function:

◆ includePresentationJS()

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

Include media object presentation JS.

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

1857  {
1858  global $DIC;
1859 
1860  $tpl = $DIC["tpl"];
1861 
1862  if ($a_tpl == null) {
1863  $a_tpl = $tpl;
1864  }
1865 
1866  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1867  iljQueryUtil::initjQUery($a_tpl);
1868  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1869  $a_tpl->addJavascript(iljQueryUtil::getLocalMaphilightPath());
1870  $a_tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
1871 
1872  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1874  }
global $DIC
Definition: saml.php:7
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
static getLocalMaphilightPath()
Get local path of maphilight file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

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

Init creation form.

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

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

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

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

◆ listSubtitleFilesObject()

ilObjMediaObjectGUI::listSubtitleFilesObject ( )

List subtitls files.

Parameters

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

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

1914  {
1915  $ilToolbar = $this->toolbar;
1916  $tpl = $this->tpl;
1917  $ilCtrl = $this->ctrl;
1918  $lng = $this->lng;
1919  $ilUser = $this->user;
1920 
1921  $this->setPropertiesSubTabs("subtitles");
1922 
1923  // upload file
1924  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1925  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1926  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.srt)", "subtitle_file");
1927  $fi->setSuffixes(array("srt"));
1928  $ilToolbar->addInputItem($fi, true);
1929 
1930  // language
1931  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1932  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
1934  $si = new ilSelectInputGUI($this->lng->txt("mob_language"), "language");
1935  $si->setOptions($options);
1936  $si->setValue($ilUser->getLanguage());
1937  $ilToolbar->addInputItem($si, true);
1938 
1939  $ilToolbar->addFormButton($lng->txt("upload"), "uploadSubtitleFile");
1940 
1941  $ilToolbar->addSeparator();
1942  $ilToolbar->addFormButton($lng->txt("mob_upload_multi_srt"), "uploadMultipleSubtitleFileForm");
1943 
1944  include_once("./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1945  $tab = new ilMobSubtitleTableGUI($this, "listSubtitleFiles", $this->object);
1946 
1947  $tpl->setContent($tab->getHTML());
1948  }
TableGUI class for subtitle list.
This class represents a selection list property in a property form.
This class represents a file property in a property form.
setPropertiesSubTabs($a_active)
Set subtabs for properties.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:

◆ removeFullscreenObject()

ilObjMediaObjectGUI::removeFullscreenObject ( )

remove fullscreen view

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

1484  {
1485  $this->object->removeMediaItem("Fullscreen");
1486  $this->object->update();
1487 
1488  $this->ctrl->redirect($this, "edit");
1489  }

◆ resizeImagesObject()

ilObjMediaObjectGUI::resizeImagesObject ( )

resize images to specified size

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

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

865  {
866  // directory
867  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
868 
869  // standard item
870  $std_item = $this->object->getMediaItem("Standard");
871  if ($std_item->getLocationType() == "LocalFile" &&
872  is_int(strpos($std_item->getFormat(), "image"))
873  ) {
874  $file = $mob_dir . "/" . $std_item->getLocation();
876  $file,
877  $std_item->getWidth(),
878  $std_item->getHeight()
879  );
880  $std_item->setLocation($location);
881  $std_item->update();
882  }
883 
884  // fullscreen item
885  if ($this->object->hasFullScreenItem()) {
886  $full_item = $this->object->getMediaItem("Fullscreen");
887  if ($full_item->getLocationType() == "LocalFile" &&
888  is_int(strpos($full_item->getFormat(), "image"))
889  ) {
890  $file = $mob_dir . "/" . $full_item->getLocation();
892  $file,
893  $full_item->getWidth(),
894  $full_item->getHeight()
895  );
896  $full_item->setLocation($location);
897  $full_item->update();
898  }
899  }
900 
901  $this->ctrl->redirect($this, "edit");
902  }
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 directory for files of media object (static)
Create new PHPExcel object
obj_idprivate
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ returnToContextObject()

ilObjMediaObjectGUI::returnToContextObject ( )

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

167  {
168  $this->ctrl->returnToParent($this);
169  }

◆ saveMultiSrtObject()

ilObjMediaObjectGUI::saveMultiSrtObject ( )

Save selected srt files as new srt files.

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

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

2081  {
2082  $ilCtrl = $this->ctrl;
2083  $srt_files = $this->object->getMultiSrtFiles();
2084  if (is_array($_POST["file"])) {
2085  foreach ($_POST["file"] as $f) {
2086  foreach ($srt_files as $srt_file) {
2087  if ($f == $srt_file["filename"]) {
2088  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir() . "/" . $srt_file["filename"], $srt_file["lang"], "rename");
2089  }
2090  }
2091  }
2092  }
2093  $this->object->clearMultiSrtDirectory();
2094  $ilCtrl->redirect($this, "listSubtitleFiles");
2095  }
global $ilCtrl
Definition: ilias.php:18
Create new PHPExcel object
obj_idprivate
$_POST["username"]

◆ saveObject()

ilObjMediaObjectGUI::saveObject ( )

create new media object in dom and update page in db

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

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

629  {
630  $tpl = $this->tpl;
631  $lng = $this->lng;
632 
633  $this->initForm();
634  if ($this->form_gui->checkInput()) {
635  $this->object = new ilObjMediaObject();
637  ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
638  return $this->object;
639  } else {
640  $this->form_gui->setValuesByPost();
641  $tpl->setContent($this->form_gui->getHTML());
642  return false;
643  }
644  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 949 of file class.ilObjMediaObjectGUI.php.

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

950  {
951  $lng = $this->lng;
952  $tpl = $this->tpl;
953 
954  $this->initForm("edit");
955  if ($this->form_gui->checkInput()) {
956  $title = trim($_POST["standard_title"]);
957  $this->object->setTitle($title);
958 
959  $std_item = $this->object->getMediaItem("Standard");
960  $location = $std_item->getLocation();
961  $format = $std_item->getFormat();
962  if ($_POST["standard_type"] == "Reference") {
963  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
964  $std_item->setFormat($format);
965  $std_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
966  $std_item->setLocationType("Reference");
967  }
968  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
969  if ($_POST["standard_type"] == "File") {
970  $resize = false;
971  if ($_FILES['standard_file']['name'] != "") {
972  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
973  $file = $mob_dir . "/" . $file_name;
974  ilUtil::moveUploadedFile(
975  $_FILES['standard_file']['tmp_name'],
976  $file_name,
977  $file
978  );
979 
980  // get mime type
982  $location = $file_name;
983 
984  $resize = true;
985  } elseif ($_POST["standard_resize"]) {
986  $file = $mob_dir . "/" . $location;
987  $resize = true;
988  }
989 
990  // resize
991  if ($resize) {
992  if ($_POST["standard_size"] != "original" &&
993  is_int(strpos($format, "image"))) {
995  $file,
996  (int) $_POST["standard_width_height"]["width"],
997  (int) $_POST["standard_width_height"]["height"],
998  (boolean) $_POST["standard_width_height"]["contr_prop"]
999  );
1000  }
1001  $std_item->setFormat($format);
1002  $std_item->setLocation($location);
1003  }
1004 
1005  $std_item->setLocationType("LocalFile");
1006  }
1007  $this->object->setDescription($format);
1008  // determine width and height of known image types
1010  $format,
1011  $_POST["standard_type"],
1012  $mob_dir . "/" . $location,
1013  $std_item->getLocation(),
1014  $_POST["standard_width_height"]["constr_prop"],
1015  ($_POST["standard_size"] == "original"),
1016  $_POST["standard_width_height"]["width"],
1017  $_POST["standard_width_height"]["height"]
1018  );
1019  if ($wh["info"] != "") {
1020  ilUtil::sendInfo($wh["info"], true);
1021  }
1022  $std_item->setWidth($wh["width"]);
1023  $std_item->setHeight($wh["height"]);
1024 
1025  // set caption
1026  $std_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
1027 
1028  // text representation
1029  $std_item->setTextRepresentation(ilUtil::stripSlashes($_POST["text_representation"]));
1030 
1031  // set parameters
1032  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
1034  $std_item->getLocation(),
1035  $std_item->getFormat()
1036  )) {
1037  if ($_POST["standard_autostart"]) { // save only autostart flag
1038  $std_item->setParameters('autostart="true"');
1039  } else {
1040  $std_item->setParameters("");
1041  }
1042  } else {
1043  $std_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_parameters"])));
1044  }
1045  }
1046 
1047  // "None" selected
1048  if ($_POST["full_type"] == "None") {
1049  if ($this->object->hasFullscreenItem()) { // delete existing
1050  $this->object->removeMediaItem("Fullscreen");
1051  }
1052  } else { // Not "None" -> we need one
1053  if ($this->object->hasFullscreenItem()) { // take existing one
1054  $full_item = $this->object->getMediaItem("Fullscreen");
1055  } else { // create one
1056  $full_item = new ilMediaItem();
1057  $this->object->addMediaItem($full_item);
1058  $full_item->setPurpose("Fullscreen");
1059  }
1060  $location = $full_item->getLocation();
1061  $format = $full_item->getFormat();
1062  if ($_POST["full_type"] == "Reference") {
1063  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["full_reference"]), true);
1064  $full_item->setFormat($format);
1065  $full_item->setLocationType("Reference");
1066  $location = ilUtil::stripSlashes($_POST["full_reference"]);
1067  $type = "Reference";
1068  }
1069  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1070  if ($_POST["full_type"] == "File") {
1071  $resize = false;
1072  if ($_FILES['full_file']['name'] != "") {
1073  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1074  $file = $mob_dir . "/" . $full_file_name;
1075  ilUtil::moveUploadedFile(
1076  $_FILES['full_file']['tmp_name'],
1077  $full_file_name,
1078  $file
1079  );
1080 
1082  $location = $full_file_name;
1083 
1084  $resize = true;
1085  } elseif ($_POST["full_resize"]) {
1086  $file = $mob_dir . "/" . $location;
1087  $resize = true;
1088  }
1089 
1090  // resize
1091  if ($resize) {
1092  if ($_POST["full_size"] != "original" &&
1093  is_int(strpos($format, "image"))) {
1095  $file,
1096  (int) $_POST["full_width_height"]["width"],
1097  (int) $_POST["full_width_height"]["height"],
1098  (boolean) $_POST["full_width_height"]["contr_prop"]
1099  );
1100  }
1101  $full_item->setFormat($format);
1102  $full_item->setLocation($location);
1103  }
1104 
1105  $full_item->setLocationType("LocalFile");
1106  $type = "File";
1107  }
1108  if ($_POST["full_type"] == "Standard") {
1109  $format = $std_item->getFormat();
1110  $location = $std_item->getLocation();
1111  $full_item->setLocationType($std_item->getLocationType());
1112  $full_item->setFormat($format);
1113  $full_item->setLocation($location);
1114  $type = $std_item->getLocationType();
1115  if ($type == "LocalFile") {
1116  $type = "File";
1117  }
1118  // resize image
1119  //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1120  if ($_POST["full_size"] != "original" &&
1121  is_int(strpos($format, "image")) &&
1122  $full_item->getLocationType() == "LocalFile") {
1123  $file = $mob_dir . "/" . $location;
1125  $file,
1126  (int) $_POST["full_width_height"]["width"],
1127  (int) $_POST["full_width_height"]["height"],
1128  (boolean) $_POST["full_width_height"]["contr_prop"]
1129  );
1130  }
1131  }
1132 
1133  // determine width and height of known image types
1135  $format,
1136  $type,
1137  $mob_dir . "/" . $location,
1138  $full_item->getLocation(),
1139  $_POST["full_width_height"]["constr_prop"],
1140  ($_POST["full_size"] == "original"),
1141  $_POST["full_width_height"]["width"],
1142  $_POST["full_width_height"]["height"]
1143  );
1144  if ($wh["info"] != "") {
1145  ilUtil::sendInfo($wh["info"], true);
1146  }
1147 
1148  $full_item->setWidth($wh["width"]);
1149  $full_item->setHeight($wh["height"]);
1150  $full_item->setLocation($location);
1151 
1152  $full_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1153 
1154  // text representation
1155  $full_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1156 
1157 
1158  // set parameters
1159  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
1161  $std_item->getLocation(),
1162  $std_item->getFormat()
1163  )) {
1164  if ($_POST["full_autostart"]) { // save only autostart flag
1165  $full_item->setParameters('autostart="true"');
1166  } else {
1167  $full_item->setParameters("");
1168  }
1169  } else {
1170  $full_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])));
1171  }
1172  }
1173  }
1174 
1176  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1178 
1179  $this->object->update();
1180  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1181  $this->ctrl->redirect($this, "edit");
1182  } else {
1183  $this->form_gui->setValuesByPost();
1184  $tpl->setContent($this->form_gui->getHTML());
1185  }
1186  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$type
static sanitizeDir($a_path)
Sanitize directory recursively.
static _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
$location
Definition: buildRTE.php:44
static _getDirectory($a_mob_id)
get directory for files of media object (static)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
Class ilMediaItem.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static secureLink($a_str)
Create new PHPExcel object
obj_idprivate
static _useAutoStartParameterOnly($a_loc, $a_format)
Check whether only autostart parameter should be supported (instead of parameters input field...
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _getSimpleMimeTypes()
Get simple mime types that deactivate parameter property files tab in ILIAS.
static _determineWidthHeight( $a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
Determine width and height.
$_POST["username"]
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ setBackTitle()

ilObjMediaObjectGUI::setBackTitle (   $a_title)

set title for back tab

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

Referenced by ilPCMediaObjectGUI\executeCommand().

246  {
247  $this->back_title = $a_title;
248  }
+ 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 94 of file class.ilObjMediaObjectGUI.php.

95  {
96  $this->enabledmapareas = $a_enabledmapareas;
97  }

◆ setHeader()

ilObjMediaObjectGUI::setHeader (   $a_title = "")

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

References header.

80  {
81  $this->header = $a_title;
82  }
Add a drawing to the header
Definition: 04printing.php:69

◆ setHeightPreset()

ilObjMediaObjectGUI::setHeightPreset (   $a_val)

Set height preset.

Parameters
intheight preset

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

135  {
136  $this->height_preset = $a_val;
137  }

◆ setObjectPerCreationForm()

static ilObjMediaObjectGUI::setObjectPerCreationForm (   $a_mob)
static

Set media object values from creation form.

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

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

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

666  {
667  // determinte title and format
668  if (trim($_POST["standard_title"]) != "") {
669  $title = trim($_POST["standard_title"]);
670  } else {
671  if ($_POST["standard_type"] == "File") {
672  $title = $_FILES['standard_file']['name'];
673  } else {
674  $title = ilUtil::stripSlashes($_POST["standard_reference"]);
675  }
676  }
677 
678  $a_mob->setTitle($title);
679  $a_mob->setDescription("");
680  $a_mob->create();
681 
682  // determine and create mob directory, move uploaded file to directory
683  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
684  $a_mob->createDirectory();
685  $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
686 
687  $media_item = new ilMediaItem();
688  $a_mob->addMediaItem($media_item);
689  $media_item->setPurpose("Standard");
690 
691  if ($_POST["standard_type"] == "File") {
692  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
693  $file = $mob_dir . "/" . $file_name;
694  ilUtil::moveUploadedFile(
695  $_FILES['standard_file']['tmp_name'],
696  $file_name,
697  $file
698  );
699 
700  // get mime type
702  $location = $file_name;
703 
704  // resize standard images
705  if ($_POST["standard_size"] != "original" &&
706  is_int(strpos($format, "image"))) {
708  $file,
709  (int) $_POST["standard_width_height"]["width"],
710  (int) $_POST["standard_width_height"]["height"],
711  (boolean) $_POST["standard_width_height"]["contr_prop"]
712  );
713  }
714 
715  // set real meta and object data
716  $media_item->setFormat($format);
717  $media_item->setLocation($location);
718  $media_item->setLocationType("LocalFile");
719  } else { // standard type: reference
720  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
721  $media_item->setFormat($format);
722  $media_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
723  $media_item->setLocationType("Reference");
724  }
725  $a_mob->setDescription($format);
726 
727  // determine width and height of known image types
729  $format,
730  $_POST["standard_type"],
731  $mob_dir . "/" . $location,
732  $media_item->getLocation(),
733  $_POST["standard_width_height"]["constr_prop"],
734  ($_POST["standard_size"] == "original"),
735  $_POST["standard_width_height"]["width"],
736  $_POST["standard_width_height"]["height"]
737  );
738  $media_item->setWidth($wh["width"]);
739  $media_item->setHeight($wh["height"]);
740  if ($wh["info"] != "") {
741  ilUtil::sendInfo($wh["info"], true);
742  }
743 
744  if ($_POST["standard_caption"] != "") {
745  $media_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
746  }
747 
748 
749  $media_item->setHAlign("Left");
750 
751  // fullscreen view
752  if ($_POST["full_type"] != "None") {
753  $media_item2 = new ilMediaItem();
754  $a_mob->addMediaItem($media_item2);
755  $media_item2->setPurpose("Fullscreen");
756 
757  // move file / set format and location
758  if ($_POST["full_type"] == "File") {
759  $format = $location = "";
760  if ($_FILES['full_file']['name'] != "") {
761  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
762  $file = $mob_dir . "/" . $full_file_name;
763  ilUtil::moveUploadedFile(
764  $_FILES['full_file']['tmp_name'],
765  $full_file_name,
766  $file
767  );
769  $location = $full_file_name;
770  }
771  } elseif ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File") {
772  $location = $file_name;
773  }
774 
775  // resize file
776  if ($_POST["full_type"] == "File" ||
777  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File")) {
778  if (($_POST["full_size"] != "original" &&
779  is_int(strpos($format, "image")))
780  ) {
782  $file,
783  (int) $_POST["full_width_height"]["width"],
784  (int) $_POST["full_width_height"]["height"],
785  (boolean) $_POST["full_width_height"]["constr_prop"]
786  );
787  }
788 
789  $media_item2->setFormat($format);
790  $media_item2->setLocation($location);
791  $media_item2->setLocationType("LocalFile");
792  $type = "File";
793  }
794 
795  if ($_POST["full_type"] == "Reference") {
796  $format = $location = "";
797  if ($_POST["full_reference"] != "") {
798  $format = ilObjMediaObject::getMimeType($_POST["full_reference"], true);
799  $location = ilUtil::stripSlashes($_POST["full_reference"]);
800  }
801  }
802 
803  if ($_POST["full_type"] == "Reference" ||
804  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "Reference")) {
805  $media_item2->setFormat($format);
806  $media_item2->setLocation($location);
807  $media_item2->setLocationType("Reference");
808  $type = "Reference";
809  }
810 
811  // determine width and height of known image types
813  $format,
814  $type,
815  $mob_dir . "/" . $location,
816  $media_item2->getLocation(),
817  $_POST["full_width_height"]["constr_prop"],
818  ($_POST["full_size"] == "original"),
819  $_POST["full_width_height"]["width"],
820  $_POST["full_width_height"]["height"]
821  );
822 
823  $media_item2->setWidth($wh["width"]);
824  $media_item2->setHeight($wh["height"]);
825 
826  if ($_POST["full_caption"] != "") {
827  $media_item2->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
828  }
829  }
830 
832  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
833  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
834  $a_mob->update();
835  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$format
Definition: metadata.php:141
$type
static sanitizeDir($a_path)
Sanitize directory recursively.
static _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
$location
Definition: buildRTE.php:44
static _getDirectory($a_mob_id)
get directory for files of media object (static)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
Class ilMediaItem.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static secureLink($a_str)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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 1881 of file class.ilObjMediaObjectGUI.php.

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

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

1882  {
1883  $ilTabs = $this->tabs;
1884  $ilCtrl = $this->ctrl;
1885  $lng = $this->lng;
1886 
1887  $ilTabs->activateTab("cont_mob_def_prop");
1888 
1889  $ilTabs->addSubTab(
1890  "general",
1891  $lng->txt("mob_general"),
1892  $ilCtrl->getLinkTarget($this, "edit")
1893  );
1894 
1895  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1896  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4") {
1897  $ilTabs->addSubTab(
1898  "subtitles",
1899  $lng->txt("mob_subtitles"),
1900  $ilCtrl->getLinkTarget($this, "listSubtitleFiles")
1901  );
1902  }
1903 
1904  $ilTabs->activateSubTab($a_active);
1905  }
global $ilCtrl
Definition: ilias.php:18
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ setTabs()

ilObjMediaObjectGUI::setTabs ( )

set admin tabs

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

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

1720  {
1721  //echo "setAdminTabs should not be called.";
1722 
1723  // catch feedback message
1724  $this->getTabs();
1725 
1726  //$tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
1727  $this->tpl->clearHeader();
1728  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject") {
1729  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1730  $this->tpl->setTitle($this->object->getTitle());
1731  } else {
1732  //$title = $this->object->getTitle();
1733  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1734  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1735  }
1736  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ setWidthPreset()

ilObjMediaObjectGUI::setWidthPreset (   $a_val)

Set width preset.

Parameters
intwidth preset

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

115  {
116  $this->width_preset = $a_val;
117  }

◆ showAllUsagesObject()

ilObjMediaObjectGUI::showAllUsagesObject ( )

Show all media object usages (incl history)

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

References showUsagesObject().

1586  {
1587  $this->showUsagesObject(true);
1588  }
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 2057 of file class.ilObjMediaObjectGUI.php.

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

2058  {
2059  $tpl = $this->tpl;
2060 
2061  $this->setPropertiesSubTabs("subtitles");
2062 
2063  include_once("./Services/MediaObjects/classes/class.ilMultiSrtConfirmationTable2GUI.php");
2064  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
2065  $tpl->setContent($tab->getHTML());
2066  }
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 1594 of file class.ilObjMediaObjectGUI.php.

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

Referenced by showAllUsagesObject().

1595  {
1596  $tpl = $this->tpl;
1597  $ilTabs = $this->tabs;
1598  $ilTabs = $this->tabs;
1599  $lng = $this->lng;
1600  $ilCtrl = $this->ctrl;
1601 
1602  $ilTabs->addSubTab(
1603  "current_usages",
1604  $lng->txt("cont_current_usages"),
1605  $ilCtrl->getLinkTarget($this, "showUsages")
1606  );
1607 
1608  $ilTabs->addSubTab(
1609  "all_usages",
1610  $lng->txt("cont_all_usages"),
1611  $ilCtrl->getLinkTarget($this, "showAllUsages")
1612  );
1613 
1614  if ($a_all) {
1615  $ilTabs->activateSubTab("all_usages");
1616  $cmd = "showAllUsages";
1617  } else {
1618  $ilTabs->activateSubTab("current_usages");
1619  $cmd = "showUsages";
1620  }
1621 
1622  include_once("./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1623  $usages_table = new ilMediaObjectUsagesTableGUI(
1624  $this,
1625  $cmd,
1626  $this->object,
1627  $a_all
1628  );
1629  $tpl->setContent($usages_table->getHTML());
1630  }
TableGUI class for media object usages listing.
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ showVideoToolObject()

ilObjMediaObjectGUI::showVideoToolObject ( )

Show video tools.

Parameters

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

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

1838  {
1839  $tpl = $this->tpl;
1840 
1841  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1842 
1843  /*$codecs = ilFFmpeg::getSupportedCodecsInfo();
1844  $codec_str = implode($codecs, "<br />");
1845  $tpl->setContent($codec_str);*/
1846 
1848  $formats_str = implode($formats, "<br />");
1849  $tpl->setContent($formats_str);
1850  }
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 1383 of file class.ilObjMediaObjectGUI.php.

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

1384  {
1385  // determine directory
1386  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1387  $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1388  $cur_dir = (!empty($cur_subdir))
1389  ? $mob_dir . "/" . $cur_subdir
1390  : $mob_dir;
1391  if (is_file($_FILES["new_file"]["tmp_name"])) {
1392  $file_name = ilObjMediaObject::fixFilename($_FILES["new_file"]["name"]);
1393  $file = $cur_dir . "/" . $file_name;
1394  ilUtil::moveUploadedFile(
1395  $_FILES['new_file']['tmp_name'],
1396  $file_name,
1397  $file
1398  );
1399  }
1401  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1402  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1403 
1404  $this->ctrl->saveParameter($this, "cdir");
1405  $this->ctrl->redirect($this, "editFiles");
1406  }
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.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $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 2020 of file class.ilObjMediaObjectGUI.php.

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

2021  {
2022  $ilToolbar = $this->toolbar;
2023  $lng = $this->lng;
2024  $ilCtrl = $this->ctrl;
2025 
2026  ilUtil::sendInfo($lng->txt("mob_upload_multi_srt_howto"));
2027 
2028  $this->setPropertiesSubTabs("subtitles");
2029 
2030  // upload file
2031  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
2032  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2033  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.zip)", "subtitle_file");
2034  $fi->setSuffixes(array("zip"));
2035  $ilToolbar->addInputItem($fi, true);
2036 
2037  $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
2038  }
This class represents a file property in a property form.
setPropertiesSubTabs($a_active)
Set subtabs for properties.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create styles array
The data for the language used.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:

◆ uploadMultipleSubtitleFileObject()

ilObjMediaObjectGUI::uploadMultipleSubtitleFileObject ( )

Upload multiple subtitles.

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

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

2044  {
2045  try {
2046  $this->object->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
2047  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
2048  } catch (ilMediaObjectsException $e) {
2049  ilUtil::sendFailure($e->getMessage(), true);
2050  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
2051  }
2052  }
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 1956 of file class.ilObjMediaObjectGUI.php.

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

1957  {
1958  $lng = $this->lng;
1959  $ilCtrl = $this->ctrl;
1960 
1961  if ($this->object->uploadSrtFile($_FILES["subtitle_file"]["tmp_name"], ilUtil::stripSlashes($_POST["language"]))) {
1962  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1963  }
1964  $ilCtrl->redirect($this, "listSubtitleFiles");
1965  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create new PHPExcel object
obj_idprivate
$_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().

◆ $ctrl

◆ $enabledmapareas

ilObjMediaObjectGUI::$enabledmapareas = true

Definition at line 54 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 52 of file class.ilObjMediaObjectGUI.php.

Referenced by getHeader().

◆ $help

ilObjMediaObjectGUI::$help
protected

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

Referenced by createObject(), and getTabs().

◆ $tabs

ilObjMediaObjectGUI::$tabs
protected

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

Referenced by setPropertiesSubTabs(), and showUsagesObject().

◆ $target_script

ilObjMediaObjectGUI::$target_script

Definition at line 53 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: