public function execute() { $id = $this->getRequest()->getParam('author_id'); /** @var \Sample\News\Model\Author $author */ $author = $this->initAuthor(); /** @var \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Sample_News::author'); $resultPage->getConfig()->getTitle()->set(__('Authors')); if ($id) { $author->load($id); if (!$author->getId()) { $this->messageManager->addError(__('This author no longer exists.')); $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setPath('sample_news/*/edit', ['author_id' => $author->getId(), '_current' => true]); return $resultRedirect; } } $title = $author->getId() ? $author->getName() : __('New Author'); $resultPage->getConfig()->getTitle()->append($title); $data = $this->backendSession->getData('sample_news_author_data', true); if (!empty($data)) { $author->setData($data); } return $resultPage; }
/** * @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Redirect|\Magento\Framework\View\Result\Page */ public function execute() { $id = $this->getRequest()->getParam('post_id'); /** @var \Mageplaza\Blog\Model\Post $post */ $post = $this->initPost(); /** @var \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Mageplaza_Blog::post'); $resultPage->getConfig()->getTitle()->set(__('Posts')); if ($id) { $post->load($id); if (!$post->getId()) { $this->messageManager->addError(__('This Post no longer exists.')); $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setPath('mageplaza_blog/*/edit', ['post_id' => $post->getId(), '_current' => true]); return $resultRedirect; } } $title = $post->getId() ? $post->getName() : __('New Post'); $resultPage->getConfig()->getTitle()->prepend($title); $data = $this->backendSession->getData('mageplaza_blog_post_data', true); if (!empty($data)) { $post->setData($data); } return $resultPage; }
/** * Register module * * @param $module * @param $version * @param string $type */ public function register($module, $version, $type = 'install') { if (null === $module || null === $version) { return; } $sessionDataKey = 'is_registered_' . $module; if ($this->session->getData($sessionDataKey)) { return; } $curl = new \Magento\Framework\HTTP\Client\Curl(); try { $curl->post(self::EXTENSION_REGISTER_URL, ['module' => $module, 'version' => $version, 'site_url' => $this->getAllUrls(), 'type' => $type]); $this->session->setData($sessionDataKey, true); } catch (Exception $e) { } }
/** * @return \Magento\Backend\Model\View\Result\Page|\Magento\Framework\View\Result\Page */ public function execute() { $id = $this->getRequest()->getParam('article_id'); $article = $this->initArticle(); $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Gemtoo_Blog::article'); $resultPage->getConfig()->getTitle()->set(__('Articles')); if ($id) { $article->load($id); if (!$article->getId()) { $this->messageManager->addError(__('This article no longer exists.')); $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setPath('gemtoo_blog/*/edit', ['article_id' => $article->getId(), '_current' => true]); return $resultRedirect; } } $title = $article->getId() ? $article->getName() : __('New Article'); $resultPage->getConfig()->getTitle()->append($title); $data = $this->backendSession->getData('gemtoo_blog_article_data', true); if (!empty($data)) { $article->setData($data); } return $resultPage; }
/** * Get all transactions and orders and return builded data * * @return array */ public function request() { //load payments by date $this->getPagSeguroAbandoned(); if ($this->_PagSeguroPaymentList->getTransactions()) { foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) { date_default_timezone_set('UTC'); $order = \UOL\PagSeguro\Helper\Data::getReferenceDecryptOrderID($payment->getReference()); $order = $this->_order->load($order); if ($this->getStoreReference() == \UOL\PagSeguro\Helper\Data::getReferenceDecrypt($payment->getReference())) { if (!is_null($this->_session->getData('store_id'))) { array_push($this->_arrayPayments, $this->build($payment, $order)); } if ($order) { array_push($this->_arrayPayments, $this->build($payment, $order)); } } } } date_default_timezone_set($this->_timezone->getConfigTimezone()); return $this->_arrayPayments; }
/** * Retrieve grid * * @param string $paramName * @param mixed $default * @return mixed */ public function getParam($paramName, $default = null) { $sessionParamName = $this->getId() . $paramName; if ($this->getRequest()->has($paramName)) { $param = $this->getRequest()->getParam($paramName); if ($this->_saveParametersInSession) { $this->_backendSession->setData($sessionParamName, $param); } return $param; } elseif ($this->_saveParametersInSession && ($param = $this->_backendSession->getData($sessionParamName))) { return $param; } return $default; }
/** * Load stored items * * @return void */ protected function _loadItems() { if (is_null($this->_items)) { $this->_items = (array) $this->_backendSession->getData($this->_getStorageKey()); } }
public function getPopups($clear = false) { return $this->session->getData(self::GROUP_ID, $clear); }