本文整理汇总了PHP中RSFormProHelper::WYSIWYG方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::WYSIWYG方法的具体用法?PHP RSFormProHelper::WYSIWYG怎么用?PHP RSFormProHelper::WYSIWYG使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::WYSIWYG方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditFields
function getEditFields()
{
$isPDF = JRequest::getVar('format') == 'pdf';
$cid = $this->getSubmissionId();
$return = array();
$this->_db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . $cid . "'");
$submission = $this->_db->loadObject();
if (empty($submission)) {
$mainframe = JFactory::getApplication();
$mainframe->redirect('index.php?option=com_rsform&task=submissions.manage');
return $return;
}
if ($isPDF) {
$this->_db->setQuery("SELECT MultipleSeparator, TextareaNewLines FROM #__rsform_forms WHERE FormId='" . $submission->FormId . "'");
$form = $this->_db->loadObject();
$form->MultipleSeparator = str_replace(array('\\n', '\\r', '\\t'), array("\n", "\r", "\t"), $form->MultipleSeparator);
}
$this->_db->setQuery("SELECT FieldName, FieldValue FROM #__rsform_submission_values WHERE SubmissionId='" . $cid . "'");
$fields = $this->_db->loadObjectList();
foreach ($fields as $field) {
$submission->values[$field->FieldName] = $field->FieldValue;
}
unset($fields);
$this->_db->setQuery("SELECT p.PropertyValue, ct.ComponentTypeName, c.ComponentId FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (p.ComponentId=c.ComponentId) LEFT JOIN #__rsform_component_types ct ON (c.ComponentTypeId=ct.ComponentTypeId) WHERE c.FormId='" . $submission->FormId . "' AND c.Published='1' AND p.PropertyName='NAME' ORDER BY `Order`");
$fields = $this->_db->loadObjectList();
if (empty($fields)) {
return $return;
}
$componentIds = array();
foreach ($fields as $field) {
$componentIds[] = $field->ComponentId;
}
$properties = RSFormProHelper::getComponentProperties($componentIds);
foreach ($fields as $field) {
$data = $properties[$field->ComponentId];
$new_field = array();
$new_field[0] = $field->PropertyValue;
$name = $field->PropertyValue;
$value = isset($submission->values[$field->PropertyValue]) ? $submission->values[$field->PropertyValue] : '';
if ($data['NAME'] == 'RSEProPayment') {
$field->ComponentTypeName = 'rsepropayment';
}
switch ($field->ComponentTypeName) {
// skip this field for now, no need to edit it
case 'freeText':
continue 2;
break;
default:
if ($isPDF) {
$new_field[1] = RSFormProHelper::htmlEscape($value);
} else {
if (strpos($value, "\n") !== false || strpos($value, "\r") !== false) {
$new_field[1] = '<textarea style="width: 95%" class="rs_textarea" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
} else {
$new_field[1] = '<input class="rs_inp rs_80"" size="105" type="text" name="form[' . $name . ']" value="' . RSFormProHelper::htmlEscape($value) . '" />';
}
}
break;
case 'textArea':
if ($isPDF) {
if (isset($data['WYSIWYG']) && $data['WYSIWYG'] == 'YES') {
$value = $value;
} elseif ($form->TextareaNewLines) {
$value = nl2br(RSFormProHelper::htmlEscape($value));
}
$new_field[1] = $value;
} elseif (isset($data['WYSIWYG']) && $data['WYSIWYG'] == 'YES') {
$new_field[1] = RSFormProHelper::WYSIWYG('form[' . $name . ']', RSFormProHelper::htmlEscape($value), '', 600, 100, 60, 10);
} else {
$new_field[1] = '<textarea style="width: 95%" class="rs_textarea" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
}
break;
case 'radioGroup':
case 'checkboxGroup':
case 'selectList':
if ($isPDF) {
$new_field[1] = str_replace("\n", $form->MultipleSeparator, $value);
break;
}
if ($field->ComponentTypeName == 'radioGroup') {
$data['SIZE'] = 0;
$data['MULTIPLE'] = 'NO';
} elseif ($field->ComponentTypeName == 'checkboxGroup') {
$data['SIZE'] = 5;
$data['MULTIPLE'] = 'YES';
}
$value = RSFormProHelper::explode($value);
$items = RSFormProHelper::isCode($data['ITEMS']);
$items = RSFormProHelper::explode($items);
$options = array();
foreach ($items as $item) {
// <OPTGROUP>
if (preg_match('/\\[g\\]/', $item)) {
$item = str_replace('[g]', '', $item);
$optgroup = new stdClass();
$optgroup->value = '<OPTGROUP>';
$optgroup->text = $item;
$options[] = $optgroup;
continue;
}
//.........这里部分代码省略.........
示例2: getEditFields
public static function getEditFields($cid)
{
$db = JFactory::getDbo();
$return = array();
$values = JFactory::getApplication()->input->get('form', array(), 'array');
$pattern = '#\\[p(.*?)\\]#is';
$db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . (int) $cid . "'");
$submission = $db->loadObject();
if (empty($submission)) {
$mainframe = JFactory::getApplication();
$mainframe->redirect(JURI::root());
return $return;
}
$validation = !empty($values) ? RSFormProHelper::validateForm($submission->FormId, 'directory') : array();
$formFields = RSFormProHelper::getDirectoryFields($submission->FormId);
$editable = array();
foreach ($formFields as $formField) {
if ($formField->editable) {
$editable[] = $formField->FieldName;
}
}
$db->setQuery("SELECT FieldName, FieldValue FROM #__rsform_submission_values WHERE SubmissionId='" . (int) $cid . "'");
$fields = $db->loadObjectList();
foreach ($fields as $field) {
$submission->values[$field->FieldName] = $field->FieldValue;
}
unset($fields);
$db->setQuery("SELECT p.PropertyValue, ct.ComponentTypeName, c.ComponentId FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (p.ComponentId=c.ComponentId) LEFT JOIN #__rsform_component_types ct ON (c.ComponentTypeId=ct.ComponentTypeId) WHERE c.FormId='" . $submission->FormId . "' AND c.Published='1' AND p.PropertyName='NAME' ORDER BY `Order`");
$fields = $db->loadObjectList();
if (empty($fields)) {
return $return;
}
$componentIds = array();
foreach ($fields as $field) {
$componentIds[] = $field->ComponentId;
}
$properties = RSFormProHelper::getComponentProperties($componentIds);
$fields = RSFormProHelper::sortFields($fields, $editable);
foreach ($fields as $field) {
if (!in_array($field->PropertyValue, $editable)) {
continue;
}
$invalid = !empty($validation) && in_array($field->ComponentId, $validation) ? ' rsform-error' : '';
$data = $properties[$field->ComponentId];
$new_field = array();
$new_field[0] = !empty($data['CAPTION']) ? $data['CAPTION'] : $field->PropertyValue;
$new_field[2] = isset($data['REQUIRED']) && $data['REQUIRED'] == 'YES' ? '<strong class="formRequired">(*)</strong>' : '';
$new_field[3] = $field->PropertyValue;
$name = $field->PropertyValue;
if (isset($values[$field->PropertyValue])) {
$value = $values[$field->PropertyValue];
} else {
$value = isset($submission->values[$field->PropertyValue]) ? $submission->values[$field->PropertyValue] : '';
}
if ($data['NAME'] == 'RSEProPayment') {
$field->ComponentTypeName = 'rsepropayment';
}
switch ($field->ComponentTypeName) {
// skip this field for now, no need to edit it
case 'freeText':
continue 2;
break;
default:
if (strpos($value, "\n") !== false || strpos($value, "\r") !== false) {
$new_field[1] = '<textarea style="width: 95%" class="rs_textarea' . $invalid . '" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
} else {
$new_field[1] = '<input class="rs_inp rs_80' . $invalid . '" type="text" name="form[' . $name . ']" value="' . RSFormProHelper::htmlEscape($value) . '" />';
}
break;
case 'textArea':
if (isset($data['WYSIWYG']) && $data['WYSIWYG'] == 'YES') {
$new_field[1] = RSFormProHelper::WYSIWYG('form[' . $name . ']', RSFormProHelper::htmlEscape($value), '', 600, 100, 60, 10);
} else {
$new_field[1] = '<textarea style="width: 95%" class="rs_textarea' . $invalid . '" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
}
break;
case 'radioGroup':
case 'checkboxGroup':
case 'selectList':
if ($field->ComponentTypeName == 'radioGroup') {
$data['SIZE'] = 0;
$data['MULTIPLE'] = 'NO';
} elseif ($field->ComponentTypeName == 'checkboxGroup') {
$data['SIZE'] = 5;
$data['MULTIPLE'] = 'YES';
}
$value = !empty($values) ? $value : RSFormProHelper::explode($value);
$items = RSFormProHelper::isCode($data['ITEMS']);
$items = RSFormProHelper::explode($items);
$options = array();
foreach ($items as $item) {
if (preg_match($pattern, $item, $match)) {
$item = preg_replace($pattern, '', $item);
}
// <OPTGROUP>
if (preg_match('/\\[g\\]/', $item)) {
$item = str_replace('[g]', '', $item);
$optgroup = new stdClass();
$optgroup->value = '<OPTGROUP>';
$optgroup->text = $item;
//.........这里部分代码省略.........
示例3: WYSIWYG
function WYSIWYG($name, $content, $hiddenField, $width, $height, $col, $row)
{
return RSFormProHelper::WYSIWYG($name, $content, $hiddenField, $width, $height, $col, $row);
}
示例4: getEditFields
public static function getEditFields($cid)
{
$db = JFactory::getDbo();
$return = array();
$values = JFactory::getApplication()->input->get('form', array(), 'array');
$pattern = '#\\[p(.*?)\\]#is';
// Load submission
$query = $db->getQuery(true);
$query->select('*')->from($db->qn('#__rsform_submissions'))->where($db->qn('SubmissionId') . '=' . $db->q($cid));
$submission = $db->setQuery($query)->loadObject();
if (empty($submission)) {
return $return;
}
$submission->DateSubmitted = JHtml::_('date', $submission->DateSubmitted, 'Y-m-d H:i:s');
// Get submission values
$submission->values = array();
$query->clear()->select($db->qn('FieldName'))->select($db->qn('FieldValue'))->from($db->qn('#__rsform_submission_values'))->where($db->qn('SubmissionId') . '=' . $db->q($cid));
if ($values = $db->setQuery($query)->loadObjectList()) {
foreach ($values as $value) {
$submission->values[$value->FieldName] = $value->FieldValue;
}
unset($values);
}
$validation = !empty($values) ? RSFormProHelper::validateForm($submission->FormId, 'directory') : array();
$formFields = self::getDirectoryFields($submission->FormId);
$headers = self::getDirectoryStaticHeaders();
$query = $db->getQuery(true);
$query->select($db->qn('ct.ComponentTypeName', 'type'))->select($db->qn('c.ComponentId'))->from($db->qn('#__rsform_components', 'c'))->join('left', $db->qn('#__rsform_component_types', 'ct') . ' ON (' . $db->qn('c.ComponentTypeId') . '=' . $db->qn('ct.ComponentTypeId') . ')')->where($db->qn('c.FormId') . '=' . $db->q($submission->FormId))->where($db->qn('c.Published') . '=' . $db->q(1));
$componentTypes = $db->setQuery($query)->loadObjectList('ComponentId');
$componentIds = array();
foreach ($formFields as $formField) {
if ($formField->FieldId > 0) {
$componentIds[] = $formField->FieldId;
}
// Assign the type
$formField->type = '';
if ($formField->FieldId < 0) {
$formField->type = 'static';
} elseif (isset($componentTypes[$formField->FieldId])) {
$formField->type = $componentTypes[$formField->FieldId]->type;
}
// For convenience...
$formField->id = $formField->FieldId;
$formField->name = $formField->FieldName;
}
$properties = RSFormProHelper::getComponentProperties($componentIds);
foreach ($formFields as $field) {
if (!$field->editable) {
continue;
}
$invalid = !empty($validation) && in_array($field->id, $validation) ? ' rsform-error' : '';
$data = $field->id > 0 ? $properties[$field->id] : array('NAME' => $field->name);
$new_field = array();
$new_field[0] = !empty($data['CAPTION']) ? $data['CAPTION'] : $field->name;
$new_field[2] = isset($data['REQUIRED']) && $data['REQUIRED'] == 'YES' ? '<strong class="formRequired">(*)</strong>' : '';
$new_field[3] = $field->name;
$name = $field->name;
if ($field->type != 'static') {
if (isset($values[$field->name])) {
$value = $values[$field->name];
} else {
$value = isset($submission->values[$field->name]) ? $submission->values[$field->name] : '';
}
} else {
$value = isset($submission->{$field->name}) ? $submission->{$field->name} : '';
}
if ($data['NAME'] == 'RSEProPayment') {
$field->type = 'rsepropayment';
}
switch ($field->type) {
case 'static':
$new_field[0] = JText::_('RSFP_' . $field->name);
// Show a dropdown for yes/no
if ($field->name == 'confirmed') {
$options = array(JHtml::_('select.option', 0, JText::_('RSFP_NO')), JHtml::_('select.option', 1, JText::_('RSFP_YES')));
$new_field[1] = JHTML::_('select.genericlist', $options, 'formStatic[confirmed]', null, 'value', 'text', $value);
} else {
$new_field[1] = '<input class="rs_inp rs_80" type="text" name="formStatic[' . $name . ']" value="' . RSFormProHelper::htmlEscape($value) . '" />';
}
break;
// skip this field for now, no need to edit it
// skip this field for now, no need to edit it
case 'freeText':
continue 2;
break;
default:
if (strpos($value, "\n") !== false || strpos($value, "\r") !== false) {
$new_field[1] = '<textarea style="width: 95%" class="rs_textarea' . $invalid . '" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
} else {
$new_field[1] = '<input class="rs_inp rs_80' . $invalid . '" type="text" name="form[' . $name . ']" value="' . RSFormProHelper::htmlEscape($value) . '" />';
}
break;
case 'textArea':
if (isset($data['WYSIWYG']) && $data['WYSIWYG'] == 'YES') {
$new_field[1] = RSFormProHelper::WYSIWYG('form[' . $name . ']', RSFormProHelper::htmlEscape($value), '', 600, 100, 60, 10);
} else {
$new_field[1] = '<textarea style="width: 95%" class="rs_textarea' . $invalid . '" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
}
break;
case 'radioGroup':
//.........这里部分代码省略.........
示例5: getFrontComponentBody
public static function getFrontComponentBody($formId, $componentId, $data, $value = array(), $invalid = false, $layoutName)
{
$mainframe = JFactory::getApplication();
$formId = (int) $formId;
$componentId = (int) $componentId;
$db = JFactory::getDBO();
// 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':
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) {
@(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"';
}
$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();
$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::explode(RSFormProHelper::isCode($data['ITEMS']));
$special = array('[c]', '[d]');
//.........这里部分代码省略.........
示例6: 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);
//.........这里部分代码省略.........