if (isset($params['groups']) && !empty($params['groups']['include']) && is_array($params['groups']['include'])) {
foreach ($params['groups']['include'] as $entityId) {
- $dao = new CRM_Campaign_DAO_CampaignGroup();
- $dao->campaign_id = $campaign->id;
+ $dao = new CRM_Campaign_DAO_CampaignGroup();
+ $dao->campaign_id = $campaign->id;
$dao->entity_table = $groupTableName;
- $dao->entity_id = $entityId;
- $dao->group_type = 'Include';
+ $dao->entity_id = $entityId;
+ $dao->group_type = 'Include';
$dao->save();
$dao->free();
}
* @param bool $appendDatesToTitle
* @param bool $forceAll
*
- * @return mixed $campaigns a set of campaigns.@access public
+ * @return mixed $campaigns a set of campaigns.
+ * @access public
*/
public static function getCampaigns(
$includeId = NULL,
static $campaigns;
$cacheKey = 0;
$cacheKeyParams = array(
- 'includeId', 'excludeId', 'onlyActive',
- 'onlyCurrent', 'appendDatesToTitle', 'forceAll',
+ 'includeId',
+ 'excludeId',
+ 'onlyActive',
+ 'onlyCurrent',
+ 'appendDatesToTitle',
+ 'forceAll',
);
foreach ($cacheKeyParams as $param) {
$cacheParam = $$param;
/**
* Wrapper to self::getCampaigns( )
* w/ permissions and component check.
- *
*/
public static function getPermissionedCampaigns(
$includeId = NULL,
) {
$cacheKey = 0;
$cachekeyParams = array(
- 'includeId', 'excludeId', 'onlyActive', 'onlyCurrent',
- 'appendDatesToTitle', 'doCheckForComponent', 'doCheckForPermissions', 'forceAll',
+ 'includeId',
+ 'excludeId',
+ 'onlyActive',
+ 'onlyCurrent',
+ 'appendDatesToTitle',
+ 'doCheckForComponent',
+ 'doCheckForPermissions',
+ 'forceAll',
);
foreach ($cachekeyParams as $param) {
$cacheKeyParam = $$param;
if (!isset($validCampaigns[$cacheKey])) {
$isValid = TRUE;
$campaigns = array(
- 'campaigns' => array(),
+ 'campaigns' => array(),
'hasAccessCampaign' => FALSE,
'isCampaignEnabled' => FALSE,
);
$queryParams[3] = array('%' . trim($params['title']) . '%', 'String');
}
if (!empty($params['start_date'])) {
- $startDate = CRM_Utils_Date::processDate($params['start_date']);
- $where[] = "( campaign.start_date >= %4 OR campaign.start_date IS NULL )";
+ $startDate = CRM_Utils_Date::processDate($params['start_date']);
+ $where[] = "( campaign.start_date >= %4 OR campaign.start_date IS NULL )";
$queryParams[4] = array($startDate, 'String');
}
if (!empty($params['end_date'])) {
- $endDate = CRM_Utils_Date::processDate($params['end_date'], '235959');
- $where[] = "( campaign.end_date <= %5 OR campaign.end_date IS NULL )";
+ $endDate = CRM_Utils_Date::processDate($params['end_date'], '235959');
+ $where[] = "( campaign.end_date <= %5 OR campaign.end_date IS NULL )";
$queryParams[5] = array($endDate, 'String');
}
if (!empty($params['description'])) {
* @param bool $is_active
* Value we want to set the is_active field.
*
- * @return Object DAO object on sucess, null otherwise
+ * @return Object
+ * DAO object on sucess, null otherwise
* @static
*/
public static function setIsActive($id, $is_active) {
/*
* Add select element for campaign
* and assign needful info to templates.
- *
*/
/**
* @param CRM_Core_Form $form
* @param string $elementName
*/
public static function addCampaignInComponentSearch(&$form, $elementName = 'campaign_id') {
- $campaignInfo = array();
+ $campaignInfo = array();
$campaignDetails = self::getPermissionedCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
- $fields = array('campaigns', 'hasAccessCampaign', 'isCampaignEnabled');
+ $fields = array('campaigns', 'hasAccessCampaign', 'isCampaignEnabled');
foreach ($fields as $fld) {
$$fld = CRM_Utils_Array::value($fld, $campaignDetails);
}
if ($isCampaignEnabled && $hasAccessCampaign && !empty($campaigns)) {
//get the current campaign only.
$currentCampaigns = self::getCampaigns(NULL, NULL, FALSE);
- $pastCampaigns = array_diff($campaigns, $currentCampaigns);
- $allCampaigns = array();
+ $pastCampaigns = array_diff($campaigns, $currentCampaigns);
+ $allCampaigns = array();
if (!empty($currentCampaigns)) {
$allCampaigns = array('crm_optgroup_current_campaign' => ts('Current Campaigns')) + $currentCampaigns;
}