Merge pull request #19205 from eileenmcnaughton/mem_forms
[civicrm-core.git] / CRM / Core / DAO / PreferencesDate.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/PreferencesDate.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a0d91310a76fe98662806ef3104d8f30)
10 */
11
12 /**
13 * Database access object for the PreferencesDate entity.
14 */
15 class CRM_Core_DAO_PreferencesDate extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_preferences_date';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = TRUE;
32
33 /**
34 * @var int
35 */
36 public $id;
37
38 /**
39 * The meta name for this date (fixed in code)
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Description of this date type.
47 *
48 * @var string
49 */
50 public $description;
51
52 /**
53 * The start offset relative to current year
54 *
55 * @var int
56 */
57 public $start;
58
59 /**
60 * The end offset relative to current year, can be negative
61 *
62 * @var int
63 */
64 public $end;
65
66 /**
67 * The date type
68 *
69 * @var string
70 */
71 public $date_format;
72
73 /**
74 * time format
75 *
76 * @var string
77 */
78 public $time_format;
79
80 /**
81 * Class constructor.
82 */
83 public function __construct() {
84 $this->__table = 'civicrm_preferences_date';
85 parent::__construct();
86 }
87
88 /**
89 * Returns localized title of this entity.
90 *
91 * @param bool $plural
92 * Whether to return the plural version of the title.
93 */
94 public static function getEntityTitle($plural = FALSE) {
95 return $plural ? ts('Preferences Dates') : ts('Preferences Date');
96 }
97
98 /**
99 * Returns all the column names of this table
100 *
101 * @return array
102 */
103 public static function &fields() {
104 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
105 Civi::$statics[__CLASS__]['fields'] = [
106 'id' => [
107 'name' => 'id',
108 'type' => CRM_Utils_Type::T_INT,
109 'title' => ts('Date Preference ID'),
110 'required' => TRUE,
111 'where' => 'civicrm_preferences_date.id',
112 'table_name' => 'civicrm_preferences_date',
113 'entity' => 'PreferencesDate',
114 'bao' => 'CRM_Core_BAO_PreferencesDate',
115 'localizable' => 0,
116 'add' => '2.0',
117 ],
118 'name' => [
119 'name' => 'name',
120 'type' => CRM_Utils_Type::T_STRING,
121 'title' => ts('Date Preference Name'),
122 'description' => ts('The meta name for this date (fixed in code)'),
123 'required' => TRUE,
124 'maxlength' => 64,
125 'size' => CRM_Utils_Type::BIG,
126 'where' => 'civicrm_preferences_date.name',
127 'table_name' => 'civicrm_preferences_date',
128 'entity' => 'PreferencesDate',
129 'bao' => 'CRM_Core_BAO_PreferencesDate',
130 'localizable' => 0,
131 'add' => '2.0',
132 ],
133 'description' => [
134 'name' => 'description',
135 'type' => CRM_Utils_Type::T_STRING,
136 'title' => ts('Description'),
137 'description' => ts('Description of this date type.'),
138 'maxlength' => 255,
139 'size' => CRM_Utils_Type::HUGE,
140 'where' => 'civicrm_preferences_date.description',
141 'table_name' => 'civicrm_preferences_date',
142 'entity' => 'PreferencesDate',
143 'bao' => 'CRM_Core_BAO_PreferencesDate',
144 'localizable' => 0,
145 'add' => '2.0',
146 ],
147 'start' => [
148 'name' => 'start',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('Start'),
151 'description' => ts('The start offset relative to current year'),
152 'required' => TRUE,
153 'where' => 'civicrm_preferences_date.start',
154 'table_name' => 'civicrm_preferences_date',
155 'entity' => 'PreferencesDate',
156 'bao' => 'CRM_Core_BAO_PreferencesDate',
157 'localizable' => 0,
158 'add' => '2.0',
159 ],
160 'end' => [
161 'name' => 'end',
162 'type' => CRM_Utils_Type::T_INT,
163 'title' => ts('End Offset'),
164 'description' => ts('The end offset relative to current year, can be negative'),
165 'required' => TRUE,
166 'where' => 'civicrm_preferences_date.end',
167 'table_name' => 'civicrm_preferences_date',
168 'entity' => 'PreferencesDate',
169 'bao' => 'CRM_Core_BAO_PreferencesDate',
170 'localizable' => 0,
171 'add' => '2.0',
172 ],
173 'date_format' => [
174 'name' => 'date_format',
175 'type' => CRM_Utils_Type::T_STRING,
176 'title' => ts('Date Format'),
177 'description' => ts('The date type'),
178 'maxlength' => 64,
179 'size' => CRM_Utils_Type::BIG,
180 'where' => 'civicrm_preferences_date.date_format',
181 'table_name' => 'civicrm_preferences_date',
182 'entity' => 'PreferencesDate',
183 'bao' => 'CRM_Core_BAO_PreferencesDate',
184 'localizable' => 0,
185 'add' => '2.0',
186 ],
187 'time_format' => [
188 'name' => 'time_format',
189 'type' => CRM_Utils_Type::T_STRING,
190 'title' => ts('Time Format'),
191 'description' => ts('time format'),
192 'maxlength' => 64,
193 'size' => CRM_Utils_Type::BIG,
194 'where' => 'civicrm_preferences_date.time_format',
195 'table_name' => 'civicrm_preferences_date',
196 'entity' => 'PreferencesDate',
197 'bao' => 'CRM_Core_BAO_PreferencesDate',
198 'localizable' => 0,
199 'add' => '3.1',
200 ],
201 ];
202 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
203 }
204 return Civi::$statics[__CLASS__]['fields'];
205 }
206
207 /**
208 * Return a mapping from field-name to the corresponding key (as used in fields()).
209 *
210 * @return array
211 * Array(string $name => string $uniqueName).
212 */
213 public static function &fieldKeys() {
214 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
215 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
216 }
217 return Civi::$statics[__CLASS__]['fieldKeys'];
218 }
219
220 /**
221 * Returns the names of this table
222 *
223 * @return string
224 */
225 public static function getTableName() {
226 return self::$_tableName;
227 }
228
229 /**
230 * Returns if this table needs to be logged
231 *
232 * @return bool
233 */
234 public function getLog() {
235 return self::$_log;
236 }
237
238 /**
239 * Returns the list of fields that can be imported
240 *
241 * @param bool $prefix
242 *
243 * @return array
244 */
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, []);
247 return $r;
248 }
249
250 /**
251 * Returns the list of fields that can be exported
252 *
253 * @param bool $prefix
254 *
255 * @return array
256 */
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, []);
259 return $r;
260 }
261
262 /**
263 * Returns the list of indices
264 *
265 * @param bool $localize
266 *
267 * @return array
268 */
269 public static function indices($localize = TRUE) {
270 $indices = [
271 'index_name' => [
272 'name' => 'index_name',
273 'field' => [
274 0 => 'name',
275 ],
276 'localizable' => FALSE,
277 'sig' => 'civicrm_preferences_date::0::name',
278 ],
279 ];
280 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
281 }
282
283 }