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 * Page for voting tab interface.
21 class CRM_Campaign_Page_Vote
extends CRM_Core_Page
{
23 private $_interviewerId;
28 public function reserve() {
29 //build ajax voter search and selector.
30 $controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Gotv', ts('Reserve Respondents'));
31 $controller->set('votingTab', TRUE);
32 $controller->set('subVotingTab', 'searchANDReserve');
34 $controller->process();
35 return $controller->run();
41 public function interview() {
42 //build interview and release voter interface.
43 $controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Task_Interview', ts('Interview Respondents'));
44 $controller->set('votingTab', TRUE);
45 $controller->set('subVotingTab', 'searchANDInterview');
46 if ($this->_surveyId
) {
47 $controller->set('surveyId', $this->_surveyId
);
49 if ($this->_interviewerId
) {
50 $controller->set('interviewerId', $this->_interviewerId
);
52 $controller->process();
53 return $controller->run();
56 public function browse() {
58 'reserve' => ts('Reserve Respondents'),
59 'interview' => ts('Interview Respondents'),
62 $this->_surveyId
= CRM_Utils_Request
::retrieve('sid', 'Positive', $this);
63 $this->_interviewerId
= CRM_Utils_Request
::retrieve('cid', 'Positive', $this);
65 $subPageType = CRM_Utils_Request
::retrieve('type', 'String', $this);
67 $session = CRM_Core_Session
::singleton();
68 $session->pushUserContext(CRM_Utils_System
::url('civicrm/campaign/vote', "reset=1&subPage={$subPageType}"));
69 //load the data in tabs.
70 $this->{$subPageType}();
76 $this->assign('subPageType', $subPageType);
78 CRM_Core_Resources
::singleton()
79 ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
82 'active' => strtolower(CRM_Utils_Array
::value('subPage', $_GET, 'reserve')),
90 public function run() {
96 public function buildTabs() {
98 foreach ($this->_tabs
as $name => $title) {
99 // check for required permissions.
100 if (!CRM_Core_Permission
::check([
103 'administer CiviCampaign',
104 "{$name} campaign contacts",
110 $urlParams = "type={$name}";
111 if ($this->_surveyId
) {
112 $urlParams .= "&sid={$this->_surveyId}";
114 if ($this->_interviewerId
) {
115 $urlParams .= "&cid={$this->_interviewerId}";
121 'link' => CRM_Utils_System
::url('civicrm/campaign/vote', $urlParams),
125 $this->assign('tabHeader', empty($allTabs) ?
FALSE : $allTabs);