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 * Page for voting tab interface.
37 class CRM_Campaign_Page_Vote
extends CRM_Core_Page
{
39 private $_interviewerId;
44 public function reserve() {
45 //build ajax voter search and selector.
46 $controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Gotv', ts('Reserve Respondents'));
47 $controller->set('votingTab', TRUE);
48 $controller->set('subVotingTab', 'searchANDReserve');
50 $controller->process();
51 return $controller->run();
57 public function interview() {
58 //build interview and release voter interface.
59 $controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Task_Interview', ts('Interview Respondents'));
60 $controller->set('votingTab', TRUE);
61 $controller->set('subVotingTab', 'searchANDInterview');
62 if ($this->_surveyId
) {
63 $controller->set('surveyId', $this->_surveyId
);
65 if ($this->_interviewerId
) {
66 $controller->set('interviewerId', $this->_interviewerId
);
68 $controller->process();
69 return $controller->run();
72 public function browse() {
74 'reserve' => ts('Reserve Respondents'),
75 'interview' => ts('Interview Respondents'),
78 $this->_surveyId
= CRM_Utils_Request
::retrieve('sid', 'Positive', $this);
79 $this->_interviewerId
= CRM_Utils_Request
::retrieve('cid', 'Positive', $this);
81 $subPageType = CRM_Utils_Request
::retrieve('type', 'String', $this);
83 $session = CRM_Core_Session
::singleton();
84 $session->pushUserContext(CRM_Utils_System
::url('civicrm/campaign/vote', "reset=1&subPage={$subPageType}"));
85 //load the data in tabs.
86 $this->{$subPageType}();
92 $this->assign('subPageType', $subPageType);
94 CRM_Core_Resources
::singleton()
95 ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
97 'tabSettings' => array(
98 'active' => strtolower(CRM_Utils_Array
::value('subPage', $_GET, 'reserve')),
106 public function run() {
109 return parent
::run();
112 public function buildTabs() {
114 foreach ($this->_tabs
as $name => $title) {
115 // check for required permissions.
116 if (!CRM_Core_Permission
::check(array(
119 'administer CiviCampaign',
120 "{$name} campaign contacts",
127 $urlParams = "type={$name}";
128 if ($this->_surveyId
) {
129 $urlParams .= "&sid={$this->_surveyId}";
131 if ($this->_interviewerId
) {
132 $urlParams .= "&cid={$this->_interviewerId}";
134 $allTabs[$name] = array(
138 'link' => CRM_Utils_System
::url('civicrm/campaign/vote', $urlParams),
142 $this->assign('tabHeader', empty($allTabs) ?
FALSE : $allTabs);