ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjMediaObject Class Reference

Class ilObjMediaObject. More...

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

Public Member Functions

 __construct ($a_id=0)
 Constructor public. More...
 
 setRefId ($a_id)
 
 getRefId ()
 
 putInTree ($a_parent_ref)
 
 createReference ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 delete ()
 delete media object More...
 
 getDescription ()
 get description of media object More...
 
 setDescription ($a_description)
 set description of media object More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 addMediaItem ($a_item)
 add media item to media object More...
 
getMediaItems ()
 get all media items More...
 
 getMediaItem ($a_purpose)
 get item for media purpose More...
 
 removeMediaItem ($a_purpose)
 
 removeAllMediaItems ()
 remove all media items More...
 
 getMediaItemNr ($a_purpose)
 
 hasFullscreenItem ()
 
 hasPurposeItem ($purpose)
 returns wether object has media item with specific purpose More...
 
 read ()
 read media object data from db More...
 
 setAlias ($a_is_alias)
 set wether page object is an alias More...
 
 isAlias ()
 
 setOriginID ($a_id)
 
 getOriginID ()
 
 getImportId ()
 get import id More...
 
 setImportId ($a_id)
 
 create ($a_create_meta_data=false, $a_save_media_items=true)
 create media object in db More...
 
 update ($a_upload=false)
 update media object in db More...
 
 createDirectory ()
 Create file directory of media object. More...
 
 getFilesOfDirectory ($a_subdir="")
 Get files of directory. More...
 
 getXML ($a_mode=IL_MODE_FULL, $a_inst=0, $a_sign_locals=false)
 get MediaObject XLM Tag More...
 
 handleAmps ($a_str)
 Replace "&" (if not an "&") with "&". More...
 
 exportXML (&$a_xml_writer, $a_inst=0)
 export XML More...
 
 exportFiles ($a_target_dir)
 export all media files of object to target directory note: target directory must be the export target directory, "/objects/il_<inst>_mob_<mob_id>/..." will be appended to this directory More...
 
 exportMediaFullscreen ($a_target_dir, $pg_obj)
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 
 setContainsIntLink ($a_contains_link)
 content parser set this flag to true, if the media object contains internal links (this method should only be called by the import parser) More...
 
 containsIntLink ()
 returns true, if mob was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser) More...
 
 getUsages ($a_include_history=true)
 get all usages of current media object More...
 
 getDataDirectory ()
 
 uploadAdditionalFile ($a_name, $tmp_name, $a_subdir="", $a_mode="move_uploaded")
 Create new media object and update page in db and return new media object. More...
 
 uploadSrtFile ($a_tmp_name, $a_language, $a_mode="move_uploaded")
 Upload srt file. More...
 
 getSrtFiles ()
 Get srt files. More...
 
 makeThumbnail ( $a_file, $a_thumbname, $a_format="png", $a_size="80")
 Make thumbnail. More...
 
 removeAdditionalFile ($a_file)
 Remove additional file. More...
 
 getLinkedMediaObjects ($a_ignore="")
 Get all media objects linked in map areas of this media object. More...
 
 duplicate ()
 Duplicate media object, return new media object. More...
 
 uploadVideoPreviewPic ($a_prevpic)
 Upload video preview picture. More...
 
 getVideoPreviewPic ($a_filename_only=false)
 Get video preview pic. More...
 
 getMultiSrtUploadDir ()
 Get directory for multi srt upload. More...
 
 uploadMultipleSubtitleFile ($a_file)
 Upload multi srt file. More...
 
 clearMultiSrtDirectory ()
 Clear multi feedback directory. More...
 
 getMultiSrtFiles ()
 Get all srt files of srt multi upload. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _exists ($a_id, $a_reference=false, $a_type=null)
 checks wether a lm content object with specified id exists or not More...
 
static _getDirectory ($a_mob_id)
 Get absolute directory. More...
 
static _getRelativeDirectory ($a_mob_id)
 Get relative (to webspace dir) directory. More...
 
static _getURL ($a_mob_id)
 get directory for files of media object (static) More...
 
static _getThumbnailDirectory ($a_mob_id, $a_mode="filesystem")
 get directory for files of media object (static) More...
 
static _lookupStandardItemPath ( $a_mob_id, $a_url_encode=false, $a_web=true)
 Get path for standard item. More...
 
static _lookupItemPath ( $a_mob_id, $a_url_encode=false, $a_web=true, $a_purpose="")
 Get path for item with specific purpose. More...
 
static _createThumbnailDirectory ($a_obj_id)
 Create thumbnail directory. More...
 
static _deleteAllUsages ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 static More...
 
static _getMobsOfObject ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 get mobs of object More...
 
static _saveUsage ($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 Save usage of mob within another container (e.g. More...
 
static _removeUsage ($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 Remove usage of mob in another container. More...
 
static lookupUsages ($a_id, $a_include_history=true)
 Lookup usages of media object. More...
 
static getParentObjectIdForUsage ($a_usage, $a_include_all_access_obj_ids=false)
 Get's the repository object ID of a parent object, if possible. More...
 
static _resizeImage ($a_file, $a_width, $a_height, $a_constrain_prop=false)
 resize image and return new image file ("_width_height" string appended) More...
 
static getMimeType ($a_file, $a_external=null)
 get mime type for file More...
 
static _determineWidthHeight ( $a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
 Determine width and height. More...
 
static _saveTempFileAsMediaObject ($name, $tmp_name, $upload=true)
 Create new media object and update page in db and return new media object. More...
 
static getThumbnailPath ($a_mob_id, $a_thumbname)
 Get thumbnail path. More...
 
static getRestrictedFileTypes ()
 Get restricted file types (this is for the input form, this list will be empty, if "allowed list" is empty) More...
 
static getForbiddenFileTypes ()
 Get forbidden file types. More...
 
static getAllowedFileTypes ()
 Get allowed file types. More...
 
static isTypeAllowed ($a_type)
 Is type allowed. More...
 
static fixFilename ($a_name)
 Fix filename of uploaded file. More...
 
static renameExecutables ($a_dir)
 Rename executables. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $is_alias
 
 $origin_id
 
 $media_items
 
 $contains_int_link
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

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

Static Protected Member Functions

static handleQuotaUpdate (ilObjMediaObject $a_mob)
 

Protected Attributes

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

Detailed Description

Class ilObjMediaObject.

Todo: this class must be integrated with group/folder handling

ILIAS Media Object

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilObjMediaObject::__construct (   $a_id = 0)

Constructor public.

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

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

48  {
49  global $DIC;
50 
51  $this->user = $DIC->user();
52  $this->app_event_handler = $DIC["ilAppEventHandler"];
53  $this->lng = $DIC->language();
54  $this->is_alias = false;
55  $this->media_items = array();
56  $this->contains_int_link = false;
57  $this->type = "mob";
58  parent::__construct($a_id, false);
59  }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _createThumbnailDirectory()

static ilObjMediaObject::_createThumbnailDirectory (   $a_obj_id)
static

Create thumbnail directory.

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

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

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

616  {
618  ilUtil::createDirectory(ilUtil::getWebspaceDir() . "/thumbs/mm_" . $a_obj_id);
619  }
static createDirectory($a_dir, $a_mod=0755)
create directory
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteAllUsages()

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

static

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

References $DIC, and $ilDB.

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

997  {
998  global $DIC;
999 
1000  $ilDB = $DIC->database();
1001 
1002  $and_hist = "";
1003  if ($a_usage_hist_nr !== false) {
1004  $and_hist = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
1005  }
1006 
1007  $mob_ids = array();
1008  $set = $ilDB->query("SELECT id FROM mob_usage" .
1009  " WHERE usage_type = " . $ilDB->quote($a_type, "text") .
1010  " AND usage_id = " . $ilDB->quote($a_id, "integer") .
1011  " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
1012  $and_hist);
1013  while ($row = $ilDB->fetchAssoc($set)) {
1014  $mob_ids[] = $row["id"];
1015  }
1016 
1017  $q = "DELETE FROM mob_usage WHERE usage_type = " .
1018  $ilDB->quote($a_type, "text") .
1019  " AND usage_id= " . $ilDB->quote($a_id, "integer") .
1020  " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
1021  $and_hist;
1022  $ilDB->manipulate($q);
1023 
1024  foreach ($mob_ids as $mob_id) {
1025  self::handleQuotaUpdate(new self($mob_id));
1026  }
1027  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ _determineWidthHeight()

static ilObjMediaObject::_determineWidthHeight (   $a_format,
  $a_type,
  $a_file,
  $a_reference,
  $a_constrain_proportions,
  $a_use_original,
  $a_user_width,
  $a_user_height 
)
static

Determine width and height.

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

References $DIC, ilObject\$lng, $size, ilUtil\deducibleSize(), and ilMediaImageUtil\getImageSize().

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

1480  {
1481  global $DIC;
1482 
1483  $lng = $DIC->language();
1484 
1485  // determine width and height of known image types
1486  //$width = 640;
1487  //$height = 360;
1488  $info = "";
1489 
1490  if ($a_format == "audio/mpeg") {
1491  $width = 300;
1492  $height = 20;
1493  }
1494  if (ilUtil::deducibleSize($a_format)) {
1495  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1496  if ($a_type == "File") {
1498  } else {
1499  $size = ilMediaImageUtil::getImageSize($a_reference);
1500  }
1501  }
1502 
1503  if ($a_use_original) {
1504  if ($size[0] > 0 && $size[1] > 0) {
1505  //$width = $size[0];
1506  //$height = $size[1];
1507  $width = "";
1508  $height = "";
1509  } else {
1510  $info = $lng->txt("cont_could_not_determine_resource_size");
1511  }
1512  } else {
1513  $w = (int) $a_user_width;
1514  $h = (int) $a_user_height;
1515  $width = $w;
1516  $height = $h;
1517  //echo "<br>C-$width-$height-";
1518  if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions) {
1519  if ($size[0] > 0 && $size[1] > 0) {
1520  if ($w > 0) {
1521  $wr = $size[0] / $w;
1522  }
1523  if ($h > 0) {
1524  $hr = $size[1] / $h;
1525  }
1526  //echo "<br>+".$wr."+".$size[0]."+".$w."+";
1527  //echo "<br>+".$hr."+".$size[1]."+".$h."+";
1528  $r = max($wr, $hr);
1529  if ($r > 0) {
1530  $width = (int) round($size[0] / $r);
1531  $height = (int) round($size[1] / $r);
1532  }
1533  }
1534  }
1535  //echo "<br>D-$width-$height-";
1536  }
1537  //echo "<br>E-$width-$height-";
1538 
1539  if ($width == 0 && $a_user_width === "") {
1540  $width = "";
1541  }
1542  if ($height == 0 && $a_user_height === "") {
1543  $height = "";
1544  }
1545  return array("width" => $width, "height" => $height, "info" => $info);
1546  }
$size
Definition: RandomTest.php:84
static getImageSize($a_location)
Get image size from location.
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _exists()

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

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

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

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

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

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

99  {
100  global $DIC;
101 
102  $ilDB = $DIC->database();
103 
104  include_once("./Services/Link/classes/class.ilInternalLink.php");
105  if (is_int(strpos($a_id, "_"))) {
107  }
108 
109  if (parent::_exists($a_id, false) && ilObject::_lookupType($a_id) == "mob") {
110  return true;
111  }
112  return false;
113  }
global $DIC
Definition: goto.php:24
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getDirectory()

static ilObjMediaObject::_getDirectory (   $a_mob_id)
static

Get absolute directory.

Parameters
int$a_mob_id
Returns
string

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

References ilUtil\getWebspaceDir().

Referenced by ilObjMediaObjectGUI\_getMediaInfoHTML(), ilObjMediaCastAccess\_lookupDiskUsage(), _saveTempFileAsMediaObject(), ilObjMediaCastGUI\convertFileObject(), ilPCInteractiveImageGUI\create(), createDirectory(), ilObjMediaPoolGUI\createMediaFromUploadDir(), ilSCORM13Package\dbImportSco(), delete(), ilNewsItem\deliverMobFile(), ilMediaItem\determineDuration(), ilObjMediaCastGUI\determinePlaytimeObject(), duplicate(), ilObjMediaObjectGUI\executeCommand(), ilObjMediaCastGUI\extractPreviewImageObject(), ilPDNewsTableGUI\fillRow(), ilMediaItem\getDirectory(), getFilesOfDirectory(), ilBlogPostingGUI\getFirstMediaObjectAsTag(), ilObjMediaObjectGUI\getFullscreenSizeObject(), ilDclMobRecordRepresentation\getHTML(), getMultiSrtUploadDir(), ilMediaItem\getOriginalSize(), ilPortfolioTemplatePage\getPageDiskSize(), getSrtFiles(), ilObjMediaObjectGUI\getStandardSizeObject(), getVideoPreviewPic(), ilMediaObjectDataSet\getXmlRecord(), ilMediaObjectDataSet\importRecord(), makeThumbnail(), ilPCMediaObject\modifyPageContentPostXsl(), ilDclMobRecordFieldModel\parseValue(), removeAdditionalFile(), ilObjMediaObjectGUI\resizeImagesObject(), ilObjMediaObjectGUI\savePropertiesObject(), ilMediaCreationGUI\saveUrl(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), uploadAdditionalFile(), ilMediaCreationGUI\uploadFile(), and uploadVideoPreviewPic().

521  {
522  return ilUtil::getWebspaceDir() . "/" . self::_getRelativeDirectory($a_mob_id);
523  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMobsOfObject()

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

get mobs of object

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

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

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

1033  {
1034  global $DIC;
1035 
1036  $ilDB = $DIC->database();
1037 
1038  $lstr = "";
1039  if ($a_lang != "") {
1040  $lstr = " AND usage_lang = " . $ilDB->quote($a_lang, "text");
1041  }
1042  $hist_str = "";
1043  if ($a_usage_hist_nr !== false) {
1044  $hist_str = " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer");
1045  }
1046 
1047  $q = "SELECT * FROM mob_usage WHERE " .
1048  "usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
1049  "usage_id = " . $ilDB->quote($a_id, "integer") .
1050  $lstr . $hist_str;
1051  $mobs = array();
1052  $mob_set = $ilDB->query($q);
1053  while ($mob_rec = $ilDB->fetchAssoc($mob_set)) {
1054  if (ilObject::_lookupType($mob_rec["id"]) == "mob") {
1055  $mobs[$mob_rec["id"]] = $mob_rec["id"];
1056  }
1057  }
1058 
1059  return $mobs;
1060  }
$mobs
Definition: imgupload.php:54
global $DIC
Definition: goto.php:24
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getRelativeDirectory()

static ilObjMediaObject::_getRelativeDirectory (   $a_mob_id)
static

Get relative (to webspace dir) directory.

Parameters
int$a_mob_id
Returns
string

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

Referenced by ilObjMediaPoolGUI\performBulkUpload().

532  {
533  return "mobs/mm_" . $a_mob_id;
534  }
+ Here is the caller graph for this function:

◆ _getThumbnailDirectory()

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

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

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

References ilUtil\getWebspaceDir().

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

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

◆ _getURL()

static ilObjMediaObject::_getURL (   $a_mob_id)
static

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id
Returns
string

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

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

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

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

◆ _lookupItemPath()

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

Get path for item with specific purpose.

Parameters
int$a_mob_idmedia object id

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

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

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

580  {
581  if ($a_purpose == "") {
582  $a_purpose = "Standard";
583  }
584  $location = ilMediaItem::_lookupLocationForMobId($a_mob_id, $a_purpose);
585  if (preg_match("/https?\:/i", $location)) {
586  return $location;
587  }
588 
589  if ($a_url_encode) {
590  $location = rawurlencode($location);
591  }
592 
593  $path = ($a_web)
594  ? ILIAS_HTTP_PATH
595  : ".";
596 
597  return $path . "/data/" . CLIENT_ID . "/mobs/mm_" . $a_mob_id . "/" . $location;
598  }
static _lookupLocationForMobId($a_mob_id, $a_purpose)
Lookup location for mob id.
$location
Definition: buildRTE.php:44
const CLIENT_ID
Definition: constants.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupStandardItemPath()

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

Get path for standard item.

Parameters
int$a_mob_idmedia object id

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

References _lookupItemPath().

Referenced by ilSCORM2004ScoGUI\getExportResources().

566  {
567  return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
568  }
static _lookupItemPath( $a_mob_id, $a_url_encode=false, $a_web=true, $a_purpose="")
Get path for item with specific purpose.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _removeUsage()

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

Remove usage of mob in another container.

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

References $DIC, and $ilDB.

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

1090  {
1091  global $DIC;
1092 
1093  $ilDB = $DIC->database();
1094 
1095  $q = "DELETE FROM mob_usage WHERE " .
1096  " id = " . $ilDB->quote((int) $a_mob_id, "integer") . " AND " .
1097  " usage_type = " . $ilDB->quote($a_type, "text") . " AND " .
1098  " usage_id = " . $ilDB->quote((int) $a_id, "integer") . " AND " .
1099  " usage_lang = " . $ilDB->quote($a_lang, "text") . " AND " .
1100  " usage_hist_nr = " . $ilDB->quote((int) $a_usage_hist_nr, "integer");
1101  $ilDB->manipulate($q);
1102 
1103  self::handleQuotaUpdate(new self($a_mob_id));
1104  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ _resizeImage()

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

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

Parameters
string$a_filefull file name
int$a_widthwidth
int$a_heightheight

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

References $location, and ilUtil\resizeImage().

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

1435  {
1436  $file_path = pathinfo($a_file);
1437  $location = substr($file_path["basename"], 0, strlen($file_path["basename"]) -
1438  strlen($file_path["extension"]) - 1) . "_" .
1439  $a_width . "_" .
1440  $a_height . "." . $file_path["extension"];
1441  $target_file = $file_path["dirname"] . "/" .
1442  $location;
1444  $a_file,
1445  $target_file,
1446  (int) $a_width,
1447  (int) $a_height,
1448  $a_constrain_prop
1449  );
1450 
1451  return $location;
1452  }
$location
Definition: buildRTE.php:44
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveTempFileAsMediaObject()

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

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

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

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

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

1557  {
1558  // create dummy object in db (we need an id)
1559  $media_object = new ilObjMediaObject();
1560  $media_object->setTitle($name);
1561  $media_object->setDescription("");
1562  $media_object->create();
1563 
1564  // determine and create mob directory, move uploaded file to directory
1565  $media_object->createDirectory();
1566  $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
1567 
1568  $media_item = new ilMediaItem();
1569  $media_object->addMediaItem($media_item);
1570  $media_item->setPurpose("Standard");
1571 
1572  $file = $mob_dir . "/" . $name;
1573  if ($upload) {
1574  ilUtil::moveUploadedFile($tmp_name, $name, $file);
1575  } else {
1576  copy($tmp_name, $file);
1577  }
1578  // get mime type
1580  $location = $name;
1581  // set real meta and object data
1582  $media_item->setFormat($format);
1583  $media_item->setLocation($location);
1584  $media_item->setLocationType("LocalFile");
1585  $media_object->setTitle($name);
1586  $media_object->setDescription($format);
1587 
1589  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1591  $media_item->setWidth($size[0]);
1592  $media_item->setHeight($size[1]);
1593  }
1594  $media_item->setHAlign("Left");
1595 
1596  self::renameExecutables($mob_dir);
1597  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1598  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1599 
1600  $media_object->update();
1601 
1602  return $media_object;
1603  }
$size
Definition: RandomTest.php:84
static getMimeType($a_file, $a_external=null)
get mime type for file
static getImageSize($a_location)
Get image size from location.
static sanitizeDir($a_path)
Sanitize directory recursively.
$location
Definition: buildRTE.php:44
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static _getDirectory($a_mob_id)
Get absolute directory.
if($format !==null) $name
Definition: metadata.php:230
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem Media Item, component of a media object (file or reference)
$format
Definition: metadata.php:218
Class ilObjMediaObject.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _saveUsage()

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

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

page)

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

References $DIC, and $ilDB.

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

1066  {
1067  global $DIC;
1068 
1069  $ilDB = $DIC->database();
1070 
1071  $ilDB->replace(
1072  "mob_usage",
1073  array(
1074  "id" => array("integer", (int) $a_mob_id),
1075  "usage_type" => array("text", $a_type),
1076  "usage_id" => array("integer", $a_id),
1077  "usage_lang" => array("text", $a_lang),
1078  "usage_hist_nr" => array("integer", (int) $a_usage_hist_nr)
1079  ),
1080  array()
1081  );
1082 
1083  self::handleQuotaUpdate(new self($a_mob_id));
1084  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ addMediaItem()

ilObjMediaObject::addMediaItem (   $a_item)

add media item to media object

Parameters
object$a_itemmedia item object

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

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

◆ clearMultiSrtDirectory()

ilObjMediaObject::clearMultiSrtDirectory ( )

Clear multi feedback directory.

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

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

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

◆ containsIntLink()

ilObjMediaObject::containsIntLink ( )

returns true, if mob was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser)

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

References $contains_int_link.

989  {
991  }

◆ create()

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

create media object in db

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

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

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

◆ createDirectory()

ilObjMediaObject::createDirectory ( )

Create file directory of media object.

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

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

604  {
605  $path = ilObjMediaObject::_getDirectory($this->getId());
606  ilUtil::makeDirParents($path);
607  if (!is_dir($path)) {
608  $this->ilias->raiseError("Failed to create directory $path.", $this->ilias->error_obj->FATAL);
609  }
610  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

◆ createMetaData()

ilObjMediaObject::createMetaData ( )

create meta data entry

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

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

Referenced by create().

226  {
227  include_once 'Services/MetaData/classes/class.ilMDCreator.php';
228 
230 
231  $md_creator = new ilMDCreator(0, $this->getId(), $this->getType());
232  $md_creator->setTitle($this->getTitle());
233  $md_creator->setTitleLanguage($ilUser->getPref('language'));
234  $md_creator->setDescription($this->getDescription());
235  $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
236  $md_creator->setKeywordLanguage($ilUser->getPref('language'));
237  $md_creator->setLanguage($ilUser->getPref('language'));
238  $md_creator->create();
239 
240  return true;
241  }
getId()
get object id public
getType()
get object type public
$ilUser
Definition: imgupload.php:18
getDescription()
get description of media object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createReference()

ilObjMediaObject::createReference ( )

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

77  {
78  $this->ilias->raiseError("Operation ilObjMedia::createReference() not allowed.", $this->ilias->error_obj->FATAL);
79  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ delete()

ilObjMediaObject::delete ( )

delete media object

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

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

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

◆ deleteMetaData()

ilObjMediaObject::deleteMetaData ( )

delete meta data entry

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

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

Referenced by delete().

270  {
271  // Delete meta data
272  include_once('Services/MetaData/classes/class.ilMD.php');
273  $md = new ilMD(0, $this->getId(), $this->getType());
274  $md->deleteAll();
275  }
getId()
get object id public
getType()
get object type public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicate()

ilObjMediaObject::duplicate ( )

Duplicate media object, return new media object.

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

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

Referenced by ilDclMobRecordFieldModel\afterClone().

1830  {
1831  $new_obj = new ilObjMediaObject();
1832  $new_obj->setTitle($this->getTitle());
1833  $new_obj->setDescription($this->getDescription());
1834 
1835  // media items
1836  foreach ($this->getMediaItems() as $key => $val) {
1837  $new_obj->addMediaItem($val);
1838  }
1839 
1840  $new_obj->create(false, true);
1841 
1842  // files
1843  $new_obj->createDirectory();
1844  self::_createThumbnailDirectory($new_obj->getId());
1845  ilUtil::rCopy(
1847  ilObjMediaObject::_getDirectory($new_obj->getId())
1848  );
1849  ilUtil::rCopy(
1851  ilObjMediaObject::_getThumbnailDirectory($new_obj->getId())
1852  );
1853 
1854  // meta data
1855  include_once("Services/MetaData/classes/class.ilMD.php");
1856  $md = new ilMD(0, $this->getId(), "mob");
1857  $new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
1858 
1859  return $new_obj;
1860  }
static _getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
Class ilObjMediaObject.
& getMediaItems()
get all media items
getDescription()
get description of media object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ escapeProperty()

ilObjMediaObject::escapeProperty (   $a_value)
protected

Escape property (e.g.

title, caption) to XSLT -> HTML output

Parameters
string$a_value
Returns
string

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

Referenced by getXML().

859  {
860  return htmlspecialchars($a_value);
861  }
+ Here is the caller graph for this function:

◆ exportFiles()

ilObjMediaObject::exportFiles (   $a_target_dir)

export all media files of object to target directory note: target directory must be the export target directory, "/objects/il_<inst>_mob_<mob_id>/..." will be appended to this directory

Parameters
string$a_target_dirtarget directory

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

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

891  {
892  $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
893  ilUtil::makeDir($a_target_dir . "/objects/" . $subdir);
894 
895  $mobdir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->getId();
896  ilUtil::rCopy($mobdir, $a_target_dir . "/objects/" . $subdir);
897  //echo "from:$mobdir:to:".$a_target_dir."/objects/".$subdir.":<br>";
898  }
const IL_INST_ID
Definition: constants.php:38
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getId()
get object id public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ exportMediaFullscreen()

ilObjMediaObject::exportMediaFullscreen (   $a_target_dir,
  $pg_obj 
)

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

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

901  {
902  $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId();
903  $a_target_dir = $a_target_dir . "/objects/" . $subdir;
904  ilUtil::makeDir($a_target_dir);
905  $tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
906  $tpl->setCurrentBlock("ilMedia");
907 
908  //$int_links = $page_object->getInternalLinks();
909  $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
910 
911  // @todo
912  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
913 
914  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
915  //$media_obj = new ilObjMediaObject($_GET["mob_id"]);
916  require_once("./Services/COPage/classes/class.ilPageObject.php");
917 
918  $xml = "<dummy>";
919  // todo: we get always the first alias now (problem if mob is used multiple
920  // times in page)
921  $xml .= $pg_obj->getMediaAliasElement($this->getId());
922  $xml .= $this->getXML(IL_MODE_OUTPUT);
923  //$xml.= $link_xml;
924  $xml .= "</dummy>";
925 
926  //die(htmlspecialchars($xml));
927 
928  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
929  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
930  $xh = xslt_create();
931 
932  //echo "<b>XML:</b>".htmlentities($xml);
933  // determine target frames for internal links
934  $wb_path = "";
935  $enlarge_path = "";
936  $params = array('mode' => "fullscreen", 'enlarge_path' => $enlarge_path,
937  'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => "",
938  'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
939  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
940  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
941  //echo xslt_error($xh);
942  xslt_free($xh);
943 
944  // unmask user html
945  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
946  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
947  $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
948  $tpl->setVariable("MEDIA_CONTENT", $output);
949  $output = $tpl->get();
950  //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
951  $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i", "$2", $output);
952  $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i", "../../players", $output);
953  $output = preg_replace("/\.\/" . str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory()) . "/i", "../../players", $output);
954  $output = preg_replace("/file=..\/..\/..\//i", "file=../objects/" . $subdir . "/", $output);
955  //die(htmlspecialchars($output));
956  fwrite(fopen($a_target_dir . '/fullscreen.html', 'w'), $output);
957  }
xslt_create()
static _getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
const IL_INST_ID
Definition: constants.php:38
special template class to simplify handling of ITX/PEAR
$_GET["client_id"]
xslt_free(&$proc)
static isTypeAllowed($a_type)
Is type allowed.
getId()
get object id public
static getFlashVideoPlayerDirectory()
Get flash video player directory.
$xml
Definition: metadata.php:332
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
const IL_MODE_OUTPUT
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
getXML($a_mode=IL_MODE_FULL, $a_inst=0, $a_sign_locals=false)
get MediaObject XLM Tag
+ Here is the call graph for this function:

◆ exportXML()

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

export XML

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

References getXML(), and IL_MODE_FULL.

878  {
879  $a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
880  }
const IL_MODE_FULL
getXML($a_mode=IL_MODE_FULL, $a_inst=0, $a_sign_locals=false)
get MediaObject XLM Tag
+ Here is the call graph for this function:

◆ fixFilename()

static ilObjMediaObject::fixFilename (   $a_name)
static

Fix filename of uploaded file.

Parameters
string$a_nameupload file name
Returns
string fixed file name

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

References ilUtil\getASCIIFilename().

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

1978  {
1979  $a_name = ilUtil::getASCIIFilename($a_name);
1980 
1981  $rchars = array("`", "=", "$", "{", "}", "'", ";", " ", "(", ")");
1982  $a_name = str_replace($rchars, "_", $a_name);
1983  $a_name = str_replace("__", "_", $a_name);
1984  return $a_name;
1985  }
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllowedFileTypes()

static ilObjMediaObject::getAllowedFileTypes ( )
static

Get allowed file types.

Returns
array

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

1795  {
1796  $mset = new ilSetting("mobs");
1797  if (trim($mset->get("restricted_file_types")) == "") {
1798  return array();
1799  }
1800  return array_map(
1801  function ($v) {
1802  return strtolower(trim($v));
1803  },
1804  explode(",", $mset->get("restricted_file_types"))
1805  );
1806  }

◆ getDataDirectory()

ilObjMediaObject::getDataDirectory ( )

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

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

Referenced by getXML().

1549  {
1550  return ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->getId();
1551  }
getId()
get object id public
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilObjMediaObject::getDescription ( )

get description of media object

Returns
string description

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

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

169  {
170  return parent::getDescription();
171  }
+ Here is the caller graph for this function:

◆ getFilesOfDirectory()

ilObjMediaObject::getFilesOfDirectory (   $a_subdir = "")

Get files of directory.

Parameters
string$a_subdirsubdirectry
Returns
array array of files

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

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

628  {
629  $a_subdir = str_replace("..", "", $a_subdir);
630  $dir = ilObjMediaObject::_getDirectory($this->getId());
631  if ($a_subdir != "") {
632  $dir .= "/" . $a_subdir;
633  }
634 
635  $files = array();
636  if (is_dir($dir)) {
637  $entries = ilUtil::getDir($dir);
638  foreach ($entries as $e) {
639  if (is_file($dir . "/" . $e["entry"]) && $e["entry"] != "." && $e["entry"] != "..") {
640  $files[] = $e["entry"];
641  }
642  }
643  }
644 
645  return $files;
646  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
+ Here is the call graph for this function:

◆ getForbiddenFileTypes()

static ilObjMediaObject::getForbiddenFileTypes ( )
static

Get forbidden file types.

Returns
array

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

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

1776  {
1777  $mset = new ilSetting("mobs");
1778  if (trim($mset->get("black_list_file_types")) == "") {
1779  return array();
1780  }
1781  return array_map(
1782  function ($v) {
1783  return strtolower(trim($v));
1784  },
1785  explode(",", $mset->get("black_list_file_types"))
1786  );
1787  }
+ Here is the caller graph for this function:

◆ getImportId()

ilObjMediaObject::getImportId ( )

get import id

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

References ilObject\$import_id.

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

◆ getLinkedMediaObjects()

ilObjMediaObject::getLinkedMediaObjects (   $a_ignore = "")

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

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

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

1731  {
1732  $linked = array();
1733 
1734  if (!is_array($a_ignore)) {
1735  $a_ignore = array();
1736  }
1737 
1738  // get linked media objects (map areas)
1739  $med_items = $this->getMediaItems();
1740 
1741  foreach ($med_items as $med_item) {
1742  $int_links = ilMapArea::_getIntLinks($med_item->getId());
1743  foreach ($int_links as $k => $int_link) {
1744  if ($int_link["Type"] == "MediaObject") {
1745  include_once("./Services/Link/classes/class.ilInternalLink.php");
1746  $l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
1747  if (ilObject::_exists($l_id)) {
1748  if (!in_array($l_id, $linked) &&
1749  !in_array($l_id, $a_ignore)) {
1750  $linked[] = $l_id;
1751  }
1752  }
1753  }
1754  }
1755  }
1756  //var_dump($linked);
1757  return $linked;
1758  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static _getIntLinks($a_item_id)
get all internal links of a media items map areas
& getMediaItems()
get all media items
+ Here is the call graph for this function:

◆ getMediaItem()

ilObjMediaObject::getMediaItem (   $a_purpose)

get item for media purpose

Parameters
string$a_purpose
Returns
ilMediaItem|null

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

Referenced by ilObjMediaCastGUI\editCastItemObject(), ilObjMediaCastGUI\getMediaItem(), ilNewsTimelineItemGUI\getMediaPath(), hasPurposeItem(), and uploadVideoPreviewPic().

305  : ?ilMediaItem
306  {
307  foreach ($this->media_items as $media_item) {
308  if ($media_item->getPurpose() == $a_purpose) {
309  return $media_item;
310  }
311  }
312  return null;
313  }
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the caller graph for this function:

◆ getMediaItemNr()

ilObjMediaObject::getMediaItemNr (   $a_purpose)

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

References $i.

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

◆ getMediaItems()

& ilObjMediaObject::getMediaItems ( )

get all media items

Returns
array array of media item objects

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

References $media_items.

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

295  {
296  return $this->media_items;
297  }
+ Here is the caller graph for this function:

◆ getMimeType()

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

get mime type for file

Parameters
string$a_filefile name
Returns
string mime type static

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

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

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

1462  {
1463  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1465  return $mime;
1466  }
static lookupMimeType($path_to_file, $fallback=self::APPLICATION__OCTET_STREAM, $a_external=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMultiSrtFiles()

ilObjMediaObject::getMultiSrtFiles ( )

Get all srt files of srt multi upload.

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

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

2035  {
2036  $items = array();
2037 
2038  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
2040 
2041  $dir = $this->getMultiSrtUploadDir();
2042  $files = ilUtil::getDir($dir);
2043  foreach ($files as $k => $i) {
2044  // check directory
2045  if ($i["type"] == "file" && !in_array($k, array(".", ".."))) {
2046  if (pathinfo($k, PATHINFO_EXTENSION) == "srt") {
2047  $lang = "";
2048  if (substr($k, strlen($k) - 7, 1) == "_") {
2049  $lang = substr($k, strlen($k) - 6, 2);
2050  if (!in_array($lang, $lang_codes)) {
2051  $lang = "";
2052  }
2053  }
2054  $items[] = array("filename" => $k, "lang" => $lang);
2055  }
2056  }
2057  }
2058  return $items;
2059  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
getMultiSrtUploadDir()
Get directory for multi srt upload.
$lang
Definition: xapiexit.php:8
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ getMultiSrtUploadDir()

ilObjMediaObject::getMultiSrtUploadDir ( )

Get directory for multi srt upload.

Parameters

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

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

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

1995  {
1996  return ilObjMediaObject::_getDirectory($this->getId() . "/srt/tmp");
1997  }
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOriginID()

ilObjMediaObject::getOriginID ( )

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

References $origin_id.

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

◆ getParentObjectIdForUsage()

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

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

see ilWebAccessChecker

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

References ilObject\$id, ilObject\$type, ilPCQuestion\_getPageForQuestionId(), assQuestion\_getQuestionInfo(), SurveyQuestion\_instanciateQuestion(), ilGlossaryTerm\_lookGlossaryID(), ilNewsItem\_lookupContextObjId(), ilLMObject\_lookupContObjID(), ilForum\_lookupObjIdForForumId(), ilSCORM2004Node\_lookupSLMID(), SurveyQuestion\_lookupSurveyObjId(), ilGlossaryDefinition\_lookupTermId(), ilObjTest\_lookupTestObjIdForQuestionId(), ilObject\_lookupType(), ilPortfolioPage\findPortfolioForPage(), ilExSubmission\lookupExerciseIdForReturnedId(), ilWikiPage\lookupObjIdByPage(), ilPageObject\lookupParentId(), and ilForumPostDraft\newInstanceByDraftId().

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

1209  {
1210  if (is_int(strpos($a_usage["type"], ":"))) {
1211  $us_arr = explode(":", $a_usage["type"]);
1212  $type = $us_arr[1];
1213  $cont_type = $us_arr[0];
1214  } else {
1215  $type = $a_usage["type"];
1216  }
1217 
1218  $id = $a_usage["id"];
1219  $obj_id = false;
1220 
1221  switch ($type) {
1222  // RTE / tiny mce
1223  case "html":
1224 
1225  switch ($cont_type) {
1226  case "qpl":
1227  // Question Pool *Question* Text (Test)
1228  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1230  if ($qinfo["original_id"] > 0) {
1231  include_once("./Modules/Test/classes/class.ilObjTest.php");
1233  } else {
1234  $obj_id = $qinfo["obj_fi"]; // usage in pool
1235  }
1236  break;
1237 
1238  case "spl":
1239  // Question Pool *Question* Text (Survey)
1241  if ($quest) {
1242  $parent_id = $quest->getObjId();
1243 
1244  // pool question copy - find survey, do not use pool itself
1245  if ($quest->getOriginalId() &&
1246  ilObject::_lookupType($parent_id) == "spl") {
1248  }
1249  // original question (in pool or survey)
1250  else {
1251  $obj_id = $parent_id;
1252  }
1253 
1254  unset($quest);
1255  }
1256  break;
1257 
1258  case "exca":
1259  // Exercise assignment
1260  $returned_pk = $a_usage['id'];
1261  // #15995 - we are just checking against exercise object
1262  include_once 'Modules/Exercise/classes/class.ilExSubmission.php';
1264  break;
1265 
1266  case "frm":
1267  // Forum
1268  $post_pk = $a_usage['id'];
1269  include_once 'Modules/Forum/classes/class.ilForumPost.php';
1270  include_once 'Modules/Forum/classes/class.ilForum.php';
1271  $oPost = new ilForumPost($post_pk);
1272  $frm_pk = $oPost->getForumId();
1274  break;
1275 
1276 
1277  case "frm~d":
1278  $draft_id = $a_usage['id'];
1279  include_once 'Modules/Forum/classes/class.ilForumPostDraft.php';
1280  include_once 'Modules/Forum/classes/class.ilForum.php';
1281  $oDraft = ilForumPostDraft::newInstanceByDraftId($draft_id);
1282 
1283  $frm_pk = $oDraft->getForumId();
1285  break;
1286  case "frm~h":
1287  $history_id = $a_usage['id'];
1288  include_once 'Modules/Forum/classes/class.ilForumDraftsHistory.php';
1289  include_once 'Modules/Forum/classes/class.ilForumPostDraft.php';
1290  include_once 'Modules/Forum/classes/class.ilForum.php';
1291  $oHistoryDraft = new ilForumDraftsHistory($history_id);
1292  $oDraft = ilForumPostDraft::newInstanceByDraftId($oHistoryDraft->getDraftId());
1293 
1294  $frm_pk = $oDraft->getForumId();
1296  break;
1297  // temporary items (per user)
1298  case "frm~":
1299  case "exca~":
1300  $obj_id = $a_usage['id'];
1301  break;
1302 
1303  // "old" category pages
1304  case "cat":
1305  // InfoScreen Text
1306  case "tst":
1307  case "svy":
1308  // data collection
1309  case "dcl":
1310  $obj_id = $id;
1311  break;
1312  }
1313  break;
1314 
1315  // page editor
1316  case "pg":
1317 
1318  switch ($cont_type) {
1319  // question feedback // parent obj id is q id
1320  case "qfbg":
1321  include_once('./Services/COPage/classes/class.ilPageObject.php');
1323  // note: no break here, we only altered the $id to the question id
1324 
1325  // no break
1326  case "qpl":
1327  // Question Pool Question Pages
1328  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1330  if ($qinfo["original_id"] > 0) {
1331  include_once("./Modules/Test/classes/class.ilObjTest.php");
1333  } else {
1334  $obj_id = $qinfo["obj_fi"]; // usage in pool
1335  }
1336  if ($obj_id == 0) { // this is the case, if question is in learning module -> get lm id
1337  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
1338  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "lm");
1339  if ($pinfo && $pinfo["parent_type"] == "lm") {
1340  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1341  $obj_id = ilLMObject::_lookupContObjID($pinfo["page_id"]);
1342  }
1343  $pinfo = ilPCQuestion::_getPageForQuestionId($id, "sahs");
1344  if ($pinfo && $pinfo["parent_type"] == "sahs") {
1345  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1346  $obj_id = ilSCORM2004Node::_lookupSLMID($pinfo["page_id"]);
1347  }
1348  }
1349  break;
1350 
1351  case "lm":
1352  // learning modules
1353  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
1355  break;
1356 
1357  case "gdf":
1358  // glossary definition
1361  break;
1362 
1363  case "wpg":
1364  // wiki page
1365  include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
1367  break;
1368 
1369  case "sahs":
1370  // sahs page
1371  // can this implementation be used for other content types, too?
1372  include_once('./Services/COPage/classes/class.ilPageObject.php');
1374  break;
1375 
1376  case "prtf":
1377  // portfolio
1378  include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
1380  break;
1381 
1382  case "prtt":
1383  // portfolio template
1384  include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
1386  break;
1387 
1388  case "blp":
1389  // blog
1390  include_once('./Services/COPage/classes/class.ilPageObject.php');
1392  break;
1393 
1394  case "impr":
1395  // imprint page - always id 1
1396  // fallthrough
1397 
1398  case "crs":
1399  case "grp":
1400  case "cat":
1401  case "fold":
1402  case "root":
1403  case "cont":
1404  case "copa":
1405  case "cstr":
1406  // repository pages
1407  $obj_id = $id;
1408  break;
1409  }
1410  break;
1411 
1412  // Media Pool
1413  case "mep":
1414  $obj_id = $id;
1415  break;
1416 
1417  // News Context Object (e.g. MediaCast)
1418  case "news":
1419  include_once("./Services/News/classes/class.ilNewsItem.php");
1421  break;
1422  }
1423 
1424  return $obj_id;
1425  }
static _lookupObjIdForForumId($a_for_id)
static _lookupSLMID($a_id)
Lookup Scorm Learning Module ID for node id.
static _lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
static _lookupSurveyObjId($a_question_id)
static findPortfolioForPage($a_page_id)
Get portfolio id of page id.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static lookupExerciseIdForReturnedId($a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
Class ilForumDraftHistory.
static _lookupTermId($a_def_id)
Looks up term id for a definition id.
static _getQuestionInfo($question_id)
Returns question information from the database.
static lookupParentId($a_id, $a_type)
Lookup parent id.
static _getPageForQuestionId($a_q_id, $a_parent_type="")
Get page for question id.
static newInstanceByDraftId($draft_id)
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookGlossaryID($term_id)
get glossary id form term id
static _lookupContextObjId($a_news_id)
Context Object ID.
static lookupObjIdByPage($a_page_id)
returns the wiki/object id to a given page id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilObjMediaObject::getRefId ( )

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

67  {
68  return false;
69  }

◆ getRestrictedFileTypes()

static ilObjMediaObject::getRestrictedFileTypes ( )
static

Get restricted file types (this is for the input form, this list will be empty, if "allowed list" is empty)

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

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

1764  {
1765  return array_filter(self::getAllowedFileTypes(), function ($v) {
1766  return !in_array($v, self::getForbiddenFileTypes());
1767  });
1768  }
+ Here is the caller graph for this function:

◆ getSrtFiles()

ilObjMediaObject::getSrtFiles ( )

Get srt files.

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

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

Referenced by getXML().

1645  {
1646  $srt_dir = ilObjMediaObject::_getDirectory($this->getId()) . "/srt";
1647 
1648  if (!is_dir($srt_dir)) {
1649  return array();
1650  }
1651 
1652  $items = ilUtil::getDir($srt_dir);
1653 
1654  $srt_files = array();
1655  foreach ($items as $i) {
1656  if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file") {
1657  $name = explode(".", $i["entry"]);
1658  if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_") {
1659  $srt_files[] = array("file" => $i["entry"],
1660  "full_path" => "srt/" . $i["entry"], "language" => substr($name[0], 9, 2));
1661  }
1662  }
1663  }
1664 
1665  return $srt_files;
1666  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static _getDirectory($a_mob_id)
Get absolute directory.
if($format !==null) $name
Definition: metadata.php:230
getId()
get object id public
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbnailPath()

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

Get thumbnail path.

Parameters
string$a_thumbnamethumbnail file name
Returns
string thumbnail path

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

References _getThumbnailDirectory().

Referenced by ilPCIIMOverlaysTableGUI\fillRow().

1708  {
1709  $t_dir = ilObjMediaObject::_getThumbnailDirectory($a_mob_id);
1710  return $t_dir . "/" . $a_thumbname;
1711  }
static _getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilObjMediaObject::getTitle ( )

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

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

87  {
88  return parent::getTitle();
89  }
+ Here is the caller graph for this function:

◆ getUsages()

ilObjMediaObject::getUsages (   $a_include_history = true)

get all usages of current media object

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

References ilObject\getId().

Referenced by delete().

1110  {
1111  return self::lookupUsages($this->getId(), $a_include_history);
1112  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVideoPreviewPic()

ilObjMediaObject::getVideoPreviewPic (   $a_filename_only = false)

Get video preview pic.

Parameters

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

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

Referenced by ilObjMediaCastGUI\getCastItemValues(), and uploadVideoPreviewPic().

1954  {
1955  $dir = ilObjMediaObject::_getDirectory($this->getId());
1956  $ppics = array("mob_vpreview.jpg",
1957  "mob_vpreview.jpeg",
1958  "mob_vpreview.png");
1959  foreach ($ppics as $p) {
1960  if (is_file($dir . "/" . $p)) {
1961  if ($a_filename_only) {
1962  return $p;
1963  } else {
1964  return $dir . "/" . $p;
1965  }
1966  }
1967  }
1968  return "";
1969  }
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getXML()

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

get MediaObject XLM Tag

Parameters
int$a_modeIL_MODE_ALIAS | IL_MODE_OUTPUT | IL_MODE_FULL

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

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

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

654  {
656 
657  // TODO: full implementation of all parameters
658  //echo "-".$a_mode."-";
659  switch ($a_mode) {
660  case IL_MODE_ALIAS:
661  $xml = "<MediaObject>";
662  $xml .= "<MediaAlias OriginId=\"il__mob_" . $this->getId() . "\"/>";
663  $media_items = $this->getMediaItems();
664  for ($i = 0; $i < count($media_items); $i++) {
665  $item = $media_items[$i];
666  $xml .= "<MediaAliasItem Purpose=\"" . $item->getPurpose() . "\">";
667 
668  // Layout
669  $width = ($item->getWidth() != "")
670  ? "Width=\"" . $item->getWidth() . "\""
671  : "";
672  $height = ($item->getHeight() != "")
673  ? "Height=\"" . $item->getHeight() . "\""
674  : "";
675  $halign = ($item->getHAlign() != "")
676  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
677  : "";
678  $xml .= "<Layout $width $height $halign />";
679 
680  // Caption
681  if ($item->getCaption() != "") {
682  $xml .= "<Caption Align=\"bottom\">" .
683  $this->escapeProperty($item->getCaption()) . "</Caption>";
684  }
685 
686  // Text Representation
687  if ($item->getTextRepresentation() != "") {
688  $xml .= "<TextRepresentation>" .
689  $this->escapeProperty($item->getTextRepresentation()) . "</TextRepresentation>";
690  }
691 
692  // Parameter
693  $parameters = $item->getParameters();
694  foreach ($parameters as $name => $value) {
695  $xml .= "<Parameter Name=\"$name\" Value=\"" . $this->escapeProperty($value) . "\"/>";
696  }
697  $xml .= $item->getMapAreasXML();
698  $xml .= "</MediaAliasItem>";
699  }
700  break;
701 
702  // for output we need technical sections of meta data
703  case IL_MODE_OUTPUT:
704 
705  // get first technical section
706 // $meta = $this->getMetaData();
707  $xml = "<MediaObject Id=\"il__mob_" . $this->getId() . "\">";
708 
709  $media_items = $this->getMediaItems();
710  for ($i = 0; $i < count($media_items); $i++) {
711  $item = $media_items[$i];
712 
713  $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">";
714 
715  if ($a_sign_locals && $item->getLocationType() == "LocalFile") {
716  require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
717  $location = ilWACSignedPath::signFile($this->getDataDirectory() . "/" . $item->getLocation());
718  $location = substr($location, strrpos($location, "/") + 1);
719  } else {
720  $location = $item->getLocation();
721  if ($item->getLocationType() != "LocalFile") { //#25941
722  $location = ilUtil::secureUrl($location); //#23518
723  }
724  }
725 
726  $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" .
727  $this->handleAmps($location) . "</Location>";
728 
729  // Format
730  $xml .= "<Format>" . $item->getFormat() . "</Format>";
731 
732  // Layout
733  $width = ($item->getWidth() != "")
734  ? "Width=\"" . $item->getWidth() . "\""
735  : "";
736  $height = ($item->getHeight() != "")
737  ? "Height=\"" . $item->getHeight() . "\""
738  : "";
739  $halign = ($item->getHAlign() != "")
740  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
741  : "";
742  $xml .= "<Layout $width $height $halign />";
743 
744  // Caption
745  if ($item->getCaption() != "") {
746  $xml .= "<Caption Align=\"bottom\">" .
747  $this->escapeProperty($item->getCaption()) . "</Caption>";
748  }
749 
750  // Text Representation
751  if ($item->getTextRepresentation() != "") {
752  $xml .= "<TextRepresentation>" .
753  $this->escapeProperty($item->getTextRepresentation()) . "</TextRepresentation>";
754  }
755 
756  // Title
757  if ($this->getTitle() != "") {
758  $xml .= "<Title>" .
759  $this->escapeProperty($this->getTitle()) . "</Title>";
760  }
761 
762  // Parameter
763  $parameters = $item->getParameters();
764  foreach ($parameters as $name => $value) {
765  $xml .= "<Parameter Name=\"$name\" Value=\"" . $this->escapeProperty($value) . "\"/>";
766  }
767  $xml .= $item->getMapAreasXML();
768 
769  // Subtitles
770  if ($item->getPurpose() == "Standard") {
771  $srts = $this->getSrtFiles();
772  foreach ($srts as $srt) {
773  $def = "";
774  $meta_lang = "";
775  if ($ilUser->getLanguage() != $meta_lang &&
776  $ilUser->getLanguage() == $srt["language"]) {
777  $def = ' Default="true" ';
778  }
779  $xml .= "<Subtitle File=\"" . $srt["full_path"] .
780  "\" Language=\"" . $srt["language"] . "\" " . $def . "/>";
781  }
782  }
783  $xml .= "</MediaItem>";
784  }
785  break;
786 
787  // full xml for export
788  case IL_MODE_FULL:
789 
790 // $meta = $this->getMetaData();
791  $xml = "<MediaObject>";
792 
793  // meta data
794  include_once("Services/MetaData/classes/class.ilMD2XML.php");
795  $md2xml = new ilMD2XML(0, $this->getId(), $this->getType());
796  $md2xml->setExportMode(true);
797  $md2xml->startExport();
798  $xml .= $md2xml->getXML();
799 
800  $media_items = $this->getMediaItems();
801  for ($i = 0; $i < count($media_items); $i++) {
802  $item = $media_items[$i];
803 
804  // highlight mode
805  $xml .= "<MediaItem Purpose=\"" . $item->getPurpose() . "\">";
806 
807  // Location
808  $xml .= "<Location Type=\"" . $item->getLocationType() . "\">" .
809  $this->handleAmps($item->getLocation()) . "</Location>";
810 
811  // Format
812  $xml .= "<Format>" . $item->getFormat() . "</Format>";
813 
814  // Layout
815  $width = ($item->getWidth() != "")
816  ? "Width=\"" . $item->getWidth() . "\""
817  : "";
818  $height = ($item->getHeight() != "")
819  ? "Height=\"" . $item->getHeight() . "\""
820  : "";
821  $halign = ($item->getHAlign() != "")
822  ? "HorizontalAlign=\"" . $item->getHAlign() . "\""
823  : "";
824  $xml .= "<Layout $width $height $halign />";
825 
826  // Caption
827  if ($item->getCaption() != "") {
828  $xml .= "<Caption Align=\"bottom\">" .
829  str_replace("&", "&amp;", $item->getCaption()) . "</Caption>";
830  }
831 
832  // Text Representation
833  if ($item->getTextRepresentation() != "") {
834  $xml .= "<TextRepresentation>" .
835  str_replace("&", "&amp;", $item->getTextRepresentation()) . "</TextRepresentation>";
836  }
837 
838  // Parameter
839  $parameters = $item->getParameters();
840  foreach ($parameters as $name => $value) {
841  $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
842  }
843  $xml .= $item->getMapAreasXML(true, $a_inst);
844  $xml .= "</MediaItem>";
845  }
846  break;
847  }
848  $xml .= "</MediaObject>";
849  return $xml;
850  }
getSrtFiles()
Get srt files.
escapeProperty($a_value)
Escape property (e.g.
const IL_MODE_FULL
$location
Definition: buildRTE.php:44
if($format !==null) $name
Definition: metadata.php:230
getId()
get object id public
$xml
Definition: metadata.php:332
static signFile($path_to_file)
getType()
get object type public
const IL_MODE_ALIAS
static secureUrl($url)
Prepare secure href attribute.
& getMediaItems()
get all media items
const IL_MODE_OUTPUT
$ilUser
Definition: imgupload.php:18
handleAmps($a_str)
Replace "&" (if not an "&amp;") with "&amp;".
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAmps()

ilObjMediaObject::handleAmps (   $a_str)

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

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

Referenced by getXML().

868  {
869  $a_str = str_replace("&amp;", "&", $a_str);
870  $a_str = str_replace("&", "&amp;", $a_str);
871  return $a_str;
872  }
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected

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

511  {
512  }

◆ hasFullscreenItem()

ilObjMediaObject::hasFullscreenItem ( )

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

References hasPurposeItem().

359  {
360  return $this->hasPurposeItem("Fullscreen");
361  }
hasPurposeItem($purpose)
returns wether object has media item with specific purpose
+ Here is the call graph for this function:

◆ hasPurposeItem()

ilObjMediaObject::hasPurposeItem (   $purpose)

returns wether object has media item with specific purpose

Parameters
string$purpose
Returns
boolean

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

References getMediaItem().

Referenced by hasFullscreenItem().

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

References $is_alias.

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

◆ isTypeAllowed()

static ilObjMediaObject::isTypeAllowed (   $a_type)
static

Is type allowed.

Parameters
string$a_type
Returns
bool

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

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

1815  {
1816  if (in_array($a_type, self::getForbiddenFileTypes())) {
1817  return false;
1818  }
1819  if (count(self::getAllowedFileTypes()) == 0 || in_array($a_type, self::getAllowedFileTypes())) {
1820  return true;
1821  }
1822  return false;
1823  }
+ Here is the caller graph for this function:

◆ lookupUsages()

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

Lookup usages of media object.

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

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

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

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

1120  {
1121  global $DIC;
1122 
1123  $ilDB = $DIC->database();
1124 
1125  $hist_str = "";
1126  if ($a_include_history) {
1127  $hist_str = ", usage_hist_nr";
1128  }
1129 
1130  // get usages in pages
1131  $q = "SELECT DISTINCT usage_type, usage_id, usage_lang" . $hist_str . " FROM mob_usage WHERE id = " .
1132  $ilDB->quote($a_id, "integer");
1133 
1134  if (!$a_include_history) {
1135  $q .= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
1136  }
1137 
1138  $us_set = $ilDB->query($q);
1139  $ret = array();
1140  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
1141  $ut = "";
1142  if (is_int(strpos($us_rec["usage_type"], ":"))) {
1143  $us_arr = explode(":", $us_rec["usage_type"]);
1144  $ut = $us_arr[1];
1145  $ct = $us_arr[0];
1146  }
1147 
1148  // check whether page exists
1149  $skip = false;
1150  if ($ut == "pg") {
1151  include_once("./Services/COPage/classes/class.ilPageObject.php");
1152  if (!ilPageObject::_exists($ct, $us_rec["usage_id"])) {
1153  $skip = true;
1154  }
1155  }
1156 
1157  if (!$skip) {
1158  $ret[] = array("type" => $us_rec["usage_type"],
1159  "id" => $us_rec["usage_id"],
1160  "lang" => $us_rec["usage_lang"],
1161  "hist_nr" => $us_rec["usage_hist_nr"]);
1162  }
1163  }
1164 
1165  // get usages in media pools
1166  $q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = " .
1167  $ilDB->quote($a_id, "integer") . " AND mep_item.type = " . $ilDB->quote("mob", "text");
1168  $us_set = $ilDB->query($q);
1169  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
1170  $ret[] = array("type" => "mep",
1171  "id" => $us_rec["mep_id"]);
1172  }
1173 
1174  // get usages in news items (media casts)
1175  include_once("./Services/News/classes/class.ilNewsItem.php");
1176  $news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
1177  foreach ($news_usages as $nu) {
1178  $ret[] = $nu;
1179  }
1180 
1181 
1182  // get usages in map areas
1183  $q = "SELECT DISTINCT mob_id FROM media_item it, map_area area " .
1184  " WHERE area.item_id = it.id " .
1185  " AND area.link_type = " . $ilDB->quote("int", "text") . " " .
1186  " AND area.target = " . $ilDB->quote("il__mob_" . $a_id, "text");
1187  $us_set = $ilDB->query($q);
1188  while ($us_rec = $ilDB->fetchAssoc($us_set)) {
1189  $ret[] = array("type" => "map",
1190  "id" => $us_rec["mob_id"]);
1191  }
1192 
1193  // get usages in personal clipboards
1194  $users = ilObjUser::_getUsersForClipboadObject("mob", $a_id);
1195  foreach ($users as $user) {
1196  $ret[] = array("type" => "clip",
1197  "id" => $user);
1198  }
1199 
1200  return $ret;
1201  }
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static _getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
global $DIC
Definition: goto.php:24
global $ilDB
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeThumbnail()

ilObjMediaObject::makeThumbnail (   $a_file,
  $a_thumbname,
  $a_format = "png",
  $a_size = "80" 
)

Make thumbnail.

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

References $size, _getDirectory(), _getThumbnailDirectory(), ilUtil\convertImage(), ilObject\getId(), ilMediaImageUtil\getImageSize(), and getMimeType().

1676  {
1677  $size = (int) $a_size;
1678  $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1680  $file = $m_dir . "/" . $a_file;
1681 
1682  $mime = ilObjMediaObject::getMimeType($file);
1683  $wh = ilMediaImageUtil::getImageSize($file);
1684 
1685  // see #8602
1686  if ($size > (int) $wh[0] && $size > $wh[1]) {
1687  $a_size = "";
1688  }
1689 
1690  $m_dir = ilObjMediaObject::_getDirectory($this->getId());
1692  self::_createThumbnailDirectory($this->getId());
1694  $m_dir . "/" . $a_file,
1695  $t_dir . "/" . $a_thumbname,
1696  $a_format,
1697  $a_size
1698  );
1699  }
static _getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
$size
Definition: RandomTest.php:84
static getMimeType($a_file, $a_external=null)
get mime type for file
static getImageSize($a_location)
Get image size from location.
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
+ Here is the call graph for this function:

◆ MDUpdateListener()

ilObjMediaObject::MDUpdateListener (   $a_element)

Meta data update listener.

Important note: Do never call create() or update() method of ilObject here. It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.

Parameters
string$a_element

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

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

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

◆ modifyExportIdentifier()

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

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

References ilUtil\insertInstIntoID().

960  {
961  if ($a_tag == "Identifier" && $a_param == "Entry") {
962  $a_value = ilUtil::insertInstIntoID($a_value);
963  }
964 
965  return $a_value;
966  }
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
+ Here is the call graph for this function:

◆ putInTree()

ilObjMediaObject::putInTree (   $a_parent_ref)

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

72  {
73  $this->ilias->raiseError("Operation ilObjMedia::putInTree() not allowed.", $this->ilias->error_obj->FATAL);
74  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ read()

ilObjMediaObject::read ( )

read media object data from db

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

References ilMediaItem\_getMediaItemsOfMOb().

384  {
385  //echo "<br>ilObjMediaObject:read";
386  parent::read();
387 
388  // get media items
390  }
static _getMediaItemsOfMOb(&$a_mob)
read media items into media objects (static)
+ Here is the call graph for this function:

◆ removeAdditionalFile()

ilObjMediaObject::removeAdditionalFile (   $a_file)

Remove additional file.

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

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

Referenced by uploadVideoPreviewPic().

1718  {
1719  $file = str_replace("..", "", $a_file);
1720  $file = ilObjMediaObject::_getDirectory($this->getId()) . "/" . $file;
1721  if (is_file($file)) {
1722  unlink($file);
1723  }
1724  }
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllMediaItems()

ilObjMediaObject::removeAllMediaItems ( )

remove all media items

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

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

◆ removeMediaItem()

ilObjMediaObject::removeMediaItem (   $a_purpose)

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

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

320  {
321  foreach ($this->media_items as $key => $media_item) {
322  if ($media_item->getPurpose() == $a_purpose) {
323  unset($this->media_items[$key]);
324  }
325  }
326  // update numbers and keys
327  $i = 1;
328  $media_items = array();
329  foreach ($this->media_items as $media_item) {
330  $media_items [$i] = $media_item;
331  $media_item->setMobId($this->getId());
332  $media_item->setNr($i);
333  $i++;
334  }
335  $this->media_items = $media_items;
336  }
getId()
get object id public
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ renameExecutables()

static ilObjMediaObject::renameExecutables (   $a_dir)
static

Rename executables.

Parameters
string

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

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

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

2067  {
2068  ilUtil::renameExecutables($a_dir);
2069  if (!self::isTypeAllowed("html")) {
2070  ilUtil::rRenameSuffix($a_dir, "html", "sec"); // see #20187
2071  }
2072  }
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($a_dir)
Rename uploaded executables for security reasons.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAlias()

ilObjMediaObject::setAlias (   $a_is_alias)

set wether page object is an alias

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

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

◆ setContainsIntLink()

ilObjMediaObject::setContainsIntLink (   $a_contains_link)

content parser set this flag to true, if the media object contains internal links (this method should only be called by the import parser)

Parameters
boolean$a_contains_linktrue, if page contains intern link tag(s)

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

980  {
981  $this->contains_int_link = $a_contains_link;
982  }

◆ setDescription()

ilObjMediaObject::setDescription (   $a_description)

set description of media object

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

Referenced by MDUpdateListener().

177  {
178  parent::setDescription($a_description);
179  }
+ Here is the caller graph for this function:

◆ setImportId()

ilObjMediaObject::setImportId (   $a_id)

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

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

◆ setOriginID()

ilObjMediaObject::setOriginID (   $a_id)

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

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

◆ setRefId()

ilObjMediaObject::setRefId (   $a_id)

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

62  {
63  $this->ilias->raiseError("Operation ilObjMedia::setRefId() not allowed.", $this->ilias->error_obj->FATAL);
64  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ setTitle()

ilObjMediaObject::setTitle (   $a_title)

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

Referenced by MDUpdateListener().

82  {
83  parent::setTitle($a_title);
84  }
+ Here is the caller graph for this function:

◆ update()

ilObjMediaObject::update (   $a_upload = false)

update media object in db

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

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

473  {
474  parent::update();
475 
476  if (!$a_upload) {
477  $this->updateMetaData();
478  }
479 
480  // iterate all items
481  $media_items = $this->getMediaItems();
482 
484 
485  $j = 1;
486  foreach ($media_items as $key => $val) {
487  $item = $media_items[$key];
488  if (is_object($item)) {
489  $item->setMobId($this->getId());
490  $item->setNr($j);
491  if ($item->getLocationType() == "Reference") {
492  $item->extractUrlParameters();
493  }
494  $item->create();
495  $j++;
496  }
497  }
498 
499  self::handleQuotaUpdate($this);
500  $ilAppEventHandler = $this->app_event_handler;
501  $ilAppEventHandler->raise(
502  'Services/MediaObjects',
503  'update',
504  array('object' => $this,
505  'obj_type' => 'mob',
506  'obj_id' => $this->getId())
507  );
508  }
static deleteAllItemsOfMob($a_mob_id)
Delete all items of a mob.
updateMetaData()
update meta data entry
getId()
get object id public
& getMediaItems()
get all media items
+ Here is the call graph for this function:

◆ updateMetaData()

ilObjMediaObject::updateMetaData ( )

update meta data entry

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

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

Referenced by update().

247  {
248  include_once("Services/MetaData/classes/class.ilMD.php");
249  include_once("Services/MetaData/classes/class.ilMDGeneral.php");
250  include_once("Services/MetaData/classes/class.ilMDDescription.php");
251 
252  $md = new ilMD(0, $this->getId(), $this->getType());
253  $md_gen = $md->getGeneral();
254  $md_gen->setTitle($this->getTitle());
255 
256  // sets first description (maybe not appropriate)
257  $md_des_ids = $md_gen->getDescriptionIds();
258  if (count($md_des_ids) > 0) {
259  $md_des = $md_gen->getDescription($md_des_ids[0]);
260  $md_des->setDescription($this->getDescription());
261  $md_des->update();
262  }
263  $md_gen->update();
264  }
getId()
get object id public
getType()
get object type public
getDescription()
get description of media object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadAdditionalFile()

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

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

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

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

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

1609  {
1610  $a_subdir = str_replace("..", "", $a_subdir);
1611  $dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
1612  if ($a_subdir != "") {
1613  $dir .= "/" . $a_subdir;
1614  }
1615  ilUtil::makeDirParents($dir);
1616  if ($a_mode == "rename") {
1617  rename($tmp_name, $dir . "/" . $a_name);
1618  } else {
1619  ilUtil::moveUploadedFile($tmp_name, $a_name, $dir . "/" . $a_name, true, $a_mode);
1620  }
1621  self::renameExecutables($mob_dir);
1622  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1623  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1624  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sanitizeDir($a_path)
Sanitize directory recursively.
static _getDirectory($a_mob_id)
Get absolute directory.
getId()
get object id public
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadMultipleSubtitleFile()

ilObjMediaObject::uploadMultipleSubtitleFile (   $a_file)

Upload multi srt file.

Parameters
array$a_filefile info array
Exceptions
ilMediaObjectsException

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

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

2007  {
2008  $lng = $this->lng;
2009  $ilUser = $this->user;
2010 
2011  include_once("./Services/MediaObjects/exceptions/class.ilMediaObjectsException.php");
2012  if (!is_file($a_file["tmp_name"])) {
2013  throw new ilMediaObjectsException($lng->txt("mob_file_could_not_be_uploaded"));
2014  }
2015 
2016  $dir = $this->getMultiSrtUploadDir();
2017  ilUtil::delDir($dir, true);
2018  ilUtil::makeDirParents($dir);
2019  ilUtil::moveUploadedFile($a_file["tmp_name"], "multi_srt.zip", $dir . "/" . "multi_srt.zip");
2020  ilUtil::unzip($dir . "/multi_srt.zip", true);
2021  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
General exception class for media objects.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
getMultiSrtUploadDir()
Get directory for multi srt upload.
$ilUser
Definition: imgupload.php:18
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ uploadSrtFile()

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

Upload srt file.

Parameters

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

References uploadAdditionalFile().

1633  {
1634  if (is_file($a_tmp_name) && $a_language != "") {
1635  $this->uploadAdditionalFile("subtitle_" . $a_language . ".srt", $a_tmp_name, "srt", $a_mode);
1636  return true;
1637  }
1638  return false;
1639  }
uploadAdditionalFile($a_name, $tmp_name, $a_subdir="", $a_mode="move_uploaded")
Create new media object and update page in db and return new media object.
+ Here is the call graph for this function:

◆ uploadVideoPreviewPic()

ilObjMediaObject::uploadVideoPreviewPic (   $a_prevpic)

Upload video preview picture.

Parameters

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

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

1869  {
1870  // remove old one
1871  if ($this->getVideoPreviewPic(true) != "") {
1872  $this->removeAdditionalFile($this->getVideoPreviewPic(true));
1873  }
1874 
1875  $pi = pathinfo($a_prevpic["name"]);
1876  $ext = $pi["extension"];
1877  if (in_array($ext, array("jpg", "jpeg", "png"))) {
1878  $this->uploadAdditionalFile("mob_vpreview." . $ext, $a_prevpic["tmp_name"]);
1879  }
1880  }
getVideoPreviewPic($a_filename_only=false)
Get video preview pic.
removeAdditionalFile($a_file)
Remove additional file.
uploadAdditionalFile($a_name, $tmp_name, $a_subdir="", $a_mode="move_uploaded")
Create new media object and update page in db and return new media object.
+ Here is the call graph for this function:

Field Documentation

◆ $app_event_handler

ilObjMediaObject::$app_event_handler
protected

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

Referenced by create(), and update().

◆ $contains_int_link

ilObjMediaObject::$contains_int_link

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

Referenced by containsIntLink().

◆ $is_alias

ilObjMediaObject::$is_alias

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

Referenced by isAlias().

◆ $media_items

ilObjMediaObject::$media_items

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

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

◆ $origin_id

ilObjMediaObject::$origin_id

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

Referenced by getOriginID().

◆ $user

ilObjMediaObject::$user
protected

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