ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjMediaObject Class Reference

Class ilObjMediaObject. More...

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

Public Member Functions

 __construct ($a_id=0)
 Constructor @access public. More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 createReference ()
 creates reference for object More...
 
 setTitle ($a_title)
 set object title More...
 
 getTitle ()
 get object title @access public More...
 
 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 ()
 get object id @access public More...
 
 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)
 set import id More...
 
 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...
 
 createDirectory ()
 Create file directory of media object. More...
 
 getFilesOfDirectory ($a_subdir="")
 Get files of directory. More...
 
 getXML ($a_mode=IL_MODE_FULL, $a_inst=0, $a_sign_locals=false)
 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...
 
 getUsages ($a_include_history=true)
 get all usages of current media object 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
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. 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...
 
 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...
 
 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) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 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...
 
 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, $a_reference=false, $a_type=null)
 checks wether a lm content object with specified id exists or not More...
 
static _getDirectory ($a_mob_id)
 Get absolute directory. More...
 
static _getRelativeDirectory ($a_mob_id)
 Get relative (to webspace dir) directory. More...
 
static _getURL ($a_mob_id)
 get directory for files of media object (static) More...
 
static _getThumbnailDirectory ($a_mob_id, $a_mode="filesystem")
 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 _createThumbnailDirectory ($a_obj_id)
 Create thumbnail directory. More...
 
static _deleteAllUsages ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 static More...
 
static _getMobsOfObject ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 get mobs of object More...
 
static _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...
 
static _removeUsage ($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 Remove usage of mob in another container. More...
 
static lookupUsages ($a_id, $a_include_history=true)
 Lookup usages of media object. More...
 
static getParentObjectIdForUsage ($a_usage, $a_include_all_access_obj_ids=false)
 Get's the repository object ID of a parent object, if possible. More...
 
static _resizeImage ($a_file, $a_width, $a_height, $a_constrain_prop=false)
 resize image and return new image file ("_width_height" string appended) More...
 
static getMimeType ($a_file, $a_external=null)
 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 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public 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 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 _lookupCreationDate ($a_id)
 Lookup creation date. 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
 
 $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
 

Protected Member Functions

 escapeProperty ($a_value)
 Escape property (e.g. More...
 

Static Protected Member Functions

static handleQuotaUpdate (ilObjMediaObject $a_mob)
 

Protected Attributes

 $user
 
 $app_event_handler
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaObject::__construct (   $a_id = 0)

Constructor @access public.

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

49 {
50 global $DIC;
51
52 $this->user = $DIC->user();
53 $this->app_event_handler = $DIC["ilAppEventHandler"];
54 $this->lng = $DIC->language();
55 $this->is_alias = false;
56 $this->media_items = array();
57 $this->contains_int_link = false;
58 $this->type = "mob";
59 parent::__construct($a_id, false);
60 }
user()
Definition: user.php:4
global $DIC
Definition: saml.php:7

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _createThumbnailDirectory()

static ilObjMediaObject::_createThumbnailDirectory (   $a_obj_id)
static

Create thumbnail directory.

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

663 {
665 ilUtil::createDirectory(ilUtil::getWebspaceDir() . "/thumbs/mm_" . $a_obj_id);
666 }
static getWebspaceDir($mode="filesystem")
get webspace directory
static createDirectory($a_dir, $a_mod=0755)
create directory

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteAllUsages()

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

static

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

1043 {
1044 global $DIC;
1045
1046 $ilDB = $DIC->database();
1047
1048 $and_hist = "";
1049 if ($a_usage_hist_nr !== false) {
1050 $and_hist = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
1051 }
1052
1053 $mob_ids = array();
1054 $set = $ilDB->query("SELECT id FROM mob_usage" .
1055 " WHERE usage_type = " . $ilDB->quote($a_type, "text") .
1056 " AND usage_id = " . $ilDB->quote($a_id, "integer") .
1057 " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
1058 $and_hist);
1059 while ($row = $ilDB->fetchAssoc($set)) {
1060 $mob_ids[] = $row["id"];
1061 }
1062
1063 $q = "DELETE FROM mob_usage WHERE usage_type = " .
1064 $ilDB->quote($a_type, "text") .
1065 " AND usage_id= " . $ilDB->quote($a_id, "integer") .
1066 " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
1067 $and_hist;
1068 $ilDB->manipulate($q);
1069
1070 foreach ($mob_ids as $mob_id) {
1071 self::handleQuotaUpdate(new self($mob_id));
1072 }
1073 }
static handleQuotaUpdate(ilObjMediaObject $a_mob)
$row
global $ilDB
$a_type
Definition: workflow.php:92

References $a_type, $DIC, $ilDB, $row, and handleQuotaUpdate().

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

+ Here is the call graph for this function:
+ 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 1520 of file class.ilObjMediaObject.php.

1529 {
1530 global $DIC;
1531
1532 $lng = $DIC->language();
1533
1534 // determine width and height of known image types
1535 //$width = 640;
1536 //$height = 360;
1537 $info = "";
1538
1539 if ($a_format == "audio/mpeg") {
1540 $width = 300;
1541 $height = 20;
1542 }
1543
1544 if (ilUtil::deducibleSize($a_format)) {
1545 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1546 if ($a_type == "File") {
1548 } else {
1549 $size = ilMediaImageUtil::getImageSize($a_reference);
1550 }
1551 }
1552
1553 if ($a_use_original) {
1554 if ($size[0] > 0 && $size[1] > 0) {
1555 //$width = $size[0];
1556 //$height = $size[1];
1557 $width = "";
1558 $height = "";
1559 } else {
1560 $info = $lng->txt("cont_could_not_determine_resource_size");
1561 }
1562 } else {
1563 $w = (int) $a_user_width;
1564 $h = (int) $a_user_height;
1565 $width = $w;
1566 $height = $h;
1567 //echo "<br>C-$width-$height-";
1568 if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions) {
1569 if ($size[0] > 0 && $size[1] > 0) {
1570 if ($w > 0) {
1571 $wr = $size[0] / $w;
1572 }
1573 if ($h > 0) {
1574 $hr = $size[1] / $h;
1575 }
1576 //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1577 //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1578 $r = max($wr, $hr);
1579 if ($r > 0) {
1580 $width = (int) ($size[0] / $r);
1581 $height = (int) ($size[1] / $r);
1582 }
1583 }
1584 }
1585 //echo "<br>D-$width-$height-";
1586 }
1587 //echo "<br>E-$width-$height-";
1588
1589 if ($width == 0 && $a_user_width === "") {
1590 $width = "";
1591 }
1592 if ($height == 0 && $a_user_height === "") {
1593 $height = "";
1594 }
1595
1596 return array("width" => $width, "height" => $height, "info" => $info);
1597 }
$size
Definition: RandomTest.php:84
static getImageSize($a_location)
Get image size from location.
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
$h
$w
$r
Definition: example_031.php:79
$info
Definition: index.php:5

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _exists()

static ilObjMediaObject::_exists (   $a_id,
  $a_reference = false,
  $a_type = null 
)
static

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

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

Reimplemented from ilObject.

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

100 {
101 global $DIC;
102
103 $ilDB = $DIC->database();
104
105 include_once("./Services/Link/classes/class.ilInternalLink.php");
106 if (is_int(strpos($a_id, "_"))) {
108 }
109
110 if (parent::_exists($a_id, false) && ilObject::_lookupType($a_id) == "mob") {
111 return true;
112 }
113 return false;
114 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References $DIC, $ilDB, ilInternalLink\_extractObjIdOfTarget(), and ilObject\_lookupType().

Referenced by ilInternalLink\_exists(), ilRTE\_getMediaObjects(), ilObjTest\addQTIMaterial(), assQuestion\addQTIMaterial(), ilObjForumGUI\createThread(), assQuestion\delete(), ilForumDraftsHistory\deleteMobs(), ilForumPostDraft\deleteMobsOfDraft(), ilObjForumGUI\deleteMobsOfDraft(), ilForum\deletePost(), ilObjTest\deleteTest(), ilTestExport\exportXHTMLMediaObjects(), ilQuestionpoolExport\exportXHTMLMediaObjects(), ilObjTest\exportXMLMediaObjects(), ilObjQuestionPool\exportXMLMediaObjects(), ilForumXMLWriter\start(), and ilExSubmissionTextGUI\updateAssignmentTextObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDirectory()

static ilObjMediaObject::_getDirectory (   $a_mob_id)
static

Get absolute directory.

Parameters
int$a_mob_id
Returns
string

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

568 {
569 return ilUtil::getWebspaceDir() . "/" . self::_getRelativeDirectory($a_mob_id);
570 }
static _getRelativeDirectory($a_mob_id)
Get relative (to webspace dir) directory.

References _getRelativeDirectory(), and 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(), ilDclMobRecordRepresentation\getHTML(), getMultiSrtUploadDir(), ilMediaItem\getOriginalSize(), ilPortfolioTemplatePage\getPageDiskSize(), getSrtFiles(), ilObjMediaObjectGUI\getStandardSizeObject(), getVideoPreviewPic(), ilMediaObjectDataSet\getXmlRecord(), ilMediaObjectDataSet\importRecord(), makeThumbnail(), ilPCMediaObject\modifyPageContentPostXsl(), ilDclMobRecordFieldModel\parseValue(), removeAdditionalFile(), ilObjMediaObjectGUI\resizeImagesObject(), ilObjMediaObjectGUI\savePropertiesObject(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), and uploadAdditionalFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMobsOfObject()

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

get mobs of object

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

1079 {
1080 global $DIC;
1081
1082 $ilDB = $DIC->database();
1083
1084 $lstr = "";
1085 if ($a_lang != "") {
1086 $lstr = " AND usage_lang = " . $ilDB->quote($a_lang, "text");
1087 }
1088 $hist_str = "";
1089 if ($a_usage_hist_nr !== false) {
1090 $hist_str = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
1091 }
1092
1093 $q = "SELECT * FROM mob_usage WHERE " .
1094 "usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
1095 "usage_id = " . $ilDB->quote($a_id, "integer") .
1096 $lstr . $hist_str;
1097 $mobs = array();
1098 $mob_set = $ilDB->query($q);
1099 while ($mob_rec = $ilDB->fetchAssoc($mob_set)) {
1100 if (ilObject::_lookupType($mob_rec["id"]) == "mob") {
1101 $mobs[$mob_rec["id"]] = $mob_rec["id"];
1102 }
1103 }
1104
1105 return $mobs;
1106 }
$mobs

References $a_type, $DIC, $ilDB, $mobs, and ilObject\_lookupType().

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), ilForumDraftsHistory\addMobsToDraftsHistory(), ilObjTest\addQTIMaterial(), assQuestion\addQTIMaterial(), ilPCMediaObject\afterPageUpdate(), ilPCMediaObject\beforePageDelete(), ilCOPageHTMLExport\collectPageElements(), SurveyQuestion\copyXHTMLMediaObjectsOfQuestion(), assQuestion\copyXHTMLMediaObjectsOfQuestion(), ilObjForumGUI\createThread(), SurveyQuestion\delete(), assQuestion\delete(), ilPageObject\delete(), ilForumDraftsHistory\deleteMobs(), ilForumPostDraft\deleteMobsOfDraft(), ilObjForumGUI\deleteMobsOfDraft(), ilForum\deletePost(), ilObjSurvey\deleteSurveyRecord(), ilObjTest\deleteTest(), ilForumAutoSaveAsyncDraftAction\executeAndGetResponseObject(), ilObjGlossary\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLPages(), ilSurveyExport\exportXHTMLMediaObjects(), ilTestExport\exportXHTMLMediaObjects(), ilQuestionpoolExport\exportXHTMLMediaObjects(), ilPageObject\getLastUpdateOfIncludedElements(), ilLMMultiSrt\getMobIds(), ilMepMultiSrt\getMobIds(), ilSoapUtils\getMobsOfObject(), ilCOPageExporter\getXmlExportHeadDependencies(), ilPCMediaObject\modifyPageContentPostXsl(), ilForumUtil\moveMediaObjects(), ilObjForumGUI\publishDraftObject(), ilPageObject\resolveMediaAliases(), ilForumXMLWriter\start(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), assClozeTest\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assKprimChoice\toJSON(), assLongMenu\toJSON(), assMatchingQuestion\toJSON(), assMultipleChoice\toJSON(), assOrderingHorizontal\toJSON(), assOrderingQuestion\toJSON(), assSingleChoice\toJSON(), and assTextSubset\toJSON().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getRelativeDirectory()

static ilObjMediaObject::_getRelativeDirectory (   $a_mob_id)
static

Get relative (to webspace dir) directory.

Parameters
int$a_mob_id
Returns
string

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

579 {
580 return "mobs/mm_" . $a_mob_id;
581 }

Referenced by _getDirectory(), and ilObjMediaPoolGUI\performBulkUpload().

+ 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 1603 of file class.ilObjMediaObject.php.

1604 {
1605 return array("image/x-ms-bmp", "image/gif", "image/jpeg", "image/x-portable-bitmap",
1606 "image/png", "image/psd", "image/tiff", "application/pdf");
1607 }

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

+ Here is the caller graph for this function:

◆ _getThumbnailDirectory()

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

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

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

600 {
601 return ilUtil::getWebspaceDir($a_mode) . "/thumbs/mm_" . $a_mob_id;
602 }

References ilUtil\getWebspaceDir().

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

+ 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 589 of file class.ilObjMediaObject.php.

590 {
591 return ilUtil::getHtmlPath(ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id);
592 }
static getHtmlPath($relative_path)
get url of path

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

Referenced by ilMediaCastTableGUI\fillRow(), ilDclMobRecordRepresentation\getHTML(), ilNewsTimelineItemGUI\getMediaPath(), ilNewsForContextBlockGUI\getMediaPath(), and ilObjMediaCastGUI\showGallery().

+ 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 622 of file class.ilObjMediaObject.php.

627 {
628 if ($a_purpose == "") {
629 $a_purpose = "Standard";
630 }
631 $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
632 if (preg_match("/https?\:/i", $location)) {
633 return $location;
634 }
635
636 if ($a_url_encode) {
637 $location = rawurlencode($location);
638 }
639
640 $path = ($a_web)
641 ? ILIAS_HTTP_PATH
642 : ".";
643
644 return $path . "/data/" . CLIENT_ID . "/mobs/mm_" . $a_mob_id . "/" . $location;
645 }
$path
Definition: aliased.php:25
$location
Definition: buildRTE.php:44
static _lookupLocationForMobId($a_mob_id, $a_purpose)
Lookup location for mob id.

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

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

+ 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 609 of file class.ilObjMediaObject.php.

613 {
614 return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
615 }
static _lookupItemPath( $a_mob_id, $a_url_encode=false, $a_web=true, $a_purpose="")
Get path for item with specific purpose.

References _lookupItemPath().

Referenced by ilSCORM2004ScoGUI\getExportResources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _removeUsage()

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

Remove usage of mob in another container.

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

1136 {
1137 global $DIC;
1138
1139 $ilDB = $DIC->database();
1140
1141 $q = "DELETE FROM mob_usage WHERE " .
1142 " id = " . $ilDB->quote((int) $a_mob_id, "integer") . " AND " .
1143 " usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
1144 " usage_id = " . $ilDB->quote((int) $a_id, "integer") . " AND " .
1145 " usage_lang = " . $ilDB->quote($a_lang, "text") . " AND " .
1146 " usage_hist_nr = " . $ilDB->quote((int) $a_usage_hist_nr, "integer");
1147 $ilDB->manipulate($q);
1148
1149 self::handleQuotaUpdate(new self($a_mob_id));
1150 }

References $a_type, $DIC, $ilDB, and handleQuotaUpdate().

Referenced by ilRTE\_cleanupMediaObjectUsage(), ilForumDraftsHistory\addMobsToDraftsHistory(), ilObjForumGUI\createThread(), SurveyQuestion\delete(), assQuestion\delete(), ilForumDraftsHistory\deleteMobs(), ilForumPostDraft\deleteMobsOfDraft(), ilObjForumGUI\deleteMobsOfDraft(), ilForum\deletePost(), ilObjSurvey\deleteSurveyRecord(), ilObjTest\deleteTest(), ilForumAutoSaveAsyncDraftAction\handleMedia(), ilForumUtil\moveMediaObjects(), ilObjForumGUI\publishDraftObject(), and ilExSubmissionTextGUI\updateAssignmentTextObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _resizeImage()

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

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

1484 {
1485 $file_path = pathinfo($a_file);
1486 $location = substr($file_path["basename"], 0, strlen($file_path["basename"]) -
1487 strlen($file_path["extension"]) - 1) . "_" .
1488 $a_width . "_" .
1489 $a_height . "." . $file_path["extension"];
1490 $target_file = $file_path["dirname"] . "/" .
1491 $location;
1493 $a_file,
1494 $target_file,
1495 (int) $a_width,
1496 (int) $a_height,
1497 $a_constrain_prop
1498 );
1499
1500 return $location;
1501 }
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image

References $location, and ilUtil\resizeImage().

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

+ 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 1638 of file class.ilObjMediaObject.php.

1639 {
1640 // create dummy object in db (we need an id)
1641 $media_object = new ilObjMediaObject();
1642 $media_object->setTitle($name);
1643 $media_object->setDescription("");
1644 $media_object->create();
1645
1646 // determine and create mob directory, move uploaded file to directory
1647 $media_object->createDirectory();
1648 $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
1649
1650 $media_item = new ilMediaItem();
1651 $media_object->addMediaItem($media_item);
1652 $media_item->setPurpose("Standard");
1653
1654 $file = $mob_dir . "/" . $name;
1655 if ($upload) {
1656 ilUtil::moveUploadedFile($tmp_name, $name, $file);
1657 } else {
1658 copy($tmp_name, $file);
1659 }
1660 // get mime type
1662 $location = $name;
1663 // set real meta and object data
1664 $media_item->setFormat($format);
1665 $media_item->setLocation($location);
1666 $media_item->setLocationType("LocalFile");
1667 $media_object->setTitle($name);
1668 $media_object->setDescription($format);
1669
1671 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1673 $media_item->setWidth($size[0]);
1674 $media_item->setHeight($size[1]);
1675 }
1676 $media_item->setHAlign("Left");
1677
1678 self::renameExecutables($mob_dir);
1679 include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1680 ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1681
1682 $media_object->update();
1683
1684 return $media_object;
1685 }
Class ilMediaItem.
static sanitizeDir($a_path)
Sanitize directory recursively.
Class ilObjMediaObject.
static getMimeType($a_file, $a_external=null)
get mime type for file
static _getDirectory($a_mob_id)
Get absolute directory.
static renameExecutables($a_dir)
Rename executables.
$format
Definition: metadata.php:141

References $format, $location, $name, $size, _getDirectory(), ilUtil\deducibleSize(), ilMediaImageUtil\getImageSize(), getMimeType(), renameExecutables(), and ilMediaSvgSanitizer\sanitizeDir().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveUsage()

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

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

page)

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

1112 {
1113 global $DIC;
1114
1115 $ilDB = $DIC->database();
1116
1117 $ilDB->replace(
1118 "mob_usage",
1119 array(
1120 "id" => array("integer", (int) $a_mob_id),
1121 "usage_type" => array("text", $a_type),
1122 "usage_id" => array("integer", $a_id),
1123 "usage_lang" => array("text", $a_lang),
1124 "usage_hist_nr" => array("integer", (int) $a_usage_hist_nr)
1125 ),
1126 array()
1127 );
1128
1129 self::handleQuotaUpdate(new self($a_mob_id));
1130 }

References $a_type, $DIC, $ilDB, and handleQuotaUpdate().

Referenced by ilRTE\_cleanupMediaObjectUsage(), ilForumDraftsHistory\addMobsToDraftsHistory(), SurveyQuestion\copyXHTMLMediaObjectsOfQuestion(), assQuestion\copyXHTMLMediaObjectsOfQuestion(), ilObjForumGUI\createThread(), assErrorTextImport\fromXML(), assFileUploadImport\fromXML(), assFlashQuestionImport\fromXML(), assFormulaQuestionImport\fromXML(), assImagemapQuestionImport\fromXML(), assJavaAppletImport\fromXML(), assKprimChoiceImport\fromXML(), assLongMenuImport\fromXML(), assMatchingQuestionImport\fromXML(), assMultipleChoiceImport\fromXML(), assNumericImport\fromXML(), assOrderingHorizontalImport\fromXML(), assOrderingQuestionImport\fromXML(), assSingleChoiceImport\fromXML(), assTextQuestionImport\fromXML(), assTextSubsetImport\fromXML(), ilObjTest\fromXML(), ilForumAutoSaveAsyncDraftAction\handleMedia(), ilForumXMLParser\handlerEndTag(), ilObjSurvey\importObject(), ilSurveyImporter\importXmlRepresentation(), ilForumUtil\moveMediaObjects(), ilDclMobRecordFieldModel\parseValue(), ilObjForumGUI\publishDraftObject(), ilForumUtil\saveMediaObjects(), ilPCMediaObject\saveMobUsage(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), and ilExSubmissionTextGUI\updateAssignmentTextObject().

+ Here is the call graph for this function:
+ 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 1620 of file class.ilObjMediaObject.php.

1621 {
1622 $lpath = pathinfo($a_loc);
1623 if ($lpath["extension"] == "mp3" && $a_format == "audio/mpeg") {
1624 return true;
1625 }
1626 if ($lpath["extension"] == "flv") {
1627 return true;
1628 }
1629 if (in_array($a_format, array("video/mp4", "video/webm"))) {
1630 return true;
1631 }
1632 return false;
1633 }

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

+ 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 284 of file class.ilObjMediaObject.php.

285 {
286 $this->media_items[] = $a_item;
287 }

◆ clearMultiSrtDirectory()

ilObjMediaObject::clearMultiSrtDirectory ( )

Clear multi feedback directory.

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

2056 {
2058 }
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

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

+ 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 1034 of file class.ilObjMediaObject.php.

1035 {
1037 }

References $contains_int_link.

◆ create()

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

create media object in db

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

453 {
454 parent::create();
455
456 if (!$a_create_meta_data) {
457 $this->createMetaData();
458 }
459
460 if ($a_save_media_items) {
461 $media_items = $this->getMediaItems();
462 for ($i = 0; $i < count($media_items); $i++) {
463 $item = $media_items[$i];
464 $item->setMobId($this->getId());
465 $item->setNr($i + 1);
466 $item->create();
467 }
468 }
469
471
472 $ilAppEventHandler = $this->app_event_handler;
473 $ilAppEventHandler->raise(
474 'Services/MediaObjects',
475 'create',
476 array('object' => $this,
477 'obj_type' => 'mob',
478 'obj_id' => $this->getId())
479 );
480 }
getId()
get object id @access public
& getMediaItems()
get all media items
createMetaData()
create meta data entry
$i
Definition: disco.tpl.php:19

References $app_event_handler, $i, $media_items, createMetaData(), getId(), getMediaItems(), and handleQuotaUpdate().

+ Here is the call graph for this function:

◆ createDirectory()

ilObjMediaObject::createDirectory ( )

Create file directory of media object.

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

651 {
654 if (!is_dir($path)) {
655 $this->ilias->raiseError("Failed to create directory $path.", $this->ilias->error_obj->FATAL);
656 }
657 }
redirection script todo: (a better solution should control the processing via a xml file)

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

+ Here is the call graph for this function:

◆ createMetaData()

ilObjMediaObject::createMetaData ( )

create meta data entry

Reimplemented from ilObject.

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

227 {
228 include_once 'Services/MetaData/classes/class.ilMDCreator.php';
229
231
232 $md_creator = new ilMDCreator(0, $this->getId(), $this->getType());
233 $md_creator->setTitle($this->getTitle());
234 $md_creator->setTitleLanguage($ilUser->getPref('language'));
235 $md_creator->setDescription($this->getDescription());
236 $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
237 $md_creator->setKeywordLanguage($ilUser->getPref('language'));
238 $md_creator->setLanguage($ilUser->getPref('language'));
239 $md_creator->create();
240
241 return true;
242 }
getTitle()
get object title @access public
getDescription()
get description of media object
getType()
get object type @access public
$ilUser
Definition: imgupload.php:18

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

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createReference()

ilObjMediaObject::createReference ( )

creates reference for object

@access public

Returns
integer reference_id of object

Reimplemented from ilObject.

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

78 {
79 $this->ilias->raiseError("Operation ilObjMedia::createReference() not allowed.", $this->ilias->error_obj->FATAL);
80 }

◆ delete()

ilObjMediaObject::delete ( )

delete media object

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

120 {
121 $mob_logger = ilLoggerFactory::getLogger('mob');
122 $mob_logger->debug("ilObjMediaObject: Delete called for media object ID '" . $this->getId() . "'.");
123
124 if (!($this->getId() > 0)) {
125 return;
126 }
127
128 $usages = $this->getUsages();
129
130 $mob_logger->debug("ilObjMediaObject: ... Found " . count($usages) . " usages.");
131
132 if (count($usages) == 0) {
133 // remove directory
135
136 // remove thumbnail directory
138
139 // delete meta data of mob
140 $this->deleteMetaData();
141
142 // delete media items
144
145 // this is just to make sure, there should be no entries left at
146 // this point as they depend on the usage
148
149 // delete object
150 parent::delete();
151
152 $mob_logger->debug("ilObjMediaObject: ... deleted.");
153 } else {
154 foreach ($usages as $u) {
155 $mob_logger->debug("ilObjMediaObject: ... usage type:" . $u["type"] .
156 ", id:" . $u["id"] .
157 ", lang:" . $u["lang"] .
158 ", hist_nr:" . $u["hist_nr"] . ".");
159 }
160 $mob_logger->debug("ilObjMediaObject: ... not deleted.");
161 }
162 }
static getLogger($a_component_id)
Get component logger.
static deleteAllItemsOfMob($a_mob_id)
Delete all items of a mob.
static _getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
deleteMetaData()
delete meta data entry
getUsages($a_include_history=true)
get all usages of current media object

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

+ Here is the call graph for this function:

◆ deleteMetaData()

ilObjMediaObject::deleteMetaData ( )

delete meta data entry

Reimplemented from ilObject.

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

271 {
272 // Delete meta data
273 include_once('Services/MetaData/classes/class.ilMD.php');
274 $md = new ilMD(0, $this->getId(), $this->getType());
275 $md->deleteAll();
276 }

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

Referenced by delete().

+ 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 1898 of file class.ilObjMediaObject.php.

1899 {
1900 $new_obj = new ilObjMediaObject();
1901 $new_obj->setTitle($this->getTitle());
1902 $new_obj->setDescription($this->getDescription());
1903
1904 // media items
1905 foreach ($this->getMediaItems() as $key => $val) {
1906 $new_obj->addMediaItem($val);
1907 }
1908
1909 $new_obj->create(false, true);
1910
1911 // files
1912 $new_obj->createDirectory();
1913 self::_createThumbnailDirectory($new_obj->getId());
1916 ilObjMediaObject::_getDirectory($new_obj->getId())
1917 );
1921 );
1922
1923 // meta data
1924 include_once("Services/MetaData/classes/class.ilMD.php");
1925 $md = new ilMD(0, $this->getId(), "mob");
1926 $new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
1927
1928 return $new_obj;
1929 }
static _createThumbnailDirectory($a_obj_id)
Create thumbnail directory.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
$key
Definition: croninfo.php:18

References $key, _createThumbnailDirectory(), _getDirectory(), _getThumbnailDirectory(), getDescription(), getId(), getMediaItems(), getTitle(), and ilUtil\rCopy().

+ Here is the call graph for this function:

◆ escapeProperty()

ilObjMediaObject::escapeProperty (   $a_value)
protected

Escape property (e.g.

title, caption) to XSLT -> HTML output

Parameters
string$a_value
Returns
string

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

906 {
907 return htmlspecialchars($a_value);
908 }

Referenced by getXML().

+ Here is the caller 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 937 of file class.ilObjMediaObject.php.

938 {
939 $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
940 ilUtil::makeDir($a_target_dir . "/objects/" . $subdir);
941
942 $mobdir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->getId();
943 ilUtil::rCopy($mobdir, $a_target_dir . "/objects/" . $subdir);
944 //echo "from:$mobdir:to:".$a_target_dir."/objects/".$subdir.":<br>";
945 }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

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

+ Here is the call graph for this function:

◆ exportMediaFullscreen()

ilObjMediaObject::exportMediaFullscreen (   $a_target_dir,
  $pg_obj 
)

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

948 {
949 $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
950 $a_target_dir = $a_target_dir . "/objects/" . $subdir;
951 ilUtil::makeDir($a_target_dir);
952 $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
953 $tpl->setCurrentBlock("ilMedia");
954
955 //$int_links = $page_object->getInternalLinks();
956 $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
957
958 // @todo
959 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
960
961 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
962 //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
963 require_once("./Services/COPage/classes/class.ilPageObject.php");
964
965 $xml = "<dummy>";
966 // todo: we get always the first alias now (problem if mob is used multiple
967 // times in page)
968 $xml .= $pg_obj->getMediaAliasElement($this->getId());
969 $xml .= $this->getXML(IL_MODE_OUTPUT);
970 //$xml.= $link_xml;
971 $xml .= "</dummy>";
972
973 //die(htmlspecialchars($xml));
974
975 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
976 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
977 $xh = xslt_create();
978
979 //echo "<b>XML:</b>".htmlentities($xml);
980 // determine target frames for internal links
981 $wb_path = "";
982 $enlarge_path = "";
983 $params = array('mode' => "fullscreen", 'enlarge_path' => $enlarge_path,
984 'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => "",
985 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
986 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
987 //echo xslt_error($xh);
988 xslt_free($xh);
989
990 // unmask user html
991 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
992 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
993 $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
994 $tpl->setVariable("MEDIA_CONTENT", $output);
995 $output = $tpl->get();
996 //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
997 $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i", "$2", $output);
998 $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i", "../../players", $output);
999 $output = preg_replace("/\.\/" . str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory()) . "/i", "../../players", $output);
1000 $output = preg_replace("/file=..\/..\/..\//i", "file=../objects/" . $subdir . "/", $output);
1001 //die(htmlspecialchars($output));
1002 fwrite(fopen($a_target_dir . '/fullscreen.html', 'w'), $output);
1003 }
$tpl
Definition: ilias.php:10
$_GET["client_id"]
const IL_MODE_OUTPUT
static _getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
getXML($a_mode=IL_MODE_FULL, $a_inst=0, $a_sign_locals=false)
get MediaObject XLM Tag
static getFlashVideoPlayerDirectory()
Get flash video player directory.
special template class to simplify handling of ITX/PEAR
xslt_free(&$proc)
xslt_create()

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

+ Here is the call graph for this function:

◆ exportXML()

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

export XML

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

925 {
926 $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
927 }
const IL_MODE_FULL

References getXML(), and IL_MODE_FULL.

+ 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 2006 of file class.ilObjMediaObject.php.

2007 {
2008 $a_name = ilUtil::getASCIIFilename($a_name);
2009
2010 $rchars = array("`", "=", "$", "{", "}", "'", ";", " ", "(", ")");
2011 $a_name = str_replace($rchars, "_", $a_name);
2012 $a_name = str_replace("__", "_", $a_name);
2013 return $a_name;
2014 }
static getASCIIFilename($a_filename)
convert utf8 to ascii filename

References ilUtil\getASCIIFilename().

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

+ 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

return

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

1958 {
1959 $item = $this->getMediaItem("Standard");
1960
1961 if ($item->getLocationType() == "LocalFile" &&
1962 is_int(strpos($item->getFormat(), "image/"))) {
1963 $dir = ilObjMediaObject::_getDirectory($this->getId());
1964 $file = $dir . "/" .
1965 $item->getLocation();
1966 if (is_file($file)) {
1967 if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
1968 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");
1969 } else {
1970 ilUtil::convertImage($file, $dir . "/mob_vpreview.png", "PNG", $a_width . "x" . $a_height);
1971 }
1972 }
1973 }
1974 }
& getMediaItem($a_purpose)
get item for media purpose
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static escapeShellArg($a_arg)
static execConvert($args)
execute convert command

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

+ Here is the call graph for this function:

◆ getAllowedFileTypes()

static ilObjMediaObject::getAllowedFileTypes ( )
static

Get allowed file types.

Returns
array

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

1864 {
1865 $mset = new ilSetting("mobs");
1866 if (trim($mset->get("restricted_file_types")) == "") {
1867 return array();
1868 }
1869 return array_map(
1870 function ($v) {
1871 return strtolower(trim($v));
1872 },
1873 explode(",", $mset->get("restricted_file_types"))
1874 );
1875 }
ILIAS Setting Class.

◆ getDataDirectory()

ilObjMediaObject::getDataDirectory ( )

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

1610 {
1611 return ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->getId();
1612 }

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

Referenced by getXML(), and handleQuotaUpdate().

+ 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

Reimplemented from ilObject.

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

170 {
171 return parent::getDescription();
172 }
static getDescription()
Definition: Php.php:51

References Gettext\Languages\Exporter\getDescription().

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

+ Here is the call graph for this function:
+ 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 674 of file class.ilObjMediaObject.php.

675 {
676 $a_subdir = str_replace("..", "", $a_subdir);
677 $dir = ilObjMediaObject::_getDirectory($this->getId());
678 if ($a_subdir != "") {
679 $dir .= "/" . $a_subdir;
680 }
681
682 $files = array();
683 if (is_dir($dir)) {
684 $entries = ilUtil::getDir($dir);
685 foreach ($entries as $e) {
686 if (is_file($dir . "/" . $e["entry"]) && $e["entry"] != "." && $e["entry"] != "..") {
687 $files[] = $e["entry"];
688 }
689 }
690 }
691
692 return $files;
693 }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
$files
Definition: metarefresh.php:49

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

+ Here is the call graph for this function:

◆ getForbiddenFileTypes()

static ilObjMediaObject::getForbiddenFileTypes ( )
static

Get forbidden file types.

Returns
array

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

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

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

+ Here is the caller graph for this function:

◆ getId()

◆ getImportId()

ilObjMediaObject::getImportId ( )

get import id

Reimplemented from ilObject.

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

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

References ilObject\$import_id.

◆ getLinkedMediaObjects()

ilObjMediaObject::getLinkedMediaObjects (   $a_ignore = "")

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

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

1800 {
1801 $linked = array();
1802
1803 if (!is_array($a_ignore)) {
1804 $a_ignore = array();
1805 }
1806
1807 // get linked media objects (map areas)
1808 $med_items = $this->getMediaItems();
1809
1810 foreach ($med_items as $med_item) {
1811 $int_links = ilMapArea::_getIntLinks($med_item->getId());
1812 foreach ($int_links as $k => $int_link) {
1813 if ($int_link["Type"] == "MediaObject") {
1814 include_once("./Services/Link/classes/class.ilInternalLink.php");
1815 $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
1816 if (ilObject::_exists($l_id)) {
1817 if (!in_array($l_id, $linked) &&
1818 !in_array($l_id, $a_ignore)) {
1819 $linked[] = $l_id;
1820 }
1821 }
1822 }
1823 }
1824 }
1825 //var_dump($linked);
1826 return $linked;
1827 }
static _getIntLinks($a_item_id)
get all internal links of a media items map areas
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public

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

+ 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 306 of file class.ilObjMediaObject.php.

307 {
308 foreach ($this->media_items as $media_item) {
309 if ($media_item->getPurpose() == $a_purpose) {
310 return $media_item;
311 }
312 }
313 return false;
314 }

Referenced by generatePreviewPic(), and hasPurposeItem().

+ Here is the caller graph for this function:

◆ getMediaItemNr()

ilObjMediaObject::getMediaItemNr (   $a_purpose)

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

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

References $i.

◆ getMediaItems()

& ilObjMediaObject::getMediaItems ( )

get all media items

Returns
array array of media item objects

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

296 {
297 return $this->media_items;
298 }

References $media_items.

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

+ Here is the caller graph for this function:

◆ getMimeType()

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

get mime type for file

Parameters
string$a_filefile name
Returns
string mime type static

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

1511 {
1512 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1514 return $mime;
1515 }
static lookupMimeType($path_to_file, $fallback=self::APPLICATION__OCTET_STREAM, $a_external=null)

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

Referenced by _saveTempFileAsMediaObject(), ilExAssignmentGUI\addFiles(), ilObjMediaObjectGUI\assignFullscreenObject(), ilObjMediaObjectGUI\assignStandardObject(), ilKprimChoiceWizardInputGUI\checkUploads(), ilPCInteractiveImageGUI\create(), ilFileUtils\createFile(), ilObjMediaPoolGUI\createMediaFromUploadDir(), ilSCORM13Package\dbImportSco(), ilPublicUserProfileGUI\deliverVCard(), ilSCORM13Player\getMimetype(), ilMediaPlayerGUI\getMp3PlayerHtml(), ilDclMobRecordFieldModel\parseValue(), ilObjMediaPoolGUI\performBulkUpload(), ilNewsTimelineItemGUI\renderMedia(), ilNewsTimelineItemGUI\renderMediaModal(), ilObjMediaObjectGUI\savePropertiesObject(), assMultipleChoice\setImageFile(), assSingleChoice\setImageFile(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilNewsForContextBlockGUI\showNews(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), ilFSStorageExercise\uploadFile(), and ilFSStorageExercise5069\uploadFile().

+ 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 2063 of file class.ilObjMediaObject.php.

2064 {
2065 $items = array();
2066
2067 include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
2069
2070 $dir = $this->getMultiSrtUploadDir();
2071 $files = ilUtil::getDir($dir);
2072 foreach ($files as $k => $i) {
2073 // check directory
2074 if ($i["type"] == "file" && !in_array($k, array(".", ".."))) {
2075 if (pathinfo($k, PATHINFO_EXTENSION) == "srt") {
2076 $lang = "";
2077 if (substr($k, strlen($k) - 7, 1) == "_") {
2078 $lang = substr($k, strlen($k) - 6, 2);
2079 if (!in_array($lang, $lang_codes)) {
2080 $lang = "";
2081 }
2082 }
2083 $items[] = array("filename" => $k, "lang" => $lang);
2084 }
2085 }
2086 }
2087 return $items;
2088 }
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349

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

+ Here is the call graph for this function:

◆ getMultiSrtUploadDir()

ilObjMediaObject::getMultiSrtUploadDir ( )

Get directory for multi srt upload.

Parameters

return

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

2024 {
2025 return ilObjMediaObject::_getDirectory($this->getId() . "/srt/tmp");
2026 }

References _getDirectory(), and getId().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOriginID()

ilObjMediaObject::getOriginID ( )

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

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

References $origin_id.

◆ getParentObjectIdForUsage()

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

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

see ilWebAccessChecker

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

1255 {
1256 if (is_int(strpos($a_usage["type"], ":"))) {
1257 $us_arr = explode(":", $a_usage["type"]);
1258 $type = $us_arr[1];
1259 $cont_type = $us_arr[0];
1260 } else {
1261 $type = $a_usage["type"];
1262 }
1263
1264 $id = $a_usage["id"];
1265 $obj_id = false;
1266
1267 switch ($type) {
1268 // RTE / tiny mce
1269 case "html":
1270
1271 switch ($cont_type) {
1272 case "qpl":
1273 // Question Pool *Question* Text (Test)
1274 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1276 if ($qinfo["original_id"] > 0) {
1277 include_once("./Modules/Test/classes/class.ilObjTest.php");
1278 $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1279 } else {
1280 $obj_id = $qinfo["obj_fi"]; // usage in pool
1281 }
1282 break;
1283
1284 case "spl":
1285 // Question Pool *Question* Text (Survey)
1286 include_once("./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
1288 if ($quest) {
1289 $parent_id = $quest->getObjId();
1290
1291 // pool question copy - find survey, do not use pool itself
1292 if ($quest->getOriginalId() &&
1293 ilObject::_lookupType($parent_id) == "spl") {
1295 }
1296 // original question (in pool or survey)
1297 else {
1298 $obj_id = $parent_id;
1299 }
1300
1301 unset($quest);
1302 }
1303 break;
1304
1305 case "exca":
1306 // Exercise assignment
1307 $returned_pk = $a_usage['id'];
1308 // #15995 - we are just checking against exercise object
1309 include_once 'Modules/Exercise/classes/class.ilExSubmission.php';
1310 $obj_id = ilExSubmission::lookupExerciseIdForReturnedId($returned_pk);
1311 break;
1312
1313 case "frm":
1314 // Forum
1315 $post_pk = $a_usage['id'];
1316 include_once 'Modules/Forum/classes/class.ilForumPost.php';
1317 include_once 'Modules/Forum/classes/class.ilForum.php';
1318 $oPost = new ilForumPost($post_pk);
1319 $frm_pk = $oPost->getForumId();
1320 $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1321 break;
1322
1323
1324 case "frm~d":
1325 $draft_id = $a_usage['id'];
1326 include_once 'Modules/Forum/classes/class.ilForumPostDraft.php';
1327 include_once 'Modules/Forum/classes/class.ilForum.php';
1328 $oDraft = ilForumPostDraft::newInstanceByDraftId($draft_id);
1329
1330 $frm_pk = $oDraft->getForumId();
1331 $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1332 break;
1333 case "frm~h":
1334 $history_id = $a_usage['id'];
1335 include_once 'Modules/Forum/classes/class.ilForumDraftsHistory.php';
1336 include_once 'Modules/Forum/classes/class.ilForumPostDraft.php';
1337 include_once 'Modules/Forum/classes/class.ilForum.php';
1338 $oHistoryDraft = new ilForumDraftsHistory($history_id);
1339 $oDraft = ilForumPostDraft::newInstanceByDraftId($oHistoryDraft->getDraftId());
1340
1341 $frm_pk = $oDraft->getForumId();
1342 $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1343 break;
1344 // temporary items (per user)
1345 case "frm~":
1346 case "exca~":
1347 $obj_id = $a_usage['id'];
1348 break;
1349
1350 // "old" category pages
1351 case "cat":
1352 // InfoScreen Text
1353 case "tst":
1354 case "svy":
1355 // data collection
1356 case "dcl":
1357 $obj_id = $id;
1358 break;
1359 }
1360 break;
1361
1362 // page editor
1363 case "pg":
1364
1365 switch ($cont_type) {
1366 // question feedback // parent obj id is q id
1367 case "qfbg":
1368 include_once('./Services/COPage/classes/class.ilPageObject.php');
1370 // note: no break here, we only altered the $id to the question id
1371
1372 // no break
1373 case "qpl":
1374 // Question Pool Question Pages
1375 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1377 if ($qinfo["original_id"] > 0) {
1378 include_once("./Modules/Test/classes/class.ilObjTest.php");
1379 $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1380 } else {
1381 $obj_id = $qinfo["obj_fi"]; // usage in pool
1382 }
1383 if ($obj_id == 0) { // this is the case, if question is in learning module -> get lm id
1384 include_once("./Services/COPage/classes/class.ilPCQuestion.php");
1386 if ($pinfo && $pinfo["parent_type"] == "lm") {
1387 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1388 $obj_id = ilLMObject::_lookupContObjID($pinfo["page_id"]);
1389 }
1390 $pinfo = ilPCQuestion::_getPageForQuestionId($id, "sahs");
1391 if ($pinfo && $pinfo["parent_type"] == "sahs") {
1392 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1393 $obj_id = ilSCORM2004Node::_lookupSLMID($pinfo["page_id"]);
1394 }
1395 }
1396 break;
1397
1398 case "lm":
1399 // learning modules
1400 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1402 break;
1403
1404 case "gdf":
1405 // glossary definition
1406 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
1407 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1409 $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
1410 break;
1411
1412 case "wpg":
1413 // wiki page
1414 include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
1416 break;
1417
1418 case "sahs":
1419 // sahs page
1420 // can this implementation be used for other content types, too?
1421 include_once('./Services/COPage/classes/class.ilPageObject.php');
1422 $obj_id = ilPageObject::lookupParentId($id, 'sahs');
1423 break;
1424
1425 case "prtf":
1426 // portfolio
1427 include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
1429 break;
1430
1431 case "prtt":
1432 // portfolio template
1433 include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
1435 break;
1436
1437 case "blp":
1438 // blog
1439 include_once('./Services/COPage/classes/class.ilPageObject.php');
1440 $obj_id = ilPageObject::lookupParentId($id, 'blp');
1441 break;
1442
1443 case "impr":
1444 // imprint page - always id 1
1445 // fallthrough
1446
1447 case "crs":
1448 case "grp":
1449 case "cat":
1450 case "fold":
1451 case "root":
1452 case "cont":
1453 case "copa":
1454 case "cstr":
1455 // repository pages
1456 $obj_id = $id;
1457 break;
1458 }
1459 break;
1460
1461 // Media Pool
1462 case "mep":
1463 $obj_id = $id;
1464 break;
1465
1466 // News Context Object (e.g. MediaCast)
1467 case "news":
1468 include_once("./Services/News/classes/class.ilNewsItem.php");
1470 break;
1471 }
1472
1473 return $obj_id;
1474 }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _lookupSurveyObjId($a_question_id)
static _getQuestionInfo($question_id)
Returns question information from the database.
static lookupExerciseIdForReturnedId($a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
static _lookupObjIdForForumId($a_for_id)
static _lookupTermId($a_def_id)
Looks up term id for a definition id.
static _lookGlossaryID($term_id)
get glossary id form term id
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _lookupContextObjId($a_news_id)
Context Object ID.
static _lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
static _getPageForQuestionId($a_q_id, $a_parent_type="")
Get page for question id.
static lookupParentId($a_id, $a_type)
Lookup parent id.
static findPortfolioForPage($a_page_id)
Get portfolio id of page id.
static _lookupSLMID($a_id)
Lookup Scorm Learning Module ID for node id.
static lookupObjIdByPage($a_page_id)
returns the wiki/object id to a given page id

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(), ilPageObject\lookupParentId(), and ilForumPostDraft\newInstanceByDraftId().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilObjMediaObject::getRefId ( )

get reference id @access public

Returns
integer reference id

Reimplemented from ilObject.

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

68 {
69 return false;
70 }

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

1833 {
1834 return array_filter(self::getAllowedFileTypes(), function ($v) {
1835 return !in_array($v, self::getForbiddenFileTypes());
1836 });
1837 }

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

+ Here is the caller graph for this function:

◆ getSrtFiles()

ilObjMediaObject::getSrtFiles ( )

Get srt files.

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

1727 {
1728 $srt_dir = ilObjMediaObject::_getDirectory($this->getId()) . "/srt";
1729
1730 if (!is_dir($srt_dir)) {
1731 return array();
1732 }
1733
1734 $items = ilUtil::getDir($srt_dir);
1735
1736 $srt_files = array();
1737 foreach ($items as $i) {
1738 if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file") {
1739 $name = explode(".", $i["entry"]);
1740 if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_") {
1741 $srt_files[] = array("file" => $i["entry"],
1742 "full_path" => "srt/" . $i["entry"], "language" => substr($name[0], 9, 2));
1743 }
1744 }
1745 }
1746
1747 return $srt_files;
1748 }

References $i, $name, _getDirectory(), ilUtil\getDir(), and getId().

Referenced by getXML().

+ 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 1776 of file class.ilObjMediaObject.php.

1777 {
1778 $t_dir = ilObjMediaObject::_getThumbnailDirectory($a_mob_id);
1779 return $t_dir . "/" . $a_thumbname;
1780 }

References _getThumbnailDirectory().

Referenced by ilPCIIMOverlaysTableGUI\fillRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilObjMediaObject::getTitle ( )

get object title @access public

Returns
string object title

Reimplemented from ilObject.

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

88 {
89 return parent::getTitle();
90 }

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

+ 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 1155 of file class.ilObjMediaObject.php.

1156 {
1157 return self::lookupUsages($this->getId(), $a_include_history);
1158 }
static lookupUsages($a_id, $a_include_history=true)
Lookup usages of media object.

References getId(), and lookupUsages().

Referenced by delete(), and handleQuotaUpdate().

+ 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

return

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

1983 {
1984 $dir = ilObjMediaObject::_getDirectory($this->getId());
1985 $ppics = array("mob_vpreview.jpg",
1986 "mob_vpreview.jpeg",
1987 "mob_vpreview.png");
1988 foreach ($ppics as $p) {
1989 if (is_file($dir . "/" . $p)) {
1990 if ($a_filename_only) {
1991 return $p;
1992 } else {
1993 return $dir . "/" . $p;
1994 }
1995 }
1996 }
1997 return "";
1998 }

References _getDirectory(), and getId().

Referenced by uploadVideoPreviewPic().

+ 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,
  $a_sign_locals = false 
)

get MediaObject XLM Tag

Parameters
int$a_modeIL_MODE_ALIAS | IL_MODE_OUTPUT | IL_MODE_FULL

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

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

References $def, $i, $ilUser, $location, $media_items, $name, $user, $xml, escapeProperty(), getDataDirectory(), getId(), getMediaItems(), getSrtFiles(), getTitle(), ilObject\getType(), handleAmps(), IL_MODE_ALIAS, IL_MODE_FULL, IL_MODE_OUTPUT, ilUtil\secureUrl(), and ilWACSignedPath\signFile().

Referenced by exportMediaFullscreen(), and exportXML().

+ 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 914 of file class.ilObjMediaObject.php.

915 {
916 $a_str = str_replace("&amp;", "&", $a_str);
917 $a_str = str_replace("&", "&amp;", $a_str);
918 return $a_str;
919 }

Referenced by getXML().

+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected

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

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

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

Referenced by _deleteAllUsages(), _removeUsage(), _saveUsage(), create(), delete(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasFullscreenItem()

ilObjMediaObject::hasFullscreenItem ( )

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

360 {
361 return $this->hasPurposeItem("Fullscreen");
362 }
hasPurposeItem($purpose)
returns wether object has media item with specific purpose

References hasPurposeItem().

+ 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 370 of file class.ilObjMediaObject.php.

371 {
372 if (is_object($this->getMediaItem($purpose))) {
373 return true;
374 } else {
375 return false;
376 }
377 }

References getMediaItem().

Referenced by hasFullscreenItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAlias()

ilObjMediaObject::isAlias ( )

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

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

References $is_alias.

◆ isTypeAllowed()

static ilObjMediaObject::isTypeAllowed (   $a_type)
static

Is type allowed.

Parameters
string$a_type
Returns
bool

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

1884 {
1885 if (in_array($a_type, self::getForbiddenFileTypes())) {
1886 return false;
1887 }
1888 if (count(self::getAllowedFileTypes()) == 0 || in_array($a_type, self::getAllowedFileTypes())) {
1889 return true;
1890 }
1891 return false;
1892 }

References $a_type.

Referenced by ilPageObjectGUI\showPage().

+ Here is the caller graph for this function:

◆ lookupUsages()

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

Lookup usages of media object.

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

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

1166 {
1167 global $DIC;
1168
1169 $ilDB = $DIC->database();
1170
1171 $hist_str = "";
1172 if ($a_include_history) {
1173 $hist_str = ", usage_hist_nr";
1174 }
1175
1176 // get usages in pages
1177 $q = "SELECT DISTINCT usage_type, usage_id, usage_lang" . $hist_str . " FROM mob_usage WHERE id = " .
1178 $ilDB->quote($a_id, "integer");
1179
1180 if (!$a_include_history) {
1181 $q .= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
1182 }
1183
1184 $us_set = $ilDB->query($q);
1185 $ret = array();
1186 while ($us_rec = $ilDB->fetchAssoc($us_set)) {
1187 $ut = "";
1188 if (is_int(strpos($us_rec["usage_type"], ":"))) {
1189 $us_arr = explode(":", $us_rec["usage_type"]);
1190 $ut = $us_arr[1];
1191 $ct = $us_arr[0];
1192 }
1193
1194 // check whether page exists
1195 $skip = false;
1196 if ($ut == "pg") {
1197 include_once("./Services/COPage/classes/class.ilPageObject.php");
1198 if (!ilPageObject::_exists($ct, $us_rec["usage_id"])) {
1199 $skip = true;
1200 }
1201 }
1202
1203 if (!$skip) {
1204 $ret[] = array("type" => $us_rec["usage_type"],
1205 "id" => $us_rec["usage_id"],
1206 "lang" => $us_rec["usage_lang"],
1207 "hist_nr" => $us_rec["usage_hist_nr"]);
1208 }
1209 }
1210
1211 // get usages in media pools
1212 $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = " .
1213 $ilDB->quote($a_id, "integer") . " AND mep_item.type = " . $ilDB->quote("mob", "text");
1214 $us_set = $ilDB->query($q);
1215 while ($us_rec = $ilDB->fetchAssoc($us_set)) {
1216 $ret[] = array("type" => "mep",
1217 "id" => $us_rec["mep_id"]);
1218 }
1219
1220 // get usages in news items (media casts)
1221 include_once("./Services/News/classes/class.ilNewsItem.php");
1222 $news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
1223 foreach ($news_usages as $nu) {
1224 $ret[] = $nu;
1225 }
1226
1227
1228 // get usages in map areas
1229 $q = "SELECT DISTINCT mob_id FROM media_item it, map_area area " .
1230 " WHERE area.item_id = it.id " .
1231 " AND area.link_type = " . $ilDB->quote("int", "text") . " " .
1232 " AND area.target = " . $ilDB->quote("il__mob_" . $a_id, "text");
1233 $us_set = $ilDB->query($q);
1234 while ($us_rec = $ilDB->fetchAssoc($us_set)) {
1235 $ret[] = array("type" => "map",
1236 "id" => $us_rec["mob_id"]);
1237 }
1238
1239 // get usages in personal clipboards
1241 foreach ($users as $user) {
1242 $ret[] = array("type" => "clip",
1243 "id" => $user);
1244 }
1245
1246 return $ret;
1247 }
$users
Definition: authpage.php:44
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static _getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
$ret
Definition: parser.php:6

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

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

+ 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 1753 of file class.ilObjMediaObject.php.

1758 {
1759 $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1763 $m_dir . "/" . $a_file,
1764 $t_dir . "/" . $a_thumbname,
1765 $a_format,
1766 $a_size
1767 );
1768 }

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

+ 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

Reimplemented from ilObject.

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

194 {
195 include_once 'Services/MetaData/classes/class.ilMD.php';
196
197 switch ($a_element) {
198 case 'General':
199
200 // Update Title and description
201 $md = new ilMD(0, $this->getId(), $this->getType());
202 $md_gen = $md->getGeneral();
203
204 if (is_object($md_gen)) {
205 ilObject::_writeTitle($this->getId(), $md_gen->getTitle());
206 $this->setTitle($md_gen->getTitle());
207
208 foreach ($md_gen->getDescriptionIds() as $id) {
209 $md_des = $md_gen->getDescription($id);
210 ilObject::_writeDescription($this->getId(), $md_des->getDescription());
211 $this->setDescription($md_des->getDescription());
212 break;
213 }
214 }
215
216 break;
217
218 default:
219 }
220 return true;
221 }
setTitle($a_title)
set object title
setDescription($a_description)
set description of media object
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)

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

+ Here is the call graph for this function:

◆ modifyExportIdentifier()

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

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

1006 {
1007 if ($a_tag == "Identifier" && $a_param == "Entry") {
1008 $a_value = ilUtil::insertInstIntoID($a_value);
1009 }
1010
1011 return $a_value;
1012 }
static insertInstIntoID($a_value)
inserts installation id into ILIAS id

References ilUtil\insertInstIntoID().

+ Here is the call graph for this function:

◆ putInTree()

ilObjMediaObject::putInTree (   $a_parent_ref)

maybe this method should be in tree object!?

Todo:
role/rbac stuff
Parameters
int$a_parent_refRef-ID of the parent object

Reimplemented from ilObject.

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

73 {
74 $this->ilias->raiseError("Operation ilObjMedia::putInTree() not allowed.", $this->ilias->error_obj->FATAL);
75 }

◆ read()

ilObjMediaObject::read ( )

read media object data from db

Reimplemented from ilObject.

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

385 {
386 //echo "<br>ilObjMediaObject:read";
387 parent::read();
388
389 // get media items
391 }
static _getMediaItemsOfMOb(&$a_mob)
read media items into media objects (static)

References ilMediaItem\_getMediaItemsOfMOb().

+ Here is the call graph for this function:

◆ removeAdditionalFile()

ilObjMediaObject::removeAdditionalFile (   $a_file)

Remove additional file.

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

1787 {
1788 $file = str_replace("..", "", $a_file);
1789 $file = ilObjMediaObject::_getDirectory($this->getId()) . "/" . $file;
1790 if (is_file($file)) {
1791 unlink($file);
1792 }
1793 }

References _getDirectory(), and getId().

Referenced by uploadVideoPreviewPic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllMediaItems()

ilObjMediaObject::removeAllMediaItems ( )

remove all media items

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

343 {
344 $this->media_items = array();
345 }

◆ removeMediaItem()

ilObjMediaObject::removeMediaItem (   $a_purpose)

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

321 {
322 foreach ($this->media_items as $key => $media_item) {
323 if ($media_item->getPurpose() == $a_purpose) {
324 unset($this->media_items[$key]);
325 }
326 }
327 // update numbers and keys
328 $i = 1;
329 $media_items = array();
330 foreach ($this->media_items as $media_item) {
331 $media_items [$i] = $media_item;
332 $media_item->setMobId($this->getId());
333 $media_item->setNr($i);
334 $i++;
335 }
336 $this->media_items = $media_items;
337 }

References $i, $key, $media_items, and getId().

+ Here is the call graph for this function:

◆ renameExecutables()

static ilObjMediaObject::renameExecutables (   $a_dir)
static

Rename executables.

Parameters
string

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

2096 {
2098 if (!self::isTypeAllowed("html")) {
2099 ilUtil::rRenameSuffix($a_dir, "html", "sec"); // see #20187
2100 }
2101 }
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.

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

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

+ 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 409 of file class.ilObjMediaObject.php.

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

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

1026 {
1027 $this->contains_int_link = $a_contains_link;
1028 }

◆ setDescription()

ilObjMediaObject::setDescription (   $a_description)

set description of media object

Reimplemented from ilObject.

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

178 {
179 parent::setDescription($a_description);
180 }

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ setId()

ilObjMediaObject::setId (   $a_id)

set id

Reimplemented from ilObject.

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

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

◆ setImportId()

ilObjMediaObject::setImportId (   $a_import_id)

set import id

@access public

Parameters
string$a_import_idimport id

Reimplemented from ilObject.

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

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

◆ setOriginID()

ilObjMediaObject::setOriginID (   $a_id)

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

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

◆ setRefId()

ilObjMediaObject::setRefId (   $a_id)

set reference id @access public

Parameters
integer$a_idreference id

Reimplemented from ilObject.

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

63 {
64 $this->ilias->raiseError("Operation ilObjMedia::setRefId() not allowed.", $this->ilias->error_obj->FATAL);
65 }

◆ setTitle()

ilObjMediaObject::setTitle (   $a_title)

set object title

@access public

Parameters
string$a_titleobject title

Reimplemented from ilObject.

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

83 {
84 parent::setTitle($a_title);
85 }

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ update()

ilObjMediaObject::update (   $a_upload = false)

update media object in db

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

487 {
489
490 if (!$a_upload) {
491 $this->updateMetaData();
492 }
493
495
496 // iterate all items
497 $media_items = $this->getMediaItems();
498 $j = 1;
499 foreach ($media_items as $key => $val) {
500 $item = $media_items[$key];
501 if (is_object($item)) {
502 $item->setMobId($this->getId());
503 $item->setNr($j);
504 if ($item->getLocationType() == "Reference") {
505 $item->extractUrlParameters();
506 }
507 $item->create();
508 $j++;
509 }
510 }
511
513 $ilAppEventHandler = $this->app_event_handler;
514 $ilAppEventHandler->raise(
515 'Services/MediaObjects',
516 'update',
517 array('object' => $this,
518 'obj_type' => 'mob',
519 'obj_id' => $this->getId())
520 );
521 }
updateMetaData()
update meta data entry
update($pash, $contents, Config $config)

References $app_event_handler, $key, $media_items, ilMediaItem\deleteAllItemsOfMob(), getId(), getMediaItems(), handleQuotaUpdate(), League\Flysystem\Adapter\Polyfill\update(), and updateMetaData().

+ Here is the call graph for this function:

◆ updateMetaData()

ilObjMediaObject::updateMetaData ( )

update meta data entry

Reimplemented from ilObject.

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

248 {
249 include_once("Services/MetaData/classes/class.ilMD.php");
250 include_once("Services/MetaData/classes/class.ilMDGeneral.php");
251 include_once("Services/MetaData/classes/class.ilMDDescription.php");
252
253 $md = new ilMD(0, $this->getId(), $this->getType());
254 $md_gen = $md->getGeneral();
255 $md_gen->setTitle($this->getTitle());
256
257 // sets first description (maybe not appropriate)
258 $md_des_ids = $md_gen->getDescriptionIds();
259 if (count($md_des_ids) > 0) {
260 $md_des = $md_gen->getDescription($md_des_ids[0]);
261 $md_des->setDescription($this->getDescription());
262 $md_des->update();
263 }
264 $md_gen->update();
265 }

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

Referenced by update().

+ 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 1690 of file class.ilObjMediaObject.php.

1691 {
1692 $a_subdir = str_replace("..", "", $a_subdir);
1693 $dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
1694 if ($a_subdir != "") {
1695 $dir .= "/" . $a_subdir;
1696 }
1698 if ($a_mode == "rename") {
1699 rename($tmp_name, $dir . "/" . $a_name);
1700 } else {
1701 ilUtil::moveUploadedFile($tmp_name, $a_name, $dir . "/" . $a_name, true, $a_mode);
1702 }
1703 self::renameExecutables($mob_dir);
1704 include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1705 ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1706 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.

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

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

+ 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 2035 of file class.ilObjMediaObject.php.

2036 {
2037 $lng = $this->lng;
2039
2040 include_once("./Services/MediaObjects/exceptions/class.ilMediaObjectsException.php");
2041 if (!is_file($a_file["tmp_name"])) {
2042 throw new ilMediaObjectsException($lng->txt("mob_file_could_not_be_uploaded"));
2043 }
2044
2045 $dir = $this->getMultiSrtUploadDir();
2046 ilUtil::delDir($dir, true);
2048 ilUtil::moveUploadedFile($a_file["tmp_name"], "multi_srt.zip", $dir . "/" . "multi_srt.zip");
2049 ilUtil::unzip($dir . "/multi_srt.zip", true);
2050 }
General exception class for media objects.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file

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

+ Here is the call graph for this function:

◆ uploadSrtFile()

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

Upload srt file.

Parameters

return

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

1715 {
1716 if (is_file($a_tmp_name) && $a_language != "") {
1717 $this->uploadAdditionalFile("subtitle_" . $a_language . ".srt", $a_tmp_name, "srt", $a_mode);
1718 return true;
1719 }
1720 return false;
1721 }
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.

References uploadAdditionalFile().

+ Here is the call graph for this function:

◆ uploadVideoPreviewPic()

ilObjMediaObject::uploadVideoPreviewPic (   $a_prevpic)

Upload video preview picture.

Parameters

return

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

1938 {
1939 // remove old one
1940 if ($this->getVideoPreviewPic(true) != "") {
1941 $this->removeAdditionalFile($this->getVideoPreviewPic(true));
1942 }
1943
1944 $pi = pathinfo($a_prevpic["name"]);
1945 $ext = $pi["extension"];
1946 if (in_array($ext, array("jpg", "jpeg", "png"))) {
1947 $this->uploadAdditionalFile("mob_vpreview." . $ext, $a_prevpic["tmp_name"]);
1948 }
1949 }
getVideoPreviewPic($a_filename_only=false)
Get video preview pic.
removeAdditionalFile($a_file)
Remove additional file.

References getVideoPreviewPic(), removeAdditionalFile(), and uploadAdditionalFile().

+ Here is the call graph for this function:

Field Documentation

◆ $app_event_handler

ilObjMediaObject::$app_event_handler
protected

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

Referenced by create(), and update().

◆ $contains_int_link

ilObjMediaObject::$contains_int_link

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

Referenced by containsIntLink().

◆ $id

ilObjMediaObject::$id

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

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

◆ $is_alias

ilObjMediaObject::$is_alias

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

Referenced by isAlias().

◆ $media_items

ilObjMediaObject::$media_items

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

Referenced by create(), getMediaItems(), getXML(), removeMediaItem(), and update().

◆ $origin_id

ilObjMediaObject::$origin_id

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

Referenced by getOriginID().

◆ $user

ilObjMediaObject::$user
protected

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