コード例 #1
0
 /**
  * @return ViewModel
  */
 public function permissionsAction()
 {
     $permissions = $this->getPermissionService()->findAllPermissions();
     $view = new ViewModel(['permissions' => $permissions]);
     $view->setTemplate('authorization/permission/permissions');
     return $view;
 }
コード例 #2
0
 public function personalChangePasswordAction()
 {
     $form = new ChangePasswordForm();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post = $request->getPost();
         $inputFilter = new ChangePasswordFilter();
         $form->setInputFilter($inputFilter);
         $form->setData($post);
         if (!$form->isValid()) {
             $viewModel = new ViewModel(array('error' => true, 'form' => $form));
             $viewModel->setTemplate('admin/personal/personal-change-password');
             return $viewModel;
         }
         if ($form->isValid()) {
             $shopncWorker = new ShopncWorker();
             $oldPassword = $post->old_password;
             $newPassword = $post->new_password;
             $confirmassword = $post->confirm_password;
             $option = array('old_password' => $oldPassword, 'new_password' => $newPassword, 'confirm_password' => $confirmassword);
             $oldResult = $this->ajaxAction('oldPasswordExamination', $option);
             $newResult = $this->ajaxAction('newPasswordExamination', $option);
             if ($oldResult and $newResult) {
                 $entity = $this->getEntityManager()->getRepository('Admin\\Entity\\ShopncWorker')->findOneBy(array('workerId' => 1));
                 $entity->setworkerPwd(md5($newPassword));
                 $this->getEntityManager()->flush();
                 return $this->redirect()->toRoute('admin_personalcenter', array('action' => 'personalSettingInformation'));
             } else {
                 return $this->redirect()->toRoute('admin_personalcenter', array('action' => 'personalChangePassword'));
             }
         }
     }
     return array('form' => $form);
 }
コード例 #3
0
ファイル: DebugFilter.php プロジェクト: hummer2k/conlayout
 /**
  * @inheritDoc
  */
 public function filter($value)
 {
     if (!($block = $this->viewModelHelper->getCurrent())) {
         return $value;
     }
     if ($blockId = $block->getOption('block_id')) {
         $value = sprintf('<!--[%s] [%s]-->%s<!--[/%s]-->', $blockId, get_class($block), $value, $blockId);
     }
     return $value;
 }
コード例 #4
0
 public function testMarkupContainsCommentsWithDebugInfo()
 {
     $block = new ViewModel();
     $block->setOption('block_id', 'the.block');
     $viewModelHelper = new ModelHelper();
     $viewModelHelper->setCurrent($block);
     $filter = new DebugFilter($viewModelHelper);
     $html = '<div></div>';
     $filteredHtml = $filter->filter($html);
     $this->assertContains('<!--[the.block]', $filteredHtml);
 }
コード例 #5
0
 public function auteurAction()
 {
     $auteur = $this->getEvent()->getRouteMAtch()->getParam('auteur');
     $viewModel = new ViewModel(array('auteur' => $auteur));
     if (array_search($auteur, self::$data)) {
         $isbn = array_keys(self::$data, $auteur);
     } else {
         $viewModel->setTemplate('miniModule/info-livre');
         $viewModel->setVariables(array('isbn' => self::$data[$isbn]));
     }
     return $viewModel;
 }
コード例 #6
0
 public function testCanCheckRootModel()
 {
     $viewModel = $this->getMock(ModelInterface::class);
     $viewModelHelper = new ViewModelHelper();
     $viewModelHelper->setRoot($viewModel);
     $viewModelHelper->setCurrent($viewModel);
     $helperPluginManager = $this->getMock(HelperPluginManager::class, [], [], '', false);
     $helperPluginManager->expects($this->any())->method('get')->with('viewModel')->will($this->returnValue($viewModelHelper));
     $resourceRenderer = new ResourceRenderer($this->resolver, $helperPluginManager);
     $this->assertTrue($resourceRenderer->isRootTemplate());
     // Set another model for the current
     $viewModelHelper->setCurrent($this->getMock(ModelInterface::class));
     $this->assertFalse($resourceRenderer->isRootTemplate());
 }