3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
21 * This class generates form components
22 * for previewing Civicrm Profile Group
25 class CRM_UF_Form_Preview
extends CRM_UF_Form_AbstractPreview
{
28 * Pre processing work done here.
30 * gets session variables for group or field id
36 public function preProcess() {
38 $gid = $this->get('id');
39 $this->set('gid', $gid);
40 $field = CRM_Utils_Request
::retrieve('field', 'Boolean', $this, TRUE, 0);
43 $fields = CRM_Core_BAO_UFGroup
::getFields($gid, FALSE, NULL, NULL, NULL, TRUE);
44 $fieldDAO = new CRM_Core_DAO_UFField();
45 $fieldDAO->id
= $this->get('fieldId');
46 $fieldDAO->find(TRUE);
48 if ($fieldDAO->is_active
== 0) {
49 CRM_Core_Error
::statusBounce(ts('This field is inactive so it will not be displayed on profile form.'));
51 elseif ($fieldDAO->is_view
== 1) {
52 CRM_Core_Error
::statusBounce(ts('This field is view only so it will not be displayed on profile form.'));
54 $name = $fieldDAO->field_name
;
56 if ($fieldDAO->field_name
== 'phone_and_ext') {
64 'supplemental_address_1',
65 'supplemental_address_2',
66 'supplemental_address_3',
80 if ($fieldDAO->location_type_id
) {
81 $name .= '-' . $fieldDAO->location_type_id
;
83 elseif (in_array($name, $specialFields)) {
87 if (isset($fieldDAO->phone_type_id
)) {
88 $name .= '-' . $fieldDAO->phone_type_id
;
91 $fieldArray[$name] = $fields[$name];
93 if ($fieldDAO->field_name
== 'phone_and_ext') {
94 $phoneExtField = str_replace('phone', 'phone_ext', $name);
95 $fieldArray[$phoneExtField] = $fields[$phoneExtField];
98 $fields = $fieldArray;
99 if (!is_array($fields[$name])) {
102 $this->setProfile($fields, TRUE, $flag);
105 $fields = CRM_Core_BAO_UFGroup
::getFields($gid);
106 $this->setProfile($fields);
111 * Build the form object.
115 public function buildQuickForm() {
116 parent
::buildQuickForm();
121 'name' => ts('Done with Preview'),