From 4668085ef587793dce2e167df6d5f3d80d4be34b Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 28 Jan 2016 17:24:33 +0200 Subject: [PATCH] firs page --- common/models/Fields.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/widgets/FieldEditor.php | 2 +- console/migrations/m160128_101543_fields.php | 27 +++++++++++++++++++++++++++ frontend/views/accounts/_form.php | 2 +- 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 common/models/Fields.php create mode 100644 console/migrations/m160128_101543_fields.php diff --git a/common/models/Fields.php b/common/models/Fields.php new file mode 100644 index 0000000..df68eb2 --- /dev/null +++ b/common/models/Fields.php @@ -0,0 +1,57 @@ + 255] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'table_name' => 'Model Name', + 'table_id' => 'Model ID', + 'value' => 'Value', + 'field_name' => 'Field Name', + 'language' => 'Language', + ]; + } + + public static function getData($id, $model, $type){ + return self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all(); + } +} diff --git a/common/widgets/FieldEditor.php b/common/widgets/FieldEditor.php index 82a0b41..baa8112 100644 --- a/common/widgets/FieldEditor.php +++ b/common/widgets/FieldEditor.php @@ -1,5 +1,5 @@ createTable('{{%fields}}', [ + 'id' => $this->primaryKey(), + 'table_name' => $this->string(255)->notNull(), + 'table_id' => $this->integer(), + 'value' => $this->string(255), + 'field_name' => $this->string(), + 'field_type' => $this->string(32)->notNull(), + 'language' => $this->integer() + ], $tableOptions); + + } + + public function down() + { + $this->dropTable('{{%fields}}'); + } +} diff --git a/frontend/views/accounts/_form.php b/frontend/views/accounts/_form.php index 2778d4f..6301ee7 100644 --- a/frontend/views/accounts/_form.php +++ b/frontend/views/accounts/_form.php @@ -49,7 +49,7 @@ use yii\widgets\ActiveForm; field($user_info, 'about')->textarea(['rows' => 6]) ?> - $model->id, 'model'=>'Gallery']); ?> +'', 'item_id'=> $user->id, 'model'=>'User']); ?>
-- libgit2 0.21.4