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