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
19 * This class generates form components
20 * for previewing Civicrm Profile Group
23 class CRM_UF_Form_Preview
extends CRM_UF_Form_AbstractPreview
{
26 * Pre processing work done here.
28 * gets session variables for group or field id
34 public function preProcess() {
36 $gid = $this->get('id');
37 $this->set('gid', $gid);
38 $field = CRM_Utils_Request
::retrieve('field', 'Boolean', $this, TRUE, 0);
41 $fields = CRM_Core_BAO_UFGroup
::getFields($gid, FALSE, NULL, NULL, NULL, TRUE);
42 $fieldDAO = new CRM_Core_DAO_UFField();
43 $fieldDAO->id
= $this->get('fieldId');
44 $fieldDAO->find(TRUE);
46 if ($fieldDAO->is_active
== 0) {
47 CRM_Core_Error
::statusBounce(ts('This field is inactive so it will not be displayed on profile form.'));
49 elseif ($fieldDAO->is_view
== 1) {
50 CRM_Core_Error
::statusBounce(ts('This field is view only so it will not be displayed on profile form.'));
52 $name = $fieldDAO->field_name
;
54 if ($fieldDAO->field_name
== 'phone_and_ext') {
62 'supplemental_address_1',
63 'supplemental_address_2',
64 'supplemental_address_3',
78 if ($fieldDAO->location_type_id
) {
79 $name .= '-' . $fieldDAO->location_type_id
;
81 elseif (in_array($name, $specialFields)) {
85 if (isset($fieldDAO->phone_type_id
)) {
86 $name .= '-' . $fieldDAO->phone_type_id
;
89 $fieldArray[$name] = $fields[$name];
91 if ($fieldDAO->field_name
== 'phone_and_ext') {
92 $phoneExtField = str_replace('phone', 'phone_ext', $name);
93 $fieldArray[$phoneExtField] = $fields[$phoneExtField];
96 $fields = $fieldArray;
97 if (!is_array($fields[$name])) {
100 $this->setProfile($fields, TRUE, $flag);
103 $fields = CRM_Core_BAO_UFGroup
::getFields($gid);
104 $this->setProfile($fields);
109 * Build the form object.
113 public function buildQuickForm() {
114 parent
::buildQuickForm();
119 'name' => ts('Done with Preview'),