Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
OperatorRules.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
41  {
42  const TYPE_EQUALS = 'equals';
43 
44  const TYPE_DOES_NOT_EQUAL = 'doesNotEqual';
45 
46  const TYPE_STARTS_WITH = 'startsWith';
47 
48  const TYPE_DOES_NOT_STARTS_WITH = 'doesNotStartsWith';
49 
50  const TYPE_ENDS_WITH = 'endsWith';
51 
52  const TYPE_DOES_NOT_ENDS_WITH = 'doesNotEndsWith';
53 
54  const TYPE_CONTAINS = 'contains';
55 
56  const TYPE_DOES_NOT_CONTAINS = 'doesNotContains';
57 
58  const TYPE_GREATER_THAN_OR_EQUAL_TO = 'greaterThanOrEqualTo';
59 
60  const TYPE_LESS_THAN_OR_EQUAL_TO = 'lessThanOrEqualTo';
61 
62  const TYPE_GREATER_THAN = 'greaterThan';
63 
64  const TYPE_LESS_THAN = 'lessThan';
65 
66  const TYPE_ONE_OF = 'oneOf';
67 
68  const TYPE_BETWEEN = 'between';
69 
70  const TYPE_IS_NULL = 'isNull';
71 
72  const TYPE_IS_NOT_NULL = 'isNotNull';
73 
74  const TYPE_BECOMES = 'becomes';
75 
76  const TYPE_WAS = 'was';
77 
78  const TYPE_BECOMES_ONE_OF = 'becomesOneOf';
79 
80  const TYPE_WAS_ONE_OF = 'wasOneOf';
81 
82  const TYPE_CHANGES = 'changes';
83 
84  const TYPE_DOES_NOT_CHANGE = 'doesNotChange';
85 
86  const TYPE_IS_EMPTY = 'isEmpty';
87 
88  const TYPE_IS_NOT_EMPTY = 'isNotEmpty';
89 
90  public static function getTranslatedTypeLabel($type)
91  {
92  assert('is_string($type)');
93  $labels = self::translatedTypeLabels();
94  if (isset($labels[$type]))
95  {
96  return $labels[$type];
97  }
98  throw new NotSupportedException();
99  }
100 
101  public static function translatedTypeLabels()
102  {
103  return array(OperatorRules::TYPE_EQUALS => Zurmo::t('Core', 'Equals'),
104  OperatorRules::TYPE_DOES_NOT_EQUAL => Zurmo::t('Core', 'Does Not Equal'),
105  OperatorRules::TYPE_STARTS_WITH => Zurmo::t('Core', 'Starts With'),
106  OperatorRules::TYPE_DOES_NOT_STARTS_WITH => Zurmo::t('Core', 'Does Not Start With'),
107  OperatorRules::TYPE_ENDS_WITH => Zurmo::t('Core', 'Ends With'),
108  OperatorRules::TYPE_DOES_NOT_ENDS_WITH => Zurmo::t('Core', 'Does Not End With'),
109  OperatorRules::TYPE_CONTAINS => Zurmo::t('Core', 'Contains'),
110  OperatorRules::TYPE_DOES_NOT_CONTAINS => Zurmo::t('Core', 'Does Not Contain'),
111  OperatorRules::TYPE_GREATER_THAN_OR_EQUAL_TO => Zurmo::t('Core', 'Greater Than Or Equal To'),
112  OperatorRules::TYPE_LESS_THAN_OR_EQUAL_TO => Zurmo::t('Core', 'Less Than Or Equal To'),
113  OperatorRules::TYPE_GREATER_THAN => Zurmo::t('Core', 'Greater Than'),
114  OperatorRules::TYPE_LESS_THAN => Zurmo::t('Core', 'Less Than'),
115  OperatorRules::TYPE_ONE_OF => Zurmo::t('Core', 'One Of'),
116  OperatorRules::TYPE_BETWEEN => Zurmo::t('Core', 'Between'),
117  OperatorRules::TYPE_IS_NULL => Zurmo::t('Core', 'Is Null'), // Not Coding Standard
118  OperatorRules::TYPE_IS_NOT_NULL => Zurmo::t('Core', 'Is Not Null'), // Not Coding Standard
119  OperatorRules::TYPE_BECOMES => Zurmo::t('Core', 'Becomes'),
120  OperatorRules::TYPE_WAS => Zurmo::t('Core', 'Was'),
121  OperatorRules::TYPE_BECOMES_ONE_OF => Zurmo::t('Core', 'Becomes One Of'),
122  OperatorRules::TYPE_WAS_ONE_OF => Zurmo::t('Core', 'Was One Of'),
123  OperatorRules::TYPE_CHANGES => Zurmo::t('Core', 'Changes'),
124  OperatorRules::TYPE_DOES_NOT_CHANGE => Zurmo::t('Core', 'Does Not Change'),
125  OperatorRules::TYPE_IS_EMPTY => Zurmo::t('Core', 'Is Empty'),
126  OperatorRules::TYPE_IS_NOT_EMPTY => Zurmo::t('Core', 'Is Not Empty'),
127  );
128  }
129 
130  public static function availableTypes()
131  {
132  return array(OperatorRules::TYPE_EQUALS,
133  OperatorRules::TYPE_DOES_NOT_EQUAL,
134  OperatorRules::TYPE_STARTS_WITH,
135  OperatorRules::TYPE_DOES_NOT_STARTS_WITH,
136  OperatorRules::TYPE_ENDS_WITH,
137  OperatorRules::TYPE_DOES_NOT_ENDS_WITH,
138  OperatorRules::TYPE_CONTAINS,
139  OperatorRules::TYPE_DOES_NOT_CONTAINS,
140  OperatorRules::TYPE_GREATER_THAN_OR_EQUAL_TO,
141  OperatorRules::TYPE_LESS_THAN_OR_EQUAL_TO,
142  OperatorRules::TYPE_GREATER_THAN,
143  OperatorRules::TYPE_LESS_THAN,
144  OperatorRules::TYPE_ONE_OF,
145  OperatorRules::TYPE_BETWEEN,
146  OperatorRules::TYPE_IS_NULL,
147  OperatorRules::TYPE_IS_NOT_NULL,
148  OperatorRules::TYPE_BECOMES,
149  OperatorRules::TYPE_WAS,
150  OperatorRules::TYPE_BECOMES_ONE_OF,
151  OperatorRules::TYPE_WAS_ONE_OF,
152  OperatorRules::TYPE_CHANGES,
153  OperatorRules::TYPE_DOES_NOT_CHANGE,
154  OperatorRules::TYPE_IS_EMPTY,
155  OperatorRules::TYPE_IS_NOT_EMPTY,
156  );
157  }
158 
159  public static function getOperatorsWhereValueIsRequired()
160  {
161  return array( OperatorRules::TYPE_EQUALS,
162  OperatorRules::TYPE_DOES_NOT_EQUAL,
163  OperatorRules::TYPE_STARTS_WITH,
164  OperatorRules::TYPE_DOES_NOT_STARTS_WITH,
165  OperatorRules::TYPE_ENDS_WITH,
166  OperatorRules::TYPE_DOES_NOT_ENDS_WITH,
167  OperatorRules::TYPE_CONTAINS,
168  OperatorRules::TYPE_DOES_NOT_CONTAINS,
169  OperatorRules::TYPE_GREATER_THAN_OR_EQUAL_TO,
170  OperatorRules::TYPE_LESS_THAN_OR_EQUAL_TO,
171  OperatorRules::TYPE_GREATER_THAN,
172  OperatorRules::TYPE_LESS_THAN,
173  OperatorRules::TYPE_ONE_OF,
174  OperatorRules::TYPE_BETWEEN,
175  OperatorRules::TYPE_BECOMES,
176  OperatorRules::TYPE_WAS,
177  OperatorRules::TYPE_BECOMES_ONE_OF,
178  OperatorRules::TYPE_WAS_ONE_OF,
179  );
180  }
181 
182  public static function getOperatorsWhereSecondValueIsRequired()
183  {
184  return array(OperatorRules::TYPE_BETWEEN);
185  }
186  }
187 ?>
Generated on Sat Jul 4 2020 07:10:28
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.