34 public static function model($className=__CLASS__)
44 return '{{tmp_user}}';
47 protected function afterFind()
49 $format = Yii::app()->locale->getDateFormat();
50 $oldDate = $this->birthday;
51 $this->birthday = Yii::app()->dateFormatter->format($format, $oldDate);
55 protected function beforeSave()
57 if(parent::beforeSave()) {
59 $dateFormat = Yii::app()->locale->getDateFormat();
60 $dateFormat = ($dateFormat ==
'MMM d, y')?
'MMM d, yyyy':$dateFormat;
62 $this->birthday = date(
'Y-m-d',
63 CDateTimeParser::parse($this->birthday,
135 $dateFormat = Yii::app()->locale->getDateFormat();
136 $dateFormat = ($dateFormat ==
'MMM d, y')?
'MMM d, yyyy':$dateFormat;
139 array(
'salutation, firstname, lastname, street, zip_code, city, country, email',
'required'),
140 array(
'salutation, firstname, lastname, company, street, zip_code, city, country, telephone, email',
'length',
'max'=>255),
141 array(
'email',
'email'),
142 array(
'birthday',
'date',
'format' => $dateFormat),
143 array(
'birthday',
'safe'),
146 array(
'id, salutation, firstname, lastname, company, birthday, street, zip_code, city, country, telephone, email',
'safe',
'on'=>
'search'),
147 array(
'salutation, firstname, lastname, street, zip_code, city, country, email, birthday, telephone, company',
'filter',
'filter'=>array($obj=
new CHtmlPurifier(),
'purify')),
159 'order' => array(self::HAS_ONE,
'Order',
'user_id'),
167 public function getExistUser()
197 public function implementFromSession(){
199 if(isset($this->parent_user_id)){
202 foreach($this->attributes as $fieldName => $value){
203 if(isset($user->$fieldName) && empty($this->$fieldName)){
204 $this->$fieldName = $user->$fieldName;
216 public function unsetExistFields(){
218 if(isset($this->parent_user_id)){
221 foreach($this->attributes as $fieldName => $value){
222 if(isset($user->$fieldName) && isset($this->$fieldName)
223 && $user->$fieldName==$this->$fieldName){
224 unset($this->$fieldName);
242 $criteria=
new CDbCriteria;
244 $criteria->compare(
'id',$this->
id,
true);
245 $criteria->compare(
'salutation',$this->salutation,
true);
246 $criteria->compare(
'first_name',$this->first_name,
true);
247 $criteria->compare(
'last_name',$this->last_name,
true);
248 $criteria->compare(
'company',$this->company,
true);
249 $criteria->compare(
'date_of_birth',$this->date_of_birth,
true);
250 $criteria->compare(
'street',$this->street,
true);
251 $criteria->compare(
'zip_code',$this->zip_code,
true);
252 $criteria->compare(
'city',$this->city,
true);
253 $criteria->compare(
'svnr',$this->svnr,
true);
254 $criteria->compare(
'memberNo',$this->memberNo,
true);
255 $criteria->compare(
'country',$this->country,
true);
256 $criteria->compare(
'telephone',$this->telephone,
true);
257 $criteria->compare(
'email',$this->email,
true);
259 return new CActiveDataProvider($this, array(
260 'criteria'=>$criteria,