-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathQuestionnaireStatusLabelHelper.php
More file actions
78 lines (73 loc) · 2.12 KB
/
QuestionnaireStatusLabelHelper.php
File metadata and controls
78 lines (73 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Questionnares App Helper
*
* @author Allcreator Co., Ltd. <info@allcreator.net>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('AppHelper', 'View/Helper');
/**
* Questionnaires Status Label Helper
*
* @author Allcreator Co., Ltd. <info@allcreator.net>
* @package NetCommons\Questionnaires\View\Helper
*/
class QuestionnaireStatusLabelHelper extends AppHelper {
/**
* Status label
*
* @param array $questionnaire questionnaire
* @return string
*/
public function statusLabel($questionnaire) {
$status = $questionnaire['Questionnaire']['status'];
//初期値セット
$lblColor = 'danger';
$lblMsg = __d('questionnaires', 'Undefined');
if ($status == WorkflowComponent::STATUS_IN_DRAFT) {
//一時保存中
$lblColor = 'info';
$lblMsg = __d('net_commons', 'Temporary');
} elseif ($status == WorkflowComponent::STATUS_APPROVAL_WAITING) {
//承認待ち
$lblColor = 'warning';
$lblMsg = __d('net_commons', 'Approving');
} elseif ($status == WorkflowComponent::STATUS_DISAPPROVED) {
//差し戻し
$lblColor = 'danger';
$lblMsg = __d('net_commons', 'Disapproving');
} else {
$rangeStat = $questionnaire['Questionnaire']['period_range_stat'];
if ($rangeStat == QuestionnairesComponent::QUESTIONNAIRE_PERIOD_STAT_BEFORE) {
//未実施
$lblColor = 'default';
$lblMsg = __d('questionnaires', 'Before public');
} elseif ($rangeStat == QuestionnairesComponent::QUESTIONNAIRE_PERIOD_STAT_END) {
//終了
$lblColor = 'default';
$lblMsg = __d('questionnaires', 'End');
} else {
$lblMsg = '';
}
}
if ($lblMsg) {
return '<span class="label label-' . $lblColor . '">' . $lblMsg . '</span>';
}
return '';
}
/**
* Status label for management widget
*
* @param array $questionnaire questionnaire
* @return string
*/
public function statusLabelManagementWidget($questionnaire) {
$label = $this->statusLabel($questionnaire);
if ($label == '') {
$label = __d('net_commons', 'Published');
}
return $label;
}
}