|
1
|
|
|
<?php |
|
2
|
|
|
namespace EWW\Dpf\ViewHelpers; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
use EWW\Dpf\Domain\Workflow\DocumentWorkflow; |
|
18
|
|
|
|
|
19
|
|
|
class ShowStatusViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Maps the internal states to more user friendly and localized state names. |
|
23
|
|
|
* |
|
24
|
|
|
* @param string $status |
|
25
|
|
|
* @param boolean $remote |
|
26
|
|
|
* @return string |
|
27
|
|
|
*/ |
|
28
|
|
|
public function render($status, $remote = FALSE) |
|
|
|
|
|
|
29
|
|
|
{ |
|
30
|
|
|
// A,I and D are the states returned by a repository search. |
|
31
|
|
|
// The other states are the ones used in the document table. |
|
32
|
|
|
$statusMapping = [ |
|
33
|
|
|
"A" => 'released', |
|
34
|
|
|
"I" => 'postponed', |
|
35
|
|
|
"D" => 'discarded', |
|
36
|
|
|
DocumentWorkflow::STATE_NEW_NONE => "new", |
|
37
|
|
|
DocumentWorkflow::STATE_REGISTERED_NONE => "registered", |
|
38
|
|
|
DocumentWorkflow::STATE_POSTPONED_NONE => "postponed", |
|
39
|
|
|
DocumentWorkflow::STATE_DISCARDED_NONE => "discarded", |
|
40
|
|
|
DocumentWorkflow::STATE_IN_PROGRESS_NONE => "inProgress", |
|
41
|
|
|
DocumentWorkflow::STATE_IN_PROGRESS_ACTIVE => "in_progress", |
|
42
|
|
|
DocumentWorkflow::STATE_IN_PROGRESS_INACTIVE => "in_progress", |
|
43
|
|
|
DocumentWorkflow::STATE_IN_PROGRESS_DELETED => "in_progress", |
|
44
|
|
|
]; |
|
45
|
|
|
|
|
46
|
|
|
if (array_key_exists($status, $statusMapping)) { |
|
47
|
|
|
return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate( |
|
48
|
|
|
"manager.documentList.state.".$statusMapping[$status], |
|
49
|
|
|
'dpf', |
|
50
|
|
|
$arguments = null |
|
51
|
|
|
); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
return "-"; |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.