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


PHP CRM_Contact_BAO_Relationship::getPermissionedEmployer方法代码示例

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


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

示例1: preProcess

 /**
  * Set variables up before form is built.
  *
  * @param CRM_Core_Form $form
  */
 public static function preProcess(&$form)
 {
     $session = CRM_Core_Session::singleton();
     $contactID = $form->_contactID;
     $ufJoinParams = array('module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $form->_id);
     $profileId = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
     $form->_profileId = $profileId[0];
     if (!$form->_profileId || !CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $form->_profileId, 'is_active')) {
         CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of an organization and the selected onbehalf profile is either disabled or not found.'));
     }
     $requiredProfileFields = array('organization_name', 'email');
     $validProfile = CRM_Core_BAO_UFGroup::checkValidProfile($form->_profileId, $requiredProfileFields);
     if (!$validProfile) {
         CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of an organization and the required fields of the selected onbehalf profile are disabled.'));
     }
     $form->assign('profileId', $form->_profileId);
     $form->assign('mode', $form->_mode);
     if ($contactID) {
         $form->_employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID);
         if (!empty($form->_membershipContactID) && $contactID != $form->_membershipContactID) {
             // renewal case - membership being renewed may or may not be for organization
             if (!empty($form->_employers) && array_key_exists($form->_membershipContactID, $form->_employers)) {
                 // if _membershipContactID belongs to employers list, we can say:
                 $form->_relatedOrganizationFound = TRUE;
             }
         } elseif (!empty($form->_employers)) {
             // not a renewal case and _employers list is not empty
             $form->_relatedOrganizationFound = TRUE;
         }
         if ($form->_relatedOrganizationFound) {
             // Related org url - pass checksum if needed
             $args = array('cid' => '');
             if (!empty($_GET['cs'])) {
                 $args = array('uid' => $form->_contactID, 'cs' => $_GET['cs'], 'cid' => '');
             }
             $locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', $args, FALSE, NULL, FALSE);
             $form->assign('locDataURL', $locDataURL);
             if (!empty($form->_submitValues['onbehalf'])) {
                 if (!empty($form->_submitValues['onbehalfof_id'])) {
                     $form->assign('submittedOnBehalf', $form->_submitValues['onbehalfof_id']);
                 }
                 $form->assign('submittedOnBehalfInfo', json_encode($form->_submitValues['onbehalf']));
             }
         }
         if ($form->_values['is_for_organization'] != 2) {
             $form->assign('relatedOrganizationFound', $form->_relatedOrganizationFound);
         } else {
             $form->assign('onBehalfRequired', $form->_onBehalfRequired);
         }
         if (count($form->_employers) == 1) {
             foreach ($form->_employers as $id => $value) {
                 $form->_organizationName = $value['name'];
                 $orgId = $id;
             }
             $form->assign('orgId', $orgId);
             $form->assign('organizationName', $form->_organizationName);
         }
     }
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:64,代码来源:OnBehalfOf.php

示例2: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 static function preProcess(&$form)
 {
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     $ufJoinParams = array('module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $form->_id);
     $profileId = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
     $form->_profileId = $profileId[0];
     if (!$form->_profileId || !CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $form->_profileId, 'is_active')) {
         CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of an organization and the selected onbehalf profile is either disabled or not found.'));
     }
     $requiredProfileFields = array('organization_name', 'email');
     $validProfile = CRM_Core_BAO_UFGroup::checkValidProfile($form->_profileId, $requiredProfileFields);
     if (!$validProfile) {
         CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of an organization and the required fields of the selected onbehalf profile are disabled.'));
     }
     $form->assign('profileId', $form->_profileId);
     $form->assign('mode', $form->_mode);
     if ($contactID) {
         $form->_employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID);
         if (!empty($form->_employers)) {
             $form->_relatedOrganizationFound = TRUE;
             $locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', 'cid=', FALSE, NULL, FALSE);
             $form->assign('locDataURL', $locDataURL);
             $dataURL = CRM_Utils_System::url('civicrm/ajax/employer', 'cid=' . $contactID, FALSE, NULL, FALSE);
             $form->assign('employerDataURL', $dataURL);
         }
         if ($form->_values['is_for_organization'] != 2) {
             $form->assign('relatedOrganizationFound', $form->_relatedOrganizationFound);
         } else {
             $form->assign('onBehalfRequired', $form->_onBehalfRequired);
         }
         if (count($form->_employers) == 1) {
             foreach ($form->_employers as $id => $value) {
                 $form->_organizationName = $value['name'];
                 $orgId = $id;
             }
             $form->assign('orgId', $orgId);
             $form->assign('organizationName', $form->_organizationName);
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:47,代码来源:OnBehalfOf.php

示例3: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     $config = CRM_Core_Config::singleton();
     $session = CRM_Core_Session::singleton();
     // current contribution page id
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if (!$this->_id) {
         // seems like the session is corrupted and/or we lost the id trail
         // lets just bump this to a regular session error and redirect user to main page
         $this->controller->invalidKeyRedirect();
     }
     // this was used prior to the cleverer this_>getContactID - unsure now
     $this->_userID = $session->get('userID');
     $this->_contactID = $this->_membershipContactID = $this->getContactID();
     $this->_mid = NULL;
     if ($this->_contactID) {
         $this->_mid = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
         if ($this->_mid) {
             $membership = new CRM_Member_DAO_Membership();
             $membership->id = $this->_mid;
             if ($membership->find(TRUE)) {
                 $this->_defaultMemTypeId = $membership->membership_type_id;
                 if ($membership->contact_id != $this->_contactID) {
                     $validMembership = FALSE;
                     $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID);
                     if (!empty($employers) && array_key_exists($membership->contact_id, $employers)) {
                         $this->_membershipContactID = $membership->contact_id;
                         $this->assign('membershipContactID', $this->_membershipContactID);
                         $this->assign('membershipContactName', $employers[$this->_membershipContactID]['name']);
                         $validMembership = TRUE;
                     } else {
                         $membershipType = new CRM_Member_BAO_MembershipType();
                         $membershipType->id = $membership->membership_type_id;
                         if ($membershipType->find(TRUE)) {
                             // CRM-14051 - membership_type.relationship_type_id is a CTRL-A padded string w one or more ID values.
                             // Convert to commma separated list.
                             $inheritedRelTypes = implode(CRM_Utils_Array::explodePadded($membershipType->relationship_type_id), ',');
                             $permContacts = CRM_Contact_BAO_Relationship::getPermissionedContacts($this->_userID, $membershipType->relationship_type_id);
                             if (array_key_exists($membership->contact_id, $permContacts)) {
                                 $this->_membershipContactID = $membership->contact_id;
                                 $validMembership = TRUE;
                             }
                         }
                     }
                     if (!$validMembership) {
                         CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert');
                     }
                 }
             } else {
                 CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert');
             }
             unset($membership);
         }
     }
     // we do not want to display recently viewed items, so turn off
     $this->assign('displayRecent', FALSE);
     // Contribution page values are cleared from session, so can't use normal Printer Friendly view.
     // Use Browser Print instead.
     $this->assign('browserPrint', TRUE);
     // action
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->assign('action', $this->_action);
     // current mode
     $this->_mode = $this->_action == 1024 ? 'test' : 'live';
     $this->_values = $this->get('values');
     $this->_fields = $this->get('fields');
     $this->_bltID = $this->get('bltID');
     $this->_paymentProcessor = $this->get('paymentProcessor');
     $this->_priceSetId = $this->get('priceSetId');
     $this->_priceSet = $this->get('priceSet');
     if (!$this->_values) {
         // get all the values from the dao object
         $this->_values = array();
         $this->_fields = array();
         CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
         // check if form is active
         if (!CRM_Utils_Array::value('is_active', $this->_values)) {
             // form is inactive, die a fatal death
             CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
         }
         // also check for billing informatin
         // get the billing location type
         $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
         // CRM-8108 remove ts around Billing location type
         //$this->_bltID = array_search( ts('Billing'),  $locationTypes );
         $this->_bltID = array_search('Billing', $locationTypes);
         if (!$this->_bltID) {
             CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
         }
         $this->set('bltID', $this->_bltID);
         // check for is_monetary status
         $isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values);
         $isPayLater = CRM_Utils_Array::value('is_pay_later', $this->_values);
         //FIXME: to support multiple payment processors
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:ContributionBase.php

示例4: getPermissionedEmployer

 /**
  * Function to obtain list of permissioned employer for the given contact-id.
  */
 function getPermissionedEmployer(&$config)
 {
     $cid = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
     $name = trim(CRM_Utils_Type::escape($_GET['name'], 'String'));
     $name = str_replace('*', '%', $name);
     require_once 'CRM/Contact/BAO/Relationship.php';
     $elements = CRM_Contact_BAO_Relationship::getPermissionedEmployer($cid, $name);
     if (!empty($elements)) {
         foreach ($elements as $cid => $name) {
             echo $element = $name['name'] . "|{$cid}\n";
         }
     }
     exit;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:17,代码来源:AJAX.php

示例5: getPermissionedEmployer

 /**
  * Function to obtain list of permissioned employer for the given contact-id.
  */
 static function getPermissionedEmployer()
 {
     $cid = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
     $name = trim(CRM_Utils_Type::escape($_GET['s'], 'String'));
     $name = str_replace('*', '%', $name);
     $elements = CRM_Contact_BAO_Relationship::getPermissionedEmployer($cid, $name);
     if (!empty($elements)) {
         foreach ($elements as $cid => $name) {
             echo $element = $name['name'] . "|{$cid}\n";
         }
     }
     CRM_Utils_System::civiExit();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:16,代码来源:AJAX.php

示例6: buildOnBehalfForm

 /**
  * Function to build form for related contacts / on behalf of organization.
  * 
  * @param $form              object  invoking Object
  * @param $contactType       string  contact type
  * @param $title             string  fieldset title
  * @param $maxLocationBlocks int     number of location blocks
  * 
  * @static
  *
  */
 static function buildOnBehalfForm(&$form, $contactType = 'Individual', $countryID = null, $stateID = null, $title = 'Contact Information', $contactEditMode = false, $maxLocationBlocks = 1)
 {
     if ($title == 'Contact Information') {
         $title = ts('Contact Information');
     }
     require_once 'CRM/Contact/Form/Location.php';
     $config = CRM_Core_Config::singleton();
     $form->assign('contact_type', $contactType);
     $form->assign('fieldSetTitle', $title);
     $form->assign('contactEditMode', $contactEditMode);
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
     switch ($contactType) {
         case 'Organization':
             $session = CRM_Core_Session::singleton();
             $contactID = $session->get('userID');
             if ($contactID) {
                 require_once 'CRM/Contact/BAO/Relationship.php';
                 $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID);
             }
             if (!$contactEditMode && $contactID && count($employers) >= 1) {
                 $locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', "cid=", false, null, false);
                 $form->assign('locDataURL', $locDataURL);
                 $dataURL = CRM_Utils_System::url('civicrm/ajax/employer', "cid=" . $contactID, false, null, false);
                 $form->assign('employerDataURL', $dataURL);
                 $form->add('text', 'organization_id', ts('Select an existing related Organization OR Enter a new one'));
                 $form->add('hidden', 'onbehalfof_id', '', array('id' => 'onbehalfof_id'));
                 $orgOptions = array('0' => ts('Create new organization'), '1' => ts('Select existing organization'));
                 $orgOptionExtra = array('onclick' => "showHideByValue('org_option','true','select_org','table-row','radio',true);showHideByValue('org_option','true','create_org','table-row','radio',false);");
                 $form->addRadio('org_option', ts('options'), $orgOptions, $orgOptionExtra);
                 $form->assign('relatedOrganizationFound', true);
             }
             $isRequired = false;
             if (CRM_Utils_Array::value('is_for_organization', $form->_values) == 2) {
                 $isRequired = true;
             }
             $form->add('text', 'organization_name', ts('Organization Name'), $attributes['organization_name'], $isRequired);
             break;
         case 'Household':
             $form->add('text', 'household_name', ts('Household Name'), $attributes['household_name']);
             break;
         default:
             // individual
             $form->addElement('select', 'prefix_id', ts('Prefix'), array('' => ts('- prefix -')) + CRM_Core_PseudoConstant::individualPrefix());
             $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
             $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
             $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
             $form->addElement('select', 'suffix_id', ts('Suffix'), array('' => ts('- suffix -')) + CRM_Core_PseudoConstant::individualSuffix());
     }
     $addressSequence = $config->addressSequence();
     $form->assign('addressSequence', array_fill_keys($addressSequence, 1));
     //Primary Phone
     $form->addElement('text', "phone[1][phone]", ts('Primary Phone'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
     //Primary Email
     $form->addElement('text', "email[1][email]", ts('Primary Email'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'));
     //build the address block
     require_once 'CRM/Contact/Form/Edit/Address.php';
     CRM_Contact_Form_Edit_Address::buildQuickForm($form);
     // also fix the state country selector
     CRM_Contact_Form_Edit_Address::fixStateSelect($form, "address[1][country_id]", "address[1][state_province_id]", $countryID);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:71,代码来源:Utils.php

示例7: getPermissionedLocation

 /**
  * FIXME: we should make this method like getLocBlock() OR use the same method and
  * remove this one.
  *
  * Function to obtain the location of given contact-id.
  * This method is used by on-behalf-of form to dynamically generate poulate the
  * location field values for selected permissioned contact.
  */
 static function getPermissionedLocation()
 {
     $cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject, TRUE);
     $ufId = CRM_Utils_Request::retrieve('ufId', 'Integer', CRM_Core_DAO::$_nullObject, TRUE);
     // Verify user id
     $user = CRM_Utils_Request::retrieve('uid', 'Integer', CRM_Core_DAO::$_nullObject, FALSE, CRM_Core_Session::singleton()->get('userID'));
     if (empty($user) || CRM_Utils_Request::retrieve('cs', 'String', $form, FALSE) && !CRM_Contact_BAO_Contact_Permission::validateChecksumContact($user, CRM_Core_DAO::$_nullObject, FALSE)) {
         CRM_Utils_System::civiExit();
     }
     // Verify user permission on related contact
     $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($user);
     if (!isset($employers[$cid])) {
         CRM_Utils_System::civiExit();
     }
     $values = array();
     $entityBlock = array('contact_id' => $cid);
     $location = CRM_Core_BAO_Location::getValues($entityBlock);
     $config = CRM_Core_Config::singleton();
     $addressSequence = array_flip($config->addressSequence());
     $profileFields = CRM_Core_BAO_UFGroup::getFields($ufId, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL);
     $website = CRM_Core_BAO_Website::getValues($entityBlock, $values);
     foreach ($location as $fld => $values) {
         if (is_array($values) && !empty($values)) {
             $locType = $values[1]['location_type_id'];
             if ($fld == 'email') {
                 $elements["onbehalf_{$fld}-{$locType}"] = array('type' => 'Text', 'value' => $location[$fld][1][$fld]);
                 unset($profileFields["{$fld}-{$locType}"]);
             } elseif ($fld == 'phone') {
                 $phoneTypeId = $values[1]['phone_type_id'];
                 $elements["onbehalf_{$fld}-{$locType}-{$phoneTypeId}"] = array('type' => 'Text', 'value' => $location[$fld][1][$fld]);
                 unset($profileFields["{$fld}-{$locType}-{$phoneTypeId}"]);
             } elseif ($fld == 'im') {
                 $providerId = $values[1]['provider_id'];
                 $elements["onbehalf_{$fld}-{$locType}"] = array('type' => 'Text', 'value' => $location[$fld][1][$fld]);
                 $elements["onbehalf_{$fld}-{$locType}provider_id"] = array('type' => 'Select', 'value' => $location[$fld][1]['provider_id']);
                 unset($profileFields["{$fld}-{$locType}-{$providerId}"]);
             }
         }
     }
     if (!empty($website)) {
         foreach ($website as $key => $val) {
             $websiteTypeId = $values[1]['website_type_id'];
             $elements["onbehalf_url-1"] = array('type' => 'Text', 'value' => $website[1]['url']);
             $elements["onbehalf_url-1-website_type_id"] = array('type' => 'Select', 'value' => $website[1]['website_type_id']);
             unset($profileFields["url-1"]);
         }
     }
     $locTypeId = isset($location['address'][1]) ? $location['address'][1]['location_type_id'] : NULL;
     $addressFields = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'country', 'state_province');
     foreach ($addressFields as $field) {
         if (array_key_exists($field, $addressSequence)) {
             $addField = $field;
             if (in_array($field, array('state_province', 'country'))) {
                 $addField = "{$field}_id";
             }
             $elements["onbehalf_{$field}-{$locTypeId}"] = array('type' => 'Text', 'value' => isset($location['address'][1]) ? $location['address'][1][$addField] : null);
             unset($profileFields["{$field}-{$locTypeId}"]);
         }
     }
     //set custom field defaults
     $defaults = array();
     CRM_Core_BAO_UFGroup::setProfileDefaults($cid, $profileFields, $defaults, TRUE, NULL, NULL, TRUE);
     if (!empty($defaults)) {
         foreach ($profileFields as $key => $val) {
             if (array_key_exists($key, $defaults)) {
                 $htmlType = CRM_Utils_Array::value('html_type', $val);
                 if ($htmlType == 'Radio') {
                     $elements["onbehalf[{$key}]"]['type'] = $htmlType;
                     $elements["onbehalf[{$key}]"]['value'] = $defaults[$key];
                 } elseif ($htmlType == 'CheckBox') {
                     foreach ($defaults[$key] as $k => $v) {
                         $elements["onbehalf[{$key}][{$k}]"]['type'] = $htmlType;
                         $elements["onbehalf[{$key}][{$k}]"]['value'] = $v;
                     }
                 } elseif ($htmlType == 'Multi-Select') {
                     foreach ($defaults[$key] as $k => $v) {
                         $elements["onbehalf_{$key}"]['type'] = $htmlType;
                         $elements["onbehalf_{$key}"]['value'][$k] = $v;
                     }
                 } elseif ($htmlType == 'Autocomplete-Select') {
                     $elements["onbehalf_{$key}"]['type'] = $htmlType;
                     $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
                     $elements["onbehalf_{$key}"]['id'] = $defaults["{$key}_id"];
                 } else {
                     $elements["onbehalf_{$key}"]['type'] = $htmlType;
                     $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
                 }
             } else {
                 $elements["onbehalf_{$key}"]['value'] = '';
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:Location.php

示例8: preProcess

 /** 
  * Function to set variables up before form is built 
  *                                                           
  * @return void 
  * @access public 
  */
 public function preProcess()
 {
     $config = CRM_Core_Config::singleton();
     $session = CRM_Core_Session::singleton();
     // current contribution page id
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if (!$this->_id) {
         $pastContributionID = $session->get('pastContributionID');
         if (!$pastContributionID) {
             CRM_Core_Error::fatal(ts('We can\'t load the requested web page due to an incomplete link. This can be caused by using your browser\'s Back button or by using an incomplete or invalid link.'));
         } else {
             CRM_Core_Error::fatal(ts('This contribution has already been submitted. Click <a href=\'%1\'>here</a> if you want to make another contribution.', array(1 => CRM_Utils_System::url('civicrm/contribute/transact', 'reset=1&id=' . $pastContributionID))));
         }
     } else {
         $session->set('pastContributionID', $this->_id);
     }
     $this->_userID = $session->get('userID');
     $this->_mid = null;
     if ($this->_userID) {
         $this->_mid = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
         if ($this->_mid) {
             require_once 'CRM/Member/DAO/Membership.php';
             $membership = new CRM_Member_DAO_Membership();
             $membership->id = $this->_mid;
             if ($membership->find(true)) {
                 $this->_defaultMemTypeId = $membership->membership_type_id;
                 if ($membership->contact_id != $this->_userID) {
                     require_once 'CRM/Contact/BAO/Relationship.php';
                     $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID);
                     if (array_key_exists($membership->contact_id, $employers)) {
                         $this->_membershipContactID = $membership->contact_id;
                         $this->assign('membershipContactID', $this->_membershipContactID);
                         $this->assign('membershipContactName', $employers[$this->_membershipContactID]['name']);
                     } else {
                         CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."));
                     }
                 }
             } else {
                 CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."));
             }
             unset($membership);
         }
     }
     // we do not want to display recently viewed items, so turn off
     $this->assign('displayRecent', false);
     // Contribution page values are cleared from session, so can't use normal Printer Friendly view.
     // Use Browser Print instead.
     $this->assign('browserPrint', true);
     // action
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'add');
     $this->assign('action', $this->_action);
     // current mode
     $this->_mode = $this->_action == 1024 ? 'test' : 'live';
     $this->_values = $this->get('values');
     $this->_fields = $this->get('fields');
     $this->_bltID = $this->get('bltID');
     $this->_paymentProcessor = $this->get('paymentProcessor');
     $this->_priceSetId = $this->get('priceSetId');
     $this->_priceSet = $this->get('priceSet');
     if (!$this->_values) {
         // get all the values from the dao object
         $this->_values = array();
         $this->_fields = array();
         require_once 'CRM/Contribute/BAO/ContributionPage.php';
         CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
         // check if form is active
         if (!$this->_values['is_active']) {
             // form is inactive, die a fatal death
             CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
         }
         // also check for billing informatin
         // get the billing location type
         $locationTypes =& CRM_Core_PseudoConstant::locationType();
         $this->_bltID = array_search('Billing', $locationTypes);
         if (!$this->_bltID) {
             CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
         }
         $this->set('bltID', $this->_bltID);
         // check for is_monetary status
         $isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values);
         $isPayLater = CRM_Utils_Array::value('is_pay_later', $this->_values);
         if ($isMonetary && (!$isPayLater || CRM_Utils_Array::value('payment_processor_id', $this->_values))) {
             $ppID = CRM_Utils_Array::value('payment_processor_id', $this->_values);
             if (!$ppID) {
                 CRM_Core_Error::fatal(ts('A payment processor must be selected for this contribution page (contact the site administrator for assistance).'));
             }
             require_once 'CRM/Core/BAO/PaymentProcessor.php';
             $this->_paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
             // check selected payment processor is active
             if (empty($this->_paymentProcessor)) {
                 CRM_Core_Error::fatal(ts('A payment processor configured for this page might be disabled (contact the site administrator for assistance).'));
             }
             // ensure that processor has a valid config
             $this->_paymentObject =& CRM_Core_Payment::singleton($this->_mode, $this->_paymentProcessor, $this);
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:ContributionBase.php

示例9: getPermissionedEmployer

 /**
  * Function to obtain list of permissioned employer for the given contact-id.
  */
 static function getPermissionedEmployer()
 {
     $cid = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
     $name = trim(CRM_Utils_Type::escape($_GET['s'], 'String'));
     $name = str_replace('*', '%', $name);
     $elements = CRM_Contact_BAO_Relationship::getPermissionedEmployer($cid, $name);
     $results = array();
     if (!empty($elements)) {
         foreach ($elements as $cid => $name) {
             $results[$cid] = $name['name'];
         }
     }
     CRM_Core_Page_AJAX::autocompleteResults($results);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:17,代码来源:AJAX.php


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