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