4define (
"IL_MODE_ALIAS", 1);
 
    5define (
"IL_MODE_OUTPUT", 2);
 
    6define (
"IL_MODE_FULL", 3);
 
    8require_once(
"./Services/MediaObjects/classes/class.ilMediaItem.php");
 
    9include_once 
"./Services/Object/classes/class.ilObject.php";
 
   40                $this->is_alias = 
false;
 
   41                $this->media_items = array();
 
   42                $this->contains_int_link = 
false;
 
   44                parent::ilObject($a_id, 
false);
 
   49                $this->
ilias->raiseError(
"Operation ilObjMedia::setRefId() not allowed.",$this->
ilias->error_obj->FATAL);
 
   59                $this->
ilias->raiseError(
"Operation ilObjMedia::putInTree() not allowed.",$this->
ilias->error_obj->FATAL);
 
   64                $this->
ilias->raiseError(
"Operation ilObjMedia::createReference() not allowed.",$this->
ilias->error_obj->FATAL);
 
   69                parent::setTitle($a_title);
 
   74                return parent::getTitle();
 
   88                include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
   89                if (is_int(strpos($a_id, 
"_")))
 
   94                return parent::_exists($a_id, 
false);
 
  102                if (!($this->
getId() > 0))
 
  109                if (count($usages) == 0)
 
  139                return parent::getDescription();
 
  147                parent::setDescription($a_description);
 
  163                include_once 
'Services/MetaData/classes/class.ilMD.php';
 
  171                                $md_gen = $md->getGeneral();
 
  173                                if (is_object($md_gen))
 
  176                                        $this->
setTitle($md_gen->getTitle());
 
  178                                        foreach($md_gen->getDescriptionIds() as 
$id)
 
  180                                                $md_des = $md_gen->getDescription(
$id);
 
  199                include_once 
'Services/MetaData/classes/class.ilMDCreator.php';
 
  204                $md_creator->setTitle($this->
getTitle());
 
  205                $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
 
  207                $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
 
  208                $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
 
  209                $md_creator->setLanguage(
$ilUser->getPref(
'language'));
 
  210                $md_creator->create();
 
  220                include_once(
"Services/MetaData/classes/class.ilMD.php");
 
  221                include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
 
  222                include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
 
  225                $md_gen =& $md->getGeneral();
 
  226                $md_gen->setTitle($this->
getTitle());
 
  229                $md_des_ids =& $md_gen->getDescriptionIds();
 
  230                if (count($md_des_ids) > 0)
 
  232                        $md_des =& $md_gen->getDescription($md_des_ids[0]);
 
  246                include_once(
'Services/MetaData/classes/class.ilMD.php');
 
  259                $this->media_items[] = $a_item;
 
  281            foreach ($this->media_items as $media_item)
 
  283                    if($media_item->getPurpose() == $a_purpose)
 
  297            foreach ($this->media_items as $key => $media_item)
 
  299                        if($media_item->getPurpose() == $a_purpose)
 
  301                                unset($this->media_items[$key]);
 
  307                foreach ($this->media_items as $media_item)
 
  310                $media_item->setMobId($this->
getId());
 
  311                        $media_item->setNr($i);
 
  322                $this->media_items = array();
 
  328                for($i=0; $i<count($this->media_items); $i++)
 
  330                        if($this->media_items[$i]->getPurpose() == $a_purpose)
 
  394                $this->is_alias = $a_is_alias;
 
  404                return $this->origin_id = $a_id;
 
  429                $this->import_id = $a_id;
 
  435        function create($a_create_meta_data = 
false, $a_save_media_items = 
true)
 
  439                if (!$a_create_meta_data)
 
  444                if ($a_save_media_items)
 
  450                                $item->setMobId($this->
getId());
 
  458                global $ilAppEventHandler;
 
  459                $ilAppEventHandler->raise(
'Services/MediaObjects',
 
  461                array(
'object' => $this,
 
  463                        'obj_id' => $this->
getId())
 
  488                        if (is_object($item))
 
  490                                $item->setMobId($this->
getId());
 
  492                                if ($item->getLocationType() == 
"Reference")
 
  494                                        $item->extractUrlParameters();
 
  503                global $ilAppEventHandler;
 
  504                $ilAppEventHandler->raise(
'Services/MediaObjects',
 
  506                array(
'object' => $this,
 
  508                        'obj_id' => $this->
getId())
 
  527                $parent_obj_ids = array();
 
  532                                !in_array($parent_obj_id, $parent_obj_ids))
 
  534                                $parent_obj_ids[]= $parent_obj_id;
 
  543                include_once 
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
 
  597                $a_web = 
true, $a_purpose = 
"")
 
  599                if ($a_purpose == 
"")
 
  601                        $a_purpose = 
"Standard";
 
  614                return $path.
"/data/".CLIENT_ID.
"/mobs/mm_".$a_mob_id.
"/".
$location;
 
  642                $a_subdir = str_replace(
"..", 
"", $a_subdir);
 
  646                        $dir.= 
"/".$a_subdir;
 
  653                        foreach ($entries as $e)
 
  655                                if (is_file($dir.
"/".$e[
"entry"]) && $e[
"entry"] != 
"." && $e[
"entry"] != 
"..")
 
  657                                        $files[] = $e[
"entry"];
 
  679                                $xml = 
"<MediaObject>";
 
  680                                $xml .= 
"<MediaAlias OriginId=\"il__mob_".$this->getId().
"\"/>";
 
  685                                        $xml .= 
"<MediaAliasItem Purpose=\"".$item->getPurpose().
"\">";
 
  688                                        $width = ($item->getWidth() != 
"")
 
  689                                                ? 
"Width=\"".$item->getWidth().
"\"" 
  691                                        $height = ($item->getHeight() != 
"")
 
  692                                                ? 
"Height=\"".$item->getHeight().
"\"" 
  694                                        $halign = ($item->getHAlign() != 
"")
 
  695                                                ? 
"HorizontalAlign=\"".$item->getHAlign().
"\"" 
  697                                        $xml .= 
"<Layout $width $height $halign />";
 
  700                                        if ($item->getCaption() != 
"")
 
  702                                                $xml .= 
"<Caption Align=\"bottom\">".
 
  703                                                        str_replace(
"&", 
"&", $item->getCaption()).
"</Caption>";
 
  707                                        if ($item->getTextRepresentation() != 
"")
 
  709                                                $xml .= 
"<TextRepresentation>".
 
  710                                                        str_replace(
"&", 
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
 
  714                                        $parameters = $item->getParameters();
 
  715                                        foreach ($parameters as $name => $value)
 
  717                                                $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  719                                        $xml .= $item->getMapAreasXML();
 
  720                                        $xml .= 
"</MediaAliasItem>";
 
  729                                $xml = 
"<MediaObject Id=\"il__mob_".$this->getId().
"\">";
 
  736                                        $xml .= 
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
 
  739                                        $xml.= 
"<Location Type=\"".$item->getLocationType().
"\">".
 
  740                                                $this->
handleAmps($item->getLocation()).
"</Location>";
 
  743                                        $xml.= 
"<Format>".$item->getFormat().
"</Format>";
 
  746                                        $width = ($item->getWidth() != 
"")
 
  747                                                ? 
"Width=\"".$item->getWidth().
"\"" 
  749                                        $height = ($item->getHeight() != 
"")
 
  750                                                ? 
"Height=\"".$item->getHeight().
"\"" 
  752                                        $halign = ($item->getHAlign() != 
"")
 
  753                                                ? 
"HorizontalAlign=\"".$item->getHAlign().
"\"" 
  755                                        $xml .= 
"<Layout $width $height $halign />";
 
  758                                        if ($item->getCaption() != 
"")
 
  760                                                $xml .= 
"<Caption Align=\"bottom\">".
 
  761                                                        str_replace(
"&", 
"&", $item->getCaption()).
"</Caption>";
 
  765                                        if ($item->getTextRepresentation() != 
"")
 
  767                                                $xml .= 
"<TextRepresentation>".
 
  768                                                        str_replace(
"&", 
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
 
  772                                        $parameters = $item->getParameters();
 
  773                                        foreach ($parameters as $name => $value)
 
  775                                                $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  777                                        $xml .= $item->getMapAreasXML();
 
  780                                        if ($item->getPurpose() == 
"Standard")
 
  783                                                foreach ($srts as $srt)
 
  787                                                        if (
$ilUser->getLanguage() != $meta_lang &&
 
  788                                                                $ilUser->getLanguage() == $srt[
"language"])
 
  790                                                                $def = 
' Default="true" ';
 
  792                                                        $xml .= 
"<Subtitle File=\"".$srt[
"full_path"].
 
  793                                                                "\" Language=\"".$srt[
"language"].
"\" ".$def.
"/>";
 
  796                                        $xml .= 
"</MediaItem>";
 
  804                                $xml = 
"<MediaObject>";
 
  807                                include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
 
  809                                $md2xml->setExportMode(
true);
 
  810                                $md2xml->startExport();
 
  811                                $xml.= $md2xml->getXML();
 
  819                                        $xml .= 
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
 
  822                                        $xml.= 
"<Location Type=\"".$item->getLocationType().
"\">".
 
  823                                                $this->
handleAmps($item->getLocation()).
"</Location>";
 
  826                                        $xml.= 
"<Format>".$item->getFormat().
"</Format>";
 
  829                                        $width = ($item->getWidth() != 
"")
 
  830                                                ? 
"Width=\"".$item->getWidth().
"\"" 
  832                                        $height = ($item->getHeight() != 
"")
 
  833                                                ? 
"Height=\"".$item->getHeight().
"\"" 
  835                                        $halign = ($item->getHAlign() != 
"")
 
  836                                                ? 
"HorizontalAlign=\"".$item->getHAlign().
"\"" 
  838                                        $xml .= 
"<Layout $width $height $halign />";
 
  841                                        if ($item->getCaption() != 
"")
 
  843                                                $xml .= 
"<Caption Align=\"bottom\">".
 
  844                                                        str_replace(
"&", 
"&", $item->getCaption()).
"</Caption>";
 
  848                                        if ($item->getTextRepresentation() != 
"")
 
  850                                                $xml .= 
"<TextRepresentation>".
 
  851                                                        str_replace(
"&", 
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
 
  855                                        $parameters = $item->getParameters();
 
  856                                        foreach ($parameters as $name => $value)
 
  858                                                $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  860                                        $xml .= $item->getMapAreasXML(
true, $a_inst);
 
  861                                        $xml .= 
"</MediaItem>";
 
  865                $xml .= 
"</MediaObject>";
 
  874                $a_str = str_replace(
"&", 
"&", $a_str);
 
  875                $a_str = str_replace(
"&", 
"&", $a_str);
 
  897                $subdir = 
"il_".IL_INST_ID.
"_mob_".$this->
getId();
 
  907                $subdir = 
"il_".IL_INST_ID.
"_mob_".$this->
getId();
 
  908                $a_target_dir = $a_target_dir.
"/objects/".$subdir;
 
  910                $tpl = 
new ilTemplate(
"tpl.fullscreen.html", 
true, 
true, 
"Modules/LearningModule");
 
  911                $tpl->setCurrentBlock(
"ilMedia");
 
  919                require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  921                require_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
  926                $xml.= $pg_obj->getMediaAliasElement($this->
getId());
 
  933                $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
 
  934                $args = array( 
'/_xml' => $xml, 
'/_xsl' => $xsl );
 
  941                $params = array (
'mode' => 
"fullscreen", 
'enlarge_path' => $enlarge_path,
 
  942                        'link_params' => 
"ref_id=".
$_GET[
"ref_id"],
'fullscreen_link' => 
"",
 
  943                        'ref_id' => 
$_GET[
"ref_id"], 
'webspace_path' => $wb_path);
 
  944                $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, $params);
 
  949                include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
 
  950                $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET", 
"../../css/style.css");
 
  951                $tpl->setVariable(
"LOCATION_STYLESHEET", 
"../../css/system.css");
 
  952                $tpl->setVariable(
"MEDIA_CONTENT", $output);
 
  953                $output = 
$tpl->get();
 
  955                $output = preg_replace(
"/mobs\/mm_(\d+)\/([^\"]+)/i",
"$2",$output);
 
  956                $output = preg_replace(
"/\.\/Services\/MediaObjects\/flash_mp3_player/i",
"../../players",$output);
 
  958                $output = preg_replace(
"/file=..\/..\/..\//i",
"file=../objects/".$subdir.
"/",$output);
 
  960                fwrite(fopen($a_target_dir.
'/fullscreen.html',
'w'), $output );
 
  965                if ($a_tag == 
"Identifier" && $a_param == 
"Entry")
 
  986                $this->contains_int_link = $a_contains_link;
 
 1006                if ($a_usage_hist_nr !== 
false)
 
 1008                        $and_hist = 
" AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, 
"integer");
 
 1012                $set = 
$ilDB->query(
"SELECT id FROM mob_usage".
 
 1013                        " WHERE usage_type = ".
$ilDB->quote($a_type, 
"text").
 
 1014                        " AND usage_id = ".$ilDB->quote($a_id, 
"integer").
 
 1015                        " AND usage_lang = ".$ilDB->quote($a_lang, 
"text").
 
 1019                        $mob_ids[] = 
$row[
"id"];
 
 1022                $q = 
"DELETE FROM mob_usage WHERE usage_type = ".
 
 1023                        $ilDB->quote($a_type, 
"text").
 
 1024                        " AND usage_id= ".$ilDB->quote($a_id, 
"integer").
 
 1025                        " AND usage_lang = ".$ilDB->quote($a_lang, 
"text").
 
 1027                $ilDB->manipulate($q);
 
 1029                foreach($mob_ids as $mob_id)
 
 1045                        $lstr = 
" AND usage_lang = ".$ilDB->quote($a_lang, 
"text");
 
 1048                if ($a_usage_hist_nr !== 
false)
 
 1050                        $hist_str = 
" AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, 
"integer");
 
 1053                $q = 
"SELECT * FROM mob_usage WHERE ".
 
 1054                        "usage_type = ".$ilDB->quote($a_type, 
"text").
" AND ".
 
 1055                        "usage_id = ".$ilDB->quote($a_id, 
"integer").
 
 1058                $mob_set = 
$ilDB->query($q);
 
 1059                while($mob_rec = 
$ilDB->fetchAssoc($mob_set))
 
 1063                                $mobs[$mob_rec[
"id"]] = $mob_rec[
"id"];
 
 1073        function _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr = 0, $a_lang = 
"-")
 
 1077                $ilDB->replace(
"mob_usage",
 
 1079                                "id" => array(
"integer", (
int) $a_mob_id),
 
 1080                                "usage_type" => array(
"text", $a_type),
 
 1081                                "usage_id" => array(
"integer", $a_id),
 
 1082                                "usage_lang" => array(
"text", $a_lang),
 
 1083                                "usage_hist_nr" => array(
"integer", (
int) $a_usage_hist_nr)
 
 1094        function _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr = 0, $a_lang = 
"-")
 
 1098                $q = 
"DELETE FROM mob_usage WHERE ".
 
 1099                        " id = ".$ilDB->quote((
int) $a_mob_id, 
"integer").
" AND ".
 
 1100                        " usage_type = ".$ilDB->quote($a_type, 
"text").
" AND ".
 
 1101                        " usage_id = ".$ilDB->quote((
int) $a_id, 
"integer").
" AND ".
 
 1102                        " usage_lang = ".$ilDB->quote($a_lang, 
"text").
" AND ".
 
 1103                        " usage_hist_nr = ".$ilDB->quote((
int) $a_usage_hist_nr, 
"integer");
 
 1104                $ilDB->manipulate($q);
 
 1127                if ($a_include_history)
 
 1129                        $hist_str = 
", usage_hist_nr";
 
 1133                $q = 
"SELECT DISTINCT usage_type, usage_id, usage_lang".$hist_str.
" FROM mob_usage WHERE id = ".
 
 1134                        $ilDB->quote($a_id, 
"integer");
 
 1136                if (!$a_include_history)
 
 1138                        $q.= 
" AND usage_hist_nr = ".$ilDB->quote(0, 
"integer");
 
 1141                $us_set = 
$ilDB->query($q);
 
 1143                while($us_rec = 
$ilDB->fetchAssoc($us_set))
 
 1146                        if(is_int(strpos($us_rec[
"usage_type"], 
":")))
 
 1148                                $us_arr = explode(
":", $us_rec[
"usage_type"]);
 
 1157                                include_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
 1166                                $ret[] = array(
"type" => $us_rec[
"usage_type"],
 
 1167                                        "id" => $us_rec[
"usage_id"],
 
 1168                                        "lang" => $us_rec[
"usage_lang"],
 
 1169                                        "hist_nr" => $us_rec[
"usage_hist_nr"]);
 
 1174                $q = 
"SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = ".
 
 1175                        $ilDB->quote($a_id, 
"integer").
" AND mep_item.type = ".
$ilDB->quote(
"mob", 
"text");
 
 1176                $us_set = 
$ilDB->query($q);
 
 1177                while($us_rec = 
$ilDB->fetchAssoc($us_set))
 
 1179                        $ret[] = array(
"type" => 
"mep",
 
 1180                                "id" => $us_rec[
"mep_id"]);
 
 1184                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1186                foreach($news_usages as $nu)
 
 1193                $q = 
"SELECT DISTINCT mob_id FROM media_item it, map_area area ".
 
 1194                        " WHERE area.item_id = it.id ".
 
 1195                        " AND area.link_type = ".$ilDB->quote(
"int", 
"text").
" ".
 
 1196                        " AND area.target = ".$ilDB->quote(
"il__mob_".$a_id, 
"text");
 
 1197                $us_set = 
$ilDB->query($q);
 
 1198                while($us_rec = 
$ilDB->fetchAssoc($us_set))
 
 1200                        $ret[] = array(
"type" => 
"map",
 
 1201                                "id" => $us_rec[
"mob_id"]);
 
 1206                foreach ($users as $user)
 
 1208                        $ret[] = array(
"type" => 
"clip",
 
 1222                if(is_int(strpos($a_usage[
"type"], 
":")))
 
 1224                        $us_arr = explode(
":", $a_usage[
"type"]);
 
 1226                        $cont_type = $us_arr[0];
 
 1230                        $type = $a_usage[
"type"];
 
 1233                $id = $a_usage[
"id"];
 
 1245                                                include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
 1247                                                if ($qinfo[
"original_id"] > 0)
 
 1249                                                        include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 1254                                                        $obj_id = $qinfo[
"obj_fi"];             
 
 1260                                                include_once(
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
 
 1264                                                        $parent_id = $quest->getObjId();                                                        
 
 1267                                                        if ($quest->getOriginalId() &&
 
 1275                                                                $obj_id = $parent_id;
 
 1284                                                $returned_pk = $a_usage[
'id'];                                  
 
 1286                                                include_once 
'Modules/Exercise/classes/class.ilObjExercise.php';
 
 1292                                                $post_pk = $a_usage[
'id'];
 
 1293                                                include_once 
'Modules/Forum/classes/class.ilForumPost.php';
 
 1294                                                include_once 
'Modules/Forum/classes/class.ilForum.php';
 
 1296                                                $frm_pk =  $oPost->getForumId();
 
 1303                                                $obj_id = $a_usage[
'id'];
 
 1325                                                include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1331                                                include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
 1333                                                if ($qinfo[
"original_id"] > 0)
 
 1335                                                        include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 1340                                                        $obj_id = $qinfo[
"obj_fi"];             
 
 1344                                                        include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
 
 1346                                                        if ($pinfo && $pinfo[
"parent_type"] == 
"lm")
 
 1348                                                                include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 1352                                                        if ($pinfo && $pinfo[
"parent_type"] == 
"sahs")
 
 1354                                                                include_once(
"./Modules/SCORM2004/classes/class.ilSCORM2004Node.php");
 
 1363                                                include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 1369                                                include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
 
 1370                                                include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
 
 1377                                                include_once 
'Modules/Wiki/classes/class.ilWikiPage.php';
 
 1384                                                include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1390                                                include_once 
"Modules/Portfolio/classes/class.ilPortfolioPage.php";                                     
 
 1396                                                include_once 
"Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";                                     
 
 1402                                                include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1430                                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1445        function _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop = 
false)
 
 1447                $file_path = pathinfo($a_file);
 
 1448                $location = substr($file_path[
"basename"],0,strlen($file_path[
"basename"]) -
 
 1449                        strlen($file_path[
"extension"]) - 1).
"_".
 
 1451                        $a_height.
".".$file_path[
"extension"];
 
 1452                $target_file = $file_path[
"dirname"].
"/".
 
 1455                        (
int) $a_width, (
int) $a_height, $a_constrain_prop);
 
 1469                include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
 
 1478                $a_file, $a_reference, $a_constrain_proportions, $a_use_original,
 
 1479                $a_user_width, $a_user_height)
 
 1484                $width = $a_def_width;
 
 1485                $height = $a_def_height;
 
 1488                if ($a_format == 
"audio/mpeg")
 
 1496                        include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
 
 1497                        if ($a_type == 
"File")
 
 1507                if ($a_use_original)
 
 1516                                $info = 
$lng->txt(
"cont_could_not_determine_resource_size");
 
 1521                        $w = (int) $a_user_width;
 
 1522                        $h = (int) $a_user_height;
 
 1532                                                $wr = 
$size[0] / $w;
 
 1536                                                $hr = 
$size[1] / $h;
 
 1543                                                $width = (int) (
$size[0]/$r);
 
 1544                                                $height = (int) (
$size[1]/$r);
 
 1551                return array(
"width" => $width, 
"height" => $height, 
"info" => $info);
 
 1560                return array(
"image/x-ms-bmp", 
"image/gif", 
"image/jpeg", 
"image/x-portable-bitmap",
 
 1561                        "image/png", 
"image/psd", 
"image/tiff", 
"application/pdf");
 
 1577                $lpath = pathinfo($a_loc);
 
 1578                if ($lpath[
"extension"] == 
"mp3" && $a_format == 
"audio/mpeg")
 
 1582                if ($lpath[
"extension"] == 
"flv")
 
 1586                if (in_array($a_format, array(
"video/mp4", 
"video/webm")))
 
 1600                $media_object->setTitle($name);
 
 1601                $media_object->setDescription(
"");
 
 1602                $media_object->create();
 
 1605                $media_object->createDirectory();
 
 1609                $media_object->addMediaItem($media_item);
 
 1610                $media_item->setPurpose(
"Standard");
 
 1612                $file = $mob_dir.
"/".$name;
 
 1619                        copy($tmp_name, 
$file);
 
 1625                $media_item->setFormat($format);
 
 1627                $media_item->setLocationType(
"LocalFile");
 
 1628                $media_object->setTitle($name);
 
 1629                $media_object->setDescription($format);
 
 1633                        include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
 
 1635                        $media_item->setWidth(
$size[0]);
 
 1636                        $media_item->setHeight(
$size[1]);
 
 1638                $media_item->setHAlign(
"Left");
 
 1641                include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
 
 1644                $media_object->update();
 
 1646                return $media_object;
 
 1654                $a_subdir = str_replace(
"..", 
"", $a_subdir);
 
 1656                if ($a_subdir != 
"")
 
 1658                        $dir.= 
"/".$a_subdir;
 
 1663                include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
 
 1676                if (is_file($a_tmp_name) && $a_language != 
"")
 
 1691                if (!is_dir($srt_dir))
 
 1698                $srt_files = array();
 
 1699                foreach ($items as $i)
 
 1701                        if (!in_array($i[
"entry"], array(
".", 
"..")) && $i[
"type"] == 
"file")
 
 1703                                $name = explode(
".", $i[
"entry"]);
 
 1704                                if ($name[1] == 
"srt" && substr($name[0], 0, 9) == 
"subtitle_")
 
 1706                                        $srt_files[] = array(
"file" => $i[
"entry"],
 
 1707                                                "full_path" => 
"srt/".$i[
"entry"], 
"language" => substr($name[0], 9, 2));
 
 1725                        $t_dir.
"/".$a_thumbname, $a_format, $a_size);
 
 1737                return $t_dir.
"/".$a_thumbname;
 
 1746                $file = str_replace(
"..", 
"", $a_file);
 
 1762                if (!is_array($a_ignore))
 
 1764                        $a_ignore = array();
 
 1770                foreach($med_items as $med_item)
 
 1773                        foreach ($int_links as $k => $int_link)
 
 1775                                if ($int_link[
"Type"] == 
"MediaObject")
 
 1777                                        include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 1781                                                if (!in_array($l_id, $linked) && 
 
 1782                                                        !in_array($l_id, $a_ignore))
 
 1799                return array_filter(self::getAllowedFileTypes(), 
function ($v) {
 
 1800                        return !in_array($v, self::getForbiddenFileTypes());
 
 1812                if (trim($mset->get(
"black_list_file_types")) == 
"")
 
 1816                return array_map(
function ($v)
 
 1818                                return strtolower(trim($v));
 
 1820                        explode(
",", $mset->get(
"black_list_file_types")));
 
 1831                if (trim($mset->get(
"restricted_file_types")) == 
"")
 
 1835                return array_map(
function ($v)
 
 1837                                return strtolower(trim($v));
 
 1839                        explode(
",", $mset->get(
"restricted_file_types")));
 
 1850                if (in_array($a_type, self::getForbiddenFileTypes()))
 
 1854                if (count(self::getAllowedFileTypes()) == 0 || in_array($a_type, self::getAllowedFileTypes()))
 
 1868                $new_obj->setTitle($this->
getTitle());
 
 1874                        $new_obj->addMediaItem($val);
 
 1877                $new_obj->create(
false, 
true);
 
 1880                $new_obj->createDirectory();
 
 1888                include_once(
"Services/MetaData/classes/class.ilMD.php");
 
 1889                $md = 
new ilMD(0, $this->
getId(), 
"mob");
 
 1890                $new_md = $md->cloneMD(0, $new_obj->getId(), 
"mob");
 
 1903                $pi = pathinfo($a_prevpic[
"name"]);
 
 1904                $ext = $pi[
"extension"];
 
 1905                if (in_array($ext, array(
"jpg", 
"jpeg", 
"png")))
 
 1921                if ($item->getLocationType() == 
"LocalFile" &&
 
 1922                        is_int(strpos($item->getFormat(), 
"image/")))
 
 1926                                $item->getLocation();
 
 1950                $ppics = array(
"mob_vpreview.jpg",
 
 1951                        "mob_vpreview.jpeg",
 
 1952                        "mob_vpreview.png");
 
 1953                foreach ($ppics as $p)
 
 1955                        if (is_file($dir.
"/".$p))
 
 1957                                if ($a_filename_only)
 
 1980                $rchars = array(
"`", 
"=", 
"$", 
"{", 
"}", 
"'", 
";", 
" ", 
"(", 
")");
 
 1981                $a_name = str_replace($rchars, 
"_", $a_name);
 
 1982                $a_name = str_replace(
"__", 
"_", $a_name);
 
 1994                if (!self::isTypeAllowed(
"html"))
 
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _lookupSurveyObjId($a_question_id)
& _getQuestionInfo($question_id)
Returns question information from the database.
static handleUpdatedSourceObject($a_src_obj_type, $a_src_obj_id, $a_src_filesize, $a_owner_obj_ids=null, $a_is_prtf=false)
Find and update/create all related entries for source object.
static _lookupObjIdForForumId($a_for_id)
_lookupTermId($a_def_id)
Looks up term id for a definition id.
static _lookGlossaryID($term_id)
get glossary id form term id
_extractObjIdOfTarget($a_target)
Extract object id out of target.
_lookupContObjID($a_id)
get learning module / digibook id for lm object
_getIntLinks($a_item_id)
get all internal links of a media items map areas
static getMimeType($a_file="", $a_filename="", $a_mime="")
Get Mime type.
static _lookupContextObjId($a_news_id)
Context Object ID.
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static lookupExerciseIdForReturnedId($a_returned_id)
_lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
_getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
Class ilObject Basic functions for all objects.
getType()
get object type @access public
_writeTitle($a_obj_id, $a_title)
write title to db (static)
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
_writeDescription($a_obj_id, $a_desc)
write description to db (static)
static _lookupType($a_id, $a_reference=false)
lookup object type
_getPageForQuestionId($a_q_id, $a_parent_type="")
Get page for question id.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
static lookupParentId($a_id, $a_type)
Lookup parent id.
static getFlashVideoPlayerDirectory()
Get flash video player directory.
static findPortfolioForPage($a_page_id)
Get portfolio id of page id.
_lookupSLMID($a_id)
Lookup Scorm Learning Module ID for node id.
special template class to simplify handling of ITX/PEAR
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static escapeShellArg($a_arg)
static getWebspaceDir($mode="filesystem")
get webspace directory
static execConvert($args)
execute convert command
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
static rRenameSuffix($a_dir, $a_old_suffix, $a_new_suffix)
Renames all files with certain suffix and gives them a new suffix.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static getHtmlPath($relative_path)
get url of path
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static createDirectory($a_dir, $a_mod=0755)
create directory
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
static lookupObjIdByPage($a_page_id)
returns the wiki/object id to a given page id
redirection script todo: (a better solution should control the processing via a xml file)