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 helps to print the labels for contacts.
21 class CRM_Event_Form_Task_Badge
extends CRM_Event_Form_Task
{
24 * Are we operating in "single mode", i.e. sending email to one
29 public $_single = FALSE;
35 public $_componentClause;
38 * Build all the data structures needed to build the form.
44 public function preProcess() {
45 $this->_context
= CRM_Utils_Request
::retrieve('context', 'Alphanumeric', $this);
46 if ($this->_context
== 'view') {
47 $this->_single
= TRUE;
49 $participantID = CRM_Utils_Request
::retrieve('id', 'Positive', $this, TRUE);
50 $contactID = CRM_Utils_Request
::retrieve('cid', 'Positive', $this, TRUE);
51 $this->_participantIds
= [$participantID];
52 $this->_componentClause
= " civicrm_participant.id = $participantID ";
53 $this->assign('totalSelectedParticipants', 1);
55 // also set the user context to send back to view page
56 $session = CRM_Core_Session
::singleton();
57 $session->pushUserContext(CRM_Utils_System
::url('civicrm/contact/view/participant',
58 "reset=1&action=view&id={$participantID}&cid={$contactID}"
67 * Build the form object.
69 public function buildQuickForm() {
70 CRM_Utils_System
::setTitle(ts('Make Name Badges'));
72 // Ajax submit would interfere with file download
73 $this->preventAjaxSubmit();
75 //add select for label
76 $label = CRM_Badge_BAO_Layout
::getList();
80 ts('Name Badge Format'),
82 '' => ts('- select -'),
87 $back = $this->_single ?
'cancel' : 'back';
88 $this->addDefaultButtons(ts('Make Name Badges'), $next, $back);
92 * Process the form after the input has been submitted and validated.
94 public function postProcess() {
95 $params = $this->controller
->exportValues($this->_name
);
96 CRM_Badge_BAO_Badge
::buildBadges($params, $this);