Commit | Line | Data |
---|---|---|
e136f704 O |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
e136f704 | 5 | | | |
bc77d7c0 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
e136f704 O |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * Membership status override types. | |
14 | * | |
15 | * @package CRM | |
ca5cec67 | 16 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e136f704 O |
17 | */ |
18 | class CRM_Member_StatusOverrideTypes { | |
19 | /** | |
20 | * The membership status is not overridden | |
21 | * and its is subject to membership status rules. | |
22 | */ | |
23 | const NO = 0; | |
24 | ||
25 | /** | |
26 | * The membership will stay at the selected status | |
27 | * and its status is NOT subject to membership | |
28 | * status rules. | |
29 | */ | |
30 | const PERMANENT = 1; | |
31 | ||
32 | /** | |
33 | * The membership status will stay at the | |
34 | * selected status and it is NOT subject to membership status rules. | |
35 | * However, on the selected date(status_override_end_date), | |
36 | * the status override type will automatically change to "NO" thus then | |
37 | * the membership becomes subject to membership status rules. | |
38 | */ | |
39 | const UNTIL_DATE = 2; | |
40 | ||
41 | /** | |
42 | * Gets the list of override types | |
43 | * as a list of options to be used | |
44 | * for select input. | |
45 | * | |
46 | * @return array | |
47 | * In ['Type 1 Value' => 'Type 1 Label'] format | |
48 | */ | |
49 | public static function getSelectOptions() { | |
be2fb01f | 50 | return [ |
e136f704 O |
51 | self::NO => ts('No'), |
52 | self::PERMANENT => ts('Override Permanently'), | |
53 | self::UNTIL_DATE => ts('Override Until Selected Date'), | |
be2fb01f | 54 | ]; |
e136f704 O |
55 | } |
56 | ||
57 | /** | |
58 | * Determines if the override type means | |
59 | * that the membership is overridden or not. | |
60 | * For now, only "NO" type means that the membership | |
61 | * status is not overridden. | |
62 | * | |
63 | * @param $overrideType | |
64 | * | |
65 | * @return bool | |
66 | */ | |
67 | public static function isOverridden($overrideType) { | |
68 | if ($overrideType == self::NO) { | |
69 | return FALSE; | |
70 | } | |
71 | ||
72 | return TRUE; | |
73 | } | |
74 | ||
75 | public static function isNo($overrideType) { | |
76 | if ($overrideType != self::NO) { | |
77 | return FALSE; | |
78 | } | |
79 | ||
80 | return TRUE; | |
81 | } | |
82 | ||
83 | public static function isPermanent($overrideType) { | |
84 | if ($overrideType != self::PERMANENT) { | |
85 | return FALSE; | |
86 | } | |
87 | ||
88 | return TRUE; | |
89 | } | |
90 | ||
91 | public static function isUntilDate($overrideType) { | |
92 | if ($overrideType != self::UNTIL_DATE) { | |
93 | return FALSE; | |
94 | } | |
95 | ||
96 | return TRUE; | |
97 | } | |
98 | ||
99 | } |