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