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


PHP RSFormProHelper::generateMap方法代码示例

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


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

示例1: showForm


//.........这里部分代码省略.........
         $formLayout .= "\n" . '<script type="text/javascript">' . "\n" . implode("\n", $prices) . "\n" . '</script>' . "\n";
     }
     if (!empty($calendars)) {
         $formLayout .= "\n" . '<script type="text/javascript" src="' . JURI::root(true) . '/components/com_rsform/assets/calendar/cal.js?v=' . _RSFORM_REVISION . '"></script>' . "\n";
         $formLayout .= '<script type="text/javascript">' . RSFormProHelper::getCalendarJS() . '</script>' . "\n";
         $formLayout .= '<script type="text/javascript" defer="defer">rsf_CALENDAR.util.Event.addListener(window, "load", rsfp_init(' . $formId . ',{ layouts: Array(' . $calendarsLayout . '), formats: Array(' . $calendarsFormat . '), values: Array(' . $calendarsValues . '), extra: Array(' . $calendarsExtra . ') }));</script>' . "\n";
     }
     if (!empty($pages)) {
         $formLayout .= '<script type="text/javascript" src="' . JURI::root(true) . '/components/com_rsform/assets/js/pages.js?v=' . _RSFORM_REVISION . '"></script>' . "\n";
         $formLayout .= '<script type="text/javascript">rsfp_changePage(' . $formId . ', ' . $start_page . ', ' . count($pages) . ');</script>' . "\n";
     }
     if ($form->AjaxValidation || !empty($pages)) {
         $formLayout .= '<script type="text/javascript">var rsfp_ajax_root = \'' . addslashes(JURI::root(true)) . '\';</script>';
     }
     if ($form->AjaxValidation) {
         $formLayout .= '<script type="text/javascript">rsfp_addEvent(window, \'load\', function(){var form = rsfp_getForm(' . $formId . '); form.onsubmit = ajaxValidation;});</script>';
     }
     $ajaxScript = '';
     $mainframe->triggerEvent('rsfp_f_onAJAXScriptCreate', array(array('script' => &$ajaxScript, 'formId' => $formId)));
     $formLayout .= '<script type="text/javascript">';
     $formLayout .= 'ajaxExtraValidationScript[' . $formId . '] = function(task, formId, data) {';
     $formLayout .= 'var formComponents = {};';
     foreach ($components as $component) {
         if (in_array($component->ComponentTypeId, array(7, 9, 10, 11, 12, 13, 15, 41))) {
             continue;
         }
         $formLayout .= "formComponents[" . $component->ComponentId . "]='" . $component->name . "';";
     }
     $formLayout .= "if (task == 'afterSend') {";
     $formLayout .= "\r\n\t\tvar ids = data.response[0].split(',');\r\n\t\tfor (var i=0; i<ids.length; i++) {\r\n\t\t\tvar id = parseInt(ids[i]);\r\n\t\t\tif (!isNaN(id) && typeof formComponents[id] != 'undefined') {\r\n\t\t\t\tvar formComponent = rsfp_getFieldsByName(formId, formComponents[id]);\r\n\t\t\t\tif (formComponent && formComponent.length > 0) {\r\n\t\t\t\t\tfor (var j=0; j<formComponent.length; j++) {\r\n\t\t\t\t\t\tif (formComponent[j]) {\r\n\t\t\t\t\t\t\tformComponent[j].className = formComponent[j].className.replace(' rsform-error', '');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar ids = data.response[1].split(',');\r\n\t\tfor (var i=0; i<ids.length; i++) {\r\n\t\t\tvar id = parseInt(ids[i]);\r\n\t\t\tif (!isNaN(id) && typeof formComponents[id] != 'undefined') {\r\n\t\t\t\tvar formComponent = rsfp_getFieldsByName(formId, formComponents[id]);\r\n\t\t\t\tif (formComponent && formComponent.length > 0) {\r\n\t\t\t\t\tfor (var j=0; j<formComponent.length; j++) {\r\n\t\t\t\t\t\tif (formComponent[j]) {\r\n\t\t\t\t\t\t\tformComponent[j].className = formComponent[j].className.replace(' rsform-error', '') + ' rsform-error';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t";
     $formLayout .= "}\n";
     // has this been modified?
     if ($ajaxScript) {
         $formLayout .= $ajaxScript;
     }
     $formLayout .= '}';
     $formLayout .= '</script>';
     if ($conditions = RSFormProHelper::getConditions($formId)) {
         $formLayout .= '<script type="text/javascript">';
         foreach ($conditions as $condition) {
             $formLayout .= "\n" . 'function rsfp_runCondition' . $condition->id . '(){';
             if ($condition->details) {
                 $condition_vars = array();
                 foreach ($condition->details as $detail) {
                     $formLayout .= "\n" . "isChecked = rsfp_verifyChecked(" . $formId . ", '" . addslashes($detail->ComponentName) . "', '" . addslashes($detail->value) . "');";
                     $formLayout .= "\n" . "condition" . $detail->id . " = isChecked == " . ($detail->operator == 'is' ? 'true' : 'false') . ";";
                     $condition_vars[] = "condition" . $detail->id;
                 }
                 if ($condition->block) {
                     $block = JFilterOutput::stringURLSafe($condition->ComponentName);
                     $formLayout .= "\n" . "items = rsfp_getBlock(" . $formId . ", '" . addslashes($block) . "');";
                 } else {
                     $formLayout .= "\n" . "items = rsfp_getFieldsByName(" . $formId . ", '" . addslashes($condition->ComponentName) . "');";
                 }
                 $formLayout .= "\n" . "if (items) {";
                 $formLayout .= "\n" . "if (" . implode($condition->condition == 'all' ? '&&' : '||', $condition_vars) . ")";
                 $formLayout .= "\n" . "rsfp_setDisplay(items, '" . ($condition->action == 'show' ? '' : 'none') . "');";
                 $formLayout .= "\n" . 'else';
                 $formLayout .= "\n" . "rsfp_setDisplay(items, '" . ($condition->action == 'show' ? 'none' : '') . "');";
                 $formLayout .= "\n" . "}";
             }
             $formLayout .= "\n" . '}';
             $formLayout .= "\n" . 'rsfp_runCondition' . $condition->id . '();';
             if ($condition->details) {
                 foreach ($condition->details as $detail) {
                     $formLayout .= "\n" . "rsfp_addCondition(" . $formId . ", '" . addslashes($detail->ComponentName) . "', rsfp_runCondition" . $condition->id . ");";
                 }
             }
         }
         $formLayout .= "\n" . '</script>';
     }
     if ($calculations = RSFormProHelper::getCalculations($formId)) {
         require_once dirname(__FILE__) . '/calculations.php';
         $formLayout .= "\n" . '<script type="text/javascript">';
         $formLayout .= "\n" . 'function rsfp_Calculations' . $formId . '(){';
         foreach ($calculations as $calculation) {
             $expression = RSFormProCalculations::expression($calculation, $formId);
             $formLayout .= "\n" . $expression . "\n";
         }
         $formLayout .= "\n" . '}';
         $formLayout .= "\n" . 'rsfp_Calculations' . $formId . '();';
         $formLayout .= RSFormProCalculations::getFields($calculations, $formId);
         $formLayout .= "\n" . 'rsfp_setCalculationsEvents(' . $formId . ',rsfpCalculationFields' . $formId . ');';
         $formLayout .= "\n" . '</script>';
     }
     $maps = RSFormProHelper::componentExists($formId, 212);
     //212 is the componentTypeId for maps
     if (!empty($maps)) {
         $formLayout .= "\n" . '<script type="text/javascript">';
         foreach ($maps as $map) {
             $formLayout .= RSFormProHelper::generateMap($map, $validation);
         }
         $formLayout .= "\n" . '</script>';
     }
     $RSadapter = RSFormProHelper::getLegacyAdapter();
     eval($form->ScriptDisplay);
     //Trigger Event - onBeforeFormDisplay
     $mainframe->triggerEvent('rsfp_f_onBeforeFormDisplay', array(array('formLayout' => &$formLayout, 'formId' => $formId)));
     return $formLayout;
 }
开发者ID:renekreijveld,项目名称:rsformpro-bootstrapped,代码行数:101,代码来源:rsform.php


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