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