3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2015
35 * This form is intended to replace the overloading of many forms to generate a snippet for custom data.
37 class CRM_Custom_Form_CustomDataByType
extends CRM_Core_Form
{
40 * Preprocess function.
42 public function preProcess() {
44 $this->_type
= $this->_cdType
= CRM_Utils_Request
::retrieve('type', 'String', CRM_Core_DAO
::$_nullObject, TRUE);
45 $this->_subType
= CRM_Utils_Request
::retrieve('subType', 'String');
46 $this->_subName
= CRM_Utils_Request
::retrieve('subName', 'String');
47 $this->_groupCount
= CRM_Utils_Request
::retrieve('cgcount', 'Positive');
48 $this->_entityId
= CRM_Utils_Request
::retrieve('entityID', 'Positive');
49 $this->_groupID
= CRM_Utils_Request
::retrieve('groupID', 'Positive');
50 $this->assign('cdType', FALSE);
51 $this->assign('cgCount', $this->_groupCount
);
53 if (!is_array($this->_subType
) && strstr($this->_subType
, CRM_Core_DAO
::VALUE_SEPARATOR
)) {
54 $this->_subType
= str_replace(CRM_Core_DAO
::VALUE_SEPARATOR
, ',', trim($this->_subType
, CRM_Core_DAO
::VALUE_SEPARATOR
));
56 CRM_Custom_Form_CustomData
::setGroupTree($this, $this->_subType
, NULL, $this->_groupID
);
58 $this->assign('suppressForm', TRUE);
59 $this->controller
->_generateQFKey
= FALSE;
67 public function setDefaultValues() {
69 CRM_Core_BAO_CustomGroup
::setDefaults($this->_groupTree
, $defaults, FALSE, FALSE, $this->get('action'));
76 public function buildQuickForm() {
77 $this->addElement('hidden', 'hidden_custom', 1);
78 $this->addElement('hidden', "hidden_custom_group_count[{$this->_groupID}]", $this->_groupCount
);
79 CRM_Core_BAO_CustomGroup
::buildQuickForm($this, $this->_groupTree
);