PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
profile
/
models
<?php class UserForm extends CFormModel { public $id; public $name; public $email; public $password; public $is_active; /** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array( 'name' => 'Name', 'email' => 'Email', 'password' => 'Password', 'is_active' => 'Is active', ); } public function rules() { return array( array('name, password', 'required'), array('name', 'length', 'max' => 255), array('password', 'length', 'min' => 6), array('id, name, email, password, is_active', 'safe'), ); } public function save($item = null) { if ($this->validate()) { $user = User::model()->findByPk($this->id); $user->name = $this->name; if ($user->save()) { Yii::app()->user->name = $user->name; return true; } return false; } else { return false; } } public function unique() { if ($this->scenario === 'create' || !isset($this->id)) { $user = User::model()->find("LOWER(email) = '".$this->email."'"); if ($user == null) { return true; } $this->addError('email', Yii::t('RbamModule.validation', 'The email "{email}" is already used by another user.', array('{email}' => $this->email))); } elseif ($this->scenario === 'update' && isset($this->id)) { $user = User::model()->find('id = '.$this->id." and LOWER(email) = '".$this->email."'"); if ($user != null) { return true; } $user = User::model()->find("LOWER(email) = '".$this->email."'"); if ($user == null) { return true; } $this->addError('email', Yii::t('RbamModule.validation', 'The email "{email}" is already used by another user.', array('{email}' => $this->email))); } return true; } }
[+]
..
[-] ResetPassForm.php
[edit]
[-] DeletePage1Form.php
[edit]
[-] PageForm.php
[edit]
[-] DeletePageForm.php
[edit]
[-] ChangeDomainForm.php
[edit]
[-] UserForm.php
[edit]
[-] ChangeSubDomainForm.php
[edit]