Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b | 6 | * |
807f8008 | 7 | * Generated from xml/schema/CRM/Mailing/MailingComponent.xml |
e501603b | 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
a9d0587b | 9 | * (GenCodeChecksum:1d0efc3e5ba8dcd6d6bbc422877b86b4) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
807f8008 | 13 | * Database access object for the MailingComponent entity. |
f41f0342 | 14 | */ |
807f8008 | 15 | class CRM_Mailing_DAO_MailingComponent 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_mailing_component'; |
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 = FALSE; |
c3fc2621 | 30 | |
e501603b | 31 | /** |
e6ca0a57 | 32 | * @var int |
e501603b TO |
33 | */ |
34 | public $id; | |
c3fc2621 | 35 | |
e501603b TO |
36 | /** |
37 | * The name of this component | |
38 | * | |
39 | * @var string | |
40 | */ | |
41 | public $name; | |
c3fc2621 | 42 | |
e501603b TO |
43 | /** |
44 | * Type of Component. | |
45 | * | |
46 | * @var string | |
47 | */ | |
48 | public $component_type; | |
c3fc2621 | 49 | |
e501603b | 50 | /** |
e501603b TO |
51 | * @var string |
52 | */ | |
53 | public $subject; | |
c3fc2621 | 54 | |
e501603b TO |
55 | /** |
56 | * Body of the component in html format. | |
57 | * | |
58 | * @var text | |
59 | */ | |
60 | public $body_html; | |
c3fc2621 | 61 | |
e501603b TO |
62 | /** |
63 | * Body of the component in text format. | |
64 | * | |
65 | * @var text | |
66 | */ | |
67 | public $body_text; | |
c3fc2621 | 68 | |
e501603b TO |
69 | /** |
70 | * Is this the default component for this component_type? | |
71 | * | |
e6ca0a57 | 72 | * @var bool |
e501603b TO |
73 | */ |
74 | public $is_default; | |
c3fc2621 | 75 | |
e501603b TO |
76 | /** |
77 | * Is this property active? | |
78 | * | |
e6ca0a57 | 79 | * @var bool |
e501603b TO |
80 | */ |
81 | public $is_active; | |
c3fc2621 | 82 | |
e501603b | 83 | /** |
f41f0342 | 84 | * Class constructor. |
e501603b | 85 | */ |
c3fc2621 | 86 | public function __construct() { |
e501603b TO |
87 | $this->__table = 'civicrm_mailing_component'; |
88 | parent::__construct(); | |
89 | } | |
c3fc2621 | 90 | |
449c4e6b CW |
91 | /** |
92 | * Returns localized title of this entity. | |
93 | */ | |
94 | public static function getEntityTitle() { | |
95 | return ts('Mailing Components'); | |
96 | } | |
97 | ||
e501603b TO |
98 | /** |
99 | * Returns all the column names of this table | |
100 | * | |
101 | * @return array | |
102 | */ | |
c3fc2621 | 103 | public static function &fields() { |
346aaaba | 104 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
105 | Civi::$statics[__CLASS__]['fields'] = [ |
106 | 'id' => [ | |
e501603b TO |
107 | 'name' => 'id', |
108 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
109 | 'title' => ts('Mailing Component ID'), |
110 | 'required' => TRUE, | |
a36434b9 | 111 | 'where' => 'civicrm_mailing_component.id', |
522a26c9 | 112 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 113 | 'entity' => 'MailingComponent', |
a0eea7b9 | 114 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 115 | 'localizable' => 0, |
a9d0587b | 116 | 'add' => NULL, |
c3fc2621 CW |
117 | ], |
118 | 'name' => [ | |
e501603b TO |
119 | 'name' => 'name', |
120 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 121 | 'title' => ts('Component Name'), |
215b423e | 122 | 'description' => ts('The name of this component'), |
e501603b TO |
123 | 'maxlength' => 64, |
124 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 125 | 'where' => 'civicrm_mailing_component.name', |
522a26c9 | 126 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 127 | 'entity' => 'MailingComponent', |
a0eea7b9 | 128 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 129 | 'localizable' => 0, |
a9d0587b | 130 | 'add' => NULL, |
c3fc2621 CW |
131 | ], |
132 | 'component_type' => [ | |
e501603b TO |
133 | 'name' => 'component_type', |
134 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 135 | 'title' => ts('Mailing Component Type'), |
215b423e | 136 | 'description' => ts('Type of Component.'), |
e501603b TO |
137 | 'maxlength' => 12, |
138 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 139 | 'where' => 'civicrm_mailing_component.component_type', |
522a26c9 | 140 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 141 | 'entity' => 'MailingComponent', |
a0eea7b9 | 142 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 143 | 'localizable' => 0, |
c3fc2621 | 144 | 'html' => [ |
e501603b | 145 | 'type' => 'Select', |
c3fc2621 CW |
146 | ], |
147 | 'pseudoconstant' => [ | |
e501603b | 148 | 'callback' => 'CRM_Core_SelectValues::mailingComponents', |
e6ca0a57 | 149 | ], |
a9d0587b | 150 | 'add' => NULL, |
c3fc2621 CW |
151 | ], |
152 | 'subject' => [ | |
e501603b TO |
153 | 'name' => 'subject', |
154 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 155 | 'title' => ts('Subject'), |
e501603b TO |
156 | 'maxlength' => 255, |
157 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 158 | 'where' => 'civicrm_mailing_component.subject', |
522a26c9 | 159 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 160 | 'entity' => 'MailingComponent', |
a0eea7b9 | 161 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 162 | 'localizable' => 0, |
a9d0587b | 163 | 'add' => NULL, |
c3fc2621 CW |
164 | ], |
165 | 'body_html' => [ | |
e501603b TO |
166 | 'name' => 'body_html', |
167 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 168 | 'title' => ts('Mailing Component Body HTML'), |
215b423e | 169 | 'description' => ts('Body of the component in html format.'), |
e501603b TO |
170 | 'rows' => 8, |
171 | 'cols' => 80, | |
a36434b9 | 172 | 'where' => 'civicrm_mailing_component.body_html', |
522a26c9 | 173 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 174 | 'entity' => 'MailingComponent', |
a0eea7b9 | 175 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 176 | 'localizable' => 0, |
c3fc2621 | 177 | 'html' => [ |
e501603b | 178 | 'type' => 'TextArea', |
c3fc2621 | 179 | ], |
a9d0587b | 180 | 'add' => NULL, |
c3fc2621 CW |
181 | ], |
182 | 'body_text' => [ | |
e501603b TO |
183 | 'name' => 'body_text', |
184 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 185 | 'title' => ts('Body Text'), |
215b423e | 186 | 'description' => ts('Body of the component in text format.'), |
e501603b TO |
187 | 'rows' => 8, |
188 | 'cols' => 80, | |
a36434b9 | 189 | 'where' => 'civicrm_mailing_component.body_text', |
522a26c9 | 190 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 191 | 'entity' => 'MailingComponent', |
a0eea7b9 | 192 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 193 | 'localizable' => 0, |
c3fc2621 | 194 | 'html' => [ |
e501603b | 195 | 'type' => 'TextArea', |
c3fc2621 | 196 | ], |
a9d0587b | 197 | 'add' => NULL, |
c3fc2621 CW |
198 | ], |
199 | 'is_default' => [ | |
e501603b TO |
200 | 'name' => 'is_default', |
201 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 202 | 'title' => ts('Mailing Component is Default?'), |
215b423e | 203 | 'description' => ts('Is this the default component for this component_type?'), |
a36434b9 | 204 | 'where' => 'civicrm_mailing_component.is_default', |
45a83e42 | 205 | 'default' => '0', |
522a26c9 | 206 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 207 | 'entity' => 'MailingComponent', |
a0eea7b9 | 208 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 209 | 'localizable' => 0, |
a9d0587b | 210 | 'add' => NULL, |
c3fc2621 CW |
211 | ], |
212 | 'is_active' => [ | |
e501603b TO |
213 | 'name' => 'is_active', |
214 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 215 | 'title' => ts('Mailing Component Is Active?'), |
215b423e | 216 | 'description' => ts('Is this property active?'), |
a36434b9 | 217 | 'where' => 'civicrm_mailing_component.is_active', |
522a26c9 | 218 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 219 | 'entity' => 'MailingComponent', |
a0eea7b9 | 220 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 221 | 'localizable' => 0, |
a9d0587b | 222 | 'add' => NULL, |
c3fc2621 CW |
223 | ], |
224 | ]; | |
346aaaba | 225 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 226 | } |
346aaaba | 227 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 228 | } |
c3fc2621 | 229 | |
e501603b | 230 | /** |
bd8e0b14 | 231 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
232 | * |
233 | * @return array | |
bd8e0b14 | 234 | * Array(string $name => string $uniqueName). |
e501603b | 235 | */ |
c3fc2621 | 236 | public static function &fieldKeys() { |
bd8e0b14 TO |
237 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
238 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 239 | } |
bd8e0b14 | 240 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 241 | } |
c3fc2621 | 242 | |
e501603b TO |
243 | /** |
244 | * Returns the names of this table | |
245 | * | |
246 | * @return string | |
247 | */ | |
c3fc2621 | 248 | public static function getTableName() { |
e501603b TO |
249 | return self::$_tableName; |
250 | } | |
c3fc2621 | 251 | |
e501603b TO |
252 | /** |
253 | * Returns if this table needs to be logged | |
254 | * | |
c3fc2621 | 255 | * @return bool |
e501603b | 256 | */ |
c3fc2621 | 257 | public function getLog() { |
e501603b TO |
258 | return self::$_log; |
259 | } | |
c3fc2621 | 260 | |
e501603b TO |
261 | /** |
262 | * Returns the list of fields that can be imported | |
263 | * | |
264 | * @param bool $prefix | |
265 | * | |
266 | * @return array | |
267 | */ | |
c3fc2621 CW |
268 | public static function &import($prefix = FALSE) { |
269 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, []); | |
60808919 | 270 | return $r; |
e501603b | 271 | } |
c3fc2621 | 272 | |
e501603b TO |
273 | /** |
274 | * Returns the list of fields that can be exported | |
275 | * | |
276 | * @param bool $prefix | |
277 | * | |
278 | * @return array | |
279 | */ | |
c3fc2621 CW |
280 | public static function &export($prefix = FALSE) { |
281 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, []); | |
60808919 | 282 | return $r; |
e501603b | 283 | } |
c3fc2621 | 284 | |
e7a6b91a AS |
285 | /** |
286 | * Returns the list of indices | |
c3fc2621 CW |
287 | * |
288 | * @param bool $localize | |
289 | * | |
290 | * @return array | |
e7a6b91a AS |
291 | */ |
292 | public static function indices($localize = TRUE) { | |
c3fc2621 | 293 | $indices = []; |
e7a6b91a AS |
294 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
295 | } | |
c3fc2621 | 296 | |
e501603b | 297 | } |