summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php
diff options
context:
space:
mode:
authorctrlaltca <>2012-07-12 11:21:01 +0000
committerctrlaltca <>2012-07-12 11:21:01 +0000
commit903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 (patch)
treee08bf04f0823650a231227ac3499121270172a23 /demos/time-tracker/protected/pages/TimeTracker/UserCreate.php
parent3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff)
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'demos/time-tracker/protected/pages/TimeTracker/UserCreate.php')
-rw-r--r--demos/time-tracker/protected/pages/TimeTracker/UserCreate.php222
1 files changed, 111 insertions, 111 deletions
diff --git a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php
index 8ee077ac..eddb87cb 100644
--- a/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php
+++ b/demos/time-tracker/protected/pages/TimeTracker/UserCreate.php
@@ -1,112 +1,112 @@
-<?php
-/**
- * UserCreate page class file.
- *
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- * @package Demos
- */
-
-/**
- * Create new user wizard page class. Validate that the usernames are unique and
- * set the new user credentials as the current application credentials.
- *
- * If logged in as admin, the user role can be change during creation.
- *
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @version $Id$
- * @package Demos
- * @since 3.1
- */
-class UserCreate extends TPage
-{
- /**
- * Sets the default new user roles, default role is set in config.xml
- */
- public function onLoad($param)
- {
- if(!$this->IsPostBack)
- {
- $this->role->SelectedValue =
- $this->Application->Parameters['NewUserRoles'];
- }
- }
-
- /**
- * Verify that the username is not taken.
- * @param TControl custom validator that created the event.
- * @param TServerValidateEventParameter validation parameters.
- */
- public function checkUsername($sender, $param)
- {
- $userDao = $this->Application->Modules['daos']->getDao('UserDao');
- if($userDao->usernameExists($this->username->Text))
- {
- $param->IsValid = false;
- $sender->ErrorMessage =
- "The user name is already taken, try '{$this->username->Text}01'";
- }
- }
-
- /**
- * Skip the role assignment step if not admin.
- */
- public function userWizardNextStep($sender, $param)
- {
- if($param->CurrentStepIndex == 0)
- {
- //create user with admin credentials
- if(!$this->User->isInRole('admin'))
- {
- $this->createNewUser($sender, $param);
- $param->NextStepIndex = 2;
- }
- }
- }
-
- /**
- * Create a new user if all data entered are valid.
- * The default user roles are obtained from "config.xml". The new user
- * details is saved to the database and the new credentials are used as the
- * application user. The user is redirected to the requested page.
- * @param TControl button control that created the event.
- * @param TEventParameter event parameters.
- */
- public function createNewUser($sender, $param)
- {
- if($this->IsValid)
- {
- $newUser = new TimeTrackerUser($this->User->Manager);
- $newUser->EmailAddress = $this->email->Text;
- $newUser->Name = $this->username->Text;
- $newUser->IsGuest = false;
- $newUser->Roles = $this->role->SelectedValue;
-
- //save the user
- $userDao = $this->Application->Modules['daos']->getDao('UserDao');
- $userDao->addNewUser($newUser, $this->password->Text);
-
- //update the user credentials if not admin
- if(!$this->User->isInRole('admin'))
- {
- $auth = $this->Application->getModule('auth');
- $auth->updateCredential($newUser);
- }
- }
- }
-
- /**
- * Continue with requested page.
- */
- public function wizardCompleted($sender, $param)
- {
- //return to requested page
- $auth = $this->Application->getModule('auth');
- $this->Response->redirect($auth->getReturnUrl());
- }
-}
-
+<?php
+/**
+ * UserCreate page class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ * @package Demos
+ */
+
+/**
+ * Create new user wizard page class. Validate that the usernames are unique and
+ * set the new user credentials as the current application credentials.
+ *
+ * If logged in as admin, the user role can be change during creation.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package Demos
+ * @since 3.1
+ */
+class UserCreate extends TPage
+{
+ /**
+ * Sets the default new user roles, default role is set in config.xml
+ */
+ public function onLoad($param)
+ {
+ if(!$this->IsPostBack)
+ {
+ $this->role->SelectedValue =
+ $this->Application->Parameters['NewUserRoles'];
+ }
+ }
+
+ /**
+ * Verify that the username is not taken.
+ * @param TControl custom validator that created the event.
+ * @param TServerValidateEventParameter validation parameters.
+ */
+ public function checkUsername($sender, $param)
+ {
+ $userDao = $this->Application->Modules['daos']->getDao('UserDao');
+ if($userDao->usernameExists($this->username->Text))
+ {
+ $param->IsValid = false;
+ $sender->ErrorMessage =
+ "The user name is already taken, try '{$this->username->Text}01'";
+ }
+ }
+
+ /**
+ * Skip the role assignment step if not admin.
+ */
+ public function userWizardNextStep($sender, $param)
+ {
+ if($param->CurrentStepIndex == 0)
+ {
+ //create user with admin credentials
+ if(!$this->User->isInRole('admin'))
+ {
+ $this->createNewUser($sender, $param);
+ $param->NextStepIndex = 2;
+ }
+ }
+ }
+
+ /**
+ * Create a new user if all data entered are valid.
+ * The default user roles are obtained from "config.xml". The new user
+ * details is saved to the database and the new credentials are used as the
+ * application user. The user is redirected to the requested page.
+ * @param TControl button control that created the event.
+ * @param TEventParameter event parameters.
+ */
+ public function createNewUser($sender, $param)
+ {
+ if($this->IsValid)
+ {
+ $newUser = new TimeTrackerUser($this->User->Manager);
+ $newUser->EmailAddress = $this->email->Text;
+ $newUser->Name = $this->username->Text;
+ $newUser->IsGuest = false;
+ $newUser->Roles = $this->role->SelectedValue;
+
+ //save the user
+ $userDao = $this->Application->Modules['daos']->getDao('UserDao');
+ $userDao->addNewUser($newUser, $this->password->Text);
+
+ //update the user credentials if not admin
+ if(!$this->User->isInRole('admin'))
+ {
+ $auth = $this->Application->getModule('auth');
+ $auth->updateCredential($newUser);
+ }
+ }
+ }
+
+ /**
+ * Continue with requested page.
+ */
+ public function wizardCompleted($sender, $param)
+ {
+ //return to requested page
+ $auth = $this->Application->getModule('auth');
+ $this->Response->redirect($auth->getReturnUrl());
+ }
+}
+
?> \ No newline at end of file