Permalink
Browse files

Merge branch 'master' of github.com:bestdeveloper/amessenger

  • Loading branch information...
2 parents 96b1070 + 17aadd6 commit ee430a3955e8b2fc0d454878a28feb7c86172e09 @bestdeveloper committed May 26, 2012
View
@@ -3,12 +3,19 @@
@darkGray: #777;
@gray: #bbb;
+*{
+ font-family: Arial;
+}
+
body{
background: url(../img/main-bg.png);
.logo{
- color: @red;
- font-size: 24px;
+ img{
+ margin-top: 5px;
+ border: 0px;
+ outline: 0px;
+ }
}
.space{
@@ -115,6 +122,7 @@ body{
a.info{
.info;
text-decoration: underline;
+ margin-right: 15px;
}
span.info{
.info;
@@ -14,7 +14,19 @@ public function accessRules()
public function actionAccount()
{
- $this->render('account', array('user' => UserManager::getCurrentUser()));
+ $userReg = new UserRegNumberForm();
+ if ($this->request->isPostRequest) {
+ $userReg->attributes = $this->request->getParam('UserRegNumberForm');
+ $userReg->user_id = $this->user->id;
+ if ($userReg->save())
+ $this->redirect('user/account');
+
+
+ }
+
+ $this->render('account', array(
+ 'user' => UserManager::getCurrentUser(),
+ 'regNumber' => $userReg));
}
public function actionDeleteRegNumber()
@@ -15,9 +15,9 @@ public function tableName()
public function rules()
{
return array(
- array('user_id, reg_number, created_at', 'required'),
+ array('user_id, reg_number', 'required'),
array('user_id', 'length', 'max' => 11),
- array('reg_number', 'length', 'max' => 7),
+ array('reg_number', 'length', 'max' => 8),
);
}
@@ -27,14 +27,4 @@ public function relations()
'user' => array(self::BELONGS_TO, 'User', 'user_id'),
);
}
-
-
- public function beforeSave()
- {
- if ($this->isNewRecord) {
- if (empty($this->created_at))
- $this->created_at = date('Y-m-d H:i:s');
- }
- return parent::beforeSave();
- }
}
@@ -0,0 +1,34 @@
+<?php
+
+class UserRegNumberForm extends UserRegNumber
+{
+ public static function model($className = __CLASS__)
+ {
+ return parent::model($className);
+ }
+
+ public function relations()
+ {
+ return array(
+ 'user' => array(self::BELONGS_TO, 'UserForm', 'user_id'),
+ );
+ }
+
+ public function attributeLabels()
+ {
+ return array(
+ 'user_id' => 'User',
+ 'reg_number' => 'Reg Number',
+ 'created_at' => 'Created At',
+ );
+ }
+
+ public function behaviors() {
+ return array(
+ 'wform' => array(
+ 'class' => 'ext.wform.WFormBehavior',
+ 'relations' => array()
+ ),
+ );
+ }
+}
@@ -2,8 +2,8 @@
<body>
<div class="container">
<div class="row space">
- <div class="span3">
- <h3 class="logo">Подрезал.me</h3>
+ <div class="span3 logo">
+ <a href="/"><img src="/img/logo.png"/></a>
</div>
<div class="span9">
<div class="row">
@@ -1,3 +1,10 @@
+<?php $form = $this->beginWidget('WForm', array('type' => BootActiveForm::TYPE_HORIZONTAL)); ?>
+ <?php echo $form->textFieldRow($regNumber, 'reg_number');?>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">Save</button>
+ <button type="reset" class="btn">Cancel</button>
+ </div>
+<?php $this->endWidget(); ?>
<table class="table table-bordered">

0 comments on commit ee430a3

Please sign in to comment.