summaryrefslogtreecommitdiffstats
path: root/apps/admin/modules/user/actions/actions.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/admin/modules/user/actions/actions.class.php')
-rw-r--r--apps/admin/modules/user/actions/actions.class.php115
1 files changed, 115 insertions, 0 deletions
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 @@
+<?php
+
+/**
+ * user actions.
+ *
+ * @package mailadmin
+ * @subpackage user
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
+ */
+class userActions extends autouserActions
+{
+ public function executeList()
+ {
+ // pageination
+ if($this->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");
+ }
+}