Merge pull request #10549 from jitendrapurohit/CRM-20761
[civicrm-core.git] / CRM / Core / DAO / PreferencesDate.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Core/PreferencesDate.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:50b4071bc8734a772c01b450d22f5920)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_PreferencesDate constructor.
39 */
40 class CRM_Core_DAO_PreferencesDate extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_preferences_date';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * The meta name for this date (fixed in code)
60 *
61 * @var string
62 */
63 public $name;
64 /**
65 * Description of this date type.
66 *
67 * @var string
68 */
69 public $description;
70 /**
71 * The start offset relative to current year
72 *
73 * @var int
74 */
75 public $start;
76 /**
77 * The end offset relative to current year, can be negative
78 *
79 * @var int
80 */
81 public $end;
82 /**
83 * The date type
84 *
85 * @var string
86 */
87 public $date_format;
88 /**
89 * time format
90 *
91 * @var string
92 */
93 public $time_format;
94 /**
95 * Class constructor.
96 */
97 function __construct() {
98 $this->__table = 'civicrm_preferences_date';
99 parent::__construct();
100 }
101 /**
102 * Returns all the column names of this table
103 *
104 * @return array
105 */
106 static function &fields() {
107 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
108 Civi::$statics[__CLASS__]['fields'] = array(
109 'id' => array(
110 'name' => 'id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Date Preference ID') ,
113 'required' => true,
114 'table_name' => 'civicrm_preferences_date',
115 'entity' => 'PreferencesDate',
116 'bao' => 'CRM_Core_BAO_PreferencesDate',
117 'localizable' => 0,
118 ) ,
119 'name' => array(
120 'name' => 'name',
121 'type' => CRM_Utils_Type::T_STRING,
122 'title' => ts('Date Preference Name') ,
123 'description' => 'The meta name for this date (fixed in code)',
124 'required' => true,
125 'maxlength' => 64,
126 'size' => CRM_Utils_Type::BIG,
127 'table_name' => 'civicrm_preferences_date',
128 'entity' => 'PreferencesDate',
129 'bao' => 'CRM_Core_BAO_PreferencesDate',
130 'localizable' => 0,
131 ) ,
132 'description' => array(
133 'name' => 'description',
134 'type' => CRM_Utils_Type::T_STRING,
135 'title' => ts('Description') ,
136 'description' => 'Description of this date type.',
137 'maxlength' => 255,
138 'size' => CRM_Utils_Type::HUGE,
139 'table_name' => 'civicrm_preferences_date',
140 'entity' => 'PreferencesDate',
141 'bao' => 'CRM_Core_BAO_PreferencesDate',
142 'localizable' => 0,
143 ) ,
144 'start' => array(
145 'name' => 'start',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Start') ,
148 'description' => 'The start offset relative to current year',
149 'required' => true,
150 'table_name' => 'civicrm_preferences_date',
151 'entity' => 'PreferencesDate',
152 'bao' => 'CRM_Core_BAO_PreferencesDate',
153 'localizable' => 0,
154 ) ,
155 'end' => array(
156 'name' => 'end',
157 'type' => CRM_Utils_Type::T_INT,
158 'title' => ts('End Offset') ,
159 'description' => 'The end offset relative to current year, can be negative',
160 'required' => true,
161 'table_name' => 'civicrm_preferences_date',
162 'entity' => 'PreferencesDate',
163 'bao' => 'CRM_Core_BAO_PreferencesDate',
164 'localizable' => 0,
165 ) ,
166 'date_format' => array(
167 'name' => 'date_format',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('Date Format') ,
170 'description' => 'The date type',
171 'maxlength' => 64,
172 'size' => CRM_Utils_Type::BIG,
173 'table_name' => 'civicrm_preferences_date',
174 'entity' => 'PreferencesDate',
175 'bao' => 'CRM_Core_BAO_PreferencesDate',
176 'localizable' => 0,
177 ) ,
178 'time_format' => array(
179 'name' => 'time_format',
180 'type' => CRM_Utils_Type::T_STRING,
181 'title' => ts('Time Format') ,
182 'description' => 'time format',
183 'maxlength' => 64,
184 'size' => CRM_Utils_Type::BIG,
185 'table_name' => 'civicrm_preferences_date',
186 'entity' => 'PreferencesDate',
187 'bao' => 'CRM_Core_BAO_PreferencesDate',
188 'localizable' => 0,
189 ) ,
190 );
191 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
192 }
193 return Civi::$statics[__CLASS__]['fields'];
194 }
195 /**
196 * Return a mapping from field-name to the corresponding key (as used in fields()).
197 *
198 * @return array
199 * Array(string $name => string $uniqueName).
200 */
201 static function &fieldKeys() {
202 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
203 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
204 }
205 return Civi::$statics[__CLASS__]['fieldKeys'];
206 }
207 /**
208 * Returns the names of this table
209 *
210 * @return string
211 */
212 static function getTableName() {
213 return self::$_tableName;
214 }
215 /**
216 * Returns if this table needs to be logged
217 *
218 * @return boolean
219 */
220 function getLog() {
221 return self::$_log;
222 }
223 /**
224 * Returns the list of fields that can be imported
225 *
226 * @param bool $prefix
227 *
228 * @return array
229 */
230 static function &import($prefix = false) {
231 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, array());
232 return $r;
233 }
234 /**
235 * Returns the list of fields that can be exported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 static function &export($prefix = false) {
242 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, array());
243 return $r;
244 }
245 /**
246 * Returns the list of indices
247 */
248 public static function indices($localize = TRUE) {
249 $indices = array(
250 'index_name' => array(
251 'name' => 'index_name',
252 'field' => array(
253 0 => 'name',
254 ) ,
255 'localizable' => false,
256 'sig' => 'civicrm_preferences_date::0::name',
257 ) ,
258 );
259 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
260 }
261 }