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


PHP RSFormProHelper::hasCalculations方法代码示例

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


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

示例1: getFrontComponentBody


//.........这里部分代码省略.........
                             $val = str_pad($i, 2, '0', STR_PAD_LEFT);
                             break;
                         case 'MONTH_TYPE_TEXT_SHORT':
                             $val = JText::_('RSFP_CALENDAR_MONTHS_SHORT_' . $i);
                             break;
                         case 'MONTH_TYPE_TEXT_LONG':
                             $val = JText::_('RSFP_CALENDAR_MONTHS_LONG_' . $i);
                             break;
                     }
                     // selected
                     $additional = '';
                     if (isset($value[$data['NAME']]['m']) && $value[$data['NAME']]['m'] == $i) {
                         $additional .= 'selected="selected"';
                     }
                     $item .= '<option value="' . $i . '" ' . $additional . '>' . $val . '</option>';
                 }
                 $item .= '</select>';
                 $items[$month] = $item;
             }
             if ($data['SHOWYEAR'] == 'YES') {
                 $isInvalid = $invalid && empty($value[$data['NAME']]['y']);
                 $attr = $data['ADDITIONALATTRIBUTES'];
                 $className = 'rsform-select-box rsform-select-box-small';
                 if ($isInvalid) {
                     $className .= ' rsform-error';
                 }
                 RSFormProHelper::addClass($attr, $className);
                 if ($hasAllFields && $data['VALIDATION_ALLOW_INCORRECT_DATE'] == 'NO') {
                     $attr .= ' onchange="rsfp_checkValidDate(\'' . $data['NAME'] . '\');"';
                 }
                 $item = '<select name="form[' . $data['NAME'] . '][y]" id="' . $data['NAME'] . 'y" ' . $attr . ' >';
                 if (strlen($data['SHOWYEARPLEASE']) > 0) {
                     $item .= '<option value="">' . self::htmlEscape($data['SHOWYEARPLEASE']) . '</option>';
                 }
                 $start = (int) $data['STARTYEAR'];
                 $end = (int) $data['ENDYEAR'];
                 if ($start < $end) {
                     for ($i = $start; $i <= $end; $i++) {
                         // selected
                         $additional = '';
                         if (isset($value[$data['NAME']]['y']) && $value[$data['NAME']]['y'] == $i) {
                             $additional .= 'selected="selected"';
                         }
                         $item .= '<option value="' . $i . '" ' . $additional . '>' . $i . '</option>';
                     }
                 } else {
                     for ($i = $start; $i >= $end; $i--) {
                         // selected
                         $additional = '';
                         if (isset($value[$data['NAME']]['y']) && $value[$data['NAME']]['y'] == $i) {
                             $additional .= 'selected="selected"';
                         }
                         $item .= '<option value="' . $i . '" ' . $additional . '>' . $i . '</option>';
                     }
                 }
                 $item .= '</select>';
                 $items[$year] = $item;
             }
             ksort($items);
             $out .= implode($data['DATESEPARATOR'], $items);
             break;
         case 212:
         case 'gmaps':
             $doc->addScript('https://maps.google.com/maps/api/js?sensor=false');
             $mapWidth = !empty($data['MAPWIDTH']) ? $data['MAPWIDTH'] : '450px';
             $mapHeight = !empty($data['MAPHEIGHT']) ? $data['MAPHEIGHT'] : '300px';
             $geolocation = isset($data['GEOLOCATION']) && $data['GEOLOCATION'] == 'YES';
             if (isset($data['VALIDATIONRULE'])) {
                 $defaultValue = '';
             } else {
                 $defaultValue = RSFormProHelper::isCode($data['DEFAULTVALUE']);
             }
             $className = 'rsform-input-box';
             if ($invalid) {
                 $className .= ' rsform-error';
             }
             RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
             $out .= '<div id="rsform-map' . $componentId . '" style="width: ' . $mapWidth . '; height: ' . $mapHeight . ';" class="rsformMaps"></div>';
             $out .= '<br />';
             if ($geolocation) {
                 $out .= '<span style="position:relative">';
             }
             $out .= '<input autocomplete="off" type="text" value="' . (isset($value[$data['NAME']]) ? RSFormProHelper::htmlEscape($value[$data['NAME']]) : RSFormProHelper::htmlEscape($defaultValue)) . '" size="' . $data['SIZE'] . '" name="form[' . $data['NAME'] . ']" id="' . $data['NAME'] . '" ' . $data['ADDITIONALATTRIBUTES'] . '/>';
             if ($geolocation) {
                 $out .= '<ul class="rsform-map-geolocation" id="rsform_geolocation' . $componentId . '" style="display:none;"></ul>';
                 $out .= '</span>';
             }
             break;
     }
     if ($prices && RSFormProHelper::hasCalculations($formId)) {
         $jsPrices = array();
         foreach ($prices as $value => $price) {
             $jsPrices[] = "'" . addslashes($value) . "': '" . addslashes($price) . "'";
         }
         self::$prices[] = "RSFormProPrices['" . addslashes($formId . '_' . $data['NAME']) . "'] = {" . implode(', ', $jsPrices) . "};";
     }
     //Trigger Event - rsfp_bk_onAfterCreateFrontComponentBody
     $mainframe->triggerEvent('rsfp_bk_onAfterCreateFrontComponentBody', array(array('out' => &$out, 'formId' => $formId, 'componentId' => $componentId, 'data' => $data, 'value' => $value, 'r' => $r, 'invalid' => $invalid)));
     return $out;
 }
开发者ID:renekreijveld,项目名称:rsformpro-bootstrapped,代码行数:101,代码来源:rsform.php


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