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