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