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