當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Event_BAO_Participant::priceSetOptionsCount方法代碼示例

本文整理匯總了PHP中CRM_Event_BAO_Participant::priceSetOptionsCount方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Event_BAO_Participant::priceSetOptionsCount方法的具體用法?PHP CRM_Event_BAO_Participant::priceSetOptionsCount怎麽用?PHP CRM_Event_BAO_Participant::priceSetOptionsCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Event_BAO_Participant的用法示例。


在下文中一共展示了CRM_Event_BAO_Participant::priceSetOptionsCount方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: formatFieldsForOptionFull

 public static function formatFieldsForOptionFull(&$form)
 {
     $priceSet = $form->get('priceSet');
     $priceSetId = $form->get('priceSetId');
     if (!$priceSetId || !is_array($priceSet) || empty($priceSet) || !CRM_Utils_Array::value('optionsMaxValueTotal', $priceSet)) {
         return;
     }
     $skipParticipants = $formattedPriceSetDefaults = array();
     if ($form->_allowConfirmation && (isset($form->_pId) || isset($form->_additionalParticipantId))) {
         $participantId = isset($form->_pId) ? $form->_pId : $form->_additionalParticipantId;
         $pricesetDefaults = CRM_Event_Form_EventFees::setDefaultPriceSet($participantId, $form->_eventId);
         // modify options full to respect the selected fields
         // options on confirmation.
         $formattedPriceSetDefaults = self::formatPriceSetParams($form, $pricesetDefaultOptions);
         // to skip current registered participants fields option count on confirmation.
         $skipParticipants[] = $form->_participantId;
         if (!empty($form->_additionalParticipantIds)) {
             $skipParticipants = array_merge($skipParticipants, $form->_additionalParticipantIds);
         }
     }
     $className = CRM_Utils_System::getClassName($form);
     //get the current price event price set options count.
     $currentOptionsCount = self::getPriceSetOptionCount($form);
     $recordedOptionsCount = CRM_Event_BAO_Participant::priceSetOptionsCount($form->_eventId, $skipParticipants);
     foreach ($form->_feeBlock as &$field) {
         $optionFullIds = array();
         $fieldId = $field['id'];
         if (!is_array($field['options'])) {
             continue;
         }
         foreach ($field['options'] as &$option) {
             $optId = $option['id'];
             $count = CRM_Utils_Array::value('count', $option, 0);
             $maxValue = CRM_Utils_Array::value('max_value', $option, 0);
             $dbTotalCount = CRM_Utils_Array::value($optId, $recordedOptionsCount, 0);
             $currentTotalCount = CRM_Utils_Array::value($optId, $currentOptionsCount, 0);
             // Do not consider current count for select field,
             // since we are not going to freeze the options.
             if ($field['html_type'] == 'Select') {
                 $totalCount = $dbTotalCount;
             } else {
                 $totalCount = $currentTotalCount + $dbTotalCount;
             }
             $isFull = FALSE;
             if ($maxValue && ($totalCount >= $maxValue || $totalCount + $count > $maxValue)) {
                 $isFull = TRUE;
                 $optionFullIds[$optId] = $optId;
             }
             //here option is not full,
             //but we don't want to allow participant to increase
             //seats at the time of re-walking registration.
             if ($count && $form->_allowConfirmation && !empty($formattedPriceSetDefaults)) {
                 if (!CRM_Utils_Array::value("price_{$field}", $formattedPriceSetDefaults) || !CRM_Utils_Array::value($opId, $formattedPriceSetDefaults["price_{$fieldId}"])) {
                     $optionFullIds[$optId] = $optId;
                     $isFull = TRUE;
                 }
             }
             $option['is_full'] = $isFull;
             $option['db_total_count'] = $dbTotalCount;
             $option['total_option_count'] = $dbTotalCount + $currentTotalCount;
         }
         //ignore option full for offline registration.
         if ($className == 'CRM_Event_Form_Participant') {
             $optionFullIds = array();
         }
         //finally get option ids in.
         $field['option_full_ids'] = $optionFullIds;
     }
 }
開發者ID:TheCraftyCanvas,項目名稱:aegir-platforms,代碼行數:69,代碼來源:Register.php


注:本文中的CRM_Event_BAO_Participant::priceSetOptionsCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。