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); CRM_Core_Resources::singleton() ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js') ->addSetting(array('tabSettings' => array( 'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'reserve')), ))); } function run() { $this->browse(); return parent::run(); } function buildTabs() { $allTabs = array(); foreach ($this->_tabs as $name => $title) { // check for required permissions. if (!CRM_Core_Permission::check(array(array('manage campaign', 'administer CiviCampaign', "{$name} campaign contacts")))) { continue; } $urlParams = "type={$name}"; if ($this->_surveyId) { $urlParams .= "&sid={$this->_surveyId}"; } if ($this->_interviewerId) { $urlParams .= "&cid={$this->_interviewerId}"; } $allTabs[$name] = array( 'title' => $title, 'valid' => TRUE, 'active' => TRUE, 'link' => CRM_Utils_System::url('civicrm/campaign/vote', $urlParams), ); } $this->assign('tabHeader', empty($allTabs) ? FALSE : $allTabs); } }