4 define (
"IL_MODE_ALIAS", 1);
5 define (
"IL_MODE_OUTPUT", 2);
6 define (
"IL_MODE_FULL", 3);
8 require_once(
"./Services/MediaObjects/classes/class.ilMediaItem.php");
9 include_once
"classes/class.ilObject.php";
40 $this->is_alias =
false;
41 $this->media_items = array();
42 $this->contains_int_link =
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);
88 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
89 if (is_int(strpos($a_id,
"_")))
102 if (!($this->
getId() > 0))
109 if (count($usages) == 0)
159 include_once
'Services/MetaData/classes/class.ilMD.php';
167 $md_gen = $md->getGeneral();
169 if (is_object($md_gen))
172 $this->
setTitle($md_gen->getTitle());
174 foreach($md_gen->getDescriptionIds() as
$id)
176 $md_des = $md_gen->getDescription(
$id);
195 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
200 $md_creator->setTitle($this->
getTitle());
201 $md_creator->setTitleLanguage($ilUser->getPref(
'language'));
203 $md_creator->setDescriptionLanguage($ilUser->getPref(
'language'));
204 $md_creator->setKeywordLanguage($ilUser->getPref(
'language'));
205 $md_creator->setLanguage($ilUser->getPref(
'language'));
206 $md_creator->create();
216 include_once(
"Services/MetaData/classes/class.ilMD.php");
217 include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
218 include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
221 $md_gen =& $md->getGeneral();
222 $md_gen->setTitle($this->
getTitle());
225 $md_des_ids =& $md_gen->getDescriptionIds();
226 if (count($md_des_ids) > 0)
228 $md_des =& $md_gen->getDescription($md_des_ids[0]);
242 include_once(
'Services/MetaData/classes/class.ilMD.php');
255 $this->media_items[] =& $a_item;
277 foreach ($this->media_items as $media_item)
279 if($media_item->getPurpose() == $a_purpose)
293 foreach ($this->media_items as $key => $media_item)
295 if($media_item->getPurpose() == $a_purpose)
297 unset($this->media_items[$key]);
303 foreach ($this->media_items as $media_item)
306 $media_item->setMobId($this->
getId());
307 $media_item->setNr($i);
318 $this->media_items = array();
324 for($i=0; $i<count($this->media_items); $i++)
326 if($this->media_items[$i]->getPurpose() == $a_purpose)
390 $this->is_alias = $a_is_alias;
400 return $this->origin_id = $a_id;
425 $this->import_id = $a_id;
431 function create($a_create_meta_data =
false, $a_save_media_items =
true)
435 if (!$a_create_meta_data)
440 if ($a_save_media_items)
446 $item->setMobId($this->
getId());
473 if (is_object($item))
475 $item->setMobId($this->
getId());
477 if ($item->getLocationType() ==
"Reference")
479 $item->extractUrlParameters();
534 $a_web =
true, $a_purpose =
"")
536 if ($a_purpose ==
"")
538 $a_purpose =
"Standard";
551 return $path.
"/data/".CLIENT_ID.
"/mobs/mm_".$a_mob_id.
"/".
$location;
579 $a_subdir = str_replace(
"..",
"", $a_subdir);
583 $dir.=
"/".$a_subdir;
590 foreach ($entries as $e)
592 if (is_file(
$dir.
"/".$e[
"entry"]) && $e[
"entry"] !=
"." && $e[
"entry"] !=
"..")
614 $xml =
"<MediaObject>";
615 $xml .=
"<MediaAlias OriginId=\"il__mob_".$this->getId().
"\"/>";
620 $xml .=
"<MediaAliasItem Purpose=\"".$item->getPurpose().
"\">";
623 $width = ($item->getWidth() !=
"")
624 ?
"Width=\"".$item->getWidth().
"\""
626 $height = ($item->getHeight() !=
"")
627 ?
"Height=\"".$item->getHeight().
"\""
629 $halign = ($item->getHAlign() !=
"")
630 ?
"HorizontalAlign=\"".$item->getHAlign().
"\""
632 $xml .=
"<Layout $width $height $halign />";
635 if ($item->getCaption() !=
"")
637 $xml .=
"<Caption Align=\"bottom\">".
638 str_replace(
"&",
"&", $item->getCaption()).
"</Caption>";
642 if ($item->getTextRepresentation() !=
"")
644 $xml .=
"<TextRepresentation>".
645 str_replace(
"&",
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
649 $parameters = $item->getParameters();
650 foreach ($parameters as $name => $value)
652 $xml .=
"<Parameter Name=\"$name\" Value=\"$value\"/>";
654 $xml .=
"</MediaAliasItem>";
663 $xml =
"<MediaObject Id=\"il__mob_".$this->getId().
"\">";
669 $xml .=
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
672 $xml.=
"<Location Type=\"".$item->getLocationType().
"\">".
673 $this->
handleAmps($item->getLocation()).
"</Location>";
676 $xml.=
"<Format>".$item->getFormat().
"</Format>";
679 $width = ($item->getWidth() !=
"")
680 ?
"Width=\"".$item->getWidth().
"\""
682 $height = ($item->getHeight() !=
"")
683 ?
"Height=\"".$item->getHeight().
"\""
685 $halign = ($item->getHAlign() !=
"")
686 ?
"HorizontalAlign=\"".$item->getHAlign().
"\""
688 $xml .=
"<Layout $width $height $halign />";
691 if ($item->getCaption() !=
"")
693 $xml .=
"<Caption Align=\"bottom\">".
694 str_replace(
"&",
"&", $item->getCaption()).
"</Caption>";
698 if ($item->getTextRepresentation() !=
"")
700 $xml .=
"<TextRepresentation>".
701 str_replace(
"&",
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
705 $parameters = $item->getParameters();
706 foreach ($parameters as $name => $value)
708 $xml .=
"<Parameter Name=\"$name\" Value=\"$value\"/>";
710 $xml .= $item->getMapAreasXML();
711 $xml .=
"</MediaItem>";
719 $xml =
"<MediaObject>";
722 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
724 $md2xml->setExportMode(
true);
725 $md2xml->startExport();
726 $xml.= $md2xml->getXML();
732 $xml .=
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
735 $xml.=
"<Location Type=\"".$item->getLocationType().
"\">".
736 $this->
handleAmps($item->getLocation()).
"</Location>";
739 $xml.=
"<Format>".$item->getFormat().
"</Format>";
742 $width = ($item->getWidth() !=
"")
743 ?
"Width=\"".$item->getWidth().
"\""
745 $height = ($item->getHeight() !=
"")
746 ?
"Height=\"".$item->getHeight().
"\""
748 $halign = ($item->getHAlign() !=
"")
749 ?
"HorizontalAlign=\"".$item->getHAlign().
"\""
751 $xml .=
"<Layout $width $height $halign />";
754 if ($item->getCaption() !=
"")
756 $xml .=
"<Caption Align=\"bottom\">".
757 str_replace(
"&",
"&", $item->getCaption()).
"</Caption>";
761 if ($item->getTextRepresentation() !=
"")
763 $xml .=
"<TextRepresentation>".
764 str_replace(
"&",
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
768 $parameters = $item->getParameters();
769 foreach ($parameters as $name => $value)
771 $xml .=
"<Parameter Name=\"$name\" Value=\"$value\"/>";
773 $xml .= $item->getMapAreasXML(
true, $a_inst);
774 $xml .=
"</MediaItem>";
778 $xml .=
"</MediaObject>";
787 $a_str = str_replace(
"&",
"&", $a_str);
788 $a_str = str_replace(
"&",
"&", $a_str);
810 $subdir =
"il_".IL_INST_ID.
"_mob_".$this->
getId();
820 $subdir =
"il_".IL_INST_ID.
"_mob_".$this->
getId();
821 $a_target_dir = $a_target_dir.
"/objects/".$subdir;
823 $tpl =
new ilTemplate(
"tpl.fullscreen.html",
true,
true,
"Modules/LearningModule");
824 $tpl->setCurrentBlock(
"ilMedia");
832 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
834 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
839 $xml.= $pg_obj->getMediaAliasElement($this->
getId());
846 $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
847 $args = array(
'/_xml' => $xml,
'/_xsl' => $xsl );
854 $params = array (
'mode' =>
"fullscreen",
'enlarge_path' => $enlarge_path,
855 'link_params' =>
"ref_id=".
$_GET[
"ref_id"],
'fullscreen_link' =>
"",
856 'ref_id' =>
$_GET[
"ref_id"],
'webspace_path' => $wb_path);
857 $output =
xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, $params);
862 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
"../../css/style.css");
863 $tpl->setVariable(
"LOCATION_STYLESHEET",
"../../css/system.css");
864 $tpl->setVariable(
"MEDIA_CONTENT", $output);
865 $output =
$tpl->get();
867 $output = preg_replace(
"/mobs\/mm_(\d+)\/([^\"]+)/i",
"$2",$output);
868 $output = preg_replace(
"/\.\/Services\/MediaObjects\/flash_mp3_player/i",
"../../players",$output);
869 $output = preg_replace(
"/\.\/Services\/MediaObjects\/flash_flv_player/i",
"../../players",$output);
870 $output = preg_replace(
"/file=..\/..\/..\//i",
"file=../objects/".$subdir.
"/",$output);
872 fwrite(fopen($a_target_dir.
'/fullscreen.html',
'w'), $output );
877 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
898 $this->contains_int_link = $a_contains_link;
917 $q =
"DELETE FROM mob_usage WHERE usage_type = ".
918 $ilDB->quote($a_type,
"text").
919 " AND usage_id= ".$ilDB->quote($a_id,
"integer").
920 " AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr,
"integer");
921 $ilDB->manipulate($q);
931 $q =
"SELECT * FROM mob_usage WHERE ".
932 "usage_type = ".$ilDB->quote($a_type,
"text").
" AND ".
933 "usage_id = ".$ilDB->quote($a_id,
"integer").
" AND ".
934 "usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr,
"integer");
936 $mob_set = $ilDB->query($q);
937 while($mob_rec = $ilDB->fetchAssoc($mob_set))
941 $mobs[$mob_rec[
"id"]] = $mob_rec[
"id"];
951 function _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr = 0)
955 $q =
"DELETE FROM mob_usage WHERE ".
956 " id = ".$ilDB->quote((
int) $a_mob_id,
"integer").
" AND ".
957 " usage_type = ".$ilDB->quote($a_type,
"text").
" AND ".
958 " usage_id = ".$ilDB->quote((
int) $a_id,
"integer").
" AND ".
959 " usage_hist_nr = ".$ilDB->quote((
int) $a_usage_hist_nr,
"integer");
960 $ilDB->manipulate($q);
961 $q =
"INSERT INTO mob_usage (id, usage_type, usage_id, usage_hist_nr) VALUES".
962 " (".$ilDB->quote((
int) $a_mob_id,
"integer").
",".
963 $ilDB->quote($a_type,
"text").
",".
964 $ilDB->quote((
int) $a_id,
"integer").
",".
965 $ilDB->quote((
int) $a_usage_hist_nr,
"integer").
")";
966 $ilDB->manipulate($q);
976 $q =
"DELETE FROM mob_usage WHERE ".
977 " id = ".$ilDB->quote((
int) $a_mob_id,
"integer").
" AND ".
978 " usage_type = ".$ilDB->quote($a_type,
"text").
" AND ".
979 " usage_id = ".$ilDB->quote((
int) $a_id,
"integer").
" AND ".
980 " usage_hist_nr = ".$ilDB->quote((
int) $a_usage_hist_nr,
"integer");
981 $ilDB->manipulate($q);
1002 if ($a_include_history)
1004 $hist_str =
", usage_hist_nr";
1008 $q =
"SELECT DISTINCT usage_type, usage_id".$hist_str.
" FROM mob_usage WHERE id = ".
1009 $ilDB->quote($a_id,
"integer");
1011 if (!$a_include_history)
1013 $q.=
" AND usage_hist_nr = ".$ilDB->quote(0,
"integer");
1016 $us_set = $ilDB->query($q);
1018 while($us_rec = $ilDB->fetchAssoc($us_set))
1021 if(is_int(strpos($us_rec[
"usage_type"],
":")))
1023 $us_arr = explode(
":", $us_rec[
"usage_type"]);
1032 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
1041 $ret[] = array(
"type" => $us_rec[
"usage_type"],
1042 "id" => $us_rec[
"usage_id"],
1043 "hist_nr" => $us_rec[
"usage_hist_nr"]);
1048 $q =
"SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = ".
1049 $ilDB->quote($a_id,
"integer").
" AND mep_item.type = ".$ilDB->quote(
"mob",
"text");
1050 $us_set = $ilDB->query($q);
1051 while($us_rec = $ilDB->fetchAssoc($us_set))
1053 $ret[] = array(
"type" =>
"mep",
1054 "id" => $us_rec[
"mep_id"]);
1058 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1060 foreach($news_usages as $nu)
1067 $q =
"SELECT DISTINCT mob_id FROM media_item it, map_area area ".
1068 " WHERE area.item_id = it.id ".
1069 " AND area.link_type = ".$ilDB->quote(
"int",
"text").
" ".
1070 " AND area.target = ".$ilDB->quote(
"il__mob_".$a_id,
"text");
1071 $us_set = $ilDB->query($q);
1072 while($us_rec = $ilDB->fetchAssoc($us_set))
1074 $ret[] = array(
"type" =>
"map",
1075 "id" => $us_rec[
"mob_id"]);
1080 foreach ($users as $user)
1082 $ret[] = array(
"type" =>
"clip",
1094 if(is_int(strpos($a_usage[
"type"],
":")))
1096 $us_arr = explode(
":", $a_usage[
"type"]);
1098 $cont_type = $us_arr[0];
1102 $type = $a_usage[
"type"];
1105 $id = $a_usage[
"id"];
1111 if ($cont_type ==
"cat")
1116 if ($cont_type ==
"tst")
1122 if ($cont_type ==
"qpl")
1124 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
1126 if ($qinfo[
"original_id"] > 0)
1128 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
1133 $obj_id = $qinfo[
"obj_fi"];
1138 if ($cont_type ==
"frm")
1140 $post_pk = $a_usage[
'id'];
1141 include_once
'Modules/Forum/classes/class.ilForumPost.php';
1142 include_once
'Modules/Forum/classes/class.ilForum.php';
1144 $frm_pk = $oPost->getForumId();
1149 if ($cont_type ==
'frm~')
1151 $obj_id = $a_usage[
'id'];
1159 if ($cont_type ==
"qpl")
1161 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
1163 if ($qinfo[
"original_id"] > 0)
1165 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
1170 $obj_id = $qinfo[
"obj_fi"];
1175 if ($cont_type ==
"lm" || $cont_type ==
"dbk")
1177 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1182 if ($cont_type ==
"gdf")
1184 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
1185 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1191 if ($cont_type ==
'wpg')
1193 include_once
'Modules/Wiki/classes/class.ilWikiPage.php';
1198 if ($cont_type ==
'sahs')
1201 include_once(
'./Services/COPage/classes/class.ilPageObject.php');
1206 if (in_array($cont_type, array(
"crs",
"grp",
"cat",
"fold",
"root")))
1211 if($cont_type ==
'prtf')
1213 include_once
"Services/Portfolio/classes/class.ilPortfolioPage.php";
1217 if($cont_type ==
'blp')
1219 include_once(
'./Services/COPage/classes/class.ilPageObject.php');
1231 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1246 function _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop =
false)
1248 $file_path = pathinfo($a_file);
1249 $location = substr($file_path[
"basename"],0,strlen($file_path[
"basename"]) -
1250 strlen($file_path[
"extension"]) - 1).
"_".
1252 $a_height.
".".$file_path[
"extension"];
1253 $target_file = $file_path[
"dirname"].
"/".
1256 (
int) $a_width, (
int) $a_height, $a_constrain_prop);
1270 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1307 $a_file, $a_reference, $a_constrain_proportions, $a_use_original,
1308 $a_user_width, $a_user_height)
1313 $width = $a_def_width;
1314 $height = $a_def_height;
1317 if ($a_format ==
"audio/mpeg")
1325 if ($a_type ==
"File")
1327 $size = @getimagesize($a_file);
1331 $size = @getimagesize($a_reference);
1335 if ($a_use_original)
1344 $info = $lng->txt(
"cont_could_not_determine_resource_size");
1349 $w = (int) $a_user_width;
1350 $h = (int) $a_user_height;
1360 $wr =
$size[0] / $w;
1364 $hr =
$size[1] / $h;
1371 $width = (int) (
$size[0]/$r);
1372 $height = (int) (
$size[1]/$r);
1379 return array(
"width" => $width,
"height" => $height,
"info" => $info);
1387 $types_map = array (
1388 '.a' =>
'application/octet-stream',
1389 '.ai' =>
'application/postscript',
1390 '.aif' =>
'audio/x-aiff',
1391 '.aifc' =>
'audio/x-aiff',
1392 '.aiff' =>
'audio/x-aiff',
1393 '.asd' =>
'application/astound',
1394 '.asf' =>
'video/x-ms-asf',
1395 '.asn' =>
'application/astound',
1396 '.asx' =>
'video/x-ms-asf',
1397 '.au' =>
'audio/basic',
1398 '.avi' =>
'video/x-msvideo',
1399 '.bat' =>
'text/plain',
1400 '.bcpio' =>
'application/x-bcpio',
1401 '.bin' =>
'application/octet-stream',
1402 '.bmp' =>
'image/x-ms-bmp',
1403 '.c' =>
'text/plain',
1404 '.cdf' =>
'application/x-cdf',
1405 '.class' =>
'application/x-java-applet',
1406 '.com' =>
'application/octet-stream',
1407 '.cpio' =>
'application/x-cpio',
1408 '.csh' =>
'application/x-csh',
1409 '.css' =>
'text/css',
1410 '.csv' =>
'text/comma-separated-values',
1411 '.dcr' =>
'application/x-director',
1412 '.dir' =>
'application/x-director',
1413 '.dll' =>
'application/octet-stream',
1414 '.doc' =>
'application/msword',
1415 '.dot' =>
'application/msword',
1416 '.dvi' =>
'application/x-dvi',
1417 '.dwg' =>
'application/acad',
1418 '.dxf' =>
'application/dxf',
1419 '.dxr' =>
'application/x-director',
1420 '.eml' =>
'message/rfc822',
1421 '.eps' =>
'application/postscript',
1422 '.etx' =>
'text/x-setext',
1423 '.exe' =>
'application/octet-stream',
1424 '.flv' =>
'video/x-flv',
1425 '.gif' =>
'image/gif',
1426 '.gtar' =>
'application/x-gtar',
1427 '.gz' =>
'application/gzip',
1428 '.h' =>
'text/plain',
1429 '.hdf' =>
'application/x-hdf',
1430 '.htm' =>
'text/html',
1431 '.html' =>
'text/html',
1432 '.ief' =>
'image/ief',
1433 '.iff' =>
'image/iff',
1434 '.jar' =>
'application/x-java-applet',
1435 '.jpe' =>
'image/jpeg',
1436 '.jpeg' =>
'image/jpeg',
1437 '.jpg' =>
'image/jpeg',
1438 '.js' =>
'application/x-javascript',
1439 '.ksh' =>
'text/plain',
1440 '.latex' =>
'application/x-latex',
1441 '.m1v' =>
'video/mpeg',
1442 '.man' =>
'application/x-troff-man',
1443 '.me' =>
'application/x-troff-me',
1444 '.mht' =>
'message/rfc822',
1445 '.mhtml' =>
'message/rfc822',
1446 '.mid' =>
'audio/x-midi',
1447 '.midi' =>
'audio/x-midi',
1448 '.mif' =>
'application/x-mif',
1449 '.mov' =>
'video/quicktime',
1450 '.movie' =>
'video/x-sgi-movie',
1451 '.mp2' =>
'audio/mpeg',
1452 '.mp3' =>
'audio/mpeg',
1453 '.mpa' =>
'video/mpeg',
1454 '.mpe' =>
'video/mpeg',
1455 '.mpeg' =>
'video/mpeg',
1456 '.mpg' =>
'video/mpeg',
1457 '.mp4' =>
'video/mp4',
1458 '.mv4' =>
'video/mp4',
1459 '.ms' =>
'application/x-troff-ms',
1460 '.nc' =>
'application/x-netcdf',
1461 '.nws' =>
'message/rfc822',
1462 '.o' =>
'application/octet-stream',
1463 '.ogg' =>
'application/ogg',
1464 '.obj' =>
'application/octet-stream',
1465 '.oda' =>
'application/oda',
1466 '.p12' =>
'application/x-pkcs12',
1467 '.p7c' =>
'application/pkcs7-mime',
1468 '.pbm' =>
'image/x-portable-bitmap',
1469 '.pdf' =>
'application/pdf',
1470 '.pfx' =>
'application/x-pkcs12',
1471 '.pgm' =>
'image/x-portable-graymap',
1472 '.php' =>
'application/x-httpd-php',
1473 '.phtml' =>
'application/x-httpd-php',
1474 '.pl' =>
'text/plain',
1475 '.png' =>
'image/png',
1476 '.pnm' =>
'image/x-portable-anymap',
1477 '.pot' =>
'application/vnd.ms-powerpoint',
1478 '.ppa' =>
'application/vnd.ms-powerpoint',
1479 '.ppm' =>
'image/x-portable-pixmap',
1480 '.pps' =>
'application/vnd.ms-powerpoint',
1481 '.ppt' =>
'application/vnd.ms-powerpoint',
1482 '.ps' =>
'application/postscript',
1483 '.psd' =>
'image/psd',
1484 '.pwz' =>
'application/vnd.ms-powerpoint',
1485 '.py' =>
'text/x-python',
1486 '.pyc' =>
'application/x-python-code',
1487 '.pyo' =>
'application/x-python-code',
1488 '.qt' =>
'video/quicktime',
1489 '.ra' =>
'audio/x-pn-realaudio',
1490 '.ram' =>
'application/x-pn-realaudio',
1491 '.ras' =>
'image/x-cmu-raster',
1492 '.rdf' =>
'application/xml',
1493 '.rgb' =>
'image/x-rgb',
1494 '.roff' =>
'application/x-troff',
1495 '.rpm' =>
'audio/x-pn-realaudio-plugin',
1496 '.rtf' =>
'application/rtf',
1497 '.rtx' =>
'text/richtext',
1498 '.sgm' =>
'text/x-sgml',
1499 '.sgml' =>
'text/x-sgml',
1500 '.sh' =>
'application/x-sh',
1501 '.shar' =>
'application/x-shar',
1502 '.sit' =>
'application/x-stuffit',
1503 '.snd' =>
'audio/basic',
1504 '.so' =>
'application/octet-stream',
1505 '.spc' =>
'text/x-speech',
1506 '.src' =>
'application/x-wais-source',
1507 '.sv4cpio'=>
'application/x-sv4cpio',
1508 '.sv4crc' =>
'application/x-sv4crc',
1509 '.svg' =>
'image/svg+xml',
1510 '.swf' =>
'application/x-shockwave-flash',
1511 '.t' =>
'application/x-troff',
1512 '.tar' =>
'application/x-tar',
1513 '.talk' =>
'text/x-speech',
1514 '.tbk' =>
'application/toolbook',
1515 '.tcl' =>
'application/x-tcl',
1516 '.tex' =>
'application/x-tex',
1517 '.texi' =>
'application/x-texinfo',
1518 '.texinfo'=>
'application/x-texinfo',
1519 '.tif' =>
'image/tiff',
1520 '.tiff' =>
'image/tiff',
1521 '.tr' =>
'application/x-troff',
1522 '.tsv' =>
'text/tab-separated-values',
1523 '.tsp' =>
'application/dsptype',
1524 '.txt' =>
'text/plain',
1525 '.ustar' =>
'application',
1526 '.vcf' =>
'text/x-vcard',
1527 '.vox' =>
'audio/voxware',
1528 '.wav' =>
'audio/x-wav',
1529 '.wax' =>
'audio/x-ms-wax',
1530 '.wiz' =>
'application/msword',
1531 '.wm' =>
'video/x-ms-wm',
1532 '.wma' =>
'audio/x-ms-wma',
1533 '.wmd' =>
'video/x-ms-wmd',
1534 '.wml' =>
'text/vnd.wap.wml',
1535 '.wmlc' =>
'application/vnd.wap.wmlc',
1536 '.wmls' =>
'text/vnd.wap.wmlscript',
1537 '.wmlsc' =>
'application/vnd.wap.wmlscriptc',
1538 '.wmv' =>
'video/x-ms-wmv',
1539 '.wmx' =>
'video/x-ms-wmx',
1540 '.wmz' =>
'video/x-ms-wmz',
1541 '.wvx' =>
'video/x-ms-wvx',
1542 '.wrl' =>
'x-world/x-vrml',
1543 '.xbm' =>
'image/x-xbitmap',
1544 '.xla' =>
'application/msexcel',
1545 '.xlb' =>
'application/vnd.ms-excel',
1546 '.xls' =>
'application/msexcel',
1547 '.xml' =>
'text/xml',
1548 '.xpm' =>
'image/x-xpixmap',
1549 '.xsl' =>
'application/xml',
1550 '.xwd' =>
'image/x-xwindowdump',
1551 '.zip' =>
'application/zip');
1562 return array(
"image/x-ms-bmp",
"image/gif",
"image/jpeg",
"image/x-portable-bitmap",
1563 "image/png",
"image/psd",
"image/tiff",
"application/pdf");
1579 $lpath = pathinfo($a_loc);
1580 if ($lpath[
"extension"] ==
"mp3" && $a_format ==
"audio/mpeg")
1584 if ($lpath[
"extension"] ==
"flv")
1598 $media_object->setTitle($name);
1599 $media_object->setDescription(
"");
1600 $media_object->create();
1603 $media_object->createDirectory();
1607 $media_object->addMediaItem($media_item);
1608 $media_item->setPurpose(
"Standard");
1610 $file = $mob_dir.
"/".$name;
1617 copy($tmp_name,
$file);
1623 $media_item->setFormat($format);
1625 $media_item->setLocationType(
"LocalFile");
1626 $media_object->setTitle($name);
1627 $media_object->setDescription($format);
1632 $media_item->setWidth(
$size[0]);
1633 $media_item->setHeight(
$size[1]);
1635 $media_item->setHAlign(
"Left");
1638 $media_object->update();
1640 return $media_object;
1648 $a_subdir = str_replace(
"..",
"", $a_subdir);
1650 if ($a_subdir !=
"")
1652 $dir.=
"/".$a_subdir;
1669 $t_dir.
"/".$a_thumbname, $a_format, $a_size);
1681 return $t_dir.
"/".$a_thumbname;
1690 $file = str_replace(
"..",
"", $a_file);
1706 if (!is_array($a_ignore))
1708 $a_ignore = array();
1714 foreach($med_items as $med_item)
1717 foreach ($int_links as $k => $int_link)
1719 if ($int_link[
"Type"] ==
"MediaObject")
1721 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
1725 if (!in_array($l_id, $linked) &&
1726 !in_array($l_id, $a_ignore))
1744 $str = $mset->get(
"restricted_file_types");
1745 $types = explode(
",", $str);
1746 $suffixes = array();
1747 if (count($types) > 0)
1749 foreach ($types as $k =>
$t)
1751 if (($s = strtolower(trim(
$t))) !=
"")
1766 $new_obj->setTitle($this->
getTitle());
1772 $new_obj->addMediaItem($val);
1775 $new_obj->create(
false,
true);
1778 $new_obj->createDirectory();
1786 include_once(
"Services/MetaData/classes/class.ilMD.php");
1787 $md =
new ilMD(0, $this->
getId(),
"mob");
1788 $new_md = $md->cloneMD(0, $new_obj->getId(),
"mob");