1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by: Jens |
4
|
|
|
* Date: 3-4-2018 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace CloudControl\Cms\components\cms\document; |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
use CloudControl\Cms\cc\Request; |
11
|
|
|
use CloudControl\Cms\components\cms\CmsConstants; |
12
|
|
|
use CloudControl\Cms\components\cms\DocumentRouting; |
13
|
|
|
use CloudControl\Cms\components\CmsComponent; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class InfoMessagesHandler |
17
|
|
|
* |
18
|
|
|
* Sets the info messages on the cms component |
19
|
|
|
* |
20
|
|
|
* @package CloudControl\Cms\components\cms\document |
21
|
|
|
*/ |
22
|
|
|
class InfoMessagesHandler |
23
|
|
|
{ |
24
|
|
|
const PARAMETER_INFO_MESSAGE = 'infoMessage'; |
25
|
|
|
const PARAMETER_INFO_MESSAGE_CLASS = 'infoMessageClass'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param CmsComponent $cmsComponent |
29
|
|
|
*/ |
30
|
|
|
public static function notFound(CmsComponent $cmsComponent) |
31
|
|
|
{ |
32
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE, 'Document could not be found. It might have been removed.'); |
33
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE_CLASS, 'error'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param CmsComponent $cmsComponent |
38
|
|
|
*/ |
39
|
|
|
public static function published(CmsComponent $cmsComponent) |
40
|
|
|
{ |
41
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE, |
42
|
|
|
'<i class="fa fa-check-circle-o"></i> Document ' . $_GET[PublicationRouting::GET_PARAMETER_PUBLISHED] . ' published'); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param CmsComponent $cmsComponent |
47
|
|
|
*/ |
48
|
|
|
public static function unpublished(CmsComponent $cmsComponent) |
49
|
|
|
{ |
50
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE, |
51
|
|
|
'<i class="fa fa-times-circle-o"></i> Document ' . $_GET[PublicationRouting::GET_PARAMETER_UNPUBLISHED] . ' unpublished'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param CmsComponent $cmsComponent |
56
|
|
|
*/ |
57
|
|
|
public static function folderDelete(CmsComponent $cmsComponent) |
58
|
|
|
{ |
59
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE, '<i class="fa fa-trash"></i> Folder deleted'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param CmsComponent $cmsComponent |
64
|
|
|
*/ |
65
|
|
|
public static function documentDelete(CmsComponent $cmsComponent) |
66
|
|
|
{ |
67
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE, '<i class="fa fa-trash"></i> Document deleted'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param CmsComponent $cmsComponent |
72
|
|
|
*/ |
73
|
|
|
public static function noDocumentTypes(CmsComponent $cmsComponent) |
74
|
|
|
{ |
75
|
|
|
$documentTypesLink = Request::$subfolders . $cmsComponent->getParameter(CmsConstants::PARAMETER_CMS_PREFIX) . '/configuration/document-types/new'; |
76
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE, |
77
|
|
|
'<i class="fa fa-exclamation-circle"></i> No document types defined yet. Please do so first, <a href="' . $documentTypesLink . '">here</a>.'); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param CmsComponent $cmsComponent |
82
|
|
|
*/ |
83
|
|
|
public static function scheduled(CmsComponent $cmsComponent) |
84
|
|
|
{ |
85
|
|
|
$cmsComponent->setParameter(self::PARAMETER_INFO_MESSAGE, |
86
|
|
|
'<i class="fa fa-clock-o"></i> Document ' . $_GET[PublicationRouting::GET_PARAMETER_SCHEDULED] . ' is scheduled for publication'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
} |