3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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-2018
35 * This class helps to print the labels for contacts.
37 class CRM_Event_Form_Task_Badge
extends CRM_Event_Form_Task
{
40 * Are we operating in "single mode", i.e. sending email to one
45 public $_single = FALSE;
50 public $_componentClause;
53 * Build all the data structures needed to build the form.
59 public function preProcess() {
60 $this->_context
= CRM_Utils_Request
::retrieve('context', 'String', $this);
61 if ($this->_context
== 'view') {
62 $this->_single
= TRUE;
64 $participantID = CRM_Utils_Request
::retrieve('id', 'Positive', $this, TRUE);
65 $contactID = CRM_Utils_Request
::retrieve('cid', 'Positive', $this, TRUE);
66 $this->_participantIds
= array($participantID);
67 $this->_componentClause
= " civicrm_participant.id = $participantID ";
68 $this->assign('totalSelectedParticipants', 1);
70 // also set the user context to send back to view page
71 $session = CRM_Core_Session
::singleton();
72 $session->pushUserContext(CRM_Utils_System
::url('civicrm/contact/view/participant',
73 "reset=1&action=view&id={$participantID}&cid={$contactID}"
82 * Build the form object.
84 public function buildQuickForm() {
85 CRM_Utils_System
::setTitle(ts('Make Name Badges'));
87 // Ajax submit would interfere with file download
88 $this->preventAjaxSubmit();
90 //add select for label
91 $label = CRM_Badge_BAO_Layout
::getList();
95 ts('Name Badge Format'),
97 '' => ts('- select -'),
102 $back = $this->_single ?
'cancel' : 'back';
103 $this->addDefaultButtons(ts('Make Name Badges'), $next, $back);
107 * Process the form after the input has been submitted and validated.
109 public function postProcess() {
110 $params = $this->controller
->exportValues($this->_name
);
111 CRM_Badge_BAO_Badge
::buildBadges($params, $this);