本文整理汇总了PHP中ShopFunctions::renderCountryList方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopFunctions::renderCountryList方法的具体用法?PHP ShopFunctions::renderCountryList怎么用?PHP ShopFunctions::renderCountryList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShopFunctions
的用法示例。
在下文中一共展示了ShopFunctions::renderCountryList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserFieldsFilled
//.........这里部分代码省略.........
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
if (Permissions::getInstance()->check('admin', 'storeadmin')) {
$admin = true;
}
// 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 : @html_entity_decode($_userData[$_fld->name], ENT_COMPAT, 'UTF-8'), 'title' => JText::_($_fld->title), 'type' => $_fld->type, 'required' => $_fld->required, 'hidden' => false, 'formcode' => '', 'description' => JText::_($_fld->description));
$readonly = '';
if (!$admin) {
if ($_fld->readonly) {
$readonly = ' readonly="readonly" ';
}
}
// 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':
//For nice lists in the FE
/* $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();
示例2: getUserFieldsFilled
/**
* Return an array with userFields in several formats.
*
* @access public
* @param $_selection An array, as returned by getuserFields(), with fields that should be returned.
* @param $_userData Array with userdata holding the values for the fields
* @param $_prefix string Optional prefix for the formtag name attribute
* @author Oscar van Eijk
* @return array List with all userfield data in the format:
* array(
* 'fields' => array( // All fields
* <fieldname> => array(
* 'name' => // Name of the field
* 'value' => // Existing value for the current user, or the default
* 'title' => // Title used for label and such
* 'type' => // Field type as specified in the userfields table
* 'hidden' => // True/False
* 'required' => // True/False. If True, the formcode also has the class "required" for the Joomla formvalidator
* 'formcode' => // Full HTML tag
* )
* [...]
* )
* 'functions' => array() // Optional javascript functions without <script> tags.
* // Possible usage: if (count($ar('functions')>0) echo '<script ...>'.join("\n", $ar('functions')).'</script>;
* 'scripts' => array( // Array with scriptsources for use with JHTML::script();
* <name> => <path>
* [...]
* )
* 'links' => array( // Array with stylesheets for use with JHTML::stylesheet();
* <name> => <path>
* [...]
* )
* )
* @example This example illustrates the use of this function. For additional examples, see the Order view
* and the User view in the administrator section.
* <pre>
* // In the controller, make sure this model is loaded.
* // In view.html.php, make the following calls:
* $_usrDetails = getUserDetailsFromSomeModel(); // retrieve an user_info record, eg from the usermodel or ordermodel
* $_usrFieldList = $userFieldsModel->getUserFields(
* 'registration'
* , array() // Default switches
* , array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type') // Skips
* );
* $usrFieldValues = $userFieldsModel->getUserFieldsFilled(
* $_usrFieldList
* ,$_usrDetails
* );
* $this->assignRef('userfields', $userfields);
* // In the template, use code below to display the data. For an extended example using
* // delimiters, JavaScripts and StyleSheets, see the edit_shopper.php in the user view
* <table class="admintable" width="100%">
* <thead>
* <tr>
* <td class="key" style="text-align: center;" colspan="2">
* <?php echo JText::_('COM_VIRTUEMART_TABLE_HEADER') ?>
* </td>
* </tr>
* </thead>
* <?php
* foreach ($this->shipmentfields['fields'] as $_field ) {
* echo ' <tr>'."\n";
* echo ' <td class="key">'."\n";
* echo ' '.$_field['title']."\n";
* echo ' </td>'."\n";
* echo ' <td>'."\n";
*
* echo ' '.$_field['value']."\n"; // Display only
* Or:
* 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']);
//.........这里部分代码省略.........
示例3: display
function display($tpl = null)
{
if (!class_exists('VmHTML')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel('calc');
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$perms = Permissions::getInstance();
$this->assignRef('perms', $perms);
//@todo should be depended by loggedVendor
$vendorId = 1;
$this->assignRef('vendorId', $vendorId);
$db = JFactory::getDBO();
$this->SetViewTitle();
$layoutName = JRequest::getWord('layout', 'default');
if ($layoutName == 'edit') {
$calc = $model->getCalc();
$this->assignRef('calc', $calc);
$isNew = $calc->virtuemart_calc_id < 1;
if ($isNew) {
$db = JFactory::getDBO();
//get default currency of the vendor, if not set get default of the shop
$q = 'SELECT `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id` = "' . $vendorId . '"';
$db->setQuery($q);
$currency = $db->loadResult();
if (empty($currency)) {
$q = 'SELECT `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id` = "1" ';
$db->setQuery($q);
$currency = $db->loadResult();
$calc->calc_currency = $currency;
} else {
$calc->calc_currency = $currency;
}
}
$entryPointsList = self::renderEntryPointsList($calc->calc_kind);
$this->assignRef('entryPointsList', $entryPointsList);
$mathOpList = self::renderMathOpList($calc->calc_value_mathop);
$this->assignRef('mathOpList', $mathOpList);
/* Get the category tree */
$categoryTree = null;
if (isset($calc->calc_categories)) {
$calc_categories = $calc->calc_categories;
$categoryTree = ShopFunctions::categoryListTree($calc_categories);
} else {
$categoryTree = ShopFunctions::categoryListTree();
}
$this->assignRef('categoryTree', $categoryTree);
$currencyModel = VmModel::getModel('currency');
$_currencies = $currencyModel->getCurrencies();
$this->assignRef('currencies', $_currencies);
/* Get the shoppergroup tree */
$shopperGroupList = ShopFunctions::renderShopperGroupList($calc->virtuemart_shoppergroup_ids, True);
$this->assignRef('shopperGroupList', $shopperGroupList);
$countriesList = ShopFunctions::renderCountryList($calc->calc_countries, True);
$this->assignRef('countriesList', $countriesList);
$statesList = ShopFunctions::renderStateList($calc->virtuemart_state_ids, '', True);
$this->assignRef('statesList', $statesList);
$manufacturerList = ShopFunctions::renderManufacturerList($calc->virtuemart_manufacturers, true);
$this->assignRef('manufacturerList', $manufacturerList);
if (Vmconfig::get('multix', 'none') !== 'none') {
$vendorList = ShopFunctions::renderVendorList($calc->virtuemart_vendor_id, false);
$this->assignRef('vendorList', $vendorList);
}
$this->addStandardEditViewCommands();
} else {
JToolBarHelper::custom('toggle.calc_shopper_published.0', 'unpublish', 'no', JText::_('COM_VIRTUEMART_CALC_SHOPPER_PUBLISH_TOGGLE_OFF'), true);
JToolBarHelper::custom('toggle.calc_shopper_published.1', 'publish', 'yes', JText::_('COM_VIRTUEMART_CALC_SHOPPER_PUBLISH_TOGGLE_ON'), true);
JToolBarHelper::custom('toggle.calc_vendor_published.0', 'unpublish', 'no', JText::_('COM_VIRTUEMART_CALC_VENDOR_PUBLISH_TOGGLE_OFF'), true);
JToolBarHelper::custom('toggle.calc_vendor_published.1', 'publish', 'yes', JText::_('COM_VIRTUEMART_CALC_VENDOR_PUBLISH_TOGGLE_ON'), true);
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$search = JRequest::getWord('search', false);
$calcs = $model->getCalcs(false, false, $search);
$this->assignRef('calcs', $calcs);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
}
parent::display($tpl);
}