function browse() { CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); $campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary(); if (!empty($campaigns)) { $campaignType = CRM_Core_PseudoConstant::campaignType(); $campaignStatus = CRM_Core_PseudoConstant::campaignStatus(); foreach ($campaigns as $cmpid => $campaign) { $campaigns[$cmpid]['campaign_id'] = $campaign['id']; $campaigns[$cmpid]['title'] = $campaign['title']; $campaigns[$cmpid]['name'] = $campaign['name']; $campaigns[$cmpid]['description'] = $campaign['description']; $campaigns[$cmpid]['campaign_type_id'] = $campaignType[$campaign['campaign_type_id']]; $campaigns[$cmpid]['status_id'] = $campaignStatus[$campaign['status_id']]; $action = array_sum(array_keys($this->actionLinks())); if ($campaign['is_active']) { $action -= CRM_Core_Action::ENABLE; } else { $action -= CRM_Core_Action::DISABLE; } $campaigns[$cmpid]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $campaign['id']), ts('more'), FALSE, 'campaign.selector.row', 'Campaign', $campaign['id']); } } $this->assign('campaigns', $campaigns); $this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add')); }
function browse() { require_once 'CRM/Core/Permission.php'; $campaigns = CRM_Campaign_BAO_Campaign::getCampaign(true); if (!empty($campaigns)) { require_once 'CRM/Campaign/BAO/Campaign.php'; $campaignType = CRM_Core_PseudoConstant::campaignType(); $campaignStatus = CRM_Core_PseudoConstant::campaignStatus(); foreach ($campaigns as $cmpid => $campaign) { $campaigns[$cmpid]['campaign_id'] = $campaign['id']; $campaigns[$cmpid]['title'] = $campaign['title']; $campaigns[$cmpid]['name'] = $campaign['name']; $campaigns[$cmpid]['description'] = $campaign['description']; $campaigns[$cmpid]['campaign_type_id'] = $campaignType[$campaign['campaign_type_id']]; $campaigns[$cmpid]['status_id'] = $campaignStatus[$campaign['status_id']]; $action = array_sum(array_keys($this->actionLinks())); if ($campaign['is_active']) { $action -= CRM_Core_Action::ENABLE; } else { $action -= CRM_Core_Action::DISABLE; } $campaigns[$cmpid]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $campaign['id'])); } } $this->assign('campaigns', $campaigns); $this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add')); }