projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '4.6' into 'master'
[civicrm-core.git]
/
CRM
/
Campaign
/
BAO
/
Survey.php
diff --git
a/CRM/Campaign/BAO/Survey.php
b/CRM/Campaign/BAO/Survey.php
index 888a96cc278e0969a0afc1926c2a51c7dbd5e2a5..45ecdd462b0a2b5895e37f43d15ef13dfb46e74b 100644
(file)
--- a/
CRM/Campaign/BAO/Survey.php
+++ b/
CRM/Campaign/BAO/Survey.php
@@
-3,7
+3,7
@@
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-201
4
|
+ | Copyright CiviCRM LLC (c) 2004-201
5
|
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@
-23,12
+23,12
@@
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+
*/
/**
*
* @package CRM
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-201
4
+ * @copyright CiviCRM LLC (c) 2004-201
5
* $Id$
*
*/
* $Id$
*
*/
@@
-40,21
+40,14
@@
require_once 'CRM/Campaign/DAO/Survey.php';
class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey {
/**
class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey {
/**
- *
Takes a bunch of params that are needed to match certain criteria and
- *
retrieves the relevant objects. Typically the valid params are only
- *
campaign_id
.
+ *
Retrieve DB object based on input parameters.
+ *
+ *
It also stores all the retrieved values in the default array
.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
- */
-
- /**
- * The action links that we need to display for the browse screen
- *
- * @param array $params
- * @param $defaults
*
* @return CRM_Campaign_DAO_Survey|null
*/
*
* @return CRM_Campaign_DAO_Survey|null
*/
@@
-71,7
+64,7
@@
class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey {
}
/**
}
/**
- * Takes an associative array and creates a Survey object
+ * Takes an associative array and creates a Survey object
.
*
* the function extract all the params it needs to initialize the create a
* survey object.
*
* the function extract all the params it needs to initialize the create a
* survey object.
@@
-79,8
+72,7
@@
class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey {
*
* @param array $params
*
*
* @param array $params
*
- * @return CRM_Survey_DAO_Survey object
- * @static
+ * @return CRM_Survey_DAO_Survey
*/
public static function create(&$params) {
if (empty($params)) {
*/
public static function create(&$params) {
if (empty($params)) {
@@
-118,7
+110,6
@@
class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey {
/**
* Retrieve surveys for dashboard.
*
/**
* Retrieve surveys for dashboard.
*
- * @static
*/
public static function getSurveySummary($params = array(), $onlyCount = FALSE) {
//build the limit and order clause.
*/
public static function getSurveySummary($params = array(), $onlyCount = FALSE) {
//build the limit and order clause.
@@
-242,14
+233,13
@@
SELECT survey.id as id,
/**
* Get the survey count.
*
/**
* Get the survey count.
*
- * @static
*/
public static function getSurveyCount() {
return (int) CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_survey');
}
/**
*/
public static function getSurveyCount() {
return (int) CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_survey');
}
/**
- * Get Surveys
+ * Get Surveys
.
*
* @param bool $onlyActive
* Retrieve only active surveys.
*
* @param bool $onlyActive
* Retrieve only active surveys.
@@
-260,7
+250,6
@@
SELECT survey.id as id,
* @param bool $includePetition
* Include or exclude petitions.
*
* @param bool $includePetition
* Include or exclude petitions.
*
- * @static
*/
public static function getSurveys($onlyActive = TRUE, $onlyDefault = FALSE, $forceAll = FALSE, $includePetition = FALSE) {
$cacheKey = 0;
*/
public static function getSurveys($onlyActive = TRUE, $onlyDefault = FALSE, $forceAll = FALSE, $includePetition = FALSE) {
$cacheKey = 0;
@@
-310,15
+299,9
@@
SELECT survey.id as id,
}
/**
}
/**
- * Get Surveys activity types
- *
- *
- * @static
+ * Get Survey activity types.
*/
*/
- static function getSurveyActivityType(
- $returnColumn = 'label',
- $includePetitionActivityType = FALSE
- ) {
+ public static function getSurveyActivityType($returnColumn = 'label', $includePetitionActivityType = FALSE) {
static $activityTypes;
$cacheKey = "{$returnColumn}_{$includePetitionActivityType}";
static $activityTypes;
$cacheKey = "{$returnColumn}_{$includePetitionActivityType}";
@@
-346,13
+329,12
@@
SELECT survey.id as id,
}
/**
}
/**
- * Get Surveys custom groups
+ * Get Surveys custom groups
.
*
* @param array $surveyTypes
* an array of survey type id.
*
* @return array
*
* @param array $surveyTypes
* an array of survey type id.
*
* @return array
- * @static
*/
public static function getSurveyCustomGroups($surveyTypes = array()) {
$customGroups = array();
*/
public static function getSurveyCustomGroups($surveyTypes = array()) {
$customGroups = array();
@@
-387,7
+369,7
@@
SELECT survey.id as id,
}
/**
}
/**
- * Update the is_active flag in the db
+ * Update the is_active flag in the db
.
*
* @param int $id
* Id of the database record.
*
* @param int $id
* Id of the database record.
@@
-395,21
+377,19
@@
SELECT survey.id as id,
* Value we want to set the is_active field.
*
* @return Object
* Value we want to set the is_active field.
*
* @return Object
- * DAO object on sucess, null otherwise
- * @static
+ * DAO object on success, null otherwise
*/
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Campaign_DAO_Survey', $id, 'is_active', $is_active);
}
/**
*/
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Campaign_DAO_Survey', $id, 'is_active', $is_active);
}
/**
- * Delete the survey
+ * Delete the survey
.
*
* @param int $id
* Survey id.
*
* @return mixed|null
*
* @param int $id
* Survey id.
*
* @return mixed|null
- * @static
*/
public static function del($id) {
if (!$id) {
*/
public static function del($id) {
if (!$id) {
@@
-433,7
+413,6
@@
SELECT survey.id as id,
*
* @return array
* array of contact info.
*
* @return array
* array of contact info.
- * @static
*/
public static function voterDetails($voterIds, $returnProperties = array()) {
$voterDetails = array();
*/
public static function voterDetails($voterIds, $returnProperties = array()) {
$voterDetails = array();
@@
-458,7
+437,7
@@
SELECT survey.id as id,
foreach ($returnProperties as $property => $ignore) {
$value = (in_array($property, array(
'city',
foreach ($returnProperties as $property => $ignore) {
$value = (in_array($property, array(
'city',
- 'street_address'
+ 'street_address'
,
))) ? 'address' : $property;
switch ($property) {
case 'sort_name':
))) ? 'address' : $property;
switch ($property) {
case 'sort_name':
@@
-530,11
+509,8
@@
Group By contact.id";
*
* @return array
* array of survey activity.
*
* @return array
* array of survey activity.
- * @static
*/
*/
- static function voterActivityDetails(
- $surveyId, $voterIds, $interviewerId = NULL,
- $statusIds = array()) {
+ public static function voterActivityDetails($surveyId, $voterIds, $interviewerId = NULL, $statusIds = array()) {
$activityDetails = array();
if (!$surveyId ||
!is_array($voterIds) || empty($voterIds)
$activityDetails = array();
if (!$surveyId ||
!is_array($voterIds) || empty($voterIds)
@@
-594,9
+570,8
@@
INNER JOIN civicrm_activity_contact activityAssignment
*
* @return array
* An array of survey activity.
*
* @return array
* An array of survey activity.
- * @static
*/
*/
- static function getSurveyActivities(
+
public
static function getSurveyActivities(
$surveyId,
$interviewerId = NULL,
$statusIds = NULL,
$surveyId,
$interviewerId = NULL,
$statusIds = NULL,
@@
-701,7
+676,6
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
*
* @return array
* Survey related contact ids.
*
* @return array
* Survey related contact ids.
- * @static
*/
public static function getSurveyVoterInfo($surveyId, $interviewerId = NULL, $statusIds = array()) {
$voterIds = array();
*/
public static function getSurveyVoterInfo($surveyId, $interviewerId = NULL, $statusIds = array()) {
$voterIds = array();
@@
-730,12
+704,11
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
}
/**
}
/**
- * This function retrieve all option groups which are created as a result set
+ * This function retrieve all option groups which are created as a result set
.
*
* @param string $valueColumnName
* @return array
* an array of option groups.
*
* @param string $valueColumnName
* @return array
* an array of option groups.
- * @static
*/
public static function getResultSets($valueColumnName = 'title') {
$resultSets = array();
*/
public static function getResultSets($valueColumnName = 'title') {
$resultSets = array();
@@
-755,8
+728,7
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
*
* @param int $activityId
* Activity id.
*
* @param int $activityId
* Activity id.
- * @return boolean
- * @static
+ * @return bool
*/
public static function isSurveyActivity($activityId) {
$isSurveyActivity = FALSE;
*/
public static function isSurveyActivity($activityId) {
$isSurveyActivity = FALSE;
@@
-780,13
+752,12
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
}
/**
}
/**
- * This function retrive all response options of survey
+ * This function retrive all response options of survey
.
*
* @param int $surveyId
* Survey id.
* @return array
* an array of option values
*
* @param int $surveyId
* Survey id.
* @return array
* an array of option values
- * @static
*/
public static function getResponsesOptions($surveyId) {
$responseOptions = array();
*/
public static function getResponsesOptions($surveyId) {
$responseOptions = array();
@@
-803,14
+774,13
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
}
/**
}
/**
- * This function return all voter links with respecting permissions
+ * This function return all voter links with respecting permissions
.
*
* @param int $surveyId
* @param bool $enclosedInUL
* @param string $extraULName
* @return array|string
* $url array of permissioned links
*
* @param int $surveyId
* @param bool $enclosedInUL
* @param string $extraULName
* @return array|string
* $url array of permissioned links
- * @static
*/
public static function buildPermissionLinks($surveyId, $enclosedInUL = FALSE, $extraULName = 'more') {
$menuLinks = array();
*/
public static function buildPermissionLinks($surveyId, $enclosedInUL = FALSE, $extraULName = 'more') {
$menuLinks = array();
@@
-856,13
+826,12
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
if (CRM_Core_Permission::check('access CiviReport')) {
$reportID = self::getReportID($surveyId);
if ($reportID) {
if (CRM_Core_Permission::check('access CiviReport')) {
$reportID = self::getReportID($surveyId);
if ($reportID) {
- $voterLinks['report'] =
- array(
- 'name' => 'report',
- 'url' => "civicrm/report/instance/{$reportID}",
- 'qs' => 'reset=1',
- 'title' => ts('View Survey Report'),
- );
+ $voterLinks['report'] = array(
+ 'name' => 'report',
+ 'url' => "civicrm/report/instance/{$reportID}",
+ 'qs' => 'reset=1',
+ 'title' => ts('View Survey Report'),
+ );
}
}
}
}
@@
-957,7
+926,7
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
}
/**
}
/**
- * Get survey supportable profile types
+ * Get survey supportable profile types
.
*/
public static function surveyProfileTypes() {
static $profileTypes;
*/
public static function surveyProfileTypes() {
static $profileTypes;
@@
-971,7
+940,7
@@
INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
}
/**
}
/**
- * Get the valid survey response fields those
+ * Get the valid survey response fields those
.
* are configured with profile and custom fields.
*
* @param int $surveyId
* are configured with profile and custom fields.
*
* @param int $surveyId
@@
-1163,10
+1132,11
@@
UPDATE civicrm_activity
case 'activity_type_id':
$campaignCompId = CRM_Core_Component::getComponentID('CiviCampaign');
if ($campaignCompId) {
case 'activity_type_id':
$campaignCompId = CRM_Core_Component::getComponentID('CiviCampaign');
if ($campaignCompId) {
- $params['condition'] = array("component_id={$campaignCompId}"
, "v.name != 'Petition'"
);
+ $params['condition'] = array("component_id={$campaignCompId}");
}
break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
}
break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
+
}
}