当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contact_BAO_Contact::getContactTypes方法代码示例

本文整理汇总了PHP中CRM_Contact_BAO_Contact::getContactTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact::getContactTypes方法的具体用法?PHP CRM_Contact_BAO_Contact::getContactTypes怎么用?PHP CRM_Contact_BAO_Contact::getContactTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_BAO_Contact的用法示例。


在下文中一共展示了CRM_Contact_BAO_Contact::getContactTypes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 /**
  * Common preprocess: fetch contact ID and contact type
  */
 public function preProcess()
 {
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE, NULL, $_REQUEST);
     $this->assign('contactId', $this->_contactId);
     // get contact type and subtype
     if (empty($this->_contactType)) {
         $contactTypeInfo = CRM_Contact_BAO_Contact::getContactTypes($this->_contactId);
         $this->_contactType = $contactTypeInfo[0];
         // check if subtype is set
         if (isset($contactTypeInfo[1])) {
             // unset contact type which is 0th element
             unset($contactTypeInfo[0]);
             $this->_contactSubType = $contactTypeInfo;
         }
     }
     $this->assign('contactType', $this->_contactType);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:20,代码来源:Inline.php

示例2: _civicrm_api3_pcpteams_getMoreInfo

function _civicrm_api3_pcpteams_getMoreInfo(&$params)
{
    foreach ($params as $pcpId => $pcpValues) {
        $entityFile = CRM_Core_BAO_File::getEntityFile('civicrm_pcp', $pcpId);
        $imageUrl = "";
        $fileId = NULL;
        if ($entityFile) {
            $fileInfo = reset($entityFile);
            $fileId = $fileInfo['fileID'];
            $imageUrl = CRM_Utils_System::url('civicrm/file', "reset=1&id={$fileId}&eid={$pcpId}");
        }
        $pcpBlockId = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'pcp_block_id', 'id');
        if ($pcpBlockId) {
            $contributionPageId = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCPBlock', $pcpBlockId, 'target_entity_id', 'id');
        }
        $donateUrl = CRM_Utils_System::url('civicrm/contribute/transact', 'id=' . $contributionPageId . '&pcpId=' . $pcpId . '&reset=1');
        $aContactTypes = CRM_Contact_BAO_Contact::getContactTypes($pcpValues['contact_id']);
        $isTeamPcp = in_array('Team', $aContactTypes) ? TRUE : FALSE;
        $params[$pcpId]['page_title'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $pcpValues['page_id'], 'title');
        $params[$pcpId]['amount_raised'] = civicrm_api3_pcpteams_getAmountRaised(array('pcp_id' => $pcpId, 'version' => 3));
        $params[$pcpId]['image_url'] = $imageUrl ? $imageUrl : CRM_Pcpteams_Constant::C_DEFAULT_PROFILE_PIC;
        $params[$pcpId]['image_id'] = $fileId;
        $params[$pcpId]['donate_url'] = $donateUrl;
        $params[$pcpId]['is_teampage'] = $isTeamPcp;
        //calculate percentage
        $percentage = 0;
        if (isset($pcpValues['goal_amount']) && number_format($pcpValues['goal_amount']) != '0') {
            $percentage = number_format($params[$pcpId]['amount_raised'] / $params[$pcpId]['goal_amount'] * 100);
        }
        if (isset($pcpValues['currency'])) {
            $params[$pcpId]['currency_symbol'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $pcpValues['currency'], 'symbol', 'name');
        }
        $params[$pcpId]['percentage'] = $percentage;
        // check the user has pending request
        $pendingDetails = civicrm_api3_pcpteams_getMyPendingTeam(array('contact_id' => $pcpValues['contact_id']));
        $params[$pcpId]['pending_team_pcp_id'] = isset($pendingDetails['values'][0]) ? $pendingDetails['values'][0]['teamPcpId'] : NULL;
        $params[$pcpId]['pending_team_relationship_id'] = isset($pendingDetails['values'][0]) ? $pendingDetails['values'][0]['relationship_id'] : NULL;
    }
}
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:39,代码来源:Pcpteams.php

示例3: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     $this->add('hidden', 'gid', $this->_gid);
     switch ($this->_mode) {
         case self::MODE_CREATE:
         case self::MODE_EDIT:
         case self::MODE_REGISTER:
             CRM_Utils_Hook::buildProfile($this->_ufGroup['name']);
             break;
         case self::MODE_SEARCH:
             CRM_Utils_Hook::searchProfile($this->_ufGroup['name']);
             break;
         default:
     }
     //lets have single status message, CRM-4363
     $return = FALSE;
     $statusMessage = NULL;
     if ($this->_multiRecord & CRM_Core_Action::ADD && $this->_maxRecordLimit) {
         return;
     }
     if ($this->_multiRecord & CRM_Core_Action::DELETE) {
         if (!$this->_recordExists) {
             CRM_Core_Session::setStatus(ts('The record %1 doesnot exists', array(1 => $this->_recordId)), ts('Record doesnot exists'), 'alert');
         } else {
             $this->assign('deleteRecord', TRUE);
         }
         return;
     }
     CRM_Core_BAO_Address::checkContactSharedAddressFields($this->_fields, $this->_id);
     // we should not allow component and mix profiles in search mode
     if ($this->_mode != self::MODE_REGISTER) {
         //check for mix profile fields (eg:  individual + other contact type)
         if (CRM_Core_BAO_UFField::checkProfileType($this->_gid)) {
             if ($this->_mode & self::MODE_EDIT && $this->_isContactActivityProfile) {
                 $errors = self::validateContactActivityProfile($this->_activityId, $this->_id, $this->_gid);
                 if (!empty($errors)) {
                     $statusMessage = array_pop($errors);
                     $return = TRUE;
                 }
             } else {
                 $statusMessage = ts('Profile search, view and edit are not supported for Profiles which include fields for more than one record type.');
                 $return = TRUE;
             }
         }
         $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
         if ($this->_id) {
             $contactTypes = CRM_Contact_BAO_Contact::getContactTypes($this->_id);
             $contactType = $contactTypes[0];
             array_shift($contactTypes);
             $contactSubtypes = $contactTypes;
             $profileSubType = FALSE;
             if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
                 $profileSubType = $profileType;
                 $profileType = CRM_Contact_BAO_ContactType::getBasicType($profileType);
             }
             if ($profileType != 'Contact' && !$this->_isContactActivityProfile && ($profileSubType && !empty($contactSubtypes) && !in_array($profileSubType, $contactSubtypes) || $profileType != $contactType)) {
                 $return = TRUE;
                 if (!$statusMessage) {
                     $statusMessage = ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.", array(1 => $profileSubType ? $profileSubType : $profileType));
                 }
             }
         }
         if (in_array($profileType, array("Membership", "Participant", "Contribution"))) {
             $return = TRUE;
             if (!$statusMessage) {
                 $statusMessage = ts('Profile is not configured for the selected action.');
             }
         }
     }
     //lets have single status message,
     $this->assign('statusMessage', $statusMessage);
     if ($return) {
         return FALSE;
     }
     $this->assign('id', $this->_id);
     $this->assign('mode', $this->_mode);
     $this->assign('action', $this->_action);
     $this->assign('fields', $this->_fields);
     $this->assign('fieldset', isset($this->_fieldset) ? $this->_fieldset : "");
     // should we restrict what we display
     $admin = TRUE;
     if ($this->_mode == self::MODE_EDIT) {
         $admin = FALSE;
         // show all fields that are visibile:
         // if we are a admin OR the same user OR acl-user with access to the profile
         // or we have checksum access to this contact (i.e. the user without a login) - CRM-5909
         if (CRM_Core_Permission::check('administer users') || $this->_id == $this->_currentUserID || $this->_isPermissionedChecksum || in_array($this->_gid, CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id')))) {
             $admin = TRUE;
         }
     }
     // if false, user is not logged-in.
     $anonUser = FALSE;
     if (!$this->_currentUserID) {
         $defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
         $primaryLocationType = $defaultLocationType->id;
//.........这里部分代码省略.........
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:101,代码来源:Form.php

示例4: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Batch Profile Update for Contact'));
     foreach ($this->_contactIds as $id) {
         $this->_contactTypes = CRM_Contact_BAO_Contact::getContactTypes($id);
     }
     //add Contact type profiles
     $this->_contactTypes[] = 'Contact';
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($this->_contactTypes);
     if (empty($profiles)) {
         $types = implode(' ' . ts('or') . ' ', $this->_contactTypes);
         CRM_Core_Session::setStatus(ts("The contact type selected for Batch Update does not have a corresponding profile. Please set up a profile for %1s and try again.", array(1 => $types)), ts('No Profile Available'), 'error');
         CRM_Utils_System::redirect($this->_userContext);
     }
     $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, TRUE, array('class' => 'crm-select2 huge'));
     $this->addDefaultButtons(ts('Continue >>'));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:24,代码来源:PickProfile.php

示例5: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     //lets have single status message, CRM-4363
     $return = false;
     $statusMessage = null;
     //we should not allow component and mix profiles in search mode
     if ($this->_mode != self::MODE_REGISTER) {
         //check for mix profile fields (eg:  individual + other contact type)
         if (CRM_Core_BAO_UFField::checkProfileType($this->_gid)) {
             $statusMessage = ts('Profile search, view and edit are not supported for Profiles which include fields for more than one record type.');
         }
         $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
         if ($this->_id) {
             list($contactType, $contactSubType) = CRM_Contact_BAO_Contact::getContactTypes($this->_id);
             if ($profileType != 'Contact' && $contactType != $profileType && !CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
                 $return = true;
                 if (!$statusMessage) {
                     $statusMessage = ts('This profile is not configured for "%1" contact type.', array(1 => $contactType));
                 }
             }
             if ($contactSubType && CRM_Contact_BAO_ContactType::isaSubType($profileType) && $profileType != $contactSubType) {
                 $return = true;
                 if (!$statusMessage) {
                     $statusMessage = ts('This profile is not configured for "%1" contact subtype.', array(1 => $contactSubType));
                 }
             }
         }
         if (in_array($profileType, array("Membership", "Participant", "Contribution"))) {
             $return = true;
             if (!$statusMessage) {
                 $statusMessage = ts('Profile is not configured for the selected action.');
             }
         }
     }
     //lets have sigle status message,
     $this->assign('statusMessage', $statusMessage);
     if ($return) {
         return false;
     }
     $sBlocks = array();
     $hBlocks = array();
     $config =& CRM_Core_Config::singleton();
     $this->assign('id', $this->_id);
     $this->assign('mode', $this->_mode);
     $this->assign('action', $this->_action);
     $this->assign_by_ref('fields', $this->_fields);
     $this->assign('fieldset', isset($this->_fieldset) ? $this->_fieldset : "");
     // do we need inactive options ?
     if ($this->_action & CRM_Core_Action::VIEW) {
         $inactiveNeeded = true;
     } else {
         $inactiveNeeded = false;
     }
     $session =& CRM_Core_Session::singleton();
     // should we restrict what we display
     $admin = true;
     if ($this->_mode == self::MODE_EDIT) {
         $admin = false;
         // show all fields that are visibile: if we are a admin or the same user or in registration mode
         if (CRM_Core_Permission::check('administer users') || $this->_id == $session->get('userID')) {
             $admin = true;
         }
     }
     $userID = $session->get('userID');
     $anonUser = false;
     // if false, user is not logged-in.
     if (!$userID) {
         require_once 'CRM/Core/BAO/LocationType.php';
         $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
         $primaryLocationType = $defaultLocationType->id;
         $anonUser = true;
         $this->assign('anonUser', true);
     }
     $addCaptcha = array();
     $emailPresent = false;
     // cache the state country fields. based on the results, we could use our javascript solution
     // in create or register mode
     $stateCountryMap = array();
     // add the form elements
     foreach ($this->_fields as $name => $field) {
         // make sure that there is enough permission to expose this field
         if (!$admin && $field['visibility'] == 'User and User Admin Only' || CRM_Utils_Array::value('is_view', $field)) {
             unset($this->_fields[$name]);
             continue;
         }
         // since the CMS manages the email field, suppress the email display if in
         // register mode which occur within the CMS form
         if ($this->_mode == self::MODE_REGISTER && substr($name, 0, 5) == 'email') {
             unset($this->_fields[$name]);
             continue;
         }
         list($prefixName, $index) = CRM_Utils_System::explode('-', $name, 2);
         if ($prefixName == 'state_province' || $prefixName == 'country') {
             if (!array_key_exists($index, $stateCountryMap)) {
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Form.php

示例6: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Batch Profile Update'));
     if (CRM_Core_Permission::access('Quest')) {
         $this->_contactTypes['Student'] = 'Student';
     }
     //add Contact type profiles
     $this->_contactTypes[] = 'Contact';
     foreach ($this->_contactIds as $id) {
         $this->_contactTypes = CRM_Contact_BAO_Contact::getContactTypes($id);
     }
     require_once "CRM/Core/BAO/UFGroup.php";
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($this->_contactTypes);
     if (empty($profiles)) {
         $types = implode('or', $this->_contactTypes);
         CRM_Core_Session::setStatus("The contact type selected for Batch Update do not have corresponding profiles. Please make sure that {$types} has a profile and try again.");
         CRM_Utils_System::redirect($this->_userContext);
     }
     $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, true);
     $this->addDefaultButtons(ts('Continue >>'));
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:27,代码来源:PickProfile.php

示例7: checkPcpType

 static function checkPcpType($pcpId)
 {
     if (empty($pcpId)) {
         return NULL;
     }
     $aContactTypes = CRM_Contact_BAO_Contact::getContactTypes(CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'contact_id'));
     return in_array('Team', $aContactTypes) ? 'Team' : 'Indiviual';
 }
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:8,代码来源:Utils.php


注:本文中的CRM_Contact_BAO_Contact::getContactTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。