ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 _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 ()
 
 uploadAdditionalFile ($a_name, $tmp_name, $a_subdir="", $a_mode="move_uploaded")
 Create new media object and update page in db and return new media object. More...
 
 uploadSrtFile ($a_tmp_name, $a_language, $a_mode="move_uploaded")
 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...
 
 getMultiSrtUploadDir ()
 Get directory for multi srt upload. More...
 
 uploadMultipleSubtitleFile ($a_file)
 Upload multi srt file. More...
 
 clearMultiSrtDirectory ()
 Clear multi feedback directory. More...
 
 getMultiSrtFiles ()
 Get all srt files of srt multi upload. 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...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _exists ($a_id)
 checks wether a lm content object with specified id exists or not More...
 
static _getURL ($a_mob_id)
 get directory for files of media object (static) 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, $a_external=false)
 get mime type for file More...
 
static _determineWidthHeight ($a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
 Determine width and height. 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 _saveTempFileAsMediaObject ($name, $tmp_name, $upload=TRUE)
 Create new media object and update page in db and return new media object. 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 _lookupImportId ($a_obj_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 fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. 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 644 of file class.ilObjMediaObject.php.

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

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

645  {
647  ilUtil::createDirectory(ilUtil::getWebspaceDir()."/thumbs/mm_".$a_obj_id);
648  }
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 1017 of file class.ilObjMediaObject.php.

References $ilDB, and $row.

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

1018  {
1019  global $ilDB;
1020 
1021  $and_hist = "";
1022  if ($a_usage_hist_nr !== false)
1023  {
1024  $and_hist = " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
1025  }
1026 
1027  $mob_ids = array();
1028  $set = $ilDB->query("SELECT id FROM mob_usage".
1029  " WHERE usage_type = ".$ilDB->quote($a_type, "text").
1030  " AND usage_id = ".$ilDB->quote($a_id, "integer").
1031  " AND usage_lang = ".$ilDB->quote($a_lang, "text").
1032  $and_hist);
1033  while($row = $ilDB->fetchAssoc($set))
1034  {
1035  $mob_ids[] = $row["id"];
1036  }
1037 
1038  $q = "DELETE FROM mob_usage WHERE usage_type = ".
1039  $ilDB->quote($a_type, "text").
1040  " AND usage_id= ".$ilDB->quote($a_id, "integer").
1041  " AND usage_lang = ".$ilDB->quote($a_lang, "text").
1042  $and_hist;
1043  $ilDB->manipulate($q);
1044 
1045  foreach($mob_ids as $mob_id)
1046  {
1047  self::handleQuotaUpdate(new self($mob_id));
1048  }
1049  }
global $ilDB
+ Here is the caller graph for this function:

◆ _determineWidthHeight()

static ilObjMediaObject::_determineWidthHeight (   $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 1493 of file class.ilObjMediaObject.php.

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

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

1496  {
1497  global $lng;
1498 
1499  // determine width and height of known image types
1500  $width = 640;
1501  $height = 360;
1502  $info = "";
1503 
1504  if ($a_format == "audio/mpeg")
1505  {
1506  $width = 300;
1507  $height = 20;
1508  }
1509 
1510  if (ilUtil::deducibleSize($a_format))
1511  {
1512  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1513  if ($a_type == "File")
1514  {
1516  }
1517  else
1518  {
1519  $size = ilMediaImageUtil::getImageSize($a_reference);
1520  }
1521  }
1522 
1523  if ($a_use_original)
1524  {
1525  if ($size[0] > 0 && $size[1] > 0)
1526  {
1527  $width = $size[0];
1528  $height = $size[1];
1529  }
1530  else
1531  {
1532  $info = $lng->txt("cont_could_not_determine_resource_size");
1533  }
1534  }
1535  else
1536  {
1537  $w = (int) $a_user_width;
1538  $h = (int) $a_user_height;
1539  $width = $w;
1540  $height = $h;
1541 //echo "<br>C-$width-$height-";
1542  if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions)
1543  {
1544  if ($size[0] > 0 && $size[1] > 0)
1545  {
1546  if ($w > 0)
1547  {
1548  $wr = $size[0] / $w;
1549  }
1550  if ($h > 0)
1551  {
1552  $hr = $size[1] / $h;
1553  }
1554 //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1555 //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1556  $r = max($wr, $hr);
1557  if ($r > 0)
1558  {
1559  $width = (int) ($size[0]/$r);
1560  $height = (int) ($size[1]/$r);
1561  }
1562  }
1563  }
1564 //echo "<br>D-$width-$height-";
1565  }
1566 //echo "<br>E-$width-$height-";
1567  return array("width" => $width, "height" => $height, "info" => $info);
1568  }
$size
Definition: RandomTest.php:79
static getImageSize($a_location)
Get image size from location.
$h
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
$w
$info
Definition: example_052.php:80
$r
Definition: example_031.php:79
+ 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\quoteTopLevelPostObject(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjForumGUI\setTopicCreateDefaultValues(), ilObjForumGUI\setTreeStateAsynchObject(), ilForumXMLWriter\start(), and ilExSubmissionTextGUI\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 571 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(), getMultiSrtUploadDir(), ilMediaItem\getOriginalSize(), ilPortfolioTemplatePage\getPageDiskSize(), getSrtFiles(), ilObjMediaObjectGUI\getStandardSizeObject(), getVideoPreviewPic(), ilMediaObjectDataSet\getXmlRecord(), ilMediaObjectDataSet\importRecord(), makeThumbnail(), ilPCMediaObject\modifyPageContentPostXsl(), ilDataCollectionDatatype\parseHTML(), ilDataCollectionDatatype\parseValue(), removeAdditionalFile(), ilObjMediaObjectGUI\resizeImagesObject(), ilObjMediaObjectGUI\savePropertiesObject(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), and uploadAdditionalFile().

572  {
573  return ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id;
574  }
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 1054 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(), ilLMMultiSrt\getMultiSrtFiles(), ilCOPageExporter\getXmlExportHeadDependencies(), ilPCMediaObject\modifyPageContentPostXsl(), ilObjForumGUI\quoteTopLevelPostObject(), ilPageObject\resolveMediaAliases(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjForumGUI\setTreeStateAsynchObject(), ilForumXMLWriter\start(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), assOrderingHorizontal\toJSON(), assTextSubset\toJSON(), assLongMenu\toJSON(), assImagemapQuestion\toJSON(), assKprimChoice\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assOrderingQuestion\toJSON(), assErrorText\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

1055  {
1056  global $ilDB;
1057 
1058  $lstr = "";
1059  if ($a_lang != "")
1060  {
1061  $lstr = " AND usage_lang = ".$ilDB->quote($a_lang, "text");
1062  }
1063  $hist_str = "";
1064  if ($a_usage_hist_nr !== false)
1065  {
1066  $hist_str = " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
1067  }
1068 
1069  $q = "SELECT * FROM mob_usage WHERE ".
1070  "usage_type = ".$ilDB->quote($a_type, "text")." AND ".
1071  "usage_id = ".$ilDB->quote($a_id, "integer").
1072  $lstr.$hist_str;
1073  $mobs = array();
1074  $mob_set = $ilDB->query($q);
1075  while($mob_rec = $ilDB->fetchAssoc($mob_set))
1076  {
1077  if (ilObject::_lookupType($mob_rec["id"]) == "mob")
1078  {
1079  $mobs[$mob_rec["id"]] = $mob_rec["id"];
1080  }
1081  }
1082 
1083  return $mobs;
1084  }
$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 1574 of file class.ilObjMediaObject.php.

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

1575  {
1576  return array("image/x-ms-bmp", "image/gif", "image/jpeg", "image/x-portable-bitmap",
1577  "image/png", "image/psd", "image/tiff", "application/pdf");
1578  }
+ 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 591 of file class.ilObjMediaObject.php.

References ilUtil\getWebspaceDir().

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

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

◆ _getURL()

static ilObjMediaObject::_getURL (   $a_mob_id)
static

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id
Returns
string

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

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

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

582  {
583  return ilUtil::getHtmlPath(ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id);
584  }
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 612 of file class.ilObjMediaObject.php.

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

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

614  {
615  if ($a_purpose == "")
616  {
617  $a_purpose = "Standard";
618  }
619  $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
620  if (preg_match("/https?\:/i",$location))
621  return $location;
622 
623  if ($a_url_encode)
624  $location = rawurlencode($location);
625 
626  $path = ($a_web)
627  ? ILIAS_HTTP_PATH
628  : ".";
629 
630  return $path."/data/".CLIENT_ID."/mobs/mm_".$a_mob_id."/".$location;
631  }
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 601 of file class.ilObjMediaObject.php.

References _lookupItemPath().

Referenced by ilSCORM2004ScoGUI\getExportResources().

603  {
604  return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
605  }
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 1110 of file class.ilObjMediaObject.php.

References $ilDB.

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

1111  {
1112  global $ilDB;
1113 
1114  $q = "DELETE FROM mob_usage WHERE ".
1115  " id = ".$ilDB->quote((int) $a_mob_id, "integer")." AND ".
1116  " usage_type = ".$ilDB->quote($a_type, "text")." AND ".
1117  " usage_id = ".$ilDB->quote((int) $a_id, "integer")." AND ".
1118  " usage_lang = ".$ilDB->quote($a_lang, "text")." AND ".
1119  " usage_hist_nr = ".$ilDB->quote((int) $a_usage_hist_nr, "integer");
1120  $ilDB->manipulate($q);
1121 
1122  self::handleQuotaUpdate(new self($a_mob_id));
1123  }
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 1461 of file class.ilObjMediaObject.php.

References $location, and ilUtil\resizeImage().

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

1462  {
1463  $file_path = pathinfo($a_file);
1464  $location = substr($file_path["basename"],0,strlen($file_path["basename"]) -
1465  strlen($file_path["extension"]) - 1)."_".
1466  $a_width."_".
1467  $a_height.".".$file_path["extension"];
1468  $target_file = $file_path["dirname"]."/".
1469  $location;
1470  ilUtil::resizeImage($a_file, $target_file,
1471  (int) $a_width, (int) $a_height, $a_constrain_prop);
1472 
1473  return $location;
1474  }
$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()

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

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

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

1613  {
1614  // create dummy object in db (we need an id)
1615  $media_object = new ilObjMediaObject();
1616  $media_object->setTitle($name);
1617  $media_object->setDescription("");
1618  $media_object->create();
1619 
1620  // determine and create mob directory, move uploaded file to directory
1621  $media_object->createDirectory();
1622  $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
1623 
1624  $media_item =& new ilMediaItem();
1625  $media_object->addMediaItem($media_item);
1626  $media_item->setPurpose("Standard");
1627 
1628  $file = $mob_dir."/".$name;
1629  if ($upload)
1630  {
1631  ilUtil::moveUploadedFile($tmp_name,$name, $file);
1632  }
1633  else
1634  {
1635  copy($tmp_name, $file);
1636  }
1637  // get mime type
1639  $location = $name;
1640  // set real meta and object data
1641  $media_item->setFormat($format);
1642  $media_item->setLocation($location);
1643  $media_item->setLocationType("LocalFile");
1644  $media_object->setTitle($name);
1645  $media_object->setDescription($format);
1646 
1647  if (ilUtil::deducibleSize($format))
1648  {
1649  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1651  $media_item->setWidth($size[0]);
1652  $media_item->setHeight($size[1]);
1653  }
1654  $media_item->setHAlign("Left");
1655 
1656  self::renameExecutables($mob_dir);
1657  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1658  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1659 
1660  $media_object->update();
1661 
1662  return $media_object;
1663  }
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 moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem.
static getMimeType($a_file, $a_external=false)
get mime type for 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:

◆ _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 1089 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(), ilDataCollectionDataSet\getXmlNamespace(), ilForumXMLParser\handlerEndTag(), ilObjSurvey\importObject(), ilSurveyImporter\importXmlRepresentation(), ilDataCollectionDatatype\parseValue(), ilObjForumGUI\quoteTopLevelPostObject(), ilPCMediaObject\saveMobUsage(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjForumGUI\setTopicCreateDefaultValues(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), and ilExSubmissionTextGUI\updateAssignmentTextObject().

1090  {
1091  global $ilDB;
1092 
1093  $ilDB->replace("mob_usage",
1094  array(
1095  "id" => array("integer", (int) $a_mob_id),
1096  "usage_type" => array("text", $a_type),
1097  "usage_id" => array("integer", $a_id),
1098  "usage_lang" => array("text", $a_lang),
1099  "usage_hist_nr" => array("integer", (int) $a_usage_hist_nr)
1100  ),
1101  array()
1102  );
1103 
1104  self::handleQuotaUpdate(new self($a_mob_id));
1105  }
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 1591 of file class.ilObjMediaObject.php.

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

1592  {
1593  $lpath = pathinfo($a_loc);
1594  if ($lpath["extension"] == "mp3" && $a_format == "audio/mpeg")
1595  {
1596  return true;
1597  }
1598  if ($lpath["extension"] == "flv")
1599  {
1600  return true;
1601  }
1602  if (in_array($a_format, array("video/mp4", "video/webm")))
1603  {
1604  return true;
1605  }
1606  return false;
1607  }
+ 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 275 of file class.ilObjMediaObject.php.

276  {
277  $this->media_items[] = $a_item;
278  }

◆ clearMultiSrtDirectory()

ilObjMediaObject::clearMultiSrtDirectory ( )

Clear multi feedback directory.

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

References ilUtil\delDir(), and getMultiSrtUploadDir().

2042  {
2044  }
getMultiSrtUploadDir()
Get directory for multi srt upload.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

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

References $contains_int_link.

1010  {
1011  return $this->contains_int_link;
1012  }

◆ create()

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

create media object in db

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

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

454  {
455  parent::create();
456 
457  if (!$a_create_meta_data)
458  {
459  $this->createMetaData();
460  }
461 
462  if ($a_save_media_items)
463  {
464  $media_items =& $this->getMediaItems();
465  for($i=0; $i<count($media_items); $i++)
466  {
467  $item =& $media_items[$i];
468  $item->setMobId($this->getId());
469  $item->setNr($i+1);
470  $item->create();
471  }
472  }
473 
474  self::handleQuotaUpdate($this);
475 
476  global $ilAppEventHandler;
477  $ilAppEventHandler->raise('Services/MediaObjects',
478  'create',
479  array('object' => $this,
480  'obj_type' => 'mob',
481  'obj_id' => $this->getId())
482  );
483  }
& 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 636 of file class.ilObjMediaObject.php.

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

637  {
639  }
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 215 of file class.ilObjMediaObject.php.

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

Referenced by create().

216  {
217  include_once 'Services/MetaData/classes/class.ilMDCreator.php';
218 
219  global $ilUser;
220 
221  $md_creator = new ilMDCreator(0, $this->getId(), $this->getType());
222  $md_creator->setTitle($this->getTitle());
223  $md_creator->setTitleLanguage($ilUser->getPref('language'));
224  $md_creator->setDescription($this->getDescription());
225  $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
226  $md_creator->setKeywordLanguage($ilUser->getPref('language'));
227  $md_creator->setLanguage($ilUser->getPref('language'));
228  $md_creator->create();
229 
230  return true;
231  }
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(), ilLoggerFactory\getLogger(), and getUsages().

101  {
102  $mob_logger = ilLoggerFactory::getLogger('mob');
103  $mob_logger->debug("ilObjMediaObject: Delete called for media object ID '".$this->getId()."'.");
104 
105  if (!($this->getId() > 0))
106  {
107  return;
108  }
109 
110  $usages = $this->getUsages();
111 
112  $mob_logger->debug("ilObjMediaObject: ... Found ".count($usages)." usages.");
113 
114  if (count($usages) == 0)
115  {
116  // remove directory
118 
119  // remove thumbnail directory
121 
122  // delete meta data of mob
123  $this->deleteMetaData();
124 
125  // delete media items
127 
128  // this is just to make sure, there should be no entries left at
129  // this point as they depend on the usage
130  self::handleQuotaUpdate($this);
131 
132  // delete object
133  parent::delete();
134 
135  $mob_logger->debug("ilObjMediaObject: ... deleted.");
136  }
137  else
138  {
139  foreach ($usages as $u)
140  {
141  $mob_logger->debug("ilObjMediaObject: ... usage type:".$u["type"].
142  ", id:".$u["id"].
143  ", lang:".$u["lang"].
144  ", hist_nr:".$u["hist_nr"].".");
145  }
146  $mob_logger->debug("ilObjMediaObject: ... not deleted.");
147  }
148  }
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 getLogger($a_component_id)
Get component logger.
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 261 of file class.ilObjMediaObject.php.

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

Referenced by delete().

262  {
263  // Delete meta data
264  include_once('Services/MetaData/classes/class.ilMD.php');
265  $md = new ilMD(0, $this->getId(), $this->getType());
266  $md->deleteAll();
267  }
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 1881 of file class.ilObjMediaObject.php.

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

1882  {
1883  $new_obj = new ilObjMediaObject();
1884  $new_obj->setTitle($this->getTitle());
1885  $new_obj->setDescription($this->getDescription());
1886 
1887  // media items
1888  foreach($this->getMediaItems() as $key => $val)
1889  {
1890  $new_obj->addMediaItem($val);
1891  }
1892 
1893  $new_obj->create(false, true);
1894 
1895  // files
1896  $new_obj->createDirectory();
1897  self::_createThumbnailDirectory($new_obj->getId());
1899  ilObjMediaObject::_getDirectory($new_obj->getId()));
1901  ilObjMediaObject::_getThumbnailDirectory($new_obj->getId()));
1902 
1903  // meta data
1904  include_once("Services/MetaData/classes/class.ilMD.php");
1905  $md = new ilMD(0, $this->getId(), "mob");
1906  $new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
1907 
1908  return $new_obj;
1909  }
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 911 of file class.ilObjMediaObject.php.

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

912  {
913  $subdir = "il_".IL_INST_ID."_mob_".$this->getId();
914  ilUtil::makeDir($a_target_dir."/objects/".$subdir);
915 
916  $mobdir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->getId();
917  ilUtil::rCopy($mobdir, $a_target_dir."/objects/".$subdir);
918 //echo "from:$mobdir:to:".$a_target_dir."/objects/".$subdir.":<br>";
919  }
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 921 of file class.ilObjMediaObject.php.

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

922  {
923  $subdir = "il_".IL_INST_ID."_mob_".$this->getId();
924  $a_target_dir = $a_target_dir."/objects/".$subdir;
925  ilUtil::makeDir($a_target_dir);
926  $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
927  $tpl->setCurrentBlock("ilMedia");
928 
929  //$int_links = $page_object->getInternalLinks();
930  $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
931 
932  // @todo
933  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
934 
935  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
936  //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
937  require_once("./Services/COPage/classes/class.ilPageObject.php");
938 
939  $xml = "<dummy>";
940  // todo: we get always the first alias now (problem if mob is used multiple
941  // times in page)
942  $xml.= $pg_obj->getMediaAliasElement($this->getId());
943  $xml.= $this->getXML(IL_MODE_OUTPUT);
944  //$xml.= $link_xml;
945  $xml.="</dummy>";
946 
947  //die(htmlspecialchars($xml));
948 
949  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
950  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
951  $xh = xslt_create();
952 
953  //echo "<b>XML:</b>".htmlentities($xml);
954  // determine target frames for internal links
955  $wb_path = "";
956  $enlarge_path = "";
957  $params = array ('mode' => "fullscreen", 'enlarge_path' => $enlarge_path,
958  'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
959  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
960  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
961  //echo xslt_error($xh);
962  xslt_free($xh);
963 
964  // unmask user html
965  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
966  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
967  $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
968  $tpl->setVariable("MEDIA_CONTENT", $output);
969  $output = $tpl->get();
970  //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
971  $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
972  $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i","../../players",$output);
973  $output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","../../players",$output);
974  $output = preg_replace("/file=..\/..\/..\//i","file=../objects/".$subdir."/",$output);
975  //die(htmlspecialchars($output));
976  fwrite(fopen($a_target_dir.'/fullscreen.html','w'), $output );
977  }
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
$params
Definition: example_049.php:96
+ Here is the call graph for this function:

◆ exportXML()

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

export XML

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

References getXML(), and IL_MODE_FULL.

899  {
900  $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
901  }
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 1992 of file class.ilObjMediaObject.php.

References ilUtil\getASCIIFilename().

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

1993  {
1994  $a_name = ilUtil::getASCIIFilename($a_name);
1995 
1996  $rchars = array("`", "=", "$", "{", "}", "'", ";", " ", "(", ")");
1997  $a_name = str_replace($rchars, "_", $a_name);
1998  $a_name = str_replace("__", "_", $a_name);
1999  return $a_name;
2000  }
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 1933 of file class.ilObjMediaObject.php.

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

Referenced by ilObjMediaCastGUI\saveCastItemObject().

1934  {
1935  $item = $this->getMediaItem("Standard");
1936 
1937  if ($item->getLocationType() == "LocalFile" &&
1938  is_int(strpos($item->getFormat(), "image/")))
1939  {
1940  $dir = ilObjMediaObject::_getDirectory($this->getId());
1941  $file = $dir."/".
1942  $item->getLocation();
1943  if (is_file($file))
1944  {
1945  if(ilUtil::isConvertVersionAtLeast("6.3.8-3"))
1946  {
1947  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");
1948  }
1949  else
1950  {
1951  ilUtil::convertImage($file, $dir."/mob_vpreview.png", "PNG", $a_width."x".$a_height);
1952  }
1953  }
1954  }
1955  }
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 1844 of file class.ilObjMediaObject.php.

1845  {
1846  $mset = new ilSetting("mobs");
1847  if (trim($mset->get("restricted_file_types")) == "")
1848  {
1849  return array();
1850  }
1851  return array_map(function ($v)
1852  {
1853  return strtolower(trim($v));
1854  },
1855  explode(",", $mset->get("restricted_file_types")));
1856  }
ILIAS Setting Class.

◆ getDataDirectory()

ilObjMediaObject::getDataDirectory ( )

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

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

Referenced by handleQuotaUpdate().

1581  {
1582  return ilUtil::getWebspaceDir()."/mobs/mm_".$this->getId();
1583  }
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 155 of file class.ilObjMediaObject.php.

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

156  {
157  return parent::getDescription();
158  }
+ 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 656 of file class.ilObjMediaObject.php.

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

657  {
658  $a_subdir = str_replace("..", "", $a_subdir);
659  $dir = ilObjMediaObject::_getDirectory($this->getId());
660  if ($a_subdir != "")
661  {
662  $dir.= "/".$a_subdir;
663  }
664 
665  $files = array();
666  if (is_dir($dir))
667  {
668  $entries = ilUtil::getDir($dir);
669  foreach ($entries as $e)
670  {
671  if (is_file($dir."/".$e["entry"]) && $e["entry"] != "." && $e["entry"] != "..")
672  {
673  $files[] = $e["entry"];
674  }
675  }
676  }
677 
678  return $files;
679  }
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 1825 of file class.ilObjMediaObject.php.

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

1826  {
1827  $mset = new ilSetting("mobs");
1828  if (trim($mset->get("black_list_file_types")) == "")
1829  {
1830  return array();
1831  }
1832  return array_map(function ($v)
1833  {
1834  return strtolower(trim($v));
1835  },
1836  explode(",", $mset->get("black_list_file_types")));
1837  }
ILIAS Setting Class.
+ Here is the caller graph for this function:

◆ getId()

◆ getImportId()

ilObjMediaObject::getImportId ( )

get import id

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

References ilObject\$import_id.

441  {
442  return $this->import_id;
443  }

◆ getLinkedMediaObjects()

ilObjMediaObject::getLinkedMediaObjects (   $a_ignore = "")

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

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

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

1775  {
1776  $linked = array();
1777 
1778  if (!is_array($a_ignore))
1779  {
1780  $a_ignore = array();
1781  }
1782 
1783  // get linked media objects (map areas)
1784  $med_items = $this->getMediaItems();
1785 
1786  foreach($med_items as $med_item)
1787  {
1788  $int_links = ilMapArea::_getIntLinks($med_item->getId());
1789  foreach ($int_links as $k => $int_link)
1790  {
1791  if ($int_link["Type"] == "MediaObject")
1792  {
1793  include_once("./Services/Link/classes/class.ilInternalLink.php");
1794  $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
1795  if (ilObject::_exists($l_id))
1796  {
1797  if (!in_array($l_id, $linked) &&
1798  !in_array($l_id, $a_ignore))
1799  {
1800  $linked[] = $l_id;
1801  }
1802  }
1803  }
1804  }
1805  }
1806 //var_dump($linked);
1807  return $linked;
1808  }
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 297 of file class.ilObjMediaObject.php.

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

298  {
299  foreach ($this->media_items as $media_item)
300  {
301  if($media_item->getPurpose() == $a_purpose)
302  {
303  return $media_item;
304  }
305  }
306  return false;
307  }
+ Here is the caller graph for this function:

◆ getMediaItemNr()

ilObjMediaObject::getMediaItemNr (   $a_purpose)

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

345  {
346  for($i=0; $i<count($this->media_items); $i++)
347  {
348  if($this->media_items[$i]->getPurpose() == $a_purpose)
349  {
350  return $i + 1;
351  }
352  }
353  return false;
354  }

◆ getMediaItems()

& ilObjMediaObject::getMediaItems ( )

get all media items

Returns
array array of media item objects

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

References $media_items.

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

287  {
288  return $this->media_items;
289  }
+ Here is the caller graph for this function:

◆ getMimeType()

static ilObjMediaObject::getMimeType (   $a_file,
  $a_external = false 
)
static

get mime type for file

Parameters
string$a_filefile name
Returns
string mime type static

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

References ilMimeTypeUtil\APPLICATION__OCTET_STREAM, and ilMimeTypeUtil\lookupMimeType().

Referenced by _saveTempFileAsMediaObject(), ilObjMediaObjectGUI\assignFullscreenObject(), ilObjMediaObjectGUI\assignStandardObject(), ilKprimChoiceWizardInputGUI\checkUploads(), ilPCInteractiveImageGUI\create(), ilFileUtils\createFile(), ilObjMediaPoolGUI\createMediaFromUploadDir(), ilSCORM13Package\dbImportSco(), ilPublicUserProfileGUI\deliverVCard(), ilSCORM13Player\getMimetype(), ilMediaPlayerGUI\getMp3PlayerHtml(), ilDataCollectionDatatype\parseValue(), ilObjMediaObjectGUI\savePropertiesObject(), assMultipleChoice\setImageFile(), assSingleChoice\setImageFile(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), and ilFSStorageExercise\uploadFile().

1484  {
1485  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1487  return $mime;
1488  }
static lookupMimeType($path_to_file, $fallback=self::APPLICATION__OCTET_STREAM, $a_external=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMultiSrtFiles()

ilObjMediaObject::getMultiSrtFiles ( )

Get all srt files of srt multi upload.

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

References $lang, ilMDLanguageItem\_getPossibleLanguageCodes(), ilUtil\getDir(), and getMultiSrtUploadDir().

2050  {
2051  $items = array();
2052 
2053  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
2055 
2056  $dir = $this->getMultiSrtUploadDir();
2057  $files = ilUtil::getDir($dir);
2058  foreach ($files as $k => $i)
2059  {
2060  // check directory
2061  if ($i["type"] == "file" && !in_array($k, array(".", "..")))
2062  {
2063  if (pathinfo($k, PATHINFO_EXTENSION) == "srt")
2064  {
2065  $lang = "";
2066  if (substr($k, strlen($k) - 7, 1) == "_")
2067  {
2068  $lang = substr($k, strlen($k) - 6, 2);
2069  if (!in_array($lang, $lang_codes))
2070  {
2071  $lang = "";
2072  }
2073  }
2074  $items[] = array("filename" => $k, "lang" => $lang);
2075  }
2076  }
2077  }
2078  return $items;
2079  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
getMultiSrtUploadDir()
Get directory for multi srt upload.
+ Here is the call graph for this function:

◆ getMultiSrtUploadDir()

ilObjMediaObject::getMultiSrtUploadDir ( )

Get directory for multi srt upload.

Parameters

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

References _getDirectory(), and getId().

Referenced by clearMultiSrtDirectory(), getMultiSrtFiles(), and uploadMultipleSubtitleFile().

2010  {
2011  return ilObjMediaObject::_getDirectory($this->getId()."/srt/tmp");
2012  }
_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:

◆ getOriginID()

ilObjMediaObject::getOriginID ( )

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

References $origin_id.

426  {
427  return $this->origin_id;
428  }

◆ 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 1236 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(), ilExSubmission\lookupExerciseIdForReturnedId(), ilWikiPage\lookupObjIdByPage(), and ilPageObject\lookupParentId().

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

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

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

1814  {
1815  return array_filter(self::getAllowedFileTypes(), function ($v) {
1816  return !in_array($v, self::getForbiddenFileTypes());
1817  });
1818  }
+ Here is the caller graph for this function:

◆ getSrtFiles()

ilObjMediaObject::getSrtFiles ( )

Get srt files.

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

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

Referenced by getXML().

1704  {
1705  $srt_dir = ilObjMediaObject::_getDirectory($this->getId())."/srt";
1706 
1707  if (!is_dir($srt_dir))
1708  {
1709  return array();
1710  }
1711 
1712  $items = ilUtil::getDir($srt_dir);
1713 
1714  $srt_files = array();
1715  foreach ($items as $i)
1716  {
1717  if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file")
1718  {
1719  $name = explode(".", $i["entry"]);
1720  if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_")
1721  {
1722  $srt_files[] = array("file" => $i["entry"],
1723  "full_path" => "srt/".$i["entry"], "language" => substr($name[0], 9, 2));
1724  }
1725  }
1726  }
1727 
1728  return $srt_files;
1729  }
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 1750 of file class.ilObjMediaObject.php.

References _getThumbnailDirectory().

Referenced by ilPCIIMOverlaysTableGUI\fillRow().

1751  {
1752  $t_dir = ilObjMediaObject::_getThumbnailDirectory($a_mob_id);
1753  return $t_dir."/".$a_thumbname;
1754  }
_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 1128 of file class.ilObjMediaObject.php.

References getId(), and lookupUsages().

Referenced by delete(), and handleQuotaUpdate().

1129  {
1130  return $this->lookupUsages($this->getId(), $a_include_history);
1131  }
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 1963 of file class.ilObjMediaObject.php.

References _getDirectory(), and getId().

Referenced by ilObjMediaCastGUI\getCastItemValues().

1964  {
1965  $dir = ilObjMediaObject::_getDirectory($this->getId());
1966  $ppics = array("mob_vpreview.jpg",
1967  "mob_vpreview.jpeg",
1968  "mob_vpreview.png");
1969  foreach ($ppics as $p)
1970  {
1971  if (is_file($dir."/".$p))
1972  {
1973  if ($a_filename_only)
1974  {
1975  return $p;
1976  }
1977  else
1978  {
1979  return $dir."/".$p;
1980  }
1981  }
1982  }
1983  return "";
1984  }
_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 686 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().

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

Referenced by getXML().

889  {
890  $a_str = str_replace("&amp;", "&", $a_str);
891  $a_str = str_replace("&", "&amp;", $a_str);
892  return $a_str;
893  }
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected

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

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

530  {
531  global $ilSetting;
532 
533  // if neither workspace nor portfolios are activated, we skip
534  // the quota update here. this due to performance reasons on installations
535  // that do not use workspace/portfolios, but heavily copy content.
536  // in extreme cases (media object in pool and personal blog, deactivate workspace, change media object,
537  // this may lead to incorrect data in the quota calculation)
538  if ($ilSetting->get("disable_personal_workspace") && !$ilSetting->get('user_portfolios'))
539  {
540  return;
541  }
542 
543  $parent_obj_ids = array();
544  foreach($a_mob->getUsages() as $item)
545  {
546  $parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
547  if($parent_obj_id &&
548  !in_array($parent_obj_id, $parent_obj_ids))
549  {
550  $parent_obj_ids[]= $parent_obj_id;
551  }
552  }
553 
554  // we could suppress this if object is present in a (repository) media pool
555  // but this would lead to "quota-breaches" when the pool item is deleted
556  // and "suddenly" all workspace owners get filesize added to their
557  // respective quotas, regardless of current status
558 
559  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
561  $a_mob->getId(),
562  ilUtil::dirSize($a_mob->getDataDirectory()),
563  $parent_obj_ids);
564  }
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 357 of file class.ilObjMediaObject.php.

References hasPurposeItem().

358  {
359  return $this->hasPurposeItem("Fullscreen");
360  }
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 368 of file class.ilObjMediaObject.php.

References getMediaItem().

Referenced by hasFullscreenItem().

369  {
370  if(is_object($this->getMediaItem($purpose)))
371  {
372  return true;
373  }
374  else
375  {
376  return false;
377  }
378  }
& 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 415 of file class.ilObjMediaObject.php.

References $is_alias.

416  {
417  return $this->is_alias;
418  }

◆ isTypeAllowed()

static ilObjMediaObject::isTypeAllowed (   $a_type)
static

Is type allowed.

Parameters
string$a_type
Returns
bool

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

Referenced by ilPageObjectGUI\showPage().

1865  {
1866  if (in_array($a_type, self::getForbiddenFileTypes()))
1867  {
1868  return false;
1869  }
1870  if (count(self::getAllowedFileTypes()) == 0 || in_array($a_type, self::getAllowedFileTypes()))
1871  {
1872  return true;
1873  }
1874  return false;
1875  }
+ 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 1138 of file class.ilObjMediaObject.php.

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

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

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

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

1736  {
1737  $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1739  self::_createThumbnailDirectory($this->getId());
1740  ilUtil::convertImage($m_dir."/".$a_file,
1741  $t_dir."/".$a_thumbname, $a_format, $a_size);
1742  }
_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 179 of file class.ilObjMediaObject.php.

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

180  {
181  include_once 'Services/MetaData/classes/class.ilMD.php';
182 
183  switch($a_element)
184  {
185  case 'General':
186 
187  // Update Title and description
188  $md = new ilMD(0, $this->getId(), $this->getType());
189  $md_gen = $md->getGeneral();
190 
191  if (is_object($md_gen))
192  {
193  ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
194  $this->setTitle($md_gen->getTitle());
195 
196  foreach($md_gen->getDescriptionIds() as $id)
197  {
198  $md_des = $md_gen->getDescription($id);
199  ilObject::_writeDescription($this->getId(),$md_des->getDescription());
200  $this->setDescription($md_des->getDescription());
201  break;
202  }
203  }
204 
205  break;
206 
207  default:
208  }
209  return true;
210  }
_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 979 of file class.ilObjMediaObject.php.

References ilUtil\insertInstIntoID().

980  {
981  if ($a_tag == "Identifier" && $a_param == "Entry")
982  {
983  $a_value = ilUtil::insertInstIntoID($a_value);
984  }
985 
986  return $a_value;
987  }
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 385 of file class.ilObjMediaObject.php.

References ilMediaItem\_getMediaItemsOfMOb().

386  {
387 //echo "<br>ilObjMediaObject:read";
388  parent::read();
389 
390  // get media items
392  }
_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 1760 of file class.ilObjMediaObject.php.

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

1761  {
1762  $file = str_replace("..", "", $a_file);
1764  if (is_file($file))
1765  {
1766  unlink($file);
1767  }
1768  }
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 338 of file class.ilObjMediaObject.php.

339  {
340  $this->media_items = array();
341  }

◆ removeMediaItem()

ilObjMediaObject::removeMediaItem (   $a_purpose)

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

References $media_items, and getId().

314  {
315  foreach ($this->media_items as $key => $media_item)
316  {
317  if($media_item->getPurpose() == $a_purpose)
318  {
319  unset($this->media_items[$key]);
320  }
321  }
322  // update numbers and keys
323  $i = 1;
324  $media_items = array();
325  foreach ($this->media_items as $media_item)
326  {
327  $media_items [$i] = $media_item;
328  $media_item->setMobId($this->getId());
329  $media_item->setNr($i);
330  $i++;
331  }
332  $this->media_items = $media_items;
333  }
+ Here is the call graph for this function:

◆ renameExecutables()

static ilObjMediaObject::renameExecutables (   $a_dir)
static

Rename executables.

Parameters
string

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

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

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

2087  {
2088  ilUtil::renameExecutables($a_dir);
2089  if (!self::isTypeAllowed("html"))
2090  {
2091  ilUtil::rRenameSuffix($a_dir, "html", "sec"); // see #20187
2092  }
2093  }
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 410 of file class.ilObjMediaObject.php.

411  {
412  $this->is_alias = $a_is_alias;
413  }

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

1001  {
1002  $this->contains_int_link = $a_contains_link;
1003  }

◆ setDescription()

ilObjMediaObject::setDescription (   $a_description)

set description of media object

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

Referenced by MDUpdateListener().

164  {
165  parent::setDescription($a_description);
166  }
+ Here is the caller graph for this function:

◆ setId()

ilObjMediaObject::setId (   $a_id)

set id

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

398  {
399  $this->id = $a_id;
400  }

◆ setImportId()

ilObjMediaObject::setImportId (   $a_id)

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

446  {
447  $this->import_id = $a_id;
448  }

◆ setOriginID()

ilObjMediaObject::setOriginID (   $a_id)

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

421  {
422  return $this->origin_id = $a_id;
423  }

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

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

490  {
491  parent::update();
492 
493  if(!$a_upload)
494  {
495  $this->updateMetaData();
496  }
497 
499 
500  // iterate all items
501  $media_items =& $this->getMediaItems();
502  $j = 1;
503  foreach($media_items as $key => $val)
504  {
505  $item =& $media_items[$key];
506  if (is_object($item))
507  {
508  $item->setMobId($this->getId());
509  $item->setNr($j);
510  if ($item->getLocationType() == "Reference")
511  {
512  $item->extractUrlParameters();
513  }
514  $item->create();
515  $j++;
516  }
517  }
518 
519  self::handleQuotaUpdate($this);
520  global $ilAppEventHandler;
521  $ilAppEventHandler->raise('Services/MediaObjects',
522  'update',
523  array('object' => $this,
524  'obj_type' => 'mob',
525  'obj_id' => $this->getId())
526  );
527  }
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 236 of file class.ilObjMediaObject.php.

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

Referenced by update().

237  {
238  include_once("Services/MetaData/classes/class.ilMD.php");
239  include_once("Services/MetaData/classes/class.ilMDGeneral.php");
240  include_once("Services/MetaData/classes/class.ilMDDescription.php");
241 
242  $md =& new ilMD(0, $this->getId(), $this->getType());
243  $md_gen =& $md->getGeneral();
244  $md_gen->setTitle($this->getTitle());
245 
246  // sets first description (maybe not appropriate)
247  $md_des_ids =& $md_gen->getDescriptionIds();
248  if (count($md_des_ids) > 0)
249  {
250  $md_des =& $md_gen->getDescription($md_des_ids[0]);
251  $md_des->setDescription($this->getDescription());
252  $md_des->update();
253  }
254  $md_gen->update();
255 
256  }
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 = "",
  $a_mode = "move_uploaded" 
)

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

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

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

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

1669  {
1670  $a_subdir = str_replace("..", "", $a_subdir);
1671  $dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
1672  if ($a_subdir != "")
1673  {
1674  $dir.= "/".$a_subdir;
1675  }
1676  ilUtil::makeDirParents($dir);
1677  ilUtil::moveUploadedFile($tmp_name, $a_name, $dir."/".$a_name, true, $a_mode);
1678  self::renameExecutables($mob_dir);
1679  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1680  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1681 
1682  }
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:

◆ uploadMultipleSubtitleFile()

ilObjMediaObject::uploadMultipleSubtitleFile (   $a_file)

Upload multi srt file.

Parameters
array$a_filefile info array
Exceptions
ilMediaObjectsException

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

References $ilUser, ilObject\$lng, ilUtil\delDir(), getMultiSrtUploadDir(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), and ilUtil\unzip().

2022  {
2023  global $lng, $ilUser;
2024 
2025  include_once("./Services/MediaObjects/exceptions/class.ilMediaObjectsException.php");
2026  if (!is_file($a_file["tmp_name"]))
2027  {
2028  throw new ilMediaObjectsException($lng->txt("mob_file_could_not_be_uploaded"));
2029  }
2030 
2031  $dir = $this->getMultiSrtUploadDir();
2032  ilUtil::delDir($dir, true);
2033  ilUtil::makeDirParents($dir);
2034  ilUtil::moveUploadedFile($a_file["tmp_name"], "multi_srt.zip", $dir."/"."multi_srt.zip");
2035  ilUtil::unzip($dir."/multi_srt.zip", true);
2036  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
General exception class for media objects.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
getMultiSrtUploadDir()
Get directory for multi srt upload.
global $ilUser
Definition: imgupload.php:15
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ uploadSrtFile()

ilObjMediaObject::uploadSrtFile (   $a_tmp_name,
  $a_language,
  $a_mode = "move_uploaded" 
)

Upload srt file.

Parameters

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

References uploadAdditionalFile().

1691  {
1692  if (is_file($a_tmp_name) && $a_language != "")
1693  {
1694  $this->uploadAdditionalFile("subtitle_".$a_language.".srt", $a_tmp_name, "srt", $a_mode);
1695  return true;
1696  }
1697  return false;
1698  }
uploadAdditionalFile($a_name, $tmp_name, $a_subdir="", $a_mode="move_uploaded")
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 1917 of file class.ilObjMediaObject.php.

References uploadAdditionalFile().

1918  {
1919  $pi = pathinfo($a_prevpic["name"]);
1920  $ext = $pi["extension"];
1921  if (in_array($ext, array("jpg", "jpeg", "png")))
1922  {
1923  $this->uploadAdditionalFile("mob_vpreview.".$ext, $a_prevpic["tmp_name"]);
1924  }
1925  }
uploadAdditionalFile($a_name, $tmp_name, $a_subdir="", $a_mode="move_uploaded")
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: