34 "/lm_".$this->lm->getId().
"/srt_tmp";
48 include_once(
"./Modules/LearningModule/exceptions/class.ilLMException.php");
49 if (!is_file($a_file[
"tmp_name"]))
51 throw new ilLMException($lng->txt(
"cont_srt_zip_file_could_not_be_uploaded"));
76 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
81 foreach (
$files as $k => $i)
84 if ($i[
"type"] ==
"file" && !in_array($k,
array(
".",
"..")))
86 if (pathinfo($k, PATHINFO_EXTENSION) ==
"srt")
89 if (substr($k, strlen($k) - 7, 1) ==
"_")
91 $lang = substr($k, strlen($k) - 6, 2);
92 if (!in_array(
$lang, $lang_codes))
97 $items[] =
array(
"filename" => $k,
"lang" =>
$lang);
104 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
105 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
108 foreach ($pages as $page)
112 foreach ($pg_mobs as $k => $pg_mob)
117 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
118 foreach ($mobs as $mob)
121 $mi = $m->getMediaItem(
"Standard");
122 if ($mi->getLocationType() ==
"LocalFile" && is_int(strpos($mi->getFormat(),
"video")))
126 $loc = pathinfo($mi->getLocation(), PATHINFO_FILENAME);
127 foreach ($items as $i => $item)
129 if (substr($item[
"filename"], 0, strlen($loc)) == $loc &&
130 substr($item[
"filename"], strlen($loc), 1) ==
"_" &&
131 pathinfo($item[
"filename"], PATHINFO_EXTENSION) ==
"srt")
133 $l = substr($item[
"filename"], strlen($loc)+1, 2);
134 if (in_array(
$l, $lang_codes))
136 $items[$i][
"lang"] =
$l;
137 $items[$i][
"mob"] = $mob;
138 $items[$i][
"mob_title"] = $m->getTitle();
155 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
157 foreach ($items as $i)
159 if ($i[
"mob"] > 0 && $i[
"lang"] !=
"")
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Class ilObjLearningModule.
moveMultiSrtFiles()
Move all srt files that could be mapped to media objects.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
Base exception class for learning modules.
__construct(ilObjLearningModule $a_lm)
Construcotr.
static _getPossibleLanguageCodes()
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Create styles array
The data for the language used.
static getDataDir()
get data directory (outside webspace)
getMultiSrtUploadDir()
Get directory for multi srt upload.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
getMultiSrtFiles()
Get all srt files of srt multi upload.
static getPageList($lm_id)
static
uploadMultipleSubtitleFile($a_file)
Upload multi srt file.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
clearMultiSrtDirectory()
Clear multi feedback directory.
Handler class for multi srt upload in learning modules.