Public Member Functions | Data Fields

ilObjMediaObject Class Reference

Inheritance diagram for ilObjMediaObject:
Collaboration diagram for ilObjMediaObject:

Public Member Functions

 ilObjMediaObject ($a_id=0, $a_call_by_reference=false)
 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
 assignMetaData (&$a_meta_data)
 assign meta data object
getMetaData ()
 get meta data object
 create ()
 create
 update ()
 update object in db
 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
 _exists ($a_id)
 checks wether a lm content object with specified id exists or not
 delete ()
 delete media object
 getDescription ()
 get description of media object
 setDescription ($a_description)
 set description of media object
 assignMetaData (&$a_meta_data)
 assign meta data object
getMetaData ()
 get meta data object
 addMediaItem (&$a_item)
 add media item to media object
getMediaItems ()
 get all media items
getMediaItem ($a_purpose)
 removeMediaItem ($a_purpose)
 getMediaItemNr ($a_purpose)
 hasFullscreenItem ()
 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 ()
 create media object in db
 initMeta ()
 init meta data object if needed
 updateMetaData ()
 update meta data only
 update ()
 update media object in db
 _getDirectory ($a_mob_id)
 get directory for files of media object (static)
 createDirectory ()
 create file directory of media object
 getXML ($a_mode=IL_MODE_FULL, $a_inst=0)
 get MediaObject XLM Tag
 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
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 setDom (&$a_dom)
 set dom object
 setNode ($a_node)
 set PageContent node
getNode ()
 get PageContent node
 setHierId ($a_hier_id)
 set hierarchical edit id
 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)
 createAlias (&$a_pg_obj, $a_hier_id)
 _deleteAllUsages ($a_type, $a_id)
 static
 _getMobsOfObject ($a_type, $a_id)
 get mobs of object
 _saveUsage ($a_mob_id, $a_type, $a_id)
 getUsages ()
 get all usages of current media object
 getMimeType ($a_file)
 get mime type for file
 getExt2MimeMap ()
 get file extension to mime type map
 getDataDirectory ()

Data Fields

 $meta_data
 $is_alias
 $origin_id
 $id
 $dom
 $hier_id
 $node
 $mob_node
 $media_items
 $contains_int_link

Detailed Description

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


Member Function Documentation

ilObjMediaObject::_deleteAllUsages ( a_type,
a_id 
)

static

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

References $ilDB, and $q.

Referenced by ilPageObject::saveMobUsage().

        {
                global $ilDB;
                
                $q = "DELETE FROM mob_usage WHERE usage_type='$a_type' AND usage_id='$a_id'";
                $ilDB->query($q);
        }

Here is the caller graph for this function:

ilObjMediaObject::_exists ( a_id  ) 

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

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

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

References $ilDB, and ilInternalLink::_extractObjIdOfTarget().

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

Here is the call graph for this function:

ilObjMediaObject::_getDirectory ( a_mob_id  ) 

get directory for files of media object (static)

Parameters:
int $a_mob_id media object id

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

References ilUtil::getWebspaceDir().

Referenced by ilPCMediaObjectGUI::create(), createDirectory(), delete(), ilMediaItem::getDirectory(), ilObjMediaObjectGUI::getFullscreenSizeObject(), ilObjMediaObjectGUI::getStandardSizeObject(), ilObjMediaObjectGUI::saveObject(), and ilObjMediaObjectGUI::savePropertiesObject().

        {
                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 
)

get mobs of object

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

References $ilDB, and $q.

Referenced by ilObjContentObject::exportHTMLGlossaryTerms(), and ilObjContentObject::exportHTMLPages().

        {
                global $ilDB;
                
                $q = "SELECT * FROM mob_usage WHERE ".
                        "usage_type = ".$ilDB->quote($a_type)." AND ".
                        "usage_id = ".$ilDB->quote($a_id);
                $mobs = array();
                $mob_set = $ilDB->query($q);
                while($mob_rec = $mob_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $mobs[$mob_rec["id"]] = $mob_rec["id"];
                }
                return $mobs;
        }

Here is the caller graph for this function:

ilObjMediaObject::_saveUsage ( a_mob_id,
a_type,
a_id 
)

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

References $ilDB, and $q.

Referenced by ilPageObject::saveMobUsage().

        {
                global $ilDB;
                
                $q = "REPLACE INTO mob_usage (id, usage_type, usage_id) VALUES".
                        " ('$a_mob_id', '$a_type', '$a_id')";
                $ilDB->query($q);
        }

Here is the caller graph for this function:

ilObjMediaObject::addMediaItem ( &$  a_item  ) 

add media item to media object

Parameters:
object $a_item media item object

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

        {
                $this->media_items[] =& $a_item;
        }

ilObjMediaObject::assignMetaData ( &$  a_meta_data  ) 

assign meta data object

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

Referenced by initMeta().

        {
                $this->meta_data =& $a_meta_data;
                $a_meta_data->setObject($this);
        }

Here is the caller graph for this function:

ilObjMediaObject::assignMetaData ( &$  a_meta_data  ) 

assign meta data object

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

        {
                $this->meta_data =& $a_meta_data;
                $a_meta_data->setObject($this);
        }

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

        {
                return $this->contains_int_link;
        }

ilObjMediaObject::create (  ) 

create

note: title, description and type should be set when this function is called

public

Returns:
integer object id

Reimplemented from ilObject.

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

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

Referenced by create().

        {
                parent::create();

                // create meta data
//echo "<b>CREATING OBJMEDIA</b>:".$this->getId().":<br>";
                $this->meta_data->setId($this->getId());
                $this->meta_data->setType($this->getType());
                $this->meta_data->create();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjMediaObject::create (  ) 

create media object in db

Reimplemented from ilObject.

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

References $media_items, create(), getId(), getMediaItems(), and ilObject::getType().

        {
                parent::create();

                // create meta data
                $this->meta_data->setId($this->getId());
                $this->meta_data->setType($this->getType());
                $this->meta_data->create();
                $this->meta_data->getDom();
                $media_items =& $this->getMediaItems();
                for($i=0; $i<count($media_items); $i++)
                {
                        $item =& $media_items[$i];
                        $item->setMobId($this->getId());
                        $item->setNr($i+1);
                        $item->create();
                }

        }

Here is the call graph for this function:

ilObjMediaObject::createAlias ( &$  a_pg_obj,
a_hier_id 
)

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

References getId(), and getMediaItem().

        {
                $this->node =& $this->dom->create_element("PageContent");
                $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER);
                $this->mob_node =& $this->dom->create_element("MediaObject");
                $this->mob_node =& $this->node->append_child($this->mob_node);
                $this->mal_node =& $this->dom->create_element("MediaAlias");
                $this->mal_node =& $this->mob_node->append_child($this->mal_node);
                $this->mal_node->set_attribute("OriginId", "il__mob_".$this->getId());

                // standard view
                $item_node =& $this->dom->create_element("MediaAliasItem");
                $item_node =& $this->mob_node->append_child($item_node);
                $item_node->set_attribute("Purpose", "Standard");
                $media_item =& $this->getMediaItem("Standard");

                $layout_node =& $this->dom->create_element("Layout");
                $layout_node =& $item_node->append_child($layout_node);
                if ($media_item->getWidth() > 0)
                {
                        $layout_node->set_attribute("Width", $media_item->getWidth());
                }
                if ($media_item->getHeight() > 0)
                {
                        $layout_node->set_attribute("Height", $media_item->getHeight());
                }
                $layout_node->set_attribute("HorizontalAlign", "Left");

                // caption
                if ($media_item->getCaption() != "")
                {
                        $cap_node =& $this->dom->create_element("Caption");
                        $cap_node =& $item_node->append_child($cap_node);
                        $cap_node->set_attribute("Align", "bottom");
                        $cap_node->set_content($media_item->getCaption());
                }

                $pars = $media_item->getParameters();
                foreach($pars as $par => $val)
                {
                        $par_node =& $this->dom->create_element("Parameter");
                        $par_node =& $item_node->append_child($par_node);
                        $par_node->set_attribute("Name", $par);
                        $par_node->set_attribute("Value", $val);
                }

                // fullscreen view
                $fullscreen_item =& $this->getMediaItem("Fullscreen");
                if (is_object($fullscreen_item))
                {
                        $item_node =& $this->dom->create_element("MediaAliasItem");
                        $item_node =& $this->mob_node->append_child($item_node);
                        $item_node->set_attribute("Purpose", "Fullscreen");

                        // width and height
                        $layout_node =& $this->dom->create_element("Layout");
                        $layout_node =& $item_node->append_child($layout_node);
                        if ($fullscreen_item->getWidth() > 0)
                        {
                                $layout_node->set_attribute("Width", $fullscreen_item->getWidth());
                        }
                        if ($fullscreen_item->getHeight() > 0)
                        {
                                $layout_node->set_attribute("Height", $fullscreen_item->getHeight());
                        }

                        // caption
                        if ($fullscreen_item->getCaption() != "")
                        {
                                $cap_node =& $this->dom->create_element("Caption");
                                $cap_node =& $item_node->append_child($cap_node);
                                $cap_node->set_attribute("Align", "bottom");
                                $cap_node->set_content($fullscreen_item->getCaption());
                        }

                        $pars = $fullscreen_item->getParameters();
                        foreach($pars as $par => $val)
                        {
                                $par_node =& $this->dom->create_element("Parameter");
                                $par_node =& $item_node->append_child($par_node);
                                $par_node->set_attribute("Name", $par);
                                $par_node->set_attribute("Value", $val);
                        }
                }
        }

Here is the call graph for this function:

ilObjMediaObject::createDirectory (  ) 

create file directory of media object

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

References _getDirectory(), and getId().

Here is the call graph for this function:

ilObjMediaObject::createReference (  ) 

creates reference for object

public

Returns:
integer reference_id of object

Reimplemented from ilObject.

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

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

ilObjMediaObject::createReference (  ) 

creates reference for object

public

Returns:
integer reference_id of object

Reimplemented from ilObject.

Definition at line 73 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 135 of file class.ilObjMediaObject.php.

References _getDirectory(), ilUtil::delDir(), ilMediaItem::deleteAllItemsOfMob(), getId(), ilObject::getType(), and getUsages().

        {
                $usages = $this->getUsages();

                if (count($usages) == 0)
                {
                        // remove directory
                        ilUtil::delDir(ilObjMediaObject::_getDirectory($this->getId()));

                        // delete meta data of mob
                        $nested = new ilNestedSetXML();
                        $nested->init($this->getId(), $this->getType());
                        $nested->deleteAllDBData();

                        // delete media items
                        ilMediaItem::deleteAllItemsOfMob($this->getId());

                        // delete object
                        parent::delete();
                }
        }

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_dir target directory

Definition at line 644 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::exportXML ( &$  a_xml_writer,
a_inst = 0 
)

export XML

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

References getXML().

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

Here is the call graph for this function:

ilObjMediaObject::getDataDirectory (  ) 

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

References ilUtil::getWebspaceDir().

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

Here is the call graph for this function:

ilObjMediaObject::getDescription (  ) 

get description of media object

Returns:
string description

Reimplemented from ilObject.

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

        {
                return parent::getDescription();
                return $this->meta_data->getDescription();
        }

ilObjMediaObject::getExt2MimeMap (  ) 

get file extension to mime type map

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

Referenced by getMimeType().

        {
                $types_map = array (
                        '.a'      => 'application/octet-stream',
                        '.ai'     => 'application/postscript',
                        '.aif'    => 'audio/x-aiff',
                        '.aifc'   => 'audio/x-aiff',
                        '.aiff'   => 'audio/x-aiff',
                        '.asd'    => 'application/astound',
                        '.asf'    => 'video/x-ms-asf',
                        '.asn'    => 'application/astound',
                        '.asx'    => 'video/x-ms-asf',
                        '.au'     => 'audio/basic',
                        '.avi'    => 'video/x-msvideo',
                        '.bat'    => 'text/plain',
                        '.bcpio'  => 'application/x-bcpio',
                        '.bin'    => 'application/octet-stream',
                        '.bmp'    => 'image/x-ms-bmp',
                        '.c'      => 'text/plain',
                        '.cdf'    => 'application/x-cdf',
                        '.class'  => 'application/x-java-applet',
                        '.com'    => 'application/octet-stream',
                        '.cpio'   => 'application/x-cpio',
                        '.csh'    => 'application/x-csh',
                        '.css'    => 'text/css',
                        '.csv'    => 'text/comma-separated-values',
                        '.dcr'    => 'application/x-director',
                        '.dir'    => 'application/x-director',
                        '.dll'    => 'application/octet-stream',
                        '.doc'    => 'application/msword',
                        '.dot'    => 'application/msword',
                        '.dvi'    => 'application/x-dvi',
                        '.dwg'    => 'application/acad',
                        '.dxf'    => 'application/dxf',
                        '.dxr'    => 'application/x-director',
                        '.eml'    => 'message/rfc822',
                        '.eps'    => 'application/postscript',
                        '.etx'    => 'text/x-setext',
                        '.exe'    => 'application/octet-stream',
                        '.gif'    => 'image/gif',
                        '.gtar'   => 'application/x-gtar',
                        '.gz'     => 'application/gzip',
                        '.h'      => 'text/plain',
                        '.hdf'    => 'application/x-hdf',
                        '.htm'    => 'text/html',
                        '.html'   => 'text/html',
                        '.ief'    => 'image/ief',
                        '.iff'    => 'image/iff',
                        '.jar'    => 'application/x-java-applet',
                        '.jpe'    => 'image/jpeg',
                        '.jpeg'   => 'image/jpeg',
                        '.jpg'    => 'image/jpeg',
                        '.js'     => 'application/x-javascript',
                        '.ksh'    => 'text/plain',
                        '.latex'  => 'application/x-latex',
                        '.m1v'    => 'video/mpeg',
                        '.man'    => 'application/x-troff-man',
                        '.me'     => 'application/x-troff-me',
                        '.mht'    => 'message/rfc822',
                        '.mhtml'  => 'message/rfc822',
                        '.mid'    => 'audio/x-midi',
                        '.midi'   => 'audio/x-midi',
                        '.mif'    => 'application/x-mif',
                        '.mov'    => 'video/quicktime',
                        '.movie'  => 'video/x-sgi-movie',
                        '.mp2'    => 'audio/mpeg',
                        '.mp3'    => 'audio/mpeg',
                        '.mpa'    => 'video/mpeg',
                        '.mpe'    => 'video/mpeg',
                        '.mpeg'   => 'video/mpeg',
                        '.mpg'    => 'video/mpeg',
                        '.ms'     => 'application/x-troff-ms',
                        '.nc'     => 'application/x-netcdf',
                        '.nws'    => 'message/rfc822',
                        '.o'      => 'application/octet-stream',
                        '.obj'    => 'application/octet-stream',
                        '.oda'    => 'application/oda',
                        '.p12'    => 'application/x-pkcs12',
                        '.p7c'    => 'application/pkcs7-mime',
                        '.pbm'    => 'image/x-portable-bitmap',
                        '.pdf'    => 'application/pdf',
                        '.pfx'    => 'application/x-pkcs12',
                        '.pgm'    => 'image/x-portable-graymap',
                        '.php'    => 'application/x-httpd-php',
                        '.phtml'  => 'application/x-httpd-php',
                        '.pl'     => 'text/plain',
                        '.png'    => 'image/png',
                        '.pnm'    => 'image/x-portable-anymap',
                        '.pot'    => 'application/vnd.ms-powerpoint',
                        '.ppa'    => 'application/vnd.ms-powerpoint',
                        '.ppm'    => 'image/x-portable-pixmap',
                        '.pps'    => 'application/vnd.ms-powerpoint',
                        '.ppt'    => 'application/vnd.ms-powerpoint',
                        '.ps'     => 'application/postscript',
                        '.psd'    => 'image/psd',
                        '.pwz'    => 'application/vnd.ms-powerpoint',
                        '.py'     => 'text/x-python',
                        '.pyc'    => 'application/x-python-code',
                        '.pyo'    => 'application/x-python-code',
                        '.qt'     => 'video/quicktime',
                        '.ra'     => 'audio/x-pn-realaudio',
                        '.ram'    => 'application/x-pn-realaudio',
                        '.ras'    => 'image/x-cmu-raster',
                        '.rdf'    => 'application/xml',
                        '.rgb'    => 'image/x-rgb',
                        '.roff'   => 'application/x-troff',
                        '.rpm'    => 'audio/x-pn-realaudio-plugin',
                        '.rtf'    => 'application/rtf',
                        '.rtx'    => 'text/richtext',
                        '.sgm'    => 'text/x-sgml',
                        '.sgml'   => 'text/x-sgml',
                        '.sh'     => 'application/x-sh',
                        '.shar'   => 'application/x-shar',
                        '.sit'    => 'application/x-stuffit',
                        '.snd'    => 'audio/basic',
                        '.so'     => 'application/octet-stream',
                        '.spc'    => 'text/x-speech',
                        '.src'    => 'application/x-wais-source',
                        '.sv4cpio'=> 'application/x-sv4cpio',
                        '.sv4crc' => 'application/x-sv4crc',
                        '.svg'    => 'image/svg+xml',
                        '.swf'    => 'application/x-shockwave-flash',
                        '.t'      => 'application/x-troff',
                        '.tar'    => 'application/x-tar',
                        '.talk'   => 'text/x-speech',
                        '.tbk'    => 'application/toolbook',
                        '.tcl'    => 'application/x-tcl',
                        '.tex'    => 'application/x-tex',
                        '.texi'   => 'application/x-texinfo',
                        '.texinfo'=> 'application/x-texinfo',
                        '.tif'    => 'image/tiff',
                        '.tiff'   => 'image/tiff',
                        '.tr'     => 'application/x-troff',
                        '.tsv'    => 'text/tab-separated-values',
                        '.tsp'    => 'application/dsptype',
                        '.txt'    => 'text/plain',
                        '.ustar'  => 'application',
                        '.vcf'    => 'text/x-vcard',
                        '.vox'    => 'audio/voxware',
                        '.wav'    => 'audio/x-wav',
                        '.wax'    => 'audio/x-ms-wax',
                        '.wiz'    => 'application/msword',
                        '.wm'     => 'video/x-ms-wm',
                        '.wma'    => 'audio/x-ms-wma',
                        '.wmd'    => 'video/x-ms-wmd',
                        '.wml'    => 'text/vnd.wap.wml',
                        '.wmlc'   => 'application/vnd.wap.wmlc',
                        '.wmls'   => 'text/vnd.wap.wmlscript',
                        '.wmlsc'  => 'application/vnd.wap.wmlscriptc',
                        '.wmv'    => 'video/x-ms-wmv',
                        '.wmx'    => 'video/x-ms-wmx',
                        '.wmz'    => 'video/x-ms-wmz',
                        '.wvx'    => 'video/x-ms-wvx',
                        '.wrl'    => 'x-world/x-vrml',
                        '.xbm'    => 'image/x-xbitmap',
                        '.xla'    => 'application/msexcel',
                        '.xlb'    => 'application/vnd.ms-excel',
                        '.xls'    => 'application/msexcel',
                        '.xml'    => 'text/xml',
                        '.xpm'    => 'image/x-xpixmap',
                        '.xsl'    => 'application/xml',
                        '.xwd'    => 'image/x-xwindowdump',
                        '.zip'    => 'application/zip');

                return $types_map;
        }

Here is the caller graph for this function:

ilObjMediaObject::getId (  ) 

get object id public

Returns:
integer object id

Reimplemented from ilObject.

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

Referenced by create(), createAlias(), createDirectory(), delete(), exportFiles(), getUsages(), getXML(), initMeta(), read(), and update().

        {
                return $this->id;
        }

Here is the caller graph for this function:

ilObjMediaObject::getImportId (  ) 

get import id

Reimplemented from ilObject.

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

References isAlias().

        {
                if($this->isAlias())
                {
//echo "getting import id for mob alias:".$this->getOriginId().":<br>";
                        return $this->getOriginId();
                }
                else
                {
//echo "getting import id for mob:".$this->meta_data->getImportIdentifierEntryID().":<br>";
                        return $this->meta_data->getImportIdentifierEntryID();
                }
        }

Here is the call graph for this function:

& ilObjMediaObject::getMediaItem ( a_purpose  ) 

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

Referenced by createAlias(), and hasFullscreenItem().

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

Here is the caller graph for this function:

ilObjMediaObject::getMediaItemNr ( a_purpose  ) 

Definition at line 245 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 212 of file class.ilObjMediaObject.php.

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

        {
                return $this->media_items;
        }

Here is the caller graph for this function:

& ilObjMediaObject::getMetaData (  ) 

get meta data object

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

Referenced by getXML().

        {
                return $this->meta_data;
        }

Here is the caller graph for this function:

& ilObjMediaObject::getMetaData (  ) 

get meta data object

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

        {
                return $this->meta_data;
        }

ilObjMediaObject::getMimeType ( a_file  ) 

get mime type for file

Parameters:
string $a_file file name
Returns:
string mime type static

map of mimetypes.py from python.org (there was no author mentioned in the file)

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

References $path, $set, and getExt2MimeMap().

Referenced by ilObjMediaObjectGUI::assignFullscreenObject(), ilObjMediaObjectGUI::assignStandardObject(), ilPCMediaObjectGUI::create(), ilFileDataExercise::deliverFile(), ilObjUserGUI::insertPublicProfile(), ilObjMediaObjectGUI::saveObject(), ilObjMediaObjectGUI::savePropertiesObject(), ASS_OrderingQuestion::set_image_file(), and ASS_MatchingQuestion::set_image_file().

        {
                // check if mimetype detection enabled in php.ini
                $set = ini_get("mime_magic.magicfile");
                // get mimetype
                if ($set <> "")
                {
                        $mime = @mime_content_type($a_file);
                }

                if (empty($mime))
                {
                        $path = pathinfo($a_file);
                        $ext = ".".strtolower($path["extension"]);

                        $types_map = ilObjMediaObject::getExt2MimeMap();
                        $mime = $types_map[$ext];
                }

                // set default if mimetype detection failed or not possible (e.g. remote file)
                if (empty($mime))
                {
                        $mime = "application/octet-stream";
                }

                return $mime;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilObjMediaObject::getNode (  ) 

get PageContent node

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

        {
                return $this->node;
        }

ilObjMediaObject::getOriginID (  ) 

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

        {
                return $this->origin_id;
        }

ilObjMediaObject::getRefId (  ) 

get reference id public

Returns:
integer reference id

Reimplemented from ilObject.

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

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

ilObjMediaObject::getRefId (  ) 

get reference id public

Returns:
integer reference id

Reimplemented from ilObject.

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

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

ilObjMediaObject::getTitle (  ) 

get object title public

Returns:
string object title

Reimplemented from ilObject.

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

References getTitle().

        {
                return parent::getTitle();
                if (is_object($this->meta_data))
                {
                        return $this->meta_data->getTitle();
                }
        }

Here is the call graph for this function:

ilObjMediaObject::getTitle (  ) 

get object title public

Returns:
string object title

Reimplemented from ilObject.

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

References ilObject::$title.

Referenced by getTitle().

        {
                $title = ($this->meta_data->getTitle() == "NO TITLE")
                        ? $this->title
                        : $this->meta_data->getTitle();

                return $title;
        }

Here is the caller graph for this function:

ilObjMediaObject::getUsages (  ) 

get all usages of current media object

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

References $ilDB, $q, $user, $users, ilObjUser::_getUsersForClipboadObject(), and getId().

Referenced by delete().

        {
                global $ilDB;

                // get usages in learning modules
                $q = "SELECT * FROM mob_usage WHERE id = '".$this->getId()."'";
                $us_set = $ilDB->query($q);
                $ret = array();
                while($us_rec = $us_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $ret[] = array("type" => $us_rec["usage_type"],
                                "id" => $us_rec["usage_id"]);
                }

                // get usages in media pools
                $q = "SELECT DISTINCT mep_id FROM mep_tree WHERE child = '".$this->getId()."'";
                $us_set = $ilDB->query($q);
                while($us_rec = $us_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $ret[] = array("type" => "mep",
                                "id" => $us_rec["mep_id"]);
                }

                // get usages in map areas
                $q = "SELECT DISTINCT mob_id FROM media_item as it, map_area as area ".
                        " WHERE area.item_id = it.id ".
                        " AND area.link_type='int' ".
                        " AND area.target = 'il__mob_".$this->getId()."'";
                $us_set = $ilDB->query($q);
                while($us_rec = $us_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $ret[] = array("type" => "map",
                                "id" => $us_rec["mob_id"]);
                }

                // get usages in personal clipboards
                $users = ilObjUser::_getUsersForClipboadObject("mob", $this->getId());
                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::getXML ( a_mode = IL_MODE_FULL,
a_inst = 0 
)

get MediaObject XLM Tag

Parameters:
int $a_mode IL_MODE_ALIAS | IL_MODE_OUTPUT | IL_MODE_FULL

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

References $media_items, $xml, getId(), getMediaItems(), getMetaData(), and ilObject::getType().

Referenced by exportXML().

        {
                // TODO: full implementation of all parameters

                switch ($a_mode)
                {
                        case IL_MODE_ALIAS:
                                $xml = "<MediaObject>";
                                $xml .= "<MediaAlias OriginId=\"il__mob_".$this->getId()."\"/>";
                                $media_items =& $this->getMediaItems();
//echo "MediaItems:".count($media_items).":<br>";
                                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\">".
                                                        $item->getCaption()."</Caption>";
                                        }

                                        // Parameter
                                        $parameters = $item->getParameters();
                                        foreach ($parameters as $name => $value)
                                        {
                                                $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
                                        }
                                        $xml .= "</MediaAliasItem>";
                                }
                                break;

                        // for output we need technical sections of meta data
                        case IL_MODE_OUTPUT:

                                // get first technical section
                                $meta =& $this->getMetaData();
                                $xml = "<MediaObject Id=\"il__mob_".$this->getId()."\">";

                                $media_items =& $this->getMediaItems();
                                for($i=0; $i<count($media_items); $i++)
                                {
                                        $item =& $media_items[$i];
                                        $xml .= "<MediaItem Purpose=\"".$item->getPurpose()."\">";

                                        // Location
                                        $xml.= "<Location Type=\"".$item->getLocationType()."\">".
                                                $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\">".
                                                        $item->getCaption()."</Caption>";
                                        }

                                        // Parameter
                                        $parameters = $item->getParameters();
                                        foreach ($parameters as $name => $value)
                                        {
                                                $xml .= "<Parameter Name=\"$name\" Value=\"$value\"/>";
                                        }
                                        $xml .= $item->getMapAreasXML();
                                        $xml .= "</MediaItem>";
                                }
                                break;

                        // full xml for export
                        case IL_MODE_FULL:

                                $meta =& $this->getMetaData();
                                $xml = "<MediaObject>";

                                // meta data
                                $nested = new ilNestedSetXML();
                                $nested->setParameterModifier($this, "modifyExportIdentifier");
                                $xml.= $nested->export($this->getId(), $this->getType());

                                $media_items =& $this->getMediaItems();
                                for($i=0; $i<count($media_items); $i++)
                                {
                                        $item =& $media_items[$i];
                                        $xml .= "<MediaItem Purpose=\"".$item->getPurpose()."\">";

                                        // Location
                                        $xml.= "<Location Type=\"".$item->getLocationType()."\">".
                                                $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\">".
                                                        $item->getCaption()."</Caption>";
                                        }

                                        // 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::hasFullscreenItem (  ) 

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

References getMediaItem().

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

Here is the call graph for this function:

ilObjMediaObject::ilObjMediaObject ( a_id = 0,
a_call_by_reference = false 
)

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

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

References ilObject::ilObject().

        {
                $this->type = "mob";

                if($a_call_by_reference)
                {
                        $this->ilias->raiseError("Can't instantiate media object via reference id.",$this->ilias->error_obj->FATAL);
                }
                parent::ilObject($a_id, false);
        }

Here is the call graph for this function:

ilObjMediaObject::ilObjMediaObject ( a_id = 0  ) 

Constructor public.

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

References ilObject::ilObject().

        {
                $this->is_alias = false;
                $this->media_items = array();
                $this->contains_int_link = false;
                $this->type = "mob";
//echo "<br>ilObjMediaObject:Constructor:$a_id:";
                parent::ilObject($a_id, false);

                /*
                if($a_id != 0)
                {
                        $this->read();
                }*/


        }

Here is the call graph for this function:

ilObjMediaObject::initMeta (  ) 

init meta data object if needed

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

References assignMetaData(), getId(), and ilObject::getType().

Referenced by updateMetaData().

        {
                if (!is_object($this->meta_data))
                {
                        if ($this->getId())
                        {
                                $new_meta =& new ilMetaData($this->getType(), $this->getId());
                        }       
                        else
                        {
                                $new_meta =& new ilMetaData();
                        }
                        $this->assignMetaData($new_meta);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjMediaObject::isAlias (  ) 

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

Referenced by getImportId(), and setImportId().

        {
                return $this->is_alias;
        }

Here is the caller graph for this function:

ilObjMediaObject::modifyExportIdentifier ( a_tag,
a_param,
a_value 
)

Definition at line 655 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 87 of file class.ilObjMediaObject.php.

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

ilObjMediaObject::putInTree (  ) 

Definition at line 68 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 272 of file class.ilObjMediaObject.php.

References ilMediaItem::_getMediaItemsOfMOb(), getId(), and ilObject::getType().

        {
//echo "<br>ilObjMediaObject:read";
                parent::read();

                // get media items
                ilMediaItem::_getMediaItemsOfMOb($this);

                // get meta data
                $this->meta_data =& new ilMetaData($this->getType(), $this->getId());
        }

Here is the call graph for this function:

ilObjMediaObject::removeMediaItem ( a_purpose  ) 

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

        {
                for($i=0; $i<count($this->media_items); $i++)
                {
                        if($this->media_items[$i]->getPurpose() == $a_purpose)
                        {
                                unset($this->media_items[$i]);
                        }
                }
        }

ilObjMediaObject::setAlias ( a_is_alias  ) 

set wether page object is an alias

Definition at line 300 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_link true, if page contains intern link tag(s)

Definition at line 709 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 171 of file class.ilObjMediaObject.php.

Referenced by updateMetaData().

        {
                parent::setDescription($a_description);
                $this->meta_data->setDescription($a_description);
        }

Here is the caller graph for this function:

ilObjMediaObject::setDom ( &$  a_dom  ) 

set dom object

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

        {
                $this->dom =& $a_dom;
        }

ilObjMediaObject::setHierId ( a_hier_id  ) 

set hierarchical edit id

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

        {
                $this->hier_id = $a_hier_id;
        }

ilObjMediaObject::setId ( a_id  ) 

set id

Reimplemented from ilObject.

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

        {
                $this->id = $a_id;
        }

ilObjMediaObject::setImportId ( a_import_id  ) 

set import id

public

Parameters:
string $a_import_id import id

Reimplemented from ilObject.

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

References isAlias().

        {
                if($this->isAlias())
                {
                        $this->meta_data->setOriginID($a_id);
                }
                else
                {
                        $this->meta_data->setImportIdentifierEntryID($a_id);
                }
        }

Here is the call graph for this function:

ilObjMediaObject::setNode ( a_node  ) 

set PageContent node

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

        {
                $this->node =& $a_node;                                                 // page content node
                $this->mob_node =& $a_node->first_child();                      // MediaObject node
        }

ilObjMediaObject::setOriginID ( a_id  ) 

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

        {
                return $this->origin_id = $a_id;
        }

ilObjMediaObject::setRefId (  ) 

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

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

ilObjMediaObject::setRefId (  ) 

Definition at line 58 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_title object title

Reimplemented from ilObject.

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

References setTitle().

        {
                parent::setTitle($a_title);
                $this->meta_data->setTitle($a_title);
        }

Here is the call graph for this function:

ilObjMediaObject::setTitle ( a_title  ) 

set object title

public

Parameters:
string $a_title object title

Reimplemented from ilObject.

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

Referenced by setTitle(), and updateMetaData().

        {
                $this->meta_data->setTitle($a_title);
        }

Here is the caller graph for this function:

ilObjMediaObject::update (  ) 

update media object in db

Reimplemented from ilObject.

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

References $media_items, ilMediaItem::deleteAllItemsOfMob(), getId(), getMediaItems(), update(), and updateMetaData().

        {
                parent::update();

                $this->updateMetaData();

                ilMediaItem::deleteAllItemsOfMob($this->getId());

                // iterate all items
                $media_items =& $this->getMediaItems();
                $j = 1;
                foreach($media_items as $key => $val)
                {
                        $item =& $media_items[$key];
                        if (is_object($item))
                        {
                                $item->setMobId($this->getId());
                                $item->setNr($j);
                                $item->create();
                                $j++;
                        }
                }
        }

Here is the call graph for this function:

ilObjMediaObject::update (  ) 

update object in db

public

Returns:
boolean true on success

Reimplemented from ilObject.

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

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

Referenced by update(), and updateMetaData().

        {
                parent::update();

                // create meta data
                $this->meta_data->setId($this->getId());
                $this->meta_data->setType($this->getType());
                $this->meta_data->update();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjMediaObject::updateMetaData (  ) 

update meta data only

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

References initMeta(), setDescription(), setTitle(), and update().

Referenced by update().

        {
                $this->initMeta();
                $this->meta_data->update();
                if ($this->meta_data->section != "General")
                {
                        $meta = $this->meta_data->getElement("Title", "General");
                        $this->meta_data->setTitle($meta[0]["value"]);
                        $meta = $this->meta_data->getElement("Description", "General");
                        $this->meta_data->setDescription($meta[0]["value"]);
                }
                else
                {
                        $this->setTitle($this->meta_data->getTitle());
                        $this->setDescription($this->meta_data->getDescription());
                }
                parent::update();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilObjMediaObject::$contains_int_link

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

ilObjMediaObject::$dom

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

ilObjMediaObject::$hier_id

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

ilObjMediaObject::$id

Reimplemented from ilObject.

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

ilObjMediaObject::$is_alias

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

ilObjMediaObject::$media_items

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

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

ilObjMediaObject::$meta_data

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

ilObjMediaObject::$mob_node

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

ilObjMediaObject::$node

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

ilObjMediaObject::$origin_id

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


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