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


PHP RSFormProHelper::getCalendarJS方法代码示例

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


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

示例1: showForm


//.........这里部分代码省略.........
     if ($form->FormLayoutName == 'bootstrap-horizontal') {
         $form->CSSClass .= ' form-horizontal';
     }
     if ($form->FormLayoutName == 'bootstrap-vertical') {
         $form->CSSClass .= ' form-vertical';
     }
     $CSSClass = $form->CSSClass ? ' class="' . RSFormProHelper::htmlEscape(trim($form->CSSClass)) . '"' : '';
     $CSSId = $form->CSSId ? ' id="' . RSFormProHelper::htmlEscape(trim($form->CSSId)) . '"' : '';
     $CSSName = $form->CSSName ? ' name="' . RSFormProHelper::htmlEscape(trim($form->CSSName)) . '"' : '';
     $u = $form->CSSAction ? RSFormProHelper::htmlEscape($form->CSSAction) : $u;
     $CSSAdditionalAttributes = $form->CSSAdditionalAttributes ? ' ' . trim($form->CSSAdditionalAttributes) : '';
     if (!empty($pages)) {
         $total_pages = count($pages) + 1;
         $step = floor(100 / $total_pages);
         $replace_progress = array('{page}', '{total}', '{percent}');
         $with_progress = array(1, $total_pages, $step * 1);
         $progress = reset($page_progress);
         $progress_script = '';
         $formLayout = '<div id="rsform_progress_' . $formId . '" class="rsformProgress">' . ($progress['show'] ? str_replace($replace_progress, $with_progress, $progress['text']) : '') . '</div>' . "\n" . $formLayout;
         foreach ($page_progress as $p => $progress) {
             $progress['text'] = str_replace(array("\r", "\n"), array('', '\\n'), addcslashes($progress['text'], "'"));
             $replace_progress = array('{page}', '{total}', '{percent}');
             $with_progress = array($p + 1, $total_pages, $p + 1 == $total_pages ? 100 : $step * ($p + 1));
             $progress_script .= "if (page == " . $p . ") document.getElementById('rsform_progress_" . $formId . "').innerHTML = '" . ($progress['show'] ? str_replace($replace_progress, $with_progress, $progress['text']) : '') . "';";
         }
         $formLayout .= "\n" . '<script type="text/javascript">' . "\n" . 'function rsfp_showProgress_' . $formId . '(page) {' . "\n" . $progress_script . "\n" . '}' . "\n" . '</script>';
     }
     $formLayout = '<form method="post" ' . $CSSId . $CSSClass . $CSSName . $CSSAdditionalAttributes . ' enctype="multipart/form-data" action="' . RSFormProHelper::htmlEscape($u) . '">' . $formLayout . '</form>';
     if ($prices = self::$prices) {
         $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>';
开发者ID:renekreijveld,项目名称:rsformpro-bootstrapped,代码行数:67,代码来源:rsform.php

示例2: showForm


//.........这里部分代码省略.........
             $data['PAGES'] = $pages;
             $page_progress[] = array('show' => @$data['DISPLAYPROGRESS'] == 'YES', 'text' => @$data['DISPLAYPROGRESSMSG']);
         } elseif ($component->ComponentTypeId == 13) {
             $data['SUBMITS'] = $submits;
             if ($component->ComponentId == end($submits)) {
                 $page_progress[] = array('show' => @$data['DISPLAYPROGRESS'] == 'YES', 'text' => @$data['DISPLAYPROGRESSMSG']);
             }
         }
         // Caption
         $find[] = '{' . $component->name . ':caption}';
         $caption = '';
         if (isset($data['SHOW']) && $data['SHOW'] == 'NO') {
             $caption = '';
         } elseif (isset($data['CAPTION'])) {
             $caption = $data['CAPTION'];
         }
         $replace[] = $caption;
         // Body
         $find[] = '{' . $component->name . ':body}';
         $replace[] = RSFormProHelper::getFrontComponentBody($formId, $component->ComponentId, $data, $val, in_array($component->ComponentId, $validation));
         // Description
         $find[] = '{' . $component->name . ':description}';
         $description = '';
         if (isset($data['SHOW']) && $data['SHOW'] == 'NO') {
             $description = '';
         } elseif (isset($data['DESCRIPTION'])) {
             $description = $data['DESCRIPTION'];
         }
         $replace[] = $description;
         // Validation message
         $find[] = '{' . $component->name . ':validation}';
         $validationMessage = '';
         if (isset($data['SHOW']) && $data['SHOW'] == 'NO') {
             $validationMessage = '';
         } elseif (isset($data['VALIDATIONMESSAGE'])) {
             if (!empty($validation) && in_array($component->ComponentId, $validation)) {
                 $validationMessage = '<span id="component' . $component->ComponentId . '" class="formError">' . $data['VALIDATIONMESSAGE'] . '</span>';
             } else {
                 $validationMessage = '<span id="component' . $component->ComponentId . '" class="formNoError">' . $data['VALIDATIONMESSAGE'] . '</span>';
             }
         }
         $replace[] = $validationMessage;
     }
     unset($all_data);
     $u = RSFormProHelper::getURL();
     //Trigger Event - onInitFormDisplay
     $mainframe->triggerEvent('rsfp_f_onInitFormDisplay', array(array('find' => &$find, 'replace' => &$replace, 'formLayout' => &$formLayout)));
     $user = JFactory::getUser();
     $jconfig = JFactory::getConfig();
     array_push($find, '{global:formtitle}', '{global:username}', '{global:userip}', '{global:userid}', '{global:useremail}', '{global:fullname}', '{global:sitename}', '{global:siteurl}');
     array_push($replace, $form->FormTitle, $user->get('username'), isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', $user->get('id'), $user->get('email'), $user->get('name'), $jconfig->getValue('config.sitename'), JURI::root());
     $formLayout = str_replace($find, $replace, $formLayout);
     if (strpos($formLayout, 'class="formError"') !== false) {
         $formLayout = str_replace('{error}', $errorMessage, $formLayout);
     } elseif ($form->AjaxValidation) {
         $formLayout = str_replace('{error}', '<div id="rsform_error_' . $formId . '" style="display: none;">' . $errorMessage . '</div>', $formLayout);
     } else {
         $formLayout = str_replace('{error}', '', $formLayout);
     }
     $formLayout .= '<input type="hidden" name="form[formId]" value="' . $formId . '"/>';
     $CSSClass = $form->CSSClass ? ' class="' . RSFormProHelper::htmlEscape($form->CSSClass) . '"' : '';
     $CSSId = $form->CSSId ? ' id="' . RSFormProHelper::htmlEscape($form->CSSId) . '"' : '';
     $CSSName = $form->CSSName ? ' name="' . RSFormProHelper::htmlEscape($form->CSSName) . '"' : '';
     $u = $form->CSSAction ? RSFormProHelper::htmlEscape($form->CSSAction) : $u;
     $CSSAdditionalAttributes = $form->CSSAdditionalAttributes ? ' ' . trim($form->CSSAdditionalAttributes) : '';
     if (!empty($pages)) {
         $total_pages = count($pages) + 1;
         $step = floor(100 / $total_pages);
         $replace_progress = array('{page}', '{total}', '{percent}');
         $with_progress = array(1, $total_pages, $step * 1);
         $progress = reset($page_progress);
         $progress_script = '';
         $formLayout = '<div id="rsform_progress_' . $formId . '" class="rsformProgress">' . ($progress['show'] ? str_replace($replace_progress, $with_progress, $progress['text']) : '') . '</div>' . "\n" . $formLayout;
         foreach ($page_progress as $p => $progress) {
             $progress['text'] = str_replace(array("\r", "\n"), array('', '\\n'), addcslashes($progress['text'], "'"));
             $replace_progress = array('{page}', '{total}', '{percent}');
             $with_progress = array($p + 1, $total_pages, $p + 1 == $total_pages ? 100 : $step * ($p + 1));
             $progress_script .= "if (page == " . $p . ") document.getElementById('rsform_progress_" . $formId . "').innerHTML = '" . ($progress['show'] ? str_replace($replace_progress, $with_progress, $progress['text']) : '') . "';";
         }
         $formLayout .= "\n" . '<script type="text/javascript">' . "\n" . 'function rsfp_showProgress_' . $formId . '(page) {' . "\n" . $progress_script . "\n" . '}' . "\n" . '</script>';
     }
     $formLayout = '<form method="post" ' . $CSSId . $CSSClass . $CSSName . $CSSAdditionalAttributes . ' enctype="multipart/form-data" action="' . RSFormProHelper::htmlEscape($u) . '">' . $formLayout . '</form>';
     if (!empty($calendars)) {
         $formLayout .= "\n" . '<script type="text/javascript" src="' . JURI::root(true) . '/components/com_rsform/assets/calendar/cal.js?v=42"></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=42"></script>' . "\n";
         $formLayout .= '<script type="text/javascript">rsfp_changePage(' . $formId . ', ' . $start_page . ', ' . count($pages) . ')</script>' . "\n";
     }
     if ($form->AjaxValidation) {
         $formLayout .= '<script type="text/javascript">rsfp_addEvent(window, \'load\', function(){var form = rsfp_getForm(' . $formId . '); form.onsubmit = ajaxValidation;});</script>';
     }
     $RSadapter = RSFormProHelper::getLegacyAdapter();
     eval($form->ScriptDisplay);
     //Trigger Event - onBeforeFormDisplay
     $mainframe->triggerEvent('rsfp_f_onBeforeFormDisplay', array(array('formLayout' => &$formLayout, 'formId' => $formId)));
     return $formLayout;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:rsform.php


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