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


PHP CRM_Core_Form::getVar方法代码示例

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


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

示例1: process

 /**
  * @param CRM_Core_Form $form
  *
  * @return array
  */
 public static function process(&$form)
 {
     if ($form->getVar('_surveyId') <= 0) {
         return NULL;
     }
     $tabs = array('main' => array('title' => ts('Main Information'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'questions' => array('title' => ts('Questions'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'results' => array('title' => ts('Results'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE));
     $surveyID = $form->getVar('_surveyId');
     $class = $form->getVar('_name');
     $class = CRM_Utils_String::getClassName($class);
     $class = strtolower($class);
     if (array_key_exists($class, $tabs)) {
         $tabs[$class]['current'] = TRUE;
         $qfKey = $form->get('qfKey');
         if ($qfKey) {
             $tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
         }
     }
     if ($surveyID) {
         $reset = !empty($_GET['reset']) ? 'reset=1&' : '';
         foreach ($tabs as $key => $value) {
             if (!isset($tabs[$key]['qfKey'])) {
                 $tabs[$key]['qfKey'] = NULL;
             }
             $tabs[$key]['link'] = CRM_Utils_System::url("civicrm/survey/configure/{$key}", "{$reset}action=update&id={$surveyID}{$tabs[$key]['qfKey']}");
             $tabs[$key]['active'] = $tabs[$key]['valid'] = TRUE;
         }
     }
     return $tabs;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:34,代码来源:TabHeader.php

示例2: process

 /**
  * @param CRM_Core_Form $form
  *
  * @return array
  */
 public static function process(&$form)
 {
     if ($form->getVar('_id') <= 0) {
         return NULL;
     }
     $tabs = array('settings' => array('title' => ts('Title'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'amount' => array('title' => ts('Amounts'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'membership' => array('title' => ts('Memberships'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'thankyou' => array('title' => ts('Receipt'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'friend' => array('title' => ts('Tell a Friend'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'custom' => array('title' => ts('Profiles'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'premium' => array('title' => ts('Premiums'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'widget' => array('title' => ts('Widgets'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'pcp' => array('title' => ts('Personal Campaigns'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE));
     $contribPageId = $form->getVar('_id');
     CRM_Utils_Hook::tabset('civicrm/admin/contribute', $tabs, array('contribution_page_id' => $contribPageId));
     $fullName = $form->getVar('_name');
     $className = CRM_Utils_String::getClassName($fullName);
     // Hack for special cases.
     switch ($className) {
         case 'Contribute':
             $attributes = $form->getVar('_attributes');
             $class = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
             break;
         case 'MembershipBlock':
             $class = 'membership';
             break;
         default:
             $class = strtolower($className);
             break;
     }
     if (array_key_exists($class, $tabs)) {
         $tabs[$class]['current'] = TRUE;
         $qfKey = $form->get('qfKey');
         if ($qfKey) {
             $tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
         }
     }
     if ($contribPageId) {
         $reset = !empty($_GET['reset']) ? 'reset=1&' : '';
         foreach ($tabs as $key => $value) {
             if (!isset($tabs[$key]['qfKey'])) {
                 $tabs[$key]['qfKey'] = NULL;
             }
             $tabs[$key]['link'] = CRM_Utils_System::url("civicrm/admin/contribute/{$key}", "{$reset}action=update&id={$contribPageId}{$tabs[$key]['qfKey']}");
             $tabs[$key]['active'] = $tabs[$key]['valid'] = TRUE;
         }
         //get all section info.
         $contriPageInfo = CRM_Contribute_BAO_ContributionPage::getSectionInfo(array($contribPageId));
         foreach ($contriPageInfo[$contribPageId] as $section => $info) {
             if (!$info) {
                 $tabs[$section]['valid'] = FALSE;
             }
         }
     }
     return $tabs;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:54,代码来源:TabHeader.php

示例3: _volunteer_civicrm_buildForm_CRM_Custom_Form_Field

/**
 * Delegated implementation of hook_civicrm_buildForm
 *
 * Customizes the UI for adding custom fields to allow the user to specify whether
 * a multi-select field should use the slider widget or not
 */
function _volunteer_civicrm_buildForm_CRM_Custom_Form_Field($formName, CRM_Core_Form &$form)
{
    // set default value for the checkbox
    $field_id = $form->getVar('_id');
    $widgetized_fields = _volunteer_get_slider_fields();
    $form->_defaultValues['is_slider_widget'] = in_array($field_id, $widgetized_fields);
    // add checkbox to the form object
    $form->add('checkbox', 'is_slider_widget', ts('Use Slider Selector?'));
    // add checkbox to the display
    CRM_Core_Region::instance('page-body')->add(array('template' => 'Slider/CRM/Custom/Form/Field.tpl'));
    // reposition and show/hide checkbox
    CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.volunteer', 'js/CRM_Custom_Form_Field.js');
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:19,代码来源:volunteer.slider.php

示例4: _securefiles_civicrm_buildForm_CRM_Custom_Form_Field

/**
 * Delegated implementation of hook_civicrm_buildForm
 *
 * Customizes the UI for adding custom fields to allow the user to specify whether
 * this field should be handled by the secure file extension
 */
function _securefiles_civicrm_buildForm_CRM_Custom_Form_Field($formName, CRM_Core_Form &$form)
{
    // set default value for the checkbox
    $field_id = $form->getVar('_id');
    $enabled_fields = _securefiles_get_secure_enabled_fields();
    $form->_defaultValues['use_securefiles'] = in_array($field_id, $enabled_fields);
    // add checkbox to the form object
    $form->add('checkbox', 'use_securefiles', ts('Store using SecureFiles'));
    // add checkbox/settings form to the display
    CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Securefiles/Form/CustomField.tpl'));
    $secureFileElements = array();
    //Let the Backend service add fields if it wants/needs to
    $backendService = CRM_Securefiles_Backend::getBackendService();
    if ($backendService) {
        $backendService->buildFieldSettingsForm($form, $secureFileElements);
    }
    //Assign our custom field names to the form so the template can render them.
    $form->assign("secureFileElements", $secureFileElements);
    // reposition and show/hide checkbox
    CRM_Core_Resources::singleton()->addScriptFile('com.ginkgostreet.securefiles', 'js/CRM_Custom_Form_Field.js');
}
开发者ID:ginkgostreet,项目名称:com.ginkgostreet.securefiles,代码行数:27,代码来源:securefiles.widget.php

示例5: menufontawesome_civicrm_buildForm

/**
 * Implements hook_civicrm_buildForm().
 *
 * Set a default value for an event price set field.
 *
 * @param string $formName
 * @param CRM_Core_Form $form
 */
function menufontawesome_civicrm_buildForm($formName, &$form)
{
    if ($formName == 'CRM_Admin_Form_Navigation') {
        CRM_Core_Resources::singleton()->addStyleFile('com.opetmar.menufontawesome', 'resources/plugins/bootstrap/css/bootstrap.css', 0, 'html-header');
        CRM_Core_Resources::singleton()->addStyleFile('com.opetmar.menufontawesome', 'resources/plugins/fontawesome-iconpicker/css/fontawesome-iconpicker.min.css', 0, 'html-header');
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/plugins/jquery-1.11.3.min.js', 0);
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/plugins/bootstrap/js/bootstrap.min.js', 1);
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/plugins/fontawesome-iconpicker/js/fontawesome-iconpicker.min.js', 2);
        CRM_Core_Resources::singleton()->addScriptFile('com.opetmar.menufontawesome', 'resources/main.js', 3);
        // Add the field element in the form
        if ($form->getAction() == CRM_Core_Action::UPDATE) {
            $id = $form->getVar('_id');
            $fa_icon = CRM_Menufontawesome_BAO_Navigation::getIcon($id);
            $form->add('text', 'fa_icon', ts('Icon'), array('value' => $fa_icon));
        } else {
            $form->add('text', 'fa_icon', ts('Icon'), array('value' => ''));
        }
        $templatePath = realpath(dirname(__FILE__) . "/templates/CRM/Menufontawesome/Page");
        // dynamically insert a template block in the page
        CRM_Core_Region::instance('page-body')->add(array('template' => "{$templatePath}/fa_icon.tpl"));
    }
}
开发者ID:omarabuhussein,项目名称:com.opetmar.menufontawesome,代码行数:30,代码来源:menufontawesome.php

示例6: postProcess

 /**
  * Post process function.
  *
  * @param CRM_Core_Form $form
  * @param bool $redirect
  */
 public static function postProcess(&$form, $redirect = TRUE)
 {
     $params = $form->getVar('_params');
     $instanceID = $form->getVar('_id');
     if ($isNew = $form->getVar('_createNew')) {
         // set the report_id since base template is going to be same, and we going to unset $instanceID
         // which will make it difficult later on, to compute report_id
         $params['report_id'] = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
         // Unset $instanceID so a new copy would be created.
         $instanceID = NULL;
     }
     $params['instance_id'] = $instanceID;
     if (!empty($params['is_navigation'])) {
         $params['navigation'] = $form->_navigation;
     } elseif ($instanceID) {
         // Delete navigation if exists.
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceID, 'navigation_id', 'id');
         if ($navId) {
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
     }
     // make a copy of params
     $formValues = $params;
     // unset params from $formValues that doesn't match with DB columns of instance tables, and also not required in form-values for sure
     $unsetFields = array('title', 'to_emails', 'cc_emails', 'header', 'footer', 'qfKey', 'id', '_qf_default', 'report_header', 'report_footer', 'grouprole');
     foreach ($unsetFields as $field) {
         unset($formValues[$field]);
     }
     $view_mode = $formValues['view_mode'];
     // pass form_values as string
     $params['form_values'] = serialize($formValues);
     $instance = CRM_Report_BAO_ReportInstance::create($params);
     $form->set('id', $instance->id);
     if ($instanceID && !$isNew) {
         // updating existing instance
         $statusMsg = ts('"%1" report has been updated.', array(1 => $instance->title));
     } elseif ($form->getVar('_id') && $isNew) {
         $statusMsg = ts('Your report has been successfully copied as "%1". You are currently viewing the new copy.', array(1 => $instance->title));
     } else {
         $statusMsg = ts('"%1" report has been successfully created. You are currently viewing the new report instance.', array(1 => $instance->title));
     }
     CRM_Core_Session::setStatus($statusMsg);
     if ($redirect) {
         $urlParams = array('reset' => 1);
         if ($view_mode == 'view') {
             $urlParams['force'] = 1;
         } else {
             $urlParams['output'] = 'criteria';
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/report/instance/{$instance->id}", $urlParams));
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:59,代码来源:Instance.php

示例7: cividiscount_civicrm_buildAmount

/**
 * Implementation of hook_civicrm_buildAmount()
 *
 * If the event id of the form being loaded has a discount code, calculate the
 * the discount and update the price and label. Apply the initial autodiscount
 * based on a users membership.
 *
 * Check all priceset items and only apply the discount to the discounted items.
 *
 * @param string $pageType
 * @param CRM_Core_Form $form
 * @param $amounts
 */
function cividiscount_civicrm_buildAmount($pagetype, &$form, &$amounts)
{
    if ((!$form->getVar('_action') || $form->getVar('_action') & CRM_Core_Action::PREVIEW || $form->getVar('_action') & CRM_Core_Action::ADD || $form->getVar('_action') & CRM_Core_Action::UPDATE) && !empty($amounts) && is_array($amounts) && ($pagetype == 'event' || $pagetype == 'membership')) {
        if (!$pagetype == 'membership' && in_array(get_class($form), array('CRM_Contribute_Form_Contribution', 'CRM_Contribute_Form_Contribution_Main'))) {
            return;
        }
        // // Don't provide Discount if the logged in user already subscribed to any membership types in the form
        $currentMemberships = $form->_currentMemberships;
        //if logged in
        if (!empty($currentMemberships)) {
            $new_member = FALSE;
        } else {
            // if not logged in
            $new_member = validate_email_for_discount($form);
        }
        /*
        Check if a payment type is set for discounts
        */
        $payids = array();
        $payids = _cividiscount_get_discounted_paymentProcessor_type_ids();
        $selectedProcessorValue = $form->_paymentProcessor['payment_processor_type_id'];
        $contact_id = _cividiscount_get_form_contact_id($form);
        $autodiscount = FALSE;
        $eid = $form->getVar('_eventId');
        $psid = $form->get('priceSetId');
        $ps = $form->get('priceSet');
        $v = $form->getVar('_values');
        $code = trim(CRM_Utils_Request::retrieve('discountcode', 'String', $form, false, null, 'REQUEST'));
        if (!array_key_exists('discountcode', $form->_submitValues) && ($pid = $form->getVar('_participantId')) && $form->getVar('_action') & CRM_Core_Action::UPDATE) {
            $code = _cividiscount_get_item_by_track('civicrm_participant', $pid, $contact_id, TRUE);
        }
        if (!empty($v['currency'])) {
            $currency = $v['currency'];
        } elseif (!empty($v['event']['currency'])) {
            $currency = $v['event']['currency'];
        } else {
            $currency = CRM_Core_Config::singleton()->defaultCurrency;
        }
        // If additional participants are not allowed to receive a discount we need
        // to interrupt the form processing on build and POST.
        // This is a potential landmine if the form processing ever changes in Civi.
        if (!_cividiscount_allow_multiple()) {
            // POST from participant form to confirm page
            if ($form->getVar('_lastParticipant') == 1) {
                return;
            }
            // On build participant form
            $keys = array_keys($_GET);
            foreach ($keys as $key) {
                if (substr($key, 0, 16) == "_qf_Participant_") {
                    // We can somewhat safely assume we're in the additional participant
                    // registration form.
                    // @todo what is the effect of this?
                    if ($_GET[$key] == 'true') {
                        return;
                    }
                }
            }
        }
        if (!$new_member && !empty($code)) {
            echo "Sorry! Discount is not applicable for renewal!";
            return;
        }
        if (!empty($payids) && !empty($code)) {
            if (!in_array($selectedProcessorValue, $payids)) {
                echo "Sorry! Discount is only applicable for Direct Debit!";
                return;
            }
        }
        $form->set('_discountInfo', NULL);
        $dicountCalculater = new CRM_CiviDiscount_DiscountCalculator($pagetype, $eid, $contact_id, $code, FALSE);
        $discounts = $dicountCalculater->getDiscounts();
        if (!empty($code)) {
            if (empty($discounts)) {
                $form->set('discountCodeErrorMsg', ts('The discount code you entered is invalid.'));
            } else {
                /*gets discounts info, even if a discount code is not applicable 
                  for the membership types in the current form */
                // Check if a discount code is applicable to any of the membership types in the form
                $membership_ids_in_form = membership_type_ids_in_form($form);
                $membership_ids_in_dicount_info = array();
                foreach ($discounts as $code => $discount) {
                    $membership_ids_in_dicount_info = $discount['memberships'];
                }
                if (count(array_intersect($membership_ids_in_dicount_info, $membership_ids_in_form)) == 0) {
                    $form->set('discountCodeErrorMsg', ts('The discount code you entered is invalid.'));
                }
//.........这里部分代码省略.........
开发者ID:krishgopi,项目名称:org.civicrm.module.cividiscount,代码行数:101,代码来源:cividiscount.php

示例8: initSet

 /**
  * Initiate price set such that various non-BAO things are set on the form.
  *
  * This function is not really a BAO function so the location is misleading.
  *
  * @param CRM_Core_Form $form
  * @param int $id
  *   Form entity id.
  * @param string $entityTable
  * @param bool $validOnly
  * @param int $priceSetId
  *   Price Set ID
  *
  * @return bool|false|int|null
  */
 public static function initSet(&$form, $id, $entityTable = 'civicrm_event', $validOnly = FALSE, $priceSetId = NULL)
 {
     if (!$priceSetId) {
         $priceSetId = self::getFor($entityTable, $id);
     }
     //check if priceset is is_config
     if (is_numeric($priceSetId)) {
         if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config') && $form->getVar('_name') != 'Participant') {
             $form->assign('quickConfig', 1);
         }
     }
     // get price info
     if ($priceSetId) {
         if ($form->_action & CRM_Core_Action::UPDATE) {
             $entityId = $entity = NULL;
             switch ($entityTable) {
                 case 'civicrm_event':
                     $entity = 'participant';
                     if (CRM_Utils_System::getClassName($form) == 'CRM_Event_Form_Participant') {
                         $entityId = $form->_id;
                     } else {
                         $entityId = $form->_participantId;
                     }
                     break;
                 case 'civicrm_contribution_page':
                 case 'civicrm_contribution':
                     $entity = 'contribution';
                     $entityId = $form->_id;
                     break;
             }
             if ($entityId && $entity) {
                 $form->_values['line_items'] = CRM_Price_BAO_LineItem::getLineItems($entityId, $entity);
             }
             $required = FALSE;
         } else {
             $required = TRUE;
         }
         $form->_priceSetId = $priceSetId;
         $priceSet = self::getSetDetail($priceSetId, $required, $validOnly);
         $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
         $form->_values['fee'] = CRM_Utils_Array::value('fields', $form->_priceSet);
         //get the price set fields participant count.
         if ($entityTable == 'civicrm_event') {
             //get option count info.
             $form->_priceSet['optionsCountTotal'] = self::getPricesetCount($priceSetId);
             if ($form->_priceSet['optionsCountTotal']) {
                 $optionsCountDeails = array();
                 if (!empty($form->_priceSet['fields'])) {
                     foreach ($form->_priceSet['fields'] as $field) {
                         foreach ($field['options'] as $option) {
                             $count = CRM_Utils_Array::value('count', $option, 0);
                             $optionsCountDeails['fields'][$field['id']]['options'][$option['id']] = $count;
                         }
                     }
                 }
                 $form->_priceSet['optionsCountDetails'] = $optionsCountDeails;
             }
             //get option max value info.
             $optionsMaxValueTotal = 0;
             $optionsMaxValueDetails = array();
             if (!empty($form->_priceSet['fields'])) {
                 foreach ($form->_priceSet['fields'] as $field) {
                     foreach ($field['options'] as $option) {
                         $maxVal = CRM_Utils_Array::value('max_value', $option, 0);
                         $optionsMaxValueDetails['fields'][$field['id']]['options'][$option['id']] = $maxVal;
                         $optionsMaxValueTotal += $maxVal;
                     }
                 }
             }
             $form->_priceSet['optionsMaxValueTotal'] = $optionsMaxValueTotal;
             if ($optionsMaxValueTotal) {
                 $form->_priceSet['optionsMaxValueDetails'] = $optionsMaxValueDetails;
             }
         }
         $form->set('priceSetId', $form->_priceSetId);
         $form->set('priceSet', $form->_priceSet);
         return $priceSetId;
     }
     return FALSE;
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:95,代码来源:PriceSet.php

示例9: buildQuickform

 /**
  * Build the payment processor form.
  *
  * @param CRM_Core_Form $form
  */
 public static function buildQuickform(&$form)
 {
     //@todo document why this addHidden is here
     //CRM-15743 - we should not set/create hidden element for pay later
     // because payment processor is not selected
     $processorId = $form->getVar('_paymentProcessorID');
     $billing_profile_id = CRM_Utils_Request::retrieve('billing_profile_id', 'String');
     if (!empty($form->_values) && !empty($form->_values['is_billing_required'])) {
         $billing_profile_id = 'billing';
     }
     if (!empty($processorId)) {
         $form->addElement('hidden', 'hidden_processor', 1);
     }
     CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, $billing_profile_id, FALSE);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:20,代码来源:ProcessorForm.php

示例10: buildPriceSet

 /**
  * Build the price set form.
  *
  * @param CRM_Core_Form $form
  *
  * @return void
  */
 public static function buildPriceSet(&$form)
 {
     $priceSetId = $form->get('priceSetId');
     $userid = $form->getVar('_userID');
     if (!$priceSetId) {
         return;
     }
     $validFieldsOnly = TRUE;
     $className = CRM_Utils_System::getClassName($form);
     if (in_array($className, array('CRM_Contribute_Form_Contribution', 'CRM_Member_Form_Membership'))) {
         $validFieldsOnly = FALSE;
     }
     $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly);
     $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
     $form->_quickConfig = $quickConfig = 0;
     if (CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set', $priceSetId, 'is_quick_config')) {
         $quickConfig = 1;
     }
     $form->assign('quickConfig', $quickConfig);
     if ($className == "CRM_Contribute_Form_Contribution_Main") {
         $form->_quickConfig = $quickConfig;
     }
     $form->assign('priceSet', $form->_priceSet);
     $component = 'contribution';
     if ($className == 'CRM_Member_Form_Membership') {
         $component = 'membership';
     }
     if ($className == 'CRM_Contribute_Form_Contribution_Main') {
         $feeBlock =& $form->_values['fee'];
         if (!empty($form->_useForMember)) {
             $component = 'membership';
         }
     } else {
         $feeBlock =& $form->_priceSet['fields'];
     }
     // call the hook.
     CRM_Utils_Hook::buildAmount($component, $form, $feeBlock);
     foreach ($feeBlock as $field) {
         if (CRM_Utils_Array::value('visibility', $field) == 'public' || !$validFieldsOnly) {
             $options = CRM_Utils_Array::value('options', $field);
             if ($className == 'CRM_Contribute_Form_Contribution_Main' && ($component = 'membership')) {
                 $checklifetime = self::checkCurrentMembership($options, $userid);
                 if ($checklifetime) {
                     $form->assign('ispricelifetime', TRUE);
                 }
             }
             if (!is_array($options)) {
                 continue;
             }
             CRM_Upgrade_Snapshot_V4p2_Price_BAO_Field::addQuickFormElement($form, 'price_' . $field['id'], $field['id'], FALSE, CRM_Utils_Array::value('is_required', $field, FALSE), NULL, $options);
         }
     }
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:60,代码来源:Set.php

示例11: buildPriceSet

 /**
  * Function to build the price set form.
  *
  * @param CRM_Core_Form $form
  *
  * @return void
  * @access public
  */
 static function buildPriceSet(&$form)
 {
     $priceSetId = $form->get('priceSetId');
     $userid = $form->getVar('_userID');
     if (!$priceSetId) {
         return;
     }
     $validFieldsOnly = TRUE;
     $className = CRM_Utils_System::getClassName($form);
     if (in_array($className, array('CRM_Contribute_Form_Contribution', 'CRM_Member_Form_Membership'))) {
         $validFieldsOnly = FALSE;
     }
     $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly);
     $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
     $validPriceFieldIds = array_keys($form->_priceSet['fields']);
     $form->_quickConfig = $quickConfig = 0;
     if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) {
         $quickConfig = 1;
     }
     $form->assign('quickConfig', $quickConfig);
     if ($className == 'CRM_Contribute_Form_Contribution_Main') {
         $form->_quickConfig = $quickConfig;
     }
     $form->assign('priceSet', $form->_priceSet);
     $component = 'contribution';
     if ($className == 'CRM_Member_Form_Membership') {
         $component = 'membership';
     }
     if ($className == 'CRM_Contribute_Form_Contribution_Main') {
         $feeBlock =& $form->_values['fee'];
         if (!empty($form->_useForMember)) {
             $component = 'membership';
         }
     } else {
         $feeBlock =& $form->_priceSet['fields'];
     }
     // call the hook.
     CRM_Utils_Hook::buildAmount($component, $form, $feeBlock);
     // CRM-14492 Admin price fields should show up on event registration if user has 'administer CiviCRM' permissions
     $adminFieldVisible = false;
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $adminFieldVisible = true;
     }
     foreach ($feeBlock as $id => $field) {
         if (CRM_Utils_Array::value('visibility', $field) == 'public' || CRM_Utils_Array::value('visibility', $field) == 'admin' && $adminFieldVisible == true || !$validFieldsOnly) {
             $options = CRM_Utils_Array::value('options', $field);
             if ($className == 'CRM_Contribute_Form_Contribution_Main' && ($component = 'membership')) {
                 $checklifetime = self::checkCurrentMembership($options, $userid);
                 if ($checklifetime) {
                     $form->assign('ispricelifetime', TRUE);
                 }
             }
             if (!is_array($options) || !in_array($id, $validPriceFieldIds)) {
                 continue;
             }
             CRM_Price_BAO_PriceField::addQuickFormElement($form, 'price_' . $field['id'], $field['id'], FALSE, CRM_Utils_Array::value('is_required', $field, FALSE), NULL, $options);
         }
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:67,代码来源:PriceSet.php

示例12: buildQuickform

 /**
  * Build the payment processor form.
  *
  * @param CRM_Core_Form $form
  */
 public static function buildQuickform(&$form)
 {
     //@todo document why this addHidden is here
     //CRM-15743 - we should not set/create hidden element for pay later
     // because payment processor is not selected
     $processorId = $form->getVar('_paymentProcessorID');
     $isBillingAddressRequiredForPayLater = $form->_isBillingAddressRequiredForPayLater;
     if (!empty($processorId)) {
         $isBillingAddressRequiredForPayLater = FALSE;
         $form->addElement('hidden', 'hidden_processor', 1);
     }
     CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, empty($isBillingAddressRequiredForPayLater), FALSE);
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:18,代码来源:ProcessorForm.php


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