本文整理汇总了PHP中CRM_Campaign_PseudoConstant::campaignStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Campaign_PseudoConstant::campaignStatus方法的具体用法?PHP CRM_Campaign_PseudoConstant::campaignStatus怎么用?PHP CRM_Campaign_PseudoConstant::campaignStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Campaign_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Campaign_PseudoConstant::campaignStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
if ($this->_search) {
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign');
$this->add('text', 'campaign_title', ts('Title'), $attributes['title']);
//campaign description.
$this->add('text', 'description', ts('Description'), $attributes['description']);
//campaign start date.
$this->addDate('start_date', ts('From'), FALSE, array('formatType' => 'searchDate'));
//campaign end date.
$this->addDate('end_date', ts('To'), FALSE, array('formatType' => 'searchDate'));
//campaign type.
$campaignTypes = CRM_Campaign_PseudoConstant::campaignType();
$this->add('select', 'campaign_type_id', ts('Campaign Type'), array('' => ts('- select -')) + $campaignTypes);
$this->set('campaignTypes', $campaignTypes);
$this->assign('campaignTypes', json_encode($campaignTypes));
//campaign status
$campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus();
$this->addElement('select', 'status_id', ts('Campaign Status'), array('' => ts('- select -')) + $campaignStatus);
$this->set('campaignStatus', $campaignStatus);
$this->assign('campaignStatus', json_encode($campaignStatus));
//active campaigns
$this->addElement('select', 'is_active', ts('Is Active?'), array('' => ts('- select -'), '0' => ts('Yes'), '1' => ts('No')));
//build the array of all search params.
$this->_searchParams = array();
foreach ($this->_elements as $element) {
$name = $element->_attributes['name'];
$label = $element->_label;
if ($name == 'qfKey') {
continue;
}
$this->_searchParams[$name] = $label ? $label : $name;
}
$this->set('searchParams', $this->_searchParams);
$this->assign('searchParams', json_encode($this->_searchParams));
}
示例2: 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;
}
示例3: asort
/**
* DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
* Get all campaign status.
*
* The static array campaignStatus is returned
*
*
* @return array
* array reference of all campaign status.
*/
public static function &campaignStatus()
{
if (!self::$campaignStatus) {
self::$campaignStatus = CRM_Core_OptionGroup::values('campaign_status');
}
asort(self::$campaignStatus);
return self::$campaignStatus;
}
示例4: buildQuickForm
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$this->applyFilter('__ALL__', 'trim');
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//campaign types.
$campaignTypes = CRM_Campaign_PseudoConstant::campaignType();
//lets assign custom data type and subtype.
$this->assign('customDataType', 'Campaign');
$this->assign('entityID', $this->_campaignId);
$this->assign('customDataSubType', CRM_Utils_Array::value('campaign_type_id', $this->_values));
$attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign');
// add comaign title.
$this->add('text', 'title', ts('Title'), $attributes['title'], TRUE);
// add description
$this->add('textarea', 'description', ts('Description'), $attributes['description']);
// add campaign start date
$this->addDateTime('start_date', ts('Start Date'), TRUE, array('formatType' => 'activityDateTime'));
// add campaign end date
$this->addDateTime('end_date', ts('End Date'), FALSE, array('formatType' => 'activityDateTime'));
// add campaign type
$this->add('select', 'campaign_type_id', ts('Campaign Type'), array('' => ts('- select -')) + $campaignTypes, TRUE, array('onChange' => "buildCustomData( 'Campaign', this.value );"));
// add campaign status
$campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus();
$this->addElement('select', 'status_id', ts('Campaign Status'), array('' => ts('- select -')) + $campaignStatus);
// add External Identifire Element
$this->add('text', 'external_identifier', ts('External Id'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign', 'external_identifier'), FALSE);
// add Campaign Parent Id
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('parent_id', $this->_values), $this->_campaignId);
if (!empty($campaigns)) {
$this->addElement('select', 'parent_id', ts('Parent Id'), array('' => ts('- select Parent -')) + $campaigns);
}
//get the campaign groups.
$groups = CRM_Core_PseudoConstant::group('Campaign');
$inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$this->addWysiwyg('goal_general', ts('Campaign Goals'), array('rows' => 2, 'cols' => 40));
$this->add('text', 'goal_revenue', ts('Revenue Goal'), array('size' => 8, 'maxlength' => 12));
$this->addRule('goal_revenue', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// is this Campaign active
$this->addElement('checkbox', 'is_active', ts('Is Active?'));
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'upload', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例5:
/**
* Get all campaign status.
*
* The static array campaignStatus is returned
*
* @access public
* @static
* @return array - array reference of all campaign status.
*
*/
public static function &campaignStatus()
{
if (!self::$campaignStatus) {
require_once 'CRM/Core/OptionGroup.php';
self::$campaignStatus = CRM_Core_OptionGroup::values('campaign_status');
}
return self::$campaignStatus;
}
示例6: buildQuickForm
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$this->applyFilter('__ALL__', 'trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign');
// add comaign title.
$this->add('text', 'title', ts('Title'), $attributes['title'], true);
// add description
$this->add('textarea', 'description', ts('Description'), $attributes['description']);
// add campaign start date
$this->addDateTime('start_date', ts('Start Date'), true, array('formatType' => 'activityDateTime'));
// add campaign end date
$this->addDateTime('end_date', ts('End Date'), false, array('formatType' => 'activityDateTime'));
// add campaign type
$campaignType = CRM_Campaign_PseudoConstant::campaignType();
$this->add('select', 'campaign_type_id', ts('Campaign Type'), array('' => ts('- select -')) + $campaignType, true);
// add campaign status
$campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus();
$this->addElement('select', 'status_id', ts('Campaign Status'), array('' => ts('- select -')) + $campaignStatus);
// add External Identifire Element
$this->add('text', 'external_identifier', ts('External Id'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign', 'external_identifier'), false);
// add Campaign Parent Id
require_once 'CRM/Campaign/BAO/Campaign.php';
$campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign($this->_campaignId);
if ($campaigns) {
$this->addElement('select', 'parent_id', ts('Parent Id'), array('' => ts('- select Parent -')) + $campaigns);
}
//get the campaign groups.
$groups = CRM_Core_PseudoConstant::group('Campaign');
$inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
// is this Campaign active
$this->addElement('checkbox', 'is_active', ts('Is Active?'));
if ($this->_context == 'dialog') {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "cj('#campaign-dialog').dialog('close'); return false;"))));
} else {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
}
示例7: browseCampaign
function browseCampaign()
{
$campaignsData = array();
//get the campaigns.
$campaigns = CRM_Campaign_BAO_Campaign::getCampaign(true);
if (!empty($campaigns)) {
$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($this->campaignActionLinks()));
if ($campaign['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$campaignsData[$cmpid]['action'] = CRM_Core_Action::formLink(self::campaignActionLinks(), $action, array('id' => $campaign['id']));
}
}
$this->assign('campaigns', $campaignsData);
$this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add'));
}