Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
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-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Core/OptionGroup.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
7c61320c | 33 | * (GenCodeChecksum:5b506b744806a9089160f2f99714a26a) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_option_group'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = true; | |
51 | /** | |
52 | * Option Group ID | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value. | |
59 | * | |
60 | * @var string | |
61 | */ | |
62 | public $name; | |
63 | /** | |
64 | * Option Group title. | |
65 | * | |
66 | * @var string | |
67 | */ | |
68 | public $title; | |
69 | /** | |
70 | * Option group description. | |
71 | * | |
72 | * @var string | |
73 | */ | |
74 | public $description; | |
7c61320c SL |
75 | /** |
76 | * Option group description. | |
77 | * | |
78 | * @var string | |
79 | */ | |
80 | public $data_type; | |
e501603b TO |
81 | /** |
82 | * Is this a predefined system option group (i.e. it can not be deleted)? | |
83 | * | |
84 | * @var boolean | |
85 | */ | |
86 | public $is_reserved; | |
87 | /** | |
88 | * Is this option group active? | |
89 | * | |
90 | * @var boolean | |
91 | */ | |
92 | public $is_active; | |
93 | /** | |
94 | * A lock to remove the ability to add new options via the UI. | |
95 | * | |
96 | * @var boolean | |
97 | */ | |
98 | public $is_locked; | |
99 | /** | |
100 | * class constructor | |
101 | * | |
102 | * @return civicrm_option_group | |
103 | */ | |
104 | function __construct() { | |
105 | $this->__table = 'civicrm_option_group'; | |
106 | parent::__construct(); | |
107 | } | |
108 | /** | |
109 | * Returns all the column names of this table | |
110 | * | |
111 | * @return array | |
112 | */ | |
113 | static function &fields() { | |
346aaaba TO |
114 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
115 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
116 | 'id' => array( |
117 | 'name' => 'id', | |
118 | 'type' => CRM_Utils_Type::T_INT, | |
119 | 'title' => ts('Option Group ID') , | |
120 | 'description' => 'Option Group ID', | |
121 | 'required' => true, | |
122 | ) , | |
123 | 'name' => array( | |
124 | 'name' => 'name', | |
125 | 'type' => CRM_Utils_Type::T_STRING, | |
126 | 'title' => ts('Option Group Name') , | |
127 | 'description' => 'Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.', | |
128 | 'required' => true, | |
129 | 'maxlength' => 64, | |
130 | 'size' => CRM_Utils_Type::BIG, | |
131 | ) , | |
132 | 'title' => array( | |
133 | 'name' => 'title', | |
134 | 'type' => CRM_Utils_Type::T_STRING, | |
135 | 'title' => ts('Option Group title') , | |
136 | 'description' => 'Option Group title.', | |
137 | 'maxlength' => 255, | |
138 | 'size' => CRM_Utils_Type::HUGE, | |
139 | ) , | |
140 | 'description' => array( | |
141 | 'name' => 'description', | |
142 | 'type' => CRM_Utils_Type::T_STRING, | |
143 | 'title' => ts('Option Group Description') , | |
144 | 'description' => 'Option group description.', | |
145 | 'maxlength' => 255, | |
146 | 'size' => CRM_Utils_Type::HUGE, | |
147 | ) , | |
7c61320c SL |
148 | 'data_type' => array( |
149 | 'name' => 'data_type', | |
150 | 'type' => CRM_Utils_Type::T_STRING, | |
151 | 'title' => ts('Data Type for this option group') , | |
152 | 'description' => 'Option group description.', | |
153 | 'maxlength' => 128, | |
154 | 'size' => CRM_Utils_Type::HUGE, | |
155 | 'pseudoconstant' => array( | |
156 | 'callback' => 'CRM_Utils_Type::dataTypes', | |
157 | ) | |
158 | ) , | |
e501603b TO |
159 | 'is_reserved' => array( |
160 | 'name' => 'is_reserved', | |
161 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
162 | 'title' => ts('Option Group Is Reserved?') , | |
163 | 'description' => 'Is this a predefined system option group (i.e. it can not be deleted)?', | |
164 | 'default' => '1', | |
165 | ) , | |
166 | 'is_active' => array( | |
167 | 'name' => 'is_active', | |
168 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
169 | 'title' => ts('Option Group Is Active?') , | |
170 | 'description' => 'Is this option group active?', | |
171 | ) , | |
172 | 'is_locked' => array( | |
173 | 'name' => 'is_locked', | |
174 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
175 | 'title' => ts('Option Group Is Locked') , | |
176 | 'description' => 'A lock to remove the ability to add new options via the UI.', | |
177 | ) , | |
178 | ); | |
346aaaba | 179 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 180 | } |
346aaaba | 181 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
182 | } |
183 | /** | |
bd8e0b14 | 184 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
185 | * |
186 | * @return array | |
bd8e0b14 | 187 | * Array(string $name => string $uniqueName). |
e501603b TO |
188 | */ |
189 | static function &fieldKeys() { | |
bd8e0b14 TO |
190 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
191 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 192 | } |
bd8e0b14 | 193 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
194 | } |
195 | /** | |
196 | * Returns the names of this table | |
197 | * | |
198 | * @return string | |
199 | */ | |
200 | static function getTableName() { | |
201 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
202 | } | |
203 | /** | |
204 | * Returns if this table needs to be logged | |
205 | * | |
206 | * @return boolean | |
207 | */ | |
208 | function getLog() { | |
209 | return self::$_log; | |
210 | } | |
211 | /** | |
212 | * Returns the list of fields that can be imported | |
213 | * | |
214 | * @param bool $prefix | |
215 | * | |
216 | * @return array | |
217 | */ | |
218 | static function &import($prefix = false) { | |
60808919 TO |
219 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_group', $prefix, array()); |
220 | return $r; | |
e501603b TO |
221 | } |
222 | /** | |
223 | * Returns the list of fields that can be exported | |
224 | * | |
225 | * @param bool $prefix | |
226 | * | |
227 | * @return array | |
228 | */ | |
229 | static function &export($prefix = false) { | |
60808919 TO |
230 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_group', $prefix, array()); |
231 | return $r; | |
e501603b TO |
232 | } |
233 | } |