ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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...
 
 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, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 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
 
 $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 47 of file class.ilObjMediaObject.php.

48 {
49 global $DIC;
50
51 $this->user = $DIC->user();
52 $this->app_event_handler = $DIC["ilAppEventHandler"];
53 $this->lng = $DIC->language();
54 $this->is_alias = false;
55 $this->media_items = array();
56 $this->contains_int_link = false;
57 $this->type = "mob";
58 parent::__construct($a_id, false);
59 }
user()
Definition: user.php:4
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), 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 648 of file class.ilObjMediaObject.php.

649 {
651 ilUtil::createDirectory(ilUtil::getWebspaceDir() . "/thumbs/mm_" . $a_obj_id);
652 }
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 1028 of file class.ilObjMediaObject.php.

1029 {
1030 global $DIC;
1031
1032 $ilDB = $DIC->database();
1033
1034 $and_hist = "";
1035 if ($a_usage_hist_nr !== false) {
1036 $and_hist = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
1037 }
1038
1039 $mob_ids = array();
1040 $set = $ilDB->query("SELECT id FROM mob_usage" .
1041 " WHERE usage_type = " . $ilDB->quote($a_type, "text") .
1042 " AND usage_id = " . $ilDB->quote($a_id, "integer") .
1043 " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
1044 $and_hist);
1045 while ($row = $ilDB->fetchAssoc($set)) {
1046 $mob_ids[] = $row["id"];
1047 }
1048
1049 $q = "DELETE FROM mob_usage WHERE usage_type = " .
1050 $ilDB->quote($a_type, "text") .
1051 " AND usage_id= " . $ilDB->quote($a_id, "integer") .
1052 " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
1053 $and_hist;
1054 $ilDB->manipulate($q);
1055
1056 foreach ($mob_ids as $mob_id) {
1057 self::handleQuotaUpdate(new self($mob_id));
1058 }
1059 }
static handleQuotaUpdate(ilObjMediaObject $a_mob)
global $ilDB
$a_type
Definition: workflow.php:92

References $a_type, $DIC, $ilDB, 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 1503 of file class.ilObjMediaObject.php.

1512 {
1513 global $DIC;
1514
1515 $lng = $DIC->language();
1516
1517 // determine width and height of known image types
1518 //$width = 640;
1519 //$height = 360;
1520 $info = "";
1521
1522 if ($a_format == "audio/mpeg") {
1523 $width = 300;
1524 $height = 20;
1525 }
1526
1527 if (ilUtil::deducibleSize($a_format)) {
1528 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1529 if ($a_type == "File") {
1531 } else {
1532 $size = ilMediaImageUtil::getImageSize($a_reference);
1533 }
1534 }
1535
1536 if ($a_use_original) {
1537 if ($size[0] > 0 && $size[1] > 0) {
1538 //$width = $size[0];
1539 //$height = $size[1];
1540 $width = "";
1541 $height = "";
1542 } else {
1543 $info = $lng->txt("cont_could_not_determine_resource_size");
1544 }
1545 } else {
1546 $w = (int) $a_user_width;
1547 $h = (int) $a_user_height;
1548 $width = $w;
1549 $height = $h;
1550 //echo "<br>C-$width-$height-";
1551 if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions) {
1552 if ($size[0] > 0 && $size[1] > 0) {
1553 if ($w > 0) {
1554 $wr = $size[0] / $w;
1555 }
1556 if ($h > 0) {
1557 $hr = $size[1] / $h;
1558 }
1559 //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1560 //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1561 $r = max($wr, $hr);
1562 if ($r > 0) {
1563 $width = (int) round($size[0] / $r);
1564 $height = (int) round($size[1] / $r);
1565 }
1566 }
1567 }
1568 //echo "<br>D-$width-$height-";
1569 }
1570 //echo "<br>E-$width-$height-";
1571
1572 if ($width == 0 && $a_user_width === "") {
1573 $width = "";
1574 }
1575 if ($height == 0 && $a_user_height === "") {
1576 $height = "";
1577 }
1578
1579 return array("width" => $width, "height" => $height, "info" => $info);
1580 }
$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()

References $a_type, $DIC, ilObject\$lng, $size, 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 98 of file class.ilObjMediaObject.php.

99 {
100 global $DIC;
101
102 $ilDB = $DIC->database();
103
104 include_once("./Services/Link/classes/class.ilInternalLink.php");
105 if (is_int(strpos($a_id, "_"))) {
107 }
108
109 if (parent::_exists($a_id, false) && ilObject::_lookupType($a_id) == "mob") {
110 return true;
111 }
112 return false;
113 }
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 553 of file class.ilObjMediaObject.php.

554 {
555 return ilUtil::getWebspaceDir() . "/" . self::_getRelativeDirectory($a_mob_id);
556 }
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 1064 of file class.ilObjMediaObject.php.

1065 {
1066 global $DIC;
1067
1068 $ilDB = $DIC->database();
1069
1070 $lstr = "";
1071 if ($a_lang != "") {
1072 $lstr = " AND usage_lang = " . $ilDB->quote($a_lang, "text");
1073 }
1074 $hist_str = "";
1075 if ($a_usage_hist_nr !== false) {
1076 $hist_str = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
1077 }
1078
1079 $q = "SELECT * FROM mob_usage WHERE " .
1080 "usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
1081 "usage_id = " . $ilDB->quote($a_id, "integer") .
1082 $lstr . $hist_str;
1083 $mobs = array();
1084 $mob_set = $ilDB->query($q);
1085 while ($mob_rec = $ilDB->fetchAssoc($mob_set)) {
1086 if (ilObject::_lookupType($mob_rec["id"]) == "mob") {
1087 $mobs[$mob_rec["id"]] = $mob_rec["id"];
1088 }
1089 }
1090
1091 return $mobs;
1092 }
$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(), 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 564 of file class.ilObjMediaObject.php.

565 {
566 return "mobs/mm_" . $a_mob_id;
567 }

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

1587 {
1588 return array("image/x-ms-bmp", "image/gif", "image/jpeg", "image/x-portable-bitmap",
1589 "image/png", "image/psd", "image/tiff", "application/pdf");
1590 }

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

586 {
587 return ilUtil::getWebspaceDir($a_mode) . "/thumbs/mm_" . $a_mob_id;
588 }

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

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

613 {
614 if ($a_purpose == "") {
615 $a_purpose = "Standard";
616 }
617 $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
618 if (preg_match("/https?\:/i", $location)) {
619 return $location;
620 }
621
622 if ($a_url_encode) {
623 $location = rawurlencode($location);
624 }
625
626 $path = ($a_web)
628 : ".";
629
630 return $path . "/data/" . CLIENT_ID . "/mobs/mm_" . $a_mob_id . "/" . $location;
631 }
$location
Definition: buildRTE.php:44
static _lookupLocationForMobId($a_mob_id, $a_purpose)
Lookup location for mob id.

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

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

599 {
600 return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
601 }
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 1121 of file class.ilObjMediaObject.php.

1122 {
1123 global $DIC;
1124
1125 $ilDB = $DIC->database();
1126
1127 $q = "DELETE FROM mob_usage WHERE " .
1128 " id = " . $ilDB->quote((int) $a_mob_id, "integer") . " AND " .
1129 " usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
1130 " usage_id = " . $ilDB->quote((int) $a_id, "integer") . " AND " .
1131 " usage_lang = " . $ilDB->quote($a_lang, "text") . " AND " .
1132 " usage_hist_nr = " . $ilDB->quote((int) $a_usage_hist_nr, "integer");
1133 $ilDB->manipulate($q);
1134
1135 self::handleQuotaUpdate(new self($a_mob_id));
1136 }

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

1467 {
1468 $file_path = pathinfo($a_file);
1469 $location = substr($file_path["basename"], 0, strlen($file_path["basename"]) -
1470 strlen($file_path["extension"]) - 1) . "_" .
1471 $a_width . "_" .
1472 $a_height . "." . $file_path["extension"];
1473 $target_file = $file_path["dirname"] . "/" .
1474 $location;
1476 $a_file,
1477 $target_file,
1478 (int) $a_width,
1479 (int) $a_height,
1480 $a_constrain_prop
1481 );
1482
1483 return $location;
1484 }
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 1621 of file class.ilObjMediaObject.php.

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

References $format, $location, $name, $size, _getDirectory(), ilUtil\deducibleSize(), ilMediaImageUtil\getImageSize(), getMimeType(), ilUtil\moveUploadedFile(), 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 1097 of file class.ilObjMediaObject.php.

1098 {
1099 global $DIC;
1100
1101 $ilDB = $DIC->database();
1102
1103 $ilDB->replace(
1104 "mob_usage",
1105 array(
1106 "id" => array("integer", (int) $a_mob_id),
1107 "usage_type" => array("text", $a_type),
1108 "usage_id" => array("integer", $a_id),
1109 "usage_lang" => array("text", $a_lang),
1110 "usage_hist_nr" => array("integer", (int) $a_usage_hist_nr)
1111 ),
1112 array()
1113 );
1114
1115 self::handleQuotaUpdate(new self($a_mob_id));
1116 }

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

1604 {
1605 $lpath = pathinfo($a_loc);
1606 if ($lpath["extension"] == "mp3" && $a_format == "audio/mpeg") {
1607 return true;
1608 }
1609 if ($lpath["extension"] == "flv") {
1610 return true;
1611 }
1612 if (in_array($a_format, array("video/mp4", "video/webm"))) {
1613 return true;
1614 }
1615 return false;
1616 }

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

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

◆ clearMultiSrtDirectory()

ilObjMediaObject::clearMultiSrtDirectory ( )

Clear multi feedback directory.

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

2039 {
2041 }
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 1020 of file class.ilObjMediaObject.php.

1021 {
1023 }

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

439 {
440 parent::create();
441
442 if (!$a_create_meta_data) {
443 $this->createMetaData();
444 }
445
446 if ($a_save_media_items) {
447 $media_items = $this->getMediaItems();
448 for ($i = 0; $i < count($media_items); $i++) {
449 $item = $media_items[$i];
450 $item->setMobId($this->getId());
451 $item->setNr($i + 1);
452 $item->create();
453 }
454 }
455
457
458 $ilAppEventHandler = $this->app_event_handler;
459 $ilAppEventHandler->raise(
460 'Services/MediaObjects',
461 'create',
462 array('object' => $this,
463 'obj_type' => 'mob',
464 'obj_id' => $this->getId())
465 );
466 }
& getMediaItems()
get all media items
createMetaData()
create meta data entry
getId()
get object id @access public
$i
Definition: metadata.php:24

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

+ Here is the call graph for this function:

◆ createDirectory()

ilObjMediaObject::createDirectory ( )

Create file directory of media object.

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

637 {
638 $path = ilObjMediaObject::_getDirectory($this->getId());
640 if (!is_dir($path)) {
641 $this->ilias->raiseError("Failed to create directory $path.", $this->ilias->error_obj->FATAL);
642 }
643 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
redirection script todo: (a better solution should control the processing via a xml file)

References _getDirectory(), ilObject\getId(), and ilUtil\makeDirParents().

+ Here is the call graph for this function:

◆ createMetaData()

ilObjMediaObject::createMetaData ( )

create meta data entry

Reimplemented from ilObject.

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

226 {
227 include_once 'Services/MetaData/classes/class.ilMDCreator.php';
228
230
231 $md_creator = new ilMDCreator(0, $this->getId(), $this->getType());
232 $md_creator->setTitle($this->getTitle());
233 $md_creator->setTitleLanguage($ilUser->getPref('language'));
234 $md_creator->setDescription($this->getDescription());
235 $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
236 $md_creator->setKeywordLanguage($ilUser->getPref('language'));
237 $md_creator->setLanguage($ilUser->getPref('language'));
238 $md_creator->create();
239
240 return true;
241 }
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(), ilObject\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 76 of file class.ilObjMediaObject.php.

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

◆ delete()

ilObjMediaObject::delete ( )

delete media object

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

119 {
120 $mob_logger = ilLoggerFactory::getLogger('mob');
121 $mob_logger->debug("ilObjMediaObject: Delete called for media object ID '" . $this->getId() . "'.");
122
123 if (!($this->getId() > 0)) {
124 return;
125 }
126
127 $usages = $this->getUsages();
128
129 $mob_logger->debug("ilObjMediaObject: ... Found " . count($usages) . " usages.");
130
131 if (count($usages) == 0) {
132 // remove directory
134
135 // remove thumbnail directory
137
138 // delete meta data of mob
139 $this->deleteMetaData();
140
141 // delete media items
143
144 // this is just to make sure, there should be no entries left at
145 // this point as they depend on the usage
147
148 // delete object
149 parent::delete();
150
151 $mob_logger->debug("ilObjMediaObject: ... deleted.");
152 } else {
153 foreach ($usages as $u) {
154 $mob_logger->debug("ilObjMediaObject: ... usage type:" . $u["type"] .
155 ", id:" . $u["id"] .
156 ", lang:" . $u["lang"] .
157 ", hist_nr:" . $u["hist_nr"] . ".");
158 }
159 $mob_logger->debug("ilObjMediaObject: ... not deleted.");
160 }
161 }
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(), ilObject\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 269 of file class.ilObjMediaObject.php.

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

References ilObject\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 1881 of file class.ilObjMediaObject.php.

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

References _createThumbnailDirectory(), _getDirectory(), _getThumbnailDirectory(), getDescription(), ilObject\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 891 of file class.ilObjMediaObject.php.

892 {
893 return htmlspecialchars($a_value);
894 }

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

924 {
925 $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
926 ilUtil::makeDir($a_target_dir . "/objects/" . $subdir);
927
928 $mobdir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->getId();
929 ilUtil::rCopy($mobdir, $a_target_dir . "/objects/" . $subdir);
930 //echo "from:$mobdir:to:".$a_target_dir."/objects/".$subdir.":<br>";
931 }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References ilObject\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 933 of file class.ilObjMediaObject.php.

934 {
935 $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
936 $a_target_dir = $a_target_dir . "/objects/" . $subdir;
937 ilUtil::makeDir($a_target_dir);
938 $tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
939 $tpl->setCurrentBlock("ilMedia");
940
941 //$int_links = $page_object->getInternalLinks();
942 $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
943
944 // @todo
945 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
946
947 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
948 //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
949 require_once("./Services/COPage/classes/class.ilPageObject.php");
950
951 $xml = "<dummy>";
952 // todo: we get always the first alias now (problem if mob is used multiple
953 // times in page)
954 $xml .= $pg_obj->getMediaAliasElement($this->getId());
955 $xml .= $this->getXML(IL_MODE_OUTPUT);
956 //$xml.= $link_xml;
957 $xml .= "</dummy>";
958
959 //die(htmlspecialchars($xml));
960
961 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
962 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
963 $xh = xslt_create();
964
965 //echo "<b>XML:</b>".htmlentities($xml);
966 // determine target frames for internal links
967 $wb_path = "";
968 $enlarge_path = "";
969 $params = array('mode' => "fullscreen", 'enlarge_path' => $enlarge_path,
970 'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => "",
971 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
972 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
973 //echo xslt_error($xh);
974 xslt_free($xh);
975
976 // unmask user html
977 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
978 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
979 $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
980 $tpl->setVariable("MEDIA_CONTENT", $output);
981 $output = $tpl->get();
982 //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
983 $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i", "$2", $output);
984 $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i", "../../players", $output);
985 $output = preg_replace("/\.\/" . str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory()) . "/i", "../../players", $output);
986 $output = preg_replace("/file=..\/..\/..\//i", "file=../objects/" . $subdir . "/", $output);
987 //die(htmlspecialchars($output));
988 fwrite(fopen($a_target_dir . '/fullscreen.html', 'w'), $output);
989 }
$_GET["client_id"]
const IL_MODE_OUTPUT
special template class to simplify handling of ITX/PEAR
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.
xslt_free(&$proc)
xslt_create()
$xml
Definition: metadata.php:332
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $_GET, $tpl, $xml, ilMediaItem\_getMapAreasIntLinks(), ilPlayerUtil\getFlashVideoPlayerDirectory(), ilObject\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 910 of file class.ilObjMediaObject.php.

911 {
912 $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
913 }
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 1989 of file class.ilObjMediaObject.php.

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

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

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

◆ getDataDirectory()

ilObjMediaObject::getDataDirectory ( )

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

1593 {
1594 return ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->getId();
1595 }

References ilObject\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 168 of file class.ilObjMediaObject.php.

169 {
170 return parent::getDescription();
171 }

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

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

661 {
662 $a_subdir = str_replace("..", "", $a_subdir);
663 $dir = ilObjMediaObject::_getDirectory($this->getId());
664 if ($a_subdir != "") {
665 $dir .= "/" . $a_subdir;
666 }
667
668 $files = array();
669 if (is_dir($dir)) {
670 $entries = ilUtil::getDir($dir);
671 foreach ($entries as $e) {
672 if (is_file($dir . "/" . $e["entry"]) && $e["entry"] != "." && $e["entry"] != "..") {
673 $files[] = $e["entry"];
674 }
675 }
676 }
677
678 return $files;
679 }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory

References Vendor\Package\$e, _getDirectory(), ilUtil\getDir(), and ilObject\getId().

+ Here is the call graph for this function:

◆ getForbiddenFileTypes()

static ilObjMediaObject::getForbiddenFileTypes ( )
static

Get forbidden file types.

Returns
array

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

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

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

+ Here is the caller graph for this function:

◆ getImportId()

ilObjMediaObject::getImportId ( )

get import id

Reimplemented from ilObject.

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

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

References ilObject\$import_id.

◆ getLinkedMediaObjects()

ilObjMediaObject::getLinkedMediaObjects (   $a_ignore = "")

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

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

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

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

Referenced by generatePreviewPic(), and hasPurposeItem().

+ Here is the caller graph for this function:

◆ getMediaItemNr()

ilObjMediaObject::getMediaItemNr (   $a_purpose)

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

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

References $i.

◆ getMediaItems()

& ilObjMediaObject::getMediaItems ( )

get all media items

Returns
array array of media item objects

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

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

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

1494 {
1495 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1497 return $mime;
1498 }
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 2046 of file class.ilObjMediaObject.php.

2047 {
2048 $items = array();
2049
2050 include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
2052
2053 $dir = $this->getMultiSrtUploadDir();
2054 $files = ilUtil::getDir($dir);
2055 foreach ($files as $k => $i) {
2056 // check directory
2057 if ($i["type"] == "file" && !in_array($k, array(".", ".."))) {
2058 if (pathinfo($k, PATHINFO_EXTENSION) == "srt") {
2059 $lang = "";
2060 if (substr($k, strlen($k) - 7, 1) == "_") {
2061 $lang = substr($k, strlen($k) - 6, 2);
2062 if (!in_array($lang, $lang_codes)) {
2063 $lang = "";
2064 }
2065 }
2066 $items[] = array("filename" => $k, "lang" => $lang);
2067 }
2068 }
2069 }
2070 return $items;
2071 }
$lang
Definition: xapiexit.php:8

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

2007 {
2008 return ilObjMediaObject::_getDirectory($this->getId() . "/srt/tmp");
2009 }

References _getDirectory(), and ilObject\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 410 of file class.ilObjMediaObject.php.

411 {
412 return $this->origin_id;
413 }

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

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

67 {
68 return false;
69 }

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

1816 {
1817 return array_filter(self::getAllowedFileTypes(), function ($v) {
1818 return !in_array($v, self::getForbiddenFileTypes());
1819 });
1820 }

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

+ Here is the caller graph for this function:

◆ getSrtFiles()

ilObjMediaObject::getSrtFiles ( )

Get srt files.

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

1710 {
1711 $srt_dir = ilObjMediaObject::_getDirectory($this->getId()) . "/srt";
1712
1713 if (!is_dir($srt_dir)) {
1714 return array();
1715 }
1716
1717 $items = ilUtil::getDir($srt_dir);
1718
1719 $srt_files = array();
1720 foreach ($items as $i) {
1721 if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file") {
1722 $name = explode(".", $i["entry"]);
1723 if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_") {
1724 $srt_files[] = array("file" => $i["entry"],
1725 "full_path" => "srt/" . $i["entry"], "language" => substr($name[0], 9, 2));
1726 }
1727 }
1728 }
1729
1730 return $srt_files;
1731 }

References $i, $name, _getDirectory(), ilUtil\getDir(), and ilObject\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 1759 of file class.ilObjMediaObject.php.

1760 {
1761 $t_dir = ilObjMediaObject::_getThumbnailDirectory($a_mob_id);
1762 return $t_dir . "/" . $a_thumbname;
1763 }

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

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

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

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

References ilObject\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 1965 of file class.ilObjMediaObject.php.

1966 {
1967 $dir = ilObjMediaObject::_getDirectory($this->getId());
1968 $ppics = array("mob_vpreview.jpg",
1969 "mob_vpreview.jpeg",
1970 "mob_vpreview.png");
1971 foreach ($ppics as $p) {
1972 if (is_file($dir . "/" . $p)) {
1973 if ($a_filename_only) {
1974 return $p;
1975 } else {
1976 return $dir . "/" . $p;
1977 }
1978 }
1979 }
1980 return "";
1981 }

References _getDirectory(), and ilObject\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 686 of file class.ilObjMediaObject.php.

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

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

Referenced by exportMediaFullscreen(), exportXML(), and ilCOPageHTMLExport\renderMob().

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

901 {
902 $a_str = str_replace("&amp;", "&", $a_str);
903 $a_str = str_replace("&", "&amp;", $a_str);
904 return $a_str;
905 }

Referenced by getXML().

+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected

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

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

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

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

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

401 {
402 return $this->is_alias;
403 }

References $is_alias.

◆ isTypeAllowed()

static ilObjMediaObject::isTypeAllowed (   $a_type)
static

Is type allowed.

Parameters
string$a_type
Returns
bool

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

1867 {
1868 if (in_array($a_type, self::getForbiddenFileTypes())) {
1869 return false;
1870 }
1871 if (count(self::getAllowedFileTypes()) == 0 || in_array($a_type, self::getAllowedFileTypes())) {
1872 return true;
1873 }
1874 return false;
1875 }

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

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

1741 {
1742 $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1746 $m_dir . "/" . $a_file,
1747 $t_dir . "/" . $a_thumbname,
1748 $a_format,
1749 $a_size
1750 );
1751 }

References _createThumbnailDirectory(), _getDirectory(), _getThumbnailDirectory(), ilUtil\convertImage(), and ilObject\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 192 of file class.ilObjMediaObject.php.

193 {
194 include_once 'Services/MetaData/classes/class.ilMD.php';
195
196 switch ($a_element) {
197 case 'General':
198
199 // Update Title and description
200 $md = new ilMD(0, $this->getId(), $this->getType());
201 $md_gen = $md->getGeneral();
202
203 if (is_object($md_gen)) {
204 ilObject::_writeTitle($this->getId(), $md_gen->getTitle());
205 $this->setTitle($md_gen->getTitle());
206
207 foreach ($md_gen->getDescriptionIds() as $id) {
208 $md_des = $md_gen->getDescription($id);
209 ilObject::_writeDescription($this->getId(), $md_des->getDescription());
210 $this->setDescription($md_des->getDescription());
211 break;
212 }
213 }
214
215 break;
216
217 default:
218 }
219 return true;
220 }
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 ilObject\$id, ilObject\_writeDescription(), ilObject\_writeTitle(), ilObject\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 991 of file class.ilObjMediaObject.php.

992 {
993 if ($a_tag == "Identifier" && $a_param == "Entry") {
994 $a_value = ilUtil::insertInstIntoID($a_value);
995 }
996
997 return $a_value;
998 }
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 71 of file class.ilObjMediaObject.php.

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

◆ read()

ilObjMediaObject::read ( )

read media object data from db

Reimplemented from ilObject.

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

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

1770 {
1771 $file = str_replace("..", "", $a_file);
1772 $file = ilObjMediaObject::_getDirectory($this->getId()) . "/" . $file;
1773 if (is_file($file)) {
1774 unlink($file);
1775 }
1776 }

References _getDirectory(), and ilObject\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 341 of file class.ilObjMediaObject.php.

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

◆ removeMediaItem()

ilObjMediaObject::removeMediaItem (   $a_purpose)

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

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

References $i, $media_items, and ilObject\getId().

+ Here is the call graph for this function:

◆ renameExecutables()

static ilObjMediaObject::renameExecutables (   $a_dir)
static

Rename executables.

Parameters
string

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

2079 {
2081 if (!self::isTypeAllowed("html")) {
2082 ilUtil::rRenameSuffix($a_dir, "html", "sec"); // see #20187
2083 }
2084 }
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 395 of file class.ilObjMediaObject.php.

396 {
397 $this->is_alias = $a_is_alias;
398 }

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

1012 {
1013 $this->contains_int_link = $a_contains_link;
1014 }

◆ setDescription()

ilObjMediaObject::setDescription (   $a_description)

set description of media object

Reimplemented from ilObject.

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

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

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ setImportId()

ilObjMediaObject::setImportId (   $a_import_id)

set import id

@access public

Parameters
string$a_import_idimport id

Reimplemented from ilObject.

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

431 {
432 $this->import_id = $a_id;
433 }

◆ setOriginID()

ilObjMediaObject::setOriginID (   $a_id)

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

406 {
407 return $this->origin_id = $a_id;
408 }

◆ setRefId()

ilObjMediaObject::setRefId (   $a_id)

set reference id @access public

Parameters
integer$a_idreference id

Reimplemented from ilObject.

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

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

◆ setTitle()

ilObjMediaObject::setTitle (   $a_title)

set object title

@access public

Parameters
string$a_titleobject title

Reimplemented from ilObject.

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

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

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

473 {
474 parent::update();
475
476 if (!$a_upload) {
477 $this->updateMetaData();
478 }
479
481
482 // iterate all items
483 $media_items = $this->getMediaItems();
484 $j = 1;
485 foreach ($media_items as $key => $val) {
486 $item = $media_items[$key];
487 if (is_object($item)) {
488 $item->setMobId($this->getId());
489 $item->setNr($j);
490 if ($item->getLocationType() == "Reference") {
491 $item->extractUrlParameters();
492 }
493 $item->create();
494 $j++;
495 }
496 }
497
499 $ilAppEventHandler = $this->app_event_handler;
500 $ilAppEventHandler->raise(
501 'Services/MediaObjects',
502 'update',
503 array('object' => $this,
504 'obj_type' => 'mob',
505 'obj_id' => $this->getId())
506 );
507 }
updateMetaData()
update meta data entry

References $app_event_handler, $media_items, ilMediaItem\deleteAllItemsOfMob(), ilObject\getId(), getMediaItems(), handleQuotaUpdate(), and updateMetaData().

+ Here is the call graph for this function:

◆ updateMetaData()

ilObjMediaObject::updateMetaData ( )

update meta data entry

Reimplemented from ilObject.

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

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

References getDescription(), ilObject\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 1673 of file class.ilObjMediaObject.php.

1674 {
1675 $a_subdir = str_replace("..", "", $a_subdir);
1676 $dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
1677 if ($a_subdir != "") {
1678 $dir .= "/" . $a_subdir;
1679 }
1681 if ($a_mode == "rename") {
1682 rename($tmp_name, $dir . "/" . $a_name);
1683 } else {
1684 ilUtil::moveUploadedFile($tmp_name, $a_name, $dir . "/" . $a_name, true, $a_mode);
1685 }
1686 self::renameExecutables($mob_dir);
1687 include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1688 ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1689 }

References _getDirectory(), ilObject\getId(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), 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 2018 of file class.ilObjMediaObject.php.

2019 {
2020 $lng = $this->lng;
2022
2023 include_once("./Services/MediaObjects/exceptions/class.ilMediaObjectsException.php");
2024 if (!is_file($a_file["tmp_name"])) {
2025 throw new ilMediaObjectsException($lng->txt("mob_file_could_not_be_uploaded"));
2026 }
2027
2028 $dir = $this->getMultiSrtUploadDir();
2029 ilUtil::delDir($dir, true);
2031 ilUtil::moveUploadedFile($a_file["tmp_name"], "multi_srt.zip", $dir . "/" . "multi_srt.zip");
2032 ilUtil::unzip($dir . "/multi_srt.zip", true);
2033 }
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(), ilUtil\moveUploadedFile(), 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 1697 of file class.ilObjMediaObject.php.

1698 {
1699 if (is_file($a_tmp_name) && $a_language != "") {
1700 $this->uploadAdditionalFile("subtitle_" . $a_language . ".srt", $a_tmp_name, "srt", $a_mode);
1701 return true;
1702 }
1703 return false;
1704 }
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 1920 of file class.ilObjMediaObject.php.

1921 {
1922 // remove old one
1923 if ($this->getVideoPreviewPic(true) != "") {
1924 $this->removeAdditionalFile($this->getVideoPreviewPic(true));
1925 }
1926
1927 $pi = pathinfo($a_prevpic["name"]);
1928 $ext = $pi["extension"];
1929 if (in_array($ext, array("jpg", "jpeg", "png"))) {
1930 $this->uploadAdditionalFile("mob_vpreview." . $ext, $a_prevpic["tmp_name"]);
1931 }
1932 }
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 41 of file class.ilObjMediaObject.php.

Referenced by containsIntLink().

◆ $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 40 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: