* $Id$
*
*/
-Class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
+class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
/**
* Takes an associative array and creates a campaign object
*/
public static function getCampaigns(
$includeId = NULL,
- $excludeId = NULL,
- $onlyActive = TRUE,
- $onlyCurrent = TRUE,
+ $excludeId = NULL,
+ $onlyActive = TRUE,
+ $onlyCurrent = TRUE,
$appendDatesToTitle = FALSE,
- $forceAll = FALSE
+ $forceAll = FALSE
) {
static $campaigns;
$cacheKey = 0;
* w/ permissions and component check.
*
*/
- public static function getPermissionedCampaigns($includeId = NULL,
+ public static function getPermissionedCampaigns(
+ $includeId = NULL,
$excludeId = NULL,
$onlyActive = TRUE,
$onlyCurrent = TRUE,
static $validCampaigns;
if (!isset($validCampaigns[$cacheKey])) {
$isValid = TRUE;
- $campaigns = array('campaigns' => array(),
+ $campaigns = array(
+ 'campaigns' => array(),
'hasAccessCampaign' => FALSE,
'isCampaignEnabled' => FALSE,
);
}
}
-
//need to lookup tables.
$orderOnCampaignTable = TRUE;
if ($sortParams['sort'] == 'status') {
//in case of only count.
if ($onlyCount) {
- return (int)CRM_Core_DAO::singleValueQuery($query, $queryParams);
+ return (int) CRM_Core_DAO::singleValueQuery($query, $queryParams);
}
$campaign = CRM_Core_DAO::executeQuery($query, $queryParams);
* @static
*/
public static function getCampaignCount() {
- return (int)CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_campaign');
+ return (int) CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_campaign');
}
/**
$campaignDetails = self::getPermissionedCampaigns($connectedCampaignId, NULL, TRUE, TRUE, $appendDates);
$fields = array('campaigns', 'hasAccessCampaign', 'isCampaignEnabled');
- foreach ($fields as $fld)$$fld = CRM_Utils_Array::value($fld, $campaignDetails);
+ foreach ($fields as $fld) {
+ $$fld = CRM_Utils_Array::value($fld, $campaignDetails);
+ }
//lets see do we have past campaigns.
$hasPastCampaigns = FALSE;
'includePastCampaignURL',
'alreadyIncludedPastCampaigns',
);
- foreach ($infoFields as $fld) $campaignInfo[$fld] = $$fld;
+ foreach ($infoFields as $fld) {
+ $campaignInfo[$fld] = $$fld;
+ }
$form->assign('campaignInfo', $campaignInfo);
}
$campaignInfo = array();
$campaignDetails = self::getPermissionedCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
$fields = array('campaigns', 'hasAccessCampaign', 'isCampaignEnabled');
- foreach ($fields as $fld)$$fld = CRM_Utils_Array::value($fld, $campaignDetails);
+ foreach ($fields as $fld) {
+ $$fld = CRM_Utils_Array::value($fld, $campaignDetails);
+ }
$showCampaignInSearch = FALSE;
if ($isCampaignEnabled && $hasAccessCampaign && !empty($campaigns)) {
//get the current campaign only.
'isCampaignEnabled',
'showCampaignInSearch',
);
- foreach ($infoFields as $fld) $campaignInfo[$fld] = $$fld;
+ foreach ($infoFields as $fld) {
+ $campaignInfo[$fld] = $$fld;
+ }
$form->assign('campaignInfo', $campaignInfo);
}
}
}
}
-
//get survey clause in force,
//only when we have survey id.
if (!self::$_applySurveyClause) {
*
* @return array|null
*/
- static function defaultReturnProperties($mode,
+ static function defaultReturnProperties(
+ $mode,
$includeCustomFields = TRUE
) {
$properties = NULL;
/**
* @param $tables
*/
- public static function tableNames(&$tables) {}
+ public static function tableNames(&$tables) {
+ }
/**
* @param $row
* @param int $id
*/
- public static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {
+ }
/**
* @param $tables
foreach (array(
'current_campaign', 'past_campaign') as $ignore) {
$index = array_search($ignore, $campaign);
- if ($index !== FALSE)unset($campaign[$index]);
+ if ($index !== FALSE) { unset($campaign[$index]);
+ }
}
}
*/
public static function create(&$params) {
if (empty($params)) {
- return false;
+ return FALSE;
}
if (!empty($params['is_default'])) {
//return only count.
if ($onlyCount) {
- return (int)CRM_Core_DAO::singleValueQuery($query, $queryParams);
+ return (int) CRM_Core_DAO::singleValueQuery($query, $queryParams);
}
$surveys = array();
* @static
*/
public static function getSurveyCount() {
- return (int)CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_survey');
+ return (int) CRM_Core_DAO::singleValueQuery('SELECT COUNT(*) FROM civicrm_survey');
}
/**
*
* @static
*/
- public static function getSurveys($onlyActive = TRUE, $onlyDefault = FALSE, $forceAll = FALSE, $includePetition = FALSE ) {
+ public static function getSurveys($onlyActive = TRUE, $onlyDefault = FALSE, $forceAll = FALSE, $includePetition = FALSE) {
$cacheKey = 0;
$cacheKeyParams = array('onlyActive', 'onlyDefault', 'forceAll', 'includePetition');
foreach ($cacheKeyParams as $param) {
*
* @static
*/
- static function getSurveyActivityType($returnColumn = 'label',
+ static function getSurveyActivityType(
+ $returnColumn = 'label',
$includePetitionActivityType = FALSE
) {
static $activityTypes;
foreach ($returnProperties as $property => $ignore) {
$voterDetails[$contact->contactId][$property] = $contact->$property;
}
- $image = CRM_Contact_BAO_Contact_Utils::getImage($contact->contact_sub_type ?
- $contact->contact_sub_type : $contact->contact_type,
+ $image = CRM_Contact_BAO_Contact_Utils::getImage($contact->contact_sub_type ? $contact->contact_sub_type : $contact->contact_type,
FALSE,
$contact->contactId
);
*
* @return array $activityDetails array of survey activity.@static
*/
- static function voterActivityDetails($surveyId, $voterIds, $interviewerId = NULL,
+ static function voterActivityDetails(
+ $surveyId, $voterIds, $interviewerId = NULL,
$statusIds = array()) {
$activityDetails = array();
if (!$surveyId ||
* @param bool $onlyCount
* @return array $activities an array of survey activity.@static
*/
- static function getSurveyActivities($surveyId,
+ static function getSurveyActivities(
+ $surveyId,
$interviewerId = NULL,
- $statusIds = NULL,
- $voterIds = NULL,
- $onlyCount = FALSE
+ $statusIds = NULL,
+ $voterIds = NULL,
+ $onlyCount = FALSE
) {
$activities = array();
$surveyActivityCount = 0;
AND ( activity.is_deleted IS NULL OR activity.is_deleted = 0 )
$whereClause";
- $params = array(1 => array($surveyId, 'Integer'),
+ $params = array(
+ 1 => array($surveyId, 'Integer'),
2 => array($actTypeId, 'Integer'),
);
* @return array $$contactIds survey related contact ids.
* @static
*/
- public static function getSurveyVoterInfo($surveyId, $interviewerId = NULL, $statusIds = array( )) {
+ public static function getSurveyVoterInfo($surveyId, $interviewerId = NULL, $statusIds = array()) {
$voterIds = array();
if (!$surveyId) {
return $voterIds;
* @param string $valueColumnName
* @return array $resultSets an array of option groups.@static
*/
- public static function getResultSets( $valueColumnName = 'title' ) {
+ public static function getResultSets($valueColumnName = 'title') {
$resultSets = array();
$valueColumnName = CRM_Utils_Type::escape($valueColumnName, 'String');
if (!array_key_exists($surveyId, $reportIds)) {
$query = "SELECT MAX(id) as id FROM civicrm_report_instance WHERE name = %1";
- $reportID = CRM_Core_DAO::singleValueQuery($query, array(1 => array("survey_{$surveyId}",'String')));
+ $reportID = CRM_Core_DAO::singleValueQuery($query, array(1 => array("survey_{$surveyId}", 'String')));
$reportIds[$surveyId] = $reportID;
}
return $reportIds[$surveyId];
if (!isset($profileTypes)) {
$profileTypes = array_merge(array('Activity', 'Contact'), CRM_Contact_BAO_ContactType::basicTypes());
- $profileTypes = array_diff($profileTypes, array('Organization','Household'));
+ $profileTypes = array_diff($profileTypes, array('Organization', 'Household'));
}
return $profileTypes;
$statusIds
);
$this->_contactIds = array();
- foreach ($surveyActivities as $val) { $this->_contactIds[$val['voter_id']] = $val['voter_id'];
+ foreach ($surveyActivities as $val) {
+ $this->_contactIds[$val['voter_id']] = $val['voter_id'];
}
$this->set('contactIds', $this->_contactIds);
}
$groups = CRM_Utils_Array::value('group', $params);
if ($campaignId && CRM_Utils_System::isNull($groups)) {
$campaignGroups = CRM_Campaign_BAO_Campaign::getCampaignGroups($campaignId);
- foreach ($campaignGroups as $id => $group) { $params['group'][$id] = 1;
+ foreach ($campaignGroups as $id => $group) {
+ $params['group'][$id] = 1;
}
}
$$pName = $pValues['default'];
if (!empty($_POST[$pValues['name']])) {
$$pName = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']);
- if ($pName == 'sort') { $$pName = $selectorCols[$$pName];
+ if ($pName == 'sort') {
+ $$pName = $selectorCols[$$pName];
}
}
}
* @return \CRM_Campaign_Selector_Search
@access public
*/
- function __construct(&$queryParams,
+ function __construct(
+ &$queryParams,
$action = CRM_Core_Action::NONE,
$surveyClause = NULL,
$single = FALSE,