Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 TO |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright Tech To The People (c) 2010 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * File for the CiviCRM APIv3 Survey Respondant functions | |
30 | * | |
31 | * @package CiviCRM_APIv3 | |
32 | * @subpackage API_Survey | |
33 | */ | |
34 | ||
a14e9d08 CW |
35 | /** |
36 | * @deprecated api notice | |
a6c01b45 | 37 | * @return string |
72b3a70c | 38 | * to indicate this entire api entity is deprecated |
a14e9d08 CW |
39 | */ |
40 | function _civicrm_api3_survey_respondant_deprecation() { | |
41 | return 'The survey_respondant api is not currently supported.'; | |
42 | } | |
43 | ||
6a488035 TO |
44 | /** |
45 | * Get the list of signatories | |
c23f45d3 | 46 | * @deprecated - api currently not supported |
cf470720 TO |
47 | * @param array $params |
48 | * (reference ) input parameters. | |
6a488035 | 49 | * |
a6c01b45 | 50 | * @return array |
c23f45d3 | 51 | * contribution_id of created or updated record |
6a488035 TO |
52 | */ |
53 | function civicrm_api3_survey_respondant_get(&$params) { | |
54 | ||
55 | civicrm_api3_verify_one_mandatory($params, NULL, array('survey_id', 'id')); | |
56 | ||
57 | if (array_key_exists('survey_id', $params)) { | |
58 | $surveyID = $params['survey_id']; | |
59 | } | |
60 | else { | |
61 | $surveyID = $params['id']; | |
62 | } | |
63 | ||
64 | $interviewerID = NULL; | |
65 | if (array_key_exists('interviewer_id', $params)) { | |
66 | $interviewerID = $params['interviewer_id']; | |
35671d00 | 67 | } |
6a488035 TO |
68 | |
69 | $statusIds = array(); | |
70 | if (array_key_exists('status_id', $params)) { | |
71 | $statusIds = explode(',', $params['status_id']); | |
72 | } | |
73 | ||
74 | $respondants = CRM_Campaign_BAO_Survey::getSurveyActivities($surveyID, $interviewerID, $statusIds); | |
75 | ||
76 | return (civicrm_api3_create_success($respondants, $params)); | |
77 | } | |
78 | ||
11e09c59 | 79 | /** |
6a488035 | 80 | * @deprecated - api currently not supported |
d0997921 | 81 | * @param array $params |
645ee340 | 82 | * @return array |
6a488035 TO |
83 | */ |
84 | function &civicrm_api3_survey_respondant_count($params) { | |
85 | ||
86 | $petition = new CRM_Campaign_BAO_Petition(); | |
87 | if (array_key_exists('groupby', $params) && | |
88 | $params['groupby'] == 'country' | |
89 | ) { | |
90 | $signaturesCount = $petition->getPetitionSignatureTotalbyCountry($params['survey_id']); | |
91 | } | |
92 | else { | |
93 | $signaturesCount = $petition->getPetitionSignatureTotal($params['survey_id']); | |
94 | } | |
95 | return ($signaturesCount); | |
96 | } |