本文整理汇总了PHP中RSFormProHelper::componentExists方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::componentExists方法的具体用法?PHP RSFormProHelper::componentExists怎么用?PHP RSFormProHelper::componentExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::componentExists方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rsfp_getPayment
function rsfp_getPayment(&$items, $formId)
{
if ($components = RSFormProHelper::componentExists($formId, $this->componentId)) {
$data = RSFormProHelper::getComponentProperties($components[0]);
$item = new stdClass();
$item->value = $this->componentValue;
$item->text = $data['LABEL'];
// add to array
$items[] = $item;
}
}
示例2: ajaxValidate
function ajaxValidate()
{
$form = JRequest::getVar('form');
$formId = (int) @$form['formId'];
$this->_db->setQuery("SELECT ComponentId, ComponentTypeId FROM #__rsform_components WHERE `FormId`='" . $formId . "' AND `Published`='1' ORDER BY `Order`");
$components = $this->_db->loadObjectList();
$page = JRequest::getInt('page');
if ($page) {
$current_page = 1;
foreach ($components as $i => $component) {
if ($current_page != $page) {
unset($components[$i]);
}
if ($component->ComponentTypeId == 41) {
$current_page++;
}
}
}
$removeUploads = array();
$removeRecaptcha = array();
$formComponents = array();
foreach ($components as $component) {
$formComponents[] = $component->ComponentId;
if ($component->ComponentTypeId == 9) {
$removeUploads[] = $component->ComponentId;
}
if ($component->ComponentTypeId == 24) {
$removeRecaptcha[] = $component->ComponentId;
}
}
echo implode(',', $formComponents);
echo "\n";
$invalid = RSFormProHelper::validateForm($formId);
if (count($invalid)) {
foreach ($invalid as $i => $componentId) {
if (in_array($componentId, $removeUploads) || in_array($componentId, $removeRecaptcha)) {
unset($invalid[$i]);
}
}
$invalidComponents = array_intersect($formComponents, $invalid);
echo implode(',', $invalidComponents);
}
if (isset($invalidComponents)) {
echo "\n";
$pages = RSFormProHelper::componentExists($formId, 41);
$pages = count($pages);
if ($pages && !$page) {
$first = reset($invalidComponents);
$current_page = 1;
foreach ($components as $i => $component) {
if ($component->ComponentId == $first) {
break;
}
if ($component->ComponentTypeId == 41) {
$current_page++;
}
}
echo $current_page;
echo "\n";
echo $pages;
}
}
jexit();
}
示例3: ajaxValidate
function ajaxValidate()
{
$form = JRequest::getVar('form');
$formId = (int) @$form['formId'];
$this->_db->setQuery("SELECT ComponentId, ComponentTypeId FROM #__rsform_components WHERE `FormId`='" . $formId . "' AND `Published`='1' ORDER BY `Order`");
$components = $this->_db->loadObjectList();
$page = JRequest::getInt('page');
if ($page) {
$current_page = 1;
foreach ($components as $i => $component) {
if ($current_page != $page) {
unset($components[$i]);
}
if ($component->ComponentTypeId == 41) {
$current_page++;
}
}
}
$removeUploads = array();
$formComponents = array();
foreach ($components as $component) {
$formComponents[] = $component->ComponentId;
if ($component->ComponentTypeId == 9) {
$removeUploads[] = $component->ComponentId;
}
}
echo implode(',', $formComponents);
echo "\n";
$invalid = RSFormProHelper::validateForm($formId);
//Trigger Event - onBeforeFormValidation
$mainframe = JFactory::getApplication();
$post = JRequest::get('post', JREQUEST_ALLOWRAW);
$mainframe->triggerEvent('rsfp_f_onBeforeFormValidation', array(array('invalid' => &$invalid, 'formId' => $formId, 'post' => &$post)));
if (count($invalid)) {
foreach ($invalid as $i => $componentId) {
if (in_array($componentId, $removeUploads)) {
unset($invalid[$i]);
}
}
$invalidComponents = array_intersect($formComponents, $invalid);
echo implode(',', $invalidComponents);
}
if (isset($invalidComponents)) {
echo "\n";
$pages = RSFormProHelper::componentExists($formId, 41);
$pages = count($pages);
if ($pages && !$page) {
$first = reset($invalidComponents);
$current_page = 1;
foreach ($components as $i => $component) {
if ($component->ComponentId == $first) {
break;
}
if ($component->ComponentTypeId == 41) {
$current_page++;
}
}
echo $current_page;
echo "\n";
echo $pages;
}
}
jexit();
}
示例4: getFrontComponentBody
//.........这里部分代码省略.........
$item = preg_replace($pricePattern, '', $item);
@(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
if (is_null($txt)) {
$txt = $val;
}
$additional = '';
// checked
if (strpos($item, '[c]') !== false && empty($value) || isset($value[$data['NAME']]) && $val == $value[$data['NAME']]) {
$additional .= 'checked="checked"';
}
// disabled
if (strpos($item, '[d]') !== false) {
$additional .= 'disabled="disabled"';
}
if ($data['FLOW'] == 'VERTICAL' && $layoutName == 'responsive') {
$out .= '<p class="rsformVerticalClear">';
}
$out .= '<label class="radio' . ($data['FLOW'] == 'VERTICAL' ? '"' : ' inline"') . ' for="' . $data['NAME'] . $i . '"><input ' . $additional . ' name="form[' . $data['NAME'] . ']" type="radio" value="' . RSFormProHelper::htmlEscape($val) . '" id="' . $data['NAME'] . $i . '" ' . $data['ADDITIONALATTRIBUTES'] . ' />' . $txt . '</label>';
if ($hasPrice) {
$prices[$val] = $price;
}
if ($data['FLOW'] == 'VERTICAL') {
if ($layoutName == 'responsive') {
$out .= '</p>';
}
//else
//$out .= '<br />';
}
$i++;
}
break;
case 6:
case 'calendar':
$calendars = RSFormProHelper::componentExists($formId, 6);
$calendars = array_flip($calendars);
$defaultValue = isset($value[$data['NAME']]) ? $value[$data['NAME']] : (isset($data['DEFAULTVALUE']) ? RSFormProHelper::isCode($data['DEFAULTVALUE']) : '');
switch ($data['CALENDARLAYOUT']) {
case 'FLAT':
$className = 'rsform-calendar-box';
if ($invalid) {
$className .= ' rsform-error';
}
$out .= '<input id="txtcal' . $formId . '_' . $calendars[$componentId] . '" name="form[' . $data['NAME'] . ']" type="text" ' . ($data['READONLY'] == 'YES' ? 'readonly="readonly"' : '') . ' class="txtCal ' . $className . '" value="' . RSFormProHelper::htmlEscape($defaultValue) . '" ' . $data['ADDITIONALATTRIBUTES'] . '/><br />';
$out .= '<div id="cal' . $formId . '_' . $calendars[$componentId] . 'Container" style="z-index:' . (9999 - $data['Order']) . '"></div>';
break;
case 'POPUP':
$data['ADDITIONALATTRIBUTES2'] = $data['ADDITIONALATTRIBUTES'];
$className = 'rsform-calendar-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
$out .= '<div class="input-append">';
$out .= '<input id="txtcal' . $formId . '_' . $calendars[$componentId] . '" name="form[' . $data['NAME'] . ']" type="text" ' . ($data['READONLY'] == 'YES' ? 'readonly="readonly"' : '') . ' value="' . RSFormProHelper::htmlEscape($defaultValue) . '" ' . $data['ADDITIONALATTRIBUTES'] . '/>';
$className = 'btn rsform-calendar-button';
if ($invalid) {
$className .= ' rsform-error';
}
$out .= '<button id="btn' . $formId . '_' . $calendars[$componentId] . '" type="button" onclick="showHideCalendar(\'cal' . $formId . '_' . $calendars[$componentId] . 'Container\');" class="btnCal ' . $className . '" ' . $data['ADDITIONALATTRIBUTES2'] . '>' . RSFormProHelper::htmlEscape($data['POPUPLABEL']) . '</button>';
$out .= '</div>';
$out .= '<div id="cal' . $formId . '_' . $calendars[$componentId] . 'Container" style="clear:both;display:none;position:absolute;z-index:' . (9999 - $data['Order']) . '"></div>';
break;
}
$out .= '<input id="hiddencal' . $formId . '_' . $calendars[$componentId] . '" type="hidden" name="hidden[' . $data['NAME'] . ']" />';
break;
case 7:
示例5: RScomponentExists
function RScomponentExists($formId, $componentTypeId)
{
return RSFormProHelper::componentExists($formId, $componentTypeId);
}
示例6: rsfp_f_onAfterFormProcess
function rsfp_f_onAfterFormProcess($args)
{
$formId = $args['formId'];
if (RSFormProHelper::componentExists($formId, 24)) {
$session = JFactory::getSession();
$session->clear('com_rsform.recaptchaToken' . $formId);
}
}
示例7: getFrontComponentBody
//.........这里部分代码省略.........
$out .= '<br/>';
}
$i++;
}
break;
case 5:
case 'radioGroup':
$i = 0;
$items = RSFormProHelper::isCode($data['ITEMS']);
$items = str_replace("\r", "", $items);
$items = explode("\n", $items);
foreach ($items as $item) {
$buf = explode('|', $item, 2);
$option_value = $buf[0];
$option_value_trimmed = str_replace('[c]', '', $option_value);
$option_shown = count($buf) == 1 ? $buf[0] : $buf[1];
$option_shown_trimmed = str_replace('[c]', '', $option_shown);
$option_checked = false;
if (empty($value) && preg_match('/\\[c\\]/', $option_shown)) {
$option_checked = true;
}
if (isset($value[$data['NAME']]) && $value[$data['NAME']] == $option_value_trimmed) {
$option_checked = true;
}
$out .= '<input ' . ($option_checked ? 'checked="checked"' : '') . ' name="form[' . $data['NAME'] . ']" type="radio" value="' . RSFormProHelper::htmlEscape($option_value_trimmed) . '" id="' . $data['NAME'] . $i . '" ' . $data['ADDITIONALATTRIBUTES'] . ' /><label for="' . $data['NAME'] . $i . '">' . $option_shown_trimmed . '</label>';
if ($data['FLOW'] == 'VERTICAL') {
$out .= '<br/>';
}
$i++;
}
break;
case 6:
case 'calendar':
$calendars = RSFormProHelper::componentExists($formId, 6);
$calendars = array_flip($calendars);
$defaultValue = isset($value[$data['NAME']]) ? $value[$data['NAME']] : (isset($data['DEFAULTVALUE']) ? RSFormProHelper::isCode($data['DEFAULTVALUE']) : '');
switch ($data['CALENDARLAYOUT']) {
case 'FLAT':
$className = 'rsform-calendar-box';
if ($invalid) {
$className .= ' rsform-error';
}
$out .= '<input id="txtcal' . $formId . '_' . $calendars[$componentId] . '" name="form[' . $data['NAME'] . ']" type="text" ' . ($data['READONLY'] == 'YES' ? 'readonly="readonly"' : '') . ' class="txtCal ' . $className . '" value="' . RSFormProHelper::htmlEscape($defaultValue) . '" ' . $data['ADDITIONALATTRIBUTES'] . '/><br />';
$out .= '<div id="cal' . $formId . '_' . $calendars[$componentId] . 'Container" style="z-index:' . (9999 - $data['Order']) . '"></div>';
break;
case 'POPUP':
$data['ADDITIONALATTRIBUTES2'] = $data['ADDITIONALATTRIBUTES'];
$className = 'rsform-calendar-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
$out .= '<input id="txtcal' . $formId . '_' . $calendars[$componentId] . '" name="form[' . $data['NAME'] . ']" type="text" ' . ($data['READONLY'] == 'YES' ? 'readonly="readonly"' : '') . ' value="' . RSFormProHelper::htmlEscape($defaultValue) . '" ' . $data['ADDITIONALATTRIBUTES'] . '/>';
$className = 'rsform-calendar-button';
if ($invalid) {
$className .= ' rsform-error';
}
$out .= '<input id="btn' . $formId . '_' . $calendars[$componentId] . '" type="button" value="' . RSFormProHelper::htmlEscape($data['POPUPLABEL']) . '" onclick="showHideCalendar(\'cal' . $formId . '_' . $calendars[$componentId] . 'Container\');" class="btnCal ' . $className . '" ' . $data['ADDITIONALATTRIBUTES2'] . ' />';
$out .= '<div id="cal' . $formId . '_' . $calendars[$componentId] . 'Container" style="clear:both;display:none;position:absolute;z-index:' . (9999 - $data['Order']) . '"></div>';
break;
}
$out .= '<input id="hiddencal' . $formId . '_' . $calendars[$componentId] . '" type="hidden" name="hidden[' . $data['NAME'] . ']" />';
break;
case 7:
case 'button':
$data['ADDITIONALATTRIBUTES2'] = $data['ADDITIONALATTRIBUTES'];
示例8: rsfp_onAfterCreatePlaceholders
public function rsfp_onAfterCreatePlaceholders($args)
{
$formId = $args['form']->FormId;
$submissionId = $args['submission']->SubmissionId;
$multipleSeparator = $args['form']->MultipleSeparator;
if (RSFormProHelper::componentExists($formId, $this->newComponents)) {
$singleProduct = RSFormProHelper::componentExists($formId, 21);
$multipleProducts = RSFormProHelper::componentExists($formId, 22);
$total = RSFormProHelper::componentExists($formId, 23);
$donationProduct = RSFormProHelper::componentExists($formId, 28);
$choosePayment = RSFormProHelper::componentExists($formId, 27);
// choose payment
if (!empty($choosePayment)) {
$details = RSFormProHelper::getComponentProperties($choosePayment[0]);
$items = $this->_getPayments($formId);
$value = $this->_getSubmissionValue($submissionId, $choosePayment[0]);
$text = '';
if ($items) {
foreach ($items as $item) {
if ($item->value == $value) {
$text = $item->text;
break;
}
}
}
$args['placeholders'][] = '{' . $details['NAME'] . ':text}';
$args['values'][] = $text;
}
// multiple products
if (!empty($multipleProducts)) {
foreach ($multipleProducts as $product) {
$pdetail = RSFormProHelper::getComponentProperties($product);
$detail = $this->_getSubmissionValue($submissionId, $product);
if ($detail == '') {
continue;
}
$detail = explode("\n", $detail);
$items = RSFormProHelper::explode(RSFormProHelper::isCode($pdetail['ITEMS']));
$replace = '{' . $pdetail['NAME'] . ':price}';
$with = array();
foreach ($items as $item) {
@(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
if (is_null($txt)) {
$txt = $val;
}
if (!$val) {
$val = 0;
}
if (in_array($txt, $detail)) {
$txt_price = $this->_getPriceMask($txt, $val);
$with[] = $txt_price;
}
}
$args['placeholders'][] = $replace;
$args['values'][] = implode($multipleSeparator, $with);
}
}
// donation
if (!empty($donationProduct)) {
$price = $this->_getSubmissionValue($submissionId, $donationProduct[0]);
$details = RSFormProHelper::getComponentProperties($donationProduct[0]);
$args['placeholders'][] = '{' . $details['NAME'] . ':price}';
$args['values'][] = $this->_getPriceMask($details['CAPTION'], $price);
}
// single product
if (!empty($singleProduct)) {
//Get Component properties
$data = RSFormProHelper::getComponentProperties($this->_getComponentId('rsfp_Product', $formId));
$price = $data['PRICE'];
$args['placeholders'][] = '{rsfp_Product:price}';
$args['values'][] = $this->_getPriceMask($data['CAPTION'], $price);
}
if (!empty($total)) {
$price = $this->_getSubmissionValue($submissionId, $total[0]);
$details = RSFormProHelper::getComponentProperties($total[0]);
$args['placeholders'][] = '{' . $details['NAME'] . ':price}';
$args['values'][] = $this->_getPriceMask($details['CAPTION'], $price);
}
}
}