Thank you kiran , But how I can use it without Scenario model
it’s possible ? .
this is my Code I hope will help u to help me
.
<?php
/* @var $this UsersController */
/* @var $model Users */
/* @var $form CActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'users-forgetpassword-form',
'enableAjaxValidation'=>false,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'email'); ?>
<?php echo $form->textField($model,'email'); ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Submit'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
Users Model :
<?php
/**
* This is the model class for table "tbl_users".
*
* The followings are the available columns in table 'tbl_users':
* @property integer $user_id
* @property string $en_username
* @property string $ar_username
* @property string $email
* @property string $password
* @property string $password_key
* @property integer $status
* @property string $en_signature
* @property string $ar_signature
* @property string $register_date
* @property string $key
*
* The followings are the available model relations:
* @property Articles[] $articles
* @property Articles[] $articles1
* @property Supervisor[] $supervisors
* @property Topstory[] $topstories
*/
class Users extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return Users the static model class
*/
//// Add new filed
public $passwordconfirm;
public $emailconfirm;
public $status;
/// End add new filed
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'tbl_users';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('en_username,email', 'required'),
array('status', 'numerical', 'integerOnly'=>true),
array('en_username, ar_username, email, password, password_key, key', 'length', 'max'=>255),
array('en_signature, ar_signature', 'length', 'max'=>400),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('user_id, en_username, ar_username, email, password, password_key, status, en_signature, ar_signature, register_date, key', 'safe', 'on'=>'search'),
array('password, passwordconfirm', 'required', 'on'=>'insert'),
array('password, passwordconfirm', 'length', 'min'=>6, 'max'=>40),
array('password', 'compare', 'compareAttribute'=>'passwordconfirm'),
array('email,emailconfirm','required', 'on'=>'insert'),
array('email, emailconfirm', 'email'),
array('email', 'compare', 'compareAttribute'=>'emailconfirm'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'articles' => array(self::HAS_MANY, 'Articles', 'user_id'),
'articles1' => array(self::HAS_MANY, 'Articles', 'editby'),
'supervisors' => array(self::HAS_MANY, 'Supervisor', 'user_id'),
'topstories' => array(self::HAS_MANY, 'Topstory', 'user_id'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'user_id' => 'User',
'en_username' => 'En Username',
'ar_username' => 'Ar Username',
'email' => 'Email',
'password' => 'Password',
'password_key' => 'Password Key',
'status' => 'Status',
'en_signature' => 'En Signature',
'ar_signature' => 'Ar Signature',
'register_date' => 'Register Date',
'key' => 'Key',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('user_id',$this->user_id);
$criteria->compare('en_username',$this->en_username,true);
$criteria->compare('ar_username',$this->ar_username,true);
$criteria->compare('email',$this->email,true);
$criteria->compare('password',$this->password,true);
$criteria->compare('password_key',$this->password_key,true);
$criteria->compare('status',$this->status);
$criteria->compare('en_signature',$this->en_signature,true);
$criteria->compare('ar_signature',$this->ar_signature,true);
$criteria->compare('register_date',$this->register_date,true);
$criteria->compare('key',$this->key,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}
thanks in advance .