First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
103
sites/all/modules/civicrm/api/v3/SurveyRespondant.php
Normal file
103
sites/all/modules/civicrm/api/v3/SurveyRespondant.php
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------+
|
||||
| CiviCRM version 4.7 |
|
||||
+--------------------------------------------------------------------+
|
||||
| Copyright Tech To The People (c) 2010 |
|
||||
+--------------------------------------------------------------------+
|
||||
| This file is a part of CiviCRM. |
|
||||
| |
|
||||
| CiviCRM is free software; you can copy, modify, and distribute it |
|
||||
| under the terms of the GNU Affero General Public License |
|
||||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
|
||||
| |
|
||||
| CiviCRM is distributed in the hope that it will be useful, but |
|
||||
| WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
| See the GNU Affero General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of the GNU Affero General Public |
|
||||
| License and the CiviCRM Licensing Exception along |
|
||||
| with this program; if not, contact CiviCRM LLC |
|
||||
| at info[AT]civicrm[DOT]org. If you have questions about the |
|
||||
| GNU Affero General Public License or the licensing of CiviCRM, |
|
||||
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
|
||||
+--------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/**
|
||||
* This api exposes CiviCRM Survey Respondant.
|
||||
*
|
||||
* @deprecated - api currently not supported
|
||||
*
|
||||
* @package CiviCRM_APIv3
|
||||
*/
|
||||
|
||||
/**
|
||||
* Notify caller of deprecated function.
|
||||
*
|
||||
* @deprecated api notice
|
||||
* @return string
|
||||
* String output indicates this entire api entity as deprecated
|
||||
*/
|
||||
function _civicrm_api3_survey_respondant_deprecation() {
|
||||
return 'The SurveyRespondant api is not currently supported.';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Count survey respondents.
|
||||
*
|
||||
* @deprecated - api currently not supported
|
||||
*
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
function &civicrm_api3_survey_respondant_count($params) {
|
||||
|
||||
$petition = new CRM_Campaign_BAO_Petition();
|
||||
if (array_key_exists('groupby', $params) &&
|
||||
$params['groupby'] == 'country'
|
||||
) {
|
||||
$signaturesCount = $petition->getPetitionSignatureTotalbyCountry($params['survey_id']);
|
||||
}
|
||||
else {
|
||||
$signaturesCount = $petition->getPetitionSignatureTotal($params['survey_id']);
|
||||
}
|
||||
return ($signaturesCount);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue