本文整理汇总了PHP中ShopFunctions::generateStAddressList方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopFunctions::generateStAddressList方法的具体用法?PHP ShopFunctions::generateStAddressList怎么用?PHP ShopFunctions::generateStAddressList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShopFunctions
的用法示例。
在下文中一共展示了ShopFunctions::generateStAddressList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
// Load the helper(s)
$this->loadHelper('html');
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$perm = Permissions::getInstance();
$this->assignRef('perm', $perm);
$model = VmModel::getModel();
$currentUser = JFactory::getUser();
$task = JRequest::getWord('task', 'edit');
if ($task == 'editshop') {
if (Vmconfig::get('multix', 'none') !== 'none') {
//Maybe we must check here if the user is vendor and if he has an own id and else map to mainvendor.
$userId = 0;
} else {
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId(1);
}
$this->SetViewTitle('STORE');
} else {
if ($task == 'add') {
$userId = 0;
} else {
$userId = JRequest::getVar('virtuemart_user_id', 0);
if (is_array($userId)) {
$userId = $userId[0];
}
$this->SetViewTitle('USER');
}
}
$userId = $model->setId($userId);
$layoutName = JRequest::getWord('layout', 'default');
$layoutName = $this->getLayout();
if ($layoutName == 'edit' || $layoutName == 'edit_shipto') {
$editor = JFactory::getEditor();
// Get the required helpers
$this->loadHelper('shoppergroup');
$this->loadHelper('image');
//$userFieldsModel = VmModel::getModel('userfields');
$userDetails = $model->getUser();
if ($task == 'editshop' && $userDetails->user_is_vendor) {
// $model->setCurrent();
if (!empty($userDetails->vendor->vendor_store_name)) {
$this->SetViewTitle('STORE', $userDetails->vendor->vendor_store_name);
} else {
$this->SetViewTitle('STORE', JText::_('COM_VIRTUEMART_NEW_VENDOR'));
}
$vendorid = $userDetails->virtuemart_vendor_id;
} else {
$vendorid = 0;
$this->SetViewTitle('USER', $userDetails->JUser->get('name'));
}
$_new = $userDetails->JUser->get('id') < 1;
$this->addStandardEditViewCommands($vendorid);
// User details
$_contactDetails = $model->getContactDetails();
$_groupList = $model->getGroupList();
if (!is_array($_groupList)) {
$this->lists['gid'] = '<input type="hidden" name="gid" value="' . $userDetails->JUser->get('gid') . '" /><strong>' . JText::_($_groupList) . '</strong>';
} else {
$this->lists['gid'] = JHTML::_('select.genericlist', $_groupList, 'gid', 'size="10"', 'value', 'text', $userDetails->JUser->get('gid'));
}
$this->lists['canBlock'] = $currentUser->authorize('com_users', 'block user') && $userDetails->JUser->get('id') != $currentUser->get('id');
// Can't block myself
$this->lists['canSetMailopt'] = $currentUser->authorize('workflow', 'email_events');
$this->lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox"', $userDetails->JUser->get('block'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox"', $userDetails->JUser->get('sendEmail'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['params'] = $userDetails->JUser->getParameters(true);
// Shopper info
$this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($userDetails->shopper_groups, true);
$this->lists['vendors'] = ShopFunctions::renderVendorList($userDetails->virtuemart_vendor_id);
$this->lists['custnumber'] = $model->getCustomerNumberById($userDetails->JUser->get('id'));
// Shipment address(es)
$this->lists['shipTo'] = ShopFunctions::generateStAddressList($this, $model, 'addST');
$new = false;
if (JRequest::getInt('new', '0') === 1) {
$new = true;
}
$virtuemart_userinfo_id_BT = $model->getBTuserinfo_id($userId);
$userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id_BT, false);
$userFieldsBT = $userFieldsArray[$virtuemart_userinfo_id_BT];
//$this->lists['perms'] = JHTML::_('select.genericlist', Permissions::getUserGroups(), 'perms', '', 'group_name', 'group_name', $userDetails->perms);
// Load the required scripts
if (count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHTML::script($_script, $_path);
}
}
// Load the required stylesheets
if (count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
JHTML::stylesheet($_link, $_path);
}
}
$this->assignRef('userFieldsBT', $userFieldsBT);
$this->assignRef('userInfoID', $virtuemart_userinfo_id_BT);
//.........这里部分代码省略.........
示例2: display
function display($tpl = null)
{
// Load the helper(s)
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel();
$currentUser = JFactory::getUser();
VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
$task = vRequest::getCmd('task', 'edit');
if ($task == 'editshop') {
$isSuperOrVendor = VmConfig::isSuperVendor();
if (empty($isSuperOrVendor)) {
JFactory::getApplication()->redirect('index.php?option=com_virtuemart', vmText::_('JERROR_ALERTNOAUTHOR'), 'error');
} else {
if (!class_exists('VirtueMartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$userId = VirtueMartModelVendor::getUserIdByVendorId($isSuperOrVendor);
}
$this->SetViewTitle('STORE');
} else {
if ($task == 'add') {
$userId = 0;
} else {
$userId = vRequest::getVar('virtuemart_user_id', 0);
if (is_array($userId)) {
$userId = $userId[0];
}
$this->SetViewTitle('USER');
}
}
$userId = $model->setId($userId);
//$layoutName = vRequest::getCmd('layout', 'default');
$layoutName = $this->getLayout();
if ($layoutName == 'edit' || $layoutName == 'edit_shipto') {
$editor = JFactory::getEditor();
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
$userDetails = $model->getUser();
if ($task == 'editshop' && $userDetails->user_is_vendor) {
// $model->setCurrent();
if (!empty($userDetails->vendor->vendor_store_name)) {
$this->SetViewTitle('STORE', $userDetails->vendor->vendor_store_name, 'shop_mart');
} else {
$this->SetViewTitle('STORE', vmText::_('COM_VIRTUEMART_NEW_VENDOR'), 'shop_mart');
}
$vendorid = $userDetails->virtuemart_vendor_id;
if ($vendorid == 1) {
$this->checkTCPDFinstalled();
}
} else {
$vendorid = 0;
$this->SetViewTitle('USER', $userDetails->JUser->get('name'));
}
$_new = $userDetails->JUser->get('id') < 1;
$this->addStandardEditViewCommands($vendorid);
// User details
$_contactDetails = $model->getContactDetails();
$this->lists['canBlock'] = $currentUser->authorise('com_users', 'block user') && $userDetails->JUser->get('id') != $currentUser->get('id');
// Can't block myself
$this->lists['canSetMailopt'] = $currentUser->authorise('workflow', 'email_events');
$this->lists['block'] = JHtml::_('select.booleanlist', 'block', 'class="inputbox"', $userDetails->JUser->get('block'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['sendEmail'] = JHtml::_('select.booleanlist', 'sendEmail', 'class="inputbox"', $userDetails->JUser->get('sendEmail'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
$this->lists['params'] = $userDetails->JUser->getParameters(true);
// Shopper info
$this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($userDetails->shopper_groups, true, 'virtuemart_shoppergroup_id');
$this->lists['vendors'] = ShopFunctions::renderVendorList($userDetails->virtuemart_vendor_id);
$model->setId($userDetails->JUser->get('id'));
$this->lists['custnumber'] = $model->getCustomerNumberById();
// Shipment address(es)
$this->lists['shipTo'] = ShopFunctions::generateStAddressList($this, $model, 'addST');
$new = false;
if (vRequest::getInt('new', '0') === 1) {
$new = true;
}
$virtuemart_userinfo_id_BT = $model->getBTuserinfo_id($userId);
$userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id_BT, false);
$userFieldsBT = $userFieldsArray[$virtuemart_userinfo_id_BT];
// Load the required scripts
if (count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHtml::script($_script, $_path);
}
}
// Load the required stylesheets
if (count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
JHtml::stylesheet($_link, $_path);
}
}
$this->assignRef('userFieldsBT', $userFieldsBT);
$this->assignRef('userInfoID', $virtuemart_userinfo_id_BT);
$addrtype = vRequest::getCmd('addrtype');
$virtuemart_userinfo_id = 0;
if ($layoutName == 'edit_shipto' or $task == 'addST' or $addrtype == 'ST') {
$virtuemart_userinfo_id = vRequest::getString('virtuemart_userinfo_id', '0', '');
$userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'ST', $virtuemart_userinfo_id, false);
if ($new) {
//.........这里部分代码省略.........
示例3: display
/**
* Displays the view, collects needed data for the different layouts
*
* Okey I try now a completly new idea.
* We make a function for every tab and the display is getting the right tabs by an own function
* putting that in an array and after that we call the preparedataforlayoutBlub
*
* @author Oscar van Eijk
* @author Max Milbers
*/
function display($tpl = null)
{
$useSSL = VmConfig::get('useSSL', 0);
$useXHTML = true;
$this->assignRef('useSSL', $useSSL);
$this->assignRef('useXHTML', $useXHTML);
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$layoutName = $this->getLayout();
// vmdebug('layout by view '.$layoutName);
if (empty($layoutName) or $layoutName == 'default') {
$layoutName = JRequest::getWord('layout', 'edit');
if ($layoutName == 'default') {
$layoutName = 'edit';
}
$this->setLayout($layoutName);
}
if (empty($this->fTask)) {
$ftask = 'saveUser';
$this->assignRef('fTask', $ftask);
}
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
// vmdebug('my layoutname',$layoutName);
if ($layoutName == 'login') {
parent::display($tpl);
return;
}
if (!class_exists('VirtuemartModelUser')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'user.php';
}
$this->_model = new VirtuemartModelUser();
// $this->_model->setCurrent(); //without this, the administrator can edit users in the FE, permission is handled in the usermodel, but maybe unsecure?
$editor = JFactory::getEditor();
//the cuid is the id of the current user
$this->_currentUser = JFactory::getUser();
$this->_cuid = $this->_lists['current_id'] = $this->_currentUser->get('id');
$this->assignRef('userId', $this->_cuid);
$this->_userDetails = $this->_model->getUser();
$this->assignRef('userDetails', $this->_userDetails);
$address_type = JRequest::getWord('addrtype', 'BT');
$this->assignRef('address_type', $address_type);
$new = false;
if (JRequest::getInt('new', '0') == 1) {
$new = true;
}
if ($new) {
$virtuemart_userinfo_id = 0;
} else {
$virtuemart_userinfo_id = JRequest::getString('virtuemart_userinfo_id', '0', '');
}
$this->assignRef('virtuemart_userinfo_id', $virtuemart_userinfo_id);
$userFields = null;
if ((strpos($this->fTask, 'cart') || strpos($this->fTask, 'checkout')) && empty($virtuemart_userinfo_id)) {
//New Address is filled here with the data of the cart (we are in the cart)
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart();
$fieldtype = $address_type . 'address';
$cart->prepareAddressDataInCart($address_type, $new);
$userFields = $cart->{$fieldtype};
$task = JRequest::getWord('task', '');
} else {
$userFields = $this->_model->getUserInfoInUserFields($layoutName, $address_type, $virtuemart_userinfo_id);
if (!$new && empty($userFields[$virtuemart_userinfo_id])) {
$virtuemart_userinfo_id = $this->_model->getBTuserinfo_id();
// vmdebug('Try to get $virtuemart_userinfo_id by type BT', $virtuemart_userinfo_id);
}
$userFields = $userFields[$virtuemart_userinfo_id];
$task = 'editaddressST';
}
//print_r( $userFields);
$this->assignRef('userFields', $userFields);
if ($layoutName == 'edit') {
if ($this->_model->getId() == 0 && $this->_cuid == 0) {
$button_lbl = JText::_('COM_VIRTUEMART_REGISTER');
} else {
$button_lbl = JText::_('COM_VIRTUEMART_SAVE');
}
$this->assignRef('button_lbl', $button_lbl);
$this->lUser();
$this->shopper($userFields);
$this->payment();
$this->lOrderlist();
$this->lVendor();
}
$this->_lists['shipTo'] = ShopFunctions::generateStAddressList($this, $this->_model, $task);
if ($this->_openTab < 0) {
//.........这里部分代码省略.........
示例4: display
/**
* Displays the view, collects needed data for the different layouts
*
* @author Max Milbers
*/
function display($tpl = null)
{
$this->useSSL = VmConfig::get('useSSL', 0);
$this->useXHTML = false;
VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$layoutName = $this->getLayout();
if ($layoutName == 'login') {
parent::display($tpl);
return;
}
if (empty($layoutName) or $layoutName == 'default') {
$layoutName = vRequest::getCmd('layout', 'edit');
if ($layoutName == 'default') {
$layoutName = 'edit';
}
$this->setLayout($layoutName);
}
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
$this->_model = VmModel::getModel('user');
//$this->_model->setCurrent(); //without this, the administrator can edit users in the FE, permission is handled in the usermodel, but maybe unsecure?
$editor = JFactory::getEditor();
$virtuemart_user_id = vRequest::getInt('virtuemart_user_id', false);
if ($virtuemart_user_id and is_array($virtuemart_user_id)) {
$virtuemart_user_id = $virtuemart_user_id[0];
}
$this->_model->setId($virtuemart_user_id);
$this->userDetails = $this->_model->getUser();
$this->address_type = vRequest::getCmd('addrtype', 'BT');
$new = false;
if (vRequest::getInt('new', '0') == 1) {
$new = true;
}
if ($new) {
$virtuemart_userinfo_id = 0;
} else {
$virtuemart_userinfo_id = vRequest::getString('virtuemart_userinfo_id', 0);
}
$this->assignRef('virtuemart_userinfo_id', $virtuemart_userinfo_id);
$userFields = null;
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
$this->cart = VirtueMartCart::getCart();
$task = vRequest::getCmd('task', '');
if (($this->cart->_fromCart or $this->cart->getInCheckOut()) && empty($virtuemart_userinfo_id)) {
//New Address is filled here with the data of the cart (we are in the cart)
$fieldtype = $this->address_type . 'address';
$this->cart->prepareAddressFieldsInCart();
$userFields = $this->cart->{$fieldtype};
} else {
if (!$new and empty($virtuemart_userinfo_id)) {
$virtuemart_userinfo_id = $this->_model->getBTuserinfo_id();
vmdebug('Try to get $virtuemart_userinfo_id by type BT', $virtuemart_userinfo_id);
}
$userFields = $this->_model->getUserInfoInUserFields($layoutName, $this->address_type, $virtuemart_userinfo_id, false);
if (!$new && empty($userFields[$virtuemart_userinfo_id])) {
$virtuemart_userinfo_id = $this->_model->getBTuserinfo_id();
vmdebug('$userFields by getBTuserinfo_id', $userFields);
}
$userFields = $userFields[$virtuemart_userinfo_id];
}
$this->assignRef('userFields', $userFields);
if ($layoutName == 'edit') {
if ($this->_model->getId() == 0 && $this->_cuid == 0) {
$button_lbl = vmText::_('COM_VIRTUEMART_REGISTER');
} else {
$button_lbl = vmText::_('COM_VIRTUEMART_SAVE');
}
$this->assignRef('button_lbl', $button_lbl);
$this->lUser();
$this->shopper($userFields);
$this->payment();
$this->lOrderlist();
$this->lVendor();
}
$this->_lists['shipTo'] = ShopFunctions::generateStAddressList($this, $this->_model, '');
$this->assignRef('lists', $this->_lists);
$this->assignRef('editor', $editor);
if ($layoutName == 'mailregisteruser') {
$vendorModel = VmModel::getModel('vendor');
// $vendorModel->setId($this->_userDetails->virtuemart_vendor_id);
$vendor = $vendorModel->getVendor();
$this->assignRef('vendor', $vendor);
}
if ($layoutName == 'editaddress') {
$layoutName = 'edit_address';
$this->setLayout($layoutName);
}
if (!$this->userDetails->JUser->get('id')) {
$corefield_title = vmText::_('COM_VIRTUEMART_USER_CART_INFO_CREATE_ACCOUNT');
} else {
//.........这里部分代码省略.........