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 helps to print the labels for contacts
40 class CRM_Event_Form_Task_Badge
extends CRM_Event_Form_Task
{
43 * Are we operating in "single mode", i.e. sending email to one
48 public $_single = FALSE;
53 public $_componentClause;
56 * build all the data structures needed to build the form
63 function preProcess() {
64 $this->_context
= CRM_Utils_Request
::retrieve('context', 'String', $this);
65 if ($this->_context
== 'view') {
66 $this->_single
= TRUE;
68 $participantID = CRM_Utils_Request
::retrieve('id', 'Positive', $this, TRUE);
69 $contactID = CRM_Utils_Request
::retrieve('cid', 'Positive', $this, TRUE);
70 $this->_participantIds
= array($participantID);
71 $this->_componentClause
= " civicrm_participant.id = $participantID ";
72 $this->assign('totalSelectedParticipants', 1);
74 // also set the user context to send back to view page
75 $session = CRM_Core_Session
::singleton();
76 $session->pushUserContext(CRM_Utils_System
::url('civicrm/contact/view/participant',
77 "reset=1&action=view&id={$participantID}&cid={$contactID}"
92 function buildQuickForm() {
93 CRM_Utils_System
::setTitle(ts('Make Name Badges'));
95 //add select for label
96 $label = CRM_Badge_BAO_Layout
::getList();
100 ts('Name Badge Format'),
102 '' => ts('- select -')) +
$label, TRUE
106 $back = $this->_single ?
'cancel' : 'back';
107 $this->addDefaultButtons(ts('Make Name Badges'), $next, $back);
111 * process the form after the input has been submitted and validated
117 public function postProcess() {
118 $params = $this->controller
->exportValues($this->_name
);
119 CRM_Badge_BAO_Badge
::buildBadges($params, $this);