30 $lng = $DIC->language();
33 $this->multi_srt = $a_multi_srt;
43 return $this->multi_srt->getUploadDir();
55 include_once(
"./Services/MediaObjects/exceptions/class.ilMobSrtUploadException.php");
56 if (!is_file($a_file[
"tmp_name"])) {
63 ilUtil::moveUploadedFile($a_file[
"tmp_name"],
"multi_srt.zip", $dir .
"/" .
"multi_srt.zip");
82 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
89 if (
$i[
"type"] ==
"file" && !in_array($k,
array(
".",
".."))) {
90 if (pathinfo($k, PATHINFO_EXTENSION) ==
"srt") {
92 if (substr($k, strlen($k) - 7, 1) ==
"_") {
93 $lang = substr($k, strlen($k) - 6, 2);
94 if (!in_array(
$lang, $lang_codes)) {
98 $items[] =
array(
"filename" => $k,
"lang" =>
$lang);
103 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
104 foreach ($this->multi_srt->getMobIds() as $mob) {
106 $mi =
$m->getMediaItem(
"Standard");
107 if ($mi->getLocationType() ==
"LocalFile" && is_int(strpos($mi->getFormat(),
"video"))) {
110 $loc = pathinfo($mi->getLocation(), PATHINFO_FILENAME);
111 foreach ($items as
$i => $item) {
112 if (substr($item[
"filename"], 0, strlen($loc)) == $loc &&
113 substr($item[
"filename"], strlen($loc), 1) ==
"_" &&
114 pathinfo($item[
"filename"], PATHINFO_EXTENSION) ==
"srt") {
115 $l = substr($item[
"filename"], strlen($loc)+1, 2);
116 if (in_array(
$l, $lang_codes)) {
117 $items[
$i][
"lang"] =
$l;
118 $items[
$i][
"mob"] = $mob;
119 $items[
$i][
"mob_title"] =
$m->getTitle();
135 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
137 foreach ($items as
$i) {
138 if ($i[
"mob"] > 0 && $i[
"lang"] !=
"") {
140 $mob->uploadSrtFile($this->
getMultiSrtUploadDir() .
"/" . $i[
"filename"], $i[
"lang"],
"rename");
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
Interface ilMobMultiSrtInt.
getMultiSrtFiles()
Get all srt files of srt multi upload.
__construct(ilMobMultiSrtInt $a_multi_srt)
Construcotr.
static _getPossibleLanguageCodes()
getMultiSrtUploadDir()
Get directory for multi srt upload.
uploadMultipleSubtitleFile($a_file)
Upload multi srt file.
Create styles array
The data for the language used.
clearMultiSrtDirectory()
Clear multi feedback directory.
moveMultiSrtFiles()
Move all srt files that could be mapped to media objects.
Handler class for multi srt upload.
Exception class for srt upload.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively