本文整理汇总了PHP中CRM_Contact_BAO_Query::componentPresent方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Query::componentPresent方法的具体用法?PHP CRM_Contact_BAO_Query::componentPresent怎么用?PHP CRM_Contact_BAO_Query::componentPresent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Query
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Query::componentPresent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
function select(&$query)
{
if (CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'hrjob_')) {
$fields = $this->getFields();
foreach ($fields as $fldName => $params) {
if (!empty($query->_returnProperties[$fldName])) {
$query->_select[$fldName] = "{$params['where']} as {$fldName}";
if ($fldName == 'hrjob_role_manager_contact') {
$query->_select[$fldName] = "GROUP_CONCAT(DISTINCT(civicrm_hrjob_role_manager.sort_name) SEPARATOR ' | ') as {$fldName}";
}
if ($fldName == 'hrjob_location') {
$ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $params['pseudoconstant']['optionGroupName'], 'id', 'name');
$query->_select[$fldName] = "(select ov.label from civicrm_option_value ov where option_group_id = {$ogID} AND value = civicrm_hrjob.location) as {$fldName}";
}
if ($fldName == 'hrjob_role_department') {
$ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $params['pseudoconstant']['optionGroupName'], 'id', 'name');
$query->_select[$fldName] = "GROUP_CONCAT(DISTINCT(select ov.label from civicrm_option_value ov where option_group_id = {$ogID} AND value = civicrm_hrjob_role.department) SEPARATOR ' | ') as {$fldName}";
}
$query->_element[$fldName] = 1;
list($tableName, $dnc) = explode('.', $params['where'], 2);
$query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
}
}
}
}
示例2: select
function select(&$query)
{
if (CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'hrjobcontract_')) {
$fields = $this->getFields();
foreach ($fields as $fldName => $params) {
if (!empty($query->_returnProperties[$fldName])) {
$query->_select[$fldName] = "{$params['where']} as {$fldName}";
if ($fldName == 'hrjobcontract_role_manager_contact') {
$query->_select[$fldName] = "GROUP_CONCAT(DISTINCT(civicrm_hrjobcontract_role_manager.sort_name) SEPARATOR ' | ') as {$fldName}";
}
if ($fldName == 'hrjobcontract_role_department') {
$query->_select[$fldName] = "GROUP_CONCAT(DISTINCT(civicrm_hrjobcontract_role.department) SEPARATOR ' | ') as {$fldName}";
}
$query->_element[$fldName] = 1;
list($tableName, $dnc) = explode('.', $params['where'], 2);
$query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
}
}
}
}
示例3: select
/**
* Build select for CiviEvent.
*
* @param $query
*/
public static function select(&$query)
{
if ($query->_mode & CRM_Contact_BAO_Query::MODE_EVENT || CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'participant_')) {
$query->_select['participant_id'] = "civicrm_participant.id as participant_id";
$query->_element['participant_id'] = 1;
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
//add fee level
if (!empty($query->_returnProperties['participant_fee_level'])) {
$query->_select['participant_fee_level'] = "civicrm_participant.fee_level as participant_fee_level";
$query->_element['participant_fee_level'] = 1;
}
//add participant contact ID
if (!empty($query->_returnProperties['participant_contact_id'])) {
$query->_select['participant_contact_id'] = "civicrm_participant.contact_id as participant_contact_id";
$query->_element['participant_contact_id'] = 1;
}
//add fee amount
if (!empty($query->_returnProperties['participant_fee_amount'])) {
$query->_select['participant_fee_amount'] = "civicrm_participant.fee_amount as participant_fee_amount";
$query->_element['participant_fee_amount'] = 1;
}
//add fee currency
if (!empty($query->_returnProperties['participant_fee_currency'])) {
$query->_select['participant_fee_currency'] = "civicrm_participant.fee_currency as participant_fee_currency";
$query->_element['participant_fee_currency'] = 1;
}
//add event title also if event id is select
if (!empty($query->_returnProperties['event_id']) || !empty($query->_returnProperties['event_title'])) {
$query->_select['event_id'] = "civicrm_event.id as event_id";
$query->_select['event_title'] = "civicrm_event.title as event_title";
$query->_element['event_id'] = 1;
$query->_element['event_title'] = 1;
$query->_tables['civicrm_event'] = 1;
$query->_whereTables['civicrm_event'] = 1;
}
//add start date / end date
if (!empty($query->_returnProperties['event_start_date'])) {
$query->_select['event_start_date'] = "civicrm_event.start_date as event_start_date";
$query->_element['event_start_date'] = 1;
}
if (!empty($query->_returnProperties['event_end_date'])) {
$query->_select['event_end_date'] = "civicrm_event.end_date as event_end_date";
$query->_element['event_end_date'] = 1;
}
//event type
if (!empty($query->_returnProperties['event_type'])) {
$query->_select['event_type'] = "event_type.label as event_type";
$query->_element['event_type'] = 1;
$query->_tables['event_type'] = 1;
$query->_whereTables['event_type'] = 1;
}
if (!empty($query->_returnProperties['event_type_id'])) {
$query->_select['event_type_id'] = "event_type.id as event_type_id";
$query->_element['event_type_id'] = 1;
$query->_tables['event_type'] = 1;
$query->_whereTables['event_type'] = 1;
}
//add status_id
if (!empty($query->_returnProperties['participant_status_id'])) {
$query->_select['participant_status_id'] = "civicrm_participant.status_id as participant_status_id";
$query->_element['participant_status_id'] = 1;
$query->_tables['civicrm_participant'] = 1;
$query->_whereTables['civicrm_participant'] = 1;
}
// get particupant_status label
if (!empty($query->_returnProperties['participant_status'])) {
$query->_select['participant_status'] = "participant_status.label as participant_status";
$query->_element['participant_status'] = 1;
$query->_tables['participant_status'] = 1;
$query->_whereTables['civicrm_participant'] = 1;
}
//add participant_role_id
if (!empty($query->_returnProperties['participant_role_id'])) {
$query->_select['participant_role_id'] = "civicrm_participant.role_id as participant_role_id";
$query->_element['participant_role_id'] = 1;
$query->_tables['civicrm_participant'] = 1;
$query->_whereTables['civicrm_participant'] = 1;
$query->_pseudoConstantsSelect['participant_role_id'] = array('pseudoField' => 'participant_role_id', 'idCol' => 'participant_role_id');
}
//add participant_role
if (!empty($query->_returnProperties['participant_role'])) {
$query->_select['participant_role'] = "civicrm_participant.role_id as participant_role";
$query->_element['participant_role'] = 1;
$query->_tables['participant_role'] = 1;
$query->_whereTables['civicrm_participant'] = 1;
$query->_pseudoConstantsSelect['participant_role'] = array('pseudoField' => 'participant_role', 'idCol' => 'participant_role');
}
//add register date
if (!empty($query->_returnProperties['participant_register_date'])) {
$query->_select['participant_register_date'] = "civicrm_participant.register_date as participant_register_date";
$query->_element['participant_register_date'] = 1;
}
//add source
if (!empty($query->_returnProperties['participant_source'])) {
$query->_select['participant_source'] = "civicrm_participant.source as participant_source";
//.........这里部分代码省略.........
示例4: select
/**
* If membership are involved, add the specific membership fields.
*
* @param CRM_Contact_BAO_Query $query
*/
public static function select(&$query)
{
// if membership mode add membership id
if ($query->_mode & CRM_Contact_BAO_Query::MODE_MEMBER || CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'membership_')) {
$query->_select['membership_id'] = "civicrm_membership.id as membership_id";
$query->_element['membership_id'] = 1;
$query->_tables['civicrm_membership'] = 1;
$query->_whereTables['civicrm_membership'] = 1;
//add membership type
if (!empty($query->_returnProperties['membership_type'])) {
$query->_select['membership_type'] = "civicrm_membership_type.name as membership_type";
$query->_element['membership_type'] = 1;
$query->_tables['civicrm_membership_type'] = 1;
$query->_whereTables['civicrm_membership_type'] = 1;
}
//add join date
if (!empty($query->_returnProperties['join_date'])) {
$query->_select['join_date'] = "civicrm_membership.join_date as join_date";
$query->_element['join_date'] = 1;
}
//add source
if (!empty($query->_returnProperties['membership_source'])) {
$query->_select['membership_source'] = "civicrm_membership.source as membership_source";
$query->_element['membership_source'] = 1;
}
//add status
if (!empty($query->_returnProperties['membership_status'])) {
$query->_select['membership_status'] = "civicrm_membership_status.label as membership_status";
$query->_element['membership_status'] = 1;
$query->_tables['civicrm_membership_status'] = 1;
$query->_whereTables['civicrm_membership_status'] = 1;
}
if (!empty($query->_returnProperties['membership_status_id'])) {
$query->_select['status_id'] = "civicrm_membership_status.id as status_id";
$query->_element['status_id'] = 1;
$query->_tables['civicrm_membership_status'] = 1;
$query->_whereTables['civicrm_membership_status'] = 1;
}
//add start date / end date
if (!empty($query->_returnProperties['membership_start_date'])) {
$query->_select['membership_start_date'] = "civicrm_membership.start_date as membership_start_date";
$query->_element['membership_start_date'] = 1;
}
if (!empty($query->_returnProperties['membership_end_date'])) {
$query->_select['membership_end_date'] = "civicrm_membership.end_date as membership_end_date";
$query->_element['membership_end_date'] = 1;
}
//add owner_membership_id
if (!empty($query->_returnProperties['owner_membership_id'])) {
$query->_select['owner_membership_id'] = "civicrm_membership.owner_membership_id as owner_membership_id";
$query->_element['owner_membership_id'] = 1;
}
//add max_related
if (!empty($query->_returnProperties['max_related'])) {
$query->_select['max_related'] = "civicrm_membership.max_related as max_related";
$query->_element['max_related'] = 1;
}
//add recur id w/o taking contribution table in join.
if (!empty($query->_returnProperties['membership_recur_id'])) {
$query->_select['membership_recur_id'] = "civicrm_membership.contribution_recur_id as membership_recur_id";
$query->_element['membership_recur_id'] = 1;
}
//add campaign id.
if (!empty($query->_returnProperties['member_campaign_id'])) {
$query->_select['member_campaign_id'] = 'civicrm_membership.campaign_id as member_campaign_id';
$query->_element['member_campaign_id'] = 1;
}
}
}
示例5: select
/**
* build select for CiviBooking
*
* @return void
* @access public
*/
function select(&$query)
{
if (CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'booking_')) {
$fields = $this->getFields();
foreach ($fields as $fldName => $params) {
if (CRM_Utils_Array::value($fldName, $query->_returnProperties)) {
$query->_select[$fldName] = "{$params['where']} as {$fldName}";
$query->_element[$fldName] = 1;
list($tableName, $dnc) = explode('.', $params['where'], 2);
$query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
}
}
if (CRM_Utils_Array::value('booking_status', $query->_returnProperties) || CRM_Utils_Array::value('booking_status_id', $query->_returnProperties)) {
$query->_select['civicrm_booking_status'] = "civicrm_booking_status.label as booking_status";
$query->_select['civicrm_booking_status_id'] = "civicrm_booking.status_id as booking_status_id";
$query->_element['civicrm_booking_status_id'] = 1;
$query->_element['civicrm_booking_status'] = 1;
$query->_tables['civicrm_booking'] = 1;
$query->_tables['civicrm_booking_status'] = 1;
}
if (CRM_Utils_Array::value('booking_payment_status', $query->_returnProperties) || CRM_Utils_Array::value('booking_payment_status_id', $query->_returnProperties)) {
$query->_select['civicrm_booking_payment_status'] = "civicrm_booking_payment_status.label as booking_payment_status";
$query->_select['civicrm_booking_payment_status_id'] = "civicrm_booking_payment_status.value as booking_payment_status_id";
$query->_element['civicrm_booking_payment_status_id'] = 1;
$query->_element['civicrm_booking_payment_status'] = 1;
$query->_tables['civicrm_booking'] = 1;
$query->_tables['civicrm_booking_payment_status'] = 1;
}
if (CRM_Utils_Array::value('booking_title', $query->_returnProperties)) {
$query->_select['booking_title'] = "civicrm_booking.title as booking_title";
$query->_element['booking_title'] = 1;
}
if (CRM_Utils_Array::value('booking_created_date', $query->_returnProperties)) {
$query->_select['booking_created_date'] = "civicrm_booking.created_date as booking_created_date";
$query->_element['booking_created_date'] = 1;
}
if (CRM_Utils_Array::value('booking_total_amount', $query->_returnProperties)) {
$query->_select['booking_total_amount'] = "civicrm_booking.total_amount as booking_total_amount";
$query->_element['booking_total_amount'] = 1;
}
if (CRM_Utils_Array::value('booking_event_date', $query->_returnProperties)) {
$query->_select['booking_event_date'] = "civicrm_booking.booking_date as booking_event_date";
$query->_element['booking_event_date'] = 1;
}
if (CRM_Utils_Array::value('booking_start_date', $query->_returnProperties)) {
$query->_select['booking_start_date'] = "civicrm_booking.start_date as booking_start_date";
$query->_element['booking_start_date'] = 1;
}
if (CRM_Utils_Array::value('booking_end_date', $query->_returnProperties)) {
$query->_select['booking_end_date'] = "civicrm_booking.end_date as booking_end_date";
$query->_element['booking_end_date'] = 1;
}
if (CRM_Utils_Array::value('booking_associated_contact', $query->_returnProperties)) {
$query->_select['booking_associated_contact'] = "civicrm_booking_associated_contact.sort_name as booking_associated_contact";
$query->_select['booking_associated_contact_id'] = "civicrm_booking.secondary_contact_id as booking_associated_contact_id";
$query->_element['civicrm_booking_associated_contact'] = 1;
$query->_element['civicrm_booking_associated_contact_id'] = 1;
$query->_tables['civicrm_contact'] = 1;
$query->_tables['civicrm_booking_associated_contact'] = 1;
}
}
}
示例6: select
function select(&$query)
{
if (CRM_Contact_BAO_Query::componentPresent($query->_returnProperties, 'lineitems_')) {
$fields = $this->getFields();
}
}