本文整理汇总了PHP中Axis::dispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Axis::dispatch方法的具体用法?PHP Axis::dispatch怎么用?PHP Axis::dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::dispatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAction
public function saveAction()
{
$_row = $this->_getAllParams();
$model = Axis::model('cms/page');
$modelContent = Axis::model('cms/page_content');
$modelCategory = Axis::model('cms/page_category');
$row = $model->save($_row);
//save page content
foreach ($_row['content'] as $languageId => $values) {
if (empty($values['link'])) {
$values['link'] = $row->name;
}
$modelContent->getRow($row->id, $languageId)->setFromArray($values)->save();
}
//save category relation
$modelCategory->delete(Axis::db()->quoteInto('cms_page_id = ?', $row->id));
$categories = array_filter(Zend_Json::decode($_row['category']));
foreach ($categories as $categoryId) {
$modelCategory->createRow(array('cms_category_id' => $categoryId, 'cms_page_id' => $row->id))->save();
}
if (!isset($_row['id']) || $_row['id'] != $row->id) {
Axis::dispatch('cms_page_add_success', array('page_id' => $row->id));
} else {
Axis::dispatch('cms_page_update_success', array('page_id' => $row->id));
}
Axis::message()->addSuccess(Axis::translate('cms')->__('Page was saved successfully'));
return $this->_helper->json->setData(array('id' => $row->id))->sendSuccess();
}
示例2: addAction
/**
* Customer add new tag on product
* @return void
*/
public function addAction()
{
$tags = array_filter(explode(',', $this->_getParam('tags')));
$productId = $this->_getParam('productId');
$modelCustomer = Axis::model('tag/customer');
$modelProduct = Axis::model('tag/product');
$defaultStatus = $modelCustomer->getDefaultStatus();
$customerId = Axis::getCustomerId();
$siteId = Axis::getSiteId();
$_row = array('customer_id' => $customerId, 'site_id' => $siteId, 'status' => $modelCustomer->getDefaultStatus());
foreach ($tags as $tag) {
$row = $modelCustomer->select()->where('name = ?', $tag)->where('customer_id = ?', $customerId)->where('site_id = ?', $siteId)->fetchRow();
if (!$row) {
$_row['name'] = $tag;
$row = $modelCustomer->createRow($_row);
$row->save();
Axis::message()->addSuccess(Axis::translate('tag')->__("Tag '%s' was successfully added to product", $tag));
} else {
Axis::message()->addNotice(Axis::translate('tag')->__("Your tag '%s' is already added to this product", $tag));
}
// add to product relation
$isExist = (bool) $modelProduct->select('id')->where('customer_tag_id = ?', $row->id)->where('product_id = ?', $productId)->fetchOne();
if (!$isExist) {
$modelProduct->createRow(array('customer_tag_id' => $row->id, 'product_id' => $productId))->save();
}
Axis::dispatch('tag_product_add_success', array('tag' => $tag, 'product_id' => $productId));
}
$this->_redirect($this->getRequest()->getServer('HTTP_REFERER'));
}
示例3: _beforeRender
protected function _beforeRender()
{
$this->_items = array();
// forward fix
Axis::dispatch('admin_box_navigation_prepare', $this);
$this->menu = new Zend_Navigation($this->_items);
}
示例4: 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();
}
示例5: _beforeRender
protected function _beforeRender()
{
if ($this->identity = Axis::getCustomerId()) {
Axis::dispatch('account_box_navigation_prepare', $this);
ksort($this->_items);
$this->items = $this->_items;
}
}
示例6: removeAction
public function removeAction()
{
$data = Zend_Json::decode($this->_getParam('data'));
Axis::model('core/site')->delete($this->db->quoteInto('id IN(?)', $data));
Axis::dispatch('core_site_delete_success', array('site_ids' => $data));
Axis::message()->addSuccess(Axis::translate('admin')->__('Site was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例7: removeAction
public function removeAction()
{
$this->_helper->layout->disableLayout();
$productId = $this->_getParam('id');
$customerId = Axis::getCustomerId();
Axis::single('account/wishlist')->delete(array($this->db->quoteInto('id = ?', $productId), $this->db->quoteInto('customer_id = ?', $customerId)));
Axis::dispatch('account_whishlist_remove_product_success', array('customer_id' => $customerId, 'product_id' => $productId));
$this->_redirect('/account/wishlist');
}
示例8: init
public function init()
{
if ($this->identity = Axis::getCustomerId()) {
Axis::dispatch('account_box_navigation_prepare', $this);
ksort($this->_items);
$this->items = $this->_items;
}
return true;
}
示例9: __construct
/**
* Constructor. Overriden to add events after form initialization
*
* Registers form view helper as decorator
*
* @param mixed $options
* @return void
*/
public function __construct($options = null)
{
$this->setDefaultDisplayGroupClass('Axis_Form_DisplayGroup');
$this->addPrefixPath('Axis_Form_Decorator', 'Axis/Form/Decorator', 'decorator');
$this->setTranslator(Axis::translate($this->_translatorModule)->getAdapter());
parent::__construct($options);
Axis::dispatch('form_construct_after', $this);
// global event for all forms
if ($this->_eventPrefix) {
Axis::dispatch($this->_eventPrefix . '_construct_after', $this);
}
}
示例10: render
public function render()
{
if (!($navigationHtml = Axis::cache()->load($this->getCacheKey()))) {
$this->_items = array();
// forward fix
Axis::dispatch('admin_box_navigation_prepare', $this);
$this->menu = new Zend_Navigation($this->_items);
$navigationHtml = parent::render();
Axis::cache()->save($navigationHtml, $this->getCacheKey(), array('modules'));
}
return $navigationHtml;
}
示例11: removeAction
public function removeAction()
{
$data = Zend_Json::decode($this->_getParam('data'));
if (!count($data)) {
Axis::message()->addError(Axis::translate('locale')->__('No language found to delete'));
return $this->_helper->json->sendFailure();
}
Axis::single('locale/language')->delete($this->db->quoteInto('id IN(?)', $data));
Axis::dispatch('locale_language_delete', $data);
Axis::message()->addSuccess(Axis::translate('locale')->__('Language was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例12: notifyQuantityUpdate
/**
* Sends catalog notifications:
* - catalog_product_backorder
* - catalog_product_in_stock
* - catalog_product_low_stock
* - catalog_product_out_of_stock
*
* @param array $data
* - old_quantity = float
* - new_quantity = float
* - product = Axis_Catalog_Model_Product_Row
* - variation = Axis_Db_Table_Row[optional]
* - stock = Axis_Catalog_Model_Product_Stock_Row
* @return void
*/
public function notifyQuantityUpdate($data)
{
if ($data['old_quantity'] <= $data['stock']->min_qty && $data['new_quantity'] > $data['stock']->min_qty && ($data['stock']->in_stock || $data['stock']->backorder)) {
if ($data['stock']->in_stock) {
Axis::dispatch('catalog_product_in_stock', $data);
} else {
Axis::dispatch('catalog_product_backorder', $data);
}
} elseif ($data['old_quantity'] > $data['stock']->notify_qty && $data['new_quantity'] <= $data['stock']->notify_qty) {
Axis::dispatch('catalog_product_low_stock', $data);
} elseif ($data['old_quantity'] > $data['stock']->min_qty && $data['new_quantity'] <= $data['stock']->min_qty) {
Axis::dispatch('catalog_product_out_of_stock', $data);
}
}
示例13: _addCommentForm
protected function _addCommentForm($pageId)
{
$form = Axis::model('cms/form_comment', array('pageId' => $pageId));
if ($this->_request->isPost()) {
$data = $this->_getAllParams();
if ($form->isValid($data)) {
Axis::single('cms/page_comment')->insert(array('author' => $data['author'], 'email' => $data['email'], 'status' => 0, 'content' => $data['content'], 'created_on' => Axis_Date::now()->toSQLString(), 'cms_page_id' => $pageId));
Axis::dispatch('cms_comment_add_success', $data);
Axis::message()->addSuccess(Axis::translate('cms')->__('Comment successfully added'));
$this->_redirect($this->getRequest()->getServer('HTTP_REFERER'));
} else {
$form->populate($data);
}
}
$this->view->formComment = $form;
}
示例14: loginAction
public function loginAction()
{
$username = $this->_getParam('username');
$password = $this->_getParam('password');
$auth = Zend_Auth::getInstance();
$authAdapter = new Axis_Auth_AdminAdapter($username, $password);
$result = $auth->authenticate($authAdapter);
if (!$result->isValid()) {
Axis::dispatch('admin_user_login_failed', array('username' => $username));
$this->_redirect($this->_getBackUrl());
} else {
Zend_Session::regenerateId();
Axis::dispatch('admin_user_login_success', array('username' => $username));
Axis::session()->roleId = Axis::single('admin/user')->select('role_id')->where('id = ?', $result->getIdentity())->fetchOne();
$this->_redirect($this->_getBackUrl());
}
}
示例15: successAction
public function successAction()
{
$this->setTitle(Axis::translate('checkout')->__('Checkout Success'));
Axis::config()->analytics->main->checkoutSuccess = true;
$checkout = $this->_getCheckout();
$orderId = $checkout->getOrderId();
$order = Axis::model('sales/order')->find($orderId)->current();
if (!$order instanceof Axis_Sales_Model_Order_Row) {
$this->_redirect('checkout/onestep');
}
if (!($statusId = $checkout->payment()->config('orderStatusId'))) {
$statusId = Axis::config('sales/order/defaultStatusId');
}
if ($statusId != $order->getStatus()) {
$order->setStatus($statusId);
}
Axis::dispatch('sales_order_create_success', $order);
$this->view->order = $order;
$checkout->clean();
$this->render();
}