set('votingTab', TRUE); $controller->set('subVotingTab', 'searchANDReserve'); $controller->process(); return $controller->run(); } function interview() { //build interview and release voter interface. $controller = new CRM_Core_Controller_Simple('CRM_Campaign_Form_Task_Interview', ts('Interview Respondents')); $controller->set('votingTab', TRUE); $controller->set('subVotingTab', 'searchANDInterview'); if ($this->_surveyId) { $controller->set('surveyId', $this->_surveyId); } if ($this->_interviewerId) { $controller->set('interviewerId', $this->_interviewerId); } $controller->process(); return $controller->run(); } function browse() { $this->_tabs = array('reserve' => ts('Reserve Respondents'), 'interview' => ts('Interview Respondents'), ); $this->_surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this); $this->_interviewerId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); $subPageType = CRM_Utils_Request::retrieve('type', 'String', $this); if ($subPageType) { $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/campaign/vote', "reset=1&subPage={$subPageType}")); //load the data in tabs. $this->{$subPageType}(); } else { //build the tabs. $this->buildTabs(); } $this->assign('subPageType', $subPageType); //give focus to proper tab. $this->assign('selectedTabIndex', array_search(CRM_Utils_Array::value('subPage', $_GET, 'reserve'), array_keys($this->_tabs) )); } function run() { $this->browse(); return parent::run(); } function buildTabs() { //check for required permissions. $superUser = FALSE; if (CRM_Core_Permission::check('manage campaign') || CRM_Core_Permission::check('administer CiviCampaign') ) { $superUser = TRUE; } $allTabs = array(); foreach ($this->_tabs as $name => $title) { if (!$superUser && !CRM_Core_Permission::check("{$name} campaign contacts") ) { continue; } $urlParams = "type={$name}&snippet=1"; if ($this->_surveyId) { $urlParams .= "&sid={$this->_surveyId}"; } if ($this->_interviewerId) { $urlParams .= "&cid={$this->_interviewerId}"; } $allTabs[] = array( 'id' => $name, 'title' => $title, 'url' => CRM_Utils_System::url('civicrm/campaign/vote', $urlParams ), ); } $this->assign('allTabs', empty($allTabs) ? FALSE : $allTabs); } }