本文整理汇总了PHP中CRM_Campaign_PseudoConstant类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Campaign_PseudoConstant类的具体用法?PHP CRM_Campaign_PseudoConstant怎么用?PHP CRM_Campaign_PseudoConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Campaign_PseudoConstant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor.
*/
public function __construct()
{
// There could be multiple contacts. We not clear on which contact id to display.
// Lets hide it for now.
$this->_exposeContactID = FALSE;
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
if ($campaignEnabled) {
$getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$this->activeCampaigns = $getCampaigns['campaigns'];
asort($this->activeCampaigns);
$this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
}
$this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'label', TRUE);
asort($this->activityTypes);
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_source' => array('name' => 'sort_name', 'title' => ts('Source Contact Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Contact Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target Contact Name'), 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.sort_name", 'default' => TRUE), 'contact_source_id' => array('name' => 'id', 'alias' => 'civicrm_contact_source', 'dbAlias' => "civicrm_contact_source.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_assignee_id' => array('name' => 'id', 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_target_id' => array('name' => 'id', 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'filters' => array('contact_source' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_source', 'title' => ts('Source Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'current_user' => array('name' => 'current_user', 'title' => ts('Limit To Current User'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('contact_source_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Contact Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Contact Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Activity ID'), 'required' => TRUE), 'source_record_id' => array('no_display' => TRUE, 'required' => TRUE), 'activity_type_id' => array('title' => ts('Activity Type'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_subject' => array('title' => ts('Subject'), 'default' => TRUE), 'activity_date_time' => array('title' => ts('Activity Date'), 'required' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => 'this.month', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT)), 'order_bys' => array('activity_date_time' => array('title' => ts('Activity Date'), 'default_weight' => '1', 'dbAlias' => 'civicrm_activity_activity_date_time'), 'activity_type_id' => array('title' => ts('Activity Type'), 'default_weight' => '2', 'dbAlias' => "option_value_civireport")), 'grouping' => 'activity-fields', 'alias' => 'activity'), 'civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array()), 'civicrm_option_value' => array('dao' => 'CRM_Core_DAO_OptionValue', 'fields' => array(), 'status_id' => array('title' => ts('Activity Status'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'location' => array('title' => ts('Location'), 'type' => CRM_Utils_Type::T_STRING), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => 'this.month', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'location' => array('title' => ts('Location'), 'type' => CRM_Utils_Type::T_TEXT), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT))) + $this->addressFields(TRUE);
if ($campaignEnabled) {
// Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
$this->_columns['civicrm_activity']['fields']['result'] = array('title' => 'Survey Result', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING);
if (!empty($this->activeCampaigns)) {
$this->_columns['civicrm_activity']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
}
if (!empty($this->engagementLevels)) {
$this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => 'Engagement Index', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
}
}
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
$this->_tagFilterTable = 'civicrm_activity';
parent::__construct();
}
示例2: __construct
/**
* Class constructor.
*/
public function __construct()
{
// There could be multiple contacts. We not clear on which contact id to display.
// Lets hide it for now.
$this->_exposeContactID = FALSE;
// if navigated from count link of activity summary reports.
$this->_resetDateFilter = CRM_Utils_Request::retrieve('resetDateFilter', 'Boolean', CRM_Core_DAO::$_nullObject);
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
$caseEnabled = in_array("CiviCase", $config->enableComponents);
if ($campaignEnabled) {
$getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$this->activeCampaigns = $getCampaigns['campaigns'];
asort($this->activeCampaigns);
$this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
}
$components = CRM_Core_Component::getEnabledComponents();
foreach ($components as $componentName => $componentInfo) {
// CRM-19201: Add support for reporting CiviCampaign activities
// For CiviCase, "access all cases and activities" is required here
// rather than "access my cases and activities" to prevent those with
// only the later permission from seeing a list of all cases which might
// present a privacy issue.
if (CRM_Core_Permission::access($componentName, TRUE, TRUE)) {
$accessAllowed[] = $componentInfo->componentID;
}
}
$include = '';
if (!empty($accessAllowed)) {
$include = 'OR v.component_id IN (' . implode(', ', $accessAllowed) . ')';
}
$condition = " AND ( v.component_id IS NULL {$include} )";
$this->activityTypes = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, $condition);
asort($this->activityTypes);
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_source' => array('name' => 'sort_name', 'title' => ts('Source Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target Name'), 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.sort_name", 'default' => TRUE), 'contact_source_id' => array('name' => 'id', 'alias' => 'civicrm_contact_source', 'dbAlias' => "civicrm_contact_source.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_assignee_id' => array('name' => 'id', 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_target_id' => array('name' => 'id', 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'filters' => array('contact_source' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_source', 'title' => ts('Source Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'current_user' => array('name' => 'current_user', 'title' => ts('Limit To Current User'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('contact_source_email' => array('name' => 'email', 'title' => ts('Source Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('contact_source_phone' => array('name' => 'phone', 'title' => ts('Source Phone'), 'alias' => 'civicrm_phone_source'), 'contact_assignee_phone' => array('name' => 'phone', 'title' => ts('Assignee Phone'), 'alias' => 'civicrm_phone_assignee'), 'contact_target_phone' => array('name' => 'phone', 'title' => ts('Target Phone'), 'alias' => 'civicrm_phone_target'))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Activity ID'), 'required' => TRUE), 'source_record_id' => array('no_display' => TRUE, 'required' => TRUE), 'activity_type_id' => array('title' => ts('Activity Type'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_subject' => array('title' => ts('Subject'), 'default' => TRUE), 'activity_date_time' => array('title' => ts('Activity Date'), 'required' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => 'this.month', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'type' => CRM_Utils_Type::T_STRING, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT)), 'order_bys' => array('activity_date_time' => array('title' => ts('Activity Date'), 'default_weight' => '1', 'dbAlias' => 'civicrm_activity_activity_date_time'), 'activity_type_id' => array('title' => ts('Activity Type'), 'default_weight' => '2', 'dbAlias' => 'field(civicrm_activity_activity_type_id, ' . implode(', ', array_keys($this->activityTypes)) . ')')), 'grouping' => 'activity-fields', 'alias' => 'activity'), 'civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array())) + $this->addressFields(TRUE);
if ($caseEnabled && CRM_Core_Permission::check('access all cases and activities')) {
$this->_columns['civicrm_activity']['filters']['include_case_activities'] = array('name' => 'include_case_activities', 'title' => ts('Include Case Activities'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')));
}
if ($campaignEnabled) {
// Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
$this->_columns['civicrm_activity']['fields']['result'] = array('title' => ts('Survey Result'), 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING);
if (!empty($this->activeCampaigns)) {
$this->_columns['civicrm_activity']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
}
if (!empty($this->engagementLevels)) {
$this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => ts('Engagement Index'), 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
}
}
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
$this->_tagFilterTable = 'civicrm_activity';
parent::__construct();
}
示例3: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
//get the activity values
$activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
//check for required permissions, CRM-6264
if ($activityId && !CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::VIEW)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$session = CRM_Core_Session::singleton();
if (!in_array($context, array('home', 'dashlet', 'dashletFullscreen'))) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
} else {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
}
$session->pushUserContext($url);
$defaults = array();
$params = array('id' => $activityId);
CRM_Activity_BAO_Activity::retrieve($params, $defaults);
//set activity type name and description to template
list($activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($defaults['activity_type_id']);
$this->assign('activityTypeName', $activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
if (!empty($defaults['mailingId'])) {
$this->_mailing_id = CRM_Utils_Array::value('source_record_id', $defaults);
$mailingReport = CRM_Mailing_BAO_Mailing::report($this->_mailing_id, TRUE);
CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this);
$this->assign('mailingReport', $mailingReport);
$full_open_report = CRM_Mailing_Event_BAO_Opened::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, $cid);
$this->assign('openreport', $full_open_report);
$click_thru_report = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, NULL, $cid);
$this->assign('clickreport', $click_thru_report);
}
foreach ($defaults as $key => $value) {
if (substr($key, -3) != '_id') {
$values[$key] = $value;
}
}
//get the campaign
if ($campaignId = CRM_Utils_Array::value('campaign_id', $defaults)) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
$values['campaign'] = $campaigns[$campaignId];
}
if ($engagementLevel = CRM_Utils_Array::value('engagement_level', $defaults)) {
$engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
$values['engagement_level'] = CRM_Utils_Array::value($engagementLevel, $engagementLevels, $engagementLevel);
}
$values['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityId);
$this->assign('values', $values);
}
示例4: 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));
}
示例5: from
/**
* @param string $name
* @param $mode
* @param $side
*
* @return null|string
*/
public static function from($name, $mode, $side)
{
$from = NULL;
//get survey clause in force,
//only when we have survey id.
if (!self::$_applySurveyClause) {
return $from;
}
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
switch ($name) {
case self::CIVICRM_ACTIVITY_TARGET:
$from = " INNER JOIN civicrm_activity_contact civicrm_activity_target\n ON ( civicrm_activity_target.contact_id = contact_a.id AND civicrm_activity_target.record_type_id = {$targetID}) ";
break;
case self::CIVICRM_ACTIVITY:
$surveyActivityTypes = CRM_Campaign_PseudoConstant::activityType();
$surveyKeys = "(" . implode(',', array_keys($surveyActivityTypes)) . ")";
$from = " INNER JOIN civicrm_activity ON ( civicrm_activity.id = civicrm_activity_target.activity_id\n AND civicrm_activity.activity_type_id IN {$surveyKeys} ) ";
break;
case self::CIVICRM_ACTIVITY_ASSIGNMENT:
$from = "\nINNER JOIN civicrm_activity_contact civicrm_activity_assignment ON ( civicrm_activity.id = civicrm_activity_assignment.activity_id AND\ncivicrm_activity_assignment.record_type_id = {$assigneeID} ) ";
break;
case 'civicrm_survey':
$from = " INNER JOIN civicrm_survey ON ( civicrm_survey.id = civicrm_activity.source_record_id ) ";
break;
case 'civicrm_campaign':
$from = " {$side} JOIN civicrm_campaign ON ( civicrm_campaign.id = civicrm_survey.campaign_id ) ";
break;
}
return $from;
}
示例6: buildSearchForm
/**
* add all the elements shared between case activity search and advanaced search
*
* @access public
*
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
$activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
asort($activityOptions);
foreach ($activityOptions as $activityID => $activity) {
$form->_activityElement =& $form->addElement('checkbox', "activity_type_id[{$activityID}]", NULL, $activity, array('onClick' => 'showCustomData( this.id );'));
}
CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
$activityRoles = array(3 => ts('With'), 2 => ts('Assigned to'), 1 => ts('Added by'));
$form->addRadio('activity_role', NULL, $activityRoles);
$form->setDefaults(array('activity_role' => 3));
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
foreach ($activityStatus as $activityStatusID => $activityStatusName) {
$activity_status[] = $form->createElement('checkbox', $activityStatusID, NULL, $activityStatusName);
}
$form->addGroup($activity_status, 'activity_status', ts('Activity Status'));
$form->setDefaults(array('activity_status[1]' => 1, 'activity_status[2]' => 1));
$form->addElement('text', 'activity_subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
$form->addYesNo('activity_test', ts('Activity is a Test?'));
$activity_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity');
if ($activity_tags) {
foreach ($activity_tags as $tagID => $tagName) {
$form->_tagElement =& $form->addElement('checkbox', "activity_tags[{$tagID}]", NULL, $tagName);
}
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity');
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_activity', NULL, TRUE, FALSE, TRUE);
$surveys = CRM_Campaign_BAO_Survey::getSurveys(TRUE, FALSE, FALSE, TRUE);
if ($surveys) {
$form->add('select', 'activity_survey_id', ts('Survey / Petition'), array('' => ts('- none -')) + $surveys, FALSE);
}
$extends = array('Activity');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('activityGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'activity_campaign_id');
//add engagement level CRM-7775
$buildEngagementLevel = FALSE;
$buildSurveyResult = FALSE;
if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$buildEngagementLevel = TRUE;
$form->add('select', 'activity_engagement_level', ts('Engagement Index'), array('' => ts('- any -')) + CRM_Campaign_PseudoConstant::engagementLevel());
// Add survey result field.
$optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name');
$resultOptions = array();
foreach ($optionGroups as $gid => $name) {
if ($name) {
$value = array();
$value = CRM_Core_OptionGroup::values($name);
if (!empty($value)) {
while (list($k, $v) = each($value)) {
$resultOptions[$v] = $v;
}
}
}
}
// If no survey result options have been created, don't build
// the field to avoid clutter.
if (count($resultOptions) > 0) {
$buildSurveyResult = TRUE;
asort($resultOptions);
$form->add('select', 'activity_result', ts("Survey Result"), $resultOptions, FALSE, array('id' => 'activity_result', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
}
$form->assign('buildEngagementLevel', $buildEngagementLevel);
$form->assign('buildSurveyResult', $buildSurveyResult);
$form->setDefaults(array('activity_test' => 0));
}
示例7: buildSearchForm
/**
* add all the elements shared between case activity search and advanaced search
*
* @access public
*
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
$activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
asort($activityOptions);
foreach ($activityOptions as $activityID => $activity) {
$form->_activityElement =& $form->addElement('checkbox', "activity_type_id[{$activityID}]", NULL, $activity, array('onClick' => 'showCustomData( this.id );'));
}
CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
$activityRoles = array(1 => ts('Created by'), 2 => ts('Assigned to'));
$form->addRadio('activity_role', NULL, $activityRoles, NULL, '<br />');
$form->addElement('text', 'activity_contact_name', ts('Contact Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
foreach ($activityStatus as $activityStatusID => $activityStatusName) {
$activity_status[] = $form->createElement('checkbox', $activityStatusID, NULL, $activityStatusName);
}
$form->addGroup($activity_status, 'activity_status', ts('Activity Status'));
$form->setDefaults(array('activity_status[1]' => 1, 'activity_status[2]' => 1));
$form->addElement('text', 'activity_subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
$form->addElement('checkbox', 'activity_test', ts('Find Test Activities?'));
$activity_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity');
if ($activity_tags) {
foreach ($activity_tags as $tagID => $tagName) {
$form->_tagElement =& $form->addElement('checkbox', "activity_tags[{$tagID}]", NULL, $tagName);
}
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity');
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_activity', NULL, TRUE, FALSE, TRUE);
$surveys = CRM_Campaign_BAO_Survey::getSurveys();
if ($surveys) {
$form->add('select', 'activity_survey_id', ts('Survey'), array('' => ts('- none -')) + $surveys, FALSE);
}
$extends = array('Activity');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('activityGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'activity_campaign_id');
//add engagement level CRM-7775
$buildEngagementLevel = FALSE;
if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$buildEngagementLevel = TRUE;
$form->add('select', 'activity_engagement_level', ts('Engagement Index'), array('' => ts('- select -')) + CRM_Campaign_PseudoConstant::engagementLevel());
}
$form->assign('buildEngagementLevel', $buildEngagementLevel);
}
示例8: browse
/**
* Browse all custom data groups.
*
* @param string $action the action to be invoked
*
* @return void
* @access public
*/
function browse($action = NULL)
{
// get all custom groups sorted by weight
$customGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();
$dao->orderBy('weight, title');
$dao->find();
while ($dao->fetch()) {
$customGroup[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $customGroup[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->actionLinks()));
// update enable/disable links depending on custom_group properties.
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$customGroup[$dao->id]['order'] = $customGroup[$dao->id]['weight'];
$customGroup[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
}
$customGroupExtends = CRM_Core_SelectValues::customGroupExtends();
foreach ($customGroup as $key => $array) {
CRM_Core_DAO_CustomGroup::addDisplayEnums($customGroup[$key]);
$customGroup[$key]['extends_display'] = $customGroupExtends[$customGroup[$key]['extends']];
}
//fix for Displaying subTypes
$subTypes = array();
$subTypes['Activity'] = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
$subTypes['Contribution'] = CRM_Contribute_PseudoConstant::contributionType();
$subTypes['Membership'] = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
$subTypes['Event'] = CRM_Core_OptionGroup::values('event_type');
$subTypes['Grant'] = CRM_Core_OptionGroup::values('grant_type');
$subTypes['Campaign'] = CRM_Campaign_PseudoConstant::campaignType();
$subTypes['Participant'] = array();
$subTypes['ParticipantRole'] = CRM_Core_OptionGroup::values('participant_role');
$subTypes['ParticipantEventName'] = CRM_Event_PseudoConstant::event();
$subTypes['ParticipantEventType'] = CRM_Core_OptionGroup::values('event_type');
$subTypes['Individual'] = CRM_Contact_BAO_ContactType::subTypePairs('Individual', FALSE, NULL);
$subTypes['Household'] = CRM_Contact_BAO_ContactType::subTypePairs('Household', FALSE, NULL);
$subTypes['Organization'] = CRM_Contact_BAO_ContactType::subTypePairs('Organization', FALSE, NULL);
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
$relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
$relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
$allRelationshipType = array();
$allRelationshipType = array_merge($relTypeInd, $relTypeOrg);
$allRelationshipType = array_merge($allRelationshipType, $relTypeHou);
//adding subtype specific relationships CRM-5256
$relSubType = CRM_Contact_BAO_ContactType::subTypeInfo();
foreach ($relSubType as $subType => $val) {
$subTypeRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], FALSE, 'label', TRUE, $subType);
$allRelationshipType = array_merge($allRelationshipType, $subTypeRelationshipTypes);
}
$subTypes['Relationship'] = $allRelationshipType;
$cSubTypes = CRM_Core_Component::contactSubTypes();
$contactSubTypes = array();
foreach ($cSubTypes as $key => $value) {
$contactSubTypes[$key] = $key;
}
$subTypes['Contact'] = $contactSubTypes;
CRM_Core_BAO_CustomGroup::getExtendedObjectTypes($subTypes);
foreach ($customGroup as $key => $values) {
$subValue = CRM_Utils_Array::value('extends_entity_column_value', $customGroup[$key]);
$subName = CRM_Utils_Array::value('extends_entity_column_id', $customGroup[$key]);
$type = CRM_Utils_Array::value('extends', $customGroup[$key]);
if ($subValue) {
$subValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subValue, 1, -1));
$colValue = NULL;
foreach ($subValue as $sub) {
if ($sub) {
if ($type == 'Participant') {
if ($subName == 1) {
$colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantRole'][$sub] : $subTypes['ParticipantRole'][$sub];
} elseif ($subName == 2) {
$colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantEventName'][$sub] : $subTypes['ParticipantEventName'][$sub];
} elseif ($subName == 3) {
$colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantEventType'][$sub] : $subTypes['ParticipantEventType'][$sub];
}
} elseif ($type == 'Relationship') {
$colValue = $colValue ? $colValue . ', ' . $subTypes[$type][$sub . '_a_b'] : $subTypes[$type][$sub . '_a_b'];
if (isset($subTypes[$type][$sub . '_b_a'])) {
$colValue = $colValue ? $colValue . ', ' . $subTypes[$type][$sub . '_b_a'] : $subTypes[$type][$sub . '_b_a'];
}
} else {
$colValue = $colValue ? $colValue . (isset($subTypes[$type][$sub]) ? ', ' . $subTypes[$type][$sub] : '') : (isset($subTypes[$type][$sub]) ? $subTypes[$type][$sub] : '');
}
}
}
$customGroup[$key]["extends_entity_column_value"] = $colValue;
} else {
if (is_array(CRM_Utils_Array::value($type, $subTypes))) {
$customGroup[$key]["extends_entity_column_value"] = ts("Any");
//.........这里部分代码省略.........
示例9: array
/**
* Returns all the rows in the given offset and rowCount.
*
* @param string $action
* The action being performed.
* @param int $offset
* The row number to start from.
* @param int $rowCount
* The number of rows to return.
* @param string $sort
* The sql string that describes the sort order.
* @param string $output
* What should the result set include (web/email/csv).
*
* @param null $case
*
* @return int
* the total number of rows for this action
*/
public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $case = NULL)
{
$params = array('contact_id' => $this->_contactId, 'admin' => $this->_admin, 'caseId' => $case, 'context' => $this->_context, 'activity_type_id' => $this->_activityTypeIDs, 'offset' => $offset, 'rowCount' => $rowCount, 'sort' => $sort);
$config = CRM_Core_Config::singleton();
$rows = CRM_Activity_BAO_Activity::getActivities($params);
if (empty($rows)) {
return $rows;
}
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
$engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
// CRM-4418
$permissions = array($this->_permission);
if (CRM_Core_Permission::check('delete activities')) {
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
foreach ($rows as $k => $row) {
$row =& $rows[$k];
// DRAFTING: provide a facility for db-stored strings
// localize the built-in activity names for display
// (these are not enums, so we can't use any automagic here)
switch ($row['activity_type']) {
case 'Meeting':
$row['activity_type'] = ts('Meeting');
break;
case 'Phone Call':
$row['activity_type'] = ts('Phone Call');
break;
case 'Email':
$row['activity_type'] = ts('Email');
break;
case 'SMS':
$row['activity_type'] = ts('SMS');
break;
case 'Event':
$row['activity_type'] = ts('Event');
break;
}
// add class to this row if overdue
if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $row)) && CRM_Utils_Array::value('status_id', $row) == 1) {
$row['overdue'] = 1;
$row['class'] = 'status-overdue';
} else {
$row['overdue'] = 0;
$row['class'] = 'status-ontime';
}
$row['status'] = $row['status_id'] ? $activityStatus[$row['status_id']] : NULL;
if ($engagementLevel = CRM_Utils_Array::value('engagement_level', $row)) {
$row['engagement_level'] = CRM_Utils_Array::value($engagementLevel, $engagementLevels, $engagementLevel);
}
// CRM-3553
$accessMailingReport = FALSE;
if (!empty($row['mailingId'])) {
$accessMailingReport = TRUE;
}
$actionLinks = $this->actionLinks(CRM_Utils_Array::value('activity_type_id', $row), CRM_Utils_Array::value('source_record_id', $row), $accessMailingReport, CRM_Utils_Array::value('activity_id', $row), $this->_key);
$actionMask = array_sum(array_keys($actionLinks)) & $mask;
if ($output != CRM_Core_Selector_Controller::EXPORT && $output != CRM_Core_Selector_Controller::SCREEN) {
$row['action'] = CRM_Core_Action::formLink($actionLinks, $actionMask, array('id' => $row['activity_id'], 'cid' => $this->_contactId, 'cxt' => $this->_context, 'caseid' => CRM_Utils_Array::value('case_id', $row)), ts('more'), FALSE, 'activity.selector.action', 'Activity', $row['activity_id']);
}
unset($row);
}
return $rows;
}
示例10: from
static function from($name, $mode, $side)
{
$from = null;
//get survey clause in force,
//only when we have survey id.
if (!self::$_applySurveyClause) {
return $from;
}
switch ($name) {
case self::civicrm_activity_target:
$from = " INNER JOIN civicrm_activity_target ON civicrm_activity_target.target_contact_id = contact_a.id ";
break;
case self::civicrm_activity:
require_once 'CRM/Campaign/PseudoConstant.php';
$surveyActivityTypes = CRM_Campaign_PseudoConstant::activityType();
$surveyKeys = "(" . implode(',', array_keys($surveyActivityTypes)) . ")";
$from = " \nINNER JOIN civicrm_activity ON ( civicrm_activity.id = civicrm_activity_target.activity_id AND \n civicrm_activity.activity_type_id IN {$surveyKeys} )\nINNER JOIN civicrm_activity_assignment ON ( civicrm_activity.id = civicrm_activity_assignment.activity_id )\n";
break;
case 'civicrm_survey':
$from = " INNER JOIN civicrm_survey ON civicrm_survey.id = civicrm_activity.source_record_id ";
break;
case 'civicrm_campaign':
$from = " {$side} JOIN civicrm_campaign ON civicrm_campaign.id = civicrm_survey.campaign_id ";
break;
}
return $from;
}
示例11: buildQuickForm
public function buildQuickForm()
{
if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', FALSE);
$button = ts('Delete');
if ($this->_action & CRM_Core_Action::RENEW) {
$button = ts('Restore');
}
$this->addButtons(array(array('type' => 'next', 'name' => $button, 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
if (!$this->_single && !empty($this->_contactIds)) {
$withArray = array();
foreach ($this->_contactIds as $contactId) {
$withDisplayName = self::_getDisplayNameById($contactId);
$withArray[] = "\"{$withDisplayName}\" ";
}
$this->assign('with', implode(', ', $withArray));
}
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//build other activity links
CRM_Activity_Form_ActivityLinks::commonBuildQuickForm($this);
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', FALSE);
$element =& $this->add('select', 'activity_type_id', ts('Activity Type'), $this->_fields['followup_activity_type_id']['attributes'], FALSE, array('onchange' => "CRM.buildCustomData( 'Activity', this.value );"));
//freeze for update mode.
if ($this->_action & CRM_Core_Action::UPDATE) {
$element->freeze();
}
foreach ($this->_fields as $field => $values) {
if (CRM_Utils_Array::value($field, $this->_fields)) {
$attribute = NULL;
if (CRM_Utils_Array::value('attributes', $values)) {
$attribute = $values['attributes'];
}
$required = FALSE;
if (CRM_Utils_Array::value('required', $values)) {
$required = TRUE;
}
if ($values['type'] == 'wysiwyg') {
$this->addWysiwyg($field, $values['label'], $attribute, $required);
} else {
$this->add($values['type'], $field, $values['label'], $attribute, $required);
}
}
}
//CRM-7362 --add campaigns.
CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
//add engagement level CRM-7775
$buildEngagementLevel = FALSE;
if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$buildEngagementLevel = TRUE;
$this->add('select', 'engagement_level', ts('Engagement Index'), array('' => ts('- select -')) + CRM_Campaign_PseudoConstant::engagementLevel());
$this->addRule('engagement_level', ts('Please enter the engagement index as a number (integers only).'), 'positiveInteger');
}
$this->assign('buildEngagementLevel', $buildEngagementLevel);
// check for survey activity
$this->_isSurveyActivity = FALSE;
if ($this->_activityId && CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$this->_isSurveyActivity = CRM_Campaign_BAO_Survey::isSurveyActivity($this->_activityId);
if ($this->_isSurveyActivity) {
$surveyId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'source_record_id');
$responseOptions = CRM_Campaign_BAO_Survey::getResponsesOptions($surveyId);
if ($responseOptions) {
$this->add('select', 'result', ts('Result'), array('' => ts('- select -')) + array_combine($responseOptions, $responseOptions));
}
$surveyTitle = NULL;
if ($surveyId) {
$surveyTitle = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $surveyId, 'title');
}
$this->assign('surveyTitle', $surveyTitle);
}
}
$this->assign('surveyActivity', $this->_isSurveyActivity);
// this option should be available only during add mode
if ($this->_action != CRM_Core_Action::UPDATE) {
$this->add('advcheckbox', 'is_multi_activity', ts('Create a separate activity for each contact.'));
}
$this->addRule('duration', ts('Please enter the duration as number of minutes (integers only).'), 'positiveInteger');
$this->addDateTime('activity_date_time', ts('Date'), TRUE, array('formatType' => 'activityDateTime'));
//add followup date
$this->addDateTime('followup_date', ts('in'), FALSE, array('formatType' => 'activityDateTime'));
//autocomplete url
$dataUrl = CRM_Utils_System::url("civicrm/ajax/rest", "className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=activity&reset=1", FALSE, NULL, FALSE);
$this->assign('dataUrl', $dataUrl);
//tokeninput url
$tokenUrl = CRM_Utils_System::url("civicrm/ajax/checkemail", "noemail=1", FALSE, NULL, FALSE);
$this->assign('tokenUrl', $tokenUrl);
$admin = CRM_Core_Permission::check('administer CiviCRM');
//allow to edit source contact field field if context is civicase.
if ($this->_context == 'caseActivity') {
$admin = TRUE;
}
$this->assign('admin', $admin);
$sourceContactField =& $this->add($this->_fields['source_contact_id']['type'], 'source_contact_id', $this->_fields['source_contact_id']['label'], NULL, $admin);
$this->add('hidden', 'source_contact_qid', '', array('id' => 'source_contact_qid'));
CRM_Contact_Form_NewContact::buildQuickForm($this);
//.........这里部分代码省略.........
示例12: __construct
function __construct()
{
// There could be multiple contacts. We not clear on which contact id to display.
// Lets hide it for now.
$this->_exposeContactID = FALSE;
$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
if ($campaignEnabled) {
$getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
$this->activeCampaigns = $getCampaigns['campaigns'];
asort($this->activeCampaigns);
$this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
}
$this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'label', TRUE);
asort($this->activityTypes);
/*
* BOS1502448 vnv.nl - lidmaatschap historie
*/
$lidmaatschap_config = CRM_Lidmaatschaphistorie_Config::singleton();
$this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_source' => array('name' => 'sort_name', 'title' => ts('Source Contact Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE, 'default' => FALSE, 'no_display' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Contact Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => FALSE, 'no_display' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target Contact Name'), 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.sort_name", 'default' => TRUE), 'contact_source_id' => array('name' => 'id', 'alias' => 'civicrm_contact_source', 'dbAlias' => "civicrm_contact_source.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_assignee_id' => array('name' => 'id', 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_target_id' => array('name' => 'id', 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'filters' => array('contact_source' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_source', 'title' => ts('Source Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'current_user' => array('name' => 'current_user', 'title' => ts('Limit To Current User'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('contact_source_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Contact Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Contact Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('title' => ts('Activity ID'), 'required' => TRUE), 'source_record_id' => array('no_display' => TRUE, 'title' => ts('Activity Contact Id'), 'required' => TRUE), 'activity_type_id' => array('title' => ts('Activity Type'), 'no_display' => TRUE, 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_subject' => array('title' => ts('Subject')), 'activity_date_time' => array('title' => ts('Activity Date'), 'no_display' => TRUE, 'required' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => '0', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes, 'default' => $lidmaatschap_config->get_lidmaatschap_historie_activity_id()), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT)), 'order_bys' => array('activity_date_time' => array('title' => ts('Activity Date'), 'default_weight' => '1', 'dbAlias' => 'civicrm_activity_activity_date_time'), 'activity_type_id' => array('title' => ts('Activity Type'), 'default_weight' => '2', 'dbAlias' => 'civicrm_activity_activity_type_id')), 'grouping' => 'activity-fields', 'alias' => 'activity'), 'civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Activity Contact ID'), 'required' => TRUE), 'contact_id' => array('title' => ts('Contact ID'), 'required' => TRUE)))) + $this->addAddressFields(FALSE, TRUE);
if ($campaignEnabled) {
// Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
$this->_columns['civicrm_activity']['fields']['result'] = array('title' => 'Survey Result', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING);
if (!empty($this->activeCampaigns)) {
$this->_columns['civicrm_activity']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
}
if (!empty($this->engagementLevels)) {
$this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => 'Engagement Index', 'default' => 'false');
$this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
}
}
/*
* Hack uncheck land field
*/
$this->_columns['civicrm_address']['fields']['country_id']['default'] = false;
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
parent::__construct();
/*
* $this->_lidmaatschap_historie_custom_group_id
* Set custom fields default values and if check or not
*/
$lidmaatschap_historie_custom_group = $lidmaatschap_config->get_lidmaatschap_historie_custom_group();
$lidmaatschap_custom_group = $lidmaatschap_config->get_lidmaatschap_custom_group();
if (isset($this->_columns[$lidmaatschap_historie_custom_group['table_name']]) and !empty($this->_columns[$lidmaatschap_historie_custom_group['table_name']])) {
// add membership for lidmaatschap
$this->_columns['civicrm_membership'] = array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Membership Id'), 'required' => TRUE, 'no_repeat' => TRUE)));
// add the lidmaatschap
$this->_columns[$lidmaatschap_custom_group['table_name']] = array('dao' => 'CRM_Contact_DAO_Contact', 'extends' => 'Membership', 'grouping' => $lidmaatschap_custom_group['table_name'], 'group_title' => $lidmaatschap_custom_group['title'], 'fields' => array());
// add the lidmaatschap fields
foreach ($lidmaatschap_config->get_lidmaatschap_custom_fields() as $custom_field_id => $custom_field) {
$this->_columns[$lidmaatschap_custom_group['table_name']]['fields']['custom_' . $custom_field_id] = array('name' => strtolower($custom_field['name']) . '_' . $custom_field_id, 'title' => $custom_field['label']);
}
// check every custom field of lidmaatschap historie
if (isset($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']) and !empty($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields'])) {
foreach ($lidmaatschap_config->get_lidmaatschap_historie_custom_fields() as $custom_field_id => $custom_field) {
if (isset($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']['custom_' . $custom_field_id]) and !empty($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']['custom_' . $custom_field_id])) {
$this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']['custom_' . $custom_field_id]['default'] = TRUE;
}
}
}
}
}
示例13: 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'))));
}
}
示例14: buildQuickForm
/**
* Build the form object.
*
*
* @return void
*/
public function buildQuickForm()
{
$this->applyFilter('__ALL__', 'trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_CustomGroup');
//title
$this->add('text', 'title', ts('Set Name'), $attributes['title'], TRUE);
//Fix for code alignment, CRM-3058
$contactTypes = array('Contact', 'Individual', 'Household', 'Organization');
$this->assign('contactTypes', json_encode($contactTypes));
$sel1 = array("" => ts("- select -")) + CRM_Core_SelectValues::customGroupExtends();
$sel2 = array();
$activityType = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
$eventType = CRM_Core_OptionGroup::values('event_type');
$grantType = CRM_Core_OptionGroup::values('grant_type');
$campaignTypes = CRM_Campaign_PseudoConstant::campaignType();
$membershipType = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
$participantRole = CRM_Core_OptionGroup::values('participant_role');
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
$relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
$relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
ksort($sel1);
asort($activityType);
asort($eventType);
asort($grantType);
asort($membershipType);
asort($participantRole);
$allRelationshipType = array();
$allRelationshipType = array_merge($relTypeInd, $relTypeOrg);
$allRelationshipType = array_merge($allRelationshipType, $relTypeHou);
//adding subtype specific relationships CRM-5256
$subTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
foreach ($subTypes as $subType => $val) {
$subTypeRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], FALSE, 'label', TRUE, $subType);
$allRelationshipType = array_merge($allRelationshipType, $subTypeRelationshipTypes);
}
$sel2['Event'] = $eventType;
$sel2['Grant'] = $grantType;
$sel2['Activity'] = $activityType;
$sel2['Campaign'] = $campaignTypes;
$sel2['Membership'] = $membershipType;
$sel2['ParticipantRole'] = $participantRole;
$sel2['ParticipantEventName'] = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$sel2['ParticipantEventType'] = $eventType;
$sel2['Contribution'] = CRM_Contribute_PseudoConstant::financialType();
$sel2['Relationship'] = $allRelationshipType;
$sel2['Individual'] = CRM_Contact_BAO_ContactType::subTypePairs('Individual', FALSE, NULL);
$sel2['Household'] = CRM_Contact_BAO_ContactType::subTypePairs('Household', FALSE, NULL);
$sel2['Organization'] = CRM_Contact_BAO_ContactType::subTypePairs('Organization', FALSE, NULL);
CRM_Core_BAO_CustomGroup::getExtendedObjectTypes($sel2);
foreach ($sel2 as $main => $sub) {
if (!empty($sel2[$main])) {
if ($main == 'Relationship') {
$relName = self::getFormattedList($sel2[$main]);
$sel2[$main] = array('' => ts("- Any -")) + $relName;
} else {
$sel2[$main] = array('' => ts("- Any -")) + $sel2[$main];
}
}
}
$cSubTypes = CRM_Core_Component::contactSubTypes();
if (!empty($cSubTypes)) {
$contactSubTypes = array();
foreach ($cSubTypes as $key => $value) {
$contactSubTypes[$key] = $key;
}
$sel2['Contact'] = array("" => "- Any -") + $contactSubTypes;
} else {
if (!isset($this->_id)) {
$formName = 'document.forms.' . $this->_name;
$js = "<script type='text/javascript'>\n";
$js .= "{$formName}['extends_1'].style.display = 'none';\n";
$js .= "</script>";
$this->assign('initHideBlocks', $js);
}
}
$sel =& $this->add('hierselect', 'extends', ts('Used For'), array('name' => 'extends[0]', 'style' => 'vertical-align: top;'), TRUE);
$sel->setOptions(array($sel1, $sel2));
if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
// make second selector a multi-select -
$sel->_elements[1]->setMultiple(TRUE);
$sel->_elements[1]->setSize(5);
}
if ($this->_action == CRM_Core_Action::UPDATE) {
$subName = CRM_Utils_Array::value('extends_entity_column_id', $this->_defaults);
if ($this->_defaults['extends'] == 'Participant') {
if ($subName == 1) {
$this->_defaults['extends'] = 'ParticipantRole';
} elseif ($subName == 2) {
$this->_defaults['extends'] = 'ParticipantEventName';
} elseif ($subName == 3) {
$this->_defaults['extends'] = 'ParticipantEventType';
}
}
//allow to edit settings if custom set is empty CRM-5258
//.........这里部分代码省略.........
示例15: 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;
}