本文整理汇总了PHP中shopFunctions::getStateByID方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctions::getStateByID方法的具体用法?PHP shopFunctions::getStateByID怎么用?PHP shopFunctions::getStateByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shopFunctions
的用法示例。
在下文中一共展示了shopFunctions::getStateByID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserFieldsFilled
//.........这里部分代码省略.........
*
* echo ' </td>'."\n";
* echo ' </tr>'."\n";
* }
* ?>
* </table>
* </pre>
*/
public function getUserFieldsFilled($_selection, $_userData = null, $_prefix = '')
{
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$_return = array('fields' => array(), 'functions' => array(), 'scripts' => array(), 'links' => array());
// vmdebug('my user data in getUserFieldsFilled',$_selection,$_userData);
$_userData = (array) $_userData;
if (is_array($_selection)) {
foreach ($_selection as $_fld) {
$_return['fields'][$_fld->name] = array('name' => $_prefix . $_fld->name, 'value' => $_userData == null || !array_key_exists($_fld->name, $_userData) ? $_fld->default : @$_userData[$_fld->name], 'title' => JText::_($_fld->title), 'type' => $_fld->type, 'required' => $_fld->required, 'hidden' => false, 'formcode' => '');
// vmdebug ('getUserFieldsFilled',$_fld->name);
// if($_fld->name==='email') vmdebug('user data email getuserfieldbyuser',$_userData);
// First, see if there are predefined fields by checking the name
switch ($_fld->name) {
// case 'email':
// $_return['fields'][$_fld->name]['formcode'] = $_userData->email;
// break;
case 'virtuemart_country_id':
$_return['fields'][$_fld->name]['formcode'] = ShopFunctions::renderCountryList($_return['fields'][$_fld->name]['value'], false, array(), $_prefix, $_fld->required);
// Translate the value from ID to name
$_return['fields'][$_fld->name]['value'] = shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']);
break;
case 'virtuemart_state_id':
$_return['fields'][$_fld->name]['formcode'] = shopFunctions::renderStateList($_return['fields'][$_fld->name]['value'], $_prefix, false, $_fld->required);
$_return['fields'][$_fld->name]['value'] = shopFunctions::getStateByID($_return['fields'][$_fld->name]['value']);
break;
//case 'agreed':
// $_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" id="'.$_prefix.'agreed_field" name="'.$_prefix.'agreed" value="1" '
// . ($_fld->required ? ' class="required"' : '') . ' />';
// break;
//case 'agreed':
// $_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" id="'.$_prefix.'agreed_field" name="'.$_prefix.'agreed" value="1" '
// . ($_fld->required ? ' class="required"' : '') . ' />';
// break;
case 'password':
case 'password2':
$_return['fields'][$_fld->name]['formcode'] = '<input type="password" id="' . $_prefix . $_fld->name . '_field" name="' . $_prefix . $_fld->name . '" size="30" class="inputbox" />' . "\n";
break;
case 'agreed':
$_return['fields'][$_fld->name]['formcode'] = '<input type="checkbox" name="' . $_prefix . $_fld->name . '" id="' . $_prefix . $_fld->name . '_field" value="1" ' . ($_return['fields'][$_fld->name]['value'] ? 'checked="checked"' : '') . '/>';
break;
// It's not a predefined field, so handle it by it's fieldtype
// It's not a predefined field, so handle it by it's fieldtype
default:
if (strpos($_fld->type, 'plugin') !== false) {
JPluginHelper::importPlugin('vmuserfield');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('plgVmOnUserfieldDisplay', array($_prefix, $_fld, &$_return));
break;
}
switch ($_fld->type) {
case 'hidden':
$_return['fields'][$_fld->name]['formcode'] = '<input type="hidden" id="' . $_prefix . $_fld->name . '_field" name="' . $_prefix . $_fld->name . '" size="' . $_fld->size . '" value="' . $_return['fields'][$_fld->name]['value'] . '" ' . ($_fld->required ? ' class="required"' : '') . ($_fld->maxlength ? ' maxlength="' . $_fld->maxlength . '"' : '') . ($_fld->readonly ? ' readonly="readonly"' : '') . ' /> ';
$_return['fields'][$_fld->name]['hidden'] = true;
break;
case 'date':
case 'age_verification':
示例2: setCountryAndState
function setCountryAndState($address)
{
// get rid of the references
$address = $this->copyObj($address);
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
if (isset($address) && !is_object($address) || !is_object($address) && empty($address->virtuemart_country_id)) {
if (!empty($address['virtuemart_country_id']) && !empty($address['virtuemart_country_id']['value']) && is_numeric($address['virtuemart_country_id']['value'])) {
$address['virtuemart_country_id']['value_txt'] = shopFunctions::getCountryByID($address['virtuemart_country_id']['value']);
//shopFunctions::getCountryByID($address['virtuemart_country_id']['value']);
} else {
$address['virtuemart_country_id']['value'] = '';
}
if (!empty($address['virtuemart_state_id']) && !empty($address['virtuemart_state_id']['value']) && is_numeric($address['virtuemart_state_id']['value'])) {
$address['virtuemart_state_id']['value_txt'] = shopFunctions::getStateByID($address['virtuemart_state_id']['value']);
} else {
$address['virtuemart_state_id']['value'] = '';
}
} else {
if (!empty($address->virtuemart_country_id) && is_numeric($address->virtuemart_country_id)) {
$address->virtuemart_country_id = shopFunctions::getCountryByID($address->virtuemart_country_id);
} else {
$address->virtuemart_country_id = '';
}
if (!empty($address->virtuemart_state_id) && is_numeric($address->virtuemart_state_id)) {
$address->virtuemart_state_id = shopFunctions::getStateByID($address->virtuemart_state_id);
} else {
$address->virtuemart_state_id = '';
}
}
return $address;
}