本文整理汇总了PHP中RSMembershipHelper::getCalendarFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::getCalendarFormat方法的具体用法?PHP RSMembershipHelper::getCalendarFormat怎么用?PHP RSMembershipHelper::getCalendarFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::getCalendarFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showCustomField
//.........这里部分代码省略.........
$field->values = RSMembershipHelper::isCode($field->values);
$field->values = str_replace("\r\n", "\n", $field->values);
$field->values = explode("\n", $field->values);
if ($editable) {
foreach ($field->values as $i => $value) {
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
$found_checked = false;
if (preg_match('/\\[c\\]/', $value)) {
$value = str_replace('[c]', '', $value);
$label = str_replace('[c]', '', $label);
$val = str_replace('[c]', '', $val);
$found_checked = true;
}
$checked = '';
if (isset($selected[$field->name]) && in_array($val, $selected[$field->name])) {
$checked = 'checked="checked"';
} elseif (!isset($selected[$field->name]) && $found_checked) {
$checked = 'checked="checked"';
}
$name = $name_field . '[' . $field->name . '][]';
$return[1] .= '<input ' . $checked . ' type="checkbox" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'utf-8') . '" id="rsm_field_' . $field->id . '_' . $i . '" ' . RSMembershipHelper::addClass($field->additional, 'pull-left rsm-margin-chradio') . ' /> <label for="rsm_field_' . $field->id . '_' . $i . '">' . $label . '</label>';
}
} else {
$return[1] = '';
if (isset($selected[$field->name])) {
foreach ($field->values as $value) {
$value = str_replace('[c]', '', $value);
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
if (is_array($selected[$field->name]) && in_array($val, $selected[$field->name]) || !is_array($selected[$field->name]) && $selected[$field->name] == $val) {
$return[1] .= htmlspecialchars($label, ENT_COMPAT, 'utf-8') . '<br />';
}
}
}
}
break;
case 'radio':
$field->values = RSMembershipHelper::isCode($field->values);
$field->values = str_replace("\r\n", "\n", $field->values);
$field->values = explode("\n", $field->values);
if ($editable) {
foreach ($field->values as $i => $value) {
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
$found_checked = false;
if (preg_match('/\\[c\\]/', $value)) {
$value = str_replace('[c]', '', $value);
$label = str_replace('[c]', '', $label);
$val = str_replace('[c]', '', $val);
$found_checked = true;
}
$checked = '';
if (isset($selected[$field->name]) && $selected[$field->name] == $val) {
$checked = 'checked="checked"';
} elseif (!isset($selected[$field->name]) && $found_checked) {
$checked = 'checked="checked"';
}
$name = $name_field . '[' . $field->name . ']';
$return[1] .= '<input ' . $checked . ' type="radio" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'utf-8') . '" id="rsm_field_' . $field->id . '_' . $i . '" ' . RSMembershipHelper::addClass($field->additional, 'pull-left rsm-margin-chradio') . '/> <label for="rsm_field_' . $field->id . '_' . $i . '">' . $label . '</label>';
}
} else {
$return[1] = '';
if (isset($selected[$field->name])) {
foreach ($field->values as $value) {
$value = str_replace('[c]', '', $value);
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
if ($selected[$field->name] == $val) {
$return[1] .= htmlspecialchars($label, ENT_COMPAT, 'utf-8') . '<br />';
}
}
}
}
break;
case 'calendar':
if (isset($selected[$field->name])) {
$field->values = $selected[$field->name];
} else {
$field->values = RSMembershipHelper::isCode($field->values);
}
$name = $name_field . '[' . $field->name . ']';
$format = RSMembershipHelper::getConfig('date_format');
$format = RSMembershipHelper::getCalendarFormat($format);
if ($editable) {
$return[1] = JHTML::_('calendar', $field->values, $name, 'rsm_' . $field->name, $format, $field->additional);
} else {
$return[1] = htmlspecialchars($field->values, ENT_COMPAT, 'utf-8');
}
break;
}
if ($field->required && $editable && $show_required) {
/*$return[1] .= ' '.JText::_('COM_RSMEMBERSHIP_REQUIRED');*/
}
return $return;
}
示例2: showCustomField
//.........这里部分代码省略.........
break;
case 'checkbox':
$field->values = RSMembershipHelper::isCode($field->values);
$field->values = str_replace("\r\n", "\n", $field->values);
$field->values = explode("\n", $field->values);
foreach ($field->values as $i => $value) {
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
$found_checked = false;
if (preg_match('/\\[c\\]/', $value)) {
$value = str_replace('[c]', '', $value);
$label = str_replace('[c]', '', $label);
$val = str_replace('[c]', '', $val);
$found_checked = true;
}
$checked = '';
if (isset($selected[$field->name]) && in_array($val, $selected[$field->name])) {
$checked = 'checked="checked"';
} elseif (!isset($selected[$field->name]) && $found_checked) {
$checked = 'checked="checked"';
}
$name = 'rsm_fields[' . $field->name . '][]';
$return[1] .= '<input ' . $checked . ' type="checkbox" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'utf-8') . '" id="rsm_field_' . $field->id . '_' . $i . '" ' . $field->additional . ' /> <label for="rsm_field_' . $field->id . '_' . $i . '">' . $label . '</label>';
}
if (!$editable) {
$return[1] = '';
if (isset($selected[$field->name])) {
foreach ($field->values as $value) {
$value = str_replace('[c]', '', $value);
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
if (is_array($selected[$field->name]) && in_array($val, $selected[$field->name]) || !is_array($selected[$field->name]) && $selected[$field->name] == $val) {
$return[1] .= htmlspecialchars($label, ENT_COMPAT, 'utf-8') . '<br />';
}
}
}
}
break;
case 'radio':
$field->values = RSMembershipHelper::isCode($field->values);
$field->values = str_replace("\r\n", "\n", $field->values);
$field->values = explode("\n", $field->values);
foreach ($field->values as $i => $value) {
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
$found_checked = false;
if (preg_match('/\\[c\\]/', $value)) {
$value = str_replace('[c]', '', $value);
$label = str_replace('[c]', '', $label);
$val = str_replace('[c]', '', $val);
$found_checked = true;
}
$checked = '';
if (isset($selected[$field->name]) && $selected[$field->name] == $val) {
$checked = 'checked="checked"';
} elseif (!isset($selected[$field->name]) && $found_checked) {
$checked = 'checked="checked"';
}
$name = 'rsm_fields[' . $field->name . ']';
$return[1] .= '<input ' . $checked . ' type="radio" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'utf-8') . '" id="rsm_field_' . $field->id . '_' . $i . '" ' . $field->additional . ' /> <label for="rsm_field_' . $field->id . '_' . $i . '">' . $label . '</label>';
}
if (!$editable) {
$return[1] = '';
if (isset($selected[$field->name])) {
foreach ($field->values as $value) {
$value = str_replace('[c]', '', $value);
$tmp = explode('|', $value, 2);
$label = isset($tmp[1]) ? $tmp[1] : $tmp[0];
$val = $tmp[0];
if ($selected[$field->name] == $val) {
$return[1] .= htmlspecialchars($label, ENT_COMPAT, 'utf-8') . '<br />';
}
}
}
}
break;
case 'calendar':
if (isset($selected[$field->name])) {
$field->values = $selected[$field->name];
} else {
$field->values = RSMembershipHelper::isCode($field->values);
}
$name = 'rsm_fields[' . $field->name . ']';
$format = RSMembershipHelper::getConfig('date_format');
$format = RSMembershipHelper::getCalendarFormat($format);
if ($editable) {
$return[1] = JHTML::_('calendar', $field->values, $name, 'rsm_' . $field->name, $format, $field->additional);
} else {
$return[1] = htmlspecialchars($field->values, ENT_COMPAT, 'utf-8');
}
break;
}
if ($field->required && $editable && $show_required) {
$return[1] .= ' ' . JText::_('RSM_REQUIRED');
}
return $return;
}