本文整理汇总了PHP中RSFormProHelper::showForm方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::showForm方法的具体用法?PHP RSFormProHelper::showForm怎么用?PHP RSFormProHelper::showForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::showForm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RSshowForm
function RSshowForm($formId, $val = '', $validation = '')
{
return RSFormProHelper::showForm($formId, $val, $validation);
}
示例2: displayForm
public static function displayForm($formId, $is_module = false)
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$db->setQuery("SELECT Published, FormTitle, MetaTitle, MetaDesc, MetaKeywords, ShowThankyou, Access FROM #__rsform_forms WHERE FormId='" . (int) $formId . "'");
$form = $db->loadObject();
if (empty($form) || !$form->Published) {
JError::raiseWarning(500, JText::_('_NOT_EXIST'));
return;
}
// Check form access level
if (!$is_module && $form->Access != '') {
$canView = false;
$menu = $mainframe->getMenu();
$active = $menu->getActive();
if ($active) {
if ($query = $active->query) {
if (isset($query['option']) && isset($query['view']) && isset($query['formId'])) {
if ($query['option'] == 'com_rsform' && $query['view'] == 'rsform' && $query['formId'] == $formId) {
$canView = true;
}
}
}
}
$rseventspro = $mainframe->input->get('option') == 'com_rseventspro' && $mainframe->input->get('layout') == 'subscribe';
if ($rseventspro || $mainframe->isAdmin()) {
$canView = true;
}
if (!$canView) {
$user = JFactory::getUser();
if (!in_array($form->Access, $user->getAuthorisedViewLevels())) {
JError::raiseWarning(500, JText::_('_NOT_EXIST'));
$mainframe->redirect(JURI::root());
return;
}
}
}
$lang = RSFormProHelper::getCurrentLanguage($formId);
$translations = RSFormProHelper::getTranslations('forms', $formId, $lang);
if ($translations) {
foreach ($translations as $field => $value) {
if (isset($form->{$field})) {
$form->{$field} = $value;
}
}
}
$doc = JFactory::getDocument();
if (!$is_module) {
if ($form->MetaDesc) {
$doc->setMetaData('description', $form->MetaDesc);
}
if ($form->MetaKeywords) {
$doc->setMetaData('keywords', $form->MetaKeywords);
}
if ($form->MetaTitle) {
$doc->setTitle($form->FormTitle);
}
}
$session = JFactory::getSession();
$formparams = $session->get('com_rsform.formparams.' . $formId);
// Form has been processed ?
if ($formparams && $formparams->formProcessed) {
// Must show Thank You Message
if ($form->ShowThankyou) {
return RSFormProHelper::showThankYouMessage($formId);
}
// Clear
$session->clear('com_rsform.formparams.' . $formId);
// Must show small message
$mainframe->enqueueMessage(JText::_('RSFP_THANKYOU_SMALL'));
}
// Must process form
$post = JRequest::getVar('form', array(), 'post', 'none', JREQUEST_ALLOWRAW);
if (isset($post['formId']) && $post['formId'] == $formId) {
$invalid = RSFormProHelper::processForm($formId);
// Did not pass validation - show the form
if ($invalid) {
$mainframe->triggerEvent('rsfp_f_onBeforeShowForm');
return RSFormProHelper::showForm($formId, $post, $invalid);
}
}
// Default - show the form
$mainframe->triggerEvent('rsfp_f_onBeforeShowForm');
return RSFormProHelper::showForm($formId);
}
示例3: displayForm
public static function displayForm($formId, $is_module = false)
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$db->setQuery("SELECT Published, FormTitle, MetaTitle, MetaDesc, MetaKeywords, ShowThankyou FROM #__rsform_forms WHERE FormId='" . (int) $formId . "'");
$form = $db->loadObject();
if (empty($form) || !$form->Published) {
JError::raiseWarning(500, JText::_('_NOT_EXIST'));
return;
}
$lang = RSFormProHelper::getCurrentLanguage($formId);
$translations = RSFormProHelper::getTranslations('forms', $formId, $lang);
if ($translations) {
foreach ($translations as $field => $value) {
if (isset($form->{$field})) {
$form->{$field} = $value;
}
}
}
$doc = JFactory::getDocument();
if (!$is_module) {
if ($form->MetaDesc) {
$doc->setMetaData('description', $form->MetaDesc);
}
if ($form->MetaKeywords) {
$doc->setMetaData('keywords', $form->MetaKeywords);
}
if ($form->MetaTitle) {
$doc->setTitle($form->FormTitle);
}
}
$session = JFactory::getSession();
$formparams = $session->get('com_rsform.formparams.' . $formId);
// Form has been processed ?
if ($formparams && $formparams->formProcessed) {
// Must show Thank You Message
if ($form->ShowThankyou) {
return RSFormProHelper::showThankYouMessage($formId);
}
// Clear
$session->clear('com_rsform.formparams.' . $formId);
// Must show small message
$mainframe->enqueueMessage(JText::_('RSFP_THANKYOU_SMALL'));
}
// Must process form
$post = JRequest::getVar('form', array(), 'post', 'none', JREQUEST_ALLOWRAW);
if (isset($post['formId']) && $post['formId'] == $formId) {
$invalid = RSFormProHelper::processForm($formId);
// Did not pass validation - show the form
if ($invalid) {
$mainframe->triggerEvent('rsfp_f_onBeforeShowForm');
return RSFormProHelper::showForm($formId, $post, $invalid);
}
}
// Default - show the form
$mainframe->triggerEvent('rsfp_f_onBeforeShowForm');
return RSFormProHelper::showForm($formId);
}