本文整理汇总了PHP中shopFunctions::renderStateList方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctions::renderStateList方法的具体用法?PHP shopFunctions::renderStateList怎么用?PHP shopFunctions::renderStateList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shopFunctions
的用法示例。
在下文中一共展示了shopFunctions::renderStateList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserFieldsFilled
//.........这里部分代码省略.........
* echo ' '.$_field['formcode']."\n"; // Input form
*
* 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':
示例2: getUserFieldsFilled
//.........这里部分代码省略.........
/* $app = JFactory::getApplication();
if($app->isSite()) {
$attrib = array('class'=>'chzn-select');
} else {
$attrib = array();
}*/
$attrib = array();
$_return['fields'][$_fld->name]['formcode'] = ShopFunctions::renderCountryList($_return['fields'][$_fld->name]['value'], false, $attrib, $_prefix, $_fld->required);
if (!empty($_return['fields'][$_fld->name]['value'])) {
// Translate the value from ID to name
$db = JFactory::getDBO();
$q = 'SELECT * FROM `#__virtuemart_countries` WHERE virtuemart_country_id = "' . (int) $_return['fields'][$_fld->name]['value'] . '"';
$db->setQuery($q);
$r = $db->loadAssoc();
if ($r) {
$_return['fields'][$_fld->name]['value'] = !empty($r['country_name']) ? $r['country_name'] : '';
$_return['fields'][$_fld->name]['country_2_code'] = !empty($r['country_2_code']) ? $r['country_2_code'] : '';
$_return['fields'][$_fld->name]['country_3_code'] = !empty($r['country_3_code']) ? $r['country_3_code'] : '';
} else {
vmError('Model Userfields, country with id ' . $_return['fields'][$_fld->name]['value'] . ' not found');
}
} else {
$_return['fields'][$_fld->name]['value'] = '';
$_return['fields'][$_fld->name]['country_2_code'] = '';
$_return['fields'][$_fld->name]['country_3_code'] = '';
}
//$_return['fields'][$_fld->name]['value'] = JText::_(shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']));
//$_return['fields'][$_fld->name]['state_2_code'] = JText::_(shopFunctions::getCountryByID($_return['fields'][$_fld->name]['value']));
break;
case 'virtuemart_state_id':
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$_return['fields'][$_fld->name]['formcode'] = shopFunctions::renderStateList($_return['fields'][$_fld->name]['value'], $_prefix, false, $_fld->required);
if (!empty($_return['fields'][$_fld->name]['value'])) {
// Translate the value from ID to name
$db = JFactory::getDBO();
$q = 'SELECT * FROM `#__virtuemart_states` WHERE virtuemart_state_id = "' . (int) $_return['fields'][$_fld->name]['value'] . '"';
$db->setQuery($q);
$r = $db->loadAssoc();
if ($r) {
$_return['fields'][$_fld->name]['value'] = !empty($r['state_name']) ? $r['state_name'] : '';
$_return['fields'][$_fld->name]['state_2_code'] = !empty($r['state_2_code']) ? $r['state_2_code'] : '';
$_return['fields'][$_fld->name]['state_3_code'] = !empty($r['state_3_code']) ? $r['state_3_code'] : '';
} else {
vmError('Model Userfields, state with id ' . $_return['fields'][$_fld->name]['value'] . ' not found');
}
} else {
$_return['fields'][$_fld->name]['value'] = '';
$_return['fields'][$_fld->name]['state_2_code'] = '';
$_return['fields'][$_fld->name]['state_3_code'] = '';
}
//$_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;