public function indexAction() { $model = new ViewModel(); $this->layout('layout/adminblank'); $model->setVariables(array('callback' => $this->params()->fromQuery('callback'))); return $model; }
public function indexAction() { $viewVariables = $this->superAdminLogin(); $model = new ViewModel(); $this->layout('layout/adminblank'); $model->setTemplate('core/index'); $model->setVariables($viewVariables); return $model; }
protected function restfulAutoRender() { $resource = $this->getRestfulResource(); $function = $resource['function']; $render = $resource['render']; if (false === method_exists($this, $function)) { throw new Exception\InvalidArgumentException(sprintf('Request restful resource %s not exist in %s', $function, get_class($this))); } $variables = $this->{$function}(); if ($variables instanceof \Zend\View\Model\ModelInterface || $variables instanceof \Zend\Http\PhpEnvironment\Response) { return $variables; } $model = new ViewModel(); if ($variables) { $model->setVariables($variables); } if (isset($this->renders[$function]) && $this->renders[$function]) { $render = $this->renders[$function]; } $model->setTemplate($render); return $model; }
public function changepasswordAction() { $request = $this->getRequest(); $postData = $request->getPost(); $form = new \User\Form\ChangePasswordForm(); $form->bind($postData); if ($form->isValid()) { $postData = $form->getData(); $itemModel = Api::_()->getModel('User\\Model\\Account'); $itemId = $itemModel->setItem($postData)->changePassword(); $this->redirect()->toUrl('/account/setting/'); } else { //p($form->getMessages()); } $viewModel = new ViewModel(); $viewModel->setTemplate('engine/account/setting'); $viewModel->setVariables(array('pwForm' => $form)); return $viewModel; }
public function oauthAction() { $oauth = new \Oauth\OauthService(); $oauth->setServiceLocator($this->getServiceLocator()); $oauth->initByAccessToken(); $accessTokenArray = $oauth->getStorage()->getAccessToken(); $accessToken = $oauth->getAdapter()->getAccessToken(); $websiteName = $oauth->getAdapter()->getWebsiteName(); $profileUrl = $oauth->getAdapter()->getWebsiteProfileUrl(); $itemModel = Api::_()->getModel('Oauth\\Model\\Accesstoken'); $itemModel->setItem($accessTokenArray)->login(); $loginResult = $itemModel->getLoginResult(); if ($loginResult && $loginResult->isValid()) { $config = $this->getServiceLocator()->get('Config'); $callback = $config['oauth']['login_url_path']; $callback = $callback ? $callback : '/'; return $this->redirect()->toUrl($callback); } $viewModel = new ViewModel(); $viewModel->setTemplate('engine/user/register'); $viewModel->setVariables(array('token' => $accessToken, 'websiteName' => $websiteName, 'profileUrl' => $profileUrl)); return $viewModel; }