ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjMediaObjectGUI Class Reference

Class ilObjMediaObjectGUI. More...

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

Public Member Functions

 ilObjMediaObjectGUI ($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...
 
 _getMediaInfoHTML (&$a_mob)
 get media info as html More...
 
 setTabs ()
 set admin tabs More...
 
 getTabs (&$tabs_gui)
 Get Tabs. More...
 
 showVideoToolObject ()
 Show video tools. More...
 
 includePresentationJS ($a_tpl=null)
 Include media object presentation JS. 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
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
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...
 
 getAdminTabs (&$tabs_gui)
 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 ($in_rep=false)
 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...
 
 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 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
 
 $ilias
 
 $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
 

Additional Inherited Members

- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 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...
 
 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...
 
 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...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 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 ($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 inherited from ilObjectGUI
 $tmp_import_dir
 

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.

Member Function Documentation

◆ _getMediaInfoHTML()

ilObjMediaObjectGUI::_getMediaInfoHTML ( $a_mob)

get media info as html

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

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

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

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

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

◆ assignFullscreenObject()

ilObjMediaObjectGUI::assignFullscreenObject (   $a_file)

assign file to fullscreen view

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

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

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

◆ assignObject()

ilObjMediaObjectGUI::assignObject ( )

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

120  {
121  if ($this->id != 0)
122  {
123  $this->object =& new ilObjMediaObject($this->id);
124  }
125  }
Class ilObjMediaObject.

◆ assignStandardObject()

ilObjMediaObjectGUI::assignStandardObject (   $a_file)

assign file to standard view

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

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

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

2081  {
2082  $this->object->clearMultiSrtDirectory();
2083  $this->ctrl->redirect($this, "listSubtitleFiles");
2084  }

◆ cancelObject()

ilObjMediaObjectGUI::cancelObject ( )

Cancel saving.

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

811  {
812  $this->ctrl->returnToParent($this);
813  }

◆ checkFormInput()

ilObjMediaObjectGUI::checkFormInput ( )

chechInputForm

Parameters

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

623  {
624  if (!$this->form_gui->checkInput())
625  {
626  $this->form_gui->setValuesByPost();
627  return false;
628  }
629  return true;
630  }

◆ confirmSrtDeletionObject()

ilObjMediaObjectGUI::confirmSrtDeletionObject ( )

Confirm srt file deletion.

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

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

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

◆ createDirectoryObject()

ilObjMediaObjectGUI::createDirectoryObject ( )

create directory

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

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

1357  {
1358 //echo "cdir:".$_GET["cdir"].":<br>";
1359  // determine directory
1360  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1361  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1362  $cur_dir = (!empty($cur_subdir))
1363  ? $mob_dir."/".$cur_subdir
1364  : $mob_dir;
1365 
1366  $new_dir = str_replace(".", "", $_POST["new_dir"]);
1367  $new_dir = str_replace("/", "", $new_dir);
1368 
1369  if (!empty($new_dir))
1370  {
1371  ilUtil::makeDir($cur_dir."/".$new_dir);
1372  }
1373  $this->ctrl->saveParameter($this, "cdir");
1374  $this->ctrl->redirect($this, "editFiles");
1375  }
$_POST['username']
Definition: cron.php:12
$_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
+ Here is the call graph for this function:

◆ createObject()

ilObjMediaObjectGUI::createObject ( )

create new media object form

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

References ilObjectGUI\$tpl, and initForm().

211  {
212  global $tpl, $ilHelp;
213 
214  $ilHelp->setScreenId("create");
215  $this->initForm();
216  $tpl->setContent($this->form_gui->getHTML());
217  }
initForm($a_mode="create")
Init creation form.
+ Here is the call graph for this function:

◆ deleteFileObject()

ilObjMediaObjectGUI::deleteFileObject ( )

delete object file

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

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

1524  {
1525  if (!isset($_POST["file"]))
1526  {
1527  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1528  }
1529 
1530  if (count($_POST["file"]) > 1)
1531  {
1532  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1533  }
1534 
1535  if ($_POST["file"][0] == "..")
1536  {
1537  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1538  }
1539 
1540  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1541  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1542  $cur_dir = (!empty($cur_subdir))
1543  ? $mob_dir."/".$cur_subdir
1544  : $mob_dir;
1545  $file = $cur_dir."/".$_POST["file"][0];
1546  $location = (!empty($cur_subdir))
1547  ? $cur_subdir."/".$_POST["file"][0]
1548  : $_POST["file"][0];
1549 
1550  $full_item =& $this->object->getMediaItem("Fullscreen");
1551  $std_item =& $this->object->getMediaItem("Standard");
1552 
1553  if ($location == $std_item->getLocation())
1554  {
1555  $this->ilias->raiseError($this->lng->txt("cont_cant_del_std"),$this->ilias->error_obj->MESSAGE);
1556  }
1557 
1558  if($this->object->hasFullScreenItem())
1559  {
1560  if ($location == $full_item->getLocation())
1561  {
1562  $this->ilias->raiseError($this->lng->txt("cont_cant_del_full"),$this->ilias->error_obj->MESSAGE);
1563  }
1564  }
1565 
1566  if (@is_dir($file))
1567  {
1568  if (substr($std_item->getLocation(), 0 ,strlen($location)) == $location)
1569  {
1570  $this->ilias->raiseError($this->lng->txt("cont_std_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1571  }
1572 
1573  if($this->object->hasFullScreenItem())
1574  {
1575  if (substr($full_item->getLocation(), 0 ,strlen($location)) == $location)
1576  {
1577  $this->ilias->raiseError($this->lng->txt("cont_full_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1578  }
1579  }
1580  }
1581 
1582  if (@is_file($file))
1583  {
1584  unlink($file);
1585  }
1586 
1587  if (@is_dir($file))
1588  {
1590  }
1591 
1592  $this->ctrl->saveParameter($this, "cdir");
1593  $this->ctrl->redirect($this, "editFiles");
1594  }
print $file
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
$location
Definition: buildRTE.php:44
redirection script todo: (a better solution should control the processing via a xml file) ...
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ deleteSrtFilesObject()

ilObjMediaObjectGUI::deleteSrtFilesObject ( )

Delete srt files.

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

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

2007  {
2008  global $lng, $ilCtrl;
2009 
2010  foreach ($_POST["srt"] as $i)
2011  {
2012  if (strlen($i) == 2 && !is_int(strpos($i, ".")))
2013  {
2014  $this->object->removeAdditionalFile("srt/subtitle_".$i.".srt");
2015  }
2016  }
2017  ilUtil::sendSuccess($lng->txt("mob_srt_files_deleted"), true);
2018  $ilCtrl->redirect($this, "listSubtitleFiles");
2019  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ editFilesObject()

ilObjMediaObjectGUI::editFilesObject ( )

administrate files of media object

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

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

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

◆ editObject()

ilObjMediaObjectGUI::editObject ( )

edit media object properties

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

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

819  {
820  global $tpl;
821 
822  $this->setPropertiesSubTabs("general");
823 
824  $this->initForm("edit");
825  $this->getValues();
826  $tpl->setContent($this->form_gui->getHTML());
827  }
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 136 of file class.ilObjMediaObjectGUI.php.

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

137  {
138  global $tpl, $ilAccess, $ilErr;
139 
140  $next_class = $this->ctrl->getNextClass($this);
141  $cmd = $this->ctrl->getCmd();
142 
143  switch($next_class)
144  {
145  case 'ilobjectmetadatagui':
146  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
147  $md_gui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
148  // object is subtype, so we have to do it ourselves
149  $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
150  $this->ctrl->forwardCommand($md_gui);
151  break;
152 
153  case "ilimagemapeditorgui":
154  require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
155  $image_map_edit = new ilImageMapEditorGUI($this->object);
156  $ret = $this->ctrl->forwardCommand($image_map_edit);
157  $tpl->setContent($ret);
158  break;
159 
160  case "ilfilesystemgui":
161  include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
162  $fs_gui =& new ilFileSystemGUI(ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId());
164  $fs_gui->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
165  $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
166  $fs_gui->setTableId("mobfs".$this->object->getId());
167  $fs_gui->labelFile($this->object->getMediaItem("Standard")->getLocation(),
168  $this->lng->txt("cont_std_view"));
169  if($this->object->hasFullscreenItem())
170  {
171  $fs_gui->labelFile($this->object->getMediaItem("Fullscreen")->getLocation(),
172  $this->lng->txt("cont_fullscreen"));
173  }
174  $fs_gui->addCommand($this, "assignStandardObject", $this->lng->txt("cont_assign_std"));
175  $fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full"));
176  ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
177  $ret =& $this->ctrl->forwardCommand($fs_gui);
178  ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
179  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
180  ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
181  break;
182 
183 
184  default:
185  if (isset($_POST["editImagemapForward"]) ||
186  isset($_POST["editImagemapForward_x"]) ||
187  isset($_POST["editImagemapForward_y"]))
188  {
189  $cmd = "editImagemapForward";
190  }
191  $cmd.= "Object";
192  $ret =& $this->$cmd();
193  break;
194  }
195 
196  return $ret;
197  }
Class ilObjectMetaDataGUI.
$_POST['username']
Definition: cron.php:12
static sanitizeDir($a_path)
Sanitize directory recursively.
$cmd
Definition: sahs_server.php:35
addMDObserver($a_class, $a_method, $a_section)
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 ...
File System Explorer GUI class.
static getWebspaceDir($mode="filesystem")
get webspace directory
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ getEnabledMapAreas()

ilObjMediaObjectGUI::getEnabledMapAreas ( )

Get Enable map areas.

Returns
boolean Enable map areas

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

References $enabledmapareas.

Referenced by getTabs().

+ Here is the caller graph for this function:

◆ getForm()

ilObjMediaObjectGUI::getForm ( )

Get form.

Returns
object form gui class

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

115  {
116  return $this->form_gui;
117  }

◆ getFullscreenSizeObject()

ilObjMediaObjectGUI::getFullscreenSizeObject ( )

set original size of fullscreen file

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

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

898  {
899  $full_item =& $this->object->getMediaItem("Fullscreen");
900  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
901 
902  if ($full_item->getLocationType() == "LocalFile")
903  {
904  $file = $mob_dir."/".$full_item->getLocation();
905  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
907  $full_item->setWidth($size[0]);
908  $full_item->setHeight($size[1]);
909  $this->object->update();
910  }
911  $this->ctrl->redirect($this, "edit");
912  }
print $file
$size
Definition: RandomTest.php:79
static getImageSize($a_location)
Get image size from location.
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ getHeader()

ilObjMediaObjectGUI::getHeader ( )

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

References $header.

45  {
46  return $this->header;
47  }

◆ getHeightPreset()

ilObjMediaObjectGUI::getHeightPreset ( )

Get height preset.

Returns
int height preset

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

Referenced by initForm().

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

◆ getStandardSizeObject()

ilObjMediaObjectGUI::getStandardSizeObject ( )

set original size of standard file

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

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

875  {
876  $std_item = $this->object->getMediaItem("Standard");
877  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
878 
879  if ($std_item->getLocationType() == "LocalFile")
880  {
881  $file = $mob_dir."/".$std_item->getLocation();
882 
883  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
885 
886  $std_item->setWidth($size[0]);
887  $std_item->setHeight($size[1]);
888  $this->object->update();
889  }
890  $this->ctrl->redirect($this, "edit");
891  }
print $file
$size
Definition: RandomTest.php:79
static getImageSize($a_location)
Get image size from location.
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ getTabs()

ilObjMediaObjectGUI::getTabs ( $tabs_gui)

Get Tabs.

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

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

Referenced by setTabs().

1763  {
1764  global $ilTabs, $ilHelp;
1765 
1766  $ilHelp->setScreenIdComponent("mob");
1767 
1768  //$tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
1769  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1770  && $this->object->getId() > 0)
1771  {
1772  // object properties
1773  $ilTabs->addTarget("cont_mob_def_prop",
1774  $this->ctrl->getLinkTarget($this, "edit"), "edit",
1775  get_class($this));
1776 
1777  $st_item =& $this->object->getMediaItem("Standard");
1778 
1779  // video tools
1780  if (substr($st_item->getFormat(), 0, 6) == "video/" && DEVMODE)
1781  {
1782  $ilTabs->addTarget("mob_video_tools",
1783  $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "showVideoTool"),
1784  "showVideoTool", "ilobjmediaobjectgui");
1785  }
1786 
1787  // link areas
1788 
1789  if (is_object($st_item) && $this->getEnabledMapAreas())
1790  {
1791  $format = $st_item->getFormat();
1792  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg")))
1793  {
1794  $ilTabs->addTarget("cont_def_map_areas",
1795  $this->ctrl->getLinkTargetByClass(
1796  array("ilobjmediaobjectgui", "ilimagemapeditorgui"), "editMapAreas"), "editMapAreas",
1797  "ilimagemapeditorgui");
1798  }
1799  }
1800 
1801  // object usages
1802  $ilTabs->addTarget("cont_mob_usages",
1803  $this->ctrl->getLinkTarget($this, "showUsages"), "showUsages",
1804  get_class($this));
1805 
1806  // object files
1807  $std_item = $this->object->getMediaItem("Standard");
1808  $full_item = $this->object->getMediaItem("Fullscreen");
1809  $mset = new ilSetting("mobs");
1810  if ($mset->get("file_manager_always") ||
1811  (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()) ||
1812  (is_object($full_item) && !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())))
1813  )
1814  {
1815 // $ilTabs->addTarget("cont_files",
1816 // $this->ctrl->getLinkTarget($this, "editFiles"), "editFiles",
1817 // get_class($this));
1818 
1819  $ilTabs->addTarget("cont_files",
1820  $this->ctrl->getLinkTargetByClass(
1821  array("ilobjmediaobjectgui", "ilfilesystemgui"), "listFiles"), "",
1822  "ilfilesystemgui");
1823  }
1824 
1825  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1826  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1827  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1828  if($mdtab)
1829  {
1830  $ilTabs->addTarget("meta_data",
1831  $mdtab,
1832  "", "ilmdeditorgui");
1833  }
1834 
1835  }
1836 
1837  // back to upper context
1838  if ($this->back_title != "")
1839  {
1840  $tabs_gui->setBackTarget($this->back_title,
1841  $this->ctrl->getParentReturn($this));
1842  }
1843  }
ILIAS Setting Class.
Class ilObjectMetaDataGUI.
getEnabledMapAreas()
Get Enable map areas.
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 495 of file class.ilObjMediaObjectGUI.php.

References ilObjMediaObject\_useAutoStartParameterOnly().

Referenced by editObject().

496  {
497  $values = array();
498 
499  $values["standard_title"] = $this->object->getTitle();
500 
501  $std_item = $this->object->getMediaItem("Standard");
502  if ($std_item->getLocationType() == "LocalFile")
503  {
504  $values["standard_type"] = "File";
505  $values["standard_file"] = $std_item->getLocation();
506  }
507  else
508  {
509  $values["standard_type"] = "Reference";
510  $values["standard_reference"] = $std_item->getLocation();
511  }
512  $values["standard_format"] = $std_item->getFormat();
513  $values["standard_width_height"]["width"] = $std_item->getWidth();
514  $values["standard_width_height"]["height"] = $std_item->getHeight();
515  $values["standard_width_height"]["constr_prop"] = true;
516 
517  $values["standard_size"] = "selected";
518 
519  if ($orig_size = $std_item->getOriginalSize())
520  {
521  if ($orig_size["width"] == $std_item->getWidth() &&
522  $orig_size["height"] == $std_item->getHeight())
523  {
524  $values["standard_size"] = "original";
525  }
526  }
527  $values["standard_caption"] = $std_item->getCaption();
528  $values["text_representation"] = $std_item->getTextRepresentation();
529  if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
530  $std_item->getFormat()))
531  {
532  $par = $std_item->getParameters();
533  if ($par["autostart"])
534  {
535  $values["standard_autostart"] = true;
536  }
537  }
538  else
539  {
540  $values["standard_parameters"] = $std_item->getParameterString();
541  }
542 
543  $values["full_type"] = "None";
544  $values["full_size"] = "original";
545  if ($this->object->hasFullScreenItem())
546  {
547  $full_item = $this->object->getMediaItem("Fullscreen");
548  if ($full_item->getLocationType() == "LocalFile")
549  {
550  $values["full_type"] = "File";
551  $values["full_file"] = $full_item->getLocation();
552  }
553  else
554  {
555  $values["full_type"] = "Reference";
556  $values["full_reference"] = $full_item->getLocation();
557  }
558  $values["full_format"] = $full_item->getFormat();
559  $values["full_width_height"]["width"] = $full_item->getWidth();
560  $values["full_width_height"]["height"] = $full_item->getHeight();
561  $values["full_width_height"]["constr_prop"] = true;
562 
563  $values["full_size"] = "selected";
564 
565  if ($orig_size = $full_item->getOriginalSize())
566  {
567  if ($orig_size["width"] == $full_item->getWidth() &&
568  $orig_size["height"] == $full_item->getHeight())
569  {
570  $values["full_size"] = "original";
571  }
572  }
573  $values["full_caption"] = $full_item->getCaption();
574  if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
575  $full_item->getFormat()))
576  {
577  $par = $full_item->getParameters();
578  if ($par["autostart"])
579  {
580  $values["full_autostart"] = true;
581  }
582  }
583  else
584  {
585  $values["full_parameters"] = $full_item->getParameterString();
586  }
587  $values["full_text_representation"] = $full_item->getTextRepresentation();
588  }
589 
590  $this->form_gui->setValuesByArray($values);
591  }
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 84 of file class.ilObjMediaObjectGUI.php.

Referenced by initForm().

85  {
86  return $this->width_preset;
87  }
+ Here is the caller graph for this function:

◆ ilObjMediaObjectGUI()

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

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

References $ilCtrl, and ilObjectGUI\$lng.

27  {
28  global $lng, $ilCtrl;
29 
30  $this->ctrl =& $ilCtrl;
31  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
32  $this->lng =& $lng;
33  $this->back_title = "";
34  $this->type = "mob";
35 
36  $lng->loadLanguageModule("mob");
37  }
global $ilCtrl
Definition: ilias.php:18

◆ includePresentationJS()

ilObjMediaObjectGUI::includePresentationJS (   $a_tpl = null)

Include media object presentation JS.

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

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

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

1871  {
1872  global $tpl;
1873 
1874  if ($a_tpl == null)
1875  {
1876  $a_tpl = $tpl;
1877  }
1878 
1879  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1880  iljQueryUtil::initjQUery($a_tpl);
1881  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1882  $a_tpl->addJavascript(iljQueryUtil::getLocalMaphilightPath());
1883  $a_tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
1884 
1885  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1887  }
getLocalMaphilightPath()
Get local path of maphilight file.
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

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

Init creation form.

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

References $ilCtrl, ilObjectGUI\$lng, ilObjMediaObject\_getSimpleMimeTypes(), ilObjMediaObject\_useAutoStartParameterOnly(), ilSubEnabledFormPropertyGUI\addSubItem(), ilObjMediaObject\getForbiddenFileTypes(), getHeightPreset(), ilObjMediaObject\getRestrictedFileTypes(), getWidthPreset(), ilTextAreaInputGUI\setCols(), ilWidthHeightInputGUI\setConstrainProportions(), ilRadioOption\setInfo(), ilTextAreaInputGUI\setRows(), ilTextInputGUI\setSize(), and ilNonEditableValueGUI\setValue().

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

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

◆ listSubtitleFilesObject()

ilObjMediaObjectGUI::listSubtitleFilesObject ( )

List subtitls files.

Parameters

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

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

1922  {
1923  global $ilToolbar, $tpl, $ilCtrl, $lng, $ilUser;
1924 
1925  $this->setPropertiesSubTabs("subtitles");
1926 
1927  // upload file
1928  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1929  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1930  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file")." (.srt)", "subtitle_file");
1931  $fi->setSuffixes(array("srt"));
1932  $ilToolbar->addInputItem($fi, true);
1933 
1934  // language
1935  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1936  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
1938  $si = new ilSelectInputGUI($this->lng->txt("mob_language"), "language");
1939  $si->setOptions($options);
1940  $si->setValue($ilUser->getLanguage());
1941  $ilToolbar->addInputItem($si, true);
1942 
1943  $ilToolbar->addFormButton($lng->txt("upload"), "uploadSubtitleFile");
1944 
1945  $ilToolbar->addSeparator();
1946  $ilToolbar->addFormButton($lng->txt("mob_upload_multi_srt"), "uploadMultipleSubtitleFileForm");
1947 
1948  include_once("./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1949  $tab = new ilMobSubtitleTableGUI($this, "listSubtitleFiles", $this->object);
1950 
1951  $tpl->setContent($tab->getHTML());
1952  }
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
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:

◆ removeFullscreenObject()

ilObjMediaObjectGUI::removeFullscreenObject ( )

remove fullscreen view

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

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

◆ resizeImagesObject()

ilObjMediaObjectGUI::resizeImagesObject ( )

resize images to specified size

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

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

834  {
835  // directory
836  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
837 
838  // standard item
839  $std_item =& $this->object->getMediaItem("Standard");
840  if ($std_item->getLocationType() == "LocalFile" &&
841  is_int(strpos($std_item->getFormat(), "image"))
842  )
843  {
844  $file = $mob_dir."/".$std_item->getLocation();
845  $location = ilObjMediaObject::_resizeImage($file, $std_item->getWidth(),
846  $std_item->getHeight());
847  $std_item->setLocation($location);
848  $std_item->update();
849  }
850 
851  // fullscreen item
852  if($this->object->hasFullScreenItem())
853  {
854  $full_item =& $this->object->getMediaItem("Fullscreen");
855  if ($full_item->getLocationType() == "LocalFile" &&
856  is_int(strpos($full_item->getFormat(), "image"))
857  )
858  {
859  $file = $mob_dir."/".$full_item->getLocation();
860  $location = ilObjMediaObject::_resizeImage($file, $full_item->getWidth(),
861  $full_item->getHeight());
862  $full_item->setLocation($location);
863  $full_item->update();
864  }
865  }
866 
867  $this->ctrl->redirect($this, "edit");
868  }
print $file
$location
Definition: buildRTE.php:44
_resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ returnToContextObject()

ilObjMediaObjectGUI::returnToContextObject ( )

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

128  {
129  $this->ctrl->returnToParent($this);
130  }

◆ saveMultiSrtObject()

ilObjMediaObjectGUI::saveMultiSrtObject ( )

Save selected srt files as new srt files.

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

References $_POST, and $ilCtrl.

2090  {
2091  global $ilCtrl;
2092  $srt_files = $this->object->getMultiSrtFiles();
2093  if (is_array($_POST["file"]))
2094  {
2095  foreach ($_POST["file"] as $f)
2096  {
2097  foreach ($srt_files as $srt_file)
2098  {
2099  if ($f == $srt_file["filename"])
2100  {
2101  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir()."/".$srt_file["filename"], $srt_file["lang"], "rename");
2102  }
2103  }
2104  }
2105  }
2106  $this->object->clearMultiSrtDirectory();
2107  $ilCtrl->redirect($this, "listSubtitleFiles");
2108  }
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18

◆ saveObject()

ilObjMediaObjectGUI::saveObject ( )

create new media object in dom and update page in db

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

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

597  {
598  global $tpl, $lng;
599 
600  $this->initForm();
601  if ($this->form_gui->checkInput())
602  {
603  $this->object = new ilObjMediaObject();
605  ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
606  return $this->object;
607  }
608  else
609  {
610  $this->form_gui->setValuesByPost();
611  $tpl->setContent($this->form_gui->getHTML());
612  return false;
613  }
614  }
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 917 of file class.ilObjMediaObjectGUI.php.

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

918  {
919  global $lng, $tpl;
920 
921  $this->initForm("edit");
922  if ($this->form_gui->checkInput())
923  {
924  $title = trim($_POST["standard_title"]);
925  $this->object->setTitle($title);
926 
927  $std_item = $this->object->getMediaItem("Standard");
928  $location = $std_item->getLocation();
929  $format = $std_item->getFormat();
930  if ($_POST["standard_type"] == "Reference")
931  {
932  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
933  $std_item->setFormat($format);
934  $std_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
935  $std_item->setLocationType("Reference");
936  }
937  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
938  if ($_POST["standard_type"] == "File")
939  {
940  $resize = false;
941  if ($_FILES['standard_file']['name'] != "")
942  {
943  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
944  $file = $mob_dir."/".$file_name;
945  ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'],
946  $file_name, $file);
947 
948  // get mime type
950  $location = $file_name;
951 
952  $resize = true;
953  }
954  else if ($_POST["standard_resize"])
955  {
956  $file = $mob_dir."/".$location;
957  $resize = true;
958  }
959 
960  // resize
961  if ($resize)
962  {
963  if ($_POST["standard_size"] != "original" &&
964  is_int(strpos($format, "image")))
965  {
966  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["standard_width_height"]["width"],
967  (int) $_POST["standard_width_height"]["height"], (boolean) $_POST["standard_width_height"]["contr_prop"]);
968  }
969  $std_item->setFormat($format);
970  $std_item->setLocation($location);
971  }
972 
973  $std_item->setLocationType("LocalFile");
974  }
975  $this->object->setDescription($format);
976 
977  // determine width and height of known image types
979  $_POST["standard_type"], $mob_dir."/".$location, $std_item->getLocation(),
980  $_POST["standard_width_height"]["constr_prop"], ($_POST["standard_size"] == "original"),
981  $_POST["standard_width_height"]["width"], $_POST["standard_width_height"]["height"]);
982  if ($wh["info"] != "")
983  {
984  ilUtil::sendInfo($wh["info"], true);
985  }
986 
987  $std_item->setWidth($wh["width"]);
988  $std_item->setHeight($wh["height"]);
989 
990  // set caption
991  $std_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
992 
993  // text representation
994  $std_item->setTextRepresentation(ilUtil::stripSlashes($_POST["text_representation"]));
995 
996  // set parameters
997  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
998  {
999  if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
1000  $std_item->getFormat()))
1001  {
1002  if ($_POST["standard_autostart"]) // save only autostart flag
1003  {
1004  $std_item->setParameters('autostart="true"');
1005  }
1006  else
1007  {
1008  $std_item->setParameters("");
1009  }
1010  }
1011  else
1012  {
1013  $std_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_parameters"])));
1014  }
1015  }
1016 
1017  // "None" selected
1018  if ($_POST["full_type"] == "None")
1019  {
1020  if ($this->object->hasFullscreenItem()) // delete existing
1021  {
1022  $this->object->removeMediaItem("Fullscreen");
1023  }
1024  }
1025  else // Not "None" -> we need one
1026  {
1027  if ($this->object->hasFullscreenItem()) // take existing one
1028  {
1029  $full_item = $this->object->getMediaItem("Fullscreen");
1030  }
1031  else // create one
1032  {
1033  $full_item = new ilMediaItem();
1034  $this->object->addMediaItem($full_item);
1035  $full_item->setPurpose("Fullscreen");
1036  }
1037  $location = $full_item->getLocation();
1038  $format = $full_item->getFormat();
1039  if ($_POST["full_type"] == "Reference")
1040  {
1041  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["full_reference"]), true);
1042  $full_item->setFormat($format);
1043  $full_item->setLocationType("Reference");
1044  $location = ilUtil::stripSlashes($_POST["full_reference"]);
1045  $type = "Reference";
1046  }
1047  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1048  if ($_POST["full_type"] == "File")
1049  {
1050  $resize = false;
1051  if ($_FILES['full_file']['name'] != "")
1052  {
1053  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1054  $file = $mob_dir."/".$full_file_name;
1055  ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'],
1056  $full_file_name, $file);
1057 
1059  $location = $full_file_name;
1060 
1061  $resize = true;
1062  }
1063  else if ($_POST["full_resize"])
1064  {
1065  $file = $mob_dir."/".$location;
1066  $resize = true;
1067  }
1068 
1069  // resize
1070  if ($resize)
1071  {
1072  if ($_POST["full_size"] != "original" &&
1073  is_int(strpos($format, "image")))
1074  {
1075  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["full_width_height"]["width"],
1076  (int) $_POST["full_width_height"]["height"], (boolean) $_POST["full_width_height"]["contr_prop"]);
1077  }
1078  $full_item->setFormat($format);
1079  $full_item->setLocation($location);
1080  }
1081 
1082  $full_item->setLocationType("LocalFile");
1083  $type = "File";
1084  }
1085  if ($_POST["full_type"] == "Standard")
1086  {
1087  $format = $std_item->getFormat();
1088  $location = $std_item->getLocation();
1089  $full_item->setLocationType($std_item->getLocationType());
1090  $full_item->setFormat($format);
1091  $full_item->setLocation($location);
1092  $type = $std_item->getLocationType();
1093  if ($type == "LocalFile")
1094  {
1095  $type = "File";
1096  }
1097  // resize image
1098 //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1099  if ($_POST["full_size"] != "original" &&
1100  is_int(strpos($format, "image")) &&
1101  $full_item->getLocationType() == "LocalFile")
1102  {
1103  $file = $mob_dir."/".$location;
1104  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["full_width_height"]["width"],
1105  (int) $_POST["full_width_height"]["height"], (boolean) $_POST["full_width_height"]["contr_prop"]);
1106  }
1107  }
1108 
1109  // determine width and height of known image types
1111  $type, $mob_dir."/".$location, $full_item->getLocation(),
1112  $_POST["full_width_height"]["constr_prop"], ($_POST["full_size"] == "original"),
1113  $_POST["full_width_height"]["width"], $_POST["full_width_height"]["height"]);
1114  if ($wh["info"] != "")
1115  {
1116  ilUtil::sendInfo($wh["info"], true);
1117  }
1118 
1119  $full_item->setWidth($wh["width"]);
1120  $full_item->setHeight($wh["height"]);
1121  $full_item->setLocation($location);
1122 
1123  $full_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1124 
1125  // text representation
1126  $full_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1127 
1128 
1129  // set parameters
1130  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
1131  {
1132  if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
1133  $std_item->getFormat()))
1134  {
1135  if ($_POST["full_autostart"]) // save only autostart flag
1136  {
1137  $full_item->setParameters('autostart="true"');
1138  }
1139  else
1140  {
1141  $full_item->setParameters("");
1142  }
1143  }
1144  else
1145  {
1146  $full_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])));
1147  }
1148  }
1149  }
1150 
1152  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1153  ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
1154 
1155  $this->object->update();
1156  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1157  $this->ctrl->redirect($this, "edit");
1158  }
1159  else
1160  {
1161  $this->form_gui->setValuesByPost();
1162  $tpl->setContent($this->form_gui->getHTML());
1163  }
1164  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
$_POST['username']
Definition: cron.php:12
static sanitizeDir($a_path)
Sanitize directory recursively.
$location
Definition: buildRTE.php:44
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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.
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static secureLink($a_str)
static getMimeType($a_file, $a_external=false)
get mime type for file
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.
_resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
_getDirectory($a_mob_id)
get directory for files of media object (static)
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 202 of file class.ilObjMediaObjectGUI.php.

Referenced by ilPCMediaObjectGUI\executeCommand().

203  {
204  $this->back_title = $a_title;
205  }
+ 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 54 of file class.ilObjMediaObjectGUI.php.

55  {
56  $this->enabledmapareas = $a_enabledmapareas;
57  }

◆ setHeader()

ilObjMediaObjectGUI::setHeader (   $a_title = "")

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

40  {
41  $this->header = $a_title;
42  }

◆ setHeightPreset()

ilObjMediaObjectGUI::setHeightPreset (   $a_val)

Set height preset.

Parameters
intheight preset

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

95  {
96  $this->height_preset = $a_val;
97  }

◆ setObjectPerCreationForm()

static ilObjMediaObjectGUI::setObjectPerCreationForm (   $a_mob)
static

Set media object values from creation form.

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

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

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

637  {
638  // determinte title and format
639  if (trim($_POST["standard_title"]) != "")
640  {
641  $title = trim($_POST["standard_title"]);
642  }
643  else
644  {
645  if ($_POST["standard_type"] == "File")
646  {
647  $title = $_FILES['standard_file']['name'];
648  }
649  else
650  {
651  $title = ilUtil::stripSlashes($_POST["standard_reference"]);
652  }
653  }
654 
655  $a_mob->setTitle($title);
656  $a_mob->setDescription("");
657  $a_mob->create();
658 
659  // determine and create mob directory, move uploaded file to directory
660  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
661  $a_mob->createDirectory();
662  $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
663 
664  $media_item =& new ilMediaItem();
665  $a_mob->addMediaItem($media_item);
666  $media_item->setPurpose("Standard");
667 
668  if ($_POST["standard_type"] == "File")
669  {
670  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
671  $file = $mob_dir."/".$file_name;
672  ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'],
673  $file_name, $file);
674 
675  // get mime type
677  $location = $file_name;
678 
679  // resize standard images
680  if ($_POST["standard_size"] != "original" &&
681  is_int(strpos($format, "image")))
682  {
683  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["standard_width_height"]["width"],
684  (int) $_POST["standard_width_height"]["height"], (boolean) $_POST["standard_width_height"]["contr_prop"]);
685  }
686 
687  // set real meta and object data
688  $media_item->setFormat($format);
689  $media_item->setLocation($location);
690  $media_item->setLocationType("LocalFile");
691  }
692  else // standard type: reference
693  {
694  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
695  $media_item->setFormat($format);
696  $media_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
697  $media_item->setLocationType("Reference");
698  }
699  $a_mob->setDescription($format);
700 
701  // determine width and height of known image types
703  $_POST["standard_type"], $mob_dir."/".$location, $media_item->getLocation(),
704  $_POST["standard_width_height"]["constr_prop"], ($_POST["standard_size"] == "original"),
705  $_POST["standard_width_height"]["width"], $_POST["standard_width_height"]["height"]);
706  $media_item->setWidth($wh["width"]);
707  $media_item->setHeight($wh["height"]);
708  if ($wh["info"] != "")
709  {
710  ilUtil::sendInfo($wh["info"], true);
711  }
712 
713  if ($_POST["standard_caption"] != "")
714  {
715  $media_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
716  }
717 
718 
719  $media_item->setHAlign("Left");
720 
721  // fullscreen view
722  if ($_POST["full_type"] != "None")
723  {
724  $media_item2 = new ilMediaItem();
725  $a_mob->addMediaItem($media_item2);
726  $media_item2->setPurpose("Fullscreen");
727 
728  // move file / set format and location
729  if ($_POST["full_type"] == "File")
730  {
731  $format = $location = "";
732  if ($_FILES['full_file']['name'] != "")
733  {
734  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
735  $file = $mob_dir."/".$full_file_name;
736  ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'],
737  $full_file_name, $file);
739  $location = $full_file_name;
740  }
741  }
742  else if ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File")
743  {
744  $location = $file_name;
745  }
746 
747  // resize file
748  if ($_POST["full_type"] == "File" ||
749  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File"))
750  {
751  if (($_POST["full_size"] != "original" &&
752  is_int(strpos($format, "image")))
753  )
754  {
755  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["full_width_height"]["width"],
756  (int) $_POST["full_width_height"]["height"], (boolean) $_POST["full_width_height"]["constr_prop"]);
757  }
758 
759  $media_item2->setFormat($format);
760  $media_item2->setLocation($location);
761  $media_item2->setLocationType("LocalFile");
762  $type = "File";
763  }
764 
765  if ($_POST["full_type"] == "Reference")
766  {
767  $format = $location = "";
768  if ($_POST["full_reference"] != "")
769  {
770  $format = ilObjMediaObject::getMimeType($_POST["full_reference"], true);
771  $location = ilUtil::stripSlashes($_POST["full_reference"]);
772  }
773  }
774 
775  if ($_POST["full_type"] == "Reference" ||
776  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "Reference"))
777  {
778  $media_item2->setFormat($format);
779  $media_item2->setLocation($location);
780  $media_item2->setLocationType("Reference");
781  $type = "Reference";
782  }
783 
784  // determine width and height of known image types
786  $type, $mob_dir."/".$location, $media_item2->getLocation(),
787  $_POST["full_width_height"]["constr_prop"], ($_POST["full_size"] == "original"),
788  $_POST["full_width_height"]["width"], $_POST["full_width_height"]["height"]);
789 
790  $media_item2->setWidth($wh["width"]);
791  $media_item2->setHeight($wh["height"]);
792 
793  if ($_POST["full_caption"] != "")
794  {
795  $media_item2->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
796  }
797 
798  }
799 
801  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
802  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
803  $a_mob->update();
804  }
print $file
$_POST['username']
Definition: cron.php:12
static sanitizeDir($a_path)
Sanitize directory recursively.
$location
Definition: buildRTE.php:44
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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.
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static secureLink($a_str)
static getMimeType($a_file, $a_external=false)
get mime type for file
_resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ 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 1894 of file class.ilObjMediaObjectGUI.php.

References $ilCtrl, and ilObjectGUI\$lng.

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

1895  {
1896  global $ilTabs, $ilCtrl, $lng;
1897 
1898  $ilTabs->activateTab("cont_mob_def_prop");
1899 
1900  $ilTabs->addSubTab("general",
1901  $lng->txt("mob_general"),
1902  $ilCtrl->getLinkTarget($this, "edit"));
1903 
1904  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1905  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4")
1906  {
1907  $ilTabs->addSubTab("subtitles",
1908  $lng->txt("mob_subtitles"),
1909  $ilCtrl->getLinkTarget($this, "listSubtitleFiles"));
1910  }
1911 
1912  $ilTabs->activateSubTab($a_active);
1913  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ setTabs()

ilObjMediaObjectGUI::setTabs ( )

set admin tabs

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

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

1737  {
1738 //echo "setAdminTabs should not be called.";
1739 
1740  // catch feedback message
1741  $this->getTabs($this->tabs_gui);
1742 
1743  //$tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
1744  $this->tpl->clearHeader();
1745  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject")
1746  {
1747  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1748  $this->tpl->setTitle($this->object->getTitle());
1749  }
1750  else
1751  {
1752  //$title = $this->object->getTitle();
1753  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1754  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1755  }
1756  }
getTabs(&$tabs_gui)
Get Tabs.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ setWidthPreset()

ilObjMediaObjectGUI::setWidthPreset (   $a_val)

Set width preset.

Parameters
intwidth preset

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

75  {
76  $this->width_preset = $a_val;
77  }

◆ showAllUsagesObject()

ilObjMediaObjectGUI::showAllUsagesObject ( )

Show all media object usages (incl history)

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

References showUsagesObject().

1600  {
1601  $this->showUsagesObject(true);
1602  }
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 2066 of file class.ilObjMediaObjectGUI.php.

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

2067  {
2068  global $tpl;
2069 
2070  $this->setPropertiesSubTabs("subtitles");
2071 
2072  include_once("./Services/MediaObjects/classes/class.ilMultiSrtConfirmationTable2GUI.php");
2073  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
2074  $tpl->setContent($tab->getHTML());
2075  }
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 1608 of file class.ilObjMediaObjectGUI.php.

References $cmd, $ilCtrl, ilObjectGUI\$lng, and ilObjectGUI\$tpl.

Referenced by showAllUsagesObject().

1609  {
1610  global $tpl, $ilTabs, $ilTabs, $lng, $ilCtrl;
1611 
1612  $ilTabs->addSubTab("current_usages", $lng->txt("cont_current_usages"),
1613  $ilCtrl->getLinkTarget($this, "showUsages"));
1614 
1615  $ilTabs->addSubTab("all_usages", $lng->txt("cont_all_usages"),
1616  $ilCtrl->getLinkTarget($this, "showAllUsages"));
1617 
1618  if ($a_all)
1619  {
1620  $ilTabs->activateSubTab("all_usages");
1621  $cmd = "showAllUsages";
1622  }
1623  else
1624  {
1625  $ilTabs->activateSubTab("current_usages");
1626  $cmd = "showUsages";
1627  }
1628 
1629  include_once("./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1630  $usages_table = new ilMediaObjectUsagesTableGUI($this, $cmd,
1631  $this->object, $a_all);
1632  $tpl->setContent($usages_table->getHTML());
1633  }
TableGUI class for media object usages listing.
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ showVideoToolObject()

ilObjMediaObjectGUI::showVideoToolObject ( )

Show video tools.

Parameters

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

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

1852  {
1853  global $tpl;
1854 
1855  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1856 
1857  /*$codecs = ilFFmpeg::getSupportedCodecsInfo();
1858  $codec_str = implode($codecs, "<br />");
1859  $tpl->setContent($codec_str);*/
1860 
1861  $formats = ilFFmpeg::getSupportedFormatsInfo();
1862  $formats_str = implode($formats, "<br />");
1863  $tpl->setContent($formats_str);
1864  }
static getSupportedFormatsInfo()
Get all supported formats.
+ Here is the call graph for this function:

◆ uploadFileObject()

ilObjMediaObjectGUI::uploadFileObject ( )

upload file

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

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

1381  {
1382  // determine directory
1383  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1384  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1385  $cur_dir = (!empty($cur_subdir))
1386  ? $mob_dir."/".$cur_subdir
1387  : $mob_dir;
1388  if (is_file($_FILES["new_file"]["tmp_name"]))
1389  {
1390  $file_name = ilObjMediaObject::fixFilename($_FILES["new_file"]["name"]);
1391  $file = $cur_dir."/".$file_name;
1392  ilUtil::moveUploadedFile($_FILES['new_file']['tmp_name'],
1393  $file_name, $file);
1394 
1395  }
1397  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1398  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1399 
1400  $this->ctrl->saveParameter($this, "cdir");
1401  $this->ctrl->redirect($this, "editFiles");
1402  }
print $file
static sanitizeDir($a_path)
Sanitize directory recursively.
$_GET["client_id"]
static renameExecutables($a_dir)
Rename executables.
static fixFilename($a_name)
Fix filename of uploaded file.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
if(!file_exists(getcwd().'/ilias.ini.php')) if(isset( $_GET["client_id"]))
registration confirmation script for ilias
Definition: confirmReg.php:20
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 2027 of file class.ilObjMediaObjectGUI.php.

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

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

◆ uploadMultipleSubtitleFileObject()

ilObjMediaObjectGUI::uploadMultipleSubtitleFileObject ( )

Upload multiple subtitles.

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

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

2049  {
2050  try
2051  {
2052  $this->object->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
2053  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
2054  }
2055  catch (ilMediaObjectsException $e)
2056  {
2057  ilUtil::sendFailure($e->getMessage(), true);
2058  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
2059  }
2060 
2061  }
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 1960 of file class.ilObjMediaObjectGUI.php.

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

1961  {
1962  global $lng, $ilCtrl;
1963 
1964  if ($this->object->uploadSrtFile($_FILES["subtitle_file"]["tmp_name"], ilUtil::stripSlashes($_POST["language"])))
1965  {
1966  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1967  }
1968  $ilCtrl->redirect($this, "listSubtitleFiles");
1969  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilObjMediaObjectGUI::$ctrl

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

◆ $enabledmapareas

ilObjMediaObjectGUI::$enabledmapareas = true

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

Referenced by getEnabledMapAreas().

◆ $header

ilObjMediaObjectGUI::$header

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

Referenced by getHeader().

◆ $target_script

ilObjMediaObjectGUI::$target_script

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


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