[NFC] fix more places where var is declared as boolean rather than bool
[civicrm-core.git] / CRM / Event / Form / Task / Badge.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
fee14197 4 | CiviCRM version 5 |
6a488035 5 +--------------------------------------------------------------------+
6b83d5bd 6 | Copyright CiviCRM LLC (c) 2004-2019 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
29 *
30 * @package CRM
6b83d5bd 31 * @copyright CiviCRM LLC (c) 2004-2019
6a488035
TO
32 */
33
34/**
6dd9d5c2 35 * This class helps to print the labels for contacts.
6a488035
TO
36 */
37class CRM_Event_Form_Task_Badge extends CRM_Event_Form_Task {
38
39 /**
40 * Are we operating in "single mode", i.e. sending email to one
41 * specific contact?
42 *
d51c6add 43 * @var bool
6a488035
TO
44 */
45 public $_single = FALSE;
46
6d4a64c8 47 /**
eceb18cc 48 * Component clause.
90b461f1 49 * @var string
6d4a64c8
KJ
50 */
51 public $_componentClause;
52
6a488035 53 /**
eceb18cc 54 * Build all the data structures needed to build the form.
6a488035
TO
55 *
56 * @param
57 *
58 * @return void
6d4a64c8 59 */
00be9182 60 public function preProcess() {
edc80cda 61 $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this);
6a488035
TO
62 if ($this->_context == 'view') {
63 $this->_single = TRUE;
64
65 $participantID = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
66 $contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
be2fb01f 67 $this->_participantIds = [$participantID];
6a488035
TO
68 $this->_componentClause = " civicrm_participant.id = $participantID ";
69 $this->assign('totalSelectedParticipants', 1);
70
71 // also set the user context to send back to view page
72 $session = CRM_Core_Session::singleton();
73 $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/participant',
353ffa53
TO
74 "reset=1&action=view&id={$participantID}&cid={$contactID}"
75 ));
6a488035
TO
76 }
77 else {
78 parent::preProcess();
79 }
80 }
81
82 /**
eceb18cc 83 * Build the form object.
6a488035 84 */
00be9182 85 public function buildQuickForm() {
6a488035
TO
86 CRM_Utils_System::setTitle(ts('Make Name Badges'));
87
22029f77
CW
88 // Ajax submit would interfere with file download
89 $this->preventAjaxSubmit();
90
6a488035 91 //add select for label
8c7f8a8b 92 $label = CRM_Badge_BAO_Layout::getList();
6a488035
TO
93
94 $this->add('select',
95 'badge_id',
96 ts('Name Badge Format'),
be2fb01f 97 [
e7483cbe 98 '' => ts('- select -'),
be2fb01f 99 ] + $label, TRUE
6a488035
TO
100 );
101
102 $next = 'next';
103 $back = $this->_single ? 'cancel' : 'back';
104 $this->addDefaultButtons(ts('Make Name Badges'), $next, $back);
105 }
106
107 /**
eceb18cc 108 * Process the form after the input has been submitted and validated.
6a488035
TO
109 */
110 public function postProcess() {
111 $params = $this->controller->exportValues($this->_name);
6d4a64c8 112 CRM_Badge_BAO_Badge::buildBadges($params, $this);
6a488035 113 }
96025800 114
6a488035 115}