当前位置: 首页>>代码示例>>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;未经允许,请勿转载。