本文整理汇总了PHP中vmJsApi::JcountryStateList方法的典型用法代码示例。如果您正苦于以下问题:PHP vmJsApi::JcountryStateList方法的具体用法?PHP vmJsApi::JcountryStateList怎么用?PHP vmJsApi::JcountryStateList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vmJsApi
的用法示例。
在下文中一共展示了vmJsApi::JcountryStateList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderStateList
/**
* Render a simple state list
*
* @author jseros, Patrick Kohl
*
* @param int $stateID Selected state id
* @param int $countryID Selected country id
* @param string $dependentField Parent <select /> ID attribute
* @param string $_prefix Optional prefix for the formtag name attribute
* @return string HTML containing the <select />
*/
public static function renderStateList($stateId = '0', $_prefix = '', $multiple = FALSE, $required = 0)
{
if (is_array($stateId)) {
$stateId = implode(",", $stateId);
}
vmJsApi::JcountryStateList($stateId, $_prefix);
if ($multiple) {
$attrs = 'multiple="multiple" size="12" name="' . $_prefix . 'virtuemart_state_id[]" ';
//$class = 'class="inputbox multiple"';
} else {
/*$app = JFactory::getApplication();
if($app->isSite()) {
$class = 'class="chzn-select"';
} else {
$class = 'class="inputbox multiple"';
}*/
$attrs = 'name="' . $_prefix . 'virtuemart_state_id" ';
}
if ($required != 0) {
$attrs .= ' required';
}
$attrs .= ' class="vm-chzn-select"';
$listHTML = '<select id="' . $_prefix . 'virtuemart_state_id" ' . $attrs . '>
<option value="">' . JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . '</option>
</select>';
return $listHTML;
}
示例2: renderStateList
/**
* Render a simple state list
*
* @author Patrick Kohl
* NOte Patrick Kohl added unique ID, javascript is broken if you have 2 lists
* @param int $stateID Selected state id
* @param int $countryID Selected country id
* @param string $dependentField Parent <select /> ID attribute
* @param string $_prefix Optional prefix for the formtag name attribute
* @return string HTML containing the <select />
*/
public static function renderStateList($stateId = '0', $prefix = '', $multiple = FALSE, $required = 0)
{
$id = $prefix . 'virtuemart_state_id';
// prevent using same ID, in all case this break the sate render if id is same.
static $keys = array();
if (isset($keys[$id])) {
return;
}
$keys[$id] = true;
if (is_array($stateId)) {
$stateId = implode(",", $stateId);
}
vmJsApi::JcountryStateList($stateId, $prefix);
if ($multiple) {
$attrs = 'multiple="multiple" size="12" name="' . $id . '[]" ';
//$class = 'class="inputbox multiple"';
} else {
$attrs = 'size="1" name="' . $id . '" ';
}
if ($required != 0) {
$attrs .= ' required';
}
$class = 'class="inputbox multiple"';
$listHTML = '<select ' . $class . ' id="' . $id . '" ' . $attrs . '>
<option value="">' . JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . '</option>
</select>';
return $listHTML;
}
示例3: renderStateList
/**
* Render a simple state list
*
* @author Valerie Isaksen, Max Milbers
*
* @param int $stateID Selected state id
* @param int $countryID Selected country id
* @param string $dependentField Parent <select /> ID attribute
* @param string $_prefix Optional prefix for the formtag name attribute
* @return string HTML containing the <select />
*/
public static function renderStateList($stateId = '0', $_prefix = '', $multiple = FALSE, $required = 0, $attribs = array())
{
if (is_array($stateId)) {
$stateId = implode(",", $stateId);
}
vmJsApi::JcountryStateList($stateId, $_prefix);
$attrs['class'] = 'vm-chzn-select';
if ($multiple) {
$attrs['name'] = $_prefix . 'virtuemart_state_id[]';
$attrs['multiple'] = 'multiple';
} else {
$attrs['name'] = $_prefix . 'virtuemart_state_id';
}
/*if ($required != 0) {
$attrs['class'] .= ' required ';
}*/
if (is_array($attribs)) {
$attrs = array_merge($attrs, $attribs);
}
$attrString = JArrayHelper::toString($attrs);
$listHTML = '<select id="' . $_prefix . 'virtuemart_state_id" ' . $attrString . '>
<option value="">' . JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . '</option>
</select>';
return $listHTML;
}
示例4: renderStateList
/**
* Render a simple state list
*
* @author jseros, Patrick Kohl
*
* @param int $stateID Selected state id
* @param int $countryID Selected country id
* @param string $dependentField Parent <select /> ID attribute
* @param string $_prefix Optional prefix for the formtag name attribute
* @return string HTML containing the <select />
*/
public static function renderStateList($stateId = '0', $_prefix = '', $multiple = FALSE, $required = 0)
{
if (is_array($stateId)) {
$stateId = implode(",", $stateId);
}
vmJsApi::JcountryStateList($stateId);
if ($multiple) {
$attrs = 'multiple="multiple" size="12" name="' . $_prefix . 'virtuemart_state_id[]" ';
} else {
$attrs = 'size="1" name="' . $_prefix . 'virtuemart_state_id" ';
}
if ($required != 0) {
$attrs .= ' required';
}
$listHTML = '<select class="inputbox multiple" id="virtuemart_state_id" ' . $attrs . '>
<option value="">' . JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . '</option>
</select>';
return $listHTML;
}