本文整理汇总了PHP中CRM_Campaign_BAO_Campaign::getCampaignSummary方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Campaign_BAO_Campaign::getCampaignSummary方法的具体用法?PHP CRM_Campaign_BAO_Campaign::getCampaignSummary怎么用?PHP CRM_Campaign_BAO_Campaign::getCampaignSummary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Campaign_BAO_Campaign
的用法示例。
在下文中一共展示了CRM_Campaign_BAO_Campaign::getCampaignSummary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
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'));
}
示例2: browse
function browse()
{
$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']));
}
}
$this->assign('campaigns', $campaigns);
$this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add'));
}
示例3: campaignList
/**
* This function uses the deprecated v1 datatable api and needs updating. See CRM-16353.
* @deprecated
*/
public function campaignList()
{
//get the search criteria params.
$searchCriteria = CRM_Utils_Request::retrieve('searchCriteria', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'POST');
$searchParams = explode(',', $searchCriteria);
$params = $searchRows = array();
foreach ($searchParams as $param) {
if (isset($_POST[$param])) {
$params[$param] = $_POST[$param];
}
}
//this is sequence columns on datatable.
$selectorCols = array('id', 'name', 'title', 'description', 'start_date', 'end_date', 'campaign_type_id', 'campaign_type', 'status_id', 'status', 'is_active', 'isActive', 'action');
// get the data table params.
$dataTableParams = array('sEcho' => array('name' => 'sEcho', 'type' => 'Integer', 'default' => 0), 'offset' => array('name' => 'iDisplayStart', 'type' => 'Integer', 'default' => 0), 'rowCount' => array('name' => 'iDisplayLength', 'type' => 'Integer', 'default' => 25), 'sort' => array('name' => 'iSortCol_0', 'type' => 'Integer', 'default' => 'start_date'), 'sortOrder' => array('name' => 'sSortDir_0', 'type' => 'String', 'default' => 'desc'));
foreach ($dataTableParams as $pName => $pValues) {
${$pName} = $pValues['default'];
if (!empty($_POST[$pValues['name']])) {
${$pName} = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']);
if ($pName == 'sort') {
${$pName} = $selectorCols[${$pName}];
}
}
}
foreach (array('sort', 'offset', 'rowCount', 'sortOrder') as $sortParam) {
$params[$sortParam] = ${$sortParam};
}
$searchCount = CRM_Campaign_BAO_Campaign::getCampaignSummary($params, TRUE);
$campaigns = CRM_Campaign_Page_DashBoard::getCampaignSummary($params);
$iTotal = $searchCount;
if ($searchCount > 0) {
if ($searchCount < $offset) {
$offset = 0;
}
foreach ($campaigns as $campaignID => $values) {
foreach ($selectorCols as $col) {
$searchRows[$campaignID][$col] = CRM_Utils_Array::value($col, $values);
}
}
}
$selectorElements = $selectorCols;
$iFilteredTotal = $iTotal;
CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
示例4: getCampaignSummary
/**
* @param array $params
*
* @return array
*/
public static function getCampaignSummary($params = array())
{
$campaignsData = array();
//get the campaigns.
$campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary($params);
if (!empty($campaigns)) {
$config = CRM_Core_Config::singleton();
$campaignType = CRM_Campaign_PseudoConstant::campaignType();
$campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus();
$properties = array('id', 'name', 'title', 'status_id', 'description', 'campaign_type_id', 'is_active', 'start_date', 'end_date');
foreach ($campaigns as $cmpid => $campaign) {
foreach ($properties as $prop) {
$campaignsData[$cmpid][$prop] = CRM_Utils_Array::value($prop, $campaign);
}
$statusId = CRM_Utils_Array::value('status_id', $campaign);
$campaignsData[$cmpid]['status'] = CRM_Utils_Array::value($statusId, $campaignStatus);
$campaignsData[$cmpid]['campaign_id'] = $campaign['id'];
$campaignsData[$cmpid]['campaign_type'] = $campaignType[$campaign['campaign_type_id']];
$action = array_sum(array_keys(self::campaignActionLinks()));
if ($campaign['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$isActive = ts('No');
if ($campaignsData[$cmpid]['is_active']) {
$isActive = ts('Yes');
}
$campaignsData[$cmpid]['isActive'] = $isActive;
if (!empty($campaignsData[$cmpid]['start_date'])) {
$campaignsData[$cmpid]['start_date'] = CRM_Utils_Date::customFormat($campaignsData[$cmpid]['start_date'], $config->dateformatFull);
}
if (!empty($campaignsData[$cmpid]['end_date'])) {
$campaignsData[$cmpid]['end_date'] = CRM_Utils_Date::customFormat($campaignsData[$cmpid]['end_date'], $config->dateformatFull);
}
$campaignsData[$cmpid]['action'] = CRM_Core_Action::formLink(self::campaignActionLinks(), $action, array('id' => $campaign['id']), ts('more'), FALSE, 'campaign.dashboard.row', 'Campaign', $campaign['id']);
}
}
return $campaignsData;
}