Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Friend/Friend.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
2562d09a | 9 | * (GenCodeChecksum:cddccd848fafb980eb26245c21f47f76) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Friend entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Friend_DAO_Friend extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '2.0'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_tell_friend'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = FALSE; |
c3fc2621 | 32 | |
e501603b TO |
33 | /** |
34 | * Friend ID | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Name of table where item being referenced is stored. | |
42 | * | |
43 | * @var string | |
44 | */ | |
45 | public $entity_table; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Foreign key to the referenced item. | |
49 | * | |
e6ca0a57 | 50 | * @var int |
e501603b TO |
51 | */ |
52 | public $entity_id; | |
c3fc2621 | 53 | |
e501603b | 54 | /** |
e501603b TO |
55 | * @var string |
56 | */ | |
57 | public $title; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Introductory message to contributor or participant displayed on the Tell a Friend form. | |
61 | * | |
62 | * @var text | |
63 | */ | |
64 | public $intro; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Suggested message to friends, provided as default on the Tell A Friend form. | |
68 | * | |
69 | * @var text | |
70 | */ | |
71 | public $suggested_message; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * URL for general info about the organization - included in the email sent to friends. | |
75 | * | |
76 | * @var string | |
77 | */ | |
78 | public $general_link; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Text for Tell a Friend thank you page header and HTML title. | |
82 | * | |
83 | * @var string | |
84 | */ | |
85 | public $thankyou_title; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Thank you message displayed on success page. | |
89 | * | |
90 | * @var text | |
91 | */ | |
92 | public $thankyou_text; | |
c3fc2621 | 93 | |
e501603b | 94 | /** |
e6ca0a57 | 95 | * @var bool |
e501603b TO |
96 | */ |
97 | public $is_active; | |
c3fc2621 | 98 | |
e501603b | 99 | /** |
f41f0342 | 100 | * Class constructor. |
e501603b | 101 | */ |
c3fc2621 | 102 | public function __construct() { |
e501603b TO |
103 | $this->__table = 'civicrm_tell_friend'; |
104 | parent::__construct(); | |
105 | } | |
c3fc2621 | 106 | |
449c4e6b CW |
107 | /** |
108 | * Returns localized title of this entity. | |
7b66c3b5 AH |
109 | * |
110 | * @param bool $plural | |
111 | * Whether to return the plural version of the title. | |
449c4e6b | 112 | */ |
7b66c3b5 AH |
113 | public static function getEntityTitle($plural = FALSE) { |
114 | return $plural ? ts('Friends') : ts('Friend'); | |
449c4e6b CW |
115 | } |
116 | ||
e501603b | 117 | /** |
f41f0342 | 118 | * Returns foreign keys and entity references. |
e501603b TO |
119 | * |
120 | * @return array | |
121 | * [CRM_Core_Reference_Interface] | |
122 | */ | |
c3fc2621 | 123 | public static function getReferenceColumns() { |
346aaaba | 124 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 125 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 126 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); |
346aaaba | 127 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 128 | } |
346aaaba | 129 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 130 | } |
c3fc2621 | 131 | |
e501603b TO |
132 | /** |
133 | * Returns all the column names of this table | |
134 | * | |
135 | * @return array | |
136 | */ | |
c3fc2621 | 137 | public static function &fields() { |
346aaaba | 138 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
139 | Civi::$statics[__CLASS__]['fields'] = [ |
140 | 'id' => [ | |
e501603b TO |
141 | 'name' => 'id', |
142 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 143 | 'title' => ts('Friend ID'), |
215b423e | 144 | 'description' => ts('Friend ID'), |
c3fc2621 | 145 | 'required' => TRUE, |
a36434b9 | 146 | 'where' => 'civicrm_tell_friend.id', |
522a26c9 | 147 | 'table_name' => 'civicrm_tell_friend', |
148 | 'entity' => 'Friend', | |
149 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 150 | 'localizable' => 0, |
2cbbebe8 A |
151 | 'html' => [ |
152 | 'type' => 'Number', | |
153 | ], | |
1fe423d6 | 154 | 'readonly' => TRUE, |
a9d0587b | 155 | 'add' => '2.0', |
c3fc2621 CW |
156 | ], |
157 | 'entity_table' => [ | |
e501603b TO |
158 | 'name' => 'entity_table', |
159 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 160 | 'title' => ts('Entity Table'), |
215b423e | 161 | 'description' => ts('Name of table where item being referenced is stored.'), |
c3fc2621 | 162 | 'required' => TRUE, |
e501603b TO |
163 | 'maxlength' => 64, |
164 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 165 | 'where' => 'civicrm_tell_friend.entity_table', |
522a26c9 | 166 | 'table_name' => 'civicrm_tell_friend', |
167 | 'entity' => 'Friend', | |
168 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 169 | 'localizable' => 0, |
a9d0587b | 170 | 'add' => '2.0', |
c3fc2621 CW |
171 | ], |
172 | 'entity_id' => [ | |
e501603b TO |
173 | 'name' => 'entity_id', |
174 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 175 | 'title' => ts('Entity ID'), |
215b423e | 176 | 'description' => ts('Foreign key to the referenced item.'), |
c3fc2621 | 177 | 'required' => TRUE, |
a36434b9 | 178 | 'where' => 'civicrm_tell_friend.entity_id', |
522a26c9 | 179 | 'table_name' => 'civicrm_tell_friend', |
180 | 'entity' => 'Friend', | |
181 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 182 | 'localizable' => 0, |
a9d0587b | 183 | 'add' => '2.0', |
c3fc2621 CW |
184 | ], |
185 | 'title' => [ | |
e501603b TO |
186 | 'name' => 'title', |
187 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 188 | 'title' => ts('Title'), |
e501603b TO |
189 | 'maxlength' => 255, |
190 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 191 | 'where' => 'civicrm_tell_friend.title', |
522a26c9 | 192 | 'table_name' => 'civicrm_tell_friend', |
193 | 'entity' => 'Friend', | |
194 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 195 | 'localizable' => 1, |
c3fc2621 | 196 | 'html' => [ |
e501603b | 197 | 'type' => 'Text', |
c3fc2621 | 198 | ], |
a9d0587b | 199 | 'add' => '2.0', |
c3fc2621 CW |
200 | ], |
201 | 'intro' => [ | |
e501603b TO |
202 | 'name' => 'intro', |
203 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 204 | 'title' => ts('Intro'), |
215b423e | 205 | 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'), |
a36434b9 | 206 | 'where' => 'civicrm_tell_friend.intro', |
522a26c9 | 207 | 'table_name' => 'civicrm_tell_friend', |
208 | 'entity' => 'Friend', | |
209 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 210 | 'localizable' => 1, |
c3fc2621 | 211 | 'html' => [ |
e501603b | 212 | 'type' => 'Text', |
c3fc2621 | 213 | ], |
a9d0587b | 214 | 'add' => '2.0', |
c3fc2621 CW |
215 | ], |
216 | 'suggested_message' => [ | |
e501603b TO |
217 | 'name' => 'suggested_message', |
218 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 219 | 'title' => ts('Suggested Message'), |
215b423e | 220 | 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'), |
a36434b9 | 221 | 'where' => 'civicrm_tell_friend.suggested_message', |
522a26c9 | 222 | 'table_name' => 'civicrm_tell_friend', |
223 | 'entity' => 'Friend', | |
224 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 225 | 'localizable' => 1, |
c3fc2621 | 226 | 'html' => [ |
e501603b | 227 | 'type' => 'Text', |
c3fc2621 | 228 | ], |
a9d0587b | 229 | 'add' => '2.0', |
c3fc2621 CW |
230 | ], |
231 | 'general_link' => [ | |
e501603b TO |
232 | 'name' => 'general_link', |
233 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 234 | 'title' => ts('General Link'), |
215b423e | 235 | 'description' => ts('URL for general info about the organization - included in the email sent to friends.'), |
e501603b TO |
236 | 'maxlength' => 255, |
237 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 238 | 'import' => TRUE, |
e501603b | 239 | 'where' => 'civicrm_tell_friend.general_link', |
c3fc2621 | 240 | 'export' => TRUE, |
522a26c9 | 241 | 'table_name' => 'civicrm_tell_friend', |
242 | 'entity' => 'Friend', | |
243 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 244 | 'localizable' => 0, |
c3fc2621 | 245 | 'html' => [ |
e501603b | 246 | 'type' => 'Text', |
c3fc2621 | 247 | ], |
a9d0587b | 248 | 'add' => '2.0', |
c3fc2621 CW |
249 | ], |
250 | 'thankyou_title' => [ | |
e501603b TO |
251 | 'name' => 'thankyou_title', |
252 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 253 | 'title' => ts('Thank You Title'), |
215b423e | 254 | 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'), |
e501603b TO |
255 | 'maxlength' => 255, |
256 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 257 | 'where' => 'civicrm_tell_friend.thankyou_title', |
522a26c9 | 258 | 'table_name' => 'civicrm_tell_friend', |
259 | 'entity' => 'Friend', | |
260 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 261 | 'localizable' => 1, |
c3fc2621 | 262 | 'html' => [ |
e501603b | 263 | 'type' => 'Text', |
c3fc2621 | 264 | ], |
a9d0587b | 265 | 'add' => '2.0', |
c3fc2621 CW |
266 | ], |
267 | 'thankyou_text' => [ | |
e501603b TO |
268 | 'name' => 'thankyou_text', |
269 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 270 | 'title' => ts('Thank You Text'), |
215b423e | 271 | 'description' => ts('Thank you message displayed on success page.'), |
a36434b9 | 272 | 'where' => 'civicrm_tell_friend.thankyou_text', |
522a26c9 | 273 | 'table_name' => 'civicrm_tell_friend', |
274 | 'entity' => 'Friend', | |
275 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 276 | 'localizable' => 1, |
c3fc2621 | 277 | 'html' => [ |
e501603b | 278 | 'type' => 'Text', |
c3fc2621 | 279 | ], |
a9d0587b | 280 | 'add' => '2.0', |
c3fc2621 CW |
281 | ], |
282 | 'is_active' => [ | |
e501603b TO |
283 | 'name' => 'is_active', |
284 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 285 | 'title' => ts('Enabled?'), |
a36434b9 | 286 | 'where' => 'civicrm_tell_friend.is_active', |
522a26c9 | 287 | 'table_name' => 'civicrm_tell_friend', |
288 | 'entity' => 'Friend', | |
289 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 290 | 'localizable' => 0, |
c3fc2621 | 291 | 'html' => [ |
e501603b | 292 | 'type' => 'CheckBox', |
c3fc2621 | 293 | ], |
a9d0587b | 294 | 'add' => '2.0', |
c3fc2621 CW |
295 | ], |
296 | ]; | |
346aaaba | 297 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 298 | } |
346aaaba | 299 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 300 | } |
c3fc2621 | 301 | |
e501603b | 302 | /** |
bd8e0b14 | 303 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
304 | * |
305 | * @return array | |
bd8e0b14 | 306 | * Array(string $name => string $uniqueName). |
e501603b | 307 | */ |
c3fc2621 | 308 | public static function &fieldKeys() { |
bd8e0b14 TO |
309 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
310 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 311 | } |
bd8e0b14 | 312 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 313 | } |
c3fc2621 | 314 | |
e501603b TO |
315 | /** |
316 | * Returns the names of this table | |
317 | * | |
318 | * @return string | |
319 | */ | |
c3fc2621 | 320 | public static function getTableName() { |
e501603b TO |
321 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
322 | } | |
c3fc2621 | 323 | |
e501603b TO |
324 | /** |
325 | * Returns if this table needs to be logged | |
326 | * | |
c3fc2621 | 327 | * @return bool |
e501603b | 328 | */ |
c3fc2621 | 329 | public function getLog() { |
e501603b TO |
330 | return self::$_log; |
331 | } | |
c3fc2621 | 332 | |
e501603b TO |
333 | /** |
334 | * Returns the list of fields that can be imported | |
335 | * | |
336 | * @param bool $prefix | |
337 | * | |
338 | * @return array | |
339 | */ | |
c3fc2621 CW |
340 | public static function &import($prefix = FALSE) { |
341 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []); | |
60808919 | 342 | return $r; |
e501603b | 343 | } |
c3fc2621 | 344 | |
e501603b TO |
345 | /** |
346 | * Returns the list of fields that can be exported | |
347 | * | |
348 | * @param bool $prefix | |
349 | * | |
350 | * @return array | |
351 | */ | |
c3fc2621 CW |
352 | public static function &export($prefix = FALSE) { |
353 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []); | |
60808919 | 354 | return $r; |
e501603b | 355 | } |
c3fc2621 | 356 | |
e7a6b91a AS |
357 | /** |
358 | * Returns the list of indices | |
c3fc2621 CW |
359 | * |
360 | * @param bool $localize | |
361 | * | |
362 | * @return array | |
e7a6b91a AS |
363 | */ |
364 | public static function indices($localize = TRUE) { | |
c3fc2621 | 365 | $indices = []; |
e7a6b91a AS |
366 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
367 | } | |
c3fc2621 | 368 | |
e501603b | 369 | } |