Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b | 6 | * |
807f8008 | 7 | * Generated from xml/schema/CRM/Mailing/MailingComponent.xml |
e501603b | 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
74db51d3 | 9 | * (GenCodeChecksum:935e7f9a3718032018ccb082a6c4500c) |
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 | |
e501603b TO |
91 | /** |
92 | * Returns all the column names of this table | |
93 | * | |
94 | * @return array | |
95 | */ | |
c3fc2621 | 96 | public static function &fields() { |
346aaaba | 97 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
98 | Civi::$statics[__CLASS__]['fields'] = [ |
99 | 'id' => [ | |
e501603b TO |
100 | 'name' => 'id', |
101 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
102 | 'title' => ts('Mailing Component ID'), |
103 | 'required' => TRUE, | |
a36434b9 | 104 | 'where' => 'civicrm_mailing_component.id', |
522a26c9 | 105 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 106 | 'entity' => 'MailingComponent', |
a0eea7b9 | 107 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 108 | 'localizable' => 0, |
c3fc2621 CW |
109 | ], |
110 | 'name' => [ | |
e501603b TO |
111 | 'name' => 'name', |
112 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 113 | 'title' => ts('Component Name'), |
215b423e | 114 | 'description' => ts('The name of this component'), |
e501603b TO |
115 | 'maxlength' => 64, |
116 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 117 | 'where' => 'civicrm_mailing_component.name', |
522a26c9 | 118 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 119 | 'entity' => 'MailingComponent', |
a0eea7b9 | 120 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 121 | 'localizable' => 0, |
c3fc2621 CW |
122 | ], |
123 | 'component_type' => [ | |
e501603b TO |
124 | 'name' => 'component_type', |
125 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 126 | 'title' => ts('Mailing Component Type'), |
215b423e | 127 | 'description' => ts('Type of Component.'), |
e501603b TO |
128 | 'maxlength' => 12, |
129 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 130 | 'where' => 'civicrm_mailing_component.component_type', |
522a26c9 | 131 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 132 | 'entity' => 'MailingComponent', |
a0eea7b9 | 133 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 134 | 'localizable' => 0, |
c3fc2621 | 135 | 'html' => [ |
e501603b | 136 | 'type' => 'Select', |
c3fc2621 CW |
137 | ], |
138 | 'pseudoconstant' => [ | |
e501603b | 139 | 'callback' => 'CRM_Core_SelectValues::mailingComponents', |
e6ca0a57 | 140 | ], |
c3fc2621 CW |
141 | ], |
142 | 'subject' => [ | |
e501603b TO |
143 | 'name' => 'subject', |
144 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 145 | 'title' => ts('Subject'), |
e501603b TO |
146 | 'maxlength' => 255, |
147 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 148 | 'where' => 'civicrm_mailing_component.subject', |
522a26c9 | 149 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 150 | 'entity' => 'MailingComponent', |
a0eea7b9 | 151 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 152 | 'localizable' => 0, |
c3fc2621 CW |
153 | ], |
154 | 'body_html' => [ | |
e501603b TO |
155 | 'name' => 'body_html', |
156 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 157 | 'title' => ts('Mailing Component Body HTML'), |
215b423e | 158 | 'description' => ts('Body of the component in html format.'), |
e501603b TO |
159 | 'rows' => 8, |
160 | 'cols' => 80, | |
a36434b9 | 161 | 'where' => 'civicrm_mailing_component.body_html', |
522a26c9 | 162 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 163 | 'entity' => 'MailingComponent', |
a0eea7b9 | 164 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 165 | 'localizable' => 0, |
c3fc2621 | 166 | 'html' => [ |
e501603b | 167 | 'type' => 'TextArea', |
c3fc2621 CW |
168 | ], |
169 | ], | |
170 | 'body_text' => [ | |
e501603b TO |
171 | 'name' => 'body_text', |
172 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 173 | 'title' => ts('Body Text'), |
215b423e | 174 | 'description' => ts('Body of the component in text format.'), |
e501603b TO |
175 | 'rows' => 8, |
176 | 'cols' => 80, | |
a36434b9 | 177 | 'where' => 'civicrm_mailing_component.body_text', |
522a26c9 | 178 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 179 | 'entity' => 'MailingComponent', |
a0eea7b9 | 180 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 181 | 'localizable' => 0, |
c3fc2621 | 182 | 'html' => [ |
e501603b | 183 | 'type' => 'TextArea', |
c3fc2621 CW |
184 | ], |
185 | ], | |
186 | 'is_default' => [ | |
e501603b TO |
187 | 'name' => 'is_default', |
188 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 189 | 'title' => ts('Mailing Component is Default?'), |
215b423e | 190 | 'description' => ts('Is this the default component for this component_type?'), |
a36434b9 | 191 | 'where' => 'civicrm_mailing_component.is_default', |
45a83e42 | 192 | 'default' => '0', |
522a26c9 | 193 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 194 | 'entity' => 'MailingComponent', |
a0eea7b9 | 195 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 196 | 'localizable' => 0, |
c3fc2621 CW |
197 | ], |
198 | 'is_active' => [ | |
e501603b TO |
199 | 'name' => 'is_active', |
200 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 201 | 'title' => ts('Mailing Component Is Active?'), |
215b423e | 202 | 'description' => ts('Is this property active?'), |
a36434b9 | 203 | 'where' => 'civicrm_mailing_component.is_active', |
522a26c9 | 204 | 'table_name' => 'civicrm_mailing_component', |
807f8008 | 205 | 'entity' => 'MailingComponent', |
a0eea7b9 | 206 | 'bao' => 'CRM_Mailing_BAO_MailingComponent', |
6a7e5e5d | 207 | 'localizable' => 0, |
c3fc2621 CW |
208 | ], |
209 | ]; | |
346aaaba | 210 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 211 | } |
346aaaba | 212 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 213 | } |
c3fc2621 | 214 | |
e501603b | 215 | /** |
bd8e0b14 | 216 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
217 | * |
218 | * @return array | |
bd8e0b14 | 219 | * Array(string $name => string $uniqueName). |
e501603b | 220 | */ |
c3fc2621 | 221 | public static function &fieldKeys() { |
bd8e0b14 TO |
222 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
223 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 224 | } |
bd8e0b14 | 225 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 226 | } |
c3fc2621 | 227 | |
e501603b TO |
228 | /** |
229 | * Returns the names of this table | |
230 | * | |
231 | * @return string | |
232 | */ | |
c3fc2621 | 233 | public static function getTableName() { |
e501603b TO |
234 | return self::$_tableName; |
235 | } | |
c3fc2621 | 236 | |
e501603b TO |
237 | /** |
238 | * Returns if this table needs to be logged | |
239 | * | |
c3fc2621 | 240 | * @return bool |
e501603b | 241 | */ |
c3fc2621 | 242 | public function getLog() { |
e501603b TO |
243 | return self::$_log; |
244 | } | |
c3fc2621 | 245 | |
e501603b TO |
246 | /** |
247 | * Returns the list of fields that can be imported | |
248 | * | |
249 | * @param bool $prefix | |
250 | * | |
251 | * @return array | |
252 | */ | |
c3fc2621 CW |
253 | public static function &import($prefix = FALSE) { |
254 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, []); | |
60808919 | 255 | return $r; |
e501603b | 256 | } |
c3fc2621 | 257 | |
e501603b TO |
258 | /** |
259 | * Returns the list of fields that can be exported | |
260 | * | |
261 | * @param bool $prefix | |
262 | * | |
263 | * @return array | |
264 | */ | |
c3fc2621 CW |
265 | public static function &export($prefix = FALSE) { |
266 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, []); | |
60808919 | 267 | return $r; |
e501603b | 268 | } |
c3fc2621 | 269 | |
e7a6b91a AS |
270 | /** |
271 | * Returns the list of indices | |
c3fc2621 CW |
272 | * |
273 | * @param bool $localize | |
274 | * | |
275 | * @return array | |
e7a6b91a AS |
276 | */ |
277 | public static function indices($localize = TRUE) { | |
c3fc2621 | 278 | $indices = []; |
e7a6b91a AS |
279 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
280 | } | |
c3fc2621 | 281 | |
e501603b | 282 | } |