ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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, int $from_mob_id=0)
 
 update (bool $a_upload=false)
 
 createDirectory ()
 Create file directory of media object. More...
 
 getFilesOfDirectory (string $dir_path="")
 
 getXML (int $a_mode=IL_MODE_FULL, int $a_inst=0, bool $a_sign_locals=false, bool $offline=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 ()
 
 addMediaItemFromLegacyUpload (string $purpose, string $tmp_name, string $name, int $resize_width=0, int $resize_height=0, bool $constrain_proportions=true, bool $deduce_size=false)
 
 addMediaItemFromUpload (string $purpose, UploadResult $result, string $upload_hash="",)
 
 addMediaItemFromLocalFile (string $purpose, string $tmp_name, string $name)
 
 replaceMediaItemFromUpload (string $purpose, UploadResult $result, string $upload_hash="",)
 
 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 (UploadResult $result, string $subdir)
 
 uploadSrtFile (string $a_tmp_name, string $a_language, string $a_mode="move_uploaded")
 
 getSrtFiles ()
 
 makeThumbnail (string $source, string $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 ()
 
 getStandardSrc ()
 
 getFullscreenSrc ()
 
- 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 _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 _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)
 
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 getIconForType (string $type)
 
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

const DEFAULT_PREVIEW_SIZE = 80
 
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...
 
 getLocationSrc (string $purpose)
 
- 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

ThumbsManager $thumbs
 
MediaObjectManager $manager
 
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
 
LOMServices $lom_services
 
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

LegacyImages $image_converter
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaObject::__construct ( int  $a_id = 0)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

51  {
52  global $DIC;
53 
54  $this->user = $DIC->user();
55  $this->app_event_handler = $DIC["ilAppEventHandler"];
56  $this->lng = $DIC->language();
57  $this->is_alias = false;
58  $this->media_items = array();
59  $this->contains_int_link = false;
60  $this->type = "mob";
61  parent::__construct($a_id, false);
62  $this->image_converter = $DIC->fileConverters()->legacyImages();
63  $this->domain = $DIC->mediaObjects()->internal()->domain();
64  $this->manager = $this->domain->mediaObject();
65  $this->thumbs = $this->domain->thumbs();
66  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllUsages()

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

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

References $DIC, $ilDB, and $q.

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

775  : void {
776  global $DIC;
777 
778  $ilDB = $DIC->database();
779 
780  $and_hist = "";
781  if (!is_null($a_usage_hist_nr)) {
782  $and_hist = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
783  }
784 
785  $mob_ids = array();
786  $set = $ilDB->query("SELECT id FROM mob_usage" .
787  " WHERE usage_type = " . $ilDB->quote($a_type, "text") .
788  " AND usage_id = " . $ilDB->quote($a_id, "integer") .
789  " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
790  $and_hist);
791  while ($row = $ilDB->fetchAssoc($set)) {
792  $mob_ids[] = $row["id"];
793  }
794 
795  $q = "DELETE FROM mob_usage WHERE usage_type = " .
796  $ilDB->quote($a_type, "text") .
797  " AND usage_id= " . $ilDB->quote($a_id, "integer") .
798  " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
799  $and_hist;
800  $ilDB->manipulate($q);
801 
802  foreach ($mob_ids as $mob_id) {
803  self::handleQuotaUpdate(new self($mob_id));
804  }
805  }
global $DIC
Definition: shib_login.php:22
$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 1240 of file class.ilObjMediaObject.php.

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

Referenced by ilObjMediaObjectGUI\savePropertiesObject().

1249  : array {
1250  global $DIC;
1251 
1252  $lng = $DIC->language();
1253  $size = [];
1254  $wr = 0;
1255  $hr = 0;
1256  $width = 0;
1257  $height = 0;
1258 
1259  // determine width and height of known image types
1260  //$width = 640;
1261  //$height = 360;
1262  $info = "";
1263 
1264  /*
1265  if ($a_format == "audio/mpeg") {
1266  $width = 300;
1267  $height = 20;
1268  }*/
1269 
1270  if (ilUtil::deducibleSize($a_format)) {
1271  if ($a_type == "File") {
1272  $size = ilMediaImageUtil::getImageSize($a_file);
1273  } else {
1274  $size = ilMediaImageUtil::getImageSize($a_reference);
1275  }
1276  }
1277 
1278  if (!isset($size[0])) {
1279  $size[0] = 0;
1280  }
1281  if (!isset($size[1])) {
1282  $size[1] = 0;
1283  }
1284 
1285  if ($a_use_original) {
1286  if ($size[0] > 0 && $size[1] > 0) {
1287  //$width = $size[0];
1288  //$height = $size[1];
1289  $width = "";
1290  $height = "";
1291  } else {
1292  $info = $lng->txt("cont_could_not_determine_resource_size");
1293  }
1294  } else {
1295  $w = $a_user_width;
1296  $h = $a_user_height;
1297  $width = $w;
1298  $height = $h;
1299  //echo "<br>C-$width-$height-";
1300  if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions) {
1301  if ($size[0] > 0 && $size[1] > 0) {
1302  if ($w > 0) {
1303  $wr = $size[0] / $w;
1304  }
1305  if ($h > 0) {
1306  $hr = $size[1] / $h;
1307  }
1308  //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1309  //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1310  $r = max($wr, $hr);
1311  if ($r > 0) {
1312  $width = (int) round($size[0] / $r);
1313  $height = (int) round($size[1] / $r);
1314  }
1315  }
1316  }
1317  //echo "<br>D-$width-$height-";
1318  }
1319  //echo "<br>E-$width-$height-";
1320 
1321  if ($width == 0 && is_null($a_user_width)) {
1322  $width = "";
1323  }
1324  if ($height == 0 && is_null($a_user_height)) {
1325  $height = "";
1326  }
1327  return array("width" => $width, "height" => $height, "info" => $info);
1328  }
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...
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
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 68 of file class.ilObjMediaObject.php.

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

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

72  : bool {
73  if (is_int(strpos($id, "_"))) {
75  }
76 
77  if (parent::_exists($id) && ilObject::_lookupType($id) === "mob") {
78  return true;
79  }
80  return false;
81  }
$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()

◆ _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 810 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(), assQuestion\cloneXHTMLMediaObjectsOfQuestion(), ilCOPageHTMLExport\collectPageElements(), SurveyQuestion\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(), ILIAS\Test\ExportImport\Export\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(), assOrderingHorizontal\toJSON(), assTextSubset\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assLongMenu\toJSON(), assKprimChoice\toJSON(), assErrorText\toJSON(), assOrderingQuestion\toJSON(), assMatchingQuestion\toJSON(), assClozeTest\toJSON(), ilObjForumGUI\updateDraftObject(), and ilObjForumGUI\viewThreadObject().

815  : array {
816  global $DIC;
817 
818  $ilDB = $DIC->database();
819 
820  $lstr = "";
821  if ($a_lang != "") {
822  $lstr = " AND usage_lang = " . $ilDB->quote($a_lang, "text");
823  }
824  $hist_str = "";
825  if ($a_usage_hist_nr > 0) {
826  $hist_str = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
827  }
828 
829  $q = "SELECT * FROM mob_usage WHERE " .
830  "usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
831  "usage_id = " . $ilDB->quote($a_id, "integer") .
832  $lstr . $hist_str;
833  $mobs = array();
834  $mob_set = $ilDB->query($q);
835  while ($mob_rec = $ilDB->fetchAssoc($mob_set)) {
836  $mob_id = (int) $mob_rec['id'];
837  if (ilObject::_lookupType($mob_id) === "mob") {
838  $mobs[$mob_id] = $mob_id;
839  }
840  }
841 
842  return $mobs;
843  }
global $DIC
Definition: shib_login.php:22
$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 384 of file class.ilObjMediaObject.php.

384  : string
385  {
386  return "mobs/mm_" . $a_mob_id;
387  }

◆ _getURL()

static ilObjMediaObject::_getURL ( int  $a_mob_id)
static

get directory for files of media object

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

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

Referenced by ilDclMobRecordRepresentation\getHTML(), and ILIAS\MediaObjects\MediaObjectManager\getLocalSrc().

394  : string {
395  return ilUtil::getHtmlPath(ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $a_mob_id);
396  }
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 401 of file class.ilObjMediaObject.php.

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

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

406  : string {
407  if ($a_purpose == "") {
408  $a_purpose = "Standard";
409  }
410  $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
411  if (preg_match("/https?\:/i", $location)) {
412  return $location;
413  }
414 
415  if ($a_url_encode) {
416  $location = rawurlencode($location);
417  }
418 
419  $path = ($a_web)
420  ? ILIAS_HTTP_PATH
421  : ".";
422 
423  return $path . "/public/data/" . CLIENT_ID . "/mobs/mm_" . $a_mob_id . "/" . $location;
424  }
static _lookupLocationForMobId(int $a_mob_id, string $a_purpose)
$location
Definition: buildRTE.php:22
$path
Definition: ltiservices.php:29
const CLIENT_ID
Definition: constants.php:41
+ Here is the call graph for this function:
+ Here is the caller 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 877 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().

883  : void {
884  global $DIC;
885 
886  $ilDB = $DIC->database();
887 
888  $q = "DELETE FROM mob_usage WHERE " .
889  " id = " . $ilDB->quote($a_mob_id, "integer") . " AND " .
890  " usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
891  " usage_id = " . $ilDB->quote($a_id, "integer") . " AND " .
892  " usage_lang = " . $ilDB->quote($a_lang, "text") . " AND " .
893  " usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
894  $ilDB->manipulate($q);
895 
896  self::handleQuotaUpdate(new self($a_mob_id));
897  }
global $DIC
Definition: shib_login.php:22
$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 1197 of file class.ilObjMediaObject.php.

References $DIC, and $location.

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

1202  : string {
1203  global $DIC;
1204  $file_path = pathinfo($a_file);
1205  $location = substr($file_path["basename"], 0, strlen($file_path["basename"]) -
1206  strlen($file_path["extension"]) - 1) . "_" .
1207  $a_width . "_" .
1208  $a_height . "." . $file_path["extension"];
1209  $target_file = $file_path["dirname"] . "/" .
1210  $location;
1211 
1212  $returned_target_file = $DIC->fileConverters()
1213  ->legacyImages()
1214  ->resizeToFixedSize(
1215  $a_file,
1216  $target_file,
1217  $a_width,
1218  $a_height,
1219  $a_constrain_prop
1220  );
1221 
1222  if ($returned_target_file !== $target_file) {
1223  throw new RuntimeException('Could not resize image');
1224  }
1225 
1226  return $location;
1227  }
$location
Definition: buildRTE.php:22
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _saveTempFileAsMediaObject()

static ilObjMediaObject::_saveTempFileAsMediaObject ( string  $name,
string  $tmp_name,
bool  $upload = true 
)
static
Deprecated:
  • for upload cases use $media_object->addMediaItemFrom(Legacy)Upload
  • imports must use the dependency mechanism

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

References _getDirectory().

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

1344  : ilObjMediaObject {
1345  // create dummy object in db (we need an id)
1346  $media_object = new ilObjMediaObject();
1347  $media_object->setTitle($name);
1348  $media_object->setDescription("");
1349  $media_object->create();
1350 
1351  // determine and create mob directory, move uploaded file to directory
1352  $media_object->createDirectory();
1353  $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
1354 
1355  $file = $mob_dir . "/" . $name;
1356  if ($upload) {
1357  $media_item = $media_object->addMediaItemFromLegacyUpload(
1358  "Standard",
1359  $tmp_name,
1360  $name,
1361  0,
1362  0,
1363  true,
1364  true
1365  );
1366  } else {
1367  $media_item = $media_object->addMediaItemFromLocalFile(
1368  "Standard",
1369  $tmp_name,
1370  $name
1371  );
1372  /*
1373  $media_item = new ilMediaItem();
1374  $media_object->addMediaItem($media_item);
1375  $media_item->setPurpose("Standard");
1376 
1377  copy($tmp_name, $file);
1378  // get mime type
1379  $format = ilObjMediaObject::getMimeType($file);
1380  $media_item->setFormat($format);
1381  $location = $name;
1382  $media_item->setLocation($location);
1383  $media_item->setLocationType("LocalFile");*/
1384  }
1385 
1386  // set real meta and object data
1387  $media_object->setTitle($name);
1388  $media_object->setDescription($media_item->getFormat());
1389  $media_item->setHAlign("Left");
1390 
1391  /*
1392  self::renameExecutables($mob_dir);
1393  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1394  */
1395 
1396  $media_object->update();
1397 
1398  return $media_object;
1399  }
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:

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

References $DIC, and $ilDB.

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

854  : void {
855  global $DIC;
856 
857  $ilDB = $DIC->database();
858 
859  $ilDB->replace(
860  "mob_usage",
861  array(
862  "id" => array("integer", $a_mob_id),
863  "usage_type" => array("text", $a_type),
864  "usage_id" => array("integer", $a_id),
865  "usage_lang" => array("text", $a_lang),
866  "usage_hist_nr" => array("integer", $a_usage_hist_nr)
867  ),
868  array()
869  );
870 
871  self::handleQuotaUpdate(new self($a_mob_id));
872  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ addAdditionalFileFromUpload()

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

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

References ilObject\getId().

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

1553  : void {
1554  $this->manager->addFileFromUpload(
1555  $this->getId(),
1556  $result,
1557  $subdir
1558  );
1559  }
+ 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 185 of file class.ilObjMediaObject.php.

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

187  : void {
188  $this->media_items[] = $a_item;
189  }
+ Here is the caller graph for this function:

◆ addMediaItemFromLegacyUpload()

ilObjMediaObject::addMediaItemFromLegacyUpload ( string  $purpose,
string  $tmp_name,
string  $name,
int  $resize_width = 0,
int  $resize_height = 0,
bool  $constrain_proportions = true,
bool  $deduce_size = false 
)

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

References $location, addMediaItem(), and ilObject\getId().

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

1409  : \ilMediaItem {
1410  $media_item = new ilMediaItem();
1411  $this->addMediaItem($media_item);
1412  $media_item->setPurpose($purpose);
1413  //$location = self::fixFilename($_FILES[$upload_name]['name']);
1414  $location = $name;
1415  $this->manager->addFileFromLegacyUpload($this->getId(), $tmp_name);
1416 
1417  // get mime type
1418  $format = self::getMimeType($location, true);
1419 
1420  // resize standard images
1421  if ($resize_width > 0 && $resize_height > 0 && is_int(strpos($format, "image"))) {
1422  /*
1423  $location = ilObjMediaObject::_resizeImage(
1424  $file,
1425  $resize_width,
1426  $resize_height,
1427  $constrain_proportions
1428  );*/
1429  }
1430 
1431  if ($deduce_size) {
1432  /*
1433  if (ilUtil::deducibleSize($format)) {
1434  $size = ilMediaImageUtil::getImageSize($file);
1435  $media_item->setWidth($size[0]);
1436  $media_item->setHeight($size[1]);
1437  }*/
1438  }
1439 
1440  // set real meta and object data
1441  $media_item->setFormat($format);
1442  $media_item->setLocation($location);
1443  $media_item->setLocationType("LocalFile");
1444  if ($purpose === "Standard") {
1445  $this->generatePreviewPic(320, 240);
1446  }
1447  return $media_item;
1448  }
$location
Definition: buildRTE.php:22
addMediaItem(ilMediaItem $a_item)
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMediaItemFromLocalFile()

ilObjMediaObject::addMediaItemFromLocalFile ( string  $purpose,
string  $tmp_name,
string  $name 
)

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

References $location, addMediaItem(), and ilObject\getId().

1480  : \ilMediaItem {
1481  $media_item = new ilMediaItem();
1482  $this->addMediaItem($media_item);
1483  $media_item->setPurpose($purpose);
1484  $location = $name;
1485  $this->manager->addFileFromLocal($this->getId(), $tmp_name, $name);
1486 
1487  // get mime type
1488  $format = self::getMimeType($location, true);
1489 
1490  // set real meta and object data
1491  $media_item->setFormat($format);
1492  $media_item->setLocation($location);
1493  $media_item->setLocationType("LocalFile");
1494  if ($purpose === "Standard") {
1495  $this->generatePreviewPic(320, 240);
1496  }
1497  return $media_item;
1498  }
$location
Definition: buildRTE.php:22
addMediaItem(ilMediaItem $a_item)
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the call graph for this function:

◆ addMediaItemFromUpload()

ilObjMediaObject::addMediaItemFromUpload ( string  $purpose,
UploadResult  $result,
string  $upload_hash = "" 
)

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

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

1454  : \ilMediaItem {
1455  $media_item = new ilMediaItem();
1456  $this->addMediaItem($media_item);
1457  $media_item->setPurpose($purpose);
1458  $this->manager->addFileFromUpload($this->getId(), $result);
1459 
1460  // get mime type
1461  $format = self::getMimeType($result->getName(), true);
1462 
1463  // set real meta and object data
1464  $media_item->setFormat($format);
1465  $media_item->setLocation($result->getName());
1466  $media_item->setLocationType("LocalFile");
1467  if ($upload_hash !== "") {
1468  $media_item->setUploadHash($upload_hash);
1469  }
1470  if ($purpose === "Standard") {
1471  $this->generatePreviewPic(320, 240);
1472  }
1473  return $media_item;
1474  }
addMediaItem(ilMediaItem $a_item)
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the call graph for this function:

◆ beforeCreateMetaData()

ilObjMediaObject::beforeCreateMetaData ( )
protected

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

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

143  : bool
144  {
145  $ilUser = $this->user;
146 
147  $this->domain->metadata()->learningObjectMetadata()->derive()->fromBasicProperties(
148  $this->getTitle(),
149  $this->getLongDescription(),
150  $ilUser->getPref('language')
151  )->forObject(0, $this->getId(), $this->getType());
152 
153  return false; // avoid parent to create md
154  }
getLongDescription()
get object long description (stored in object_description)
+ Here is the call graph for this function:

◆ beforeDeleteMetaData()

ilObjMediaObject::beforeDeleteMetaData ( )
protected

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

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

175  : bool
176  {
177  // Delete meta data
178  $this->domain->metadata()->learningObjectMetadata()
179  ->deleteAll(0, $this->getId(), $this->getType());
180 
181  return false;
182  }
+ 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 ilObject\_writeDescription(), ilObject\_writeTitle(), ilObject\getId(), and ilObject\getType().

123  : bool
124  {
125  switch ($a_element) {
126  case 'General':
127  // Update Title and description
128  $paths = $this->domain->metadata()->learningObjectMetadata()->paths();
129  $reader = $this->domain->metadata()->learningObjectMetadata()->read(
130  0,
131  $this->getId(),
132  $this->getType(),
133  $paths->custom()->withNextStep('general')->get()
134  );
135 
136  ilObject::_writeTitle($this->getId(), $reader->firstData($paths->title())->value());
137  ilObject::_writeDescription($this->getId(), $reader->firstData($paths->descriptions())->value());
138  break;
139  }
140  return false; // prevent parent from creating ilMD
141  }
static _writeTitle(int $obj_id, string $title)
write title to db (static)
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 156 of file class.ilObjMediaObject.php.

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

156  : bool
157  {
158  $paths = $this->domain->metadata()->learningObjectMetadata()->paths();
159 
160  $manipulator = $this->domain->metadata()->learningObjectMetadata()
161  ->manipulate(0, $this->getId(), $this->getType())
162  ->prepareCreateOrUpdate($paths->title(), $this->getTitle());
163 
164  if ($this->getDescription() !== '') {
165  $manipulator = $manipulator->prepareCreateOrUpdate($paths->firstDescription(), $this->getDescription());
166  } else {
167  $manipulator = $manipulator->prepareDelete($paths->firstDescription());
168  }
169 
170  $manipulator->execute();
171 
172  return false;
173  }
+ Here is the call graph for this function:

◆ clearMultiSrtDirectory()

ilObjMediaObject::clearMultiSrtDirectory ( )

Clear multi srt directory.

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

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

1810  : void
1811  {
1813  }
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 765 of file class.ilObjMediaObject.php.

References $contains_int_link.

765  : bool
766  {
768  }

◆ create()

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

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

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

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

289  : int {
290  $id = parent::create();
291 
292  if (!$a_create_meta_data) {
293  $this->createMetaData();
294  }
295  $this->manager->create(
296  $id,
297  $this->getTitle(),
298  $from_mob_id
299  );
300 
301  if ($a_save_media_items) {
302  $media_items = $this->getMediaItems();
303  for ($i = 0; $i < count($media_items); $i++) {
304  $item = $media_items[$i];
305  $item->setMobId($this->getId());
306  $item->setNr($i + 1);
307  $item->create();
308  }
309  }
310 
311  self::handleQuotaUpdate($this);
312 
313  $ilAppEventHandler = $this->app_event_handler;
314  $ilAppEventHandler->raise(
315  'components/ILIAS/MediaObjects',
316  'create',
317  array('object' => $this,
318  'obj_type' => 'mob',
319  'obj_id' => $this->getId())
320  );
321 
322  return $id;
323  }
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 430 of file class.ilObjMediaObject.php.

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

Referenced by ilObjMediaCastGUI\updateMediaItem().

430  : void
431  {
434  if (!is_dir($path)) {
435  throw new ilMediaObjectsException("Failed to create directory $path.");
436  }
437  }
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:29
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 83 of file class.ilObjMediaObject.php.

References ilMediaItem\deleteAllItemsOfMob(), ilObject\deleteMetaData(), ilObject\getId(), ilLoggerFactory\getLogger(), and getUsages().

83  : bool
84  {
85  $mob_logger = ilLoggerFactory::getLogger('mob');
86  $mob_logger->debug("ilObjMediaObject: Delete called for media object ID '" . $this->getId() . "'.");
87 
88  if (!($this->getId() > 0)) {
89  return false;
90  }
91 
92  $usages = $this->getUsages();
93 
94  $mob_logger->debug("ilObjMediaObject: ... Found " . count($usages) . " usages.");
95 
96  if (count($usages) == 0) {
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 getLogger(string $a_component_id)
Get component logger.
static deleteAllItemsOfMob(int $a_mob_id)
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 1667 of file class.ilObjMediaObject.php.

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

Referenced by ilDclMobRecordFieldModel\afterClone().

1668  {
1669  $new_obj = new ilObjMediaObject();
1670  $new_obj->setTitle($this->getTitle());
1671  $new_obj->setDescription($this->getDescription());
1672 
1673  // media items
1674  foreach ($this->getMediaItems() as $key => $val) {
1675  $new_obj->addMediaItem($val);
1676  }
1677 
1678  $new_obj->create(
1679  false,
1680  true,
1681  $this->getId() // "from" id
1682  );
1683 
1684  // meta data
1685  $this->domain->metadata()->learningObjectMetadata()
1686  ->derive()
1687  ->fromObject(0, $this->getId(), "mob")
1688  ->forObject(0, $new_obj->getId(), "mob");
1689 
1690  return $new_obj;
1691  }
+ 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 690 of file class.ilObjMediaObject.php.

Referenced by getXML().

692  : string {
693  return htmlspecialchars($a_value);
694  }
+ 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 724 of file class.ilObjMediaObject.php.

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

726  : void {
727  $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
728  ilFileUtils::makeDir($a_target_dir . "/objects/" . $subdir);
729 
730  $mobdir = ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->getId();
731  ilFileUtils::rCopy($mobdir, $a_target_dir . "/objects/" . $subdir);
732  }
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 708 of file class.ilObjMediaObject.php.

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

711  : void {
712  $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
713  }
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, bool $offline=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 1767 of file class.ilObjMediaObject.php.

References ilFileUtils\getASCIIFilename().

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

1769  : string {
1770  $a_name = ilFileUtils::getASCIIFilename($a_name);
1771 
1772  $rchars = array("`", "=", "$", "{", "}", "'", ";", " ", "(", ")");
1773  $a_name = str_replace($rchars, "_", $a_name);
1774  $a_name = str_replace("__", "_", $a_name);
1775  return $a_name;
1776  }
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 1330 of file class.ilObjMediaObject.php.

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

Referenced by getXML().

1330  : string
1331  {
1332  return ilFileUtils::getWebspaceDir() . "/mobs/mm_" . $this->getId();
1333  }
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 1853 of file class.ilObjMediaObject.php.

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

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

1853  : void
1854  {
1855  // see https://oembed.com/
1856  $st_item = $this->getMediaItem("Standard");
1857  if ($st_item->getLocationType() == "Reference") {
1858  if (ilExternalMediaAnalyzer::isVimeo($st_item->getLocation())) {
1859  $st_item->setFormat("video/vimeo");
1860  $par = ilExternalMediaAnalyzer::extractVimeoParameters($st_item->getLocation());
1861  $meta = ilExternalMediaAnalyzer::getVimeoMetadata($par["id"]);
1862  $this->setTitle($meta["title"] ?? "");
1863  $description = str_replace("\n", "", $meta["description"] ?? "");
1864  $description = str_replace(["<br>", "<br />"], ["\n", "\n"], $description);
1865  $description = strip_tags($description);
1866  $this->setDescription($description);
1867  $st_item->setDuration((int) ($meta["duration"] ?? 0));
1868  $url = parse_url($meta["thumbnail_url"] ?? "");
1869  $file = basename($url["path"]);
1870  $ext = pathinfo($file, PATHINFO_EXTENSION);
1871  if ($ext == "") {
1872  $ext = "jpg";
1873  }
1874  $this->manager->addPreviewFromUrl(
1875  $this->getId(),
1876  $meta["thumbnail_url"],
1877  "/mob_vpreview." . $ext
1878  );
1879  }
1880  if (ilExternalMediaAnalyzer::isYoutube($st_item->getLocation())) {
1881  $st_item->setFormat("video/youtube");
1882  $par = ilExternalMediaAnalyzer::extractYoutubeParameters($st_item->getLocation());
1883  try {
1885  $this->setTitle($meta["title"] ?? "");
1886  $description = str_replace("\n", "", $meta["description"] ?? "");
1887  } catch (Exception $e) {
1888  $this->setTitle($st_item->getLocation());
1889  $description = "";
1890  }
1891  $description = str_replace(["<br>", "<br />"], ["\n", "\n"], $description);
1892  $description = strip_tags($description);
1893  $this->setDescription($description);
1894  $st_item->setDuration((int) ($meta["duration"] ?? 0));
1895  $thumbnail_url = $meta["thumbnail_url"] ?? "";
1896  $url = parse_url($thumbnail_url);
1897  if ($thumbnail_url !== "") {
1898  $file = basename($url["path"]);
1899  $this->manager->addPreviewFromUrl(
1900  $this->getId(),
1901  $meta["thumbnail_url"],
1902  "/mob_vpreview." .
1903  pathinfo($file, PATHINFO_EXTENSION)
1904  );
1905  }
1906  }
1907  }
1908  }
setTitle(string $title)
$url
Definition: shib_logout.php:66
static isVimeo(string $a_location)
Identify Vimeo links.
getMediaItem(string $a_purpose)
get item for media purpose
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  $dir_path = "")

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

References ilObject\getId().

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

441  : array {
442  return $this->manager->getFilesOfPath(
443  $this->getId(),
444  $dir_path
445  );
446  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFullscreenSrc()

ilObjMediaObject::getFullscreenSrc ( )

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

References getLocationSrc().

1915  : string
1916  {
1917  return $this->getLocationSrc("Fullscreen");
1918  }
getLocationSrc(string $purpose)
+ Here is the call 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 1629 of file class.ilObjMediaObject.php.

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

1631  : array {
1632  $linked = array();
1633 
1634  // get linked media objects (map areas)
1635  $med_items = $this->getMediaItems();
1636 
1637  foreach ($med_items as $med_item) {
1638  $int_links = ilMapArea::_getIntLinks($med_item->getId());
1639  foreach ($int_links as $k => $int_link) {
1640  if ($int_link["Type"] == "MediaObject") {
1641  $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
1642  if (ilObject::_exists($l_id)) {
1643  if (!in_array($l_id, $linked) &&
1644  !in_array($l_id, $a_ignore)) {
1645  $linked[] = $l_id;
1646  }
1647  }
1648  }
1649  }
1650  }
1651  //var_dump($linked);
1652  return $linked;
1653  }
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:

◆ getLocationSrc()

ilObjMediaObject::getLocationSrc ( string  $purpose)
protected

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

References getMediaItem().

Referenced by getFullscreenSrc(), and getStandardSrc().

1920  : string
1921  {
1922  return (string) $this->getMediaItem($purpose)?->getLocationSrc();
1923  }
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:

◆ getMediaItem()

ilObjMediaObject::getMediaItem ( string  $a_purpose)

get item for media purpose

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

References null.

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML(), ilMediaObjectsPlayerWrapperGUI\audio(), ilMediaObjectsPlayerWrapperGUI\getComponent(), getExternalMetadata(), getLocationSrc(), ilObjMediaCastGUI\getMediaItem(), getVideoPreviewPic(), hasPurposeItem(), ilMediaObjectsPlayerWrapperGUI\image(), ilPCImageMapEditorGUI\makeMapWorkCopy(), replaceMediaItemFromUpload(), ilMediaCreationGUI\saveUrl(), ilObjMediaCastGUI\showCastItemObject(), uploadVideoPreviewPic(), and ilMediaObjectsPlayerWrapperGUI\video().

201  : ?ilMediaItem {
202  foreach ($this->media_items as $media_item) {
203  if ($media_item->getPurpose() == $a_purpose) {
204  return $media_item;
205  }
206  }
207  return null;
208  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the caller graph for this function:

◆ getMediaItems()

& ilObjMediaObject::getMediaItems ( )

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

References $media_items.

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

191  : array
192  {
193  return $this->media_items;
194  }
+ Here is the caller graph for this function:

◆ getMimeType()

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

◆ getMultiSrtFiles()

ilObjMediaObject::getMultiSrtFiles ( )

Get all srt files of srt multi upload.

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

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

1818  : array
1819  {
1820  $items = array();
1821 
1822  $lang_codes = $this->domain->metadata()->getLOMLanguageCodes();
1823 
1824  $dir = $this->getMultiSrtUploadDir();
1825  $files = ilFileUtils::getDir($dir);
1826  foreach ($files as $k => $i) {
1827  // check directory
1828  if ($i["type"] == "file" && !in_array($k, array(".", ".."))) {
1829  if (pathinfo($k, PATHINFO_EXTENSION) == "srt") {
1830  $lang = "";
1831  if (substr($k, strlen($k) - 7, 1) == "_") {
1832  $lang = substr($k, strlen($k) - 6, 2);
1833  if (!in_array($lang, $lang_codes)) {
1834  $lang = "";
1835  }
1836  }
1837  $items[] = array("filename" => $k, "lang" => $lang);
1838  }
1839  }
1840  }
1841  return $items;
1842  }
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:25
+ Here is the call graph for this function:

◆ getMultiSrtUploadDir()

ilObjMediaObject::getMultiSrtUploadDir ( )

Get directory for multi srt upload.

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

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

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

1782  : string
1783  {
1784  return ilObjMediaObject::_getDirectory($this->getId()) . "/srt/tmp";
1785  }
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 280 of file class.ilObjMediaObject.php.

References $origin_id.

280  : string
281  {
282  return $this->origin_id;
283  }

◆ 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 1004 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(), ilForumPostDraft\newInstanceByDraftId(), and null.

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

1007  : ?int {
1008  $cont_type = "";
1009  if (is_int(strpos($a_usage["type"], ":"))) {
1010  $us_arr = explode(":", $a_usage["type"]);
1011  $type = $us_arr[1];
1012  $cont_type = $us_arr[0];
1013  } else {
1014  $type = $a_usage["type"];
1015  }
1016 
1017  $id = $a_usage["id"];
1018  $obj_id = null;
1019 
1020  switch ($type) {
1021  // RTE / tiny mce
1022  case "html":
1023 
1024  switch ($cont_type) {
1025  case "qpl":
1026  // Question Pool *Question* Text (Test)
1027  global $DIC;
1028  $qinfo = $DIC->testQuestion()->getGeneralQuestionProperties($id);
1029  if ($qinfo->getOriginalId() > 0) {
1030  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1031  } else {
1032  $obj_id = (int) ($qinfo["obj_fi"] ?? 0); // usage in pool
1033  }
1034  break;
1035 
1036  case "spl":
1037  // Question Pool *Question* Text (Survey)
1039  if ($quest) {
1040  $parent_id = $quest->getObjId();
1041 
1042  // pool question copy - find survey, do not use pool itself
1043  if ($quest->getOriginalId() &&
1044  ilObject::_lookupType($parent_id) == "spl") {
1046  }
1047  // original question (in pool or survey)
1048  else {
1049  $obj_id = (int) $parent_id;
1050  }
1051 
1052  unset($quest);
1053  }
1054  break;
1055 
1056  case "exca":
1057  // Exercise assignment
1058  $returned_pk = $a_usage['id'];
1059  // #15995 - we are just checking against exercise object
1060  $obj_id = ilExSubmission::lookupExerciseIdForReturnedId($returned_pk);
1061  break;
1062 
1063  case "frm":
1064  // Forum
1065  $post_pk = $a_usage['id'];
1066  $oPost = new ilForumPost($post_pk);
1067  $frm_pk = $oPost->getForumId();
1068  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1069  break;
1070 
1071 
1072  case "frm~d":
1073  $draft_id = $a_usage['id'];
1074  $oDraft = ilForumPostDraft::newInstanceByDraftId($draft_id);
1075 
1076  $frm_pk = $oDraft->getForumId();
1077  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1078  break;
1079  case "frm~h":
1080  $history_id = $a_usage['id'];
1081  $oHistoryDraft = new ilForumDraftsHistory($history_id);
1082  $oDraft = ilForumPostDraft::newInstanceByDraftId($oHistoryDraft->getDraftId());
1083 
1084  $frm_pk = $oDraft->getForumId();
1085  $obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
1086  break;
1087  // temporary items (per user)
1088  case "frm~":
1089  case "exca~":
1090  $obj_id = (int) $a_usage['id'];
1091  break;
1092 
1093  // "old" category pages
1094  case "cat":
1095  // InfoScreen Text
1096  case "tst":
1097  case "svy":
1098  // data collection
1099  case "dcl":
1100  $obj_id = (int) $id;
1101  break;
1102  }
1103  break;
1104 
1105  // page editor
1106  case "pg":
1107 
1108  switch ($cont_type) {
1109  // question feedback // parent obj id is q id
1110  case "qfbg":
1111  case "qpl":
1112 
1113  if ($cont_type == "qfbg") {
1115  }
1116 
1117  // Question Pool Question Pages
1118  global $DIC;
1119  $qinfo = $DIC->testQuestion()->getGeneralQuestionProperties($id);
1120  if ($qinfo->getOriginalId() > 0) {
1121  $obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
1122  } else {
1123  $obj_id = $qinfo["obj_fi"]; // usage in pool
1124  }
1125  if ($obj_id == 0) { // this is the case, if question is in learning module -> get lm id
1126  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "lm");
1127  if ($pinfo && $pinfo["parent_type"] == "lm") {
1128  $obj_id = ilLMObject::_lookupContObjID($pinfo["page_id"]);
1129  }
1130  }
1131  break;
1132 
1133  case "lm":
1134  // learning modules
1135  $obj_id = ilLMObject::_lookupContObjID($id);
1136  break;
1137 
1138  case "term":
1139  $term_id = $id;
1140  $obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
1141  break;
1142 
1143  case "wpg":
1144  // wiki page
1145  $obj_id = (int) ilWikiPage::lookupObjIdByPage($id);
1146  break;
1147 
1148  case "sahs":
1149  // sahs page
1150  // can this implementation be used for other content types, too?
1151  $obj_id = ilPageObject::lookupParentId($id, 'sahs');
1152  break;
1153 
1154  case "prtf":
1155  // portfolio
1157  break;
1158 
1159  case "prtt":
1160  // portfolio template
1162  break;
1163 
1164 
1165  case "impr":
1166  // imprint page - always id 1
1167  // fallthrough
1168 
1169  case "copa":
1170  case "cstr":
1171  $obj_id = $id;
1172  break;
1173 
1174  default:
1175  $obj_id = ilPageObject::lookupParentId($id, $cont_type);
1176  break;
1177  }
1178  break;
1179 
1180  // Media Pool
1181  case "mep":
1182  $obj_id = $id;
1183  break;
1184 
1185  // News Context Object (e.g. MediaCast)
1186  case "news":
1188  break;
1189  }
1190 
1191  return $obj_id;
1192  }
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupObjIdForForumId(int $a_for_id)
global $DIC
Definition: shib_login.php:22
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)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static lookupObjIdByPage(int $a_page_id)
returns the wiki/object id to a given page id
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 1573 of file class.ilObjMediaObject.php.

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

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

1573  : array
1574  {
1575  $srt_dir = ilObjMediaObject::_getDirectory($this->getId()) . "/srt";
1576 
1577  if (!is_dir($srt_dir)) {
1578  return array();
1579  }
1580 
1581  $items = ilFileUtils::getDir($srt_dir);
1582 
1583  $srt_files = array();
1584  foreach ($items as $i) {
1585  if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file") {
1586  $name = explode(".", $i["entry"]);
1587  if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_") {
1588  $srt_files[] = array("file" => $i["entry"],
1589  "full_path" => "srt/" . $i["entry"], "language" => substr($name[0], 9, 2));
1590  }
1591  }
1592  }
1593 
1594  return $srt_files;
1595  }
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:

◆ getStandardSrc()

ilObjMediaObject::getStandardSrc ( )

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

References getLocationSrc().

Referenced by ilMediaObjectsPlayerWrapperGUI\audio(), ilNewsTimelineItemGUI\getMediaPath(), ilMediaObjectsPlayerWrapperGUI\image(), and ilMediaObjectsPlayerWrapperGUI\video().

1910  : string
1911  {
1912  return $this->getLocationSrc("Standard");
1913  }
getLocationSrc(string $purpose)
+ 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 902 of file class.ilObjMediaObject.php.

References ilObject\getId().

Referenced by delete().

904  : array {
905  return self::lookupUsages($this->getId(), $a_include_history);
906  }
+ 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 1733 of file class.ilObjMediaObject.php.

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

Referenced by getXML(), and uploadVideoPreviewPic().

1735  : string {
1736 
1737  if (!$a_filename_only) {
1738  $src = $this->thumbs->getPreviewSrc($this->getId());
1739  if ($src !== "") {
1740  return $src;
1741  }
1742  }
1743 
1744  $dir = ilObjMediaObject::_getDirectory($this->getId());
1745  $ppics = array("mob_vpreview.jpg",
1746  "mob_vpreview.jpeg",
1747  "mob_vpreview.png");
1748  $med = $this->getMediaItem("Standard");
1749  if ($med && $med->getFormat() === "image/svg+xml" && $med->getLocationType() === "LocalFile") {
1750  $ppics[] = $med->getLocation();
1751  }
1752  foreach ($ppics as $p) {
1753  if (is_file($dir . "/" . $p)) {
1754  if ($a_filename_only) {
1755  return $p;
1756  } else {
1757  return $dir . "/" . $p;
1758  }
1759  }
1760  }
1761  return "";
1762  }
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,
bool  $offline = 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 456 of file class.ilObjMediaObject.php.

References $location, $user, escapeProperty(), ilExternalMediaAnalyzer\extractVimeoParameters(), 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().

461  : string {
462  $ilUser = $this->user;
463  $xml = "";
464  switch ($a_mode) {
465  case IL_MODE_ALIAS:
466  $xml = "<MediaObject>";
467  $xml .= "<MediaAlias OriginId=\"il__mob_" . $this->getId() . "\"/>";
468  $media_items = $this->getMediaItems();
469  for ($i = 0; $i < count($media_items); $i++) {
470  $item = $media_items[$i];
471  $xml .= "<MediaAliasItem Purpose=\"" . $item->getPurpose() . "\">";
472 
473  // Layout
474  $width = ($item->getWidth() != "")
475  ? "Width=\"" . $item->getWidth() . "\""
476  : "";
477  $height = ($item->getHeight() != "")
478  ? "Height=\"" . $item->getHeight() . "\""
479  : "";
480  $halign = ($item->getHAlign() != "")
481  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
482  : "";
483  $xml .= "<Layout $width $height $halign />";
484 
485  // Caption
486  if ($item->getCaption() != "") {
487  $xml .= "<Caption Align=\"bottom\">" .
488  $this->escapeProperty($item->getCaption()) . "</Caption>";
489  }
490 
491  // Text Representation
492  if ($item->getTextRepresentation() != "") {
493  $xml .= "<TextRepresentation>" .
494  $this->escapeProperty($item->getTextRepresentation()) . "</TextRepresentation>";
495  }
496 
497  // Parameter
498  $parameters = $item->getParameters();
499  foreach ($parameters as $name => $value) {
500  $xml .= "<Parameter Name=\"$name\" Value=\"" . $this->escapeProperty($value) . "\"/>";
501  }
502  $xml .= $item->getMapAreasXML();
503  $xml .= "</MediaAliasItem>";
504  }
505  break;
506 
507  // for output we need technical sections of meta data
508  case IL_MODE_OUTPUT:
509 
510  // get first technical section
511  // $meta = $this->getMetaData();
512  $xml = "<MediaObject Id=\"il__mob_" . $this->getId() . "\">";
513 
514  $media_items = $this->getMediaItems();
515  for ($i = 0; $i < count($media_items); $i++) {
516  $item = $media_items[$i];
517 
518  $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">";
519  if ($a_sign_locals && $item->getLocationType() == "LocalFile") {
520  // pre irss file
521  if (is_file($this->getDataDirectory() . "/" . $item->getLocation())) {
522  $location = ilWACSignedPath::signFile($this->getDataDirectory() . "/" . $item->getLocation());
523  $location = substr($location, strrpos($location, "/") + 1);
524  } else {
525  if ($offline) {
526  $location = $item->getLocation();
527  } else {
528  $location = $this->manager->getLocalSrc(
529  $this->getId(),
530  $item->getLocation()
531  );
532  }
533  }
534  } else {
535  $location = $item->getLocation();
536  // irss
537  if ($item->getLocationType() === "LocalFile" &&
538  !is_file($this->getDataDirectory() . "/" . $item->getLocation())) {
539  $location = $this->manager->getLocalSrc(
540  $this->getId(),
541  $item->getLocation()
542  );
543  }
544  if ($item->getLocationType() != "LocalFile") { //#25941
545  $location = ilUtil::secureUrl($location); //#23518
546  }
547  }
548 
549  $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" .
550  $this->handleAmps($location) . "</Location>";
551 
552  // Format
553  $xml .= "<Format>" . $item->getFormat() . "</Format>";
554 
555  // Layout
556  $width = ($item->getWidth() != "")
557  ? "Width=\"" . $item->getWidth() . "\""
558  : "";
559  $height = ($item->getHeight() != "")
560  ? "Height=\"" . $item->getHeight() . "\""
561  : "";
562  $halign = ($item->getHAlign() != "")
563  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
564  : "";
565  $xml .= "<Layout $width $height $halign />";
566 
567  // Caption
568  if ($item->getCaption() != "") {
569  $xml .= "<Caption Align=\"bottom\">" .
570  $this->escapeProperty($item->getCaption()) . "</Caption>";
571  }
572 
573  // Text Representation
574  if ($item->getTextRepresentation() != "") {
575  $xml .= "<TextRepresentation>" .
576  $this->escapeProperty($item->getTextRepresentation()) . "</TextRepresentation>";
577  }
578 
579  // Title
580  if ($this->getTitle() != "") {
581  $xml .= "<Title>" .
582  $this->escapeProperty($this->getTitle()) . "</Title>";
583  }
584 
585  // Parameter
586  $parameters = $item->getParameters();
587  if ($item->getFormat() === "video/vimeo") {
588  $parameters = ilExternalMediaAnalyzer::extractVimeoParameters($item->getLocation());
589  }
590  foreach ($parameters as $name => $value) {
591  $xml .= "<Parameter Name=\"$name\" Value=\"" . $this->escapeProperty($value) . "\"/>";
592  }
593  $xml .= $item->getMapAreasXML();
594 
595  // Subtitles
596  if ($item->getPurpose() == "Standard") {
597  $srts = $this->getSrtFiles();
598  foreach ($srts as $srt) {
599  $def = "";
600  $meta_lang = "";
601  if ($ilUser->getLanguage() != $meta_lang &&
602  $ilUser->getLanguage() == $srt["language"]) {
603  $def = ' Default="true" ';
604  }
605  $xml .= "<Subtitle File=\"" . $srt["full_path"] .
606  "\" Language=\"" . $srt["language"] . "\" " . $def . "/>";
607  }
608  }
609  if ($this->getVideoPreviewPic(true)) {
610  $xml .= "<PreviewPic File=\"" . $this->getVideoPreviewPic(true) .
611  "\" />";
612  }
613  if ($item->getLocationType() == "LocalFile") {
614  $lpos = strrpos($location, "/");
615  $base_url = substr($location, 0, $lpos);
616  $xml .= "<Url Base=\"" . $base_url .
617  "\" />";
618  }
619  $xml .= "</MediaItem>";
620  }
621  break;
622 
623  // full xml for export
624  case IL_MODE_FULL:
625 
626  // $meta = $this->getMetaData();
627  $xml = "<MediaObject>";
628 
629  // meta data
630  $md2xml = new ilMD2XML(0, $this->getId(), $this->getType());
631  $md2xml->setExportMode(true);
632  $md2xml->startExport();
633  $xml .= $md2xml->getXML();
634 
635  $media_items = $this->getMediaItems();
636  for ($i = 0; $i < count($media_items); $i++) {
637  $item = $media_items[$i];
638 
639  // highlight mode
640  $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">";
641 
642  // Location
643  $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" .
644  $this->handleAmps($item->getLocation()) . "</Location>";
645 
646  // Format
647  $xml .= "<Format>" . $item->getFormat() . "</Format>";
648 
649  // Layout
650  $width = ($item->getWidth() != "")
651  ? "Width=\"" . $item->getWidth() . "\""
652  : "";
653  $height = ($item->getHeight() != "")
654  ? "Height=\"" . $item->getHeight() . "\""
655  : "";
656  $halign = ($item->getHAlign() != "")
657  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
658  : "";
659  $xml .= "<Layout $width $height $halign />";
660 
661  // Caption
662  if ($item->getCaption() != "") {
663  $xml .= "<Caption Align=\"bottom\">" .
664  str_replace("&", "&amp;", $item->getCaption()) . "</Caption>";
665  }
666 
667  // Text Representation
668  if ($item->getTextRepresentation() != "") {
669  $xml .= "<TextRepresentation>" .
670  str_replace("&", "&amp;", $item->getTextRepresentation()) . "</TextRepresentation>";
671  }
672 
673  // Parameter
674  $parameters = $item->getParameters();
675  foreach ($parameters as $name => $value) {
676  $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
677  }
678  $xml .= $item->getMapAreasXML(true, $a_inst);
679  $xml .= "</MediaItem>";
680  }
681  break;
682  }
683  $xml .= "</MediaObject>";
684  return $xml;
685  }
const IL_MODE_FULL
$location
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
static extractVimeoParameters(string $a_location)
Extract Vimeo Parameter.
+ 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 700 of file class.ilObjMediaObject.php.

Referenced by getXML().

702  : string {
703  $a_str = str_replace("&amp;", "&", $a_str);
704  $a_str = str_replace("&", "&amp;", $a_str);
705  return $a_str;
706  }
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

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

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

369  : void {
370  }

◆ hasFullscreenItem()

ilObjMediaObject::hasFullscreenItem ( )

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

References hasPurposeItem().

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML().

235  : bool
236  {
237  return $this->hasPurposeItem("Fullscreen");
238  }
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 243 of file class.ilObjMediaObject.php.

References getMediaItem().

Referenced by hasFullscreenItem().

243  : bool
244  {
245  if (is_object($this->getMediaItem($purpose))) {
246  return true;
247  } else {
248  return false;
249  }
250  }
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 267 of file class.ilObjMediaObject.php.

References $is_alias.

267  : bool
268  {
269  return $this->is_alias;
270  }

◆ isTypeAllowed()

static ilObjMediaObject::isTypeAllowed ( string  $a_type)
static

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

References $DIC.

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

1657  : bool {
1658  global $DIC;
1659  return in_array($a_type, iterator_to_array(
1660  $DIC->mediaObjects()->internal()->domain()->mediaType()->getAllowedSuffixes()
1661  ), true);
1662  }
global $DIC
Definition: shib_login.php:22
+ 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 913 of file class.ilObjMediaObject.php.

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

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

916  : array {
917  global $DIC;
918 
919  $ilDB = $DIC->database();
920 
921  $hist_str = "";
922  if ($a_include_history) {
923  $hist_str = ", usage_hist_nr";
924  }
925 
926  // get usages in pages
927  $q = "SELECT DISTINCT usage_type, usage_id, usage_lang" . $hist_str . " FROM mob_usage WHERE id = " .
928  $ilDB->quote($a_id, "integer");
929 
930  if (!$a_include_history) {
931  $q .= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
932  }
933 
934  $us_set = $ilDB->query($q);
935  $ret = array();
936  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
937  $ut = "";
938  $ct = 0;
939  if (is_int(strpos($us_rec["usage_type"], ":"))) {
940  $us_arr = explode(":", $us_rec["usage_type"]);
941  $ut = $us_arr[1];
942  $ct = $us_arr[0];
943  }
944 
945  // check whether page exists
946  $skip = false;
947  if ($ut == "pg") {
948  if (!ilPageObject::_exists($ct, $us_rec["usage_id"])) {
949  $skip = true;
950  }
951  }
952 
953  if (!$skip) {
954  $ret[] = array(
955  "type" => $us_rec["usage_type"],
956  "id" => $us_rec["usage_id"],
957  "lang" => $us_rec["usage_lang"],
958  "hist_nr" => ($us_rec["usage_hist_nr"] ?? 0)
959  );
960  }
961  }
962 
963  // get usages in media pools
964  $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = " .
965  $ilDB->quote($a_id, "integer") . " AND mep_item.type = " . $ilDB->quote("mob", "text");
966  $us_set = $ilDB->query($q);
967  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
968  $ret[] = array("type" => "mep",
969  "id" => $us_rec["mep_id"]);
970  }
971 
972  // get usages in news items (media casts)
973  $news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
974  foreach ($news_usages as $nu) {
975  $ret[] = $nu;
976  }
977 
978 
979  // get usages in map areas
980  $q = "SELECT DISTINCT mob_id FROM media_item it, map_area area " .
981  " WHERE area.item_id = it.id " .
982  " AND area.link_type = " . $ilDB->quote("int", "text") . " " .
983  " AND area.target = " . $ilDB->quote("il__mob_" . $a_id, "text");
984  $us_set = $ilDB->query($q);
985  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
986  $ret[] = array("type" => "map",
987  "id" => $us_rec["mob_id"]);
988  }
989 
990  // get usages in personal clipboards
991  $users = ilObjUser::_getUsersForClipboadObject("mob", $a_id);
992  foreach ($users as $user) {
993  $ret[] = array("type" => "clip",
994  "id" => $user);
995  }
996 
997  return $ret;
998  }
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
global $DIC
Definition: shib_login.php:22
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  $source,
string  $thumbname 
)

Make thumbnail.

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

References ilObject\getId().

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

1603  : void {
1604  $format = self::getMimeType($source, true);
1605  $this->manager->generatePreview(
1606  $this->getId(),
1607  $source,
1608  true,
1609  $format,
1610  1,
1611  $thumbname
1612  );
1613  }
+ 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 734 of file class.ilObjMediaObject.php.

References ilUtil\insertInstIntoID().

738  : string {
739  if ($a_tag == "Identifier" && $a_param == "Entry") {
740  $a_value = ilUtil::insertInstIntoID($a_value);
741  }
742 
743  return $a_value;
744  }
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 256 of file class.ilObjMediaObject.php.

References ilMediaItem\_getMediaItemsOfMOb().

256  : void
257  {
258  parent::read();
260  }
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 1615 of file class.ilObjMediaObject.php.

References ilObject\getId().

Referenced by uploadVideoPreviewPic().

1617  : void {
1618  $this->manager->removeLocation(
1619  $this->getId(),
1620  $a_file
1621  );
1622  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllMediaItems()

ilObjMediaObject::removeAllMediaItems ( )

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

230  : void
231  {
232  $this->media_items = array();
233  }

◆ removeMediaItem()

ilObjMediaObject::removeMediaItem ( string  $a_purpose)

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

References $media_items, and ilObject\getId().

212  : void {
213  foreach ($this->media_items as $key => $media_item) {
214  if ($media_item->getPurpose() == $a_purpose) {
215  unset($this->media_items[$key]);
216  }
217  }
218  // update numbers and keys
219  $i = 1;
220  $media_items = array();
221  foreach ($this->media_items as $media_item) {
222  $media_items [$i] = $media_item;
223  $media_item->setMobId($this->getId());
224  $media_item->setNr($i);
225  $i++;
226  }
227  $this->media_items = $media_items;
228  }
+ Here is the call graph for this function:

◆ renameExecutables()

static ilObjMediaObject::renameExecutables ( string  $a_dir)
static

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

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

1846  : void {
1848  if (!self::isTypeAllowed("html")) {
1849  ilFileUtils::rRenameSuffix($a_dir, "html", "sec"); // see #20187
1850  }
1851  }
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:

◆ replaceMediaItemFromUpload()

ilObjMediaObject::replaceMediaItemFromUpload ( string  $purpose,
UploadResult  $result,
string  $upload_hash = "" 
)

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

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

1504  : \ilMediaItem {
1505  $media_item = $this->getMediaItem($purpose);
1506  $this->manager->removeLocation($this->getId(), $media_item->getLocation());
1507  $this->manager->addFileFromUpload($this->getId(), $result);
1508 
1509  // get mime type
1510  $format = self::getMimeType($result->getName(), true);
1511 
1512  // set real meta and object data
1513  $media_item->setFormat($format);
1514  $media_item->setLocation($result->getName());
1515  $media_item->setLocationType("LocalFile");
1516  if ($upload_hash !== "") {
1517  $media_item->setUploadHash($upload_hash);
1518  }
1519  if ($purpose === "Standard") {
1520  $this->generatePreviewPic(320, 240);
1521  }
1522  return $media_item;
1523  }
getMediaItem(string $a_purpose)
get item for media purpose
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the call graph for this function:

◆ setAlias()

ilObjMediaObject::setAlias ( bool  $a_is_alias)

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

262  : void
263  {
264  $this->is_alias = $a_is_alias;
265  }

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

757  : void {
758  $this->contains_int_link = $a_contains_link;
759  }

◆ setOriginID()

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

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

275  : void
276  {
277  $this->origin_id = $a_id;
278  }

◆ update()

ilObjMediaObject::update ( bool  $a_upload = false)

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

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

Referenced by ilObjMediaObjectGUI\setObjectPerCreationForm().

325  : bool
326  {
327  parent::update();
328 
329  if (!$a_upload) {
330  $this->updateMetaData();
331  }
332 
333  // iterate all items
334  $media_items = $this->getMediaItems();
336 
337  $j = 1;
338  foreach ($media_items as $key => $val) {
339  $item = $val;
340  if (is_object($item)) {
341  $item->setMobId($this->getId());
342  $item->setNr($j);
343  if ($item->getLocationType() == "Reference") {
344  $item->extractUrlParameters();
345  }
346  $item->create();
347  $j++;
348  }
349  }
350 
351  self::handleQuotaUpdate($this);
352  $ilAppEventHandler = $this->app_event_handler;
353  $ilAppEventHandler->raise(
354  'components/ILIAS/MediaObjects',
355  'update',
356  array('object' => $this,
357  'obj_type' => 'mob',
358  'obj_id' => $this->getId())
359  );
360 
361  return true;
362  }
static deleteAllItemsOfMob(int $a_mob_id)
ilAppEventHandler $app_event_handler
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 1528 of file class.ilObjMediaObject.php.

References ilObject\getId().

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

1533  : void {
1534  $a_subdir = str_replace("..", "", $a_subdir);
1535  if ($a_mode == "rename") {
1536  $this->manager->addFileFromLocal(
1537  $this->getId(),
1538  $tmp_name,
1539  $a_subdir . "/" . $a_name
1540  );
1541  } else {
1542  $this->manager->addFileFromLegacyUpload(
1543  $this->getId(),
1544  $tmp_name,
1545  $a_subdir . "/" . $a_name
1546  );
1547  }
1548  }
+ 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 1791 of file class.ilObjMediaObject.php.

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

1793  : void {
1794  $lng = $this->lng;
1795 
1796  if (!is_file($a_file["tmp_name"])) {
1797  throw new ilMediaObjectsException($lng->txt("mob_file_could_not_be_uploaded"));
1798  }
1799 
1800  $dir = $this->getMultiSrtUploadDir();
1801  ilFileUtils::delDir($dir, true);
1803  ilFileUtils::moveUploadedFile($a_file["tmp_name"], "multi_srt.zip", $dir . "/" . "multi_srt.zip");
1804  $this->domain->resources()->zip()->unzipFile($dir . "/multi_srt.zip");
1805  }
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 1561 of file class.ilObjMediaObject.php.

References uploadAdditionalFile().

1565  : bool {
1566  if (is_file($a_tmp_name) && $a_language != "") {
1567  $this->uploadAdditionalFile("subtitle_" . $a_language . ".srt", $a_tmp_name, "srt", $a_mode);
1568  return true;
1569  }
1570  return false;
1571  }
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 1693 of file class.ilObjMediaObject.php.

References $GLOBALS, ilObject\getId(), getMediaItem(), getVideoPreviewPic(), removeAdditionalFile(), and uploadAdditionalFile().

1695  : void {
1696  // remove old one
1697  if ($this->getVideoPreviewPic(true) != "") {
1698  $this->removeAdditionalFile($this->getVideoPreviewPic(true));
1699  }
1700 
1701  $pi = pathinfo($a_prevpic["name"]);
1702  $ext = $pi["extension"];
1703  if (in_array($ext, array("jpg", "jpeg", "png"))) {
1704  $this->uploadAdditionalFile("mob_vpreview." . $ext, $a_prevpic["tmp_name"]);
1705  }
1706  }
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 46 of file class.ilObjMediaObject.php.

Referenced by containsIntLink().

◆ $domain

InternalDomainService ilObjMediaObject::$domain
protected

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

◆ $image_converter

LegacyImages ilObjMediaObject::$image_converter
private

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

◆ $is_alias

bool ilObjMediaObject::$is_alias

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

Referenced by isAlias().

◆ $manager

MediaObjectManager ilObjMediaObject::$manager
protected

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

◆ $media_items

array ilObjMediaObject::$media_items

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

Referenced by getMediaItems(), and removeMediaItem().

◆ $origin_id

string ilObjMediaObject::$origin_id

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

Referenced by getOriginID().

◆ $thumbs

ThumbsManager ilObjMediaObject::$thumbs
protected

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

◆ $user

ilObjUser ilObjMediaObject::$user
protected

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

Referenced by beforeCreateMetaData(), and getXML().

◆ DEFAULT_PREVIEW_SIZE

const ilObjMediaObject::DEFAULT_PREVIEW_SIZE = 80

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