本文整理汇总了PHP中RSFormProHelper::addClass方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::addClass方法的具体用法?PHP RSFormProHelper::addClass怎么用?PHP RSFormProHelper::addClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::addClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFrontComponentBody
function getFrontComponentBody($formId, $componentId, $data, $value = '', $invalid = false)
{
$mainframe =& JFactory::getApplication();
$formId = (int) $formId;
$componentId = (int) $componentId;
$db = JFactory::getDBO();
// Optimized, don't need this anymore
//$db->setQuery("SELECT `ComponentTypeId`, `Order` FROM #__rsform_components WHERE ComponentId='".$componentId."' LIMIT 1");
//$r = $db->loadAssoc();
// For legacy reasons...
$r = array();
$r['ComponentTypeId'] = $data['componentTypeId'];
$r['Order'] = @$data['Order'];
$out = '';
//Trigger Event - rsfp_bk_onBeforeCreateFrontComponentBody
$mainframe->triggerEvent('rsfp_bk_onBeforeCreateFrontComponentBody', array(array('out' => &$out, 'formId' => $formId, 'componentId' => $componentId, 'data' => $data, 'value' => $value)));
switch ($data['ComponentTypeName']) {
case 1:
case 'textBox':
$defaultValue = RSFormProHelper::isCode($data['DEFAULTVALUE']);
$className = 'rsform-input-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
$out .= '<input type="text" value="' . (isset($value[$data['NAME']]) ? RSFormProHelper::htmlEscape($value[$data['NAME']]) : RSFormProHelper::htmlEscape($defaultValue)) . '" size="' . $data['SIZE'] . '" ' . ((int) $data['MAXSIZE'] > 0 ? 'maxlength="' . (int) $data['MAXSIZE'] . '"' : '') . ' name="form[' . $data['NAME'] . ']" id="' . $data['NAME'] . '" ' . $data['ADDITIONALATTRIBUTES'] . '/>';
break;
case 2:
case 'textArea':
$defaultValue = RSFormProHelper::isCode($data['DEFAULTVALUE']);
$className = 'rsform-text-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
if (isset($data['WYSIWYG']) && $data['WYSIWYG'] == 'YES') {
$out .= RSFormProHelper::WYSIWYG('form[' . $data['NAME'] . ']', isset($value[$data['NAME']]) ? RSFormProHelper::htmlEscape($value[$data['NAME']]) : RSFormProHelper::htmlEscape($defaultValue), 'id[' . $data['NAME'] . ']', $data['COLS'] * 10, $data['ROWS'] * 10, $data['COLS'], $data['ROWS']);
} else {
$out .= '<textarea cols="' . (int) $data['COLS'] . '" rows="' . (int) $data['ROWS'] . '" name="form[' . $data['NAME'] . ']" id="' . $data['NAME'] . '" ' . $data['ADDITIONALATTRIBUTES'] . '>' . (isset($value[$data['NAME']]) ? RSFormProHelper::htmlEscape($value[$data['NAME']]) : RSFormProHelper::htmlEscape($defaultValue)) . '</textarea>';
}
break;
case 3:
case 'selectList':
$className = 'rsform-select-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
$out .= '<select ' . ($data['MULTIPLE'] == 'YES' ? 'multiple="multiple"' : '') . ' name="form[' . $data['NAME'] . '][]" ' . ((int) $data['SIZE'] > 0 ? 'size="' . (int) $data['SIZE'] . '"' : '') . ' id="' . $data['NAME'] . '" ' . $data['ADDITIONALATTRIBUTES'] . ' >';
$items = RSFormProHelper::isCode($data['ITEMS']);
$items = str_replace("\r", "", $items);
$items = explode("\n", $items);
foreach ($items as $item) {
$buf = explode('|', $item, 2);
if (preg_match('/\\[g\\]/', $item)) {
$out .= '<optgroup label="' . RSFormProHelper::htmlEscape(str_replace('[g]', '', $item)) . '">';
continue;
}
if (preg_match('/\\[\\/g\\]/', $item)) {
$out .= '</optgroup>';
continue;
}
$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']]) && in_array($option_value_trimmed, $value[$data['NAME']])) {
$option_checked = true;
}
$out .= '<option ' . ($option_checked ? 'selected="selected"' : '') . ' value="' . RSFormProHelper::htmlEscape($option_value_trimmed) . '">' . RSFormProHelper::htmlEscape($option_shown_trimmed) . '</option>';
}
$out .= '</select>';
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$layout = JRequest::getCmd('layout');
if ($option == 'com_rsevents' && $view == 'events' && $layout == 'subscribe' && $data['NAME'] == 'RSEventsTickets') {
$db->setQuery("SELECT ConfigValue FROM #__rsevents_config WHERE ConfigName = 'event.multiple.tickets' ");
$multipleTickets = $db->loadResult();
if ($multipleTickets) {
$lang =& JFactory::getLanguage();
$lang->load('com_rsevents', JPATH_SITE);
$out .= ' <a onclick="add_ticket(1,\'' . JText::_('RSE_REMOVE_TICKET', true) . '\');" href="javascript:void(0)">' . JText::_('RSE_ADD_TICKET') . '</a> ';
$out .= '<br /><span id="tickets"></span>';
$out .= '<span id="rse_tickets_ids"></span>' . "\n";
$out .= '<span id="rse_tickets_no"></span>' . "\n";
}
}
break;
case 4:
case 'checkboxGroup':
$i = 0;
$items = RSFormProHelper::isCode($data['ITEMS']);
$items = str_replace("\r", "", $items);
$items = explode("\n", $items);
foreach ($items as $item) {
$buf = explode('|', $item, 2);
//.........这里部分代码省略.........
示例2: getFrontComponentBody
public static function getFrontComponentBody($formId, $componentId, $data, $value = array(), $invalid = false, $layoutName)
{
$mainframe = JFactory::getApplication();
$doc = JFactory::getDocument();
$formId = (int) $formId;
$componentId = (int) $componentId;
$db = JFactory::getDBO();
// For legacy reasons...
$r = array();
$r['ComponentTypeId'] = $data['componentTypeId'];
$r['Order'] = @$data['Order'];
$out = '';
// calculation handling
$pricePattern = '#\\[p(.*?)\\]#is';
$prices = array();
//Trigger Event - rsfp_bk_onBeforeCreateFrontComponentBody
$mainframe->triggerEvent('rsfp_bk_onBeforeCreateFrontComponentBody', array(array('out' => &$out, 'formId' => $formId, 'componentId' => $componentId, 'data' => &$data, 'value' => &$value)));
switch ($data['ComponentTypeName']) {
case 1:
case 'textBox':
if (isset($data['VALIDATIONRULE']) && $data['VALIDATIONRULE'] == 'password') {
$defaultValue = '';
} else {
$defaultValue = RSFormProHelper::isCode($data['DEFAULTVALUE']);
}
$className = 'rsform-input-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
$out .= '<input type="text" value="' . (isset($value[$data['NAME']]) ? RSFormProHelper::htmlEscape($value[$data['NAME']]) : RSFormProHelper::htmlEscape($defaultValue)) . '" size="' . $data['SIZE'] . '" ' . ((int) $data['MAXSIZE'] > 0 ? 'maxlength="' . (int) $data['MAXSIZE'] . '"' : '') . ' name="form[' . $data['NAME'] . ']" id="' . $data['NAME'] . '" ' . $data['ADDITIONALATTRIBUTES'] . '/>';
break;
case 2:
case 'textArea':
$defaultValue = RSFormProHelper::isCode($data['DEFAULTVALUE']);
$className = 'rsform-text-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
if (isset($data['WYSIWYG']) && $data['WYSIWYG'] == 'YES') {
$out .= RSFormProHelper::WYSIWYG('form[' . $data['NAME'] . ']', isset($value[$data['NAME']]) ? RSFormProHelper::htmlEscape($value[$data['NAME']]) : RSFormProHelper::htmlEscape($defaultValue), 'id[' . $data['NAME'] . ']', $data['COLS'] * 10, $data['ROWS'] * 10, $data['COLS'], $data['ROWS']);
} else {
$out .= '<textarea cols="' . (int) $data['COLS'] . '" rows="' . (int) $data['ROWS'] . '" name="form[' . $data['NAME'] . ']" id="' . $data['NAME'] . '" ' . $data['ADDITIONALATTRIBUTES'] . '>' . (isset($value[$data['NAME']]) ? RSFormProHelper::htmlEscape($value[$data['NAME']]) : RSFormProHelper::htmlEscape($defaultValue)) . '</textarea>';
}
break;
case 3:
case 'selectList':
$className = 'rsform-select-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
$out .= '<select ' . ($data['MULTIPLE'] == 'YES' ? 'multiple="multiple"' : '') . ' name="form[' . $data['NAME'] . '][]" ' . ((int) $data['SIZE'] > 0 ? 'size="' . (int) $data['SIZE'] . '"' : '') . ' id="' . $data['NAME'] . '" ' . $data['ADDITIONALATTRIBUTES'] . ' >';
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS']));
$special = array('[c]', '[g]', '[d]');
foreach ($items as $item) {
$hasPrice = false;
if (preg_match($pricePattern, $item, $match)) {
$hasPrice = true;
$price = $match[1];
}
$item = preg_replace($pricePattern, '', $item);
@(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
if (is_null($txt)) {
$txt = $val;
}
// <optgroup>
if (strpos($item, '[g]') !== false) {
$out .= '<optgroup label="' . RSFormProHelper::htmlEscape($val) . '">';
continue;
}
// </optgroup>
if (strpos($item, '[/g]') !== false) {
$out .= '</optgroup>';
continue;
}
$additional = '';
// selected
if (strpos($item, '[c]') !== false && empty($value) || isset($value[$data['NAME']]) && in_array($val, $value[$data['NAME']])) {
$additional .= 'selected="selected"';
}
// disabled
if (strpos($item, '[d]') !== false) {
$additional .= 'disabled="disabled"';
}
if ($hasPrice) {
$prices[$val] = $price;
}
$out .= '<option ' . $additional . ' value="' . RSFormProHelper::htmlEscape($val) . '">' . RSFormProHelper::htmlEscape($txt) . '</option>';
}
$out .= '</select>';
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$layout = JRequest::getCmd('layout');
if ($option == 'com_rsevents' && $view == 'events' && $layout == 'subscribe' && $data['NAME'] == 'RSEventsTickets') {
$db->setQuery("SELECT ConfigValue FROM #__rsevents_config WHERE ConfigName = 'event.multiple.tickets' ");
$multipleTickets = $db->loadResult();
if ($multipleTickets) {
$lang = JFactory::getLanguage();
//.........这里部分代码省略.........
示例3: rsfp_bk_onAfterCreateFrontComponentBody
public function rsfp_bk_onAfterCreateFrontComponentBody($args)
{
$db = JFactory::getDBO();
$nodecimals = RSFormProHelper::getConfig('payment.nodecimals');
$decimal = RSFormProHelper::getConfig('payment.decimal');
$thousands = RSFormProHelper::getConfig('payment.thousands');
$currency = RSFormProHelper::getConfig('payment.currency');
$totalMask = RSFormProHelper::getConfig('payment.totalmask');
$value = $args['value'];
$formId = (int) $args['formId'];
$db->setQuery("SELECT FormLayoutName FROM #__rsform_forms WHERE FormId='" . $formId . "'");
$layoutName = $db->loadResult();
$out =& $args['out'];
$data =& $args['data'];
$invalid =& $args['invalid'];
switch ($args['r']['ComponentTypeId']) {
case 21:
$out = '<input type="hidden" value="' . $this->_escape($data['PRICE']) . '" />';
$out .= '<input type="hidden" name="form[' . $data['NAME'] . ']" id="' . $data['NAME'] . '" value="' . $this->_escape($data['CAPTION']) . '" />';
break;
case 22:
if (!isset($this->_products[$args['componentId']])) {
$this->_products[$args['componentId']] = array();
}
switch ($args['data']['VIEW_TYPE']) {
case 'DROPDOWN':
$className = 'rsform-select-box';
if ($invalid) {
$className .= ' rsform-error';
}
RSFormProHelper::addClass($data['ADDITIONALATTRIBUTES'], $className);
$out .= '<select ' . ($data['MULTIPLE'] == 'YES' ? 'multiple="multiple"' : '') . ' name="form[' . $data['NAME'] . '][]" ' . ((int) $data['SIZE'] > 0 ? 'size="' . (int) $data['SIZE'] . '"' : '') . ' id="payment-' . $args['componentId'] . '" ' . $data['ADDITIONALATTRIBUTES'] . ' onchange="getPrice_' . $args['formId'] . '();">';
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS']));
$special = array('[c]', '[g]', '[d]');
foreach ($items as $item) {
@(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
if (is_null($txt)) {
$txt = $val;
}
if ($val) {
$txt_price = $this->_getPriceMask($txt, $val);
} else {
// no point showing - 0.00
$txt_price = $txt;
if ($val === '0') {
$val = $txt;
}
}
// <optgroup>
if (strpos($item, '[g]') !== false) {
$out .= '<optgroup label="' . $this->_escape($val) . '">';
continue;
}
// </optgroup>
if (strpos($item, '[/g]') !== false) {
$out .= '</optgroup>';
continue;
}
$additional = '';
// selected
if (strpos($item, '[c]') !== false && empty($value) || isset($value[$data['NAME']]) && in_array($txt, $value[$data['NAME']])) {
$additional .= 'selected="selected"';
}
// disabled
if (strpos($item, '[d]') !== false) {
$additional .= 'disabled="disabled"';
}
$out .= '<option ' . $additional . ' value="' . ($val ? $this->_escape($txt) : '') . '">' . $this->_escape($txt_price) . '</option>';
$this->_products[$args['componentId']][] = array('val' => $val, 'txt' => $txt);
}
$out .= '</select>';
break;
case 'CHECKBOX':
$i = 0;
$items = RSFormProHelper::explode(RSFormProHelper::isCode($data['ITEMS']));
$special = array('[c]', '[d]');
foreach ($items as $item) {
@(list($val, $txt) = @explode('|', str_replace($special, '', $item), 2));
if (is_null($txt)) {
$txt = $val;
}
if ($val) {
$txt_price = $this->_getPriceMask($txt, $val);
} else {
// no point showing - 0.00
$txt_price = $txt;
if ($val === '0') {
$val = $txt;
}
}
$additional = '';
// checked
if (strpos($item, '[c]') !== false && empty($value) || isset($value[$data['NAME']]) && in_array($txt, $value[$data['NAME']])) {
$additional .= 'checked="checked"';
}
// disabled
if (strpos($item, '[d]') !== false) {
$additional .= 'disabled="disabled"';
}
if ($data['FLOW'] == 'VERTICAL' && $layoutName == 'responsive') {
//.........这里部分代码省略.........