ILIAS  release_4-4 Revision
ilObjMediaObject Class Reference

Class ilObjMediaObject. More...

+ Inheritance diagram for ilObjMediaObject:
+ Collaboration diagram for ilObjMediaObject:

Public Member Functions

 ilObjMediaObject ($a_id=0)
 Constructor public. More...
 
 setRefId ()
 
 getRefId ()
 
 putInTree ()
 
 createReference ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 delete ()
 delete media object More...
 
 getDescription ()
 get description of media object More...
 
 setDescription ($a_description)
 set description of media object More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 addMediaItem ($a_item)
 add media item to media object More...
 
getMediaItems ()
 get all media items More...
 
getMediaItem ($a_purpose)
 get item for media purpose More...
 
 removeMediaItem ($a_purpose)
 
 removeAllMediaItems ()
 remove all media items More...
 
 getMediaItemNr ($a_purpose)
 
 hasFullscreenItem ()
 
 hasPurposeItem ($purpose)
 returns wether object has media item with specific purpose More...
 
 read ()
 read media object data from db More...
 
 setId ($a_id)
 set id More...
 
 getId ()
 
 setAlias ($a_is_alias)
 set wether page object is an alias More...
 
 isAlias ()
 
 setOriginID ($a_id)
 
 getOriginID ()
 
 getImportId ()
 get import id More...
 
 setImportId ($a_id)
 
 create ($a_create_meta_data=false, $a_save_media_items=true)
 create media object in db More...
 
 update ($a_upload=false)
 update media object in db More...
 
 _getDirectory ($a_mob_id)
 get directory for files of media object (static) More...
 
 _getURL ($a_mob_id)
 get directory for files of media object (static) More...
 
 _getThumbnailDirectory ($a_mob_id, $a_mode="filesystem")
 get directory for files of media object (static) More...
 
 createDirectory ()
 Create file directory of media object. More...
 
 _createThumbnailDirectory ($a_obj_id)
 Create thumbnail directory. More...
 
 getFilesOfDirectory ($a_subdir="")
 Get files of directory. More...
 
 getXML ($a_mode=IL_MODE_FULL, $a_inst=0)
 get MediaObject XLM Tag More...
 
 handleAmps ($a_str)
 Replace "&" (if not an "&") with "&". More...
 
 exportXML (&$a_xml_writer, $a_inst=0)
 export XML More...
 
 exportFiles ($a_target_dir)
 export all media files of object to target directory note: target directory must be the export target directory, "/objects/il_<inst>_mob_<mob_id>/..." will be appended to this directory More...
 
 exportMediaFullscreen ($a_target_dir, $pg_obj)
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 
 setContainsIntLink ($a_contains_link)
 content parser set this flag to true, if the media object contains internal links (this method should only be called by the import parser) More...
 
 containsIntLink ()
 returns true, if mob was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser) More...
 
 _deleteAllUsages ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 static More...
 
 _getMobsOfObject ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 get mobs of object More...
 
 _saveUsage ($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 Save usage of mob within another container (e.g. More...
 
 _removeUsage ($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 Remove usage of mob in another container. More...
 
 getUsages ($a_include_history=true)
 get all usages of current media object More...
 
 lookupUsages ($a_id, $a_include_history=true)
 Lookup usages of media object. More...
 
 getParentObjectIdForUsage ($a_usage, $a_include_all_access_obj_ids=false)
 Get's the repository object ID of a parent object, if possible. More...
 
 _resizeImage ($a_file, $a_width, $a_height, $a_constrain_prop=false)
 resize image and return new image file ("_width_height" string appended) More...
 
 getDataDirectory ()
 
_saveTempFileAsMediaObject ($name, $tmp_name, $upload=TRUE)
 Create new media object and update page in db and return new media object. More...
 
 uploadAdditionalFile ($a_name, $tmp_name, $a_subdir="")
 Create new media object and update page in db and return new media object. More...
 
 uploadSrtFile ($a_tmp_name, $a_language)
 Upload srt file. More...
 
 getSrtFiles ()
 Get srt files. More...
 
 makeThumbnail ($a_file, $a_thumbname, $a_format="png", $a_size="80")
 Make thumbnail. More...
 
 removeAdditionalFile ($a_file)
 Remove additional file. More...
 
 getLinkedMediaObjects ($a_ignore="")
 Get all media objects linked in map areas of this media object. More...
 
 duplicate ()
 Duplicate media object, return new media object. More...
 
 uploadVideoPreviewPic ($a_prevpic)
 Upload video preview picture. More...
 
 generatePreviewPic ($a_width, $a_height)
 Upload video preview picture. More...
 
 getVideoPreviewPic ($a_filename_only=false)
 Get video preview pic. More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 createRoleFolder ()
 creates a local role folder More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Static Public Member Functions

static _exists ($a_id)
 checks wether a lm content object with specified id exists or not More...
 
static _lookupStandardItemPath ($a_mob_id, $a_url_encode=false, $a_web=true)
 Get path for standard item. More...
 
static _lookupItemPath ($a_mob_id, $a_url_encode=false, $a_web=true, $a_purpose="")
 Get path for item with specific purpose. More...
 
static getMimeType ($a_file)
 get mime type for file More...
 
static _determineWidthHeight ($a_def_width, $a_def_height, $a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
 Determine width and height. More...
 
static _getSimpleMimeTypes ()
 Get simple mime types that deactivate parameter property files tab in ILIAS. More...
 
static _useAutoStartParameterOnly ($a_loc, $a_format)
 Check whether only autostart parameter should be supported (instead of parameters input field. More...
 
static getThumbnailPath ($a_mob_id, $a_thumbname)
 Get thumbnail path. More...
 
static getRestrictedFileTypes ()
 Get restricted file types. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $is_alias
 
 $origin_id
 
 $id
 
 $media_items
 
 $contains_int_link
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 
 $obj_data_record
 object_data record More...
 

Static Protected Member Functions

static handleQuotaUpdate (ilObjMediaObject $a_mob)
 

Detailed Description

Class ilObjMediaObject.

Todo: this class must be integrated with group/folder handling

ILIAS Media Object

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ _createThumbnailDirectory()

ilObjMediaObject::_createThumbnailDirectory (   $a_obj_id)

Create thumbnail directory.

Definition at line 611 of file class.ilObjMediaObject.php.

References ilUtil\createDirectory(), and ilUtil\getWebspaceDir().

Referenced by ilMediaItem\getThumbnailTarget(), and ilMediaObjectDataSet\importRecord().

612  {
614  ilUtil::createDirectory(ilUtil::getWebspaceDir()."/thumbs/mm_".$a_obj_id);
615  }
static createDirectory($a_dir, $a_mod=0755)
create directory
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteAllUsages()

ilObjMediaObject::_deleteAllUsages (   $a_type,
  $a_id,
  $a_usage_hist_nr = 0,
  $a_lang = "-" 
)

static

Definition at line 984 of file class.ilObjMediaObject.php.

References $row.

Referenced by ilPCMediaObject\beforePageDelete(), ilPageObject\delete(), and ilPCMediaObject\saveMobUsage().

985  {
986  global $ilDB;
987 
988  $and_hist = "";
989  if ($a_usage_hist_nr !== false)
990  {
991  $and_hist = " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
992  }
993 
994  $mob_ids = array();
995  $set = $ilDB->query("SELECT id FROM mob_usage".
996  " WHERE usage_type = ".$ilDB->quote($a_type, "text").
997  " AND usage_id = ".$ilDB->quote($a_id, "integer").
998  " AND usage_lang = ".$ilDB->quote($a_lang, "text").
999  $and_hist);
1000  while($row = $ilDB->fetchAssoc($set))
1001  {
1002  $mob_ids[] = $row["id"];
1003  }
1004 
1005  $q = "DELETE FROM mob_usage WHERE usage_type = ".
1006  $ilDB->quote($a_type, "text").
1007  " AND usage_id= ".$ilDB->quote($a_id, "integer").
1008  " AND usage_lang = ".$ilDB->quote($a_lang, "text").
1009  $and_hist;
1010  $ilDB->manipulate($q);
1011 
1012  foreach($mob_ids as $mob_id)
1013  {
1014  self::handleQuotaUpdate(new self($mob_id));
1015  }
1016  }
+ Here is the caller graph for this function:

◆ _determineWidthHeight()

static ilObjMediaObject::_determineWidthHeight (   $a_def_width,
  $a_def_height,
  $a_format,
  $a_type,
  $a_file,
  $a_reference,
  $a_constrain_proportions,
  $a_use_original,
  $a_user_width,
  $a_user_height 
)
static

Determine width and height.

Definition at line 1448 of file class.ilObjMediaObject.php.

References ilObject\$lng, $r, $size, and ilUtil\deducibleSize().

Referenced by ilObjMediaPoolGUI\createMediaFromUploadDir(), ilDataCollectionDatatype\parseValue(), ilObjMediaObjectGUI\savePropertiesObject(), and ilObjMediaObjectGUI\setObjectPerCreationForm().

1451  {
1452  global $lng;
1453 
1454  // determine width and height of known image types
1455  $width = $a_def_width;
1456  $height = $a_def_height;
1457  $info = "";
1458 
1459  if ($a_format == "audio/mpeg")
1460  {
1461  $width = 300;
1462  $height = 20;
1463  }
1464 
1465  if (ilUtil::deducibleSize($a_format))
1466  {
1467  if ($a_type == "File")
1468  {
1469  $size = @getimagesize($a_file);
1470  }
1471  else
1472  {
1473  $size = @getimagesize($a_reference);
1474  }
1475  }
1476 
1477  if ($a_use_original)
1478  {
1479  if ($size[0] > 0 && $size[1] > 0)
1480  {
1481  $width = $size[0];
1482  $height = $size[1];
1483  }
1484  else
1485  {
1486  $info = $lng->txt("cont_could_not_determine_resource_size");
1487  }
1488  }
1489  else
1490  {
1491  $w = (int) $a_user_width;
1492  $h = (int) $a_user_height;
1493  $width = $w;
1494  $height = $h;
1495 //echo "<br>C-$width-$height-";
1496  if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions)
1497  {
1498  if ($size[0] > 0 && $size[1] > 0)
1499  {
1500  if ($w > 0)
1501  {
1502  $wr = $size[0] / $w;
1503  }
1504  if ($h > 0)
1505  {
1506  $hr = $size[1] / $h;
1507  }
1508 //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1509 //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1510  $r = max($wr, $hr);
1511  if ($r > 0)
1512  {
1513  $width = (int) ($size[0]/$r);
1514  $height = (int) ($size[1]/$r);
1515  }
1516  }
1517  }
1518 //echo "<br>D-$width-$height-";
1519  }
1520 //echo "<br>E-$width-$height-";
1521  return array("width" => $width, "height" => $height, "info" => $info);
1522  }
$size
Definition: RandomTest.php:79
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _exists()

static ilObjMediaObject::_exists (   $a_id)
static

checks wether a lm content object with specified id exists or not

Parameters
int$idid
Returns
boolean true, if lm content object exists

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

References ilInternalLink\_extractObjIdOfTarget().

Referenced by ilInternalLink\_exists(), ilRTE\_getMediaObjects(), ilRTE\_replaceMediaObjectImageSrc(), assQuestion\addQTIMaterial(), ilObjTest\addQTIMaterial(), assQuestion\delete(), ilForum\deletePost(), ilObjTest\deleteTest(), ilQuestionpoolExport\exportXHTMLMediaObjects(), ilTestExport\exportXHTMLMediaObjects(), ilObjQuestionPool\exportXMLMediaObjects(), ilObjTest\exportXMLMediaObjects(), ilObjForumGUI\getReplyEditForm(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjForumGUI\setTopicCreateDefaultValues(), ilObjForumGUI\setTreeStateAsynchObject(), ilForumXMLWriter\start(), and ilObjExerciseGUI\updateAssignmentTextObject().

85  {
86  global $ilDB;
87 
88  include_once("./Services/COPage/classes/class.ilInternalLink.php");
89  if (is_int(strpos($a_id, "_")))
90  {
92  }
93 
94  return parent::_exists($a_id, false);
95  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDirectory()

ilObjMediaObject::_getDirectory (   $a_mob_id)

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

Definition at line 538 of file class.ilObjMediaObject.php.

References ilUtil\getWebspaceDir().

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML(), ilObjMediaCastAccess\_lookupDiskUsage(), _saveTempFileAsMediaObject(), ilObjMediaCastGUI\convertFileObject(), ilPCInteractiveImageGUI\create(), createDirectory(), ilObjMediaPoolGUI\createMediaFromUploadDir(), ilSCORM13Package\dbImportSco(), delete(), ilNewsItem\deliverMobFile(), ilObjMediaCastGUI\determinePlaytimeObject(), duplicate(), ilObjMediaCastGUI\extractPreviewImageObject(), ilPDNewsTableGUI\fillRow(), generatePreviewPic(), ilMediaItem\getDirectory(), getFilesOfDirectory(), ilObjMediaObjectGUI\getFullscreenSizeObject(), ilMediaItem\getOriginalSize(), ilPortfolioTemplatePage\getPageDiskSize(), getSrtFiles(), ilObjMediaObjectGUI\getStandardSizeObject(), getVideoPreviewPic(), ilMediaObjectDataSet\getXmlRecord(), ilMediaObjectDataSet\importRecord(), makeThumbnail(), ilDataCollectionDatatype\parseHTML(), ilDataCollectionDatatype\parseValue(), removeAdditionalFile(), ilObjMediaObjectGUI\resizeImagesObject(), ilObjMediaObjectGUI\savePropertiesObject(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), and uploadAdditionalFile().

539  {
540  return ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id;
541  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMobsOfObject()

ilObjMediaObject::_getMobsOfObject (   $a_type,
  $a_id,
  $a_usage_hist_nr = 0,
  $a_lang = "-" 
)

get mobs of object

Definition at line 1021 of file class.ilObjMediaObject.php.

References $mobs, and ilObject\_lookupType().

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), assQuestion\addQTIMaterial(), ilObjTest\addQTIMaterial(), ilPCMediaObject\afterPageUpdate(), ilPCMediaObject\beforePageDelete(), ilCOPageHTMLExport\collectPageElements(), SurveyQuestion\copyXHTMLMediaObjectsOfQuestion(), assQuestion\copyXHTMLMediaObjectsOfQuestion(), SurveyQuestion\delete(), assQuestion\delete(), ilForum\deletePost(), ilObjSurvey\deleteSurveyRecord(), ilObjTest\deleteTest(), ilObjGlossary\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLPages(), ilSurveyExport\exportXHTMLMediaObjects(), ilQuestionpoolExport\exportXHTMLMediaObjects(), ilTestExport\exportXHTMLMediaObjects(), ilPageObject\getLastUpdateOfIncludedElements(), ilSoapUtils\getMobsOfObject(), ilObjForumGUI\getReplyEditForm(), ilCOPageExporter\getXmlExportHeadDependencies(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjForumGUI\setTreeStateAsynchObject(), ilForumXMLWriter\start(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), assOrderingHorizontal\toJSON(), assTextSubset\toJSON(), assImagemapQuestion\toJSON(), assSingleChoice\toJSON(), assMultipleChoice\toJSON(), assOrderingQuestion\toJSON(), assErrorText\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

1022  {
1023  global $ilDB;
1024 
1025  $q = "SELECT * FROM mob_usage WHERE ".
1026  "usage_type = ".$ilDB->quote($a_type, "text")." AND ".
1027  "usage_id = ".$ilDB->quote($a_id, "integer")." AND ".
1028  "usage_lang = ".$ilDB->quote($a_lang, "text")." AND ".
1029  "usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
1030  $mobs = array();
1031  $mob_set = $ilDB->query($q);
1032  while($mob_rec = $ilDB->fetchAssoc($mob_set))
1033  {
1034  if (ilObject::_lookupType($mob_rec["id"]) == "mob")
1035  {
1036  $mobs[$mob_rec["id"]] = $mob_rec["id"];
1037  }
1038  }
1039 
1040  return $mobs;
1041  }
$mobs
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSimpleMimeTypes()

static ilObjMediaObject::_getSimpleMimeTypes ( )
static

Get simple mime types that deactivate parameter property files tab in ILIAS.

Definition at line 1528 of file class.ilObjMediaObject.php.

Referenced by ilObjMediaObjectGUI\getTabs(), ilPCMediaObjectGUI\initAliasForm(), ilObjMediaObjectGUI\initForm(), and ilObjMediaObjectGUI\savePropertiesObject().

1529  {
1530  return array("image/x-ms-bmp", "image/gif", "image/jpeg", "image/x-portable-bitmap",
1531  "image/png", "image/psd", "image/tiff", "application/pdf");
1532  }
+ Here is the caller graph for this function:

◆ _getThumbnailDirectory()

ilObjMediaObject::_getThumbnailDirectory (   $a_mob_id,
  $a_mode = "filesystem" 
)

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

Definition at line 558 of file class.ilObjMediaObject.php.

References ilUtil\getWebspaceDir().

Referenced by delete(), duplicate(), ilMediaItem\getThumbnailDirectory(), getThumbnailPath(), and makeThumbnail().

559  {
560  return ilUtil::getWebspaceDir($a_mode)."/thumbs/mm_".$a_mob_id;
561  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getURL()

ilObjMediaObject::_getURL (   $a_mob_id)

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

Definition at line 548 of file class.ilObjMediaObject.php.

References ilUtil\getHtmlPath(), and ilUtil\getWebspaceDir().

Referenced by ilMediaCastTableGUI\fillRow(), ilObjMediaCastGUI\showGallery(), and ilNewsForContextBlockGUI\showNews().

549  {
550  return ilUtil::getHtmlPath(ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id);
551  }
static getHtmlPath($relative_path)
get url of path
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupItemPath()

static ilObjMediaObject::_lookupItemPath (   $a_mob_id,
  $a_url_encode = false,
  $a_web = true,
  $a_purpose = "" 
)
static

Get path for item with specific purpose.

Parameters
int$a_mob_idmedia object id

Definition at line 579 of file class.ilObjMediaObject.php.

References $location, $path, and ilMediaItem\_lookupLocationForMobId().

Referenced by _lookupStandardItemPath(), ilMediaCastTableGUI\fillRow(), ilDataCollectionRecordEditGUI\getValues(), and ilObjectFeedWriter\ilObjectFeedWriter().

581  {
582  if ($a_purpose == "")
583  {
584  $a_purpose = "Standard";
585  }
586  $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
587  if (preg_match("/https?\:/i",$location))
588  return $location;
589 
590  if ($a_url_encode)
591  $location = rawurlencode($location);
592 
593  $path = ($a_web)
594  ? ILIAS_HTTP_PATH
595  : ".";
596 
597  return $path."/data/".CLIENT_ID."/mobs/mm_".$a_mob_id."/".$location;
598  }
static _lookupLocationForMobId($a_mob_id, $a_purpose)
Lookup location for mob id.
$location
Definition: buildRTE.php:44
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupStandardItemPath()

static ilObjMediaObject::_lookupStandardItemPath (   $a_mob_id,
  $a_url_encode = false,
  $a_web = true 
)
static

Get path for standard item.

Parameters
int$a_mob_idmedia object id

Definition at line 568 of file class.ilObjMediaObject.php.

References _lookupItemPath().

Referenced by ilSCORM2004ScoGUI\getExportResources().

570  {
571  return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
572  }
static _lookupItemPath($a_mob_id, $a_url_encode=false, $a_web=true, $a_purpose="")
Get path for item with specific purpose.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _removeUsage()

ilObjMediaObject::_removeUsage (   $a_mob_id,
  $a_type,
  $a_id,
  $a_usage_hist_nr = 0,
  $a_lang = "-" 
)

Remove usage of mob in another container.

Definition at line 1072 of file class.ilObjMediaObject.php.

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\delete(), assQuestion\delete(), ilForum\deletePost(), ilObjSurvey\deleteSurveyRecord(), ilObjTest\deleteTest(), ilObjForumGUI\getReplyEditForm(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjForumGUI\setTopicCreateDefaultValues(), ilObjForumGUI\setTreeStateAsynchObject(), and ilObjExerciseGUI\updateAssignmentTextObject().

1073  {
1074  global $ilDB;
1075 
1076  $q = "DELETE FROM mob_usage WHERE ".
1077  " id = ".$ilDB->quote((int) $a_mob_id, "integer")." AND ".
1078  " usage_type = ".$ilDB->quote($a_type, "text")." AND ".
1079  " usage_id = ".$ilDB->quote((int) $a_id, "integer")." AND ".
1080  " usage_lang = ".$ilDB->quote($a_lang, "text")." AND ".
1081  " usage_hist_nr = ".$ilDB->quote((int) $a_usage_hist_nr, "integer");
1082  $ilDB->manipulate($q);
1083 
1084  self::handleQuotaUpdate(new self($a_mob_id));
1085  }
+ Here is the caller graph for this function:

◆ _resizeImage()

ilObjMediaObject::_resizeImage (   $a_file,
  $a_width,
  $a_height,
  $a_constrain_prop = false 
)

resize image and return new image file ("_width_height" string appended)

Parameters
string$a_filefull file name
int$a_widthwidth
int$a_heightheight

Definition at line 1416 of file class.ilObjMediaObject.php.

References $location, and ilUtil\resizeImage().

Referenced by ilDataCollectionDatatype\parseValue(), ilObjMediaObjectGUI\resizeImagesObject(), ilObjMediaObjectGUI\savePropertiesObject(), and ilObjMediaObjectGUI\setObjectPerCreationForm().

1417  {
1418  $file_path = pathinfo($a_file);
1419  $location = substr($file_path["basename"],0,strlen($file_path["basename"]) -
1420  strlen($file_path["extension"]) - 1)."_".
1421  $a_width."_".
1422  $a_height.".".$file_path["extension"];
1423  $target_file = $file_path["dirname"]."/".
1424  $location;
1425  ilUtil::resizeImage($a_file, $target_file,
1426  (int) $a_width, (int) $a_height, $a_constrain_prop);
1427 
1428  return $location;
1429  }
$location
Definition: buildRTE.php:44
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveTempFileAsMediaObject()

& ilObjMediaObject::_saveTempFileAsMediaObject (   $name,
  $tmp_name,
  $upload = TRUE 
)

Create new media object and update page in db and return new media object.

Definition at line 1566 of file class.ilObjMediaObject.php.

References $file, $location, $size, _getDirectory(), ilUtil\deducibleSize(), getMimeType(), ilObjMediaObject(), ilUtil\moveUploadedFile(), and ilUtil\renameExecutables().

Referenced by assErrorTextImport\fromXML(), assFlashQuestionImport\fromXML(), assFileUploadImport\fromXML(), assFormulaQuestionImport\fromXML(), assOrderingQuestionImport\fromXML(), assSingleChoiceImport\fromXML(), assOrderingHorizontalImport\fromXML(), assNumericImport\fromXML(), assTextQuestionImport\fromXML(), assImagemapQuestionImport\fromXML(), assJavaAppletImport\fromXML(), assTextSubsetImport\fromXML(), assMultipleChoiceImport\fromXML(), assClozeTestImport\fromXML(), assMatchingQuestionImport\fromXML(), ilObjTest\fromXML(), ilForumXMLParser\handlerEndTag(), ilObjSurvey\importObject(), ilSurveyImporter\importXmlRepresentation(), and ilSoapUtils\saveTempFileAsMediaObject().

1567  {
1568  // create dummy object in db (we need an id)
1569  $media_object = new ilObjMediaObject();
1570  $media_object->setTitle($name);
1571  $media_object->setDescription("");
1572  $media_object->create();
1573 
1574  // determine and create mob directory, move uploaded file to directory
1575  $media_object->createDirectory();
1576  $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
1577 
1578  $media_item =& new ilMediaItem();
1579  $media_object->addMediaItem($media_item);
1580  $media_item->setPurpose("Standard");
1581 
1582  $file = $mob_dir."/".$name;
1583  if ($upload)
1584  {
1585  ilUtil::moveUploadedFile($tmp_name,$name, $file);
1586  }
1587  else
1588  {
1589  copy($tmp_name, $file);
1590  }
1591  // get mime type
1593  $location = $name;
1594  // set real meta and object data
1595  $media_item->setFormat($format);
1596  $media_item->setLocation($location);
1597  $media_item->setLocationType("LocalFile");
1598  $media_object->setTitle($name);
1599  $media_object->setDescription($format);
1600 
1601  if (ilUtil::deducibleSize($format))
1602  {
1603  $size = getimagesize($file);
1604  $media_item->setWidth($size[0]);
1605  $media_item->setHeight($size[1]);
1606  }
1607  $media_item->setHAlign("Left");
1608 
1609  ilUtil::renameExecutables($mob_dir);
1610  $media_object->update();
1611 
1612  return $media_object;
1613  }
print $file
$size
Definition: RandomTest.php:79
ilObjMediaObject($a_id=0)
Constructor public.
$location
Definition: buildRTE.php:44
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static getMimeType($a_file)
get mime type for file
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
_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:

◆ _saveUsage()

ilObjMediaObject::_saveUsage (   $a_mob_id,
  $a_type,
  $a_id,
  $a_usage_hist_nr = 0,
  $a_lang = "-" 
)

Save usage of mob within another container (e.g.

page)

Definition at line 1046 of file class.ilObjMediaObject.php.

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\copyXHTMLMediaObjectsOfQuestion(), assQuestion\copyXHTMLMediaObjectsOfQuestion(), assFileUploadImport\fromXML(), assErrorTextImport\fromXML(), assFlashQuestionImport\fromXML(), assSingleChoiceImport\fromXML(), assImagemapQuestionImport\fromXML(), assJavaAppletImport\fromXML(), assMultipleChoiceImport\fromXML(), assNumericImport\fromXML(), assOrderingHorizontalImport\fromXML(), assOrderingQuestionImport\fromXML(), assTextQuestionImport\fromXML(), assTextSubsetImport\fromXML(), assFormulaQuestionImport\fromXML(), assMatchingQuestionImport\fromXML(), ilObjTest\fromXML(), ilObjForumGUI\getReplyEditForm(), ilForumXMLParser\handlerEndTag(), ilObjSurvey\importObject(), ilSurveyImporter\importXmlRepresentation(), ilDataCollectionDatatype\parseValue(), ilPCMediaObject\saveMobUsage(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjForumGUI\setTopicCreateDefaultValues(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), and ilObjExerciseGUI\updateAssignmentTextObject().

1047  {
1048  global $ilDB;
1049 
1050  $q = "DELETE FROM mob_usage WHERE ".
1051  " id = ".$ilDB->quote((int) $a_mob_id, "integer")." AND ".
1052  " usage_type = ".$ilDB->quote($a_type, "text")." AND ".
1053  " usage_id = ".$ilDB->quote((int) $a_id, "integer")." AND ".
1054  " usage_lang = ".$ilDB->quote($a_lang, "text")." AND ".
1055  " usage_hist_nr = ".$ilDB->quote((int) $a_usage_hist_nr, "integer");
1056  $ilDB->manipulate($q);
1057  $q = "INSERT INTO mob_usage (id, usage_type, usage_id, usage_hist_nr, usage_lang) VALUES".
1058  " (".$ilDB->quote((int) $a_mob_id, "integer").",".
1059  $ilDB->quote($a_type, "text").",".
1060  $ilDB->quote((int) $a_id, "integer").",".
1061  $ilDB->quote((int) $a_usage_hist_nr, "integer").",".
1062  $ilDB->quote($a_lang, "text").
1063  ")";
1064  $ilDB->manipulate($q);
1065 
1066  self::handleQuotaUpdate(new self($a_mob_id));
1067  }
+ Here is the caller graph for this function:

◆ _useAutoStartParameterOnly()

static ilObjMediaObject::_useAutoStartParameterOnly (   $a_loc,
  $a_format 
)
static

Check whether only autostart parameter should be supported (instead of parameters input field.

This should be the same behaviour as mp3/flv in page.xsl

Definition at line 1545 of file class.ilObjMediaObject.php.

Referenced by ilPCMediaObjectGUI\getAliasValues(), ilObjMediaObjectGUI\getValues(), ilPCMediaObjectGUI\initAliasForm(), ilObjMediaObjectGUI\initForm(), ilPCMediaObjectGUI\saveAliasProperties(), and ilObjMediaObjectGUI\savePropertiesObject().

1546  {
1547  $lpath = pathinfo($a_loc);
1548  if ($lpath["extension"] == "mp3" && $a_format == "audio/mpeg")
1549  {
1550  return true;
1551  }
1552  if ($lpath["extension"] == "flv")
1553  {
1554  return true;
1555  }
1556  if (in_array($a_format, array("video/mp4", "video/webm")))
1557  {
1558  return true;
1559  }
1560  return false;
1561  }
+ Here is the caller graph for this function:

◆ addMediaItem()

ilObjMediaObject::addMediaItem (   $a_item)

add media item to media object

Parameters
object$a_itemmedia item object

Definition at line 257 of file class.ilObjMediaObject.php.

258  {
259  $this->media_items[] = $a_item;
260  }

◆ containsIntLink()

ilObjMediaObject::containsIntLink ( )

returns true, if mob was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser)

Definition at line 976 of file class.ilObjMediaObject.php.

References $contains_int_link.

977  {
979  }

◆ create()

ilObjMediaObject::create (   $a_create_meta_data = false,
  $a_save_media_items = true 
)

create media object in db

Definition at line 435 of file class.ilObjMediaObject.php.

References createMetaData(), getId(), and getMediaItems().

436  {
437  parent::create();
438 
439  if (!$a_create_meta_data)
440  {
441  $this->createMetaData();
442  }
443 
444  if ($a_save_media_items)
445  {
446  $media_items =& $this->getMediaItems();
447  for($i=0; $i<count($media_items); $i++)
448  {
449  $item =& $media_items[$i];
450  $item->setMobId($this->getId());
451  $item->setNr($i+1);
452  $item->create();
453  }
454  }
455 
456  self::handleQuotaUpdate($this);
457  }
& getMediaItems()
get all media items
createMetaData()
create meta data entry
+ Here is the call graph for this function:

◆ createDirectory()

ilObjMediaObject::createDirectory ( )

Create file directory of media object.

Definition at line 603 of file class.ilObjMediaObject.php.

References _getDirectory(), ilUtil\createDirectory(), and getId().

604  {
606  }
static createDirectory($a_dir, $a_mod=0755)
create directory
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ createMetaData()

ilObjMediaObject::createMetaData ( )

create meta data entry

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

References $ilUser, getDescription(), getId(), getTitle(), and ilObject\getType().

Referenced by create().

198  {
199  include_once 'Services/MetaData/classes/class.ilMDCreator.php';
200 
201  global $ilUser;
202 
203  $md_creator = new ilMDCreator(0, $this->getId(), $this->getType());
204  $md_creator->setTitle($this->getTitle());
205  $md_creator->setTitleLanguage($ilUser->getPref('language'));
206  $md_creator->setDescription($this->getDescription());
207  $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
208  $md_creator->setKeywordLanguage($ilUser->getPref('language'));
209  $md_creator->setLanguage($ilUser->getPref('language'));
210  $md_creator->create();
211 
212  return true;
213  }
getType()
get object type public
global $ilUser
Definition: imgupload.php:15
getDescription()
get description of media object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createReference()

ilObjMediaObject::createReference ( )

Definition at line 62 of file class.ilObjMediaObject.php.

63  {
64  $this->ilias->raiseError("Operation ilObjMedia::createReference() not allowed.",$this->ilias->error_obj->FATAL);
65  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ delete()

ilObjMediaObject::delete ( )

delete media object

Definition at line 100 of file class.ilObjMediaObject.php.

References _getDirectory(), _getThumbnailDirectory(), ilUtil\delDir(), ilMediaItem\deleteAllItemsOfMob(), deleteMetaData(), getId(), and getUsages().

101  {
102  if (!($this->getId() > 0))
103  {
104  return;
105  }
106 
107  $usages = $this->getUsages();
108 
109  if (count($usages) == 0)
110  {
111  // remove directory
113 
114  // remove thumbnail directory
116 
117  // delete meta data of mob
118  $this->deleteMetaData();
119 
120  // delete media items
122 
123  // this is just to make sure, there should be no entries left at
124  // this point as they depend on the usage
125  self::handleQuotaUpdate($this);
126 
127  // delete object
128  parent::delete();
129  }
130  }
getUsages($a_include_history=true)
get all usages of current media object
deleteMetaData()
delete meta data entry
deleteAllItemsOfMob($a_mob_id)
static
_getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ deleteMetaData()

ilObjMediaObject::deleteMetaData ( )

delete meta data entry

Definition at line 243 of file class.ilObjMediaObject.php.

References getId(), and ilObject\getType().

Referenced by delete().

244  {
245  // Delete meta data
246  include_once('Services/MetaData/classes/class.ilMD.php');
247  $md = new ilMD(0, $this->getId(), $this->getType());
248  $md->deleteAll();
249  }
getType()
get object type public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicate()

ilObjMediaObject::duplicate ( )

Duplicate media object, return new media object.

Definition at line 1782 of file class.ilObjMediaObject.php.

References _getDirectory(), _getThumbnailDirectory(), getDescription(), getId(), getMediaItems(), getTitle(), ilObjMediaObject(), and ilUtil\rCopy().

1783  {
1784  $new_obj = new ilObjMediaObject();
1785  $new_obj->setTitle($this->getTitle());
1786  $new_obj->setDescription($this->getDescription());
1787 
1788  // media items
1789  foreach($this->getMediaItems() as $key => $val)
1790  {
1791  $new_obj->addMediaItem($val);
1792  }
1793 
1794  $new_obj->create(false, true);
1795 
1796  // files
1797  $new_obj->createDirectory();
1798  self::_createThumbnailDirectory($new_obj->getId());
1800  ilObjMediaObject::_getDirectory($new_obj->getId()));
1802  ilObjMediaObject::_getThumbnailDirectory($new_obj->getId()));
1803 
1804  // meta data
1805  include_once("Services/MetaData/classes/class.ilMD.php");
1806  $md = new ilMD(0, $this->getId(), "mob");
1807  $new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
1808 
1809  return $new_obj;
1810  }
ilObjMediaObject($a_id=0)
Constructor public.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
_getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
& getMediaItems()
get all media items
getDescription()
get description of media object
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ exportFiles()

ilObjMediaObject::exportFiles (   $a_target_dir)

export all media files of object to target directory note: target directory must be the export target directory, "/objects/il_<inst>_mob_<mob_id>/..." will be appended to this directory

Parameters
string$a_target_dirtarget directory

Definition at line 878 of file class.ilObjMediaObject.php.

References getId(), ilUtil\getWebspaceDir(), ilUtil\makeDir(), and ilUtil\rCopy().

879  {
880  $subdir = "il_".IL_INST_ID."_mob_".$this->getId();
881  ilUtil::makeDir($a_target_dir."/objects/".$subdir);
882 
883  $mobdir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->getId();
884  ilUtil::rCopy($mobdir, $a_target_dir."/objects/".$subdir);
885 //echo "from:$mobdir:to:".$a_target_dir."/objects/".$subdir.":<br>";
886  }
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
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:

◆ exportMediaFullscreen()

ilObjMediaObject::exportMediaFullscreen (   $a_target_dir,
  $pg_obj 
)

Definition at line 888 of file class.ilObjMediaObject.php.

References $_GET, $tpl, ilMediaItem\_getMapAreasIntLinks(), ilPlayerUtil\getFlashVideoPlayerDirectory(), getId(), getXML(), IL_MODE_OUTPUT, ilUtil\makeDir(), xslt_create(), xslt_free(), and xslt_process().

889  {
890  $subdir = "il_".IL_INST_ID."_mob_".$this->getId();
891  $a_target_dir = $a_target_dir."/objects/".$subdir;
892  ilUtil::makeDir($a_target_dir);
893  $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
894  $tpl->setCurrentBlock("ilMedia");
895 
896  //$int_links = $page_object->getInternalLinks();
897  $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
898 
899  // @todo
900  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
901 
902  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
903  //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
904  require_once("./Services/COPage/classes/class.ilPageObject.php");
905 
906  $xml = "<dummy>";
907  // todo: we get always the first alias now (problem if mob is used multiple
908  // times in page)
909  $xml.= $pg_obj->getMediaAliasElement($this->getId());
910  $xml.= $this->getXML(IL_MODE_OUTPUT);
911  //$xml.= $link_xml;
912  $xml.="</dummy>";
913 
914  //die(htmlspecialchars($xml));
915 
916  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
917  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
918  $xh = xslt_create();
919 
920  //echo "<b>XML:</b>".htmlentities($xml);
921  // determine target frames for internal links
922  $wb_path = "";
923  $enlarge_path = "";
924  $params = array ('mode' => "fullscreen", 'enlarge_path' => $enlarge_path,
925  'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
926  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
927  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
928  //echo xslt_error($xh);
929  xslt_free($xh);
930 
931  // unmask user html
932  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
933  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
934  $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
935  $tpl->setVariable("MEDIA_CONTENT", $output);
936  $output = $tpl->get();
937  //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
938  $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
939  $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i","../../players",$output);
940  $output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","../../players",$output);
941  $output = preg_replace("/file=..\/..\/..\//i","file=../objects/".$subdir."/",$output);
942  //die(htmlspecialchars($output));
943  fwrite(fopen($a_target_dir.'/fullscreen.html','w'), $output );
944  }
xslt_create()
$_GET["client_id"]
xslt_free(&$proc)
xslt_process(&$proc, $xml_var, $xslt_var, $dummy, $args, $params, $a_no_warnings=false)
special template class to simplify handling of ITX/PEAR
static getFlashVideoPlayerDirectory()
Get flash video player directory.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
_getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
getXML($a_mode=IL_MODE_FULL, $a_inst=0)
get MediaObject XLM Tag
const IL_MODE_OUTPUT
+ Here is the call graph for this function:

◆ exportXML()

ilObjMediaObject::exportXML ( $a_xml_writer,
  $a_inst = 0 
)

export XML

Definition at line 865 of file class.ilObjMediaObject.php.

References getXML(), and IL_MODE_FULL.

866  {
867  $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
868  }
const IL_MODE_FULL
getXML($a_mode=IL_MODE_FULL, $a_inst=0)
get MediaObject XLM Tag
+ Here is the call graph for this function:

◆ generatePreviewPic()

ilObjMediaObject::generatePreviewPic (   $a_width,
  $a_height 
)

Upload video preview picture.

Parameters

Definition at line 1834 of file class.ilObjMediaObject.php.

References $file, _getDirectory(), ilUtil\convertImage(), ilUtil\escapeShellArg(), ilUtil\execConvert(), getId(), getMediaItem(), and ilUtil\isConvertVersionAtLeast().

Referenced by ilObjMediaCastGUI\saveCastItemObject().

1835  {
1836  $item = $this->getMediaItem("Standard");
1837 
1838  if ($item->getLocationType() == "LocalFile" &&
1839  is_int(strpos($item->getFormat(), "image/")))
1840  {
1841  $dir = ilObjMediaObject::_getDirectory($this->getId());
1842  $file = $dir."/".
1843  $item->getLocation();
1844  if (is_file($file))
1845  {
1846  if(ilUtil::isConvertVersionAtLeast("6.3.8-3"))
1847  {
1848  ilUtil::execConvert(ilUtil::escapeShellArg($file)."[0] -geometry ".$a_width."x".$a_height."^ -gravity center -extent ".$a_width."x".$a_height." PNG:".$dir."/mob_vpreview.png");
1849  }
1850  else
1851  {
1852  ilUtil::convertImage($file, $dir."/mob_vpreview.png", "PNG", $a_width."x".$a_height);
1853  }
1854  }
1855  }
1856  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
print $file
& getMediaItem($a_purpose)
get item for media purpose
static execConvert($args)
execute convert command
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static escapeShellArg($a_arg)
_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:

◆ getDataDirectory()

ilObjMediaObject::getDataDirectory ( )

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

References getId(), and ilUtil\getWebspaceDir().

Referenced by handleQuotaUpdate().

1535  {
1536  return ilUtil::getWebspaceDir()."/mobs/mm_".$this->getId();
1537  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilObjMediaObject::getDescription ( )

get description of media object

Returns
string description

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

Referenced by createMetaData(), duplicate(), and updateMetaData().

138  {
139  return parent::getDescription();
140  }
+ Here is the caller graph for this function:

◆ getFilesOfDirectory()

ilObjMediaObject::getFilesOfDirectory (   $a_subdir = "")

Get files of directory.

Parameters
string$a_subdirsubdirectry
Returns
array array of files

Definition at line 623 of file class.ilObjMediaObject.php.

References _getDirectory(), ilUtil\getDir(), and getId().

624  {
625  $a_subdir = str_replace("..", "", $a_subdir);
626  $dir = ilObjMediaObject::_getDirectory($this->getId());
627  if ($a_subdir != "")
628  {
629  $dir.= "/".$a_subdir;
630  }
631 
632  $files = array();
633  if (is_dir($dir))
634  {
635  $entries = ilUtil::getDir($dir);
636  foreach ($entries as $e)
637  {
638  if (is_file($dir."/".$e["entry"]) && $e["entry"] != "." && $e["entry"] != "..")
639  {
640  $files[] = $e["entry"];
641  }
642  }
643  }
644 
645  return $files;
646  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ getId()

◆ getImportId()

ilObjMediaObject::getImportId ( )

get import id

Definition at line 422 of file class.ilObjMediaObject.php.

References ilObject\$import_id.

423  {
424  return $this->import_id;
425  }

◆ getLinkedMediaObjects()

ilObjMediaObject::getLinkedMediaObjects (   $a_ignore = "")

Get all media objects linked in map areas of this media object.

Definition at line 1721 of file class.ilObjMediaObject.php.

References ilObject\_exists(), ilInternalLink\_extractObjIdOfTarget(), ilMapArea\_getIntLinks(), and getMediaItems().

1722  {
1723  $linked = array();
1724 
1725  if (!is_array($a_ignore))
1726  {
1727  $a_ignore = array();
1728  }
1729 
1730  // get linked media objects (map areas)
1731  $med_items = $this->getMediaItems();
1732 
1733  foreach($med_items as $med_item)
1734  {
1735  $int_links = ilMapArea::_getIntLinks($med_item->getId());
1736  foreach ($int_links as $k => $int_link)
1737  {
1738  if ($int_link["Type"] == "MediaObject")
1739  {
1740  include_once("./Services/COPage/classes/class.ilInternalLink.php");
1741  $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
1742  if (ilObject::_exists($l_id))
1743  {
1744  if (!in_array($l_id, $linked) &&
1745  !in_array($l_id, $a_ignore))
1746  {
1747  $linked[] = $l_id;
1748  }
1749  }
1750  }
1751  }
1752  }
1753 //var_dump($linked);
1754  return $linked;
1755  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
& getMediaItems()
get all media items
_getIntLinks($a_item_id)
get all internal links of a media items map areas
+ Here is the call graph for this function:

◆ getMediaItem()

& ilObjMediaObject::getMediaItem (   $a_purpose)

get item for media purpose

Parameters
string$a_purpose
Returns
ilMediaItem

Definition at line 279 of file class.ilObjMediaObject.php.

Referenced by ilObjMediaCastGUI\editCastItemObject(), generatePreviewPic(), ilObjMediaCastGUI\getMediaItem(), and hasPurposeItem().

280  {
281  foreach ($this->media_items as $media_item)
282  {
283  if($media_item->getPurpose() == $a_purpose)
284  {
285  return $media_item;
286  }
287  }
288  return false;
289  }
+ Here is the caller graph for this function:

◆ getMediaItemNr()

ilObjMediaObject::getMediaItemNr (   $a_purpose)

Definition at line 326 of file class.ilObjMediaObject.php.

327  {
328  for($i=0; $i<count($this->media_items); $i++)
329  {
330  if($this->media_items[$i]->getPurpose() == $a_purpose)
331  {
332  return $i + 1;
333  }
334  }
335  return false;
336  }

◆ getMediaItems()

& ilObjMediaObject::getMediaItems ( )

get all media items

Returns
array array of media item objects

Definition at line 268 of file class.ilObjMediaObject.php.

References $media_items.

Referenced by create(), duplicate(), getLinkedMediaObjects(), ilObjMediaCastGUI\getMediaItems(), getXML(), and update().

269  {
270  return $this->media_items;
271  }
+ Here is the caller graph for this function:

◆ getMimeType()

static ilObjMediaObject::getMimeType (   $a_file)
static

◆ getOriginID()

ilObjMediaObject::getOriginID ( )

Definition at line 407 of file class.ilObjMediaObject.php.

References $origin_id.

408  {
409  return $this->origin_id;
410  }

◆ getParentObjectIdForUsage()

ilObjMediaObject::getParentObjectIdForUsage (   $a_usage,
  $a_include_all_access_obj_ids = false 
)

Get's the repository object ID of a parent object, if possible.

see ilWebAccessChecker

Definition at line 1198 of file class.ilObjMediaObject.php.

References $id, ilObject\$type, ilPCQuestion\_getPageForQuestionId(), assQuestion\_getQuestionInfo(), SurveyQuestion\_instanciateQuestion(), ilGlossaryTerm\_lookGlossaryID(), ilNewsItem\_lookupContextObjId(), ilLMObject\_lookupContObjID(), ilForum\_lookupObjIdForForumId(), ilSCORM2004Node\_lookupSLMID(), ilGlossaryDefinition\_lookupTermId(), ilObjTest\_lookupTestObjIdForQuestionId(), ilPortfolioPage\findPortfolioForPage(), ilObjExercise\lookupExerciseIdForReturnedId(), ilWikiPage\lookupObjIdByPage(), and ilPageObject\lookupParentId().

Referenced by ilWebAccessChecker\checkAccessMob(), and handleQuotaUpdate().

1199  {
1200  if(is_int(strpos($a_usage["type"], ":")))
1201  {
1202  $us_arr = explode(":", $a_usage["type"]);
1203  $type = $us_arr[1];
1204  $cont_type = $us_arr[0];
1205  }
1206  else
1207  {
1208  $type = $a_usage["type"];
1209  }
1210 
1211  $id = $a_usage["id"];
1212  $obj_id = false;
1213 
1214  switch($type)
1215  {
1216  // RTE / tiny mce
1217  case "html":
1218 
1219  switch($cont_type)
1220  {
1221  case "qpl":
1222  // Question Pool *Question* Text (Test)
1223  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1225  if ($qinfo["original_id"] > 0)
1226  {
1227  include_once("./Modules/Test/classes/class.ilObjTest.php");
1228  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1229  }
1230  else
1231  {
1232  $obj_id = $qinfo["obj_fi"]; // usage in pool
1233  }
1234  break;
1235 
1236  case "spl":
1237  // Question Pool *Question* Text (Survey)
1238  include_once("./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
1240  if($quest)
1241  {
1242  if ($quest->getOriginalId() > 0)
1243  {
1244  $obj_id = $quest->getSurveyId();
1245  }
1246  else
1247  {
1248  $obj_id = $quest->getObjId(); // usage in pool
1249  }
1250  unset($quest);
1251  }
1252  break;
1253 
1254  case "exca":
1255  // Exercise assignment
1256  $returned_pk = $a_usage['id'];
1257  // we are just checking against exercise object
1258  include_once 'Modules/Exercise/classes/class.ilObjExercise.php';
1259  $obj_id = ilObjExercise::lookupExerciseIdForReturnedId($returned_pk);
1260  break;
1261 
1262  case "frm":
1263  // Forum
1264  $post_pk = $a_usage['id'];
1265  include_once 'Modules/Forum/classes/class.ilForumPost.php';
1266  include_once 'Modules/Forum/classes/class.ilForum.php';
1267  $oPost = new ilForumPost($post_pk);
1268  $frm_pk = $oPost->getForumId();
1269  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1270  break;
1271 
1272  // temporary items (per user)
1273  case "frm~":
1274  case "exca~":
1275  $obj_id = $a_usage['id'];
1276  break;
1277 
1278  // "old" category pages
1279  case "cat":
1280  // InfoScreen Text
1281  case "tst":
1282  case "svy":
1283  // data collection
1284  case "dcl":
1285  $obj_id = $id;
1286  break;
1287  }
1288  break;
1289 
1290  // page editor
1291  case "pg":
1292 
1293  switch($cont_type)
1294  {
1295  // question feedback // parent obj id is q id
1296  case "qfbg":
1297  include_once('./Services/COPage/classes/class.ilPageObject.php');
1299  // note: no break here, we only altered the $id to the question id
1300 
1301  case "qpl":
1302  // Question Pool Question Pages
1303  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1305  if ($qinfo["original_id"] > 0)
1306  {
1307  include_once("./Modules/Test/classes/class.ilObjTest.php");
1308  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1309  }
1310  else
1311  {
1312  $obj_id = $qinfo["obj_fi"]; // usage in pool
1313  }
1314  if ($obj_id == 0) // this is the case, if question is in learning module -> get lm id
1315  {
1316  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
1317  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "lm");
1318  if ($pinfo && $pinfo["parent_type"] == "lm")
1319  {
1320  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1321  $obj_id = ilLMObject::_lookupContObjID($pinfo["page_id"]);
1322  }
1323  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "sahs");
1324  if ($pinfo && $pinfo["parent_type"] == "sahs")
1325  {
1326  include_once("./Modules/SCORM2004/classes/class.ilSCORM2004Node.php");
1327  $obj_id = ilSCORM2004Node::_lookupSLMID($pinfo["page_id"]);
1328  }
1329  }
1330  break;
1331 
1332  case "lm":
1333  case "dbk":
1334  // learning modules
1335  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1336  $obj_id = ilLMObject::_lookupContObjID($id);
1337  break;
1338 
1339  case "gdf":
1340  // glossary definition
1341  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
1342  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1344  $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
1345  break;
1346 
1347  case "wpg":
1348  // wiki page
1349  include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
1351  break;
1352 
1353  case "sahs":
1354  // sahs page
1355  // can this implementation be used for other content types, too?
1356  include_once('./Services/COPage/classes/class.ilPageObject.php');
1357  $obj_id = ilPageObject::lookupParentId($id, 'sahs');
1358  break;
1359 
1360  case "prtf":
1361  // portfolio
1362  include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
1364  break;
1365 
1366  case "prtt":
1367  // portfolio template
1368  include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
1370  break;
1371 
1372  case "blp":
1373  // blog
1374  include_once('./Services/COPage/classes/class.ilPageObject.php');
1375  $obj_id = ilPageObject::lookupParentId($id, 'blp');
1376  break;
1377 
1378  case "impr":
1379  // imprint page - always id 1
1380  // fallthrough
1381 
1382  case "crs":
1383  case "grp":
1384  case "cat":
1385  case "fold":
1386  case "root":
1387  case "cont":
1388  // repository pages
1389  $obj_id = $id;
1390  break;
1391  }
1392  break;
1393 
1394  // Media Pool
1395  case "mep":
1396  $obj_id = $id;
1397  break;
1398 
1399  // News Context Object (e.g. MediaCast)
1400  case "news":
1401  include_once("./Services/News/classes/class.ilNewsItem.php");
1403  break;
1404  }
1405 
1406  return $obj_id;
1407  }
static _lookupObjIdForForumId($a_for_id)
static findPortfolioForPage($a_page_id)
Get portfolio id of page id.
& _getQuestionInfo($question_id)
Returns question information from the database.
_getPageForQuestionId($a_q_id, $a_parent_type="")
Get page for question id.
_lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
static lookupParentId($a_id, $a_type)
Lookup parent id.
_lookupSLMID($a_id)
Lookup Scorm Learning Module ID for node id.
_lookupContObjID($a_id)
get learning module / digibook id for lm object
_lookGlossaryID($term_id)
get glossary id form term id
static _lookupContextObjId($a_news_id)
Context Object ID.
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static lookupExerciseIdForReturnedId($a_returned_id)
_lookupTermId($a_def_id)
Looks up term id for a definition id.
static lookupObjIdByPage($a_page_id)
returns the wiki/object id to a given page id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilObjMediaObject::getRefId ( )

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

53  {
54  return false;
55  }

◆ getRestrictedFileTypes()

static ilObjMediaObject::getRestrictedFileTypes ( )
static

Get restricted file types.

Definition at line 1760 of file class.ilObjMediaObject.php.

References $t.

Referenced by ilObjMediaObjectGUI\initForm().

1761  {
1762  $mset = new ilSetting("mobs");
1763  $str = $mset->get("restricted_file_types");
1764  $types = explode(",", $str);
1765  $suffixes = array();
1766  if (count($types) > 0)
1767  {
1768  foreach ($types as $k => $t)
1769  {
1770  if (($s = strtolower(trim($t))) != "")
1771  {
1772  $suffixes[] = $s;
1773  }
1774  }
1775  }
1776  return $suffixes;
1777  }
ILIAS Setting Class.
+ Here is the caller graph for this function:

◆ getSrtFiles()

ilObjMediaObject::getSrtFiles ( )

Get srt files.

Definition at line 1650 of file class.ilObjMediaObject.php.

References _getDirectory(), ilUtil\getDir(), and getId().

Referenced by getXML().

1651  {
1652  $srt_dir = ilObjMediaObject::_getDirectory($this->getId())."/srt";
1653 
1654  if (!is_dir($srt_dir))
1655  {
1656  return array();
1657  }
1658 
1659  $items = ilUtil::getDir($srt_dir);
1660 
1661  $srt_files = array();
1662  foreach ($items as $i)
1663  {
1664  if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file")
1665  {
1666  $name = explode(".", $i["entry"]);
1667  if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_")
1668  {
1669  $srt_files[] = array("file" => $i["entry"],
1670  "full_path" => "srt/".$i["entry"], "language" => substr($name[0], 9, 2));
1671  }
1672  }
1673  }
1674 
1675  return $srt_files;
1676  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
_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:

◆ getThumbnailPath()

static ilObjMediaObject::getThumbnailPath (   $a_mob_id,
  $a_thumbname 
)
static

Get thumbnail path.

Parameters
string$a_thumbnamethumbnail file name
Returns
string thumbnail path

Definition at line 1697 of file class.ilObjMediaObject.php.

References _getThumbnailDirectory().

Referenced by ilPCIIMOverlaysTableGUI\fillRow().

1698  {
1699  $t_dir = ilObjMediaObject::_getThumbnailDirectory($a_mob_id);
1700  return $t_dir."/".$a_thumbname;
1701  }
_getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilObjMediaObject::getTitle ( )

Definition at line 72 of file class.ilObjMediaObject.php.

Referenced by createMetaData(), duplicate(), and updateMetaData().

73  {
74  return parent::getTitle();
75  }
+ Here is the caller graph for this function:

◆ getUsages()

ilObjMediaObject::getUsages (   $a_include_history = true)

get all usages of current media object

Definition at line 1090 of file class.ilObjMediaObject.php.

References getId(), and lookupUsages().

Referenced by delete(), and handleQuotaUpdate().

1091  {
1092  return $this->lookupUsages($this->getId(), $a_include_history);
1093  }
lookupUsages($a_id, $a_include_history=true)
Lookup usages of media object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVideoPreviewPic()

ilObjMediaObject::getVideoPreviewPic (   $a_filename_only = false)

Get video preview pic.

Parameters

Definition at line 1864 of file class.ilObjMediaObject.php.

References _getDirectory(), and getId().

Referenced by ilObjMediaCastGUI\getCastItemValues().

1865  {
1866  $dir = ilObjMediaObject::_getDirectory($this->getId());
1867  $ppics = array("mob_vpreview.jpg",
1868  "mob_vpreview.jpeg",
1869  "mob_vpreview.png");
1870  foreach ($ppics as $p)
1871  {
1872  if (is_file($dir."/".$p))
1873  {
1874  if ($a_filename_only)
1875  {
1876  return $p;
1877  }
1878  else
1879  {
1880  return $dir."/".$p;
1881  }
1882  }
1883  }
1884  return "";
1885  }
_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:

◆ getXML()

ilObjMediaObject::getXML (   $a_mode = IL_MODE_FULL,
  $a_inst = 0 
)

get MediaObject XLM Tag

Parameters
int$a_modeIL_MODE_ALIAS | IL_MODE_OUTPUT | IL_MODE_FULL

Definition at line 653 of file class.ilObjMediaObject.php.

References $ilUser, getId(), getMediaItems(), getSrtFiles(), ilObject\getType(), handleAmps(), IL_MODE_ALIAS, IL_MODE_FULL, and IL_MODE_OUTPUT.

Referenced by exportMediaFullscreen(), and exportXML().

654  {
655  global $ilUser;
656 
657  // TODO: full implementation of all parameters
658 //echo "-".$a_mode."-";
659  switch ($a_mode)
660  {
661  case IL_MODE_ALIAS:
662  $xml = "<MediaObject>";
663  $xml .= "<MediaAlias OriginId=\"il__mob_".$this->getId()."\"/>";
664  $media_items =& $this->getMediaItems();
665  for($i=0; $i<count($media_items); $i++)
666  {
667  $item =& $media_items[$i];
668  $xml .= "<MediaAliasItem Purpose=\"".$item->getPurpose()."\">";
669 
670  // Layout
671  $width = ($item->getWidth() != "")
672  ? "Width=\"".$item->getWidth()."\""
673  : "";
674  $height = ($item->getHeight() != "")
675  ? "Height=\"".$item->getHeight()."\""
676  : "";
677  $halign = ($item->getHAlign() != "")
678  ? "HorizontalAlign=\"".$item->getHAlign()."\""
679  : "";
680  $xml .= "<Layout $width $height $halign />";
681 
682  // Caption
683  if ($item->getCaption() != "")
684  {
685  $xml .= "<Caption Align=\"bottom\">".
686  str_replace("&", "&amp;", $item->getCaption())."</Caption>";
687  }
688 
689  // Text Representation
690  if ($item->getTextRepresentation() != "")
691  {
692  $xml .= "<TextRepresentation>".
693  str_replace("&", "&amp;", $item->getTextRepresentation())."</TextRepresentation>";
694  }
695 
696  // Parameter
697  $parameters = $item->getParameters();
698  foreach ($parameters as $name => $value)
699  {
700  $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
701  }
702  $xml .= $item->getMapAreasXML();
703  $xml .= "</MediaAliasItem>";
704  }
705  break;
706 
707  // for output we need technical sections of meta data
708  case IL_MODE_OUTPUT:
709 
710  // get first technical section
711 // $meta =& $this->getMetaData();
712  $xml = "<MediaObject Id=\"il__mob_".$this->getId()."\">";
713 
714  $media_items =& $this->getMediaItems();
715  for($i=0; $i<count($media_items); $i++)
716  {
717  $item =& $media_items[$i];
718 
719  $xml .= "<MediaItem Purpose=\"".$item->getPurpose()."\">";
720 
721  // Location
722  $xml.= "<Location Type=\"".$item->getLocationType()."\">".
723  $this->handleAmps($item->getLocation())."</Location>";
724 
725  // Format
726  $xml.= "<Format>".$item->getFormat()."</Format>";
727 
728  // Layout
729  $width = ($item->getWidth() != "")
730  ? "Width=\"".$item->getWidth()."\""
731  : "";
732  $height = ($item->getHeight() != "")
733  ? "Height=\"".$item->getHeight()."\""
734  : "";
735  $halign = ($item->getHAlign() != "")
736  ? "HorizontalAlign=\"".$item->getHAlign()."\""
737  : "";
738  $xml .= "<Layout $width $height $halign />";
739 
740  // Caption
741  if ($item->getCaption() != "")
742  {
743  $xml .= "<Caption Align=\"bottom\">".
744  str_replace("&", "&amp;", $item->getCaption())."</Caption>";
745  }
746 
747  // Text Representation
748  if ($item->getTextRepresentation() != "")
749  {
750  $xml .= "<TextRepresentation>".
751  str_replace("&", "&amp;", $item->getTextRepresentation())."</TextRepresentation>";
752  }
753 
754  // Parameter
755  $parameters = $item->getParameters();
756  foreach ($parameters as $name => $value)
757  {
758  $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
759  }
760  $xml .= $item->getMapAreasXML();
761 
762  // Subtitles
763  if ($item->getPurpose() == "Standard")
764  {
765  $srts = $this->getSrtFiles();
766  foreach ($srts as $srt)
767  {
768  $def = "";
769  $meta_lang = "";
770  if ($ilUser->getLanguage() != $meta_lang &&
771  $ilUser->getLanguage() == $srt["language"])
772  {
773  $def = ' Default="true" ';
774  }
775  $xml .= "<Subtitle File=\"".$srt["full_path"].
776  "\" Language=\"".$srt["language"]."\" ".$def."/>";
777  }
778  }
779  $xml .= "</MediaItem>";
780  }
781  break;
782 
783  // full xml for export
784  case IL_MODE_FULL:
785 
786 // $meta =& $this->getMetaData();
787  $xml = "<MediaObject>";
788 
789  // meta data
790  include_once("Services/MetaData/classes/class.ilMD2XML.php");
791  $md2xml = new ilMD2XML(0, $this->getId(), $this->getType());
792  $md2xml->setExportMode(true);
793  $md2xml->startExport();
794  $xml.= $md2xml->getXML();
795 
796  $media_items =& $this->getMediaItems();
797  for($i=0; $i<count($media_items); $i++)
798  {
799  $item =& $media_items[$i];
800 
801  // highlight mode
802  $xml .= "<MediaItem Purpose=\"".$item->getPurpose()."\">";
803 
804  // Location
805  $xml.= "<Location Type=\"".$item->getLocationType()."\">".
806  $this->handleAmps($item->getLocation())."</Location>";
807 
808  // Format
809  $xml.= "<Format>".$item->getFormat()."</Format>";
810 
811  // Layout
812  $width = ($item->getWidth() != "")
813  ? "Width=\"".$item->getWidth()."\""
814  : "";
815  $height = ($item->getHeight() != "")
816  ? "Height=\"".$item->getHeight()."\""
817  : "";
818  $halign = ($item->getHAlign() != "")
819  ? "HorizontalAlign=\"".$item->getHAlign()."\""
820  : "";
821  $xml .= "<Layout $width $height $halign />";
822 
823  // Caption
824  if ($item->getCaption() != "")
825  {
826  $xml .= "<Caption Align=\"bottom\">".
827  str_replace("&", "&amp;", $item->getCaption())."</Caption>";
828  }
829 
830  // Text Representation
831  if ($item->getTextRepresentation() != "")
832  {
833  $xml .= "<TextRepresentation>".
834  str_replace("&", "&amp;", $item->getTextRepresentation())."</TextRepresentation>";
835  }
836 
837  // Parameter
838  $parameters = $item->getParameters();
839  foreach ($parameters as $name => $value)
840  {
841  $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
842  }
843  $xml .= $item->getMapAreasXML(true, $a_inst);
844  $xml .= "</MediaItem>";
845  }
846  break;
847  }
848  $xml .= "</MediaObject>";
849  return $xml;
850  }
getSrtFiles()
Get srt files.
const IL_MODE_FULL
getType()
get object type public
const IL_MODE_ALIAS
global $ilUser
Definition: imgupload.php:15
& getMediaItems()
get all media items
const IL_MODE_OUTPUT
handleAmps($a_str)
Replace "&" (if not an "&amp;") with "&amp;".
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAmps()

ilObjMediaObject::handleAmps (   $a_str)

Replace "&" (if not an "&amp;") with "&amp;".

Definition at line 855 of file class.ilObjMediaObject.php.

Referenced by getXML().

856  {
857  $a_str = str_replace("&amp;", "&", $a_str);
858  $a_str = str_replace("&", "&amp;", $a_str);
859  return $a_str;
860  }
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected

Definition at line 496 of file class.ilObjMediaObject.php.

References $ilSetting, getDataDirectory(), getId(), getParentObjectIdForUsage(), ilObject\getType(), getUsages(), and ilDiskQuotaHandler\handleUpdatedSourceObject().

497  {
498  global $ilSetting;
499 
500  // if neither workspace nor portfolios are activated, we skip
501  // the quota update here. this due to performance reasons on installations
502  // that do not use workspace/portfolios, but heavily copy content.
503  // in extreme cases (media object in pool and personal blog, deactivate workspace, change media object,
504  // this may lead to incorrect data in the quota calculation)
505  if ($ilSetting->get("disable_personal_workspace") && !$ilSetting->get('user_portfolios'))
506  {
507  return;
508  }
509 
510  $parent_obj_ids = array();
511  foreach($a_mob->getUsages() as $item)
512  {
513  $parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
514  if($parent_obj_id &&
515  !in_array($parent_obj_id, $parent_obj_ids))
516  {
517  $parent_obj_ids[]= $parent_obj_id;
518  }
519  }
520 
521  // we could suppress this if object is present in a (repository) media pool
522  // but this would lead to "quota-breaches" when the pool item is deleted
523  // and "suddenly" all workspace owners get filesize added to their
524  // respective quotas, regardless of current status
525 
526  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
528  $a_mob->getId(),
529  ilUtil::dirSize($a_mob->getDataDirectory()),
530  $parent_obj_ids);
531  }
getUsages($a_include_history=true)
get all usages of current media object
getParentObjectIdForUsage($a_usage, $a_include_all_access_obj_ids=false)
Get&#39;s the repository object ID of a parent object, if possible.
getType()
get object type public
global $ilSetting
Definition: privfeed.php:40
static handleUpdatedSourceObject($a_src_obj_type, $a_src_obj_id, $a_src_filesize, $a_owner_obj_ids=null, $a_is_prtf=false)
Find and update/create all related entries for source object.
+ Here is the call graph for this function:

◆ hasFullscreenItem()

ilObjMediaObject::hasFullscreenItem ( )

Definition at line 339 of file class.ilObjMediaObject.php.

References hasPurposeItem().

340  {
341  return $this->hasPurposeItem("Fullscreen");
342  }
hasPurposeItem($purpose)
returns wether object has media item with specific purpose
+ Here is the call graph for this function:

◆ hasPurposeItem()

ilObjMediaObject::hasPurposeItem (   $purpose)

returns wether object has media item with specific purpose

Parameters
string$purpose
Returns
boolean

Definition at line 350 of file class.ilObjMediaObject.php.

References getMediaItem().

Referenced by hasFullscreenItem().

351  {
352  if(is_object($this->getMediaItem($purpose)))
353  {
354  return true;
355  }
356  else
357  {
358  return false;
359  }
360  }
& getMediaItem($a_purpose)
get item for media purpose
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilObjMediaObject()

ilObjMediaObject::ilObjMediaObject (   $a_id = 0)

Constructor public.

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

Referenced by _saveTempFileAsMediaObject(), and duplicate().

39  {
40  $this->is_alias = false;
41  $this->media_items = array();
42  $this->contains_int_link = false;
43  $this->type = "mob";
44  parent::ilObject($a_id, false);
45  }
+ Here is the caller graph for this function:

◆ isAlias()

ilObjMediaObject::isAlias ( )

Definition at line 397 of file class.ilObjMediaObject.php.

References $is_alias.

398  {
399  return $this->is_alias;
400  }

◆ lookupUsages()

ilObjMediaObject::lookupUsages (   $a_id,
  $a_include_history = true 
)

Lookup usages of media object.

Todo:
: This should be all in one context -> mob id table

Definition at line 1100 of file class.ilObjMediaObject.php.

References $ret, ilPageObject\_exists(), ilObjUser\_getUsersForClipboadObject(), and ilNewsItem\_lookupMediaObjectUsages().

Referenced by ilWebAccessChecker\checkAccessMob(), getUsages(), and ilLMObject\updateInternalLinks().

1101  {
1102  global $ilDB;
1103 
1104  $hist_str = "";
1105  if ($a_include_history)
1106  {
1107  $hist_str = ", usage_hist_nr";
1108  }
1109 
1110  // get usages in pages
1111  $q = "SELECT DISTINCT usage_type, usage_id, usage_lang".$hist_str." FROM mob_usage WHERE id = ".
1112  $ilDB->quote($a_id, "integer");
1113 
1114  if (!$a_include_history)
1115  {
1116  $q.= " AND usage_hist_nr = ".$ilDB->quote(0, "integer");
1117  }
1118 
1119  $us_set = $ilDB->query($q);
1120  $ret = array();
1121  while($us_rec = $ilDB->fetchAssoc($us_set))
1122  {
1123  $ut = "";
1124  if(is_int(strpos($us_rec["usage_type"], ":")))
1125  {
1126  $us_arr = explode(":", $us_rec["usage_type"]);
1127  $ut = $us_arr[1];
1128  $ct = $us_arr[0];
1129  }
1130 
1131  // check whether page exists
1132  $skip = false;
1133  if ($ut == "pg")
1134  {
1135  include_once("./Services/COPage/classes/class.ilPageObject.php");
1136  if (!ilPageObject::_exists($ct, $us_rec["usage_id"]))
1137  {
1138  $skip = true;
1139  }
1140  }
1141 
1142  if (!$skip)
1143  {
1144  $ret[] = array("type" => $us_rec["usage_type"],
1145  "id" => $us_rec["usage_id"],
1146  "lang" => $us_rec["usage_lang"],
1147  "hist_nr" => $us_rec["usage_hist_nr"]);
1148  }
1149  }
1150 
1151  // get usages in media pools
1152  $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = ".
1153  $ilDB->quote($a_id, "integer")." AND mep_item.type = ".$ilDB->quote("mob", "text");
1154  $us_set = $ilDB->query($q);
1155  while($us_rec = $ilDB->fetchAssoc($us_set))
1156  {
1157  $ret[] = array("type" => "mep",
1158  "id" => $us_rec["mep_id"]);
1159  }
1160 
1161  // get usages in news items (media casts)
1162  include_once("./Services/News/classes/class.ilNewsItem.php");
1163  $news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
1164  foreach($news_usages as $nu)
1165  {
1166  $ret[] = $nu;
1167  }
1168 
1169 
1170  // get usages in map areas
1171  $q = "SELECT DISTINCT mob_id FROM media_item it, map_area area ".
1172  " WHERE area.item_id = it.id ".
1173  " AND area.link_type = ".$ilDB->quote("int", "text")." ".
1174  " AND area.target = ".$ilDB->quote("il__mob_".$a_id, "text");
1175  $us_set = $ilDB->query($q);
1176  while($us_rec = $ilDB->fetchAssoc($us_set))
1177  {
1178  $ret[] = array("type" => "map",
1179  "id" => $us_rec["mob_id"]);
1180  }
1181 
1182  // get usages in personal clipboards
1183  $users = ilObjUser::_getUsersForClipboadObject("mob", $a_id);
1184  foreach ($users as $user)
1185  {
1186  $ret[] = array("type" => "clip",
1187  "id" => $user);
1188  }
1189 
1190  return $ret;
1191  }
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
_getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeThumbnail()

ilObjMediaObject::makeThumbnail (   $a_file,
  $a_thumbname,
  $a_format = "png",
  $a_size = "80" 
)

Make thumbnail.

Definition at line 1681 of file class.ilObjMediaObject.php.

References _getDirectory(), _getThumbnailDirectory(), ilUtil\convertImage(), and getId().

1683  {
1684  $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1686  self::_createThumbnailDirectory($this->getId());
1687  ilUtil::convertImage($m_dir."/".$a_file,
1688  $t_dir."/".$a_thumbname, $a_format, $a_size);
1689  }
_getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ MDUpdateListener()

ilObjMediaObject::MDUpdateListener (   $a_element)

Meta data update listener.

Important note: Do never call create() or update() method of ilObject here. It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.

Parameters
string$a_element

Definition at line 161 of file class.ilObjMediaObject.php.

References $id, ilObject\_writeDescription(), ilObject\_writeTitle(), getId(), ilObject\getType(), setDescription(), and setTitle().

162  {
163  include_once 'Services/MetaData/classes/class.ilMD.php';
164 
165  switch($a_element)
166  {
167  case 'General':
168 
169  // Update Title and description
170  $md = new ilMD(0, $this->getId(), $this->getType());
171  $md_gen = $md->getGeneral();
172 
173  if (is_object($md_gen))
174  {
175  ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
176  $this->setTitle($md_gen->getTitle());
177 
178  foreach($md_gen->getDescriptionIds() as $id)
179  {
180  $md_des = $md_gen->getDescription($id);
181  ilObject::_writeDescription($this->getId(),$md_des->getDescription());
182  $this->setDescription($md_des->getDescription());
183  break;
184  }
185  }
186 
187  break;
188 
189  default:
190  }
191  return true;
192  }
_writeTitle($a_obj_id, $a_title)
write title to db (static)
setDescription($a_description)
set description of media object
_writeDescription($a_obj_id, $a_desc)
write description to db (static)
getType()
get object type public
+ Here is the call graph for this function:

◆ modifyExportIdentifier()

ilObjMediaObject::modifyExportIdentifier (   $a_tag,
  $a_param,
  $a_value 
)

Definition at line 946 of file class.ilObjMediaObject.php.

References ilUtil\insertInstIntoID().

947  {
948  if ($a_tag == "Identifier" && $a_param == "Entry")
949  {
950  $a_value = ilUtil::insertInstIntoID($a_value);
951  }
952 
953  return $a_value;
954  }
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
+ Here is the call graph for this function:

◆ putInTree()

ilObjMediaObject::putInTree ( )

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

58  {
59  $this->ilias->raiseError("Operation ilObjMedia::putInTree() not allowed.",$this->ilias->error_obj->FATAL);
60  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ read()

ilObjMediaObject::read ( )

read media object data from db

Definition at line 367 of file class.ilObjMediaObject.php.

References ilMediaItem\_getMediaItemsOfMOb().

368  {
369 //echo "<br>ilObjMediaObject:read";
370  parent::read();
371 
372  // get media items
374  }
_getMediaItemsOfMOb(&$a_mob)
read media items into media objects (static)
+ Here is the call graph for this function:

◆ removeAdditionalFile()

ilObjMediaObject::removeAdditionalFile (   $a_file)

Remove additional file.

Definition at line 1707 of file class.ilObjMediaObject.php.

References $file, _getDirectory(), and getId().

1708  {
1709  $file = str_replace("..", "", $a_file);
1711  if (is_file($file))
1712  {
1713  unlink($file);
1714  }
1715  }
print $file
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ removeAllMediaItems()

ilObjMediaObject::removeAllMediaItems ( )

remove all media items

Definition at line 320 of file class.ilObjMediaObject.php.

321  {
322  $this->media_items = array();
323  }

◆ removeMediaItem()

ilObjMediaObject::removeMediaItem (   $a_purpose)

Definition at line 295 of file class.ilObjMediaObject.php.

References $media_items, and getId().

296  {
297  foreach ($this->media_items as $key => $media_item)
298  {
299  if($media_item->getPurpose() == $a_purpose)
300  {
301  unset($this->media_items[$key]);
302  }
303  }
304  // update numbers and keys
305  $i = 1;
306  $media_items = array();
307  foreach ($this->media_items as $media_item)
308  {
309  $media_items [$i] = $media_item;
310  $media_item->setMobId($this->getId());
311  $media_item->setNr($i);
312  $i++;
313  }
314  $this->media_items = $media_items;
315  }
+ Here is the call graph for this function:

◆ setAlias()

ilObjMediaObject::setAlias (   $a_is_alias)

set wether page object is an alias

Definition at line 392 of file class.ilObjMediaObject.php.

393  {
394  $this->is_alias = $a_is_alias;
395  }

◆ setContainsIntLink()

ilObjMediaObject::setContainsIntLink (   $a_contains_link)

content parser set this flag to true, if the media object contains internal links (this method should only be called by the import parser)

Parameters
boolean$a_contains_linktrue, if page contains intern link tag(s)

Definition at line 967 of file class.ilObjMediaObject.php.

968  {
969  $this->contains_int_link = $a_contains_link;
970  }

◆ setDescription()

ilObjMediaObject::setDescription (   $a_description)

set description of media object

Definition at line 145 of file class.ilObjMediaObject.php.

Referenced by MDUpdateListener().

146  {
147  parent::setDescription($a_description);
148  }
+ Here is the caller graph for this function:

◆ setId()

ilObjMediaObject::setId (   $a_id)

set id

Definition at line 379 of file class.ilObjMediaObject.php.

380  {
381  $this->id = $a_id;
382  }

◆ setImportId()

ilObjMediaObject::setImportId (   $a_id)

Definition at line 427 of file class.ilObjMediaObject.php.

428  {
429  $this->import_id = $a_id;
430  }

◆ setOriginID()

ilObjMediaObject::setOriginID (   $a_id)

Definition at line 402 of file class.ilObjMediaObject.php.

403  {
404  return $this->origin_id = $a_id;
405  }

◆ setRefId()

ilObjMediaObject::setRefId ( )

Definition at line 47 of file class.ilObjMediaObject.php.

48  {
49  $this->ilias->raiseError("Operation ilObjMedia::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
50  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ setTitle()

ilObjMediaObject::setTitle (   $a_title)

Definition at line 67 of file class.ilObjMediaObject.php.

Referenced by MDUpdateListener().

68  {
69  parent::setTitle($a_title);
70  }
+ Here is the caller graph for this function:

◆ update()

ilObjMediaObject::update (   $a_upload = false)

update media object in db

Definition at line 463 of file class.ilObjMediaObject.php.

References ilMediaItem\deleteAllItemsOfMob(), getId(), getMediaItems(), and updateMetaData().

464  {
465  parent::update();
466 
467  if(!$a_upload)
468  {
469  $this->updateMetaData();
470  }
471 
473 
474  // iterate all items
475  $media_items =& $this->getMediaItems();
476  $j = 1;
477  foreach($media_items as $key => $val)
478  {
479  $item =& $media_items[$key];
480  if (is_object($item))
481  {
482  $item->setMobId($this->getId());
483  $item->setNr($j);
484  if ($item->getLocationType() == "Reference")
485  {
486  $item->extractUrlParameters();
487  }
488  $item->create();
489  $j++;
490  }
491  }
492 
493  self::handleQuotaUpdate($this);
494  }
updateMetaData()
update meta data entry
deleteAllItemsOfMob($a_mob_id)
static
& getMediaItems()
get all media items
+ Here is the call graph for this function:

◆ updateMetaData()

ilObjMediaObject::updateMetaData ( )

update meta data entry

Definition at line 218 of file class.ilObjMediaObject.php.

References getDescription(), getId(), getTitle(), and ilObject\getType().

Referenced by update().

219  {
220  include_once("Services/MetaData/classes/class.ilMD.php");
221  include_once("Services/MetaData/classes/class.ilMDGeneral.php");
222  include_once("Services/MetaData/classes/class.ilMDDescription.php");
223 
224  $md =& new ilMD(0, $this->getId(), $this->getType());
225  $md_gen =& $md->getGeneral();
226  $md_gen->setTitle($this->getTitle());
227 
228  // sets first description (maybe not appropriate)
229  $md_des_ids =& $md_gen->getDescriptionIds();
230  if (count($md_des_ids) > 0)
231  {
232  $md_des =& $md_gen->getDescription($md_des_ids[0]);
233  $md_des->setDescription($this->getDescription());
234  $md_des->update();
235  }
236  $md_gen->update();
237 
238  }
getType()
get object type public
getDescription()
get description of media object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadAdditionalFile()

ilObjMediaObject::uploadAdditionalFile (   $a_name,
  $tmp_name,
  $a_subdir = "" 
)

Create new media object and update page in db and return new media object.

Definition at line 1618 of file class.ilObjMediaObject.php.

References _getDirectory(), getId(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), and ilUtil\renameExecutables().

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

1619  {
1620  $a_subdir = str_replace("..", "", $a_subdir);
1621  $dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
1622  if ($a_subdir != "")
1623  {
1624  $dir.= "/".$a_subdir;
1625  }
1626  ilUtil::makeDirParents($dir);
1627  ilUtil::moveUploadedFile($tmp_name, $a_name, $dir."/".$a_name);
1628  ilUtil::renameExecutables($mob_dir);
1629  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
_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:

◆ uploadSrtFile()

ilObjMediaObject::uploadSrtFile (   $a_tmp_name,
  $a_language 
)

Upload srt file.

Parameters

Definition at line 1637 of file class.ilObjMediaObject.php.

References uploadAdditionalFile().

1638  {
1639  if (is_file($a_tmp_name) && $a_language != "")
1640  {
1641  $this->uploadAdditionalFile("subtitle_".$a_language.".srt", $a_tmp_name, "srt");
1642  return true;
1643  }
1644  return false;
1645  }
uploadAdditionalFile($a_name, $tmp_name, $a_subdir="")
Create new media object and update page in db and return new media object.
+ Here is the call graph for this function:

◆ uploadVideoPreviewPic()

ilObjMediaObject::uploadVideoPreviewPic (   $a_prevpic)

Upload video preview picture.

Parameters

Definition at line 1818 of file class.ilObjMediaObject.php.

References uploadAdditionalFile().

1819  {
1820  $pi = pathinfo($a_prevpic["name"]);
1821  $ext = $pi["extension"];
1822  if (in_array($ext, array("jpg", "jpeg", "png")))
1823  {
1824  $this->uploadAdditionalFile("mob_vpreview.".$ext, $a_prevpic["tmp_name"]);
1825  }
1826  }
uploadAdditionalFile($a_name, $tmp_name, $a_subdir="")
Create new media object and update page in db and return new media object.
+ Here is the call graph for this function:

Field Documentation

◆ $contains_int_link

ilObjMediaObject::$contains_int_link

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

Referenced by containsIntLink().

◆ $id

ilObjMediaObject::$id

Definition at line 30 of file class.ilObjMediaObject.php.

Referenced by getId(), getParentObjectIdForUsage(), and MDUpdateListener().

◆ $is_alias

ilObjMediaObject::$is_alias

Definition at line 28 of file class.ilObjMediaObject.php.

Referenced by isAlias().

◆ $media_items

ilObjMediaObject::$media_items

Definition at line 31 of file class.ilObjMediaObject.php.

Referenced by getMediaItems(), and removeMediaItem().

◆ $origin_id

ilObjMediaObject::$origin_id

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

Referenced by getOriginID().


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