Merge pull request #22501 from mattwire/alterdisplayname
[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:767dc30f83e4087a07c185f857fc8fb3)
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 'html' => [
117 'type' => 'Number',
118 ],
119 'readonly' => TRUE,
120 'add' => '2.0',
121 ],
122 'name' => [
123 'name' => 'name',
124 'type' => CRM_Utils_Type::T_STRING,
125 'title' => ts('Date Preference Name'),
126 'description' => ts('The meta name for this date (fixed in code)'),
127 'required' => TRUE,
128 'maxlength' => 64,
129 'size' => CRM_Utils_Type::BIG,
130 'where' => 'civicrm_preferences_date.name',
131 'table_name' => 'civicrm_preferences_date',
132 'entity' => 'PreferencesDate',
133 'bao' => 'CRM_Core_BAO_PreferencesDate',
134 'localizable' => 0,
135 'add' => '2.0',
136 ],
137 'description' => [
138 'name' => 'description',
139 'type' => CRM_Utils_Type::T_STRING,
140 'title' => ts('Description'),
141 'description' => ts('Description of this date type.'),
142 'maxlength' => 255,
143 'size' => CRM_Utils_Type::HUGE,
144 'where' => 'civicrm_preferences_date.description',
145 'table_name' => 'civicrm_preferences_date',
146 'entity' => 'PreferencesDate',
147 'bao' => 'CRM_Core_BAO_PreferencesDate',
148 'localizable' => 0,
149 'html' => [
150 'label' => ts("Description"),
151 ],
152 'add' => '2.0',
153 ],
154 'start' => [
155 'name' => 'start',
156 'type' => CRM_Utils_Type::T_INT,
157 'title' => ts('Start'),
158 'description' => ts('The start offset relative to current year'),
159 'required' => TRUE,
160 'where' => 'civicrm_preferences_date.start',
161 'table_name' => 'civicrm_preferences_date',
162 'entity' => 'PreferencesDate',
163 'bao' => 'CRM_Core_BAO_PreferencesDate',
164 'localizable' => 0,
165 'html' => [
166 'label' => ts("Start"),
167 ],
168 'add' => '2.0',
169 ],
170 'end' => [
171 'name' => 'end',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('End Offset'),
174 'description' => ts('The end offset relative to current year, can be negative'),
175 'required' => TRUE,
176 'where' => 'civicrm_preferences_date.end',
177 'table_name' => 'civicrm_preferences_date',
178 'entity' => 'PreferencesDate',
179 'bao' => 'CRM_Core_BAO_PreferencesDate',
180 'localizable' => 0,
181 'add' => '2.0',
182 ],
183 'date_format' => [
184 'name' => 'date_format',
185 'type' => CRM_Utils_Type::T_STRING,
186 'title' => ts('Date Format'),
187 'description' => ts('The date type'),
188 'maxlength' => 64,
189 'size' => CRM_Utils_Type::BIG,
190 'where' => 'civicrm_preferences_date.date_format',
191 'table_name' => 'civicrm_preferences_date',
192 'entity' => 'PreferencesDate',
193 'bao' => 'CRM_Core_BAO_PreferencesDate',
194 'localizable' => 0,
195 'html' => [
196 'label' => ts("Date Format"),
197 ],
198 'add' => '2.0',
199 ],
200 'time_format' => [
201 'name' => 'time_format',
202 'type' => CRM_Utils_Type::T_STRING,
203 'title' => ts('Time Format'),
204 'description' => ts('time format'),
205 'maxlength' => 64,
206 'size' => CRM_Utils_Type::BIG,
207 'where' => 'civicrm_preferences_date.time_format',
208 'table_name' => 'civicrm_preferences_date',
209 'entity' => 'PreferencesDate',
210 'bao' => 'CRM_Core_BAO_PreferencesDate',
211 'localizable' => 0,
212 'html' => [
213 'label' => ts("Time Format"),
214 ],
215 'add' => '3.1',
216 ],
217 ];
218 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
219 }
220 return Civi::$statics[__CLASS__]['fields'];
221 }
222
223 /**
224 * Return a mapping from field-name to the corresponding key (as used in fields()).
225 *
226 * @return array
227 * Array(string $name => string $uniqueName).
228 */
229 public static function &fieldKeys() {
230 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
231 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
232 }
233 return Civi::$statics[__CLASS__]['fieldKeys'];
234 }
235
236 /**
237 * Returns the names of this table
238 *
239 * @return string
240 */
241 public static function getTableName() {
242 return self::$_tableName;
243 }
244
245 /**
246 * Returns if this table needs to be logged
247 *
248 * @return bool
249 */
250 public function getLog() {
251 return self::$_log;
252 }
253
254 /**
255 * Returns the list of fields that can be imported
256 *
257 * @param bool $prefix
258 *
259 * @return array
260 */
261 public static function &import($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, []);
263 return $r;
264 }
265
266 /**
267 * Returns the list of fields that can be exported
268 *
269 * @param bool $prefix
270 *
271 * @return array
272 */
273 public static function &export($prefix = FALSE) {
274 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, []);
275 return $r;
276 }
277
278 /**
279 * Returns the list of indices
280 *
281 * @param bool $localize
282 *
283 * @return array
284 */
285 public static function indices($localize = TRUE) {
286 $indices = [
287 'index_name' => [
288 'name' => 'index_name',
289 'field' => [
290 0 => 'name',
291 ],
292 'localizable' => FALSE,
293 'sig' => 'civicrm_preferences_date::0::name',
294 ],
295 ];
296 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
297 }
298
299 }