ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjMediaObject Class Reference

Class ilObjMediaObject. More...

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

Public Member Functions

 ilObjMediaObject ($a_id=0)
 Constructor public.
 setRefId ()
 getRefId ()
 get reference id public
 putInTree ()
 createReference ()
 creates reference for object
 setTitle ($a_title)
 set object title
 getTitle ()
 get object title public
 delete ()
 delete media object
 getDescription ()
 get description of media object
 setDescription ($a_description)
 set description of media object
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 addMediaItem ($a_item)
 add media item to media object
getMediaItems ()
 get all media items
getMediaItem ($a_purpose)
 get item for media purpose
 removeMediaItem ($a_purpose)
 removeAllMediaItems ()
 remove all media items
 getMediaItemNr ($a_purpose)
 hasFullscreenItem ()
 hasPurposeItem ($purpose)
 returns wether object has media item with specific purpose
 read ()
 read media object data from db
 setId ($a_id)
 set id
 getId ()
 get object id public
 setAlias ($a_is_alias)
 set wether page object is an alias
 isAlias ()
 setOriginID ($a_id)
 getOriginID ()
 getImportId ()
 get import id
 setImportId ($a_id)
 set import id
 create ($a_create_meta_data=false, $a_save_media_items=true)
 create media object in db
 update ($a_upload=false)
 update media object in db
 _getDirectory ($a_mob_id)
 get directory for files of media object (static)
 _getURL ($a_mob_id)
 get directory for files of media object (static)
 _getThumbnailDirectory ($a_mob_id, $a_mode="filesystem")
 get directory for files of media object (static)
 createDirectory ()
 Create file directory of media object.
 _createThumbnailDirectory ($a_obj_id)
 Create thumbnail directory.
 getFilesOfDirectory ($a_subdir="")
 Get files of directory.
 getXML ($a_mode=IL_MODE_FULL, $a_inst=0)
 get MediaObject XLM Tag
 handleAmps ($a_str)
 Replace "&" (if not an "&") with "&".
 exportXML (&$a_xml_writer, $a_inst=0)
 export XML
 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
 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)
 containsIntLink ()
 returns true, if mob was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser)
 _deleteAllUsages ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 static
 _getMobsOfObject ($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 get mobs of object
 _saveUsage ($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 Save usage of mob within another container (e.g.
 _removeUsage ($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
 Remove usage of mob in another container.
 getUsages ($a_include_history=true)
 get all usages of current media object
 lookupUsages ($a_id, $a_include_history=true)
 Lookup usages of media object.
 getParentObjectIdForUsage ($a_usage, $a_include_all_access_obj_ids=false)
 Get's the repository object ID of a parent object, if possible.
 _resizeImage ($a_file, $a_width, $a_height, $a_constrain_prop=false)
 resize image and return new image file ("_width_height" string appended)
 getDataDirectory ()
_saveTempFileAsMediaObject ($name, $tmp_name, $upload=TRUE)
 Create new media object and update page in db and return new media object.
 uploadAdditionalFile ($a_name, $tmp_name, $a_subdir="")
 Create new media object and update page in db and return new media object.
 uploadSrtFile ($a_tmp_name, $a_language)
 Upload srt file.
 getSrtFiles ()
 Get srt files.
 makeThumbnail ($a_file, $a_thumbname, $a_format="png", $a_size="80")
 Make thumbnail.
 removeAdditionalFile ($a_file)
 Remove additional file.
 getLinkedMediaObjects ($a_ignore="")
 Get all media objects linked in map areas of this media object.
 duplicate ()
 Duplicate media object, return new media object.
 uploadVideoPreviewPic ($a_prevpic)
 Upload video preview picture.
 generatePreviewPic ($a_width, $a_height)
 Upload video preview picture.
 getVideoPreviewPic ($a_filename_only=false)
 Get video preview pic.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 setRefId ($a_id)
 set reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getUntranslatedTitle ()
 get untranslated object title public
 getLongDescription ()
 get object long description (stored in object_description)
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ()
 create
 update ()
 update object in db
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 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.
 countReferences ()
 count references of object
 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
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ...
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.
 _lookupCreationDate ($a_id)
 Lookup creation date.

Static Public Member Functions

static _exists ($a_id)
 checks wether a lm content object with specified id exists or not
static _lookupStandardItemPath ($a_mob_id, $a_url_encode=false, $a_web=true)
 Get path for standard item.
static _lookupItemPath ($a_mob_id, $a_url_encode=false, $a_web=true, $a_purpose="")
 Get path for item with specific purpose.
static getMimeType ($a_file)
 get mime type for file
static _determineWidthHeight ($a_def_width, $a_def_height, $a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
 Determine width and height.
static _getSimpleMimeTypes ()
 Get simple mime types that deactivate parameter property files tab in ILIAS.
static _useAutoStartParameterOnly ($a_loc, $a_format)
 Check whether only autostart parameter should be supported (instead of parameters input field.
static getThumbnailPath ($a_mob_id, $a_thumbname)
 Get thumbnail path.
static getRestrictedFileTypes ()
 Get restricted file types.
static fixFilename ($a_name)
 Fix filename of uploaded file.
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

Data Fields

 $is_alias
 $origin_id
 $id
 $media_items
 $contains_int_link
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title
const DESC_LENGTH = 128
 $ilias
 $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
 $obj_data_record
 object_data record

Static Protected Member Functions

static handleQuotaUpdate (ilObjMediaObject $a_mob)

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:
class.ilObjMediaObject.php 61213 2015-10-26 08:30:11Z gitmgr

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

Member Function Documentation

ilObjMediaObject::_createThumbnailDirectory (   $a_obj_id)

Create thumbnail directory.

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

static

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

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

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

{
global $ilDB;
$and_hist = "";
if ($a_usage_hist_nr !== false)
{
$and_hist = " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
}
$mob_ids = array();
$set = $ilDB->query("SELECT id FROM mob_usage".
" WHERE usage_type = ".$ilDB->quote($a_type, "text").
" AND usage_id = ".$ilDB->quote($a_id, "integer").
" AND usage_lang = ".$ilDB->quote($a_lang, "text").
$and_hist);
while($row = $ilDB->fetchAssoc($set))
{
$mob_ids[] = $row["id"];
}
$q = "DELETE FROM mob_usage WHERE usage_type = ".
$ilDB->quote($a_type, "text").
" AND usage_id= ".$ilDB->quote($a_id, "integer").
" AND usage_lang = ".$ilDB->quote($a_lang, "text").
$and_hist;
$ilDB->manipulate($q);
foreach($mob_ids as $mob_id)
{
self::handleQuotaUpdate(new self($mob_id));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjMediaObject::_determineWidthHeight (   $a_def_width,
  $a_def_height,
  $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 1477 of file class.ilObjMediaObject.php.

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

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

{
global $lng;
// determine width and height of known image types
$width = $a_def_width;
$height = $a_def_height;
$info = "";
if ($a_format == "audio/mpeg")
{
$width = 300;
$height = 20;
}
if (ilUtil::deducibleSize($a_format))
{
if ($a_type == "File")
{
$size = @getimagesize($a_file);
}
else
{
$size = @getimagesize($a_reference);
}
}
if ($a_use_original)
{
if ($size[0] > 0 && $size[1] > 0)
{
$width = $size[0];
$height = $size[1];
}
else
{
$info = $lng->txt("cont_could_not_determine_resource_size");
}
}
else
{
$w = (int) $a_user_width;
$h = (int) $a_user_height;
$width = $w;
$height = $h;
//echo "<br>C-$width-$height-";
if (ilUtil::deducibleSize($a_format) && $a_constrain_proportions)
{
if ($size[0] > 0 && $size[1] > 0)
{
if ($w > 0)
{
$wr = $size[0] / $w;
}
if ($h > 0)
{
$hr = $size[1] / $h;
}
//echo "<br>+".$wr."+".$size[0]."+".$w."+";
//echo "<br>+".$hr."+".$size[1]."+".$h."+";
$r = max($wr, $hr);
if ($r > 0)
{
$width = (int) ($size[0]/$r);
$height = (int) ($size[1]/$r);
}
}
}
//echo "<br>D-$width-$height-";
}
//echo "<br>E-$width-$height-";
return array("width" => $width, "height" => $height, "info" => $info);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjMediaObject::_exists (   $a_id)
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 84 of file class.ilObjMediaObject.php.

References $ilDB, and ilInternalLink\_extractObjIdOfTarget().

Referenced by ilRTE\_getMediaObjects(), ilRTE\_replaceMediaObjectImageSrc(), assQuestion\addQTIMaterial(), ilObjTest\addQTIMaterial(), assQuestion\delete(), ilForum\deletePost(), ilObjTest\deleteTest(), ilQuestionpoolExport\exportXHTMLMediaObjects(), ilTestExport\exportXHTMLMediaObjects(), ilObjQuestionPool\exportXMLMediaObjects(), ilObjTest\exportXMLMediaObjects(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilForumXMLWriter\start(), and ilObjExerciseGUI\updateAssignmentTextObject().

{
global $ilDB;
include_once("./Services/Link/classes/class.ilInternalLink.php");
if (is_int(strpos($a_id, "_")))
{
}
return parent::_exists($a_id, false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::_getDirectory (   $a_mob_id)

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

Definition at line 555 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(), ilObjMediaCastGUI\determinePlaytimeObject(), duplicate(), ilObjMediaCastGUI\extractPreviewImageObject(), ilPDNewsTableGUI\fillRow(), generatePreviewPic(), ilMediaItem\getDirectory(), getFilesOfDirectory(), ilBlogPostingGUI\getFirstMediaObjectAsTag(), ilObjMediaObjectGUI\getFullscreenSizeObject(), ilMediaItem\getOriginalSize(), ilPortfolioTemplatePage\getPageDiskSize(), getSrtFiles(), ilObjMediaObjectGUI\getStandardSizeObject(), getVideoPreviewPic(), ilMediaObjectDataSet\getXmlRecord(), ilMediaObjectDataSet\importRecord(), makeThumbnail(), ilDataCollectionDatatype\parseHTML(), ilDataCollectionDatatype\parseValue(), removeAdditionalFile(), ilObjMediaObjectGUI\resizeImagesObject(), ilObjMediaObjectGUI\savePropertiesObject(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilPCInteractiveImageGUI\update(), ilObjMediaCastGUI\updateMediaItem(), and uploadAdditionalFile().

{
return ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

get mobs of object

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

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

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), assQuestion\addQTIMaterial(), ilObjTest\addQTIMaterial(), ilPCMediaObject\afterPageUpdate(), ilPCMediaObject\beforePageDelete(), ilCOPageHTMLExport\collectPageElements(), SurveyQuestion\copyXHTMLMediaObjectsOfQuestion(), assQuestion\copyXHTMLMediaObjectsOfQuestion(), SurveyQuestion\delete(), assQuestion\delete(), ilPageObject\delete(), ilForum\deletePost(), ilObjSurvey\deleteSurveyRecord(), ilObjTest\deleteTest(), ilObjGlossary\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLGlossaryTerms(), ilObjContentObject\exportHTMLPages(), ilSurveyExport\exportXHTMLMediaObjects(), ilQuestionpoolExport\exportXHTMLMediaObjects(), ilTestExport\exportXHTMLMediaObjects(), ilPageObject\getLastUpdateOfIncludedElements(), ilSoapUtils\getMobsOfObject(), ilCOPageExporter\getXmlExportHeadDependencies(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilForumXMLWriter\start(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), assOrderingHorizontal\toJSON(), assTextSubset\toJSON(), assImagemapQuestion\toJSON(), assKprimChoice\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assOrderingQuestion\toJSON(), assErrorText\toJSON(), assMatchingQuestion\toJSON(), and assClozeTest\toJSON().

{
global $ilDB;
$lstr = "";
if ($a_lang != "")
{
$lstr = " AND usage_lang = ".$ilDB->quote($a_lang, "text");
}
$hist_str = "";
if ($a_usage_hist_nr !== false)
{
$hist_str = " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, "integer");
}
$q = "SELECT * FROM mob_usage WHERE ".
"usage_type = ".$ilDB->quote($a_type, "text")." AND ".
"usage_id = ".$ilDB->quote($a_id, "integer").
$lstr.$hist_str;
$mobs = array();
$mob_set = $ilDB->query($q);
while($mob_rec = $ilDB->fetchAssoc($mob_set))
{
if (ilObject::_lookupType($mob_rec["id"]) == "mob")
{
$mobs[$mob_rec["id"]] = $mob_rec["id"];
}
}
return $mobs;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjMediaObject::_getSimpleMimeTypes ( )
static

Get simple mime types that deactivate parameter property files tab in ILIAS.

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

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

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

+ Here is the caller graph for this function:

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

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

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

References ilUtil\getWebspaceDir().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::_getURL (   $a_mob_id)

get directory for files of media object (static)

Parameters
int$a_mob_idmedia object id

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

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

Referenced by ilMediaCastTableGUI\fillRow(), ilDataCollectionDatatype\parseHTML(), ilObjMediaCastGUI\showGallery(), and ilNewsForContextBlockGUI\showNews().

{
return ilUtil::getHtmlPath(ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

{
if ($a_purpose == "")
{
$a_purpose = "Standard";
}
if (preg_match("/https?\:/i",$location))
return $location;
if ($a_url_encode)
$location = rawurlencode($location);
$path = ($a_web)
? ILIAS_HTTP_PATH
: ".";
return $path."/data/".CLIENT_ID."/mobs/mm_".$a_mob_id."/".$location;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References _lookupItemPath().

Referenced by ilSCORM2004ScoGUI\getExportResources().

{
return ilObjMediaObject::_lookupItemPath($a_mob_id, $a_url_encode, $a_web, "Standard");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Remove usage of mob in another container.

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

References $ilDB, and handleQuotaUpdate().

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\delete(), assQuestion\delete(), ilForum\deletePost(), ilObjSurvey\deleteSurveyRecord(), ilObjTest\deleteTest(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), and ilObjExerciseGUI\updateAssignmentTextObject().

{
global $ilDB;
$q = "DELETE FROM mob_usage WHERE ".
" id = ".$ilDB->quote((int) $a_mob_id, "integer")." AND ".
" usage_type = ".$ilDB->quote($a_type, "text")." AND ".
" usage_id = ".$ilDB->quote((int) $a_id, "integer")." AND ".
" usage_lang = ".$ilDB->quote($a_lang, "text")." AND ".
" usage_hist_nr = ".$ilDB->quote((int) $a_usage_hist_nr, "integer");
$ilDB->manipulate($q);
self::handleQuotaUpdate(new self($a_mob_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $location, and ilUtil\resizeImage().

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

{
$file_path = pathinfo($a_file);
$location = substr($file_path["basename"],0,strlen($file_path["basename"]) -
strlen($file_path["extension"]) - 1)."_".
$a_width."_".
$a_height.".".$file_path["extension"];
$target_file = $file_path["dirname"]."/".
ilUtil::resizeImage($a_file, $target_file,
(int) $a_width, (int) $a_height, $a_constrain_prop);
return $location;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjMediaObject::_saveTempFileAsMediaObject (   $name,
  $tmp_name,
  $upload = TRUE 
)

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

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

References $file, $location, $size, _getDirectory(), ilUtil\deducibleSize(), getMimeType(), ilObjMediaObject(), ilUtil\moveUploadedFile(), and ilUtil\renameExecutables().

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

{
// create dummy object in db (we need an id)
$media_object = new ilObjMediaObject();
$media_object->setTitle($name);
$media_object->setDescription("");
$media_object->create();
// determine and create mob directory, move uploaded file to directory
$media_object->createDirectory();
$mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
$media_item =& new ilMediaItem();
$media_object->addMediaItem($media_item);
$media_item->setPurpose("Standard");
$file = $mob_dir."/".$name;
if ($upload)
{
ilUtil::moveUploadedFile($tmp_name,$name, $file);
}
else
{
copy($tmp_name, $file);
}
// get mime type
$location = $name;
// set real meta and object data
$media_item->setFormat($format);
$media_item->setLocation($location);
$media_item->setLocationType("LocalFile");
$media_object->setTitle($name);
$media_object->setDescription($format);
if (ilUtil::deducibleSize($format))
{
$size = getimagesize($file);
$media_item->setWidth($size[0]);
$media_item->setHeight($size[1]);
}
$media_item->setHAlign("Left");
$media_object->update();
return $media_object;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

page)

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

References $ilDB, and handleQuotaUpdate().

Referenced by ilRTE\_cleanupMediaObjectUsage(), SurveyQuestion\copyXHTMLMediaObjectsOfQuestion(), assQuestion\copyXHTMLMediaObjectsOfQuestion(), assKprimChoiceImport\fromXML(), assErrorTextImport\fromXML(), assFileUploadImport\fromXML(), assFlashQuestionImport\fromXML(), assTextQuestionImport\fromXML(), assMultipleChoiceImport\fromXML(), assNumericImport\fromXML(), assOrderingHorizontalImport\fromXML(), assOrderingQuestionImport\fromXML(), assSingleChoiceImport\fromXML(), assJavaAppletImport\fromXML(), assTextSubsetImport\fromXML(), assFormulaQuestionImport\fromXML(), assImagemapQuestionImport\fromXML(), assMatchingQuestionImport\fromXML(), ilObjTest\fromXML(), ilForumXMLParser\handlerEndTag(), ilObjSurvey\importObject(), ilSurveyImporter\importXmlRepresentation(), ilDataCollectionDatatype\parseValue(), ilPCMediaObject\saveMobUsage(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), assQuestion\syncXHTMLMediaObjectsOfQuestion(), and ilObjExerciseGUI\updateAssignmentTextObject().

{
global $ilDB;
$ilDB->replace("mob_usage",
array(
"id" => array("integer", (int) $a_mob_id),
"usage_type" => array("text", $a_type),
"usage_id" => array("integer", $a_id),
"usage_lang" => array("text", $a_lang),
"usage_hist_nr" => array("integer", (int) $a_usage_hist_nr)
),
array()
);
self::handleQuotaUpdate(new self($a_mob_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjMediaObject::_useAutoStartParameterOnly (   $a_loc,
  $a_format 
)
static

Check whether only autostart parameter should be supported (instead of parameters input field.

This should be the same behaviour as mp3/flv in page.xsl

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

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

{
$lpath = pathinfo($a_loc);
if ($lpath["extension"] == "mp3" && $a_format == "audio/mpeg")
{
return true;
}
if ($lpath["extension"] == "flv")
{
return true;
}
if (in_array($a_format, array("video/mp4", "video/webm")))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilObjMediaObject::addMediaItem (   $a_item)

add media item to media object

Parameters
object$a_itemmedia item object

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

{
$this->media_items[] = $a_item;
}
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 993 of file class.ilObjMediaObject.php.

References $contains_int_link.

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

create media object in db

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

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

{
if (!$a_create_meta_data)
{
$this->createMetaData();
}
if ($a_save_media_items)
{
for($i=0; $i<count($media_items); $i++)
{
$item =& $media_items[$i];
$item->setMobId($this->getId());
$item->setNr($i+1);
$item->create();
}
}
global $ilAppEventHandler;
$ilAppEventHandler->raise('Services/MediaObjects',
'create',
array('object' => $this,
'obj_type' => 'mob',
'obj_id' => $this->getId())
);
}

+ Here is the call graph for this function:

ilObjMediaObject::createDirectory ( )

Create file directory of media object.

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

References _getDirectory(), and getId().

Referenced by _createThumbnailDirectory().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::createMetaData ( )

create meta data entry

Reimplemented from ilObject.

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

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

Referenced by create().

{
include_once 'Services/MetaData/classes/class.ilMDCreator.php';
global $ilUser;
$md_creator = new ilMDCreator(0, $this->getId(), $this->getType());
$md_creator->setTitle($this->getTitle());
$md_creator->setTitleLanguage($ilUser->getPref('language'));
$md_creator->setDescription($this->getDescription());
$md_creator->setDescriptionLanguage($ilUser->getPref('language'));
$md_creator->setKeywordLanguage($ilUser->getPref('language'));
$md_creator->setLanguage($ilUser->getPref('language'));
$md_creator->create();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::createReference ( )

creates reference for object

public

Returns
integer reference_id of object

Reimplemented from ilObject.

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

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

delete media object

Reimplemented from ilObject.

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

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

{
if (!($this->getId() > 0))
{
return;
}
$usages = $this->getUsages();
if (count($usages) == 0)
{
// remove directory
// remove thumbnail directory
// delete meta data of mob
$this->deleteMetaData();
// delete media items
// this is just to make sure, there should be no entries left at
// this point as they depend on the usage
// delete object
}
}

+ Here is the call graph for this function:

ilObjMediaObject::deleteMetaData ( )

delete meta data entry

Reimplemented from ilObject.

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

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

Referenced by delete().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::duplicate ( )

Duplicate media object, return new media object.

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

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

{
$new_obj = new ilObjMediaObject();
$new_obj->setTitle($this->getTitle());
$new_obj->setDescription($this->getDescription());
// media items
foreach($this->getMediaItems() as $key => $val)
{
$new_obj->addMediaItem($val);
}
$new_obj->create(false, true);
// files
$new_obj->createDirectory();
self::_createThumbnailDirectory($new_obj->getId());
ilObjMediaObject::_getDirectory($new_obj->getId()));
// meta data
include_once("Services/MetaData/classes/class.ilMD.php");
$md = new ilMD(0, $this->getId(), "mob");
$new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
return $new_obj;
}

+ Here is the call graph for this function:

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

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

{
$subdir = "il_".IL_INST_ID."_mob_".$this->getId();
ilUtil::makeDir($a_target_dir."/objects/".$subdir);
$mobdir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->getId();
ilUtil::rCopy($mobdir, $a_target_dir."/objects/".$subdir);
//echo "from:$mobdir:to:".$a_target_dir."/objects/".$subdir.":<br>";
}

+ Here is the call graph for this function:

ilObjMediaObject::exportMediaFullscreen (   $a_target_dir,
  $pg_obj 
)

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

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

{
$subdir = "il_".IL_INST_ID."_mob_".$this->getId();
$a_target_dir = $a_target_dir."/objects/".$subdir;
ilUtil::makeDir($a_target_dir);
$tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
$tpl->setCurrentBlock("ilMedia");
//$int_links = $page_object->getInternalLinks();
$med_links = ilMediaItem::_getMapAreasIntLinks($this->getId());
// @todo
//$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
//$media_obj = new ilObjMediaObject($_GET["mob_id"]);
require_once("./Services/COPage/classes/class.ilPageObject.php");
$xml = "<dummy>";
// todo: we get always the first alias now (problem if mob is used multiple
// times in page)
$xml.= $pg_obj->getMediaAliasElement($this->getId());
$xml.= $this->getXML(IL_MODE_OUTPUT);
//$xml.= $link_xml;
$xml.="</dummy>";
//die(htmlspecialchars($xml));
$xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
$args = array( '/_xml' => $xml, '/_xsl' => $xsl );
$xh = xslt_create();
//echo "<b>XML:</b>".htmlentities($xml);
// determine target frames for internal links
$wb_path = "";
$enlarge_path = "";
$params = array ('mode' => "fullscreen", 'enlarge_path' => $enlarge_path,
'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
//echo xslt_error($xh);
xslt_free($xh);
// unmask user html
include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
$tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css");
$tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css");
$tpl->setVariable("MEDIA_CONTENT", $output);
$output = $tpl->get();
//$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
$output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output);
$output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i","../../players",$output);
$output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","../../players",$output);
$output = preg_replace("/file=..\/..\/..\//i","file=../objects/".$subdir."/",$output);
//die(htmlspecialchars($output));
fwrite(fopen($a_target_dir.'/fullscreen.html','w'), $output );
}

+ Here is the call graph for this function:

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

export XML

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

References getXML(), and IL_MODE_FULL.

{
$a_xml_writer->appendXML($this->getXML(IL_MODE_FULL, $a_inst));
}

+ Here is the call graph for this function:

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

References ilUtil\getASCIIFilename().

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

{
$a_name = ilUtil::getASCIIFilename($a_name);
$rchars = array("`", "=", "$", "{", "}", "'", ";", " ", "(", ")");
$a_name = str_replace($rchars, "_", $a_name);
$a_name = str_replace("__", "_", $a_name);
return $a_name;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::generatePreviewPic (   $a_width,
  $a_height 
)

Upload video preview picture.

Parameters
@return

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

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

Referenced by ilObjMediaCastGUI\saveCastItemObject().

{
$item = $this->getMediaItem("Standard");
if ($item->getLocationType() == "LocalFile" &&
is_int(strpos($item->getFormat(), "image/")))
{
$file = $dir."/".
$item->getLocation();
if (is_file($file))
{
{
ilUtil::execConvert(ilUtil::escapeShellArg($file)."[0] -geometry ".$a_width."x".$a_height."^ -gravity center -extent ".$a_width."x".$a_height." PNG:".$dir."/mob_vpreview.png");
}
else
{
ilUtil::convertImage($file, $dir."/mob_vpreview.png", "PNG", $a_width."x".$a_height);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::getDataDirectory ( )

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

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

Referenced by handleQuotaUpdate().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::getDescription ( )

get description of media object

Returns
string description

Reimplemented from ilObject.

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

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

{
}

+ Here is the caller graph for this function:

ilObjMediaObject::getFilesOfDirectory (   $a_subdir = "")

Get files of directory.

Parameters
string$a_subdirsubdirectry
Returns
array array of files

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

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

{
$a_subdir = str_replace("..", "", $a_subdir);
if ($a_subdir != "")
{
$dir.= "/".$a_subdir;
}
$files = array();
if (is_dir($dir))
{
$entries = ilUtil::getDir($dir);
foreach ($entries as $e)
{
if (is_file($dir."/".$e["entry"]) && $e["entry"] != "." && $e["entry"] != "..")
{
$files[] = $e["entry"];
}
}
}
return $files;
}

+ Here is the call graph for this function:

ilObjMediaObject::getImportId ( )

get import id

Reimplemented from ilObject.

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

References ilObject\$import_id.

{
}
ilObjMediaObject::getLinkedMediaObjects (   $a_ignore = "")

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

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

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

{
$linked = array();
if (!is_array($a_ignore))
{
$a_ignore = array();
}
// get linked media objects (map areas)
$med_items = $this->getMediaItems();
foreach($med_items as $med_item)
{
$int_links = ilMapArea::_getIntLinks($med_item->getId());
foreach ($int_links as $k => $int_link)
{
if ($int_link["Type"] == "MediaObject")
{
include_once("./Services/Link/classes/class.ilInternalLink.php");
$l_id = ilInternalLink::_extractObjIdOfTarget($int_link["Target"]);
if (ilObject::_exists($l_id))
{
if (!in_array($l_id, $linked) &&
!in_array($l_id, $a_ignore))
{
$linked[] = $l_id;
}
}
}
}
}
//var_dump($linked);
return $linked;
}

+ Here is the call graph for this function:

& ilObjMediaObject::getMediaItem (   $a_purpose)

get item for media purpose

Parameters
string$a_purpose
Returns
ilMediaItem

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

Referenced by ilObjMediaCastGUI\editCastItemObject(), generatePreviewPic(), ilObjMediaCastGUI\getMediaItem(), and hasPurposeItem().

{
foreach ($this->media_items as $media_item)
{
if($media_item->getPurpose() == $a_purpose)
{
return $media_item;
}
}
return false;
}

+ Here is the caller graph for this function:

ilObjMediaObject::getMediaItemNr (   $a_purpose)

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

{
for($i=0; $i<count($this->media_items); $i++)
{
if($this->media_items[$i]->getPurpose() == $a_purpose)
{
return $i + 1;
}
}
return false;
}
& ilObjMediaObject::getMediaItems ( )

get all media items

Returns
array array of media item objects

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

References $media_items.

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

{
}

+ Here is the caller graph for this function:

ilObjMediaObject::getOriginID ( )

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

References $origin_id.

{
}
ilObjMediaObject::getParentObjectIdForUsage (   $a_usage,
  $a_include_all_access_obj_ids = false 
)

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

see ilWebAccessChecker

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

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

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

{
if(is_int(strpos($a_usage["type"], ":")))
{
$us_arr = explode(":", $a_usage["type"]);
$type = $us_arr[1];
$cont_type = $us_arr[0];
}
else
{
$type = $a_usage["type"];
}
$id = $a_usage["id"];
$obj_id = false;
switch($type)
{
// RTE / tiny mce
case "html":
switch($cont_type)
{
case "qpl":
// Question Pool *Question* Text (Test)
include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
if ($qinfo["original_id"] > 0)
{
include_once("./Modules/Test/classes/class.ilObjTest.php");
$obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
}
else
{
$obj_id = $qinfo["obj_fi"]; // usage in pool
}
break;
case "spl":
// Question Pool *Question* Text (Survey)
include_once("./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
if ($quest)
{
$parent_id = $quest->getObjId();
// pool question copy - find survey, do not use pool itself
if ($quest->getOriginalId() &&
ilObject::_lookupType($parent_id) == "spl")
{
}
// original question (in pool or survey)
else
{
$obj_id = $parent_id;
}
unset($quest);
}
break;
case "exca":
// Exercise assignment
$returned_pk = $a_usage['id'];
// we are just checking against exercise object
include_once 'Modules/Exercise/classes/class.ilObjExercise.php';
break;
case "frm":
// Forum
$post_pk = $a_usage['id'];
include_once 'Modules/Forum/classes/class.ilForumPost.php';
include_once 'Modules/Forum/classes/class.ilForum.php';
$oPost = new ilForumPost($post_pk);
$frm_pk = $oPost->getForumId();
$obj_id = ilForum::_lookupObjIdForForumId($frm_pk);
break;
// temporary items (per user)
case "frm~":
case "exca~":
$obj_id = $a_usage['id'];
break;
// "old" category pages
case "cat":
// InfoScreen Text
case "tst":
case "svy":
// data collection
case "dcl":
$obj_id = $id;
break;
}
break;
// page editor
case "pg":
switch($cont_type)
{
// question feedback // parent obj id is q id
case "qfbg":
include_once('./Services/COPage/classes/class.ilPageObject.php');
// note: no break here, we only altered the $id to the question id
case "qpl":
// Question Pool Question Pages
include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
if ($qinfo["original_id"] > 0)
{
include_once("./Modules/Test/classes/class.ilObjTest.php");
$obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id); // usage in test
}
else
{
$obj_id = $qinfo["obj_fi"]; // usage in pool
}
if ($obj_id == 0) // this is the case, if question is in learning module -> get lm id
{
include_once("./Services/COPage/classes/class.ilPCQuestion.php");
if ($pinfo && $pinfo["parent_type"] == "lm")
{
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
$obj_id = ilLMObject::_lookupContObjID($pinfo["page_id"]);
}
if ($pinfo && $pinfo["parent_type"] == "sahs")
{
include_once("./Modules/SCORM2004/classes/class.ilSCORM2004Node.php");
$obj_id = ilSCORM2004Node::_lookupSLMID($pinfo["page_id"]);
}
}
break;
case "lm":
case "dbk":
// learning modules
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
break;
case "gdf":
// glossary definition
include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
$obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
break;
case "wpg":
// wiki page
include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
break;
case "sahs":
// sahs page
// can this implementation be used for other content types, too?
include_once('./Services/COPage/classes/class.ilPageObject.php');
$obj_id = ilPageObject::lookupParentId($id, 'sahs');
break;
case "prtf":
// portfolio
include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
break;
case "prtt":
// portfolio template
include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
break;
case "blp":
// blog
include_once('./Services/COPage/classes/class.ilPageObject.php');
$obj_id = ilPageObject::lookupParentId($id, 'blp');
break;
case "impr":
// imprint page - always id 1
// fallthrough
case "crs":
case "grp":
case "cat":
case "fold":
case "root":
case "cont":
case "cstr":
// repository pages
$obj_id = $id;
break;
}
break;
// Media Pool
case "mep":
$obj_id = $id;
break;
// News Context Object (e.g. MediaCast)
case "news":
include_once("./Services/News/classes/class.ilNewsItem.php");
break;
}
return $obj_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::getRefId ( )

get reference id public

Returns
integer reference id

Reimplemented from ilObject.

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

{
return false;
}
static ilObjMediaObject::getRestrictedFileTypes ( )
static

Get restricted file types.

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

References $t.

Referenced by ilObjMediaObjectGUI\initForm().

{
$mset = new ilSetting("mobs");
$str = $mset->get("restricted_file_types");
$types = explode(",", $str);
$suffixes = array();
if (count($types) > 0)
{
foreach ($types as $k => $t)
{
if (($s = strtolower(trim($t))) != "")
{
$suffixes[] = $s;
}
}
}
return $suffixes;
}

+ Here is the caller graph for this function:

ilObjMediaObject::getSrtFiles ( )

Get srt files.

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

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

Referenced by getXML().

{
$srt_dir = ilObjMediaObject::_getDirectory($this->getId())."/srt";
if (!is_dir($srt_dir))
{
return array();
}
$items = ilUtil::getDir($srt_dir);
$srt_files = array();
foreach ($items as $i)
{
if (!in_array($i["entry"], array(".", "..")) && $i["type"] == "file")
{
$name = explode(".", $i["entry"]);
if ($name[1] == "srt" && substr($name[0], 0, 9) == "subtitle_")
{
$srt_files[] = array("file" => $i["entry"],
"full_path" => "srt/".$i["entry"], "language" => substr($name[0], 9, 2));
}
}
}
return $srt_files;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References _getThumbnailDirectory().

Referenced by ilPCIIMOverlaysTableGUI\fillRow().

{
return $t_dir."/".$a_thumbname;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::getTitle ( )

get object title public

Returns
string object title

Reimplemented from ilObject.

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

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

{
return parent::getTitle();
}

+ Here is the caller graph for this function:

ilObjMediaObject::getUsages (   $a_include_history = true)

get all usages of current media object

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

References getId(), and lookupUsages().

Referenced by delete(), and handleQuotaUpdate().

{
return $this->lookupUsages($this->getId(), $a_include_history);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::getVideoPreviewPic (   $a_filename_only = false)

Get video preview pic.

Parameters
@return

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

References _getDirectory(), and getId().

Referenced by ilObjMediaCastGUI\getCastItemValues().

{
$ppics = array("mob_vpreview.jpg",
"mob_vpreview.jpeg",
"mob_vpreview.png");
foreach ($ppics as $p)
{
if (is_file($dir."/".$p))
{
if ($a_filename_only)
{
return $p;
}
else
{
return $dir."/".$p;
}
}
}
return "";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

get MediaObject XLM Tag

Parameters
int$a_modeIL_MODE_ALIAS | IL_MODE_OUTPUT | IL_MODE_FULL

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

References $ilUser, $media_items, getId(), getMediaItems(), getSrtFiles(), ilObject\getType(), handleAmps(), IL_MODE_ALIAS, IL_MODE_FULL, and IL_MODE_OUTPUT.

Referenced by exportMediaFullscreen(), and exportXML().

{
global $ilUser;
// TODO: full implementation of all parameters
//echo "-".$a_mode."-";
switch ($a_mode)
{
$xml = "<MediaObject>";
$xml .= "<MediaAlias OriginId=\"il__mob_".$this->getId()."\"/>";
for($i=0; $i<count($media_items); $i++)
{
$item =& $media_items[$i];
$xml .= "<MediaAliasItem Purpose=\"".$item->getPurpose()."\">";
// Layout
$width = ($item->getWidth() != "")
? "Width=\"".$item->getWidth()."\""
: "";
$height = ($item->getHeight() != "")
? "Height=\"".$item->getHeight()."\""
: "";
$halign = ($item->getHAlign() != "")
? "HorizontalAlign=\"".$item->getHAlign()."\""
: "";
$xml .= "<Layout $width $height $halign />";
// Caption
if ($item->getCaption() != "")
{
$xml .= "<Caption Align=\"bottom\">".
str_replace("&", "&amp;", $item->getCaption())."</Caption>";
}
// Text Representation
if ($item->getTextRepresentation() != "")
{
$xml .= "<TextRepresentation>".
str_replace("&", "&amp;", $item->getTextRepresentation())."</TextRepresentation>";
}
// Parameter
$parameters = $item->getParameters();
foreach ($parameters as $name => $value)
{
$xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
}
$xml .= $item->getMapAreasXML();
$xml .= "</MediaAliasItem>";
}
break;
// for output we need technical sections of meta data
// get first technical section
// $meta =& $this->getMetaData();
$xml = "<MediaObject Id=\"il__mob_".$this->getId()."\">";
for($i=0; $i<count($media_items); $i++)
{
$item =& $media_items[$i];
$xml .= "<MediaItem Purpose=\"".$item->getPurpose()."\">";
// Location
$xml.= "<Location Type=\"".$item->getLocationType()."\">".
$this->handleAmps($item->getLocation())."</Location>";
// Format
$xml.= "<Format>".$item->getFormat()."</Format>";
// Layout
$width = ($item->getWidth() != "")
? "Width=\"".$item->getWidth()."\""
: "";
$height = ($item->getHeight() != "")
? "Height=\"".$item->getHeight()."\""
: "";
$halign = ($item->getHAlign() != "")
? "HorizontalAlign=\"".$item->getHAlign()."\""
: "";
$xml .= "<Layout $width $height $halign />";
// Caption
if ($item->getCaption() != "")
{
$xml .= "<Caption Align=\"bottom\">".
str_replace("&", "&amp;", $item->getCaption())."</Caption>";
}
// Text Representation
if ($item->getTextRepresentation() != "")
{
$xml .= "<TextRepresentation>".
str_replace("&", "&amp;", $item->getTextRepresentation())."</TextRepresentation>";
}
// Parameter
$parameters = $item->getParameters();
foreach ($parameters as $name => $value)
{
$xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
}
$xml .= $item->getMapAreasXML();
// Subtitles
if ($item->getPurpose() == "Standard")
{
$srts = $this->getSrtFiles();
foreach ($srts as $srt)
{
$def = "";
$meta_lang = "";
if ($ilUser->getLanguage() != $meta_lang &&
$ilUser->getLanguage() == $srt["language"])
{
$def = ' Default="true" ';
}
$xml .= "<Subtitle File=\"".$srt["full_path"].
"\" Language=\"".$srt["language"]."\" ".$def."/>";
}
}
$xml .= "</MediaItem>";
}
break;
// full xml for export
// $meta =& $this->getMetaData();
$xml = "<MediaObject>";
// meta data
include_once("Services/MetaData/classes/class.ilMD2XML.php");
$md2xml = new ilMD2XML(0, $this->getId(), $this->getType());
$md2xml->setExportMode(true);
$md2xml->startExport();
$xml.= $md2xml->getXML();
for($i=0; $i<count($media_items); $i++)
{
$item =& $media_items[$i];
// highlight mode
$xml .= "<MediaItem Purpose=\"".$item->getPurpose()."\">";
// Location
$xml.= "<Location Type=\"".$item->getLocationType()."\">".
$this->handleAmps($item->getLocation())."</Location>";
// Format
$xml.= "<Format>".$item->getFormat()."</Format>";
// Layout
$width = ($item->getWidth() != "")
? "Width=\"".$item->getWidth()."\""
: "";
$height = ($item->getHeight() != "")
? "Height=\"".$item->getHeight()."\""
: "";
$halign = ($item->getHAlign() != "")
? "HorizontalAlign=\"".$item->getHAlign()."\""
: "";
$xml .= "<Layout $width $height $halign />";
// Caption
if ($item->getCaption() != "")
{
$xml .= "<Caption Align=\"bottom\">".
str_replace("&", "&amp;", $item->getCaption())."</Caption>";
}
// Text Representation
if ($item->getTextRepresentation() != "")
{
$xml .= "<TextRepresentation>".
str_replace("&", "&amp;", $item->getTextRepresentation())."</TextRepresentation>";
}
// Parameter
$parameters = $item->getParameters();
foreach ($parameters as $name => $value)
{
$xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
}
$xml .= $item->getMapAreasXML(true, $a_inst);
$xml .= "</MediaItem>";
}
break;
}
$xml .= "</MediaObject>";
return $xml;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::handleAmps (   $a_str)

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

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

Referenced by getXML().

{
$a_str = str_replace("&amp;", "&", $a_str);
$a_str = str_replace("&", "&amp;", $a_str);
return $a_str;
}

+ Here is the caller graph for this function:

static ilObjMediaObject::handleQuotaUpdate ( ilObjMediaObject  $a_mob)
staticprotected

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

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

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

{
global $ilSetting;
// if neither workspace nor portfolios are activated, we skip
// the quota update here. this due to performance reasons on installations
// that do not use workspace/portfolios, but heavily copy content.
// in extreme cases (media object in pool and personal blog, deactivate workspace, change media object,
// this may lead to incorrect data in the quota calculation)
if ($ilSetting->get("disable_personal_workspace") && !$ilSetting->get('user_portfolios'))
{
return;
}
$parent_obj_ids = array();
foreach($a_mob->getUsages() as $item)
{
$parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
if($parent_obj_id &&
!in_array($parent_obj_id, $parent_obj_ids))
{
$parent_obj_ids[]= $parent_obj_id;
}
}
// we could suppress this if object is present in a (repository) media pool
// but this would lead to "quota-breaches" when the pool item is deleted
// and "suddenly" all workspace owners get filesize added to their
// respective quotas, regardless of current status
include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
$a_mob->getId(),
ilUtil::dirSize($a_mob->getDataDirectory()),
$parent_obj_ids);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::hasFullscreenItem ( )

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

References hasPurposeItem().

{
return $this->hasPurposeItem("Fullscreen");
}

+ Here is the call graph for this function:

ilObjMediaObject::hasPurposeItem (   $purpose)

returns wether object has media item with specific purpose

Parameters
string$purpose
Returns
boolean

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

References getMediaItem().

Referenced by hasFullscreenItem().

{
if(is_object($this->getMediaItem($purpose)))
{
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::ilObjMediaObject (   $a_id = 0)

Constructor public.

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

References ilObject\ilObject().

Referenced by _saveTempFileAsMediaObject(), and duplicate().

{
$this->is_alias = false;
$this->media_items = array();
$this->contains_int_link = false;
$this->type = "mob";
parent::ilObject($a_id, false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::isAlias ( )

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

References $is_alias.

{
}
ilObjMediaObject::lookupUsages (   $a_id,
  $a_include_history = true 
)

Lookup usages of media object.

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

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

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

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

{
global $ilDB;
$hist_str = "";
if ($a_include_history)
{
$hist_str = ", usage_hist_nr";
}
// get usages in pages
$q = "SELECT DISTINCT usage_type, usage_id, usage_lang".$hist_str." FROM mob_usage WHERE id = ".
$ilDB->quote($a_id, "integer");
if (!$a_include_history)
{
$q.= " AND usage_hist_nr = ".$ilDB->quote(0, "integer");
}
$us_set = $ilDB->query($q);
$ret = array();
while($us_rec = $ilDB->fetchAssoc($us_set))
{
$ut = "";
if(is_int(strpos($us_rec["usage_type"], ":")))
{
$us_arr = explode(":", $us_rec["usage_type"]);
$ut = $us_arr[1];
$ct = $us_arr[0];
}
// check whether page exists
$skip = false;
if ($ut == "pg")
{
include_once("./Services/COPage/classes/class.ilPageObject.php");
if (!ilPageObject::_exists($ct, $us_rec["usage_id"]))
{
$skip = true;
}
}
if (!$skip)
{
$ret[] = array("type" => $us_rec["usage_type"],
"id" => $us_rec["usage_id"],
"lang" => $us_rec["usage_lang"],
"hist_nr" => $us_rec["usage_hist_nr"]);
}
}
// get usages in media pools
$q = "SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = ".
$ilDB->quote($a_id, "integer")." AND mep_item.type = ".$ilDB->quote("mob", "text");
$us_set = $ilDB->query($q);
while($us_rec = $ilDB->fetchAssoc($us_set))
{
$ret[] = array("type" => "mep",
"id" => $us_rec["mep_id"]);
}
// get usages in news items (media casts)
include_once("./Services/News/classes/class.ilNewsItem.php");
$news_usages = ilNewsItem::_lookupMediaObjectUsages($a_id);
foreach($news_usages as $nu)
{
$ret[] = $nu;
}
// get usages in map areas
$q = "SELECT DISTINCT mob_id FROM media_item it, map_area area ".
" WHERE area.item_id = it.id ".
" AND area.link_type = ".$ilDB->quote("int", "text")." ".
" AND area.target = ".$ilDB->quote("il__mob_".$a_id, "text");
$us_set = $ilDB->query($q);
while($us_rec = $ilDB->fetchAssoc($us_set))
{
$ret[] = array("type" => "map",
"id" => $us_rec["mob_id"]);
}
// get usages in personal clipboards
$users = ilObjUser::_getUsersForClipboadObject("mob", $a_id);
foreach ($users as $user)
{
$ret[] = array("type" => "clip",
"id" => $user);
}
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Make thumbnail.

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

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

{
ilUtil::convertImage($m_dir."/".$a_file,
$t_dir."/".$a_thumbname, $a_format, $a_size);
}

+ Here is the call graph for this function:

ilObjMediaObject::MDUpdateListener (   $a_element)

Meta data update listener.

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

Parameters
string$a_element

Reimplemented from ilObject.

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

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

{
include_once 'Services/MetaData/classes/class.ilMD.php';
switch($a_element)
{
case 'General':
// Update Title and description
$md = new ilMD(0, $this->getId(), $this->getType());
$md_gen = $md->getGeneral();
if (is_object($md_gen))
{
ilObject::_writeTitle($this->getId(),$md_gen->getTitle());
$this->setTitle($md_gen->getTitle());
foreach($md_gen->getDescriptionIds() as $id)
{
$md_des = $md_gen->getDescription($id);
ilObject::_writeDescription($this->getId(),$md_des->getDescription());
$this->setDescription($md_des->getDescription());
break;
}
}
break;
default:
}
return true;
}

+ Here is the call graph for this function:

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

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

References ilUtil\insertInstIntoID().

{
if ($a_tag == "Identifier" && $a_param == "Entry")
{
$a_value = ilUtil::insertInstIntoID($a_value);
}
return $a_value;
}

+ Here is the call graph for this function:

ilObjMediaObject::putInTree ( )

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

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

read media object data from db

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

References ilMediaItem\_getMediaItemsOfMOb().

{
//echo "<br>ilObjMediaObject:read";
// get media items
}

+ Here is the call graph for this function:

ilObjMediaObject::removeAdditionalFile (   $a_file)

Remove additional file.

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

References $file, _getDirectory(), and getId().

{
$file = str_replace("..", "", $a_file);
if (is_file($file))
{
unlink($file);
}
}

+ Here is the call graph for this function:

ilObjMediaObject::removeAllMediaItems ( )

remove all media items

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

{
$this->media_items = array();
}
ilObjMediaObject::removeMediaItem (   $a_purpose)

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

References $media_items, and getId().

{
foreach ($this->media_items as $key => $media_item)
{
if($media_item->getPurpose() == $a_purpose)
{
unset($this->media_items[$key]);
}
}
// update numbers and keys
$i = 1;
$media_items = array();
foreach ($this->media_items as $media_item)
{
$media_items [$i] = $media_item;
$media_item->setMobId($this->getId());
$media_item->setNr($i);
$i++;
}
$this->media_items = $media_items;
}

+ Here is the call graph for this function:

ilObjMediaObject::setAlias (   $a_is_alias)

set wether page object is an alias

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

{
$this->is_alias = $a_is_alias;
}
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 984 of file class.ilObjMediaObject.php.

{
$this->contains_int_link = $a_contains_link;
}
ilObjMediaObject::setDescription (   $a_description)

set description of media object

Reimplemented from ilObject.

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

Referenced by MDUpdateListener().

{
parent::setDescription($a_description);
}

+ Here is the caller graph for this function:

ilObjMediaObject::setId (   $a_id)

set id

Reimplemented from ilObject.

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

{
$this->id = $a_id;
}
ilObjMediaObject::setImportId (   $a_import_id)

set import id

public

Parameters
string$a_import_idimport id

Reimplemented from ilObject.

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

{
$this->import_id = $a_id;
}
ilObjMediaObject::setOriginID (   $a_id)

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

{
return $this->origin_id = $a_id;
}
ilObjMediaObject::setRefId ( )

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

{
$this->ilias->raiseError("Operation ilObjMedia::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
}
ilObjMediaObject::setTitle (   $a_title)

set object title

public

Parameters
string$a_titleobject title

Reimplemented from ilObject.

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

Referenced by MDUpdateListener().

{
parent::setTitle($a_title);
}

+ Here is the caller graph for this function:

ilObjMediaObject::update (   $a_upload = false)

update media object in db

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

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

{
if(!$a_upload)
{
$this->updateMetaData();
}
// iterate all items
$j = 1;
foreach($media_items as $key => $val)
{
$item =& $media_items[$key];
if (is_object($item))
{
$item->setMobId($this->getId());
$item->setNr($j);
if ($item->getLocationType() == "Reference")
{
$item->extractUrlParameters();
}
$item->create();
$j++;
}
}
global $ilAppEventHandler;
$ilAppEventHandler->raise('Services/MediaObjects',
'update',
array('object' => $this,
'obj_type' => 'mob',
'obj_id' => $this->getId())
);
}

+ Here is the call graph for this function:

ilObjMediaObject::updateMetaData ( )

update meta data entry

Reimplemented from ilObject.

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

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

Referenced by update().

{
include_once("Services/MetaData/classes/class.ilMD.php");
include_once("Services/MetaData/classes/class.ilMDGeneral.php");
include_once("Services/MetaData/classes/class.ilMDDescription.php");
$md =& new ilMD(0, $this->getId(), $this->getType());
$md_gen =& $md->getGeneral();
$md_gen->setTitle($this->getTitle());
// sets first description (maybe not appropriate)
$md_des_ids =& $md_gen->getDescriptionIds();
if (count($md_des_ids) > 0)
{
$md_des =& $md_gen->getDescription($md_des_ids[0]);
$md_des->setDescription($this->getDescription());
$md_des->update();
}
$md_gen->update();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

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

Referenced by uploadSrtFile(), and uploadVideoPreviewPic().

{
$a_subdir = str_replace("..", "", $a_subdir);
$dir = $mob_dir = ilObjMediaObject::_getDirectory($this->getId());
if ($a_subdir != "")
{
$dir.= "/".$a_subdir;
}
ilUtil::moveUploadedFile($tmp_name, $a_name, $dir."/".$a_name);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaObject::uploadSrtFile (   $a_tmp_name,
  $a_language 
)

Upload srt file.

Parameters
@return

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

References uploadAdditionalFile().

{
if (is_file($a_tmp_name) && $a_language != "")
{
$this->uploadAdditionalFile("subtitle_".$a_language.".srt", $a_tmp_name, "srt");
return true;
}
return false;
}

+ Here is the call graph for this function:

ilObjMediaObject::uploadVideoPreviewPic (   $a_prevpic)

Upload video preview picture.

Parameters
@return

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

References uploadAdditionalFile().

{
$pi = pathinfo($a_prevpic["name"]);
$ext = $pi["extension"];
if (in_array($ext, array("jpg", "jpeg", "png")))
{
$this->uploadAdditionalFile("mob_vpreview.".$ext, $a_prevpic["tmp_name"]);
}
}

+ Here is the call graph for this function:

Field Documentation

ilObjMediaObject::$contains_int_link

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

Referenced by containsIntLink().

ilObjMediaObject::$id

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

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

ilObjMediaObject::$is_alias

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

Referenced by isAlias().

ilObjMediaObject::$media_items

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

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

ilObjMediaObject::$origin_id

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

Referenced by getOriginID().


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