From 9f108dd1a969473375341d92a7b1252fa2cedc9a Mon Sep 17 00:00:00 2001 From: mszulecki Date: Thu, 14 Jun 2007 17:09:01 +0000 Subject: Initial import. git-svn-id: http://svn.sukimashita.com/repos/mailadmin/trunk@2 4281df72-ff29-0410-8fee-2d9ac0c5f5a7 --- apps/admin/modules/user/actions/actions.class.php | 115 ++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 apps/admin/modules/user/actions/actions.class.php (limited to 'apps/admin/modules/user/actions') diff --git a/apps/admin/modules/user/actions/actions.class.php b/apps/admin/modules/user/actions/actions.class.php new file mode 100644 index 0000000..1af2445 --- /dev/null +++ b/apps/admin/modules/user/actions/actions.class.php @@ -0,0 +1,115 @@ +hasRequestParameter("max_per_page")) + $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page")); + + return parent::executeList(); + } + + public function executeCreate() + { + // populate preset values + $user = $this->getRequestParameter('user'); + $user["parent_user_id"] = $this->getUser()->getId(); + $this->getRequest()->setParameter('user', $user); + + $this->setTemplate("edit"); + return $this->executeEdit(); + } + + public function handleErrorCreate() + { + // populate preset values + $user = $this->getRequestParameter('user'); + $user["parent_user_id"] = $this->getUser()->getId(); + $this->getRequest()->setParameter('user', $user); + + $this->setTemplate("edit"); + return $this->handleErrorEdit(); + } + + public function executeLogin() + { + if($this->getRequest()->getMethod() != sfRequest::POST) + { + $this->getRequest()->setAttribute('referer', $this->getRequest()->getReferer()); + + return sfView::SUCCESS; + } + else + { + return $this->redirect($this->getRequestParameter('referer', '@homepage')); + } + } + + public function handleErrorLogin() + { + return sfView::SUCCESS; + } + + public function executeSettings() + { + $user = UserPeer::retrieveByPK($this->getUser()->getId()); + $this->user = $user; + + if($this->getRequest()->getMethod() != sfRequest::POST) + { + $this->getRequest()->setAttribute('referer', $this->getRequest()->getReferer()); + } + else + { + if($this->getRequest()->getParameter("commit") == "Cancel") + return $this->redirect($this->getRequestParameter('referer', '@homepage')); + + // update record + $user->setNickname($this->getRequestParameter("nickname")); + $user->setFirstName($this->getRequestParameter("first_name")); + $user->setLastName($this->getRequestParameter("last_name")); + $user->setEmail($this->getRequestParameter("email")); + + // set new password + $password = $this->getRequestParameter("password2"); + if($password != "") + $user->setPassword($password); + + $user->save(); + + // update session + $this->getUser()->updateUserAttributes($user); + + return $this->redirect($this->getRequestParameter('referer', '@homepage')); + } + + return sfView::SUCCESS; + } + + public function handleErrorSettings() + { + $user = UserPeer::retrieveByPK($this->getUser()->getId()); + $this->user = $user; + + if($this->getRequest()->getParameter("commit") == "Cancel") + return $this->redirect($this->getRequestParameter('referer', '@homepage')); + + return sfView::SUCCESS; + } + + public function executeLogout() + { + $this->getUser()->signOut($user); + $this->redirect("@homepage"); + } +} -- cgit v1.1-32-gdbae