/**
  * This is the default method routed to by the frontcontroller
  */
 public function actionIndex()
 {
     $this->addView('library/index');
     $books = BookDao::get()->findAll();
     $id = $this->_auth->getId();
     $user = \ezmvc\dao\UserDAO::get()->findById($id);
     $this->username = $user->Username;
     $this->firstname = $user->FirstName;
     $this->lastname = $user->LastName;
 }
 public function actionEdit($id)
 {
     $id = $this->_auth->getId();
     $user = \ezmvc\dao\UserDAO::get()->findById($id);
     $this->username = $user->Username;
     $this->firstname = $user->FirstName;
     $this->lastname = $user->LastName;
     $userid = $this->_requireLogin();
     $dao = UserDao::get('');
     // populate the form
     $user = $dao->findById($userid);
     // if form is posted and valid
     if ($this->_validForm($this->_request->getPost('form'), $user)) {
         // prepare for persistence, update and redirect
         $user->prepare();
         $dao->update($user);
         $this->_redirect('library');
     }
     // prepare the view
     $this->addView('user/edit', 'content');
     $this->pagetitle = 'Edit profile';
     $this->content->user = $user;
 }