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);
 
  103                $mob_logger->debug(
"ilObjMediaObject: Delete called for media object ID '".$this->
getId().
"'.");
 
  105                if (!($this->
getId() > 0))
 
  112                $mob_logger->debug(
"ilObjMediaObject: ... Found ".count($usages).
" usages.");
 
  114                if (count($usages) == 0)
 
  135                        $mob_logger->debug(
"ilObjMediaObject: ... deleted.");
 
  139                        foreach ($usages as $u)
 
  141                                $mob_logger->debug(
"ilObjMediaObject: ... usage type:".$u[
"type"].
 
  143                                        ", lang:".$u[
"lang"].
 
  144                                        ", hist_nr:".$u[
"hist_nr"].
".");
 
  146                        $mob_logger->debug(
"ilObjMediaObject: ... not deleted.");
 
  157                return parent::getDescription();
 
  165                parent::setDescription($a_description);
 
  181                include_once 
'Services/MetaData/classes/class.ilMD.php';
 
  189                                $md_gen = $md->getGeneral();
 
  191                                if (is_object($md_gen))
 
  194                                        $this->
setTitle($md_gen->getTitle());
 
  196                                        foreach($md_gen->getDescriptionIds() as 
$id)
 
  198                                                $md_des = $md_gen->getDescription(
$id);
 
  217                include_once 
'Services/MetaData/classes/class.ilMDCreator.php';
 
  222                $md_creator->setTitle($this->
getTitle());
 
  223                $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
 
  225                $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
 
  226                $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
 
  227                $md_creator->setLanguage(
$ilUser->getPref(
'language'));
 
  228                $md_creator->create();
 
  238                include_once(
"Services/MetaData/classes/class.ilMD.php");
 
  239                include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
 
  240                include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
 
  243                $md_gen =& $md->getGeneral();
 
  244                $md_gen->setTitle($this->
getTitle());
 
  247                $md_des_ids =& $md_gen->getDescriptionIds();
 
  248                if (count($md_des_ids) > 0)
 
  250                        $md_des =& $md_gen->getDescription($md_des_ids[0]);
 
  264                include_once(
'Services/MetaData/classes/class.ilMD.php');
 
  277                $this->media_items[] = $a_item;
 
  299            foreach ($this->media_items as $media_item)
 
  301                    if($media_item->getPurpose() == $a_purpose)
 
  315            foreach ($this->media_items as $key => $media_item)
 
  317                        if($media_item->getPurpose() == $a_purpose)
 
  319                                unset($this->media_items[$key]);
 
  325                foreach ($this->media_items as $media_item)
 
  328                $media_item->setMobId($this->
getId());
 
  329                        $media_item->setNr($i);
 
  340                $this->media_items = array();
 
  346                for($i=0; $i<count($this->media_items); $i++)
 
  348                        if($this->media_items[$i]->getPurpose() == $a_purpose)
 
  412                $this->is_alias = $a_is_alias;
 
  422                return $this->origin_id = $a_id;
 
  447                $this->import_id = $a_id;
 
  453        function create($a_create_meta_data = 
false, $a_save_media_items = 
true)
 
  457                if (!$a_create_meta_data)
 
  462                if ($a_save_media_items)
 
  468                                $item->setMobId($this->
getId());
 
  476                global $ilAppEventHandler;
 
  477                $ilAppEventHandler->raise(
'Services/MediaObjects',
 
  479                array(
'object' => $this,
 
  481                        'obj_id' => $this->
getId())
 
  506                        if (is_object($item))
 
  508                                $item->setMobId($this->
getId());
 
  510                                if ($item->getLocationType() == 
"Reference")
 
  512                                        $item->extractUrlParameters();
 
  520                global $ilAppEventHandler;
 
  521                $ilAppEventHandler->raise(
'Services/MediaObjects',
 
  523                array(
'object' => $this,
 
  525                        'obj_id' => $this->
getId())
 
  543                $parent_obj_ids = array();
 
  548                                !in_array($parent_obj_id, $parent_obj_ids))
 
  550                                $parent_obj_ids[]= $parent_obj_id;
 
  559                include_once 
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
 
  613                $a_web = 
true, $a_purpose = 
"")
 
  615                if ($a_purpose == 
"")
 
  617                        $a_purpose = 
"Standard";
 
  630                return $path.
"/data/".CLIENT_ID.
"/mobs/mm_".$a_mob_id.
"/".
$location;
 
  658                $a_subdir = str_replace(
"..", 
"", $a_subdir);
 
  662                        $dir.= 
"/".$a_subdir;
 
  669                        foreach ($entries as $e)
 
  671                                if (is_file($dir.
"/".$e[
"entry"]) && $e[
"entry"] != 
"." && $e[
"entry"] != 
"..")
 
  673                                        $files[] = $e[
"entry"];
 
  695                                $xml = 
"<MediaObject>";
 
  696                                $xml .= 
"<MediaAlias OriginId=\"il__mob_".$this->getId().
"\"/>";
 
  701                                        $xml .= 
"<MediaAliasItem Purpose=\"".$item->getPurpose().
"\">";
 
  704                                        $width = ($item->getWidth() != 
"")
 
  705                                                ? 
"Width=\"".$item->getWidth().
"\"" 
  707                                        $height = ($item->getHeight() != 
"")
 
  708                                                ? 
"Height=\"".$item->getHeight().
"\"" 
  710                                        $halign = ($item->getHAlign() != 
"")
 
  711                                                ? 
"HorizontalAlign=\"".$item->getHAlign().
"\"" 
  713                                        $xml .= 
"<Layout $width $height $halign />";
 
  716                                        if ($item->getCaption() != 
"")
 
  718                                                $xml .= 
"<Caption Align=\"bottom\">".
 
  719                                                        str_replace(
"&", 
"&", $item->getCaption()).
"</Caption>";
 
  723                                        if ($item->getTextRepresentation() != 
"")
 
  725                                                $xml .= 
"<TextRepresentation>".
 
  726                                                        str_replace(
"&", 
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
 
  730                                        $parameters = $item->getParameters();
 
  731                                        foreach ($parameters as $name => $value)
 
  733                                                $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  735                                        $xml .= $item->getMapAreasXML();
 
  736                                        $xml .= 
"</MediaAliasItem>";
 
  745                                $xml = 
"<MediaObject Id=\"il__mob_".$this->getId().
"\">";
 
  752                                        $xml .= 
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
 
  755                                        $xml.= 
"<Location Type=\"".$item->getLocationType().
"\">".
 
  756                                                $this->
handleAmps($item->getLocation()).
"</Location>";
 
  759                                        $xml.= 
"<Format>".$item->getFormat().
"</Format>";
 
  762                                        $width = ($item->getWidth() != 
"")
 
  763                                                ? 
"Width=\"".$item->getWidth().
"\"" 
  765                                        $height = ($item->getHeight() != 
"")
 
  766                                                ? 
"Height=\"".$item->getHeight().
"\"" 
  768                                        $halign = ($item->getHAlign() != 
"")
 
  769                                                ? 
"HorizontalAlign=\"".$item->getHAlign().
"\"" 
  771                                        $xml .= 
"<Layout $width $height $halign />";
 
  774                                        if ($item->getCaption() != 
"")
 
  776                                                $xml .= 
"<Caption Align=\"bottom\">".
 
  777                                                        str_replace(
"&", 
"&", $item->getCaption()).
"</Caption>";
 
  781                                        if ($item->getTextRepresentation() != 
"")
 
  783                                                $xml .= 
"<TextRepresentation>".
 
  784                                                        str_replace(
"&", 
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
 
  788                                        $parameters = $item->getParameters();
 
  789                                        foreach ($parameters as $name => $value)
 
  791                                                $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  793                                        $xml .= $item->getMapAreasXML();
 
  796                                        if ($item->getPurpose() == 
"Standard")
 
  799                                                foreach ($srts as $srt)
 
  803                                                        if (
$ilUser->getLanguage() != $meta_lang &&
 
  804                                                                $ilUser->getLanguage() == $srt[
"language"])
 
  806                                                                $def = 
' Default="true" ';
 
  808                                                        $xml .= 
"<Subtitle File=\"".$srt[
"full_path"].
 
  809                                                                "\" Language=\"".$srt[
"language"].
"\" ".$def.
"/>";
 
  812                                        $xml .= 
"</MediaItem>";
 
  820                                $xml = 
"<MediaObject>";
 
  823                                include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
 
  825                                $md2xml->setExportMode(
true);
 
  826                                $md2xml->startExport();
 
  827                                $xml.= $md2xml->getXML();
 
  835                                        $xml .= 
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
 
  838                                        $xml.= 
"<Location Type=\"".$item->getLocationType().
"\">".
 
  839                                                $this->
handleAmps($item->getLocation()).
"</Location>";
 
  842                                        $xml.= 
"<Format>".$item->getFormat().
"</Format>";
 
  845                                        $width = ($item->getWidth() != 
"")
 
  846                                                ? 
"Width=\"".$item->getWidth().
"\"" 
  848                                        $height = ($item->getHeight() != 
"")
 
  849                                                ? 
"Height=\"".$item->getHeight().
"\"" 
  851                                        $halign = ($item->getHAlign() != 
"")
 
  852                                                ? 
"HorizontalAlign=\"".$item->getHAlign().
"\"" 
  854                                        $xml .= 
"<Layout $width $height $halign />";
 
  857                                        if ($item->getCaption() != 
"")
 
  859                                                $xml .= 
"<Caption Align=\"bottom\">".
 
  860                                                        str_replace(
"&", 
"&", $item->getCaption()).
"</Caption>";
 
  864                                        if ($item->getTextRepresentation() != 
"")
 
  866                                                $xml .= 
"<TextRepresentation>".
 
  867                                                        str_replace(
"&", 
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
 
  871                                        $parameters = $item->getParameters();
 
  872                                        foreach ($parameters as $name => $value)
 
  874                                                $xml .= 
"<Parameter Name=\"$name\" Value=\"$value\"/>";
 
  876                                        $xml .= $item->getMapAreasXML(
true, $a_inst);
 
  877                                        $xml .= 
"</MediaItem>";
 
  881                $xml .= 
"</MediaObject>";
 
  890                $a_str = str_replace(
"&", 
"&", $a_str);
 
  891                $a_str = str_replace(
"&", 
"&", $a_str);
 
  913                $subdir = 
"il_".IL_INST_ID.
"_mob_".$this->
getId();
 
  923                $subdir = 
"il_".IL_INST_ID.
"_mob_".$this->
getId();
 
  924                $a_target_dir = $a_target_dir.
"/objects/".$subdir;
 
  926                $tpl = 
new ilTemplate(
"tpl.fullscreen.html", 
true, 
true, 
"Modules/LearningModule");
 
  927                $tpl->setCurrentBlock(
"ilMedia");
 
  935                require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  937                require_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
  942                $xml.= $pg_obj->getMediaAliasElement($this->
getId());
 
  949                $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
 
  950                $args = array( 
'/_xml' => $xml, 
'/_xsl' => $xsl );
 
  957                $params = array (
'mode' => 
"fullscreen", 
'enlarge_path' => $enlarge_path,
 
  958                        'link_params' => 
"ref_id=".
$_GET[
"ref_id"],
'fullscreen_link' => 
"",
 
  959                        'ref_id' => 
$_GET[
"ref_id"], 
'webspace_path' => $wb_path);
 
  960                $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, 
$params);
 
  965                include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
 
  966                $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET", 
"../../css/style.css");
 
  967                $tpl->setVariable(
"LOCATION_STYLESHEET", 
"../../css/system.css");
 
  968                $tpl->setVariable(
"MEDIA_CONTENT", $output);
 
  969                $output = 
$tpl->get();
 
  971                $output = preg_replace(
"/mobs\/mm_(\d+)\/([^\"]+)/i",
"$2",$output);
 
  972                $output = preg_replace(
"/\.\/Services\/MediaObjects\/flash_mp3_player/i",
"../../players",$output);
 
  974                $output = preg_replace(
"/file=..\/..\/..\//i",
"file=../objects/".$subdir.
"/",$output);
 
  976                fwrite(fopen($a_target_dir.
'/fullscreen.html',
'w'), $output );
 
  981                if ($a_tag == 
"Identifier" && $a_param == 
"Entry")
 
 1002                $this->contains_int_link = $a_contains_link;
 
 1022                if ($a_usage_hist_nr !== 
false)
 
 1024                        $and_hist = 
" AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, 
"integer");
 
 1028                $set = 
$ilDB->query(
"SELECT id FROM mob_usage".
 
 1029                        " WHERE usage_type = ".
$ilDB->quote($a_type, 
"text").
 
 1030                        " AND usage_id = ".$ilDB->quote($a_id, 
"integer").
 
 1031                        " AND usage_lang = ".$ilDB->quote($a_lang, 
"text").
 
 1035                        $mob_ids[] = 
$row[
"id"];
 
 1038                $q = 
"DELETE FROM mob_usage WHERE usage_type = ".
 
 1039                        $ilDB->quote($a_type, 
"text").
 
 1040                        " AND usage_id= ".$ilDB->quote($a_id, 
"integer").
 
 1041                        " AND usage_lang = ".$ilDB->quote($a_lang, 
"text").
 
 1043                $ilDB->manipulate($q);
 
 1045                foreach($mob_ids as $mob_id)
 
 1061                        $lstr = 
" AND usage_lang = ".$ilDB->quote($a_lang, 
"text");
 
 1064                if ($a_usage_hist_nr !== 
false)
 
 1066                        $hist_str = 
" AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr, 
"integer");
 
 1069                $q = 
"SELECT * FROM mob_usage WHERE ".
 
 1070                        "usage_type = ".$ilDB->quote($a_type, 
"text").
" AND ".
 
 1071                        "usage_id = ".$ilDB->quote($a_id, 
"integer").
 
 1074                $mob_set = 
$ilDB->query($q);
 
 1075                while($mob_rec = 
$ilDB->fetchAssoc($mob_set))
 
 1079                                $mobs[$mob_rec[
"id"]] = $mob_rec[
"id"];
 
 1089        function _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr = 0, $a_lang = 
"-")
 
 1093                $ilDB->replace(
"mob_usage",
 
 1095                                "id" => array(
"integer", (
int) $a_mob_id),
 
 1096                                "usage_type" => array(
"text", $a_type),
 
 1097                                "usage_id" => array(
"integer", $a_id),
 
 1098                                "usage_lang" => array(
"text", $a_lang),
 
 1099                                "usage_hist_nr" => array(
"integer", (
int) $a_usage_hist_nr)
 
 1110        function _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr = 0, $a_lang = 
"-")
 
 1114                $q = 
"DELETE FROM mob_usage WHERE ".
 
 1115                        " id = ".$ilDB->quote((
int) $a_mob_id, 
"integer").
" AND ".
 
 1116                        " usage_type = ".$ilDB->quote($a_type, 
"text").
" AND ".
 
 1117                        " usage_id = ".$ilDB->quote((
int) $a_id, 
"integer").
" AND ".
 
 1118                        " usage_lang = ".$ilDB->quote($a_lang, 
"text").
" AND ".
 
 1119                        " usage_hist_nr = ".$ilDB->quote((
int) $a_usage_hist_nr, 
"integer");
 
 1120                $ilDB->manipulate($q);
 
 1143                if ($a_include_history)
 
 1145                        $hist_str = 
", usage_hist_nr";
 
 1149                $q = 
"SELECT DISTINCT usage_type, usage_id, usage_lang".$hist_str.
" FROM mob_usage WHERE id = ".
 
 1150                        $ilDB->quote($a_id, 
"integer");
 
 1152                if (!$a_include_history)
 
 1154                        $q.= 
" AND usage_hist_nr = ".$ilDB->quote(0, 
"integer");
 
 1157                $us_set = 
$ilDB->query($q);
 
 1159                while($us_rec = 
$ilDB->fetchAssoc($us_set))
 
 1162                        if(is_int(strpos($us_rec[
"usage_type"], 
":")))
 
 1164                                $us_arr = explode(
":", $us_rec[
"usage_type"]);
 
 1173                                include_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
 1182                                $ret[] = array(
"type" => $us_rec[
"usage_type"],
 
 1183                                        "id" => $us_rec[
"usage_id"],
 
 1184                                        "lang" => $us_rec[
"usage_lang"],
 
 1185                                        "hist_nr" => $us_rec[
"usage_hist_nr"]);
 
 1190                $q = 
"SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = ".
 
 1191                        $ilDB->quote($a_id, 
"integer").
" AND mep_item.type = ".
$ilDB->quote(
"mob", 
"text");
 
 1192                $us_set = 
$ilDB->query($q);
 
 1193                while($us_rec = 
$ilDB->fetchAssoc($us_set))
 
 1195                        $ret[] = array(
"type" => 
"mep",
 
 1196                                "id" => $us_rec[
"mep_id"]);
 
 1200                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1202                foreach($news_usages as $nu)
 
 1209                $q = 
"SELECT DISTINCT mob_id FROM media_item it, map_area area ".
 
 1210                        " WHERE area.item_id = it.id ".
 
 1211                        " AND area.link_type = ".$ilDB->quote(
"int", 
"text").
" ".
 
 1212                        " AND area.target = ".$ilDB->quote(
"il__mob_".$a_id, 
"text");
 
 1213                $us_set = 
$ilDB->query($q);
 
 1214                while($us_rec = 
$ilDB->fetchAssoc($us_set))
 
 1216                        $ret[] = array(
"type" => 
"map",
 
 1217                                "id" => $us_rec[
"mob_id"]);
 
 1222                foreach ($users as $user)
 
 1224                        $ret[] = array(
"type" => 
"clip",
 
 1238                if(is_int(strpos($a_usage[
"type"], 
":")))
 
 1240                        $us_arr = explode(
":", $a_usage[
"type"]);
 
 1242                        $cont_type = $us_arr[0];
 
 1246                        $type = $a_usage[
"type"];
 
 1249                $id = $a_usage[
"id"];
 
 1261                                                include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
 1263                                                if ($qinfo[
"original_id"] > 0)
 
 1265                                                        include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 1270                                                        $obj_id = $qinfo[
"obj_fi"];             
 
 1276                                                include_once(
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
 
 1280                                                        $parent_id = $quest->getObjId();                                                        
 
 1283                                                        if ($quest->getOriginalId() &&
 
 1291                                                                $obj_id = $parent_id;
 
 1300                                                $returned_pk = $a_usage[
'id'];                                  
 
 1302                                                include_once 
'Modules/Exercise/classes/class.ilExSubmission.php';
 
 1308                                                $post_pk = $a_usage[
'id'];
 
 1309                                                include_once 
'Modules/Forum/classes/class.ilForumPost.php';
 
 1310                                                include_once 
'Modules/Forum/classes/class.ilForum.php';
 
 1312                                                $frm_pk =  $oPost->getForumId();
 
 1319                                                $obj_id = $a_usage[
'id'];
 
 1341                                                include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1347                                                include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
 1349                                                if ($qinfo[
"original_id"] > 0)
 
 1351                                                        include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 1356                                                        $obj_id = $qinfo[
"obj_fi"];             
 
 1360                                                        include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
 
 1362                                                        if ($pinfo && $pinfo[
"parent_type"] == 
"lm")
 
 1364                                                                include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 1368                                                        if ($pinfo && $pinfo[
"parent_type"] == 
"sahs")
 
 1370                                                                include_once(
"./Modules/SCORM2004/classes/class.ilSCORM2004Node.php");
 
 1379                                                include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
 
 1385                                                include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
 
 1386                                                include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
 
 1393                                                include_once 
'Modules/Wiki/classes/class.ilWikiPage.php';
 
 1400                                                include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1406                                                include_once 
"Modules/Portfolio/classes/class.ilPortfolioPage.php";                                     
 
 1412                                                include_once 
"Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";                                     
 
 1418                                                include_once(
'./Services/COPage/classes/class.ilPageObject.php');
 
 1446                                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1461        function _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop = 
false)
 
 1463                $file_path = pathinfo($a_file);
 
 1464                $location = substr($file_path[
"basename"],0,strlen($file_path[
"basename"]) -
 
 1465                        strlen($file_path[
"extension"]) - 1).
"_".
 
 1467                        $a_height.
".".$file_path[
"extension"];
 
 1468                $target_file = $file_path[
"dirname"].
"/".
 
 1471                        (
int) $a_width, (
int) $a_height, $a_constrain_prop);
 
 1485                include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
 
 1494                $a_file, $a_reference, $a_constrain_proportions, $a_use_original,
 
 1495                $a_user_width, $a_user_height)
 
 1504                if ($a_format == 
"audio/mpeg")
 
 1512                        include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
 
 1513                        if ($a_type == 
"File")
 
 1523                if ($a_use_original)
 
 1532                                $info = 
$lng->txt(
"cont_could_not_determine_resource_size");
 
 1537                        $w = (int) $a_user_width;
 
 1538                        $h = (int) $a_user_height;
 
 1560                                                $height = (int) (
$size[1]/
$r);
 
 1567                return array(
"width" => $width, 
"height" => $height, 
"info" => 
$info);
 
 1576                return array(
"image/x-ms-bmp", 
"image/gif", 
"image/jpeg", 
"image/x-portable-bitmap",
 
 1577                        "image/png", 
"image/psd", 
"image/tiff", 
"application/pdf");
 
 1593                $lpath = pathinfo($a_loc);
 
 1594                if ($lpath[
"extension"] == 
"mp3" && $a_format == 
"audio/mpeg")
 
 1598                if ($lpath[
"extension"] == 
"flv")
 
 1602                if (in_array($a_format, array(
"video/mp4", 
"video/webm")))
 
 1616                $media_object->setTitle($name);
 
 1617                $media_object->setDescription(
"");
 
 1618                $media_object->create();
 
 1621                $media_object->createDirectory();
 
 1625                $media_object->addMediaItem($media_item);
 
 1626                $media_item->setPurpose(
"Standard");
 
 1628                $file = $mob_dir.
"/".$name;
 
 1635                        copy($tmp_name, 
$file);
 
 1641                $media_item->setFormat($format);
 
 1643                $media_item->setLocationType(
"LocalFile");
 
 1644                $media_object->setTitle($name);
 
 1645                $media_object->setDescription($format);
 
 1649                        include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
 
 1651                        $media_item->setWidth(
$size[0]);
 
 1652                        $media_item->setHeight(
$size[1]);
 
 1654                $media_item->setHAlign(
"Left");
 
 1657                include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
 
 1660                $media_object->update();
 
 1662                return $media_object;
 
 1670                $a_subdir = str_replace(
"..", 
"", $a_subdir);
 
 1672                if ($a_subdir != 
"")
 
 1674                        $dir.= 
"/".$a_subdir;
 
 1679                include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
 
 1692                if (is_file($a_tmp_name) && $a_language != 
"")
 
 1707                if (!is_dir($srt_dir))
 
 1714                $srt_files = array();
 
 1715                foreach ($items as $i)
 
 1717                        if (!in_array($i[
"entry"], array(
".", 
"..")) && $i[
"type"] == 
"file")
 
 1719                                $name = explode(
".", $i[
"entry"]);
 
 1720                                if ($name[1] == 
"srt" && substr($name[0], 0, 9) == 
"subtitle_")
 
 1722                                        $srt_files[] = array(
"file" => $i[
"entry"],
 
 1723                                                "full_path" => 
"srt/".$i[
"entry"], 
"language" => substr($name[0], 9, 2));
 
 1741                        $t_dir.
"/".$a_thumbname, $a_format, $a_size);
 
 1753                return $t_dir.
"/".$a_thumbname;
 
 1762                $file = str_replace(
"..", 
"", $a_file);
 
 1778                if (!is_array($a_ignore))
 
 1780                        $a_ignore = array();
 
 1786                foreach($med_items as $med_item)
 
 1789                        foreach ($int_links as $k => $int_link)
 
 1791                                if ($int_link[
"Type"] == 
"MediaObject")
 
 1793                                        include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 1797                                                if (!in_array($l_id, $linked) && 
 
 1798                                                        !in_array($l_id, $a_ignore))
 
 1815                return array_filter(self::getAllowedFileTypes(), 
function ($v) {
 
 1816                        return !in_array($v, self::getForbiddenFileTypes());
 
 1828                if (trim($mset->get(
"black_list_file_types")) == 
"")
 
 1832                return array_map(
function ($v)
 
 1834                                return strtolower(trim($v));
 
 1836                        explode(
",", $mset->get(
"black_list_file_types")));
 
 1847                if (trim($mset->get(
"restricted_file_types")) == 
"")
 
 1851                return array_map(
function ($v)
 
 1853                                return strtolower(trim($v));
 
 1855                        explode(
",", $mset->get(
"restricted_file_types")));
 
 1866                if (in_array($a_type, self::getForbiddenFileTypes()))
 
 1870                if (count(self::getAllowedFileTypes()) == 0 || in_array($a_type, self::getAllowedFileTypes()))
 
 1884                $new_obj->setTitle($this->
getTitle());
 
 1890                        $new_obj->addMediaItem($val);
 
 1893                $new_obj->create(
false, 
true);
 
 1896                $new_obj->createDirectory();
 
 1904                include_once(
"Services/MetaData/classes/class.ilMD.php");
 
 1905                $md = 
new ilMD(0, $this->
getId(), 
"mob");
 
 1906                $new_md = $md->cloneMD(0, $new_obj->getId(), 
"mob");
 
 1919                $pi = pathinfo($a_prevpic[
"name"]);
 
 1920                $ext = $pi[
"extension"];
 
 1921                if (in_array($ext, array(
"jpg", 
"jpeg", 
"png")))
 
 1937                if ($item->getLocationType() == 
"LocalFile" &&
 
 1938                        is_int(strpos($item->getFormat(), 
"image/")))
 
 1942                                $item->getLocation();
 
 1966                $ppics = array(
"mob_vpreview.jpg",
 
 1967                        "mob_vpreview.jpeg",
 
 1968                        "mob_vpreview.png");
 
 1969                foreach ($ppics as $p)
 
 1971                        if (is_file($dir.
"/".$p))
 
 1973                                if ($a_filename_only)
 
 1996                $rchars = array(
"`", 
"=", 
"$", 
"{", 
"}", 
"'", 
";", 
" ", 
"(", 
")");
 
 1997                $a_name = str_replace($rchars, 
"_", $a_name);
 
 1998                $a_name = str_replace(
"__", 
"_", $a_name);
 
 2025                include_once(
"./Services/MediaObjects/exceptions/class.ilMediaObjectsException.php");
 
 2026                if (!is_file($a_file[
"tmp_name"]))
 
 2053                include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
 
 2058                foreach ($files as $k => $i)
 
 2061                        if ($i[
"type"] == 
"file" && !in_array($k, array(
".", 
"..")))
 
 2063                                if (pathinfo($k, PATHINFO_EXTENSION) == 
"srt")
 
 2066                                        if (substr($k, strlen($k) - 7, 1) == 
"_")
 
 2068                                                $lang = substr($k, strlen($k) - 6, 2);
 
 2069                                                if (!in_array(
$lang, $lang_codes))
 
 2074                                        $items[] = array(
"filename" => $k, 
"lang" => 
$lang);
 
 2089                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 lookupExerciseIdForReturnedId($a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
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
static getLogger($a_component_id)
Get component logger.
_getPossibleLanguageCodes()
_getIntLinks($a_item_id)
get all internal links of a media items map areas
const APPLICATION__OCTET_STREAM
static lookupMimeType($path_to_file, $fallback=self::APPLICATION__OCTET_STREAM, $a_external=false)
static _lookupContextObjId($a_news_id)
Context Object ID.
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
_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 lookupParentId($a_id, $a_type)
Lookup parent id.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
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 unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
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)