|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace EventEspresso\ui\browser\checkins\entities; |
|
4
|
|
|
|
|
5
|
|
|
use EE_Checkin; |
|
6
|
|
|
use EE_Datetime; |
|
7
|
|
|
use EE_Error; |
|
8
|
|
|
use EE_Registration; |
|
9
|
|
|
|
|
10
|
|
|
defined('EVENT_ESPRESSO_VERSION') || exit; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class CheckinStatusDashicon |
|
15
|
|
|
* Description |
|
16
|
|
|
* |
|
17
|
|
|
* @package EventEspresso\ui\browser\checkins\entities |
|
18
|
|
|
* @author Brent Christensen |
|
19
|
|
|
* @since $VID:$ |
|
20
|
|
|
*/ |
|
21
|
|
|
class CheckinStatusDashicon |
|
22
|
|
|
{ |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var int $checkin_status |
|
26
|
|
|
*/ |
|
27
|
|
|
private $checkin_status; |
|
28
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* CheckinStatusDashicon constructor. |
|
32
|
|
|
* |
|
33
|
|
|
* @param int $checkin_status |
|
34
|
|
|
*/ |
|
35
|
|
|
public function __construct($checkin_status = EE_Checkin::status_checked_never) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->checkin_status = $checkin_status; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @param EE_Checkin $checkin |
|
43
|
|
|
* @return CheckinStatusDashicon |
|
44
|
|
|
* @throws EE_Error |
|
45
|
|
|
*/ |
|
46
|
|
|
public static function fromCheckin(EE_Checkin $checkin) |
|
47
|
|
|
{ |
|
48
|
|
|
return new CheckinStatusDashicon( |
|
49
|
|
|
$checkin->status() |
|
50
|
|
|
? EE_Checkin::status_checked_in |
|
51
|
|
|
: EE_Checkin::status_checked_out |
|
52
|
|
|
); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param EE_Registration $registration |
|
58
|
|
|
* @param EE_Datetime $datetime |
|
59
|
|
|
* @return CheckinStatusDashicon |
|
60
|
|
|
* @throws EE_Error |
|
61
|
|
|
*/ |
|
62
|
|
|
public static function fromRegistrationAndDatetime(EE_Registration $registration, EE_Datetime $datetime) |
|
63
|
|
|
{ |
|
64
|
|
|
return new CheckinStatusDashicon( |
|
65
|
|
|
$registration->check_in_status_for_datetime( |
|
66
|
|
|
$datetime->ID() |
|
67
|
|
|
) |
|
68
|
|
|
); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param EE_Registration $registration |
|
74
|
|
|
* @param int $DTT_ID |
|
75
|
|
|
* @return CheckinStatusDashicon |
|
76
|
|
|
* @throws EE_Error |
|
77
|
|
|
*/ |
|
78
|
|
|
public static function fromRegistrationAndDatetimeId(EE_Registration $registration, $DTT_ID = 0) |
|
79
|
|
|
{ |
|
80
|
|
|
return new CheckinStatusDashicon( |
|
81
|
|
|
$registration->check_in_status_for_datetime( |
|
82
|
|
|
absint($DTT_ID) |
|
83
|
|
|
) |
|
84
|
|
|
); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Will return the correct set of dashicon css classes for the set checkin status |
|
89
|
|
|
* |
|
90
|
|
|
* @return string |
|
91
|
|
|
*/ |
|
92
|
|
|
public function cssClasses() |
|
93
|
|
|
{ |
|
94
|
|
|
if ($this->checkin_status === EE_Checkin::status_checked_in) { |
|
95
|
|
|
return "ee-dashicons ee-icon-check-in checkin-icons checkedin-status-{$this->checkin_status}"; |
|
96
|
|
|
} |
|
97
|
|
|
if ($this->checkin_status === EE_Checkin::status_checked_out) { |
|
98
|
|
|
return "ee-dashicons ee-icon-check-out checkin-icons checkedin-status-{$this->checkin_status}"; |
|
99
|
|
|
} |
|
100
|
|
|
return "dashicons dashicons-no checkin-icons checkedin-status-{$this->checkin_status}"; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* returns a description for the Checkin Status Dashicon that can be used in List Table Legends |
|
105
|
|
|
* |
|
106
|
|
|
* @return string |
|
107
|
|
|
*/ |
|
108
|
|
|
public function legendLabel() |
|
109
|
|
|
{ |
|
110
|
|
|
if ($this->checkin_status === EE_Checkin::status_checked_in) { |
|
111
|
|
|
return esc_html__('This Registrant has been Checked In', 'event_espresso'); |
|
112
|
|
|
} |
|
113
|
|
|
if ($this->checkin_status === EE_Checkin::status_checked_out) { |
|
114
|
|
|
return esc_html__('This Registrant has been Checked Out', 'event_espresso'); |
|
115
|
|
|
} |
|
116
|
|
|
return esc_html__('No Check-in Record has been Created for this Registrant', 'event_espresso'); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
|
|
120
|
|
|
} |
|
121
|
|
|
// Location: ui/browser/checkins/entities/CheckinStatusDashicon.php |
|
122
|
|
|
|