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
"./Services/Object/classes/class.ilObject.php";
40 $this->is_alias =
false;
41 $this->media_items =
array();
42 $this->contains_int_link =
false;
44 parent::__construct($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)
130 self::handleQuotaUpdate($this);
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]);
324 $media_items =
array();
325 foreach ($this->media_items as $media_item)
327 $media_items [$i] = $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)
465 for($i=0; $i<count($media_items); $i++)
467 $item = $media_items[$i];
468 $item->setMobId($this->
getId());
474 self::handleQuotaUpdate($this);
476 global $ilAppEventHandler;
477 $ilAppEventHandler->raise(
'Services/MediaObjects',
479 array(
'object' => $this,
481 'obj_id' => $this->
getId())
503 foreach($media_items as $key => $val)
505 $item = $media_items[$key];
506 if (is_object($item))
508 $item->setMobId($this->
getId());
510 if ($item->getLocationType() ==
"Reference")
512 $item->extractUrlParameters();
519 self::handleQuotaUpdate($this);
520 global $ilAppEventHandler;
521 $ilAppEventHandler->raise(
'Services/MediaObjects',
523 array(
'object' => $this,
525 'obj_id' => $this->
getId())
538 if ($ilSetting->get(
"disable_personal_workspace") && !$ilSetting->get(
'user_portfolios'))
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"] !=
"..")
695 $xml =
"<MediaObject>";
696 $xml .=
"<MediaAlias OriginId=\"il__mob_".$this->getId().
"\"/>";
698 for($i=0; $i<count($media_items); $i++)
700 $item = $media_items[$i];
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\">".
723 if ($item->getTextRepresentation() !=
"")
725 $xml .=
"<TextRepresentation>".
726 $this->
escapeProperty($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().
"\">";
748 for($i=0; $i<count($media_items); $i++)
750 $item = $media_items[$i];
752 $xml .=
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
755 $loc = ($item->getLocationType() ==
"Reference")
757 : $item->getLocation();
758 $xml.=
"<Location Type=\"".$item->getLocationType().
"\">".
762 $xml.=
"<Format>".$item->getFormat().
"</Format>";
765 $width = ($item->getWidth() !=
"")
766 ?
"Width=\"".$item->getWidth().
"\"" 768 $height = ($item->getHeight() !=
"")
769 ?
"Height=\"".$item->getHeight().
"\"" 771 $halign = ($item->getHAlign() !=
"")
772 ?
"HorizontalAlign=\"".$item->getHAlign().
"\"" 774 $xml .=
"<Layout $width $height $halign />";
777 if ($item->getCaption() !=
"")
779 $xml .=
"<Caption Align=\"bottom\">".
784 if ($item->getTextRepresentation() !=
"")
786 $xml .=
"<TextRepresentation>".
787 $this->
escapeProperty($item->getTextRepresentation()).
"</TextRepresentation>";
791 $parameters = $item->getParameters();
792 foreach ($parameters as $name => $value)
794 $xml .=
"<Parameter Name=\"$name\" Value=\"$value\"/>";
796 $xml .= $item->getMapAreasXML();
799 if ($item->getPurpose() ==
"Standard")
802 foreach ($srts as $srt)
806 if ($ilUser->getLanguage() != $meta_lang &&
807 $ilUser->getLanguage() == $srt[
"language"])
809 $def =
' Default="true" ';
811 $xml .=
"<Subtitle File=\"".$srt[
"full_path"].
812 "\" Language=\"".$srt[
"language"].
"\" ".$def.
"/>";
815 $xml .=
"</MediaItem>";
823 $xml =
"<MediaObject>";
826 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
828 $md2xml->setExportMode(
true);
829 $md2xml->startExport();
830 $xml.= $md2xml->getXML();
833 for($i=0; $i<count($media_items); $i++)
835 $item = $media_items[$i];
838 $xml .=
"<MediaItem Purpose=\"".$item->getPurpose().
"\">";
841 $xml.=
"<Location Type=\"".$item->getLocationType().
"\">".
842 $this->
handleAmps($item->getLocation()).
"</Location>";
845 $xml.=
"<Format>".$item->getFormat().
"</Format>";
848 $width = ($item->getWidth() !=
"")
849 ?
"Width=\"".$item->getWidth().
"\"" 851 $height = ($item->getHeight() !=
"")
852 ?
"Height=\"".$item->getHeight().
"\"" 854 $halign = ($item->getHAlign() !=
"")
855 ?
"HorizontalAlign=\"".$item->getHAlign().
"\"" 857 $xml .=
"<Layout $width $height $halign />";
860 if ($item->getCaption() !=
"")
862 $xml .=
"<Caption Align=\"bottom\">".
863 str_replace(
"&",
"&", $item->getCaption()).
"</Caption>";
867 if ($item->getTextRepresentation() !=
"")
869 $xml .=
"<TextRepresentation>".
870 str_replace(
"&",
"&", $item->getTextRepresentation()).
"</TextRepresentation>";
874 $parameters = $item->getParameters();
875 foreach ($parameters as $name => $value)
877 $xml .=
"<Parameter Name=\"$name\" Value=\"$value\"/>";
879 $xml .= $item->getMapAreasXML(
true, $a_inst);
880 $xml .=
"</MediaItem>";
884 $xml .=
"</MediaObject>";
896 return htmlspecialchars($a_value);
905 $a_str = str_replace(
"&",
"&", $a_str);
906 $a_str = str_replace(
"&",
"&", $a_str);
928 $subdir =
"il_".IL_INST_ID.
"_mob_".$this->
getId();
938 $subdir =
"il_".IL_INST_ID.
"_mob_".$this->
getId();
939 $a_target_dir = $a_target_dir.
"/objects/".$subdir;
941 $tpl =
new ilTemplate(
"tpl.fullscreen.html",
true,
true,
"Modules/LearningModule");
942 $tpl->setCurrentBlock(
"ilMedia");
950 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
952 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
957 $xml.= $pg_obj->getMediaAliasElement($this->
getId());
964 $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
965 $args =
array(
'/_xml' => $xml,
'/_xsl' => $xsl );
972 $params =
array (
'mode' =>
"fullscreen",
'enlarge_path' => $enlarge_path,
973 'link_params' =>
"ref_id=".
$_GET[
"ref_id"],
'fullscreen_link' =>
"",
974 'ref_id' =>
$_GET[
"ref_id"],
'webspace_path' => $wb_path);
975 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args,
$params);
980 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
981 $tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
"../../css/style.css");
982 $tpl->setVariable(
"LOCATION_STYLESHEET",
"../../css/system.css");
986 $output = preg_replace(
"/mobs\/mm_(\d+)\/([^\"]+)/i",
"$2",
$output);
987 $output = preg_replace(
"/\.\/Services\/MediaObjects\/flash_mp3_player/i",
"../../players",
$output);
989 $output = preg_replace(
"/file=..\/..\/..\//i",
"file=../objects/".$subdir.
"/",
$output);
991 fwrite(fopen($a_target_dir.
'/fullscreen.html',
'w'),
$output );
996 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
1017 $this->contains_int_link = $a_contains_link;
1037 if ($a_usage_hist_nr !==
false)
1039 $and_hist =
" AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr,
"integer");
1043 $set = $ilDB->query(
"SELECT id FROM mob_usage".
1044 " WHERE usage_type = ".$ilDB->quote(
$a_type,
"text").
1045 " AND usage_id = ".$ilDB->quote($a_id,
"integer").
1046 " AND usage_lang = ".$ilDB->quote($a_lang,
"text").
1048 while(
$row = $ilDB->fetchAssoc($set))
1050 $mob_ids[] =
$row[
"id"];
1053 $q =
"DELETE FROM mob_usage WHERE usage_type = ".
1054 $ilDB->quote(
$a_type,
"text").
1055 " AND usage_id= ".$ilDB->quote($a_id,
"integer").
1056 " AND usage_lang = ".$ilDB->quote($a_lang,
"text").
1058 $ilDB->manipulate($q);
1060 foreach($mob_ids as $mob_id)
1062 self::handleQuotaUpdate(
new self($mob_id));
1076 $lstr =
" AND usage_lang = ".$ilDB->quote($a_lang,
"text");
1079 if ($a_usage_hist_nr !==
false)
1081 $hist_str =
" AND usage_hist_nr = ".$ilDB->quote($a_usage_hist_nr,
"integer");
1084 $q =
"SELECT * FROM mob_usage WHERE ".
1085 "usage_type = ".$ilDB->quote(
$a_type,
"text").
" AND ".
1086 "usage_id = ".$ilDB->quote($a_id,
"integer").
1089 $mob_set = $ilDB->query($q);
1090 while($mob_rec = $ilDB->fetchAssoc($mob_set))
1094 $mobs[$mob_rec[
"id"]] = $mob_rec[
"id"];
1108 $ilDB->replace(
"mob_usage",
1110 "id" =>
array(
"integer", (
int) $a_mob_id),
1112 "usage_id" =>
array(
"integer", $a_id),
1113 "usage_lang" =>
array(
"text", $a_lang),
1114 "usage_hist_nr" =>
array(
"integer", (
int) $a_usage_hist_nr)
1119 self::handleQuotaUpdate(
new self($a_mob_id));
1129 $q =
"DELETE FROM mob_usage WHERE ".
1130 " id = ".$ilDB->quote((
int) $a_mob_id,
"integer").
" AND ".
1131 " usage_type = ".$ilDB->quote(
$a_type,
"text").
" AND ".
1132 " usage_id = ".$ilDB->quote((
int) $a_id,
"integer").
" AND ".
1133 " usage_lang = ".$ilDB->quote($a_lang,
"text").
" AND ".
1134 " usage_hist_nr = ".$ilDB->quote((
int) $a_usage_hist_nr,
"integer");
1135 $ilDB->manipulate($q);
1137 self::handleQuotaUpdate(
new self($a_mob_id));
1145 return self::lookupUsages($this->
getId(), $a_include_history);
1158 if ($a_include_history)
1160 $hist_str =
", usage_hist_nr";
1164 $q =
"SELECT DISTINCT usage_type, usage_id, usage_lang".$hist_str.
" FROM mob_usage WHERE id = ".
1165 $ilDB->quote($a_id,
"integer");
1167 if (!$a_include_history)
1169 $q.=
" AND usage_hist_nr = ".$ilDB->quote(0,
"integer");
1172 $us_set = $ilDB->query($q);
1174 while($us_rec = $ilDB->fetchAssoc($us_set))
1177 if(is_int(strpos($us_rec[
"usage_type"],
":")))
1179 $us_arr = explode(
":", $us_rec[
"usage_type"]);
1188 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
1197 $ret[] =
array(
"type" => $us_rec[
"usage_type"],
1198 "id" => $us_rec[
"usage_id"],
1199 "lang" => $us_rec[
"usage_lang"],
1200 "hist_nr" => $us_rec[
"usage_hist_nr"]);
1205 $q =
"SELECT DISTINCT mep_id FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE mep_item.foreign_id = ".
1206 $ilDB->quote($a_id,
"integer").
" AND mep_item.type = ".$ilDB->quote(
"mob",
"text");
1207 $us_set = $ilDB->query($q);
1208 while($us_rec = $ilDB->fetchAssoc($us_set))
1211 "id" => $us_rec[
"mep_id"]);
1215 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1217 foreach($news_usages as $nu)
1224 $q =
"SELECT DISTINCT mob_id FROM media_item it, map_area area ".
1225 " WHERE area.item_id = it.id ".
1226 " AND area.link_type = ".$ilDB->quote(
"int",
"text").
" ".
1227 " AND area.target = ".$ilDB->quote(
"il__mob_".$a_id,
"text");
1228 $us_set = $ilDB->query($q);
1229 while($us_rec = $ilDB->fetchAssoc($us_set))
1232 "id" => $us_rec[
"mob_id"]);
1237 foreach ($users as $user)
1253 if(is_int(strpos($a_usage[
"type"],
":")))
1255 $us_arr = explode(
":", $a_usage[
"type"]);
1257 $cont_type = $us_arr[0];
1261 $type = $a_usage[
"type"];
1264 $id = $a_usage[
"id"];
1276 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
1278 if ($qinfo[
"original_id"] > 0)
1280 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
1285 $obj_id = $qinfo[
"obj_fi"];
1291 include_once(
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php");
1295 $parent_id = $quest->getObjId();
1298 if ($quest->getOriginalId() &&
1306 $obj_id = $parent_id;
1315 $returned_pk = $a_usage[
'id'];
1317 include_once
'Modules/Exercise/classes/class.ilExSubmission.php';
1323 $post_pk = $a_usage[
'id'];
1324 include_once
'Modules/Forum/classes/class.ilForumPost.php';
1325 include_once
'Modules/Forum/classes/class.ilForum.php';
1327 $frm_pk = $oPost->getForumId();
1333 $draft_id = $a_usage[
'id'];
1334 include_once
'Modules/Forum/classes/class.ilForumPostDraft.php';
1335 include_once
'Modules/Forum/classes/class.ilForum.php';
1336 $oDraft = ilForumPostDraft::newInstanceByDraftId($draft_id);
1338 $frm_pk = $oDraft->getForumId();
1342 $history_id = $a_usage[
'id'];
1343 include_once
'Modules/Forum/classes/class.ilForumDraftsHistory.php';
1344 include_once
'Modules/Forum/classes/class.ilForumPostDraft.php';
1345 include_once
'Modules/Forum/classes/class.ilForum.php';
1347 $oDraft = ilForumPostDraft::newInstanceByDraftId($oHistoryDraft->getDraftId());
1349 $frm_pk = $oDraft->getForumId();
1355 $obj_id = $a_usage[
'id'];
1377 include_once(
'./Services/COPage/classes/class.ilPageObject.php');
1383 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
1385 if ($qinfo[
"original_id"] > 0)
1387 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
1392 $obj_id = $qinfo[
"obj_fi"];
1396 include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
1398 if ($pinfo && $pinfo[
"parent_type"] ==
"lm")
1400 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1404 if ($pinfo && $pinfo[
"parent_type"] ==
"sahs")
1406 include_once(
"./Modules/SCORM2004/classes/class.ilSCORM2004Node.php");
1414 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1420 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
1421 include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1428 include_once
'Modules/Wiki/classes/class.ilWikiPage.php';
1435 include_once(
'./Services/COPage/classes/class.ilPageObject.php');
1441 include_once
"Modules/Portfolio/classes/class.ilPortfolioPage.php";
1447 include_once
"Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
1453 include_once(
'./Services/COPage/classes/class.ilPageObject.php');
1481 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1496 static function _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop =
false)
1498 $file_path = pathinfo($a_file);
1499 $location = substr($file_path[
"basename"],0,strlen($file_path[
"basename"]) -
1500 strlen($file_path[
"extension"]) - 1).
"_".
1502 $a_height.
".".$file_path[
"extension"];
1503 $target_file = $file_path[
"dirname"].
"/".
1506 (
int) $a_width, (
int) $a_height, $a_constrain_prop);
1520 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1529 $a_file, $a_reference, $a_constrain_proportions, $a_use_original,
1530 $a_user_width, $a_user_height)
1539 if ($a_format ==
"audio/mpeg")
1547 include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1558 if ($a_use_original)
1569 $info = $lng->txt(
"cont_could_not_determine_resource_size");
1574 $w = (int) $a_user_width;
1575 $h = (int) $a_user_height;
1597 $height = (int) (
$size[1]/
$r);
1605 if ($width == 0 && $a_user_width ===
"")
1609 if ($height == 0 && $a_user_height ===
"")
1614 return array(
"width" => $width,
"height" => $height,
"info" =>
$info);
1623 return array(
"image/x-ms-bmp",
"image/gif",
"image/jpeg",
"image/x-portable-bitmap",
1624 "image/png",
"image/psd",
"image/tiff",
"application/pdf");
1640 $lpath = pathinfo($a_loc);
1641 if ($lpath[
"extension"] ==
"mp3" && $a_format ==
"audio/mpeg")
1645 if ($lpath[
"extension"] ==
"flv")
1649 if (in_array($a_format,
array(
"video/mp4",
"video/webm")))
1663 $media_object->setTitle($name);
1664 $media_object->setDescription(
"");
1665 $media_object->create();
1668 $media_object->createDirectory();
1672 $media_object->addMediaItem($media_item);
1673 $media_item->setPurpose(
"Standard");
1675 $file = $mob_dir.
"/".$name;
1682 copy($tmp_name,
$file);
1688 $media_item->setFormat($format);
1690 $media_item->setLocationType(
"LocalFile");
1691 $media_object->setTitle($name);
1692 $media_object->setDescription($format);
1696 include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
1698 $media_item->setWidth(
$size[0]);
1699 $media_item->setHeight(
$size[1]);
1701 $media_item->setHAlign(
"Left");
1703 self::renameExecutables($mob_dir);
1704 include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1707 $media_object->update();
1709 return $media_object;
1717 $a_subdir = str_replace(
"..",
"", $a_subdir);
1719 if ($a_subdir !=
"")
1721 $dir.=
"/".$a_subdir;
1725 self::renameExecutables($mob_dir);
1726 include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1739 if (is_file($a_tmp_name) && $a_language !=
"")
1754 if (!is_dir($srt_dir))
1761 $srt_files =
array();
1762 foreach ($items as $i)
1764 if (!in_array($i[
"entry"],
array(
".",
"..")) && $i[
"type"] ==
"file")
1766 $name = explode(
".", $i[
"entry"]);
1767 if ($name[1] ==
"srt" && substr($name[0], 0, 9) ==
"subtitle_")
1769 $srt_files[] =
array(
"file" => $i[
"entry"],
1770 "full_path" =>
"srt/".$i[
"entry"],
"language" => substr($name[0], 9, 2));
1786 self::_createThumbnailDirectory($this->
getId());
1788 $t_dir.
"/".$a_thumbname, $a_format, $a_size);
1800 return $t_dir.
"/".$a_thumbname;
1809 $file = str_replace(
"..",
"", $a_file);
1825 if (!is_array($a_ignore))
1827 $a_ignore =
array();
1833 foreach($med_items as $med_item)
1836 foreach ($int_links as $k => $int_link)
1838 if ($int_link[
"Type"] ==
"MediaObject")
1840 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1844 if (!in_array($l_id, $linked) &&
1845 !in_array($l_id, $a_ignore))
1862 return array_filter(self::getAllowedFileTypes(),
function ($v) {
1863 return !in_array($v, self::getForbiddenFileTypes());
1875 if (trim($mset->get(
"black_list_file_types")) ==
"")
1879 return array_map(
function ($v)
1881 return strtolower(trim($v));
1883 explode(
",", $mset->get(
"black_list_file_types")));
1894 if (trim($mset->get(
"restricted_file_types")) ==
"")
1898 return array_map(
function ($v)
1900 return strtolower(trim($v));
1902 explode(
",", $mset->get(
"restricted_file_types")));
1913 if (in_array(
$a_type, self::getForbiddenFileTypes()))
1917 if (count(self::getAllowedFileTypes()) == 0 || in_array(
$a_type, self::getAllowedFileTypes()))
1931 $new_obj->setTitle($this->
getTitle());
1937 $new_obj->addMediaItem($val);
1940 $new_obj->create(
false,
true);
1943 $new_obj->createDirectory();
1944 self::_createThumbnailDirectory($new_obj->getId());
1951 include_once(
"Services/MetaData/classes/class.ilMD.php");
1952 $md =
new ilMD(0, $this->
getId(),
"mob");
1953 $new_md = $md->cloneMD(0, $new_obj->getId(),
"mob");
1972 $pi = pathinfo($a_prevpic[
"name"]);
1973 $ext = $pi[
"extension"];
1974 if (in_array($ext,
array(
"jpg",
"jpeg",
"png")))
1990 if ($item->getLocationType() ==
"LocalFile" &&
1991 is_int(strpos($item->getFormat(),
"image/")))
1995 $item->getLocation();
2019 $ppics =
array(
"mob_vpreview.jpg",
2020 "mob_vpreview.jpeg",
2021 "mob_vpreview.png");
2022 foreach ($ppics as $p)
2024 if (is_file($dir.
"/".$p))
2026 if ($a_filename_only)
2049 $rchars =
array(
"`",
"=",
"$",
"{",
"}",
"'",
";",
" ",
"(",
")");
2050 $a_name = str_replace($rchars,
"_", $a_name);
2051 $a_name = str_replace(
"__",
"_", $a_name);
2078 include_once(
"./Services/MediaObjects/exceptions/class.ilMediaObjectsException.php");
2079 if (!is_file($a_file[
"tmp_name"]))
2106 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
2111 foreach (
$files as $k => $i)
2114 if ($i[
"type"] ==
"file" && !in_array($k,
array(
".",
"..")))
2116 if (pathinfo($k, PATHINFO_EXTENSION) ==
"srt")
2119 if (substr($k, strlen($k) - 7, 1) ==
"_")
2121 $lang = substr($k, strlen($k) - 6, 2);
2122 if (!in_array(
$lang, $lang_codes))
2127 $items[] =
array(
"filename" => $k,
"lang" =>
$lang);
2142 if (!self::isTypeAllowed(
"html"))
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static _lookupObjIdForForumId($a_for_id)
static rRenameSuffix($a_dir, $a_old_suffix, $a_new_suffix)
Renames all files with certain suffix and gives them a new suffix.
static _lookupSLMID($a_id)
Lookup Scorm Learning Module ID for node id.
static _lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
static _lookupSurveyObjId($a_question_id)
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static lookupMimeType($path_to_file, $fallback=self::APPLICATION__OCTET_STREAM, $a_external=false)
static _getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
Class ilObject Basic functions for all objects.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
static findPortfolioForPage($a_page_id)
Get portfolio id of page id.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static lookupExerciseIdForReturnedId($a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
Class ilForumDraftHistory.
static _lookupTermId($a_def_id)
Looks up term id for a definition id.
static _getQuestionInfo($question_id)
Returns question information from the database.
static lookupParentId($a_id, $a_type)
Lookup parent id.
static _getIntLinks($a_item_id)
get all internal links of a media items map areas
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
static _getPossibleLanguageCodes()
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
static _lookupMediaObjectUsages($a_mob_id)
Lookup media object usage(s)
static execConvert($args)
execute convert command
static _getPageForQuestionId($a_q_id, $a_parent_type="")
Get page for question id.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
special template class to simplify handling of ITX/PEAR
static getFlashVideoPlayerDirectory()
Get flash video player directory.
redirection script todo: (a better solution should control the processing via a xml file) ...
static createDirectory($a_dir, $a_mod=0755)
create directory
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
getType()
get object type public
static getHtmlPath($relative_path)
get url of path
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
const APPLICATION__OCTET_STREAM
static _lookGlossaryID($term_id)
get glossary id form term id
static secureUrl($url)
Prepare secure href attribute.
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
static escapeShellArg($a_arg)
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 _lookupContextObjId($a_news_id)
Context Object ID.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static getLogger($a_component_id)
Get component logger.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
static lookupObjIdByPage($a_page_id)
returns the wiki/object id to a given page id