CRM-15603 - Standardize punctuation of 'You do not have permission to access this...
[civicrm-core.git] / CRM / Event / Form / Task / Badge.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
06b69b18 4 | CiviCRM version 4.5 |
6a488035 5 +--------------------------------------------------------------------+
06b69b18 6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 +--------------------------------------------------------------------+
26*/
27
28/**
29 *
30 * @package CRM
06b69b18 31 * @copyright CiviCRM LLC (c) 2004-2014
6a488035
TO
32 * $Id$
33 *
34 */
35
36/**
37 * This class helps to print the labels for contacts
38 *
39 */
40class CRM_Event_Form_Task_Badge extends CRM_Event_Form_Task {
41
42 /**
43 * Are we operating in "single mode", i.e. sending email to one
44 * specific contact?
45 *
46 * @var boolean
47 */
48 public $_single = FALSE;
49
6d4a64c8
KJ
50 /**
51 * component clause
52 */
53 public $_componentClause;
54
6a488035
TO
55 /**
56 * build all the data structures needed to build the form
57 *
58 * @param
59 *
60 * @return void
61 * @access public
6d4a64c8
KJ
62 */
63 function preProcess() {
6a488035
TO
64 $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
65 if ($this->_context == 'view') {
66 $this->_single = TRUE;
67
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);
73
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}"
78 ));
79 }
80 else {
81 parent::preProcess();
82 }
83 }
84
85 /**
86 * Build the form
87 *
88 * @access public
89 *
90 * @return void
91 */
92 function buildQuickForm() {
93 CRM_Utils_System::setTitle(ts('Make Name Badges'));
94
95 //add select for label
8c7f8a8b 96 $label = CRM_Badge_BAO_Layout::getList();
6a488035
TO
97
98 $this->add('select',
99 'badge_id',
100 ts('Name Badge Format'),
101 array(
102 '' => ts('- select -')) + $label, TRUE
103 );
104
105 $next = 'next';
106 $back = $this->_single ? 'cancel' : 'back';
107 $this->addDefaultButtons(ts('Make Name Badges'), $next, $back);
108 }
109
110 /**
111 * process the form after the input has been submitted and validated
112 *
113 * @access public
114 *
115 * @return void
116 */
117 public function postProcess() {
118 $params = $this->controller->exportValues($this->_name);
6d4a64c8 119 CRM_Badge_BAO_Badge::buildBadges($params, $this);
6a488035
TO
120 }
121}
122