public function logoutAction()
 {
     Utility::insertHistory('logout');
     $auth = new AuthenticationService();
     $auth->clearIdentity();
     $this->redirect()->toRoute('admin/child', array('controller' => 'login'));
 }
 public function indexAction()
 {
     //$this->modelUsers->createQuery('');
     $users = $this->modelUsers->findBy(array('isdelete' => '0'));
     //tableTitle = table heading
     //datarow row of table... render by heading key
     //heading key = table column name
     $dataRow = $this->modelUsers->convertToArray($users);
     $data = array('title' => $this->translator->translate('Login'), 'link' => '/frontend/login', 'buttonLogin' => $this->translator->translate('Login'), 'userNameText' => $this->translator->translate('User name'), 'passwordText' => $this->translator->translate('Password'));
     if ($this->getRequest()->isPost()) {
         $userName = $this->params()->fromPost('userName');
         $password = $this->params()->fromPost('password');
         $data = $this->params()->fromPost();
         //login here
         $login_obj = new AuthenticationService(null, $this->modelUsers);
         $this->modelUsers->setLoginUser($data);
         $login_obj->authenticate();
         //check login
         $user = Utility::checkLogin($this);
         if ($user != null) {
             Utility::insertHistory('login');
             $this->redirect()->toRoute('frontend/child', array('controller' => 'table'));
         } else {
             $this->redirect()->toRoute('frontend/child', array('controller' => 'login'));
         }
         //end check login
     }
     return new ViewModel($data);
 }