Ejemplo n.º 1
0
 /**
  * @return ViewModel
  */
 public function permissionsAction()
 {
     $permissions = $this->getPermissionService()->findAllPermissions();
     $view = new ViewModel(['permissions' => $permissions]);
     $view->setTemplate('authorization/permission/permissions');
     return $view;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
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;
 }