ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjMediaObject Class Reference
+ Inheritance diagram for ilObjMediaObject:
+ Collaboration diagram for ilObjMediaObject:

Public Member Functions

 __construct (int $a_id=0)
 
 delete ()
 
 addMediaItem (ilMediaItem $a_item)
 
getMediaItems ()
 
 getMediaItem (string $a_purpose)
 get item for media purpose More...
 
 removeMediaItem (string $a_purpose)
 
 removeAllMediaItems ()
 
 hasFullscreenItem ()
 
 hasPurposeItem (string $purpose)
 returns whether object has media item with specific purpose More...
 
 read ()
 
 setAlias (bool $a_is_alias)
 
 isAlias ()
 
 setOriginID (string $a_id)
 
 getOriginID ()
 
 create (bool $a_create_meta_data=false, bool $a_save_media_items=true)
 
 update (bool $a_upload=false)
 
 createDirectory ()
 Create file directory of media object. More...
 
 getFilesOfDirectory (string $a_subdir="")
 Get files of directory. More...
 
 getXML (int $a_mode=IL_MODE_FULL, int $a_inst=0, bool $a_sign_locals=false)
 get MediaObject XLM Tag More...
 
 handleAmps (string $a_str)
 Replace "&" (if not an "&") with "&". More...
 
 exportXML (ilXmlWriter $a_xml_writer, int $a_inst=0)
 
 exportFiles (string $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...
 
 modifyExportIdentifier (string $a_tag, string $a_param, string $a_value)
 
 setContainsIntLink (bool $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 (bool $a_include_history=true)
 get all usages of current media object More...
 
 getDataDirectory ()
 
 uploadAdditionalFile (string $a_name, string $tmp_name, string $a_subdir="", string $a_mode="move_uploaded")
 Create new media object and update page in db and return new media object. More...
 
 addAdditionalFileFromUpload (FileUpload $upload, UploadResult $result, string $subdir)
 
 uploadSrtFile (string $a_tmp_name, string $a_language, string $a_mode="move_uploaded")
 
 getSrtFiles ()
 
 makeThumbnail (string $a_file, string $a_thumbname,)
 Make thumbnail. More...
 
 removeAdditionalFile (string $a_file)
 
 getLinkedMediaObjects (array $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 (array $a_prevpic)
 
 getVideoPreviewPic (bool $a_filename_only=false)
 
 getMultiSrtUploadDir ()
 Get directory for multi srt upload. More...
 
 uploadMultipleSubtitleFile (array $a_file)
 Upload multi srt file. More...
 
 clearMultiSrtDirectory ()
 Clear multi srt directory. More...
 
 getMultiSrtFiles ()
 Get all srt files of srt multi upload. More...
 
 getExternalMetadata ()
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _exists (int $id, bool $reference=false, ?string $type=null)
 
static _getDirectory (int $a_mob_id)
 Get absolute directory. More...
 
static _getRelativeDirectory (int $a_mob_id)
 Get relative (to webspace dir) directory. More...
 
static _getURL (int $a_mob_id)
 get directory for files of media object More...
 
static _getThumbnailDirectory (int $a_mob_id, string $a_mode="filesystem")
 get directory for files of media object More...
 
static _lookupStandardItemPath (int $a_mob_id, bool $a_url_encode=false, bool $a_web=true)
 Get path for standard item. More...
 
static _lookupItemPath (int $a_mob_id, bool $a_url_encode=false, bool $a_web=true, string $a_purpose="")
 Get path for item with specific purpose. More...
 
static _createThumbnailDirectory (int $a_obj_id)
 Create thumbnail directory. More...
 
static _deleteAllUsages (string $a_type, int $a_id, ?int $a_usage_hist_nr=0, string $a_lang="-")
 
static _getMobsOfObject (string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
 
static _saveUsage (int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
 Save usage of mob within another container (e.g. More...
 
static _removeUsage (int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
 Remove usage of mob in another container. More...
 
static lookupUsages (int $a_id, bool $a_include_history=true)
 Lookup usages of media object. More...
 
static getParentObjectIdForUsage (array $a_usage, bool $a_include_all_access_obj_ids=false)
 Get's the repository object ID of a parent object, if possible see ilWebAccessChecker. More...
 
static _resizeImage (string $a_file, int $a_width, int $a_height, bool $a_constrain_prop=false)
 Resize image and return new image file ("_width_height" string appended) More...
 
static getMimeType (string $a_file, bool $a_external=false)
 get mime type for file More...
 
static _determineWidthHeight (string $a_format, string $a_type, string $a_file, string $a_reference, bool $a_constrain_proportions, bool $a_use_original, ?int $a_user_width=null, ?int $a_user_height=null)
 
static _saveTempFileAsMediaObject (string $name, string $tmp_name, bool $upload=true)
 Create new media object and update page in db and return new media object. More...
 
static getThumbnailPath (int $a_mob_id, string $a_thumbname)
 
static isTypeAllowed (string $a_type)
 
static fixFilename (string $a_name)
 Fix filename of uploaded file. More...
 
static renameExecutables (string $a_dir)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Data Fields

bool $is_alias
 
string $origin_id
 
array $media_items
 
bool $contains_int_link
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Member Functions

 beforeMDUpdateListener (string $a_element)
 
 beforeCreateMetaData ()
 
 beforeUpdateMetaData ()
 
 beforeDeleteMetaData ()
 
 escapeProperty (string $a_value)
 Escape property (e.g. More...
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Static Protected Member Functions

static handleQuotaUpdate (ilObjMediaObject $a_mob)
 

Protected Attributes

InternalDomainService $domain
 
ilObjUser $user
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Private Attributes

const DEFAULT_PREVIEW_SIZE = 80
 
LegacyImages $image_converter
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaObject::__construct ( int  $a_id = 0)

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

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

47  {
48  global $DIC;
49 
50  $this->user = $DIC->user();
51  $this->app_event_handler = $DIC["ilAppEventHandler"];
52  $this->lng = $DIC->language();
53  $this->is_alias = false;
54  $this->media_items = array();
55  $this->contains_int_link = false;
56  $this->type = "mob";
57  parent::__construct($a_id, false);
58  $this->image_converter = $DIC->fileConverters()->legacyImages();
59  $this->domain = $DIC->mediaObjects()->internal()->domain();
60  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ _createThumbnailDirectory()

static ilObjMediaObject::_createThumbnailDirectory ( int  $a_obj_id)
static

Create thumbnail directory.

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

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

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

464  : void {
466  ilFileUtils::createDirectory(ilFileUtils::getWebspaceDir() . "/thumbs/mm_" . $a_obj_id);
467  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static createDirectory(string $a_dir, int $a_mod=0755)
create directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteAllUsages()

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

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

References $DIC, $ilDB, and $q.

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

794  : void {
795  global $DIC;
796 
797  $ilDB = $DIC->database();
798 
799  $and_hist = "";
800  if (!is_null($a_usage_hist_nr)) {
801  $and_hist = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
802  }
803 
804  $mob_ids = array();
805  $set = $ilDB->query("SELECT id FROM mob_usage" .
806  " WHERE usage_type = " . $ilDB->quote($a_type, "text") .
807  " AND usage_id = " . $ilDB->quote($a_id, "integer") .
808  " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
809  $and_hist);
810  while ($row = $ilDB->fetchAssoc($set)) {
811  $mob_ids[] = $row["id"];
812  }
813 
814  $q = "DELETE FROM mob_usage WHERE usage_type = " .
815  $ilDB->quote($a_type, "text") .
816  " AND usage_id= " . $ilDB->quote($a_id, "integer") .
817  " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
818  $and_hist;
819  $ilDB->manipulate($q);
820 
821  foreach ($mob_ids as $mob_id) {
822  self::handleQuotaUpdate(new self($mob_id));
823  }
824  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _determineWidthHeight()

static ilObjMediaObject::_determineWidthHeight ( string  $a_format,
string  $a_type,
string  $a_file,
string  $a_reference,
bool  $a_constrain_proportions,
bool  $a_use_original,
?int  $a_user_width = null,
?int  $a_user_height = null 
)
static

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

References $DIC, ilObject\$lng, $r, ilUtil\deducibleSize(), ilMediaImageUtil\getImageSize(), ILIAS\Repository\int(), and ilLanguage\txt().

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

1268  : array {
1269  global $DIC;
1270 
1271  $lng = $DIC->language();
1272  $size = [];
1273  $wr = 0;
1274  $hr = 0;
1275  $width = 0;
1276  $height = 0;
1277 
1278  // determine width and height of known image types
1279  //$width = 640;
1280  //$height = 360;
1281  $info = "";
1282 
1283  /*
1284  if ($a_format == "audio/mpeg") {
1285  $width = 300;
1286  $height = 20;
1287  }*/
1288 
1289  if (ilUtil::deducibleSize($a_format)) {
1290  if ($a_type == "File") {
1291  $size = ilMediaImageUtil::getImageSize($a_file);
1292  } else {
1293  $size = ilMediaImageUtil::getImageSize($a_reference);
1294  }
1295  }
1296 
1297  if (!isset($size[0])) {
1298  $size[0] = 0;
1299  }
1300  if (!isset($size[1])) {
1301  $size[1] = 0;
1302  }
1303 
1304  if ($a_use_original) {
1305  if ($size[0] > 0 && $size[1] > 0) {
1306  //$width = $size[0];
1307  //$height = $size[1];
1308  $width = "";
1309  $height = "";
1310  } else {
1311  $info = $lng->txt("cont_could_not_determine_resource_size");
1312  }
1313  } else {
1314  $w = $a_user_width;
1315  $h = $a_user_height;
1316  $width = $w;
1317  $height = $h;
1318  //echo "<br>C-$width-$height-";
1319  if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions) {
1320  if ($size[0] > 0 && $size[1] > 0) {
1321  if ($w > 0) {
1322  $wr = $size[0] / $w;
1323  }
1324  if ($h > 0) {
1325  $hr = $size[1] / $h;
1326  }
1327  //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1328  //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1329  $r = max($wr, $hr);
1330  if ($r > 0) {
1331  $width = (int) round($size[0] / $r);
1332  $height = (int) round($size[1] / $r);
1333  }
1334  }
1335  }
1336  //echo "<br>D-$width-$height-";
1337  }
1338  //echo "<br>E-$width-$height-";
1339 
1340  if ($width == 0 && is_null($a_user_width)) {
1341  $width = "";
1342  }
1343  if ($height == 0 && is_null($a_user_height)) {
1344  $height = "";
1345  }
1346  return array("width" => $width, "height" => $height, "info" => $info);
1347  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: feed.php:28
ilLanguage $lng
static deducibleSize(string $a_mime)
checks if mime type is provided by getimagesize()
static getImageSize(string $a_location)
Get image size from location.
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _exists()

static ilObjMediaObject::_exists ( int  $id,
bool  $reference = false,
?string  $type = null 
)
static

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

References ilInternalLink\_extractObjIdOfTarget(), and ilObject\_lookupType().

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

66  : bool {
67  if (is_int(strpos($id, "_"))) {
69  }
70 
71  if (parent::_exists($id) && ilObject::_lookupType($id) === "mob") {
72  return true;
73  }
74  return false;
75  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDirectory()

static ilObjMediaObject::_getDirectory ( int  $a_mob_id)
static

Get absolute directory.

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

References ilFileUtils\getWebspaceDir().

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML(), ilObjMediaCastAccess\_lookupDiskUsage(), _saveTempFileAsMediaObject(), ILIAS\MediaCast\BackgroundTasks\DownloadAllCollectFilesJob\collectMediaFiles(), ilPCInteractiveImageGUI\create(), createDirectory(), ilObjMediaPoolGUI\createMediaFromUploadDir(), delete(), ilNewsItem\deliverMobFile(), ilMediaItem\determineDuration(), ilObjMediaCastGUI\determinePlaytimeObject(), duplicate(), ilMediaItem\getDirectory(), getExternalMetadata(), 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\returnToContextObject(), ilObjMediaObjectGUI\savePropertiesObject(), ilMediaCreationGUI\saveUrl(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), uploadAdditionalFile(), and uploadVideoPreviewPic().

376  : string {
377  return ilFileUtils::getWebspaceDir() . "/" . self::_getRelativeDirectory($a_mob_id);
378  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMobsOfObject()

static ilObjMediaObject::_getMobsOfObject ( string  $a_type,
int  $a_id,
int  $a_usage_hist_nr = 0,
string  $a_lang = "-" 
)
static
Returns
int[]

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

References $DIC, $ilDB, $q, ilObject\_lookupType(), and ILIAS\Repository\int().

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), assQuestionExport\addQTIMaterial(), ilObjTest\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(), ilQuestionpoolExport\exportXHTMLMediaObjects(), ilTestExport\exportXHTMLMediaObjects(), ilPageObject\getLastUpdateOfIncludedElements(), ilLMMultiSrt\getMobIds(), ilMepMultiSrt\getMobIds(), ilSoapUtils\getMobsOfObject(), ilCOPageExporter\getXmlExportHeadDependencies(), ilTestExporter\getXmlExportHeadDependencies(), ilPCMediaObject\modifyPageContentPostXsl(), ilForumUtil\moveMediaObjects(), ilObjForumGUI\publishDraftObject(), ILIAS\COPage\PC\MediaObject\MediaObjectManager\resolveMediaAliases(), ilObjForumGUI\savePostObject(), ilForumXMLWriter\start(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), assOrderingHorizontal\toJSON(), assTextSubset\toJSON(), assLongMenu\toJSON(), assKprimChoice\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assOrderingQuestion\toJSON(), assMatchingQuestion\toJSON(), assClozeTest\toJSON(), ilObjForumGUI\updateDraftObject(), and ilObjForumGUI\viewThreadObject().

834  : array {
835  global $DIC;
836 
837  $ilDB = $DIC->database();
838 
839  $lstr = "";
840  if ($a_lang != "") {
841  $lstr = " AND usage_lang = " . $ilDB->quote($a_lang, "text");
842  }
843  $hist_str = "";
844  if ($a_usage_hist_nr > 0) {
845  $hist_str = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
846  }
847 
848  $q = "SELECT * FROM mob_usage WHERE " .
849  "usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
850  "usage_id = " . $ilDB->quote($a_id, "integer") .
851  $lstr . $hist_str;
852  $mobs = array();
853  $mob_set = $ilDB->query($q);
854  while ($mob_rec = $ilDB->fetchAssoc($mob_set)) {
855  $mob_id = (int) $mob_rec['id'];
856  if (ilObject::_lookupType($mob_id) === "mob") {
857  $mobs[$mob_id] = $mob_id;
858  }
859  }
860 
861  return $mobs;
862  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getRelativeDirectory()

static ilObjMediaObject::_getRelativeDirectory ( int  $a_mob_id)
static

Get relative (to webspace dir) directory.

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

Referenced by ILIAS\COPage\PC\InteractiveImage\IIMManager\handleUploadResult(), ilMediaCreationGUI\handleUploadResult(), and ilObjMediaPoolGUI\handleUploadResult().

383  : string
384  {
385  return "mobs/mm_" . $a_mob_id;
386  }
+ Here is the caller graph for this function:

◆ _getThumbnailDirectory()

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

get directory for files of media object

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

References ilFileUtils\getWebspaceDir().

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

403  : string {
404  return ilFileUtils::getWebspaceDir($a_mode) . "/thumbs/mm_" . $a_mob_id;
405  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getURL()

static ilObjMediaObject::_getURL ( int  $a_mob_id)
static

get directory for files of media object

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

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

Referenced by ilMediaObjectsPlayerWrapperGUI\audio(), ilMediaCastTableGUI\fillRow(), ilMediaCastManageTableGUI\fillRow(), ilDclMobRecordRepresentation\getHTML(), McstImageGalleryGUI\getHTML(), ilNewsTimelineItemGUI\getMediaPath(), ilNewsForContextBlockGUI\getMediaPath(), ilMediaItem\getThumbnailTarget(), ILIAS\MediaCast\Video\VideoSequence\init(), and ilObjMediaCastGUI\showCastItemObject().

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

◆ _lookupItemPath()

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

Get path for item with specific purpose.

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

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

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

426  : string {
427  if ($a_purpose == "") {
428  $a_purpose = "Standard";
429  }
430  $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
431  if (preg_match("/https?\:/i", $location)) {
432  return $location;
433  }
434 
435  if ($a_url_encode) {
436  $location = rawurlencode($location);
437  }
438 
439  $path = ($a_web)
440  ? ILIAS_HTTP_PATH
441  : ".";
442 
443  return $path . "/data/" . CLIENT_ID . "/mobs/mm_" . $a_mob_id . "/" . $location;
444  }
static _lookupLocationForMobId(int $a_mob_id, string $a_purpose)
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
$path
Definition: ltiservices.php:32
const CLIENT_ID
Definition: constants.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupStandardItemPath()

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

Get path for standard item.

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

References _lookupItemPath().

414  : string {
415  return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
416  }
static _lookupItemPath(int $a_mob_id, bool $a_url_encode=false, bool $a_web=true, string $a_purpose="")
Get path for item with specific purpose.
+ Here is the call graph for this function:

◆ _removeUsage()

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

Remove usage of mob in another container.

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

References $DIC, $ilDB, and $q.

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

902  : void {
903  global $DIC;
904 
905  $ilDB = $DIC->database();
906 
907  $q = "DELETE FROM mob_usage WHERE " .
908  " id = " . $ilDB->quote($a_mob_id, "integer") . " AND " .
909  " usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
910  " usage_id = " . $ilDB->quote($a_id, "integer") . " AND " .
911  " usage_lang = " . $ilDB->quote($a_lang, "text") . " AND " .
912  " usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
913  $ilDB->manipulate($q);
914 
915  self::handleQuotaUpdate(new self($a_mob_id));
916  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _resizeImage()

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

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

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

References $DIC, and $location.

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

1221  : string {
1222  global $DIC;
1223  $file_path = pathinfo($a_file);
1224  $location = substr($file_path["basename"], 0, strlen($file_path["basename"]) -
1225  strlen($file_path["extension"]) - 1) . "_" .
1226  $a_width . "_" .
1227  $a_height . "." . $file_path["extension"];
1228  $target_file = $file_path["dirname"] . "/" .
1229  $location;
1230 
1231  $returned_target_file = $DIC->fileConverters()
1232  ->legacyImages()
1233  ->resizeToFixedSize(
1234  $a_file,
1235  $target_file,
1236  $a_width,
1237  $a_height,
1238  $a_constrain_prop
1239  );
1240 
1241  if ($returned_target_file !== $target_file) {
1242  throw new RuntimeException('Could not resize image');
1243  }
1244 
1245  return $location;
1246  }
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _saveTempFileAsMediaObject()

static ilObjMediaObject::_saveTempFileAsMediaObject ( string  $name,
string  $tmp_name,
bool  $upload = true 
)
static

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

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

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

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

1361  : ilObjMediaObject {
1362  // create dummy object in db (we need an id)
1363  $media_object = new ilObjMediaObject();
1364  $media_object->setTitle($name);
1365  $media_object->setDescription("");
1366  $media_object->create();
1367 
1368  // determine and create mob directory, move uploaded file to directory
1369  $media_object->createDirectory();
1370  $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
1371 
1372  $media_item = new ilMediaItem();
1373  $media_object->addMediaItem($media_item);
1374  $media_item->setPurpose("Standard");
1375 
1376  $file = $mob_dir . "/" . $name;
1377  if ($upload) {
1378  ilFileUtils::moveUploadedFile($tmp_name, $name, $file);
1379  } else {
1380  copy($tmp_name, $file);
1381  }
1382  // get mime type
1383  $format = ilObjMediaObject::getMimeType($file);
1384  $location = $name;
1385  // set real meta and object data
1386  $media_item->setFormat($format);
1387  $media_item->setLocation($location);
1388  $media_item->setLocationType("LocalFile");
1389  $media_object->setTitle($name);
1390  $media_object->setDescription($format);
1391 
1392  if (ilUtil::deducibleSize($format)) {
1393  $size = ilMediaImageUtil::getImageSize($file);
1394  $media_item->setWidth($size[0]);
1395  $media_item->setHeight($size[1]);
1396  }
1397  $media_item->setHAlign("Left");
1398 
1399  self::renameExecutables($mob_dir);
1400  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1401 
1402  $media_object->update();
1403 
1404  return $media_object;
1405  }
static sanitizeDir(string $a_path)
Sanitize directory recursively.
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static deducibleSize(string $a_mime)
checks if mime type is provided by getimagesize()
static getImageSize(string $a_location)
Get image size from location.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveUsage()

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

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

page)

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

References $DIC, and $ilDB.

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\copyXHTMLMediaObjectsOfQuestion(), assQuestion\copyXHTMLMediaObjectsOfQuestion(), ilObjForumGUI\createThread(), ilDataCollectionDataSet\escapeArray(), assKprimChoiceImport\fromXML(), assLongMenuImport\fromXML(), assFileUploadImport\fromXML(), assErrorTextImport\fromXML(), assFormulaQuestionImport\fromXML(), assImagemapQuestionImport\fromXML(), assMultipleChoiceImport\fromXML(), assNumericImport\fromXML(), assOrderingHorizontalImport\fromXML(), assSingleChoiceImport\fromXML(), assTextSubsetImport\fromXML(), assOrderingQuestionImport\fromXML(), assTextQuestionImport\fromXML(), assMatchingQuestionImport\fromXML(), ilSurveyImporter\getSurvey(), ilForumAutoSaveAsyncDraftAction\handleMedia(), ilForumXMLParser\handlerEndTag(), ilForumUtil\moveMediaObjects(), ilDclMobRecordFieldModel\parseValue(), ilObjForumGUI\publishDraftObject(), ilObjTest\replaceMobsInPageImports(), ilObjTest\retrieveMobsFromLegacyImports(), ilForumUtil\saveMediaObjects(), ilPCMediaObject\saveMobUsage(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), ilExSubmissionTextGUI\updateAssignmentTextObject(), and ilObjForumGUI\updateDraftObject().

873  : void {
874  global $DIC;
875 
876  $ilDB = $DIC->database();
877 
878  $ilDB->replace(
879  "mob_usage",
880  array(
881  "id" => array("integer", $a_mob_id),
882  "usage_type" => array("text", $a_type),
883  "usage_id" => array("integer", $a_id),
884  "usage_lang" => array("text", $a_lang),
885  "usage_hist_nr" => array("integer", $a_usage_hist_nr)
886  ),
887  array()
888  );
889 
890  self::handleQuotaUpdate(new self($a_mob_id));
891  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ addAdditionalFileFromUpload()

ilObjMediaObject::addAdditionalFileFromUpload ( FileUpload  $upload,
UploadResult  $result,
string  $subdir 
)

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

References ilObject\getId(), ILIAS\FileUpload\DTO\UploadResult\getName(), and ILIAS\FileUpload\FileUpload\moveOneFileTo().

Referenced by ILIAS\COPage\PC\InteractiveImage\IIMManager\handleOverlayUpload().

1435  : void {
1436  $mob_dir = self::_getRelativeDirectory($this->getId());
1437  $mob_dir .= "/" . $subdir;
1438  $upload->moveOneFileTo(
1439  $result,
1440  $mob_dir,
1441  Location::WEB,
1442  $result->getName(),
1443  true
1444  );
1445  }
moveOneFileTo(UploadResult $uploadResult, string $destination, int $location=Location::STORAGE, string $file_name='', bool $override_existing=false)
Moves a single File (the attributes, metadata and upload-status of which are contained in UploadResul...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMediaItem()

ilObjMediaObject::addMediaItem ( ilMediaItem  $a_item)

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

Referenced by ilMediaItem\_getMediaItemsOfMOb(), ilObjMediaCastGUI\createMediaItemForPurpose(), and ilObjMediaObjectGUI\setObjectPerCreationForm().

194  : void {
195  $this->media_items[] = $a_item;
196  }
+ Here is the caller graph for this function:

◆ beforeCreateMetaData()

ilObjMediaObject::beforeCreateMetaData ( )
protected

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

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

149  : bool
150  {
151  $ilUser = $this->user;
152 
153  $md_creator = new ilMDCreator(0, $this->getId(), $this->getType());
154  $md_creator->setTitle($this->getTitle());
155  $md_creator->setTitleLanguage($ilUser->getPref('language'));
156  $md_creator->setDescription($this->getDescription());
157  $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
158  $md_creator->setKeywordLanguage($ilUser->getPref('language'));
159  $md_creator->setLanguage($ilUser->getPref('language'));
160  $md_creator->create();
161 
162  return false; // avoid parent to create md
163  }
+ Here is the call graph for this function:

◆ beforeDeleteMetaData()

ilObjMediaObject::beforeDeleteMetaData ( )
protected

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

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

182  : bool
183  {
184  // Delete meta data
185  $md = new ilMD(0, $this->getId(), $this->getType());
186  $md->deleteAll();
187 
188  return false;
189  }
+ Here is the call graph for this function:

◆ beforeMDUpdateListener()

ilObjMediaObject::beforeMDUpdateListener ( string  $a_element)
protected

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

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

123  : bool
124  {
125  switch ($a_element) {
126  case 'General':
127 
128  // Update Title and description
129  $md = new ilMD(0, $this->getId(), $this->getType());
130  $md_gen = $md->getGeneral();
131 
132  if (is_object($md_gen)) {
133  ilObject::_writeTitle($this->getId(), $md_gen->getTitle());
134  $this->setTitle($md_gen->getTitle());
135 
136  foreach ($md_gen->getDescriptionIds() as $id) {
137  $md_des = $md_gen->getDescription($id);
138  ilObject::_writeDescription($this->getId(), $md_des->getDescription());
139  $this->setDescription($md_des->getDescription());
140  break;
141  }
142  }
143 
144  break;
145  }
146  return false; // prevent parent from creating ilMD
147  }
static _writeTitle(int $obj_id, string $title)
write title to db (static)
setTitle(string $title)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setDescription(string $description)
static _writeDescription(int $obj_id, string $desc)
write description to db (static)
+ Here is the call graph for this function:

◆ beforeUpdateMetaData()

ilObjMediaObject::beforeUpdateMetaData ( )
protected

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

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

165  : bool
166  {
167  $md = new ilMD(0, $this->getId(), $this->getType());
168  $md_gen = $md->getGeneral();
169  $md_gen->setTitle($this->getTitle());
170 
171  // sets first description (maybe not appropriate)
172  $md_des_ids = $md_gen->getDescriptionIds();
173  if (count($md_des_ids) > 0) {
174  $md_des = $md_gen->getDescription($md_des_ids[0]);
175  $md_des->setDescription($this->getDescription());
176  $md_des->update();
177  }
178  $md_gen->update();
179  return false;
180  }
+ Here is the call graph for this function:

◆ clearMultiSrtDirectory()

ilObjMediaObject::clearMultiSrtDirectory ( )

Clear multi srt directory.

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

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

1766  : void
1767  {
1769  }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getMultiSrtUploadDir()
Get directory for multi srt upload.
+ 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 784 of file class.ilObjMediaObject.php.

References $contains_int_link.

784  : bool
785  {
787  }

◆ create()

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

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

References ilObject\$app_event_handler, $id, ilObject\createMetaData(), ilObject\getId(), getMediaItems(), and ilAppEventHandler\raise().

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

292  : int
293  {
294  $id = parent::create();
295 
296  if (!$a_create_meta_data) {
297  $this->createMetaData();
298  }
299 
300  if ($a_save_media_items) {
301  $media_items = $this->getMediaItems();
302  for ($i = 0; $i < count($media_items); $i++) {
303  $item = $media_items[$i];
304  $item->setMobId($this->getId());
305  $item->setNr($i + 1);
306  $item->create();
307  }
308  }
309 
310  self::handleQuotaUpdate($this);
311 
312  $ilAppEventHandler = $this->app_event_handler;
313  $ilAppEventHandler->raise(
314  'Services/MediaObjects',
315  'create',
316  array('object' => $this,
317  'obj_type' => 'mob',
318  'obj_id' => $this->getId())
319  );
320 
321  return $id;
322  }
ilAppEventHandler $app_event_handler
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createDirectory()

ilObjMediaObject::createDirectory ( )

Create file directory of media object.

Exceptions
ilMediaObjectsException

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

References $path, _getDirectory(), ilObject\getId(), and ilFileUtils\makeDirParents().

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm(), and ilObjMediaCastGUI\updateMediaItem().

450  : void
451  {
454  if (!is_dir($path)) {
455  throw new ilMediaObjectsException("Failed to create directory $path.");
456  }
457  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
$path
Definition: ltiservices.php:32
static _getDirectory(int $a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjMediaObject::delete ( )

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

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

77  : bool
78  {
79  $mob_logger = ilLoggerFactory::getLogger('mob');
80  $mob_logger->debug("ilObjMediaObject: Delete called for media object ID '" . $this->getId() . "'.");
81 
82  if (!($this->getId() > 0)) {
83  return false;
84  }
85 
86  $usages = $this->getUsages();
87 
88  $mob_logger->debug("ilObjMediaObject: ... Found " . count($usages) . " usages.");
89 
90  if (count($usages) == 0) {
91  // remove directory
93 
94  // remove thumbnail directory
96 
97  // delete meta data of mob
98  $this->deleteMetaData();
99 
100  // delete media items
102 
103  // this is just to make sure, there should be no entries left at
104  // this point as they depend on the usage
105  self::handleQuotaUpdate($this);
106 
107  // delete object
108  parent::delete();
109 
110  $mob_logger->debug("ilObjMediaObject: ... deleted.");
111  } else {
112  foreach ($usages as $u) {
113  $mob_logger->debug("ilObjMediaObject: ... usage type:" . $u["type"] .
114  ", id:" . $u["id"] .
115  ", lang:" . ($u["lang"] ?? "") .
116  ", hist_nr:" . ($u["hist_nr"] ?? "") . ".");
117  }
118  $mob_logger->debug("ilObjMediaObject: ... not deleted.");
119  }
120  return true;
121  }
static _getThumbnailDirectory(int $a_mob_id, string $a_mode="filesystem")
get directory for files of media object
static getLogger(string $a_component_id)
Get component logger.
static deleteAllItemsOfMob(int $a_mob_id)
static _getDirectory(int $a_mob_id)
Get absolute directory.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getUsages(bool $a_include_history=true)
get all usages of current media object
+ Here is the call graph for this function:

◆ duplicate()

ilObjMediaObject::duplicate ( )

Duplicate media object, return new media object.

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

References ILIAS\LTI\ToolProvider\$key, _getDirectory(), _getThumbnailDirectory(), ilObject\getDescription(), ilObject\getId(), getMediaItems(), ilObject\getTitle(), and ilFileUtils\rCopy().

Referenced by ilDclMobRecordFieldModel\afterClone().

1575  {
1576  $new_obj = new ilObjMediaObject();
1577  $new_obj->setTitle($this->getTitle());
1578  $new_obj->setDescription($this->getDescription());
1579 
1580  // media items
1581  foreach ($this->getMediaItems() as $key => $val) {
1582  $new_obj->addMediaItem($val);
1583  }
1584 
1585  $new_obj->create(false, true);
1586 
1587  // files
1588  $new_obj->createDirectory();
1589  self::_createThumbnailDirectory($new_obj->getId());
1592  ilObjMediaObject::_getDirectory($new_obj->getId())
1593  );
1596  ilObjMediaObject::_getThumbnailDirectory($new_obj->getId())
1597  );
1598 
1599  // meta data
1600  $md = new ilMD(0, $this->getId(), "mob");
1601  $new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
1602 
1603  return $new_obj;
1604  }
static _getThumbnailDirectory(int $a_mob_id, string $a_mode="filesystem")
get directory for files of media object
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static _getDirectory(int $a_mob_id)
Get absolute directory.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ escapeProperty()

ilObjMediaObject::escapeProperty ( string  $a_value)
protected

Escape property (e.g.

title, caption) to XSLT -> HTML output

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

Referenced by getXML().

711  : string {
712  return htmlspecialchars($a_value);
713  }
+ Here is the caller graph for this function:

◆ exportFiles()

ilObjMediaObject::exportFiles ( string  $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

Exceptions

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

References ilObject\getId(), ilFileUtils\getWebspaceDir(), IL_INST_ID, ilFileUtils\makeDir(), and ilFileUtils\rCopy().

745  : void {
746  $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
747  ilFileUtils::makeDir($a_target_dir . "/objects/" . $subdir);
748 
749  $mobdir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->getId();
750  ilFileUtils::rCopy($mobdir, $a_target_dir . "/objects/" . $subdir);
751  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
const IL_INST_ID
Definition: constants.php:40
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ exportXML()

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

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

References ilXmlWriter\appendXML(), getXML(), and IL_MODE_FULL.

730  : void {
731  $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
732  }
const IL_MODE_FULL
appendXML(string $a_str)
append xml string to document
getXML(int $a_mode=IL_MODE_FULL, int $a_inst=0, bool $a_sign_locals=false)
get MediaObject XLM Tag
+ Here is the call graph for this function:

◆ fixFilename()

static ilObjMediaObject::fixFilename ( string  $a_name)
static

Fix filename of uploaded file.

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

References ilFileUtils\getASCIIFilename().

Referenced by ILIAS\COPage\PC\InteractiveImage\IIMManager\handleUploadResult(), ilMediaCreationGUI\handleUploadResult(), ilObjMediaPoolGUI\handleUploadResult(), ilObjMediaObjectGUI\savePropertiesObject(), and ilObjMediaObjectGUI\setObjectPerCreationForm().

1725  : string {
1726  $a_name = ilFileUtils::getASCIIFilename($a_name);
1727 
1728  $rchars = array("`", "=", "$", "{", "}", "'", ";", " ", "(", ")");
1729  $a_name = str_replace($rchars, "_", $a_name);
1730  $a_name = str_replace("__", "_", $a_name);
1731  return $a_name;
1732  }
static getASCIIFilename(string $a_filename)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDataDirectory()

ilObjMediaObject::getDataDirectory ( )

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

References ilObject\getId(), and ilFileUtils\getWebspaceDir().

Referenced by getXML().

1349  : string
1350  {
1351  return ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->getId();
1352  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExternalMetadata()

ilObjMediaObject::getExternalMetadata ( )

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

References Vendor\Package\$e, $url, _getDirectory(), ilExternalMediaAnalyzer\extractVimeoParameters(), ilObject\getId(), getMediaItem(), ilExternalMediaAnalyzer\getVimeoMetadata(), ilExternalMediaAnalyzer\getYoutubeMetadata(), ilExternalMediaAnalyzer\isVimeo(), ilObject\setDescription(), and ilObject\setTitle().

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

1809  : void
1810  {
1811  // see https://oembed.com/
1812  $st_item = $this->getMediaItem("Standard");
1813  if ($st_item->getLocationType() == "Reference") {
1814  if (ilExternalMediaAnalyzer::isVimeo($st_item->getLocation())) {
1815  $st_item->setFormat("video/vimeo");
1816  $par = ilExternalMediaAnalyzer::extractVimeoParameters($st_item->getLocation());
1817  $meta = ilExternalMediaAnalyzer::getVimeoMetadata($par["id"]);
1818  $this->setTitle($meta["title"] ?? "");
1819  $description = str_replace("\n", "", $meta["description"] ?? "");
1820  $description = str_replace(["<br>", "<br />"], ["\n", "\n"], $description);
1821  $description = strip_tags($description);
1822  $this->setDescription($description);
1823  $st_item->setDuration((int) ($meta["duration"] ?? 0));
1824  $url = parse_url($meta["thumbnail_url"] ?? "");
1825  $file = basename($url["path"]);
1826  $ext = pathinfo($file, PATHINFO_EXTENSION);
1827  if ($ext == "") {
1828  $ext = "jpg";
1829  }
1830  copy(
1831  $meta["thumbnail_url"],
1832  ilObjMediaObject::_getDirectory($this->getId()) . "/mob_vpreview." .
1833  $ext
1834  );
1835  }
1836  if (ilExternalMediaAnalyzer::isYoutube($st_item->getLocation())) {
1837  $st_item->setFormat("video/youtube");
1838  $par = ilExternalMediaAnalyzer::extractYoutubeParameters($st_item->getLocation());
1839  try {
1841  $this->setTitle($meta["title"] ?? "");
1842  $description = str_replace("\n", "", $meta["description"] ?? "");
1843  } catch (Exception $e) {
1844  $this->setTitle($st_item->getLocation());
1845  $description = "";
1846  }
1847  $description = str_replace(["<br>", "<br />"], ["\n", "\n"], $description);
1848  $description = strip_tags($description);
1849  $this->setDescription($description);
1850  $st_item->setDuration((int) ($meta["duration"] ?? 0));
1851  $thumbnail_url = $meta["thumbnail_url"] ?? "";
1852  $url = parse_url($thumbnail_url);
1853  if ($thumbnail_url !== "") {
1854  $file = basename($url["path"]);
1855  copy(
1856  $meta["thumbnail_url"],
1857  ilObjMediaObject::_getDirectory($this->getId()) . "/mob_vpreview." .
1858  pathinfo($file, PATHINFO_EXTENSION)
1859  );
1860  }
1861  }
1862  }
1863  }
setTitle(string $title)
static isVimeo(string $a_location)
Identify Vimeo links.
static _getDirectory(int $a_mob_id)
Get absolute directory.
getMediaItem(string $a_purpose)
get item for media purpose
$url
Definition: ltiregstart.php:35
static extractVimeoParameters(string $a_location)
Extract Vimeo Parameter.
setDescription(string $description)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilesOfDirectory()

ilObjMediaObject::getFilesOfDirectory ( string  $a_subdir = "")

Get files of directory.

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

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

Referenced by ILIAS\COPage\PC\InteractiveImage\IIMManager\getOverlays().

474  : array {
475  $a_subdir = str_replace("..", "", $a_subdir);
476  $dir = ilObjMediaObject::_getDirectory($this->getId());
477  if ($a_subdir != "") {
478  $dir .= "/" . $a_subdir;
479  }
480 
481  $files = array();
482  if (is_dir($dir)) {
483  $entries = ilFileUtils::getDir($dir);
484  foreach ($entries as $e) {
485  if (is_file($dir . "/" . $e["entry"]) && $e["entry"] != "." && $e["entry"] != "..") {
486  $files[] = $e["entry"];
487  }
488  }
489  }
490  return $files;
491  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLinkedMediaObjects()

ilObjMediaObject::getLinkedMediaObjects ( array  $a_ignore = [])

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

Parameters
int[]$a_ignore array of IDs that should be ignored

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

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

1538  : array {
1539  $linked = array();
1540 
1541  // get linked media objects (map areas)
1542  $med_items = $this->getMediaItems();
1543 
1544  foreach ($med_items as $med_item) {
1545  $int_links = ilMapArea::_getIntLinks($med_item->getId());
1546  foreach ($int_links as $k => $int_link) {
1547  if ($int_link["Type"] == "MediaObject") {
1548  $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
1549  if (ilObject::_exists($l_id)) {
1550  if (!in_array($l_id, $linked) &&
1551  !in_array($l_id, $a_ignore)) {
1552  $linked[] = $l_id;
1553  }
1554  }
1555  }
1556  }
1557  }
1558  //var_dump($linked);
1559  return $linked;
1560  }
static _getIntLinks(int $a_item_id)
get all internal links of a media items map areas
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
+ Here is the call graph for this function:

◆ getMediaItem()

ilObjMediaObject::getMediaItem ( string  $a_purpose)

get item for media purpose

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

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML(), ilMediaObjectsPlayerWrapperGUI\audio(), getExternalMetadata(), ilObjMediaCastGUI\getMediaItem(), ilNewsTimelineItemGUI\getMediaPath(), getVideoPreviewPic(), ilMediaCreationGUI\handleUploadResult(), ilObjMediaPoolGUI\handleUploadResult(), hasPurposeItem(), ilPCImageMapEditorGUI\makeMapWorkCopy(), ilMediaCreationGUI\saveUrl(), ilObjMediaCastGUI\showCastItemObject(), and uploadVideoPreviewPic().

208  : ?ilMediaItem {
209  foreach ($this->media_items as $media_item) {
210  if ($media_item->getPurpose() == $a_purpose) {
211  return $media_item;
212  }
213  }
214  return null;
215  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getMediaItems()

& ilObjMediaObject::getMediaItems ( )

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

References $media_items.

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

198  : array
199  {
200  return $this->media_items;
201  }
+ Here is the caller graph for this function:

◆ getMimeType()

◆ getMultiSrtFiles()

ilObjMediaObject::getMultiSrtFiles ( )

Get all srt files of srt multi upload.

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

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

1774  : array
1775  {
1776  $items = array();
1777 
1779 
1780  $dir = $this->getMultiSrtUploadDir();
1781  $files = ilFileUtils::getDir($dir);
1782  foreach ($files as $k => $i) {
1783  // check directory
1784  if ($i["type"] == "file" && !in_array($k, array(".", ".."))) {
1785  if (pathinfo($k, PATHINFO_EXTENSION) == "srt") {
1786  $lang = "";
1787  if (substr($k, strlen($k) - 7, 1) == "_") {
1788  $lang = substr($k, strlen($k) - 6, 2);
1789  if (!in_array($lang, $lang_codes)) {
1790  $lang = "";
1791  }
1792  }
1793  $items[] = array("filename" => $k, "lang" => $lang);
1794  }
1795  }
1796  }
1797  return $items;
1798  }
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
getMultiSrtUploadDir()
Get directory for multi srt upload.
$lang
Definition: xapiexit.php:26
+ Here is the call graph for this function:

◆ getMultiSrtUploadDir()

ilObjMediaObject::getMultiSrtUploadDir ( )

Get directory for multi srt upload.

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

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

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

1738  : string
1739  {
1740  return ilObjMediaObject::_getDirectory($this->getId()) . "/srt/tmp";
1741  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOriginID()

ilObjMediaObject::getOriginID ( )

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

References $origin_id.

287  : string
288  {
289  return $this->origin_id;
290  }

◆ getParentObjectIdForUsage()

static ilObjMediaObject::getParentObjectIdForUsage ( array  $a_usage,
bool  $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 1023 of file class.ilObjMediaObject.php.

References $DIC, $id, ilObject\$type, ilPCQuestion\_getPageForQuestionId(), SurveyQuestion\_instanciateQuestion(), ilGlossaryTerm\_lookGlossaryID(), ilNewsItem\_lookupContextObjId(), ilLMObject\_lookupContObjID(), ilForum\_lookupObjIdForForumId(), SurveyQuestion\_lookupSurveyObjId(), ilObjTest\_lookupTestObjIdForQuestionId(), ilObject\_lookupType(), ilPortfolioPage\findPortfolioForPage(), ILIAS\Repository\int(), ilExSubmission\lookupExerciseIdForReturnedId(), ilWikiPage\lookupObjIdByPage(), ilPageObject\lookupParentId(), and ilForumPostDraft\newInstanceByDraftId().

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

1026  : ?int {
1027  $cont_type = "";
1028  if (is_int(strpos($a_usage["type"], ":"))) {
1029  $us_arr = explode(":", $a_usage["type"]);
1030  $type = $us_arr[1];
1031  $cont_type = $us_arr[0];
1032  } else {
1033  $type = $a_usage["type"];
1034  }
1035 
1036  $id = $a_usage["id"];
1037  $obj_id = null;
1038 
1039  switch ($type) {
1040  // RTE / tiny mce
1041  case "html":
1042 
1043  switch ($cont_type) {
1044  case "qpl":
1045  // Question Pool *Question* Text (Test)
1046  global $DIC;
1047  $qinfo = $DIC->testQuestionPool()->questionInfo()->getQuestionInfo($id);
1048  if (isset($qinfo["original_id"]) && $qinfo["original_id"] > 0) {
1049  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1050  } else {
1051  $obj_id = (int) ($qinfo["obj_fi"] ?? 0); // usage in pool
1052  }
1053  break;
1054 
1055  case "spl":
1056  // Question Pool *Question* Text (Survey)
1058  if ($quest) {
1059  $parent_id = $quest->getObjId();
1060 
1061  // pool question copy - find survey, do not use pool itself
1062  if ($quest->getOriginalId() &&
1063  ilObject::_lookupType($parent_id) == "spl") {
1065  }
1066  // original question (in pool or survey)
1067  else {
1068  $obj_id = (int) $parent_id;
1069  }
1070 
1071  unset($quest);
1072  }
1073  break;
1074 
1075  case "exca":
1076  // Exercise assignment
1077  $returned_pk = $a_usage['id'];
1078  // #15995 - we are just checking against exercise object
1079  $obj_id = ilExSubmission::lookupExerciseIdForReturnedId($returned_pk);
1080  break;
1081 
1082  case "frm":
1083  // Forum
1084  $post_pk = $a_usage['id'];
1085  $oPost = new ilForumPost($post_pk);
1086  $frm_pk = $oPost->getForumId();
1087  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1088  break;
1089 
1090 
1091  case "frm~d":
1092  $draft_id = $a_usage['id'];
1093  $oDraft = ilForumPostDraft::newInstanceByDraftId($draft_id);
1094 
1095  $frm_pk = $oDraft->getForumId();
1096  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1097  break;
1098  case "frm~h":
1099  $history_id = $a_usage['id'];
1100  $oHistoryDraft = new ilForumDraftsHistory($history_id);
1101  $oDraft = ilForumPostDraft::newInstanceByDraftId($oHistoryDraft->getDraftId());
1102 
1103  $frm_pk = $oDraft->getForumId();
1104  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1105  break;
1106  // temporary items (per user)
1107  case "frm~":
1108  case "exca~":
1109  $obj_id = (int) $a_usage['id'];
1110  break;
1111 
1112  // "old" category pages
1113  case "cat":
1114  // InfoScreen Text
1115  case "tst":
1116  case "svy":
1117  // data collection
1118  case "dcl":
1119  $obj_id = (int) $id;
1120  break;
1121  }
1122  break;
1123 
1124  // page editor
1125  case "pg":
1126 
1127  switch ($cont_type) {
1128  // question feedback // parent obj id is q id
1129  case "qfbg":
1130  case "qpl":
1131 
1132  if ($cont_type == "qfbg") {
1134  }
1135 
1136  // Question Pool Question Pages
1137  global $DIC;
1138  $qinfo = $DIC->testQuestionPool()->questionInfo()->getQuestionInfo($id);
1139  if ($qinfo["original_id"] > 0) {
1140  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1141  } else {
1142  $obj_id = $qinfo["obj_fi"]; // usage in pool
1143  }
1144  if ($obj_id == 0) { // this is the case, if question is in learning module -> get lm id
1145  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "lm");
1146  if ($pinfo && $pinfo["parent_type"] == "lm") {
1147  $obj_id = ilLMObject::_lookupContObjID($pinfo["page_id"]);
1148  }
1149  }
1150  break;
1151 
1152  case "lm":
1153  // learning modules
1154  $obj_id = ilLMObject::_lookupContObjID($id);
1155  break;
1156 
1157  case "term":
1158  $term_id = $id;
1159  $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
1160  break;
1161 
1162  case "wpg":
1163  // wiki page
1164  $obj_id = (int) ilWikiPage::lookupObjIdByPage($id);
1165  break;
1166 
1167  case "sahs":
1168  // sahs page
1169  // can this implementation be used for other content types, too?
1170  $obj_id = ilPageObject::lookupParentId($id, 'sahs');
1171  break;
1172 
1173  case "prtf":
1174  // portfolio
1176  break;
1177 
1178  case "prtt":
1179  // portfolio template
1181  break;
1182 
1183 
1184  case "impr":
1185  // imprint page - always id 1
1186  // fallthrough
1187 
1188  case "copa":
1189  case "cstr":
1190  $obj_id = $id;
1191  break;
1192 
1193  default:
1194  $obj_id = ilPageObject::lookupParentId($id, $cont_type);
1195  break;
1196  }
1197  break;
1198 
1199  // Media Pool
1200  case "mep":
1201  $obj_id = $id;
1202  break;
1203 
1204  // News Context Object (e.g. MediaCast)
1205  case "news":
1207  break;
1208  }
1209 
1210  return $obj_id;
1211  }
string $type
static _getPageForQuestionId(int $a_q_id, string $a_parent_type="")
static _lookupTestObjIdForQuestionId(int $q_id)
Get test Object ID for question ID.
Class ilForumDraftHistory.
global $DIC
Definition: feed.php:28
static _lookupObjIdForForumId(int $a_for_id)
static lookupExerciseIdForReturnedId(int $a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
static lookupParentId(int $a_id, string $a_type)
static _lookupSurveyObjId(int $a_question_id)
static lookupObjIdByPage(int $a_page_id)
returns the wiki/object id to a given page id
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static findPortfolioForPage(int $a_page_id)
Get portfolio id of page id.
static _lookupContObjID(int $a_id)
get learning module id for lm object
static newInstanceByDraftId(int $draft_id)
static _lookupType(int $id, bool $reference=false)
static _instanciateQuestion(int $question_id)
Get question object.
static _lookupContextObjId(int $a_news_id)
Context Object ID.
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSrtFiles()

ilObjMediaObject::getSrtFiles ( )

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

References _getDirectory(), ilFileUtils\getDir(), and ilObject\getId().

Referenced by ilMobSubtitleTableGUI\__construct(), and getXML().

1459  : array
1460  {
1461  $srt_dir = ilObjMediaObject::_getDirectory($this->getId()) . "/srt";
1462 
1463  if (!is_dir($srt_dir)) {
1464  return array();
1465  }
1466 
1467  $items = ilFileUtils::getDir($srt_dir);
1468 
1469  $srt_files = array();
1470  foreach ($items as $i) {
1471  if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file") {
1472  $name = explode(".", $i["entry"]);
1473  if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_") {
1474  $srt_files[] = array("file" => $i["entry"],
1475  "full_path" => "srt/" . $i["entry"], "language" => substr($name[0], 9, 2));
1476  }
1477  }
1478  }
1479 
1480  return $srt_files;
1481  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbnailPath()

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

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

References _getThumbnailDirectory().

Referenced by ilPCIIMOverlaysTableGUI\fillRow().

1516  : string {
1517  $t_dir = ilObjMediaObject::_getThumbnailDirectory($a_mob_id);
1518  return $t_dir . "/" . $a_thumbname;
1519  }
static _getThumbnailDirectory(int $a_mob_id, string $a_mode="filesystem")
get directory for files of media object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUsages()

ilObjMediaObject::getUsages ( bool  $a_include_history = true)

get all usages of current media object

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

References ilObject\getId().

Referenced by delete().

923  : array {
924  return self::lookupUsages($this->getId(), $a_include_history);
925  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVideoPreviewPic()

ilObjMediaObject::getVideoPreviewPic ( bool  $a_filename_only = false)

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

References _getDirectory(), ilObject\getId(), and getMediaItem().

Referenced by getXML(), and uploadVideoPreviewPic().

1699  : string {
1700  $dir = ilObjMediaObject::_getDirectory($this->getId());
1701  $ppics = array("mob_vpreview.jpg",
1702  "mob_vpreview.jpeg",
1703  "mob_vpreview.png");
1704  $med = $this->getMediaItem("Standard");
1705  if ($med && $med->getFormat() === "image/svg+xml" && $med->getLocationType() === "LocalFile") {
1706  $ppics[] = $med->getLocation();
1707  }
1708  foreach ($ppics as $p) {
1709  if (is_file($dir . "/" . $p)) {
1710  if ($a_filename_only) {
1711  return $p;
1712  } else {
1713  return $dir . "/" . $p;
1714  }
1715  }
1716  }
1717  return "";
1718  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
getMediaItem(string $a_purpose)
get item for media purpose
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getXML()

ilObjMediaObject::getXML ( int  $a_mode = IL_MODE_FULL,
int  $a_inst = 0,
bool  $a_sign_locals = false 
)

get MediaObject XLM Tag

Parameters
int$a_modeIL_MODE_ALIAS | IL_MODE_OUTPUT | IL_MODE_FULL
int$a_inst
bool$a_sign_locals
Returns
string
Exceptions
ilWACException

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

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

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

506  : string {
507  $ilUser = $this->user;
508  $xml = "";
509  // TODO: full implementation of all parameters
510  //echo "-".$a_mode."-";
511  switch ($a_mode) {
512  case IL_MODE_ALIAS:
513  $xml = "<MediaObject>";
514  $xml .= "<MediaAlias OriginId=\"il__mob_" . $this->getId() . "\"/>";
515  $media_items = $this->getMediaItems();
516  for ($i = 0; $i < count($media_items); $i++) {
517  $item = $media_items[$i];
518  $xml .= "<MediaAliasItem Purpose=\"" . $item->getPurpose() . "\">";
519 
520  // Layout
521  $width = ($item->getWidth() != "")
522  ? "Width=\"" . $item->getWidth() . "\""
523  : "";
524  $height = ($item->getHeight() != "")
525  ? "Height=\"" . $item->getHeight() . "\""
526  : "";
527  $halign = ($item->getHAlign() != "")
528  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
529  : "";
530  $xml .= "<Layout $width $height $halign />";
531 
532  // Caption
533  if ($item->getCaption() != "") {
534  $xml .= "<Caption Align=\"bottom\">" .
535  $this->escapeProperty($item->getCaption()) . "</Caption>";
536  }
537 
538  // Text Representation
539  if ($item->getTextRepresentation() != "") {
540  $xml .= "<TextRepresentation>" .
541  $this->escapeProperty($item->getTextRepresentation()) . "</TextRepresentation>";
542  }
543 
544  // Parameter
545  $parameters = $item->getParameters();
546  foreach ($parameters as $name => $value) {
547  $xml .= "<Parameter Name=\"$name\" Value=\"" . $this->escapeProperty($value) . "\"/>";
548  }
549  $xml .= $item->getMapAreasXML();
550  $xml .= "</MediaAliasItem>";
551  }
552  break;
553 
554  // for output we need technical sections of meta data
555  case IL_MODE_OUTPUT:
556 
557  // get first technical section
558  // $meta = $this->getMetaData();
559  $xml = "<MediaObject Id=\"il__mob_" . $this->getId() . "\">";
560 
561  $media_items = $this->getMediaItems();
562  for ($i = 0; $i < count($media_items); $i++) {
563  $item = $media_items[$i];
564 
565  $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">";
566 
567  if ($a_sign_locals && $item->getLocationType() == "LocalFile") {
568  $location = ilWACSignedPath::signFile($this->getDataDirectory() . "/" . $item->getLocation());
569  $location = substr($location, strrpos($location, "/") + 1);
570  } else {
571  $location = $item->getLocation();
572  if ($item->getLocationType() != "LocalFile") { //#25941
573  $location = ilUtil::secureUrl($location); //#23518
574  }
575  }
576 
577  $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" .
578  $this->handleAmps($location) . "</Location>";
579 
580  // Format
581  $xml .= "<Format>" . $item->getFormat() . "</Format>";
582 
583  // Layout
584  $width = ($item->getWidth() != "")
585  ? "Width=\"" . $item->getWidth() . "\""
586  : "";
587  $height = ($item->getHeight() != "")
588  ? "Height=\"" . $item->getHeight() . "\""
589  : "";
590  $halign = ($item->getHAlign() != "")
591  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
592  : "";
593  $xml .= "<Layout $width $height $halign />";
594 
595  // Caption
596  if ($item->getCaption() != "") {
597  $xml .= "<Caption Align=\"bottom\">" .
598  $this->escapeProperty($item->getCaption()) . "</Caption>";
599  }
600 
601  // Text Representation
602  if ($item->getTextRepresentation() != "") {
603  $xml .= "<TextRepresentation>" .
604  $this->escapeProperty($item->getTextRepresentation()) . "</TextRepresentation>";
605  }
606 
607  // Title
608  if ($this->getTitle() != "") {
609  $xml .= "<Title>" .
610  $this->escapeProperty($this->getTitle()) . "</Title>";
611  }
612 
613  // Parameter
614  $parameters = $item->getParameters();
615  foreach ($parameters as $name => $value) {
616  $xml .= "<Parameter Name=\"$name\" Value=\"" . $this->escapeProperty($value) . "\"/>";
617  }
618  $xml .= $item->getMapAreasXML();
619 
620  // Subtitles
621  if ($item->getPurpose() == "Standard") {
622  $srts = $this->getSrtFiles();
623  foreach ($srts as $srt) {
624  $def = "";
625  $meta_lang = "";
626  if ($ilUser->getLanguage() != $meta_lang &&
627  $ilUser->getLanguage() == $srt["language"]) {
628  $def = ' Default="true" ';
629  }
630  $xml .= "<Subtitle File=\"" . $srt["full_path"] .
631  "\" Language=\"" . $srt["language"] . "\" " . $def . "/>";
632  }
633  }
634  if ($this->getVideoPreviewPic(true)) {
635  $xml .= "<PreviewPic File=\"" . $this->getVideoPreviewPic(true) .
636  "\" />";
637  }
638  $xml .= "</MediaItem>";
639  }
640  break;
641 
642  // full xml for export
643  case IL_MODE_FULL:
644 
645  // $meta = $this->getMetaData();
646  $xml = "<MediaObject>";
647 
648  // meta data
649  $md2xml = new ilMD2XML(0, $this->getId(), $this->getType());
650  $md2xml->setExportMode(true);
651  $md2xml->startExport();
652  $xml .= $md2xml->getXML();
653 
654  $media_items = $this->getMediaItems();
655  for ($i = 0; $i < count($media_items); $i++) {
656  $item = $media_items[$i];
657 
658  // highlight mode
659  $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">";
660 
661  // Location
662  $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" .
663  $this->handleAmps($item->getLocation()) . "</Location>";
664 
665  // Format
666  $xml .= "<Format>" . $item->getFormat() . "</Format>";
667 
668  // Layout
669  $width = ($item->getWidth() != "")
670  ? "Width=\"" . $item->getWidth() . "\""
671  : "";
672  $height = ($item->getHeight() != "")
673  ? "Height=\"" . $item->getHeight() . "\""
674  : "";
675  $halign = ($item->getHAlign() != "")
676  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
677  : "";
678  $xml .= "<Layout $width $height $halign />";
679 
680  // Caption
681  if ($item->getCaption() != "") {
682  $xml .= "<Caption Align=\"bottom\">" .
683  str_replace("&", "&amp;", $item->getCaption()) . "</Caption>";
684  }
685 
686  // Text Representation
687  if ($item->getTextRepresentation() != "") {
688  $xml .= "<TextRepresentation>" .
689  str_replace("&", "&amp;", $item->getTextRepresentation()) . "</TextRepresentation>";
690  }
691 
692  // Parameter
693  $parameters = $item->getParameters();
694  foreach ($parameters as $name => $value) {
695  $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
696  }
697  $xml .= $item->getMapAreasXML(true, $a_inst);
698  $xml .= "</MediaItem>";
699  }
700  break;
701  }
702  $xml .= "</MediaObject>";
703  return $xml;
704  }
const IL_MODE_FULL
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static secureUrl(string $url)
escapeProperty(string $a_value)
Escape property (e.g.
getVideoPreviewPic(bool $a_filename_only=false)
const IL_MODE_ALIAS
handleAmps(string $a_str)
Replace "&" (if not an "&amp;") with "&amp;".
static signFile(string $path_to_file)
const IL_MODE_OUTPUT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAmps()

ilObjMediaObject::handleAmps ( string  $a_str)

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

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

Referenced by getXML().

721  : string {
722  $a_str = str_replace("&amp;", "&", $a_str);
723  $a_str = str_replace("&", "&amp;", $a_str);
724  return $a_str;
725  }
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected
Deprecated:

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

368  : void {
369  }

◆ hasFullscreenItem()

ilObjMediaObject::hasFullscreenItem ( )

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

References hasPurposeItem().

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML().

242  : bool
243  {
244  return $this->hasPurposeItem("Fullscreen");
245  }
hasPurposeItem(string $purpose)
returns whether object has media item with specific purpose
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPurposeItem()

ilObjMediaObject::hasPurposeItem ( string  $purpose)

returns whether object has media item with specific purpose

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

References getMediaItem().

Referenced by hasFullscreenItem().

250  : bool
251  {
252  if (is_object($this->getMediaItem($purpose))) {
253  return true;
254  } else {
255  return false;
256  }
257  }
getMediaItem(string $a_purpose)
get item for media purpose
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAlias()

ilObjMediaObject::isAlias ( )

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

References $is_alias.

274  : bool
275  {
276  return $this->is_alias;
277  }

◆ isTypeAllowed()

static ilObjMediaObject::isTypeAllowed ( string  $a_type)
static

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

References $DIC.

Referenced by ilPageObjectGUI\displayMedia(), ilCOPageHTMLExport\exportHTMLMOB(), ilLMPresentationGUI\ilMedia(), ilGlossaryPresentationGUI\media(), ilObjMediaPoolGUI\showMedia(), ilPageObjectGUI\showMediaFullscreen(), and ilPageObjectGUI\showPage().

1564  : bool {
1565  global $DIC;
1566  return in_array($a_type, iterator_to_array(
1567  $DIC->mediaObjects()->internal()->domain()->mediaType()->getAllowedSuffixes()
1568  ), true);
1569  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ lookupUsages()

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

Lookup usages of media object.

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

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

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

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

935  : array {
936  global $DIC;
937 
938  $ilDB = $DIC->database();
939 
940  $hist_str = "";
941  if ($a_include_history) {
942  $hist_str = ", usage_hist_nr";
943  }
944 
945  // get usages in pages
946  $q = "SELECT DISTINCT usage_type, usage_id, usage_lang" . $hist_str . " FROM mob_usage WHERE id = " .
947  $ilDB->quote($a_id, "integer");
948 
949  if (!$a_include_history) {
950  $q .= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
951  }
952 
953  $us_set = $ilDB->query($q);
954  $ret = array();
955  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
956  $ut = "";
957  $ct = 0;
958  if (is_int(strpos($us_rec["usage_type"], ":"))) {
959  $us_arr = explode(":", $us_rec["usage_type"]);
960  $ut = $us_arr[1];
961  $ct = $us_arr[0];
962  }
963 
964  // check whether page exists
965  $skip = false;
966  if ($ut == "pg") {
967  if (!ilPageObject::_exists($ct, $us_rec["usage_id"])) {
968  $skip = true;
969  }
970  }
971 
972  if (!$skip) {
973  $ret[] = array(
974  "type" => $us_rec["usage_type"],
975  "id" => $us_rec["usage_id"],
976  "lang" => $us_rec["usage_lang"],
977  "hist_nr" => ($us_rec["usage_hist_nr"] ?? 0)
978  );
979  }
980  }
981 
982  // get usages in media pools
983  $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = " .
984  $ilDB->quote($a_id, "integer") . " AND mep_item.type = " . $ilDB->quote("mob", "text");
985  $us_set = $ilDB->query($q);
986  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
987  $ret[] = array("type" => "mep",
988  "id" => $us_rec["mep_id"]);
989  }
990 
991  // get usages in news items (media casts)
992  $news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
993  foreach ($news_usages as $nu) {
994  $ret[] = $nu;
995  }
996 
997 
998  // get usages in map areas
999  $q = "SELECT DISTINCT mob_id FROM media_item it, map_area area " .
1000  " WHERE area.item_id = it.id " .
1001  " AND area.link_type = " . $ilDB->quote("int", "text") . " " .
1002  " AND area.target = " . $ilDB->quote("il__mob_" . $a_id, "text");
1003  $us_set = $ilDB->query($q);
1004  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
1005  $ret[] = array("type" => "map",
1006  "id" => $us_rec["mob_id"]);
1007  }
1008 
1009  // get usages in personal clipboards
1010  $users = ilObjUser::_getUsersForClipboadObject("mob", $a_id);
1011  foreach ($users as $user) {
1012  $ret[] = array("type" => "clip",
1013  "id" => $user);
1014  }
1015 
1016  return $ret;
1017  }
global $DIC
Definition: feed.php:28
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static _getUsersForClipboadObject(string $a_type, int $a_id)
get all users, that have a certain object within their clipboard
$q
Definition: shib_logout.php:21
static _lookupMediaObjectUsages(int $a_mob_id)
Lookup media object usage(s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeThumbnail()

ilObjMediaObject::makeThumbnail ( string  $a_file,
string  $a_thumbname 
)

Make thumbnail.

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

References _getDirectory(), _getThumbnailDirectory(), ilObject\getId(), ilMediaImageUtil\getImageSize(), and getMimeType().

Referenced by ILIAS\COPage\PC\InteractiveImage\IIMManager\handleOverlayUpload().

1489  : void {
1490  $size = self::DEFAULT_PREVIEW_SIZE;
1491  $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1493  $file = $m_dir . "/" . $a_file;
1494 
1495  $mime = ilObjMediaObject::getMimeType($file);
1496  $wh = ilMediaImageUtil::getImageSize($file);
1497 
1498  // see #8602
1499  if ($size > (int) $wh[0] && $size > $wh[1]) {
1500  $size = min($wh[0], $wh[1]);
1501  }
1502 
1503  $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1505  self::_createThumbnailDirectory($this->getId());
1506  $this->image_converter->croppedSquare(
1507  $m_dir . "/" . $a_file,
1508  $t_dir . "/" . $a_thumbname,
1509  $size
1510  );
1511  }
static _getThumbnailDirectory(int $a_mob_id, string $a_mode="filesystem")
get directory for files of media object
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
static getImageSize(string $a_location)
Get image size from location.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyExportIdentifier()

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

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

References ilUtil\insertInstIntoID().

757  : string {
758  if ($a_tag == "Identifier" && $a_param == "Entry") {
759  $a_value = ilUtil::insertInstIntoID($a_value);
760  }
761 
762  return $a_value;
763  }
static insertInstIntoID(string $a_value)
inserts installation id into ILIAS id
+ Here is the call graph for this function:

◆ read()

ilObjMediaObject::read ( )
Exceptions
ilObjectNotFoundException
ilObjectTypeMismatchException

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

References ilMediaItem\_getMediaItemsOfMOb().

263  : void
264  {
265  parent::read();
267  }
static _getMediaItemsOfMOb(ilObjMediaObject $a_mob)
Read media items into(!) media object (static)
+ Here is the call graph for this function:

◆ removeAdditionalFile()

ilObjMediaObject::removeAdditionalFile ( string  $a_file)

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

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

Referenced by uploadVideoPreviewPic().

1523  : void {
1524  $file = str_replace("..", "", $a_file);
1525  $file = ilObjMediaObject::_getDirectory($this->getId()) . "/" . $file;
1526  if (is_file($file)) {
1527  unlink($file);
1528  }
1529  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllMediaItems()

ilObjMediaObject::removeAllMediaItems ( )

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

237  : void
238  {
239  $this->media_items = array();
240  }

◆ removeMediaItem()

ilObjMediaObject::removeMediaItem ( string  $a_purpose)

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

References ILIAS\LTI\ToolProvider\$key, $media_items, and ilObject\getId().

219  : void {
220  foreach ($this->media_items as $key => $media_item) {
221  if ($media_item->getPurpose() == $a_purpose) {
222  unset($this->media_items[$key]);
223  }
224  }
225  // update numbers and keys
226  $i = 1;
227  $media_items = array();
228  foreach ($this->media_items as $media_item) {
229  $media_items [$i] = $media_item;
230  $media_item->setMobId($this->getId());
231  $media_item->setNr($i);
232  $i++;
233  }
234  $this->media_items = $media_items;
235  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ renameExecutables()

static ilObjMediaObject::renameExecutables ( string  $a_dir)
static

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

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

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

1802  : void {
1804  if (!self::isTypeAllowed("html")) {
1805  ilFileUtils::rRenameSuffix($a_dir, "html", "sec"); // see #20187
1806  }
1807  }
static rRenameSuffix(string $a_dir, string $a_old_suffix, string $a_new_suffix)
Renames all files with certain suffix and gives them a new suffix.
static renameExecutables(string $a_dir)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAlias()

ilObjMediaObject::setAlias ( bool  $a_is_alias)

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

269  : void
270  {
271  $this->is_alias = $a_is_alias;
272  }

◆ setContainsIntLink()

ilObjMediaObject::setContainsIntLink ( bool  $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)

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

776  : void {
777  $this->contains_int_link = $a_contains_link;
778  }

◆ setOriginID()

ilObjMediaObject::setOriginID ( string  $a_id)
Deprecated:
(seems to be obsolete)

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

282  : void
283  {
284  $this->origin_id = $a_id;
285  }

◆ update()

ilObjMediaObject::update ( bool  $a_upload = false)

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

References ilObject\$app_event_handler, ILIAS\LTI\ToolProvider\$key, ilMediaItem\deleteAllItemsOfMob(), ilObject\getId(), getMediaItems(), ilAppEventHandler\raise(), and ilObject\updateMetaData().

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

324  : bool
325  {
326  parent::update();
327 
328  if (!$a_upload) {
329  $this->updateMetaData();
330  }
331 
332  // iterate all items
333  $media_items = $this->getMediaItems();
335 
336  $j = 1;
337  foreach ($media_items as $key => $val) {
338  $item = $val;
339  if (is_object($item)) {
340  $item->setMobId($this->getId());
341  $item->setNr($j);
342  if ($item->getLocationType() == "Reference") {
343  $item->extractUrlParameters();
344  }
345  $item->create();
346  $j++;
347  }
348  }
349 
350  self::handleQuotaUpdate($this);
351  $ilAppEventHandler = $this->app_event_handler;
352  $ilAppEventHandler->raise(
353  'Services/MediaObjects',
354  'update',
355  array('object' => $this,
356  'obj_type' => 'mob',
357  'obj_id' => $this->getId())
358  );
359 
360  return true;
361  }
static deleteAllItemsOfMob(int $a_mob_id)
ilAppEventHandler $app_event_handler
string $key
Consumer key/client ID value.
Definition: System.php:193
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadAdditionalFile()

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

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

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

References _getDirectory(), ilObject\getId(), ilFileUtils\makeDirParents(), ilFileUtils\moveUploadedFile(), ilFileUtils\rename(), and ilMediaSvgSanitizer\sanitizeDir().

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

1415  : void {
1416  $a_subdir = str_replace("..", "", $a_subdir);
1417  $dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
1418  if ($a_subdir != "") {
1419  $dir .= "/" . $a_subdir;
1420  }
1422  if ($a_mode == "rename") {
1423  ilFileUtils::rename($tmp_name, $dir . "/" . $a_name);
1424  } else {
1425  ilFileUtils::moveUploadedFile($tmp_name, $a_name, $dir . "/" . $a_name, true, $a_mode);
1426  }
1427  self::renameExecutables($mob_dir);
1428  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1429  }
static sanitizeDir(string $a_path)
Sanitize directory recursively.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static _getDirectory(int $a_mob_id)
Get absolute directory.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static rename(string $a_source, string $a_target)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadMultipleSubtitleFile()

ilObjMediaObject::uploadMultipleSubtitleFile ( array  $a_file)

Upload multi srt file.

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

References ilObject\$lng, ilFileUtils\delDir(), getMultiSrtUploadDir(), ilFileUtils\makeDirParents(), ilFileUtils\moveUploadedFile(), and ilLanguage\txt().

1749  : void {
1750  $lng = $this->lng;
1751 
1752  if (!is_file($a_file["tmp_name"])) {
1753  throw new ilMediaObjectsException($lng->txt("mob_file_could_not_be_uploaded"));
1754  }
1755 
1756  $dir = $this->getMultiSrtUploadDir();
1757  ilFileUtils::delDir($dir, true);
1759  ilFileUtils::moveUploadedFile($a_file["tmp_name"], "multi_srt.zip", $dir . "/" . "multi_srt.zip");
1760  $this->domain->resources()->zip()->unzipFile($dir . "/multi_srt.zip");
1761  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
ilLanguage $lng
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
getMultiSrtUploadDir()
Get directory for multi srt upload.
+ Here is the call graph for this function:

◆ uploadSrtFile()

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

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

References uploadAdditionalFile().

1451  : bool {
1452  if (is_file($a_tmp_name) && $a_language != "") {
1453  $this->uploadAdditionalFile("subtitle_" . $a_language . ".srt", $a_tmp_name, "srt", $a_mode);
1454  return true;
1455  }
1456  return false;
1457  }
uploadAdditionalFile(string $a_name, string $tmp_name, string $a_subdir="", string $a_mode="move_uploaded")
Create new media object and update page in db and return new media object.
+ Here is the call graph for this function:

◆ uploadVideoPreviewPic()

ilObjMediaObject::uploadVideoPreviewPic ( array  $a_prevpic)

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

References Vendor\Package\$e, $GLOBALS, $message, _getDirectory(), ilFFmpeg\extractImage(), ilObject\getId(), ilFFmpeg\getLastReturnValues(), getMediaItem(), getVideoPreviewPic(), removeAdditionalFile(), uploadAdditionalFile(), and ilLogLevel\WARNING.

1608  : void {
1609  // remove old one
1610  if ($this->getVideoPreviewPic(true) != "") {
1611  $this->removeAdditionalFile($this->getVideoPreviewPic(true));
1612  }
1613 
1614  $pi = pathinfo($a_prevpic["name"]);
1615  $ext = $pi["extension"];
1616  if (in_array($ext, array("jpg", "jpeg", "png"))) {
1617  $this->uploadAdditionalFile("mob_vpreview." . $ext, $a_prevpic["tmp_name"]);
1618  }
1619  }
getVideoPreviewPic(bool $a_filename_only=false)
uploadAdditionalFile(string $a_name, string $tmp_name, string $a_subdir="", string $a_mode="move_uploaded")
Create new media object and update page in db and return new media object.
removeAdditionalFile(string $a_file)
+ Here is the call graph for this function:

Field Documentation

◆ $contains_int_link

bool ilObjMediaObject::$contains_int_link

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

Referenced by containsIntLink().

◆ $domain

InternalDomainService ilObjMediaObject::$domain
protected

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

◆ $image_converter

LegacyImages ilObjMediaObject::$image_converter
private

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

◆ $is_alias

bool ilObjMediaObject::$is_alias

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

Referenced by isAlias().

◆ $media_items

array ilObjMediaObject::$media_items

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

Referenced by getMediaItems(), and removeMediaItem().

◆ $origin_id

string ilObjMediaObject::$origin_id

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

Referenced by getOriginID().

◆ $user

ilObjUser ilObjMediaObject::$user
protected

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

Referenced by beforeCreateMetaData(), and getXML().

◆ DEFAULT_PREVIEW_SIZE

const ilObjMediaObject::DEFAULT_PREVIEW_SIZE = 80
private

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


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