本文整理汇总了PHP中Axis::getSiteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Axis::getSiteId方法的具体用法?PHP Axis::getSiteId怎么用?PHP Axis::getSiteId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::getSiteId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadSeoData
private function _loadSeoData()
{
if (isset($this->_params['cat'])) {
$this->_params['cat']['seo'] = Axis::single('catalog/hurl')->select('key_word')->where('key_id = ?', $this->_params['cat']['value'])->where("key_type = 'c'")->where('site_id = ?', Axis::getSiteId())->fetchOne();
}
if (isset($this->_params['manufacturer'])) {
$this->_params['manufacturer']['seo'] = strtolower(Axis::single('catalog/product_manufacturer')->getNameById($this->_params['manufacturer']['value']));
}
if (isset($this->_params['attributes'])) {
/*//
//exit();
$rows = Axis::single('catalog/product_option_text')
->getOptionsByAttributtes(
$this->_params['attributes']
);
foreach ($rows as $row) {
$this->_params['at_' . $row['option_id']] = array(
'value' => $row['id'],
'seo' => strtolower($row['value_name']),
'option_name' => $row['option_name'],
'value_name' => $row['value_name']
);
}*/
$this->_params['attributes'] = Axis::single('catalog/product_option')->getAttributesByKeyword($this->_params['attributes']);
}
}
示例2: log
public function log($observer)
{
if (!Axis::config('log/main/enabled')) {
return false;
}
/**
* @var $request Zend_Controller_Request_Abstract
*/
$request = $observer->getController()->getRequest();
$url = $request->getScheme() . '://' . $request->getHttpHost() . $request->getRequestUri();
$refer = $request->getServer('HTTP_REFERER', '');
$timestamp = Axis_Date::now()->toSQLString();
$siteId = Axis::getSiteId();
// add new url request
$modelUrlInfo = Axis::single('log/url_info');
$rowUrlInfo = $modelUrlInfo->select()->where('url = ?', $url)->where('refer = ?', $refer)->fetchRow();
if (!$rowUrlInfo) {
$rowUrlInfo = $modelUrlInfo->createRow(array('url' => $url, 'refer' => $refer));
$rowUrlInfo->save();
}
//add/update visitor
$visitor = Axis::single('log/visitor')->getVisitor();
//add/update visitor info
Axis::single('log/visitor_info')->getRow(array('visitor_id' => $visitor->id, 'user_agent' => $request->getServer('HTTP_USER_AGENT', ''), 'http_accept_charset' => $request->getServer('HTTP_ACCEPT_CHARSET', ''), 'http_accept_language' => $request->getServer('HTTP_ACCEPT_LANGUAGE', ''), 'server_addr' => $request->getServer('SERVER_ADDR', ''), 'remote_addr' => $request->getServer('REMOTE_ADDR', '')))->save();
Axis::single('log/url')->insert(array('url_id' => $rowUrlInfo->id, 'visitor_id' => $visitor->id, 'visit_at' => $timestamp, 'site_id' => $siteId));
}
示例3: _initSeoParams
private function _initSeoParams($keywords)
{
if (!sizeof($keywords)) {
return array();
}
$rowset = Axis::single('catalog/hurl')->select()->where('key_word IN (?)', $keywords)->where('site_id = ?', Axis::getSiteId())->fetchAssoc();
foreach ($rowset as $row) {
switch ($row['key_type']) {
case 'c':
$this->_params['cat']['value'] = $row['key_id'];
if (empty($this->_params['cat']['seo'])) {
$this->_params['cat']['seo'] = $row['key_word'];
} else {
$this->_params['cat']['seo'] .= '/' . $row['key_word'];
}
break;
case 'p':
$this->_params['product']['value'] = $row['key_id'];
$this->_params['product']['seo'] = $row['key_word'];
$this->getRequest()->setParam('product', $row['key_id']);
break;
case 'm':
$mDescription = Axis::single('catalog/product_manufacturer_description')->select(array('title', 'description'))->where('manufacturer_id = ?', $row['key_id'])->where('language_id = ?', Axis_Locale::getLanguageId())->fetchRow();
$this->_params['manufacturer'] = array('value' => $row['key_id'], 'seo' => $row['key_word'], 'title' => $mDescription->title, 'description' => $mDescription->description);
break;
default:
break;
}
}
}
示例4: getAllowedTypes
public function getAllowedTypes($request)
{
switch ($this->_config->type) {
case Axis_ShippingTable_Model_Option_Standard_Service::PER_WEIGHT:
$value = $request['weight'];
break;
case Axis_ShippingTable_Model_Option_Standard_Service::PER_ITEM:
$value = $request['qty'];
break;
case Axis_ShippingTable_Model_Option_Standard_Service::PER_PRICE:
default:
$value = $request['price'];
break;
}
$select = Axis::model('shippingTable/rate')->select();
$select->where('value <= ? ', $value)->where('site_id = ? OR site_id = 0', Axis::getSiteId())->where('country_id = ? OR country_id = 0', $request['country']['id'])->where('zip = ? OR zip = "*"', $request['postcode'])->order('site_id DESC')->order('country_id ASC')->order('zone_id ASC')->order('zip ASC')->order('value DESC')->limit(1);
if (isset($request['zone']['id'])) {
$select->where('zone_id = ? OR zone_id = 0', $request['zone']['id']);
} else {
$select->where('zone_id = 0');
}
$row = $select->fetchRow();
if ($row) {
$handling = is_numeric($this->_config->handling) ? $this->_config->handling : 0;
$this->_types = array(array('id' => $this->_code, 'title' => $this->getTitle(), 'price' => $row['price'] + $handling));
}
return $this->_types;
}
示例5: getAllowedTypes
public function getAllowedTypes($request)
{
switch ($this->_config->type) {
case 'Per Weight':
$value = $request['weight'];
break;
case 'Per Item':
$value = $request['qty'];
break;
case 'Per Price':
default:
$value = $request['price'];
break;
}
$select = Axis::table('shippingtable_rate')->select();
$select->where('value <= ? ', $value)->where('site_id = ? OR site_id = 0', Axis::getSiteId())->where('country_id = ? OR country_id = 0', $request['country']['id'])->where('zip = ? OR zip = "*"', $request['postcode'])->order('site_id DESC')->order('country_id ASC')->order('zone_id ASC')->order('zip ASC')->order('value DESC')->limit(1);
if (isset($request['zone']['id'])) {
$select->where('zone_id = ? OR zone_id = 0', $request['zone']['id']);
} else {
$select->where('zone_id = 0');
}
$row = $select->fetchRow();
$this->_types = array(array('id' => $this->_code, 'title' => $this->getTitle(), 'price' => $row['price'] + (is_numeric($this->_config->handling) ? $this->_config->handling : 0)));
return $this->_types;
}
示例6: _beforeRender
protected function _beforeRender()
{
$visitor = Axis::model('log/visitor')->getVisitor();
// select all viewed products by current visitor
$selectInner = Axis::model('log/event')->select(array('id', 'object_id'))->order('le.id DESC');
$customerId = $visitor->customer_id;
if ($customerId && $customerId === Axis::getCustomerId()) {
$selectInner->join('log_visitor', 'le.visitor_id = lv.id')->where('lv.customer_id = ?', $customerId);
} else {
$selectInner->where('visitor_id = ?', $visitor->id);
}
// filter unique product_ids from correctly ordered query
// using adapter for specific from statement
// this subquery is used to get the correct order for products
// bigfix for not displayed product if the user viewed it some time ago and now opened it again
// with single query this product will not outputted first in a row
$adapter = Axis::model('log/event')->getAdapter();
$select = $adapter->select()->from(array('le' => $selectInner), 'object_id')->group('le.object_id')->order('le.id DESC')->limit($this->getProductsCount());
$productIds = $adapter->fetchCol($select);
if (empty($productIds)) {
return false;
}
$products = Axis::model('catalog/product')->select('*')->addFilterByAvailability()->addCommonFields()->addFinalPrice()->joinCategory()->where('cc.site_id = ?', Axis::getSiteId())->where('cp.id IN (?)', $productIds)->fetchProducts($productIds);
if (empty($products)) {
return false;
}
$this->products = $products;
return $this->hasProducts();
}
示例7: init
public function init()
{
$categories = Axis::single('catalog/category')->select('*')->addName(Axis_Locale::getLanguageId())->addKeyWord()->order('cc.lft')->addSiteFilter(Axis::getSiteId())->addDisabledFilter()->fetchAll();
if (!is_array($this->_activeCategories)) {
$this->_activeCategories = array();
if (Zend_Registry::isRegistered('catalog/current_category')) {
$this->_activeCategories = array_keys(Zend_Registry::get('catalog/current_category')->cache()->getParentItems());
}
}
$container = $_container = new Zend_Navigation();
$lvl = 0;
$view = $this->getView();
foreach ($categories as $_category) {
$uri = $view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'controller' => 'catalog', 'action' => 'view'), false, true);
$class = 'nav-' . str_replace('.', '-', $_category['key_word']);
$page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'class' => $class, 'visible' => 'enabled' === $_category['status'] ? true : false, 'active' => in_array($_category['id'], $this->_activeCategories)));
$lvl = $lvl - $_category['lvl'] + 1;
for ($i = 0; $i < $lvl; $i++) {
$_container = $_container->getParent();
}
$lvl = $_category['lvl'];
$_container->addPage($page);
$_container = $page;
}
$this->setData('menu', $container);
return true;
}
示例8: indexAction
public function indexAction()
{
$this->setCanonicalUrl($this->view->url(array(), 'cms', true));
$this->setTitle(Axis::translate('cms')->__('Pages'), null, false);
$categories = Axis::single('cms/category')->select(array('id', 'parent_id'))->addCategoryContentTable()->columns(array('ccc.link', 'ccc.title'))->addActiveFilter()->addSiteFilter(Axis::getSiteId())->addLanguageIdFilter(Axis_Locale::getLanguageId())->order('cc.parent_id')->where('ccc.link IS NOT NULL')->fetchAssoc();
$pages = Axis::single('cms/page')->select(array('id', 'name'))->join(array('cpca' => 'cms_page_category'), 'cp.id = cpca.cms_page_id', 'cms_category_id')->join('cms_page_content', 'cp.id = cpc.cms_page_id', array('link', 'title'))->where('cp.is_active = 1')->where('cpc.language_id = ?', Axis_Locale::getLanguageId())->where('cpca.cms_category_id IN (?)', array_keys($categories))->order('cpca.cms_category_id')->fetchAssoc();
$menu = new Zend_Navigation();
foreach ($categories as $_category) {
$title = empty($_category['title']) ? $_category['link'] : $_category['title'];
$page = new Zend_Navigation_Page_Mvc(array('category_id' => $_category['id'], 'label' => $title, 'title' => $title, 'route' => 'cms_category', 'params' => array('cat' => $_category['link']), 'class' => 'icon-folder'));
$_container = $menu->findBy('category_id', $_category['parent_id']);
if (null === $_container) {
$_container = $menu;
}
$_container->addPage($page);
}
foreach ($pages as $_page) {
$title = empty($_page['title']) ? $_page['link'] : $_page['title'];
$page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_page', 'params' => array('page' => $_page['link']), 'class' => 'icon-page'));
$_container = $menu->findBy('category_id', $_page['cms_category_id']);
$_container->addPage($page);
}
$this->view->menu = $menu;
$this->render();
}
示例9: registerAction
public function registerAction()
{
$this->setTitle(Axis::translate('account')->__('Forgot password'));
$username = $this->_getParam('username', null);
if (empty($username)) {
$this->render();
return;
}
$customerId = Axis::single('account/customer')->getIdByEmail($username);
if ($customerId && ($customer = Axis::single('account/customer')->find($customerId)->current()) && Axis::getSiteId() === $customer->site_id) {
$modelForgotPassword = Axis::model('account/customer_forgotPassword');
$hash = $modelForgotPassword->generatePassword();
$link = $this->view->href('account/forgot', true) . '?hash=' . $hash;
try {
$mail = new Axis_Mail();
$configResult = $mail->setConfig(array('event' => 'forgot_password', 'subject' => Axis::translate('account')->__('Forgotten Password'), 'data' => array('link' => $link, 'firstname' => $customer->firstname, 'lastname' => $customer->lastname), 'to' => $username));
if ($configResult) {
$mail->send();
$modelForgotPassword->save(array('hash' => $hash, 'customer_id' => $customerId));
Axis::message()->addSuccess(Axis::translate('core')->__('Message was sended to you. Check your mailbox'));
}
} catch (Zend_Mail_Exception $e) {
Axis::message()->addError(Axis::translate('core')->__('Mail sending was failed.'));
}
} else {
Axis::message()->addError(Axis::translate('account')->__("'%s' was not found in database", $username));
}
$this->render();
}
示例10: registerAction
public function registerAction()
{
if (Axis::getCustomerId()) {
$this->_redirect('account');
}
$this->setTitle(Axis::translate('account')->__('Create an Account'));
$form = Axis::single('account/form_signup');
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
if ($form->isValid($data)) {
$model = Axis::single('account/customer');
$data['site_id'] = Axis::getSiteId();
$data['is_active'] = 1;
list($row, $password) = $model->create($data);
$row->setDetails($data);
Axis::dispatch('account_customer_register_success', array('customer' => $row, 'password' => $password));
$model->login($data['email'], $password);
return $this->_redirect('account');
} else {
$form->populate($data);
}
}
$this->view->formSignup = $form;
$this->render();
}
示例11: isValid
/**
*
* @param string $hash
* @param string $email
* @return bool
*/
public function isValid($hash, $email = null)
{
$date = Axis_Date::now()->addDay(-1)->toSQLString();
$select = $this->select('*')->joinLeft('account_customer', 'ac.id = acf.customer_id')->where('acf.hash = ?', $hash)->where('ac.site_id = ?', Axis::getSiteId())->where('acf.created_at > ?', $date);
if (null !== $email) {
$select->where('ac.email = ?', $email);
}
return (bool) $select->count();
}
示例12: logging
/**
* @param array $data
* @return mixed
*/
public function logging(array $data = array())
{
$pdata = array('num_results' => $data['num_results'], 'created_at' => Axis_Date::now()->toSQLString(), 'visitor_id' => Axis::single('log/visitor')->getVisitor()->id, 'customer_id' => Axis::getCustomerId(), 'site_id' => Axis::getSiteId());
$query = Axis::single('search/log_query')->getQuery($data['query']);
$query->hit++;
$query->save();
$pdata['query_id'] = $query->id;
/* @todo analize search query */
return parent::insert($pdata);
}
示例13: init
public function init()
{
$this->addElement('text', 'email', array('required' => true, 'label' => 'Email', 'class' => 'input-text required email', 'validators' => array('EmailAddress', new Axis_Validate_Exists(Axis::single('account/customer'), 'email', "id <> " . Axis::getCustomerId() . " AND site_id = " . Axis::getSiteId()))));
$this->addElement('text', 'firstname', array('required' => true, 'label' => 'Firstname', 'class' => 'input-text required'));
$this->addElement('text', 'lastname', array('required' => true, 'label' => 'Lastname', 'class' => 'input-text required'));
$this->addDisplayGroup(array('email', 'firstname', 'lastname'), 'login', array('legend' => 'General information'));
$rows = Axis::single('account/customer_field')->getFields();
$groupsFields = array();
foreach ($rows as $row) {
$field = 'field_' . $row['id'];
$config = array('id' => 'field_' . $row['name'], 'required' => (bool) $row['required'], 'label' => $row['field_label'], 'class' => in_array($row['field_type'], array('textarea', 'text')) ? 'input-text' : '');
if ($row['field_type'] == 'textarea') {
$config['rows'] = 6;
$config['cols'] = 60;
}
$this->addElement($row['field_type'], $field, $config);
$el = $this->getElement($field);
if ($row['required']) {
$el->addValidator('NotEmpty')->setAttrib('class', $el->getAttrib('class') . ' required');
}
if (!empty($row['validator'])) {
if ($row['validator'] == 'Date') {
$el->addValidator($row['validator'], false, array('format' => 'yyyy-MM-dd'));
$el->setAttrib('class', $el->getAttrib('class') . ' input-date');
} else {
$el->addValidator($row['validator']);
}
}
if (!empty($row['axis_validator'])) {
$el->addValidator(new $row['axis_validator']());
}
if (isset($row['customer_valueset_id'])) {
$values = Axis::single('account/Customer_ValueSet_Value')->getCustomValues($row['customer_valueset_id'], Axis_Locale::getLanguageId());
if (method_exists($el, 'setMultiOptions')) {
$el->setMultiOptions($values);
}
}
$groupsFields[$row['customer_field_group_id']][$row['id']] = $field;
}
/* add field groups */
if (count($groupsFields)) {
$groups = Axis::single('account/customer_fieldGroup')->getCustomGroups(array_keys($groupsFields), Axis_Locale::getLanguageId());
foreach ($groups as $row) {
$this->addDisplayGroup(array_values($groupsFields[$row['id']]), empty($row['name']) ? $row['id'] : $row['name'], array('legend' => $row['group_label']));
$this->getDisplayGroup(empty($row['name']) ? $row['id'] : $row['name'])->setDisableTranslator(true);
}
}
$this->addElement('checkbox', 'change_password_toggle', array('label' => 'Change password', 'onchange' => "togglePasswordForm(this.checked)"));
$this->addElement('password', 'password', array('disabled' => 'disabled', 'label' => 'New password', 'class' => 'input-text required password', 'validators' => array('NotEmpty', new Axis_Validate_PasswordConfirmation())));
$this->addElement('password', 'password_confirm', array('disabled' => 'disabled', 'label' => 'Confirm new password', 'class' => 'input-text required password'));
$this->addElement('password', 'password_current', array('disabled' => 'disabled', 'label' => 'Current password', 'class' => 'input-text required password', 'validators' => array('NotEmpty', new Axis_Validate_PasswordEqual(Axis::getCustomer()->password))));
$this->addDisplayGroup(array('password_current', 'password', 'password_confirm'), 'change_password', array('legend' => 'Change password', 'style' => 'display: none;'));
$this->addElement('button', 'submit', array('type' => 'submit', 'class' => 'button', 'label' => 'Save'));
$this->addActionBar(array('submit'));
}
示例14: _beforeRender
protected function _beforeRender()
{
$select = Axis::model('catalog/product')->select('id')->addFilterByAvailability()->joinCategory()->where('cc.site_id = ?', Axis::getSiteId())->where('cp.ordered > 0')->order(array('cp.ordered DESC', 'cp.id DESC'))->limit($this->getProductsCount());
if ($catId = Axis_HumanUri::getInstance()->getParamValue('cat')) {
$select->where('cc.id = ?', $catId);
}
$list = $select->fetchList();
if (!$list['count']) {
return false;
}
$this->products = $list['data'];
}
示例15: _load
private function _load($key, $siteId, $default)
{
if (null === $siteId) {
$siteId = Axis::getSiteId();
}
$rows = Axis::single('core/config_field')->getFieldsByKey($key, $siteId);
if (!sizeof($rows)) {
$this->_data[$key] = $default;
return;
}
$values = array();
foreach ($rows as $path => $row) {
$parts = explode('/', $path);
switch ($row['config_type']) {
case 'string':
$value = $row['value'];
break;
case 'select':
$value = $row['value'];
break;
case 'bool':
$value = (bool) $row['value'];
break;
case 'handler':
$class = 'Axis_Config_Handler_' . ucfirst($row['model']);
if ($row['model']) {
$value = call_user_func(array($class, 'getConfig'), $row['value']);
} else {
$value = $row['value'];
}
break;
case 'multiple':
if (!isset($row['value'])) {
$value = array();
} else {
$value = explode(self::MULTI_SEPARATOR, $row['value']);
}
break;
default:
$value = $row['value'];
break;
}
$values[$parts[0]][$parts[1]][$parts[2]] = $value;
}
foreach ($values as $key => $value) {
if (is_array($value)) {
$this->_data[$key] = new Axis_Config($value, $this->_allowModifications);
} else {
$this->_data[$key] = $value;
}
}
}