37 $lng = $DIC->language();
40 $this->multi_srt = $a_multi_srt;
48 return $this->multi_srt->getUploadDir();
62 if (!is_file($a_file[
"tmp_name"])) {
92 foreach ($files as $k =>
$i) {
94 if (
$i[
"type"] ==
"file" && !in_array($k, array(
".",
".."))) {
95 if (pathinfo($k, PATHINFO_EXTENSION) ==
"srt") {
97 if (substr($k, strlen($k) - 7, 1) ==
"_") {
98 $lang = substr($k, strlen($k) - 6, 2);
99 if (!in_array(
$lang, $lang_codes)) {
103 $items[] = array(
"filename" => $k,
"lang" =>
$lang);
108 foreach ($this->multi_srt->getMobIds() as $mob) {
110 $mi = $m->getMediaItem(
"Standard");
111 if ($mi->getLocationType() ==
"LocalFile" && is_int(strpos($mi->getFormat(),
"video"))) {
114 $loc = pathinfo($mi->getLocation(), PATHINFO_FILENAME);
115 foreach ($items as
$i => $item) {
116 if (substr($item[
"filename"], 0, strlen($loc)) == $loc &&
117 substr($item[
"filename"], strlen($loc), 1) ==
"_" &&
118 pathinfo($item[
"filename"], PATHINFO_EXTENSION) ==
"srt") {
119 $l = substr($item[
"filename"], strlen($loc) + 1, 2);
120 if (in_array($l, $lang_codes)) {
121 $items[
$i][
"lang"] = $l;
122 $items[
$i][
"mob"] = $mob;
123 $items[
$i][
"mob_title"] = $m->getTitle();
140 foreach ($items as
$i) {
141 if ($i[
"mob"] > 0 && $i[
"lang"] !=
"") {
143 $mob->uploadSrtFile($this->
getMultiSrtUploadDir() .
"/" . $i[
"filename"], $i[
"lang"],
"rename");
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
getMultiSrtFiles()
Get all srt files of srt multi upload.
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
__construct(ilMobMultiSrtInt $a_multi_srt)
static _getPossibleLanguageCodes()
getMultiSrtUploadDir()
Get directory for multi srt upload.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
clearMultiSrtDirectory()
Clear multi feedback directory.
moveMultiSrtFiles()
Move all srt files that could be mapped to media objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilMobMultiSrtInt $multi_srt
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
uploadMultipleSubtitleFile(array $a_file)
Upload multi srt file.