ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. 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...
 
 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 (this is for the input form, this list will be empty, if "allowed list" is empty) More...
 
static getForbiddenFileTypes ()
 Get forbidden file types. More...
 
static getAllowedFileTypes ()
 Get allowed file types. More...
 
static isTypeAllowed ($a_type)
 Is type allowed. More...
 
static fixFilename ($a_name)
 Fix filename of uploaded file. More...
 
static renameExecutables ($a_dir)
 Rename executables. 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 628 of file class.ilObjMediaObject.php.

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

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

629  {
631  ilUtil::createDirectory(ilUtil::getWebspaceDir()."/thumbs/mm_".$a_obj_id);
632  }
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 1001 of file class.ilObjMediaObject.php.

References $ilDB, and $row.

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

1002  {
1003  global $ilDB;
1004 
1005  $and_hist = "";
1006  if ($a_usage_hist_nr !== false)
1007  {
1008  $and_hist = " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
1009  }
1010 
1011  $mob_ids = array();
1012  $set = $ilDB->query("SELECT id FROM mob_usage".
1013  " WHERE usage_type = ".$ilDB->quote($a_type, "text").
1014  " AND usage_id = ".$ilDB->quote($a_id, "integer").
1015  " AND usage_lang = ".$ilDB->quote($a_lang, "text").
1016  $and_hist);
1017  while($row = $ilDB->fetchAssoc($set))
1018  {
1019  $mob_ids[] = $row["id"];
1020  }
1021 
1022  $q = "DELETE FROM mob_usage WHERE usage_type = ".
1023  $ilDB->quote($a_type, "text").
1024  " AND usage_id= ".$ilDB->quote($a_id, "integer").
1025  " AND usage_lang = ".$ilDB->quote($a_lang, "text").
1026  $and_hist;
1027  $ilDB->manipulate($q);
1028 
1029  foreach($mob_ids as $mob_id)
1030  {
1031  self::handleQuotaUpdate(new self($mob_id));
1032  }
1033  }
global $ilDB
+ 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 1477 of file class.ilObjMediaObject.php.

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

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

1480  {
1481  global $lng;
1482 
1483  // determine width and height of known image types
1484  $width = $a_def_width;
1485  $height = $a_def_height;
1486  $info = "";
1487 
1488  if ($a_format == "audio/mpeg")
1489  {
1490  $width = 300;
1491  $height = 20;
1492  }
1493 
1494  if (ilUtil::deducibleSize($a_format))
1495  {
1496  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1497  if ($a_type == "File")
1498  {
1500  }
1501  else
1502  {
1503  $size = ilMediaImageUtil::getImageSize($a_reference);
1504  }
1505  }
1506 
1507  if ($a_use_original)
1508  {
1509  if ($size[0] > 0 && $size[1] > 0)
1510  {
1511  $width = $size[0];
1512  $height = $size[1];
1513  }
1514  else
1515  {
1516  $info = $lng->txt("cont_could_not_determine_resource_size");
1517  }
1518  }
1519  else
1520  {
1521  $w = (int) $a_user_width;
1522  $h = (int) $a_user_height;
1523  $width = $w;
1524  $height = $h;
1525 //echo "<br>C-$width-$height-";
1526  if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions)
1527  {
1528  if ($size[0] > 0 && $size[1] > 0)
1529  {
1530  if ($w > 0)
1531  {
1532  $wr = $size[0] / $w;
1533  }
1534  if ($h > 0)
1535  {
1536  $hr = $size[1] / $h;
1537  }
1538 //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1539 //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1540  $r = max($wr, $hr);
1541  if ($r > 0)
1542  {
1543  $width = (int) ($size[0]/$r);
1544  $height = (int) ($size[1]/$r);
1545  }
1546  }
1547  }
1548 //echo "<br>D-$width-$height-";
1549  }
1550 //echo "<br>E-$width-$height-";
1551  return array("width" => $width, "height" => $height, "info" => $info);
1552  }
$size
Definition: RandomTest.php:79
static getImageSize($a_location)
Get image size from location.
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 $ilDB, and 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/Link/classes/class.ilInternalLink.php");
89  if (is_int(strpos($a_id, "_")))
90  {
92  }
93 
94  return parent::_exists($a_id, false);
95  }
global $ilDB
+ 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 555 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(), ilObjMediaObjectGUI\executeCommand(), ilObjMediaCastGUI\extractPreviewImageObject(), ilPDNewsTableGUI\fillRow(), generatePreviewPic(), ilMediaItem\getDirectory(), getFilesOfDirectory(), ilBlogPostingGUI\getFirstMediaObjectAsTag(), 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().

556  {
557  return ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id;
558  }
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 1038 of file class.ilObjMediaObject.php.

References $ilDB, $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(), ilPageObject\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(), assKprimChoice\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assOrderingQuestion\toJSON(), assErrorText\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

1039  {
1040  global $ilDB;
1041 
1042  $lstr = "";
1043  if ($a_lang != "")
1044  {
1045  $lstr = " AND usage_lang = ".$ilDB->quote($a_lang, "text");
1046  }
1047  $hist_str = "";
1048  if ($a_usage_hist_nr !== false)
1049  {
1050  $hist_str = " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
1051  }
1052 
1053  $q = "SELECT * FROM mob_usage WHERE ".
1054  "usage_type = ".$ilDB->quote($a_type, "text")." AND ".
1055  "usage_id = ".$ilDB->quote($a_id, "integer").
1056  $lstr.$hist_str;
1057  $mobs = array();
1058  $mob_set = $ilDB->query($q);
1059  while($mob_rec = $ilDB->fetchAssoc($mob_set))
1060  {
1061  if (ilObject::_lookupType($mob_rec["id"]) == "mob")
1062  {
1063  $mobs[$mob_rec["id"]] = $mob_rec["id"];
1064  }
1065  }
1066 
1067  return $mobs;
1068  }
$mobs
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ 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 1558 of file class.ilObjMediaObject.php.

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

1559  {
1560  return array("image/x-ms-bmp", "image/gif", "image/jpeg", "image/x-portable-bitmap",
1561  "image/png", "image/psd", "image/tiff", "application/pdf");
1562  }
+ 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 575 of file class.ilObjMediaObject.php.

References ilUtil\getWebspaceDir().

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

576  {
577  return ilUtil::getWebspaceDir($a_mode)."/thumbs/mm_".$a_mob_id;
578  }
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 565 of file class.ilObjMediaObject.php.

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

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

566  {
567  return ilUtil::getHtmlPath(ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id);
568  }
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 596 of file class.ilObjMediaObject.php.

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

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

598  {
599  if ($a_purpose == "")
600  {
601  $a_purpose = "Standard";
602  }
603  $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
604  if (preg_match("/https?\:/i",$location))
605  return $location;
606 
607  if ($a_url_encode)
608  $location = rawurlencode($location);
609 
610  $path = ($a_web)
611  ? ILIAS_HTTP_PATH
612  : ".";
613 
614  return $path."/data/".CLIENT_ID."/mobs/mm_".$a_mob_id."/".$location;
615  }
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 585 of file class.ilObjMediaObject.php.

References _lookupItemPath().

Referenced by ilSCORM2004ScoGUI\getExportResources().

587  {
588  return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
589  }
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 1094 of file class.ilObjMediaObject.php.

References $ilDB.

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().

1095  {
1096  global $ilDB;
1097 
1098  $q = "DELETE FROM mob_usage WHERE ".
1099  " id = ".$ilDB->quote((int) $a_mob_id, "integer")." AND ".
1100  " usage_type = ".$ilDB->quote($a_type, "text")." AND ".
1101  " usage_id = ".$ilDB->quote((int) $a_id, "integer")." AND ".
1102  " usage_lang = ".$ilDB->quote($a_lang, "text")." AND ".
1103  " usage_hist_nr = ".$ilDB->quote((int) $a_usage_hist_nr, "integer");
1104  $ilDB->manipulate($q);
1105 
1106  self::handleQuotaUpdate(new self($a_mob_id));
1107  }
global $ilDB
+ 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 1445 of file class.ilObjMediaObject.php.

References $location, and ilUtil\resizeImage().

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

1446  {
1447  $file_path = pathinfo($a_file);
1448  $location = substr($file_path["basename"],0,strlen($file_path["basename"]) -
1449  strlen($file_path["extension"]) - 1)."_".
1450  $a_width."_".
1451  $a_height.".".$file_path["extension"];
1452  $target_file = $file_path["dirname"]."/".
1453  $location;
1454  ilUtil::resizeImage($a_file, $target_file,
1455  (int) $a_width, (int) $a_height, $a_constrain_prop);
1456 
1457  return $location;
1458  }
$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 1596 of file class.ilObjMediaObject.php.

References $file, $location, $size, _getDirectory(), ilUtil\deducibleSize(), ilMediaImageUtil\getImageSize(), getMimeType(), ilObjMediaObject(), ilUtil\moveUploadedFile(), and ilMediaSvgSanitizer\sanitizeDir().

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

1597  {
1598  // create dummy object in db (we need an id)
1599  $media_object = new ilObjMediaObject();
1600  $media_object->setTitle($name);
1601  $media_object->setDescription("");
1602  $media_object->create();
1603 
1604  // determine and create mob directory, move uploaded file to directory
1605  $media_object->createDirectory();
1606  $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
1607 
1608  $media_item =& new ilMediaItem();
1609  $media_object->addMediaItem($media_item);
1610  $media_item->setPurpose("Standard");
1611 
1612  $file = $mob_dir."/".$name;
1613  if ($upload)
1614  {
1615  ilUtil::moveUploadedFile($tmp_name,$name, $file);
1616  }
1617  else
1618  {
1619  copy($tmp_name, $file);
1620  }
1621  // get mime type
1623  $location = $name;
1624  // set real meta and object data
1625  $media_item->setFormat($format);
1626  $media_item->setLocation($location);
1627  $media_item->setLocationType("LocalFile");
1628  $media_object->setTitle($name);
1629  $media_object->setDescription($format);
1630 
1631  if (ilUtil::deducibleSize($format))
1632  {
1633  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1635  $media_item->setWidth($size[0]);
1636  $media_item->setHeight($size[1]);
1637  }
1638  $media_item->setHAlign("Left");
1639 
1640  self::renameExecutables($mob_dir);
1641  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1642  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1643 
1644  $media_object->update();
1645 
1646  return $media_object;
1647  }
print $file
$size
Definition: RandomTest.php:79
static getImageSize($a_location)
Get image size from location.
ilObjMediaObject($a_id=0)
Constructor public.
static sanitizeDir($a_path)
Sanitize directory recursively.
$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.
_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 1073 of file class.ilObjMediaObject.php.

References $ilDB.

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

1074  {
1075  global $ilDB;
1076 
1077  $ilDB->replace("mob_usage",
1078  array(
1079  "id" => array("integer", (int) $a_mob_id),
1080  "usage_type" => array("text", $a_type),
1081  "usage_id" => array("integer", $a_id),
1082  "usage_lang" => array("text", $a_lang),
1083  "usage_hist_nr" => array("integer", (int) $a_usage_hist_nr)
1084  ),
1085  array()
1086  );
1087 
1088  self::handleQuotaUpdate(new self($a_mob_id));
1089  }
global $ilDB
+ 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 1575 of file class.ilObjMediaObject.php.

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

1576  {
1577  $lpath = pathinfo($a_loc);
1578  if ($lpath["extension"] == "mp3" && $a_format == "audio/mpeg")
1579  {
1580  return true;
1581  }
1582  if ($lpath["extension"] == "flv")
1583  {
1584  return true;
1585  }
1586  if (in_array($a_format, array("video/mp4", "video/webm")))
1587  {
1588  return true;
1589  }
1590  return false;
1591  }
+ 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 993 of file class.ilObjMediaObject.php.

References $contains_int_link.

994  {
996  }

◆ 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 
458  global $ilAppEventHandler;
459  $ilAppEventHandler->raise('Services/MediaObjects',
460  'create',
461  array('object' => $this,
462  'obj_type' => 'mob',
463  'obj_id' => $this->getId())
464  );
465  }
& 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 620 of file class.ilObjMediaObject.php.

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

621  {
623  }
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 1865 of file class.ilObjMediaObject.php.

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

1866  {
1867  $new_obj = new ilObjMediaObject();
1868  $new_obj->setTitle($this->getTitle());
1869  $new_obj->setDescription($this->getDescription());
1870 
1871  // media items
1872  foreach($this->getMediaItems() as $key => $val)
1873  {
1874  $new_obj->addMediaItem($val);
1875  }
1876 
1877  $new_obj->create(false, true);
1878 
1879  // files
1880  $new_obj->createDirectory();
1881  self::_createThumbnailDirectory($new_obj->getId());
1883  ilObjMediaObject::_getDirectory($new_obj->getId()));
1885  ilObjMediaObject::_getThumbnailDirectory($new_obj->getId()));
1886 
1887  // meta data
1888  include_once("Services/MetaData/classes/class.ilMD.php");
1889  $md = new ilMD(0, $this->getId(), "mob");
1890  $new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
1891 
1892  return $new_obj;
1893  }
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 895 of file class.ilObjMediaObject.php.

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

896  {
897  $subdir = "il_".IL_INST_ID."_mob_".$this->getId();
898  ilUtil::makeDir($a_target_dir."/objects/".$subdir);
899 
900  $mobdir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->getId();
901  ilUtil::rCopy($mobdir, $a_target_dir."/objects/".$subdir);
902 //echo "from:$mobdir:to:".$a_target_dir."/objects/".$subdir.":<br>";
903  }
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 905 of file class.ilObjMediaObject.php.

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

906  {
907  $subdir = "il_".IL_INST_ID."_mob_".$this->getId();
908  $a_target_dir = $a_target_dir."/objects/".$subdir;
909  ilUtil::makeDir($a_target_dir);
910  $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
911  $tpl->setCurrentBlock("ilMedia");
912 
913  //$int_links = $page_object->getInternalLinks();
914  $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
915 
916  // @todo
917  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
918 
919  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
920  //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
921  require_once("./Services/COPage/classes/class.ilPageObject.php");
922 
923  $xml = "<dummy>";
924  // todo: we get always the first alias now (problem if mob is used multiple
925  // times in page)
926  $xml.= $pg_obj->getMediaAliasElement($this->getId());
927  $xml.= $this->getXML(IL_MODE_OUTPUT);
928  //$xml.= $link_xml;
929  $xml.="</dummy>";
930 
931  //die(htmlspecialchars($xml));
932 
933  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
934  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
935  $xh = xslt_create();
936 
937  //echo "<b>XML:</b>".htmlentities($xml);
938  // determine target frames for internal links
939  $wb_path = "";
940  $enlarge_path = "";
941  $params = array ('mode' => "fullscreen", 'enlarge_path' => $enlarge_path,
942  'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
943  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
944  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
945  //echo xslt_error($xh);
946  xslt_free($xh);
947 
948  // unmask user html
949  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
950  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
951  $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
952  $tpl->setVariable("MEDIA_CONTENT", $output);
953  $output = $tpl->get();
954  //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
955  $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
956  $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i","../../players",$output);
957  $output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","../../players",$output);
958  $output = preg_replace("/file=..\/..\/..\//i","file=../objects/".$subdir."/",$output);
959  //die(htmlspecialchars($output));
960  fwrite(fopen($a_target_dir.'/fullscreen.html','w'), $output );
961  }
xslt_create()
$_GET["client_id"]
xslt_free(&$proc)
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
static getFlashVideoPlayerDirectory()
Get flash video player directory.
_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 882 of file class.ilObjMediaObject.php.

References getXML(), and IL_MODE_FULL.

883  {
884  $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
885  }
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:

◆ fixFilename()

static ilObjMediaObject::fixFilename (   $a_name)
static

Fix filename of uploaded file.

Parameters
string$a_nameupload file name
Returns
string fixed file name

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

References ilUtil\getASCIIFilename().

Referenced by ilObjMediaObjectGUI\savePropertiesObject(), ilObjMediaObjectGUI\setObjectPerCreationForm(), and ilObjMediaObjectGUI\uploadFileObject().

1977  {
1978  $a_name = ilUtil::getASCIIFilename($a_name);
1979 
1980  $rchars = array("`", "=", "$", "{", "}", "'", ";", " ", "(", ")");
1981  $a_name = str_replace($rchars, "_", $a_name);
1982  $a_name = str_replace("__", "_", $a_name);
1983  return $a_name;
1984  }
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generatePreviewPic()

ilObjMediaObject::generatePreviewPic (   $a_width,
  $a_height 
)

Upload video preview picture.

Parameters

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

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

Referenced by ilObjMediaCastGUI\saveCastItemObject().

1918  {
1919  $item = $this->getMediaItem("Standard");
1920 
1921  if ($item->getLocationType() == "LocalFile" &&
1922  is_int(strpos($item->getFormat(), "image/")))
1923  {
1924  $dir = ilObjMediaObject::_getDirectory($this->getId());
1925  $file = $dir."/".
1926  $item->getLocation();
1927  if (is_file($file))
1928  {
1929  if(ilUtil::isConvertVersionAtLeast("6.3.8-3"))
1930  {
1931  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");
1932  }
1933  else
1934  {
1935  ilUtil::convertImage($file, $dir."/mob_vpreview.png", "PNG", $a_width."x".$a_height);
1936  }
1937  }
1938  }
1939  }
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:

◆ getAllowedFileTypes()

static ilObjMediaObject::getAllowedFileTypes ( )
static

Get allowed file types.

Returns
array

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

1829  {
1830  $mset = new ilSetting("mobs");
1831  if (trim($mset->get("restricted_file_types")) == "")
1832  {
1833  return array();
1834  }
1835  return array_map(function ($v)
1836  {
1837  return strtolower(trim($v));
1838  },
1839  explode(",", $mset->get("restricted_file_types")));
1840  }
ILIAS Setting Class.

◆ getDataDirectory()

ilObjMediaObject::getDataDirectory ( )

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

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

Referenced by handleQuotaUpdate().

1565  {
1566  return ilUtil::getWebspaceDir()."/mobs/mm_".$this->getId();
1567  }
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 640 of file class.ilObjMediaObject.php.

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

641  {
642  $a_subdir = str_replace("..", "", $a_subdir);
643  $dir = ilObjMediaObject::_getDirectory($this->getId());
644  if ($a_subdir != "")
645  {
646  $dir.= "/".$a_subdir;
647  }
648 
649  $files = array();
650  if (is_dir($dir))
651  {
652  $entries = ilUtil::getDir($dir);
653  foreach ($entries as $e)
654  {
655  if (is_file($dir."/".$e["entry"]) && $e["entry"] != "." && $e["entry"] != "..")
656  {
657  $files[] = $e["entry"];
658  }
659  }
660  }
661 
662  return $files;
663  }
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:

◆ getForbiddenFileTypes()

static ilObjMediaObject::getForbiddenFileTypes ( )
static

Get forbidden file types.

Returns
array

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

Referenced by ilObjMediaObjectGUI\executeCommand(), and ilObjMediaObjectGUI\initForm().

1810  {
1811  $mset = new ilSetting("mobs");
1812  if (trim($mset->get("black_list_file_types")) == "")
1813  {
1814  return array();
1815  }
1816  return array_map(function ($v)
1817  {
1818  return strtolower(trim($v));
1819  },
1820  explode(",", $mset->get("black_list_file_types")));
1821  }
ILIAS Setting Class.
+ Here is the caller 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 1758 of file class.ilObjMediaObject.php.

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

1759  {
1760  $linked = array();
1761 
1762  if (!is_array($a_ignore))
1763  {
1764  $a_ignore = array();
1765  }
1766 
1767  // get linked media objects (map areas)
1768  $med_items = $this->getMediaItems();
1769 
1770  foreach($med_items as $med_item)
1771  {
1772  $int_links = ilMapArea::_getIntLinks($med_item->getId());
1773  foreach ($int_links as $k => $int_link)
1774  {
1775  if ($int_link["Type"] == "MediaObject")
1776  {
1777  include_once("./Services/Link/classes/class.ilInternalLink.php");
1778  $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
1779  if (ilObject::_exists($l_id))
1780  {
1781  if (!in_array($l_id, $linked) &&
1782  !in_array($l_id, $a_ignore))
1783  {
1784  $linked[] = $l_id;
1785  }
1786  }
1787  }
1788  }
1789  }
1790 //var_dump($linked);
1791  return $linked;
1792  }
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 1220 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(), SurveyQuestion\_lookupSurveyObjId(), ilGlossaryDefinition\_lookupTermId(), ilObjTest\_lookupTestObjIdForQuestionId(), ilObject\_lookupType(), ilPortfolioPage\findPortfolioForPage(), ilObjExercise\lookupExerciseIdForReturnedId(), ilWikiPage\lookupObjIdByPage(), and ilPageObject\lookupParentId().

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

1221  {
1222  if(is_int(strpos($a_usage["type"], ":")))
1223  {
1224  $us_arr = explode(":", $a_usage["type"]);
1225  $type = $us_arr[1];
1226  $cont_type = $us_arr[0];
1227  }
1228  else
1229  {
1230  $type = $a_usage["type"];
1231  }
1232 
1233  $id = $a_usage["id"];
1234  $obj_id = false;
1235 
1236  switch($type)
1237  {
1238  // RTE / tiny mce
1239  case "html":
1240 
1241  switch($cont_type)
1242  {
1243  case "qpl":
1244  // Question Pool *Question* Text (Test)
1245  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1247  if ($qinfo["original_id"] > 0)
1248  {
1249  include_once("./Modules/Test/classes/class.ilObjTest.php");
1250  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1251  }
1252  else
1253  {
1254  $obj_id = $qinfo["obj_fi"]; // usage in pool
1255  }
1256  break;
1257 
1258  case "spl":
1259  // Question Pool *Question* Text (Survey)
1260  include_once("./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
1262  if ($quest)
1263  {
1264  $parent_id = $quest->getObjId();
1265 
1266  // pool question copy - find survey, do not use pool itself
1267  if ($quest->getOriginalId() &&
1268  ilObject::_lookupType($parent_id) == "spl")
1269  {
1271  }
1272  // original question (in pool or survey)
1273  else
1274  {
1275  $obj_id = $parent_id;
1276  }
1277 
1278  unset($quest);
1279  }
1280  break;
1281 
1282  case "exca":
1283  // Exercise assignment
1284  $returned_pk = $a_usage['id'];
1285  // we are just checking against exercise object
1286  include_once 'Modules/Exercise/classes/class.ilObjExercise.php';
1287  $obj_id = ilObjExercise::lookupExerciseIdForReturnedId($returned_pk);
1288  break;
1289 
1290  case "frm":
1291  // Forum
1292  $post_pk = $a_usage['id'];
1293  include_once 'Modules/Forum/classes/class.ilForumPost.php';
1294  include_once 'Modules/Forum/classes/class.ilForum.php';
1295  $oPost = new ilForumPost($post_pk);
1296  $frm_pk = $oPost->getForumId();
1297  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1298  break;
1299 
1300  // temporary items (per user)
1301  case "frm~":
1302  case "exca~":
1303  $obj_id = $a_usage['id'];
1304  break;
1305 
1306  // "old" category pages
1307  case "cat":
1308  // InfoScreen Text
1309  case "tst":
1310  case "svy":
1311  // data collection
1312  case "dcl":
1313  $obj_id = $id;
1314  break;
1315  }
1316  break;
1317 
1318  // page editor
1319  case "pg":
1320 
1321  switch($cont_type)
1322  {
1323  // question feedback // parent obj id is q id
1324  case "qfbg":
1325  include_once('./Services/COPage/classes/class.ilPageObject.php');
1327  // note: no break here, we only altered the $id to the question id
1328 
1329  case "qpl":
1330  // Question Pool Question Pages
1331  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1333  if ($qinfo["original_id"] > 0)
1334  {
1335  include_once("./Modules/Test/classes/class.ilObjTest.php");
1336  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1337  }
1338  else
1339  {
1340  $obj_id = $qinfo["obj_fi"]; // usage in pool
1341  }
1342  if ($obj_id == 0) // this is the case, if question is in learning module -> get lm id
1343  {
1344  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
1345  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "lm");
1346  if ($pinfo && $pinfo["parent_type"] == "lm")
1347  {
1348  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1349  $obj_id = ilLMObject::_lookupContObjID($pinfo["page_id"]);
1350  }
1351  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "sahs");
1352  if ($pinfo && $pinfo["parent_type"] == "sahs")
1353  {
1354  include_once("./Modules/SCORM2004/classes/class.ilSCORM2004Node.php");
1355  $obj_id = ilSCORM2004Node::_lookupSLMID($pinfo["page_id"]);
1356  }
1357  }
1358  break;
1359 
1360  case "lm":
1361  case "dbk":
1362  // learning modules
1363  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1364  $obj_id = ilLMObject::_lookupContObjID($id);
1365  break;
1366 
1367  case "gdf":
1368  // glossary definition
1369  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
1370  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1372  $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
1373  break;
1374 
1375  case "wpg":
1376  // wiki page
1377  include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
1379  break;
1380 
1381  case "sahs":
1382  // sahs page
1383  // can this implementation be used for other content types, too?
1384  include_once('./Services/COPage/classes/class.ilPageObject.php');
1385  $obj_id = ilPageObject::lookupParentId($id, 'sahs');
1386  break;
1387 
1388  case "prtf":
1389  // portfolio
1390  include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
1392  break;
1393 
1394  case "prtt":
1395  // portfolio template
1396  include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
1398  break;
1399 
1400  case "blp":
1401  // blog
1402  include_once('./Services/COPage/classes/class.ilPageObject.php');
1403  $obj_id = ilPageObject::lookupParentId($id, 'blp');
1404  break;
1405 
1406  case "impr":
1407  // imprint page - always id 1
1408  // fallthrough
1409 
1410  case "crs":
1411  case "grp":
1412  case "cat":
1413  case "fold":
1414  case "root":
1415  case "cont":
1416  case "cstr":
1417  // repository pages
1418  $obj_id = $id;
1419  break;
1420  }
1421  break;
1422 
1423  // Media Pool
1424  case "mep":
1425  $obj_id = $id;
1426  break;
1427 
1428  // News Context Object (e.g. MediaCast)
1429  case "news":
1430  include_once("./Services/News/classes/class.ilNewsItem.php");
1432  break;
1433  }
1434 
1435  return $obj_id;
1436  }
static _lookupObjIdForForumId($a_for_id)
static _lookupSurveyObjId($a_question_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
static _lookupType($a_id, $a_reference=false)
lookup object type
static _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 (this is for the input form, this list will be empty, if "allowed list" is empty)

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

Referenced by ilObjMediaObjectGUI\executeCommand(), and ilObjMediaObjectGUI\initForm().

1798  {
1799  return array_filter(self::getAllowedFileTypes(), function ($v) {
1800  return !in_array($v, self::getForbiddenFileTypes());
1801  });
1802  }
+ Here is the caller graph for this function:

◆ getSrtFiles()

ilObjMediaObject::getSrtFiles ( )

Get srt files.

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

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

Referenced by getXML().

1688  {
1689  $srt_dir = ilObjMediaObject::_getDirectory($this->getId())."/srt";
1690 
1691  if (!is_dir($srt_dir))
1692  {
1693  return array();
1694  }
1695 
1696  $items = ilUtil::getDir($srt_dir);
1697 
1698  $srt_files = array();
1699  foreach ($items as $i)
1700  {
1701  if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file")
1702  {
1703  $name = explode(".", $i["entry"]);
1704  if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_")
1705  {
1706  $srt_files[] = array("file" => $i["entry"],
1707  "full_path" => "srt/".$i["entry"], "language" => substr($name[0], 9, 2));
1708  }
1709  }
1710  }
1711 
1712  return $srt_files;
1713  }
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 1734 of file class.ilObjMediaObject.php.

References _getThumbnailDirectory().

Referenced by ilPCIIMOverlaysTableGUI\fillRow().

1735  {
1736  $t_dir = ilObjMediaObject::_getThumbnailDirectory($a_mob_id);
1737  return $t_dir."/".$a_thumbname;
1738  }
_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 1112 of file class.ilObjMediaObject.php.

References getId(), and lookupUsages().

Referenced by delete(), and handleQuotaUpdate().

1113  {
1114  return $this->lookupUsages($this->getId(), $a_include_history);
1115  }
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 1947 of file class.ilObjMediaObject.php.

References _getDirectory(), and getId().

Referenced by ilObjMediaCastGUI\getCastItemValues().

1948  {
1949  $dir = ilObjMediaObject::_getDirectory($this->getId());
1950  $ppics = array("mob_vpreview.jpg",
1951  "mob_vpreview.jpeg",
1952  "mob_vpreview.png");
1953  foreach ($ppics as $p)
1954  {
1955  if (is_file($dir."/".$p))
1956  {
1957  if ($a_filename_only)
1958  {
1959  return $p;
1960  }
1961  else
1962  {
1963  return $dir."/".$p;
1964  }
1965  }
1966  }
1967  return "";
1968  }
_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 670 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().

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

Referenced by getXML().

873  {
874  $a_str = str_replace("&amp;", "&", $a_str);
875  $a_str = str_replace("&", "&amp;", $a_str);
876  return $a_str;
877  }
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected

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

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

514  {
515  global $ilSetting;
516 
517  // if neither workspace nor portfolios are activated, we skip
518  // the quota update here. this due to performance reasons on installations
519  // that do not use workspace/portfolios, but heavily copy content.
520  // in extreme cases (media object in pool and personal blog, deactivate workspace, change media object,
521  // this may lead to incorrect data in the quota calculation)
522  if ($ilSetting->get("disable_personal_workspace") && !$ilSetting->get('user_portfolios'))
523  {
524  return;
525  }
526 
527  $parent_obj_ids = array();
528  foreach($a_mob->getUsages() as $item)
529  {
530  $parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
531  if($parent_obj_id &&
532  !in_array($parent_obj_id, $parent_obj_ids))
533  {
534  $parent_obj_ids[]= $parent_obj_id;
535  }
536  }
537 
538  // we could suppress this if object is present in a (repository) media pool
539  // but this would lead to "quota-breaches" when the pool item is deleted
540  // and "suddenly" all workspace owners get filesize added to their
541  // respective quotas, regardless of current status
542 
543  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
545  $a_mob->getId(),
546  ilUtil::dirSize($a_mob->getDataDirectory()),
547  $parent_obj_ids);
548  }
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  }

◆ isTypeAllowed()

static ilObjMediaObject::isTypeAllowed (   $a_type)
static

Is type allowed.

Parameters
string$a_type
Returns
bool

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

Referenced by ilPageObjectGUI\showPage().

1849  {
1850  if (in_array($a_type, self::getForbiddenFileTypes()))
1851  {
1852  return false;
1853  }
1854  if (count(self::getAllowedFileTypes()) == 0 || in_array($a_type, self::getAllowedFileTypes()))
1855  {
1856  return true;
1857  }
1858  return false;
1859  }
+ Here is the caller graph for this function:

◆ 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 1122 of file class.ilObjMediaObject.php.

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

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

1123  {
1124  global $ilDB;
1125 
1126  $hist_str = "";
1127  if ($a_include_history)
1128  {
1129  $hist_str = ", usage_hist_nr";
1130  }
1131 
1132  // get usages in pages
1133  $q = "SELECT DISTINCT usage_type, usage_id, usage_lang".$hist_str." FROM mob_usage WHERE id = ".
1134  $ilDB->quote($a_id, "integer");
1135 
1136  if (!$a_include_history)
1137  {
1138  $q.= " AND usage_hist_nr = ".$ilDB->quote(0, "integer");
1139  }
1140 
1141  $us_set = $ilDB->query($q);
1142  $ret = array();
1143  while($us_rec = $ilDB->fetchAssoc($us_set))
1144  {
1145  $ut = "";
1146  if(is_int(strpos($us_rec["usage_type"], ":")))
1147  {
1148  $us_arr = explode(":", $us_rec["usage_type"]);
1149  $ut = $us_arr[1];
1150  $ct = $us_arr[0];
1151  }
1152 
1153  // check whether page exists
1154  $skip = false;
1155  if ($ut == "pg")
1156  {
1157  include_once("./Services/COPage/classes/class.ilPageObject.php");
1158  if (!ilPageObject::_exists($ct, $us_rec["usage_id"]))
1159  {
1160  $skip = true;
1161  }
1162  }
1163 
1164  if (!$skip)
1165  {
1166  $ret[] = array("type" => $us_rec["usage_type"],
1167  "id" => $us_rec["usage_id"],
1168  "lang" => $us_rec["usage_lang"],
1169  "hist_nr" => $us_rec["usage_hist_nr"]);
1170  }
1171  }
1172 
1173  // get usages in media pools
1174  $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = ".
1175  $ilDB->quote($a_id, "integer")." AND mep_item.type = ".$ilDB->quote("mob", "text");
1176  $us_set = $ilDB->query($q);
1177  while($us_rec = $ilDB->fetchAssoc($us_set))
1178  {
1179  $ret[] = array("type" => "mep",
1180  "id" => $us_rec["mep_id"]);
1181  }
1182 
1183  // get usages in news items (media casts)
1184  include_once("./Services/News/classes/class.ilNewsItem.php");
1185  $news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
1186  foreach($news_usages as $nu)
1187  {
1188  $ret[] = $nu;
1189  }
1190 
1191 
1192  // get usages in map areas
1193  $q = "SELECT DISTINCT mob_id FROM media_item it, map_area area ".
1194  " WHERE area.item_id = it.id ".
1195  " AND area.link_type = ".$ilDB->quote("int", "text")." ".
1196  " AND area.target = ".$ilDB->quote("il__mob_".$a_id, "text");
1197  $us_set = $ilDB->query($q);
1198  while($us_rec = $ilDB->fetchAssoc($us_set))
1199  {
1200  $ret[] = array("type" => "map",
1201  "id" => $us_rec["mob_id"]);
1202  }
1203 
1204  // get usages in personal clipboards
1205  $users = ilObjUser::_getUsersForClipboadObject("mob", $a_id);
1206  foreach ($users as $user)
1207  {
1208  $ret[] = array("type" => "clip",
1209  "id" => $user);
1210  }
1211 
1212  return $ret;
1213  }
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
global $ilDB
_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 1718 of file class.ilObjMediaObject.php.

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

1720  {
1721  $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1723  self::_createThumbnailDirectory($this->getId());
1724  ilUtil::convertImage($m_dir."/".$a_file,
1725  $t_dir."/".$a_thumbname, $a_format, $a_size);
1726  }
_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 963 of file class.ilObjMediaObject.php.

References ilUtil\insertInstIntoID().

964  {
965  if ($a_tag == "Identifier" && $a_param == "Entry")
966  {
967  $a_value = ilUtil::insertInstIntoID($a_value);
968  }
969 
970  return $a_value;
971  }
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 1744 of file class.ilObjMediaObject.php.

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

1745  {
1746  $file = str_replace("..", "", $a_file);
1748  if (is_file($file))
1749  {
1750  unlink($file);
1751  }
1752  }
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:

◆ renameExecutables()

static ilObjMediaObject::renameExecutables (   $a_dir)
static

Rename executables.

Parameters
string

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

References ilUtil\renameExecutables(), and ilUtil\rRenameSuffix().

Referenced by ilObjMediaObjectGUI\executeCommand(), ilMediaObjectDataSet\importRecord(), ilObjMediaObjectGUI\savePropertiesObject(), ilObjMediaObjectGUI\setObjectPerCreationForm(), and ilObjMediaObjectGUI\uploadFileObject().

1992  {
1993  ilUtil::renameExecutables($a_dir);
1994  if (!self::isTypeAllowed("html"))
1995  {
1996  ilUtil::rRenameSuffix($a_dir, "html", "sec"); // see #20187
1997  }
1998  }
static rRenameSuffix($a_dir, $a_old_suffix, $a_new_suffix)
Renames all files with certain suffix and gives them a new suffix.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
+ Here is the call graph for this function:
+ Here is the caller 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 984 of file class.ilObjMediaObject.php.

985  {
986  $this->contains_int_link = $a_contains_link;
987  }

◆ 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 471 of file class.ilObjMediaObject.php.

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

472  {
473  parent::update();
474 
475  if(!$a_upload)
476  {
477  $this->updateMetaData();
478  }
479 
481 
482  // iterate all items
483  $media_items =& $this->getMediaItems();
484  $j = 1;
485  foreach($media_items as $key => $val)
486  {
487  $item =& $media_items[$key];
488  if (is_object($item))
489  {
490  $item->setMobId($this->getId());
491  $item->setNr($j);
492  if ($item->getLocationType() == "Reference")
493  {
494  $item->extractUrlParameters();
495  }
496  $item->create();
497  $j++;
498  }
499  }
500 
501  self::handleQuotaUpdate($this);
502 
503  global $ilAppEventHandler;
504  $ilAppEventHandler->raise('Services/MediaObjects',
505  'update',
506  array('object' => $this,
507  'obj_type' => 'mob',
508  'obj_id' => $this->getId())
509  );
510 
511  }
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 1652 of file class.ilObjMediaObject.php.

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

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

1653  {
1654  $a_subdir = str_replace("..", "", $a_subdir);
1655  $dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
1656  if ($a_subdir != "")
1657  {
1658  $dir.= "/".$a_subdir;
1659  }
1660  ilUtil::makeDirParents($dir);
1661  ilUtil::moveUploadedFile($tmp_name, $a_name, $dir."/".$a_name);
1662  self::renameExecutables($mob_dir);
1663  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1664  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1665 
1666  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sanitizeDir($a_path)
Sanitize directory recursively.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
_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 1674 of file class.ilObjMediaObject.php.

References uploadAdditionalFile().

1675  {
1676  if (is_file($a_tmp_name) && $a_language != "")
1677  {
1678  $this->uploadAdditionalFile("subtitle_".$a_language.".srt", $a_tmp_name, "srt");
1679  return true;
1680  }
1681  return false;
1682  }
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 1901 of file class.ilObjMediaObject.php.

References uploadAdditionalFile().

1902  {
1903  $pi = pathinfo($a_prevpic["name"]);
1904  $ext = $pi["extension"];
1905  if (in_array($ext, array("jpg", "jpeg", "png")))
1906  {
1907  $this->uploadAdditionalFile("mob_vpreview.".$ext, $a_prevpic["tmp_name"]);
1908  }
1909  }
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: