ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilLMMultiSrtUploadGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
14 protected $lm;
15 public $multi_srt;
16
22 public function __construct(ilObjLearningModule $a_lm)
23 {
24 global $ilCtrl;
25
26 $this->ctrl = $ilCtrl;
27 $this->lm = $a_lm;
28 include_once("./Modules/LearningModule/classes/class.ilLMMultiSrt.php");
29 $this->multi_srt = new ilLMMultiSrt($this->lm);
30 }
31
35 function executeCommand()
36 {
37 global $ilCtrl;
38
39 $cmd = $ilCtrl->getCmd("uploadMultipleSubtitleFileForm");
40
41 if (in_array($cmd, array("uploadMultipleSubtitleFileForm", "uploadMultipleSubtitleFile", "showMultiSubtitleConfirmationTable", "cancelMultiSrt", "saveMultiSrt")))
42 {
43 $this->$cmd();
44 }
45 }
46
51 {
52 global $ilToolbar, $lng, $ilCtrl;
53
54 ilUtil::sendInfo($lng->txt("cont_upload_multi_srt_howto"));
55
56 // upload file
57 $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
58 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
59 $fi = new ilFileInputGUI($lng->txt("cont_subtitle_file")." (.zip)", "subtitle_file");
60 $fi->setSuffixes(array("zip"));
61 $ilToolbar->addInputItem($fi, true);
62
63 $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
64 }
65
70 {
71 try
72 {
73 $this->multi_srt->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
74 $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
75 }
76 catch (ilLMException $e)
77 {
78 ilUtil::sendFailure($e->getMessage(), true);
79 $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
80 }
81
82 }
83
88 {
89 global $tpl;
90
91 include_once("./Modules/LearningModule/classes/class.ilLMMultiSrtConfirmationTable2GUI.php");
92 $tab = new ilLMMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
93 $tpl->setContent($tab->getHTML());
94 }
95
99 function cancelMultiSrt()
100 {
101 $this->multi_srt->clearMultiSrtDirectory();
102 $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
103 }
104
108 function saveMultiSrt()
109 {
110 global $ilCtrl, $lng;
111
112 $cnt = $this->multi_srt->moveMultiSrtFiles();
113 $this->multi_srt->clearMultiSrtDirectory();
114
115 ilUtil::sendSuccess($lng->txt("cont_moved_srt_files")." (".$cnt.")", true);
116 $ilCtrl->redirect($this, "uploadMultipleSubtitleFileForm");
117 }
118
119
120
121}
122
123?>
global $tpl
Definition: ilias.php:8
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 all media objects of a learning module.
saveMultiSrt()
Save selected srt files as new srt files.
uploadMultipleSubtitleFile()
Upload multiple subtitles.
__construct(ilObjLearningModule $a_lm)
Constructor.
showMultiSubtitleConfirmationTable()
List of srt files in zip file.
cancelMultiSrt()
Cancel Multi Feedback.
uploadMultipleSubtitleFileForm()
Upload multiple stubtitles.
Handler class for multi srt upload in learning modules.
Class ilObjLearningModule.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35