/** * Get the list of signatories. * * @deprecated - api currently not supported * * @param array $params * input parameters. * * @return array */ function civicrm_api3_survey_respondant_get(&$params) { civicrm_api3_verify_one_mandatory($params, NULL, array('survey_id', 'id')); if (array_key_exists('survey_id', $params)) { $surveyID = $params['survey_id']; } else { $surveyID = $params['id']; } $interviewerID = NULL; if (array_key_exists('interviewer_id', $params)) { $interviewerID = $params['interviewer_id']; } $statusIds = array(); if (array_key_exists('status_id', $params)) { $statusIds = explode(',', $params['status_id']); } $respondants = CRM_Campaign_BAO_Survey::getSurveyActivities($surveyID, $interviewerID, $statusIds); return civicrm_api3_create_success($respondants, $params, 'SurveyRespondant', 'get'); }
/** * Build all the data structures needed to build the form. */ public function preProcess() { parent::preProcess(); //get the survey id from user submitted values. $this->_surveyId = $this->get('surveyId'); $this->_interviewerId = $this->get('interviewerId'); if (!$this->_surveyId) { CRM_Core_Error::statusBounce(ts("Could not find Survey Id.")); } if (!$this->_interviewerId) { CRM_Core_Error::statusBounce(ts("Missing Interviewer contact.")); } if (!is_array($this->_contactIds) || empty($this->_contactIds)) { CRM_Core_Error::statusBounce(ts("Could not find contacts for reservation.")); } $params = array('id' => $this->_surveyId); CRM_Campaign_BAO_Survey::retrieve($params, $this->_surveyDetails); //get the survey activities. $activityStatus = CRM_Core_PseudoConstant::activityStatus('name'); $statusIds = array(); foreach (array('Scheduled') as $name) { if ($statusId = array_search($name, $activityStatus)) { $statusIds[] = $statusId; } } // these are the activities count that are linked to the current // interviewer and current survey and not the list of ALL survey activities $this->_numVoters = CRM_Campaign_BAO_Survey::getSurveyActivities($this->_surveyId, $this->_interviewerId, $statusIds, NULL, TRUE); //validate the selected survey. $this->validateSurvey(); $this->assign('surveyTitle', $this->_surveyDetails['title']); $this->assign('activityType', $this->_surveyDetails['activity_type_id']); $this->assign('surveyId', $this->_surveyId); //append breadcrumb to survey dashboard. if (CRM_Campaign_BAO_Campaign::accessCampaign()) { $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'); CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey(s)'), 'url' => $url))); } //set the title. CRM_Utils_System::setTitle(ts('Reserve Respondents')); }