ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilMobMultiSrtUploadGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
17 protected $ctrl;
18
22 protected $lng;
23
27 protected $toolbar;
28
32 protected $tpl;
33
34 public $multi_srt;
35
41 public function __construct(ilMobMultiSrtInt $a_multi_srt)
42 {
43 global $DIC;
44
45 $ilCtrl = $DIC->ctrl();
46 $lng = $DIC->language();
47 $ilToolbar = $DIC->toolbar();
48 $tpl = $DIC["tpl"];
49
50 $this->tpl = $tpl;
51 $this->lng = $lng;
52 $this->ctrl = $ilCtrl;
53 include_once("./Services/MediaObjects/classes/class.ilMobMultiSrtUpload.php");
54 $this->multi_srt = new ilMobMultiSrtUpload($a_multi_srt);
55 $this->toolbar = $ilToolbar;
56 }
57
61 public function executeCommand()
62 {
63 $cmd = $this->ctrl->getCmd("uploadMultipleSubtitleFileForm");
64
65 if (in_array($cmd, array("uploadMultipleSubtitleFileForm", "uploadMultipleSubtitleFile", "showMultiSubtitleConfirmationTable", "cancelMultiSrt", "saveMultiSrt"))) {
66 $this->$cmd();
67 }
68 }
69
74 {
75 ilUtil::sendInfo($this->lng->txt("cont_upload_multi_srt_howto"));
76
77 // upload file
78 $this->toolbar->setFormAction($this->ctrl->getFormAction($this), true);
79 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
80 $fi = new ilFileInputGUI($this->lng->txt("cont_subtitle_file") . " (.zip)", "subtitle_file");
81 $fi->setSuffixes(array("zip"));
82 $this->toolbar->addInputItem($fi, true);
83
84 $this->toolbar->addFormButton($this->lng->txt("upload"), "uploadMultipleSubtitleFile");
85 }
86
91 {
92 try {
93 $this->multi_srt->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
94 $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
95 } catch (ilLMException $e) {
96 ilUtil::sendFailure($e->getMessage(), true);
97 $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
98 }
99 }
100
105 {
106 include_once("./Services/MediaObjects/classes/class.ilMobMultiSrtConfirmationTable2GUI.php");
107 $tab = new ilMobMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
108 $this->tpl->setContent($tab->getHTML());
109 }
110
114 public function cancelMultiSrt()
115 {
116 $this->multi_srt->clearMultiSrtDirectory();
117 $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
118 }
119
123 public function saveMultiSrt()
124 {
125 $cnt = $this->multi_srt->moveMultiSrtFiles();
126 $this->multi_srt->clearMultiSrtDirectory();
127
128 ilUtil::sendSuccess($this->lng->txt("cont_moved_srt_files") . " (" . $cnt . ")", true);
129 $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
130 }
131}
An exception for terminatinating execution or to throw for unit testing.
This class represents a file property in a property form.
Base exception class for learning modules.
List srt files from zip file for upload confirmation.
Upload SRT files to a set of media objects.
showMultiSubtitleConfirmationTable()
List of srt files in zip file.
uploadMultipleSubtitleFile()
Upload multiple subtitles.
saveMultiSrt()
Save selected srt files as new srt files.
uploadMultipleSubtitleFileForm()
Upload multiple stubtitles.
cancelMultiSrt()
Cancel Multi Feedback.
__construct(ilMobMultiSrtInt $a_multi_srt)
Constructor.
Handler class for multi srt upload.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
global $ilCtrl
Definition: ilias.php:18
Interface ilMobMultiSrtInt.
$DIC
Definition: xapitoken.php:46