3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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-2013
37 * This class provides the functionality for batch profile update for event participations
39 class CRM_Event_Form_Task_PickProfile
extends CRM_Event_Form_Task
{
42 * the title of the group
49 * maximum event participations that should be allowed to update
52 protected $_maxParticipations = 100;
55 * variable to store redirect path
58 protected $_userContext;
61 * build all the data structures needed to build the form
66 function preProcess() {
68 * initialize the task and row fields
72 $session = CRM_Core_Session
::singleton();
73 $this->_userContext
= $session->readUserContext();
75 CRM_Utils_System
::setTitle(ts('Batch Update for Event Participants'));
79 if (count($this->_participantIds
) > $this->_maxParticipations
) {
80 CRM_Core_Session
::setStatus("The maximum number of event participations you can select for Batch Update is {$this->_maxParticipations}. You have selected " . count($this->_participantIds
) . ". Please select fewer participantions from your search results and try again.");
86 CRM_Utils_System
::redirect($this->_userContext
);
97 function buildQuickForm() {
98 $types = array('Participant');
99 $profiles = CRM_Core_BAO_UFGroup
::getProfiles($types, TRUE);
101 if (empty($profiles)) {
102 CRM_Core_Session
::setStatus("To use Batch Update for event participants, you need to configure a profile containing only Participant fields (e.g. Participant Status, Participant Role, etc.). Configure a profile at 'Administer CiviCRM >> Customize >> CiviCRM Profile'.");
103 CRM_Utils_System
::redirect($this->_userContext
);
106 $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'),
108 '' => ts('- select profile -')) +
$profiles, TRUE
110 $this->addDefaultButtons(ts('Continue >>'));
114 * Add local and global form rules
120 function addRules() {
121 $this->addFormRule(array('CRM_Event_Form_Task_PickProfile', 'formRule'));
125 * global validation rules for the form
127 * @param array $fields posted values of the form
129 * @return array list of errors to be posted back to the form
133 static function formRule($fields) {
138 * process the form after the input has been submitted and validated
144 public function postProcess() {
145 $params = $this->exportValues();
147 $this->set('ufGroupId', $params['uf_group_id']);
149 // also reset the batch page so it gets new values from the db
150 $this->controller
->resetPage('Batch');