Commit 7d33380def07f519467077fd943437e835ef080d
1 parent
7df21997
Exists in
master
and in
56 other branches
Send TT and catalog to SAMP
Showing
2 changed files
with
27 additions
and
3 deletions
Show diff stats
src/InputOutput/IHMImpl/TimeTables/IHMInputOutputTTClass.php
... | ... | @@ -23,6 +23,10 @@ class IHMInputOutputTTClass implements InputOutputInterface |
23 | 23 | { |
24 | 24 | if (isset($this->processDatas)) |
25 | 25 | unset($this->processDatas); |
26 | + | |
27 | + $sendToSamp = isset($input->sendToSamp) && $input->sendToSamp; | |
28 | + $compression = !$sendToSamp && ($input->compression !== 'none'); | |
29 | + $format = $sendToSamp ? 'vot' : $input->fileformat; | |
26 | 30 | |
27 | 31 | $final = ""; |
28 | 32 | |
... | ... | @@ -52,7 +56,7 @@ class IHMInputOutputTTClass implements InputOutputInterface |
52 | 56 | $processData->setInputFileFormat(TTRequestFileFormatEnum::INTERNAL); |
53 | 57 | $processData->setOutputDir(IHMConfigClass::getDownloadTmpPath()); |
54 | 58 | |
55 | - switch ($input->fileformat) { | |
59 | + switch ($format) { | |
56 | 60 | case 'vot' : |
57 | 61 | $processData->setOutputFileFormat(TTRequestFileFormatEnum::VOTABLE); |
58 | 62 | $outputName = $tt->name.'.xml'; |
... | ... | @@ -67,6 +71,7 @@ class IHMInputOutputTTClass implements InputOutputInterface |
67 | 71 | $final .= " ".$outputName; |
68 | 72 | $processData->setType($function); |
69 | 73 | $processData->setCmd("ttConversion"); |
74 | + $processData->setSendToSamp($sendToSamp); | |
70 | 75 | |
71 | 76 | $this->processDatas[] = $processData; |
72 | 77 | } |
... | ... | @@ -74,7 +79,7 @@ class IHMInputOutputTTClass implements InputOutputInterface |
74 | 79 | $this->postProcessTT = new PostProcessTTClass(); |
75 | 80 | $this->postProcessTT->setOutputDirAlias($this->processDatas[0]->getOutputDir()); |
76 | 81 | |
77 | - if ($input->compression !== 'none') { | |
82 | + if ($compression) { | |
78 | 83 | $this->postProcessTT->compression = true; |
79 | 84 | $archive = "Timetable_archive_".date('Ymd_Hi'); |
80 | 85 | switch ($input->compression) { |
... | ... | @@ -125,6 +130,14 @@ class IHMInputOutputTTClass implements InputOutputInterface |
125 | 130 | |
126 | 131 | |
127 | 132 | } |
133 | + else if ($data[0]->getSendToSamp()) { | |
134 | + $donwload = array(); | |
135 | + foreach ($data as $d) { | |
136 | + $donwload[] = $this->postProcessTT->getOutputDirAlias().$d->getOutputFileName(); | |
137 | + } | |
138 | + $result = array('success'=>$data[0]->getSuccess(), 'sendToSamp' => TRUE, | |
139 | + 'download' => $donwload); | |
140 | + } | |
128 | 141 | else { |
129 | 142 | $result = array('success'=>$data[0]->getSuccess(), |
130 | 143 | 'download' => $this->postProcessTT->getOutputDirAlias().$data[0]->getOutputFileName()); | ... | ... |
src/Request/TTRequestImpl/TTRequestDataClass.php
... | ... | @@ -33,6 +33,7 @@ class TTRequestDataClass extends RequestDataClass |
33 | 33 | private $cmd = ""; |
34 | 34 | private $envVars = array(); |
35 | 35 | private $exitCode = 0; |
36 | + private $sendToSamp = FALSE; | |
36 | 37 | |
37 | 38 | public function getInputFileName() |
38 | 39 | { |
... | ... | @@ -83,6 +84,16 @@ class TTRequestDataClass extends RequestDataClass |
83 | 84 | { |
84 | 85 | $this->outputDir = $outputDir; |
85 | 86 | } |
87 | + | |
88 | + public function setSendToSamp($sendToSamp) | |
89 | + { | |
90 | + $this->sendToSamp = $sendToSamp; | |
91 | + } | |
92 | + | |
93 | + public function getSendToSamp($sendToSamp) | |
94 | + { | |
95 | + return $this->sendToSamp; | |
96 | + } | |
86 | 97 | |
87 | 98 | public function getCmd() |
88 | 99 | { |
... | ... | @@ -126,4 +137,4 @@ class TTRequestDataClass extends RequestDataClass |
126 | 137 | } |
127 | 138 | } |
128 | 139 | |
129 | -?> | |
130 | 140 | \ No newline at end of file |
141 | +?> | ... | ... |