Commit 88def98887ad515e804eb2023817a291ffda35f1
Merge remote-tracking branch 'origin/master'
Showing
41 changed files
with
399 additions
and
1400 deletions
Show diff stats
backend/views/termin/index.php
1 | <?php | 1 | <?php |
2 | - | ||
3 | -use yii\helpers\Html; | 2 | + use backend\models\Termin; |
3 | + use yii\helpers\Html; | ||
4 | use yii\grid\GridView; | 4 | use yii\grid\GridView; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
@@ -32,7 +32,11 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -32,7 +32,11 @@ $this->params['breadcrumbs'][] = $this->title; | ||
32 | 'attribute' => 'termin_parent_title', | 32 | 'attribute' => 'termin_parent_title', |
33 | 'value' => 'terminStructures.parent.terminLangs.termin_title', | 33 | 'value' => 'terminStructures.parent.terminLangs.termin_title', |
34 | 'content' => function($model, $key, $index, $column) { | 34 | 'content' => function($model, $key, $index, $column) { |
35 | - return $model->terminStructures[0]->parent->terminLangs[0]->termin_title; | 35 | + if($model->terminStructures[0]->parent instanceof Termin) { |
36 | + return $model->terminStructures[0]->parent->terminLangs[0]->termin_title; | ||
37 | + } else { | ||
38 | + return NULL; | ||
39 | + } | ||
36 | } | 40 | } |
37 | ], | 41 | ], |
38 | 'termin_name', | 42 | 'termin_name', |
common/config/.gitignore deleted
1 | +<?php | ||
2 | +return [ | ||
3 | + 'components' => [ | ||
4 | + 'db' => [ | ||
5 | + 'class' => 'yii\db\Connection', | ||
6 | + 'dsn' => 'pgsql:host=127.0.0.1;port=5432;dbname=mfp_local', | ||
7 | + 'username' => 'postgres', | ||
8 | + 'password' => '', | ||
9 | + 'schemaMap' => [ | ||
10 | + 'pgsql'=> [ | ||
11 | + 'class'=>'yii\db\pgsql\Schema', | ||
12 | + 'defaultSchema' => 'public' | ||
13 | + ] | ||
14 | + ], | ||
15 | + ], | ||
16 | + 'mailer' => [ | ||
17 | + 'class' => 'yii\swiftmailer\Mailer', | ||
18 | + 'viewPath' => '@common/mail', | ||
19 | + // send all mails to a file by default. You have to set | ||
20 | + // 'useFileTransport' to false and configure a transport | ||
21 | + // for the mailer to send real emails. | ||
22 | + 'useFileTransport' => true, | ||
23 | + ], | ||
24 | + ], | ||
25 | +]; |
common/config/main.php
@@ -13,7 +13,7 @@ return [ | @@ -13,7 +13,7 @@ return [ | ||
13 | ], | 13 | ], |
14 | ], | 14 | ], |
15 | 'bootstrap' => [ | 15 | 'bootstrap' => [ |
16 | - 'options', | 16 | + 'options' |
17 | ], | 17 | ], |
18 | 'components' => [ | 18 | 'components' => [ |
19 | 'cache' => [ | 19 | 'cache' => [ |
@@ -26,7 +26,7 @@ return [ | @@ -26,7 +26,7 @@ return [ | ||
26 | 'rules'=>[ | 26 | 'rules'=>[ |
27 | '<module:\w+>/<controller:\w+>/<action:(\w|-)+>' => '<module>/<controller>/<action>', | 27 | '<module:\w+>/<controller:\w+>/<action:(\w|-)+>' => '<module>/<controller>/<action>', |
28 | '<module:\w+>/<controller:\w+>/<action:(\w|-)+>/<id:\d+>' => '<module>/<controller>/<action>', | 28 | '<module:\w+>/<controller:\w+>/<action:(\w|-)+>/<id:\d+>' => '<module>/<controller>/<action>', |
29 | - ] | 29 | + ], |
30 | ], | 30 | ], |
31 | 31 | ||
32 | 'i18n' => [ | 32 | 'i18n' => [ |
common/models/OptionHelper.php
@@ -14,7 +14,7 @@ class OptionHelper extends Model | @@ -14,7 +14,7 @@ class OptionHelper extends Model | ||
14 | const OPTION_VALUE = 3; | 14 | const OPTION_VALUE = 3; |
15 | public function getRule($return = 3) | 15 | public function getRule($return = 3) |
16 | { | 16 | { |
17 | - $result = Options::find()->where(['name' => 'rules'])->with('value'); | 17 | + $result = Option::find()->where(['name' => 'rules'])->with('value'); |
18 | if($return == self::OPTION_OBJECT) { | 18 | if($return == self::OPTION_OBJECT) { |
19 | return $result->one(); | 19 | return $result->one(); |
20 | } elseif($return == self::OPTION_ARRAY) { | 20 | } elseif($return == self::OPTION_ARRAY) { |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "user_info". | ||
9 | + * | ||
10 | + * @property integer $user_id | ||
11 | + * @property integer $view_count | ||
12 | + * @property string $busy | ||
13 | + * @property string $date_visit | ||
14 | + * @property string $experience | ||
15 | + * @property string $rank | ||
16 | + * @property string $salary | ||
17 | + * @property string $job | ||
18 | + * @property string $location | ||
19 | + * @property string $soft | ||
20 | + * @property integer $user_info_id | ||
21 | + * @property string $guarantee | ||
22 | + * @property integer $contract | ||
23 | + * @property integer $estimate | ||
24 | + * @property integer $purchase | ||
25 | + * @property integer $delivery | ||
26 | + * @property double $prepayment | ||
27 | + * @property string $about | ||
28 | + */ | ||
29 | +class UserInfo extends \yii\db\ActiveRecord | ||
30 | +{ | ||
31 | + /** | ||
32 | + * @inheritdoc | ||
33 | + */ | ||
34 | + public static function tableName() | ||
35 | + { | ||
36 | + return 'user_info'; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * @inheritdoc | ||
41 | + */ | ||
42 | + public function rules() | ||
43 | + { | ||
44 | + return [ | ||
45 | + [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'], | ||
46 | + [['date_visit'], 'safe'], | ||
47 | + [['experience', 'soft', 'guarantee', 'about'], 'string'], | ||
48 | + [['prepayment'], 'number'], | ||
49 | + [['busy', 'rank', 'location'], 'string', 'max' => 50], | ||
50 | + [['salary', 'job'], 'string', 'max' => 255] | ||
51 | + ]; | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * @inheritdoc | ||
56 | + */ | ||
57 | + public function attributeLabels() | ||
58 | + { | ||
59 | + return [ | ||
60 | + 'user_id' => Yii::t('app', 'User ID'), | ||
61 | + 'view_count' => Yii::t('app', 'View Count'), | ||
62 | + 'busy' => Yii::t('app', 'Busy'), | ||
63 | + 'date_visit' => Yii::t('app', 'Date Visit'), | ||
64 | + 'experience' => Yii::t('app', 'Experience'), | ||
65 | + 'rank' => Yii::t('app', 'Rank'), | ||
66 | + 'salary' => Yii::t('app', 'Salary'), | ||
67 | + 'job' => Yii::t('app', 'Job'), | ||
68 | + 'location' => Yii::t('app', 'Location'), | ||
69 | + 'soft' => Yii::t('app', 'Soft'), | ||
70 | + 'user_info_id' => Yii::t('app', 'User Info ID'), | ||
71 | + 'guarantee' => Yii::t('app', 'Guarantee'), | ||
72 | + 'contract' => Yii::t('app', 'Contract'), | ||
73 | + 'estimate' => Yii::t('app', 'Estimate'), | ||
74 | + 'purchase' => Yii::t('app', 'Purchase'), | ||
75 | + 'delivery' => Yii::t('app', 'Delivery'), | ||
76 | + 'prepayment' => Yii::t('app', 'Prepayment'), | ||
77 | + 'about' => Yii::t('app', 'About'), | ||
78 | + ]; | ||
79 | + } | ||
80 | +} |
frontend/models/OptionLangSearch.php renamed to common/models/UserInfoSearch.php
100755 โ 100644
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | -namespace frontend\models; | 3 | +namespace common\models; |
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | use yii\base\Model; | 6 | use yii\base\Model; |
7 | use yii\data\ActiveDataProvider; | 7 | use yii\data\ActiveDataProvider; |
8 | -use frontend\models\OptionLang; | 8 | +use common\models\UserInfo; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | - * OptionLangSearch represents the model behind the search form about `frontend\models\OptionLang`. | 11 | + * UserInfoSearch represents the model behind the search form about `common\models\UserInfo`. |
12 | */ | 12 | */ |
13 | -class OptionLangSearch extends OptionLang | 13 | +class UserInfoSearch extends UserInfo |
14 | { | 14 | { |
15 | /** | 15 | /** |
16 | * @inheritdoc | 16 | * @inheritdoc |
@@ -18,8 +18,9 @@ class OptionLangSearch extends OptionLang | @@ -18,8 +18,9 @@ class OptionLangSearch extends OptionLang | ||
18 | public function rules() | 18 | public function rules() |
19 | { | 19 | { |
20 | return [ | 20 | return [ |
21 | - [['option_language_id', 'option_id', 'language_id'], 'integer'], | ||
22 | - [['value'], 'safe'], | 21 | + [['user_id', 'view_count', 'user_info_id', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'], |
22 | + [['busy', 'date_visit', 'experience', 'rank', 'salary', 'job', 'location', 'soft', 'guarantee', 'about'], 'safe'], | ||
23 | + [['prepayment'], 'number'], | ||
23 | ]; | 24 | ]; |
24 | } | 25 | } |
25 | 26 | ||
@@ -41,7 +42,7 @@ class OptionLangSearch extends OptionLang | @@ -41,7 +42,7 @@ class OptionLangSearch extends OptionLang | ||
41 | */ | 42 | */ |
42 | public function search($params) | 43 | public function search($params) |
43 | { | 44 | { |
44 | - $query = OptionLang::find(); | 45 | + $query = UserInfo::find(); |
45 | 46 | ||
46 | $dataProvider = new ActiveDataProvider([ | 47 | $dataProvider = new ActiveDataProvider([ |
47 | 'query' => $query, | 48 | 'query' => $query, |
@@ -56,12 +57,26 @@ class OptionLangSearch extends OptionLang | @@ -56,12 +57,26 @@ class OptionLangSearch extends OptionLang | ||
56 | } | 57 | } |
57 | 58 | ||
58 | $query->andFilterWhere([ | 59 | $query->andFilterWhere([ |
59 | - 'option_language_id' => $this->option_language_id, | ||
60 | - 'option_id' => $this->option_id, | ||
61 | - 'language_id' => $this->language_id, | 60 | + 'user_id' => $this->user_id, |
61 | + 'view_count' => $this->view_count, | ||
62 | + 'date_visit' => $this->date_visit, | ||
63 | + 'user_info_id' => $this->user_info_id, | ||
64 | + 'contract' => $this->contract, | ||
65 | + 'estimate' => $this->estimate, | ||
66 | + 'purchase' => $this->purchase, | ||
67 | + 'delivery' => $this->delivery, | ||
68 | + 'prepayment' => $this->prepayment, | ||
62 | ]); | 69 | ]); |
63 | 70 | ||
64 | - $query->andFilterWhere(['like', 'value', $this->value]); | 71 | + $query->andFilterWhere(['like', 'busy', $this->busy]) |
72 | + ->andFilterWhere(['like', 'experience', $this->experience]) | ||
73 | + ->andFilterWhere(['like', 'rank', $this->rank]) | ||
74 | + ->andFilterWhere(['like', 'salary', $this->salary]) | ||
75 | + ->andFilterWhere(['like', 'job', $this->job]) | ||
76 | + ->andFilterWhere(['like', 'location', $this->location]) | ||
77 | + ->andFilterWhere(['like', 'soft', $this->soft]) | ||
78 | + ->andFilterWhere(['like', 'guarantee', $this->guarantee]) | ||
79 | + ->andFilterWhere(['like', 'about', $this->about]); | ||
65 | 80 | ||
66 | return $dataProvider; | 81 | return $dataProvider; |
67 | } | 82 | } |
common/modules/blog/Module.php
1 | <?php | 1 | <?php |
2 | namespace common\modules\blog; | 2 | namespace common\modules\blog; |
3 | 3 | ||
4 | +use yii\base\BootstrapInterface; | ||
5 | + | ||
4 | class Module extends \yii\base\Module | 6 | class Module extends \yii\base\Module |
5 | { | 7 | { |
6 | public function init() | 8 | public function init() |
@@ -9,4 +11,5 @@ class Module extends \yii\base\Module | @@ -9,4 +11,5 @@ class Module extends \yii\base\Module | ||
9 | 11 | ||
10 | \Yii::configure($this, require(__DIR__.'/config.php')); | 12 | \Yii::configure($this, require(__DIR__.'/config.php')); |
11 | } | 13 | } |
14 | + | ||
12 | } | 15 | } |
common/modules/blog/views/ajax/_article_form.php
@@ -10,29 +10,29 @@ if(empty($form)) { | @@ -10,29 +10,29 @@ if(empty($form)) { | ||
10 | ?> | 10 | ?> |
11 | <div role="" class="tab-pane active ajax-loaded" id="<?=$widget_id?>-<?=$model->language_id?>"> | 11 | <div role="" class="tab-pane active ajax-loaded" id="<?=$widget_id?>-<?=$model->language_id?>"> |
12 | 12 | ||
13 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]language_id"]))->label(false)->hiddenInput(['value' => $model->language_id]) ?> | 13 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]language_id", 'form' => $form]))->label(false)->hiddenInput(['value' => $model->language_id]) ?> |
14 | 14 | ||
15 | <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]text", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?> | 15 | <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]text", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?> |
16 | 16 | ||
17 | <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]preview", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?> | 17 | <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]preview", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?> |
18 | 18 | ||
19 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]seo_url"]))->textInput() ?> | 19 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]seo_url", 'form' => $form]))->textInput() ?> |
20 | 20 | ||
21 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]name"]))->textInput() ?> | 21 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]name", 'form' => $form]))->textInput() ?> |
22 | 22 | ||
23 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_title"]))->textInput() ?> | 23 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_title", 'form' => $form]))->textInput() ?> |
24 | 24 | ||
25 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_descr"]))->textarea() ?> | 25 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_descr", 'form' => $form]))->textarea() ?> |
26 | 26 | ||
27 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_keyword"]))->textInput() ?> | 27 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_keyword", 'form' => $form]))->textInput() ?> |
28 | 28 | ||
29 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]h1_tag"]))->textInput() ?> | 29 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]h1_tag", 'form' => $form]))->textInput() ?> |
30 | 30 | ||
31 | - <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]tag"]))->textInput() ?> | 31 | + <?= (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]tag", 'form' => $form]))->textInput() ?> |
32 | 32 | ||
33 | </div> | 33 | </div> |
34 | <?php | 34 | <?php |
35 | - if($new_form) { | 35 | + if(isset($new_form) && $new_form === true) { |
36 | $form->end(); | 36 | $form->end(); |
37 | } | 37 | } |
38 | ?> | 38 | ?> |
console/migrations/m130524_201442_init.php
@@ -16,6 +16,9 @@ class m130524_201442_init extends Migration | @@ -16,6 +16,9 @@ class m130524_201442_init extends Migration | ||
16 | $this->createTable('{{%user}}', [ | 16 | $this->createTable('{{%user}}', [ |
17 | 'id' => $this->primaryKey(), | 17 | 'id' => $this->primaryKey(), |
18 | 'username' => $this->string()->notNull()->unique(), | 18 | 'username' => $this->string()->notNull()->unique(), |
19 | + 'lastname' => $this->string(), | ||
20 | + 'firstname' => $this->string(), | ||
21 | + 'middlename' => $this->string(), | ||
19 | 'auth_key' => $this->string(32)->notNull(), | 22 | 'auth_key' => $this->string(32)->notNull(), |
20 | 'password_hash' => $this->string()->notNull(), | 23 | 'password_hash' => $this->string()->notNull(), |
21 | 'password_reset_token' => $this->string()->unique(), | 24 | 'password_reset_token' => $this->string()->unique(), |
@@ -25,6 +28,19 @@ class m130524_201442_init extends Migration | @@ -25,6 +28,19 @@ class m130524_201442_init extends Migration | ||
25 | 'created_at' => $this->integer()->notNull(), | 28 | 'created_at' => $this->integer()->notNull(), |
26 | 'updated_at' => $this->integer()->notNull(), | 29 | 'updated_at' => $this->integer()->notNull(), |
27 | ], $tableOptions); | 30 | ], $tableOptions); |
31 | + | ||
32 | + $this->insert('{{%user}}', [ | ||
33 | + 'username' => 'admin', | ||
34 | + 'lastname' => 'admin', | ||
35 | + 'firstname' => 'admin', | ||
36 | + 'middlename' => '', | ||
37 | + 'auth_key' => 'SlJ315le5enaDJ4OsdvXX83i_drf-JXl', | ||
38 | + 'password_hash' => '$2y$13$LfYpoaZkKzniNw/7rySAnOVPHy8wKFFznxBVoAWTnbLv/Di0oXqvi', | ||
39 | + 'password_reset_token' => 'NULL', | ||
40 | + 'email' => 'admin@admin.com', | ||
41 | + 'created_at' => '1', | ||
42 | + 'updated_at' => '1', | ||
43 | + ]); | ||
28 | } | 44 | } |
29 | 45 | ||
30 | public function down() | 46 | public function down() |
frontend/assets/AppAsset.php
@@ -19,6 +19,7 @@ class AppAsset extends AssetBundle | @@ -19,6 +19,7 @@ class AppAsset extends AssetBundle | ||
19 | public $baseUrl = '@web'; | 19 | public $baseUrl = '@web'; |
20 | public $css = [ | 20 | public $css = [ |
21 | 'css/style.css', | 21 | 'css/style.css', |
22 | + '/admin/css/flags32.css' | ||
22 | ]; | 23 | ]; |
23 | public $js = [ | 24 | public $js = [ |
24 | 'js/script.js', | 25 | 'js/script.js', |
@@ -26,7 +27,8 @@ class AppAsset extends AssetBundle | @@ -26,7 +27,8 @@ class AppAsset extends AssetBundle | ||
26 | 'js/markerclusterer.js', | 27 | 'js/markerclusterer.js', |
27 | 'js/jquery.scrollbox.min.js', | 28 | 'js/jquery.scrollbox.min.js', |
28 | 'js/slider.js', | 29 | 'js/slider.js', |
29 | - 'js/jquery.rating.js' | 30 | + 'js/jquery.rating.js', |
31 | + '/admin/js/option.js' | ||
30 | ]; | 32 | ]; |
31 | public $depends = [ | 33 | public $depends = [ |
32 | 'yii\web\YiiAsset', | 34 | 'yii\web\YiiAsset', |
frontend/controllers/OptionController.php
@@ -3,12 +3,11 @@ | @@ -3,12 +3,11 @@ | ||
3 | namespace frontend\controllers; | 3 | namespace frontend\controllers; |
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | -use frontend\models\Option; | ||
7 | -use frontend\models\OptionSearch; | 6 | +use common\models\Option; |
7 | +use common\models\OptionSearch; | ||
8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
11 | -use frontend\models\OptionLang; | ||
12 | 11 | ||
13 | /** | 12 | /** |
14 | * OptionController implements the CRUD actions for Option model. | 13 | * OptionController implements the CRUD actions for Option model. |
@@ -61,14 +60,17 @@ class OptionController extends Controller | @@ -61,14 +60,17 @@ class OptionController extends Controller | ||
61 | */ | 60 | */ |
62 | public function actionCreate() | 61 | public function actionCreate() |
63 | { | 62 | { |
64 | - $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text', 'translate' => true], ['name' => 'adres', 'template' => 'text', 'translate' => false]]); | ||
65 | - if($form[0]['success'] == false) { | ||
66 | - return $this->render('create', ['forms' => $form]); | 63 | + $model = new Option(); |
64 | + | ||
65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
66 | + return $this->redirect(['view', 'id' => $model->option_id]); | ||
67 | } else { | 67 | } else { |
68 | - return $this->redirect(['index']); | 68 | + return $this->render('create', [ |
69 | + 'model' => $model, | ||
70 | + ]); | ||
69 | } | 71 | } |
70 | } | 72 | } |
71 | - | 73 | + |
72 | /** | 74 | /** |
73 | * Updates an existing Option model. | 75 | * Updates an existing Option model. |
74 | * If update is successful, the browser will be redirected to the 'view' page. | 76 | * If update is successful, the browser will be redirected to the 'view' page. |
@@ -77,11 +79,14 @@ class OptionController extends Controller | @@ -77,11 +79,14 @@ class OptionController extends Controller | ||
77 | */ | 79 | */ |
78 | public function actionUpdate($id) | 80 | public function actionUpdate($id) |
79 | { | 81 | { |
80 | - $form[0] = Option::change($id, \Yii::$app->request->post(), 'User', 10); | ||
81 | - if($form[0]['success'] == false) { | ||
82 | - return $this->render('update', ['forms' => $form]); | 82 | + $model = $this->findModel($id); |
83 | + | ||
84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
85 | + return $this->redirect(['view', 'id' => $model->option_id]); | ||
83 | } else { | 86 | } else { |
84 | - return $this->redirect(['view', 'id' => $id]); | 87 | + return $this->render('update', [ |
88 | + 'model' => $model, | ||
89 | + ]); | ||
85 | } | 90 | } |
86 | } | 91 | } |
87 | 92 | ||
@@ -93,23 +98,7 @@ class OptionController extends Controller | @@ -93,23 +98,7 @@ class OptionController extends Controller | ||
93 | */ | 98 | */ |
94 | public function actionDelete($id) | 99 | public function actionDelete($id) |
95 | { | 100 | { |
96 | - $model = $this->findModel($id); | ||
97 | - $children = $model->hasMany(Option::className(), ['parent_id' => 'option_id'])->all(); | ||
98 | - $langs = array(); | ||
99 | - if(!empty($children)) { | ||
100 | - foreach($children as $child) { | ||
101 | - $langs = OptionLang::findAll(['id' => $child->option_id]); | ||
102 | - foreach($langs as $lang) { | ||
103 | - $lang->delete(); | ||
104 | - } | ||
105 | - $child->delete(); | ||
106 | - } | ||
107 | - } | ||
108 | - $langs = OptionLang::findAll(['id' => $id]); | ||
109 | - foreach($langs as $lang) { | ||
110 | - $lang->delete(); | ||
111 | - } | ||
112 | - $model->delete(); | 101 | + $this->findModel($id)->delete(); |
113 | 102 | ||
114 | return $this->redirect(['index']); | 103 | return $this->redirect(['index']); |
115 | } | 104 | } |
frontend/controllers/OptionValuesController.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\controllers; | ||
4 | - | ||
5 | -use Yii; | ||
6 | -use frontend\models\OptionValues; | ||
7 | -use frontend\models\OptionValuesSearch; | ||
8 | -use yii\web\Controller; | ||
9 | -use yii\web\NotFoundHttpException; | ||
10 | -use yii\filters\VerbFilter; | ||
11 | - | ||
12 | -/** | ||
13 | - * OptionValuesController implements the CRUD actions for OptionValues model. | ||
14 | - */ | ||
15 | -class OptionValuesController extends Controller | ||
16 | -{ | ||
17 | - public function behaviors() | ||
18 | - { | ||
19 | - return [ | ||
20 | - 'verbs' => [ | ||
21 | - 'class' => VerbFilter::className(), | ||
22 | - 'actions' => [ | ||
23 | - 'delete' => ['post'], | ||
24 | - ], | ||
25 | - ], | ||
26 | - ]; | ||
27 | - } | ||
28 | - | ||
29 | - /** | ||
30 | - * Lists all OptionValues models. | ||
31 | - * @return mixed | ||
32 | - */ | ||
33 | - public function actionIndex() | ||
34 | - { | ||
35 | - $searchModel = new OptionValuesSearch(); | ||
36 | - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
37 | - return $this->render('index', [ | ||
38 | - 'searchModel' => $searchModel, | ||
39 | - 'dataProvider' => $dataProvider, | ||
40 | - ]); | ||
41 | - } | ||
42 | - | ||
43 | - /** | ||
44 | - * Displays a single OptionValues model. | ||
45 | - * @param integer $id | ||
46 | - * @return mixed | ||
47 | - */ | ||
48 | - public function actionView($id) | ||
49 | - { | ||
50 | - return $this->render('view', [ | ||
51 | - 'model' => $this->findModel($id), | ||
52 | - ]); | ||
53 | - } | ||
54 | - | ||
55 | - /** | ||
56 | - * Creates a new OptionValues model. | ||
57 | - * If creation is successful, the browser will be redirected to the 'view' page. | ||
58 | - * @return mixed | ||
59 | - */ | ||
60 | - public function actionCreate() | ||
61 | - { | ||
62 | - $post = \Yii::$app->request->post(); | ||
63 | - if(is_array($post['OptionValues']['option_value_text'])) { | ||
64 | - $ok = 0; | ||
65 | - $first = 0; | ||
66 | - $id = 0; | ||
67 | - $models = array(); | ||
68 | - foreach($post['OptionValues']['option_value_text'] as $lang => $value) { | ||
69 | - $models[$lang] = new OptionValues(); | ||
70 | - $models[$lang]->load(Yii::$app->request->post()); | ||
71 | - $models[$lang]->option_language_id = $lang; | ||
72 | - $models[$lang]->option_value_text = $value; | ||
73 | - if($first && $id) { | ||
74 | - $models[$lang]->option_value_parent = $id; | ||
75 | - } | ||
76 | - if($models[$lang]->save()) { | ||
77 | - $ok = 1; | ||
78 | - if(!$first) { | ||
79 | - $first = 1; | ||
80 | - $id = $models[$lang]->option_value_id; | ||
81 | - } | ||
82 | - } else { | ||
83 | - unset($models[$lang]); | ||
84 | - } | ||
85 | - } | ||
86 | - if($ok) { | ||
87 | - return $this->redirect(['view', 'id' => $id]); | ||
88 | - } | ||
89 | - } | ||
90 | - $model = new OptionValues(); | ||
91 | - if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
92 | - return $this->redirect(['view', 'id' => $model->option_value_id]); | ||
93 | - } else { | ||
94 | - return $this->render('create', [ | ||
95 | - 'model' => $model, | ||
96 | - ]); | ||
97 | - } | ||
98 | - } | ||
99 | - | ||
100 | - /** | ||
101 | - * Updates an existing OptionValues model. | ||
102 | - * If update is successful, the browser will be redirected to the 'view' page. | ||
103 | - * @param integer $id | ||
104 | - * @return mixed | ||
105 | - */ | ||
106 | - public function actionUpdate($id) | ||
107 | - { | ||
108 | - $model = $this->findModel($id); | ||
109 | - | ||
110 | - if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
111 | - return $this->redirect(['view', 'id' => $model->option_value_id]); | ||
112 | - } else { | ||
113 | - return $this->render('update', [ | ||
114 | - 'model' => $model, | ||
115 | - ]); | ||
116 | - } | ||
117 | - } | ||
118 | - | ||
119 | - /** | ||
120 | - * Deletes an existing OptionValues model. | ||
121 | - * If deletion is successful, the browser will be redirected to the 'index' page. | ||
122 | - * @param integer $id | ||
123 | - * @return mixed | ||
124 | - */ | ||
125 | - public function actionDelete($id) | ||
126 | - { | ||
127 | - $this->findModel($id)->delete(); | ||
128 | - | ||
129 | - return $this->redirect(['index']); | ||
130 | - } | ||
131 | - | ||
132 | - /** | ||
133 | - * Finds the OptionValues model based on its primary key value. | ||
134 | - * If the model is not found, a 404 HTTP exception will be thrown. | ||
135 | - * @param integer $id | ||
136 | - * @return OptionValues the loaded model | ||
137 | - * @throws NotFoundHttpException if the model cannot be found | ||
138 | - */ | ||
139 | - protected function findModel($id) | ||
140 | - { | ||
141 | - if (($model = OptionValues::findOne($id)) !== null) { | ||
142 | - return $model; | ||
143 | - } else { | ||
144 | - throw new NotFoundHttpException('The requested page does not exist.'); | ||
145 | - } | ||
146 | - } | ||
147 | -} |
frontend/controllers/OptionsController.php renamed to frontend/controllers/UserInfoController.php
100755 โ 100644
@@ -3,16 +3,16 @@ | @@ -3,16 +3,16 @@ | ||
3 | namespace frontend\controllers; | 3 | namespace frontend\controllers; |
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | -use frontend\models\Options; | ||
7 | -use frontend\models\OptionsSearch; | 6 | +use common\models\UserInfo; |
7 | +use common\models\UserInfoSearch; | ||
8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | - * OptionsController implements the CRUD actions for Options model. | 13 | + * UserInfoController implements the CRUD actions for UserInfo model. |
14 | */ | 14 | */ |
15 | -class OptionsController extends Controller | 15 | +class UserInfoController extends Controller |
16 | { | 16 | { |
17 | public function behaviors() | 17 | public function behaviors() |
18 | { | 18 | { |
@@ -27,12 +27,12 @@ class OptionsController extends Controller | @@ -27,12 +27,12 @@ class OptionsController extends Controller | ||
27 | } | 27 | } |
28 | 28 | ||
29 | /** | 29 | /** |
30 | - * Lists all Options models. | 30 | + * Lists all UserInfo models. |
31 | * @return mixed | 31 | * @return mixed |
32 | */ | 32 | */ |
33 | public function actionIndex() | 33 | public function actionIndex() |
34 | { | 34 | { |
35 | - $searchModel = new OptionsSearch(); | 35 | + $searchModel = new UserInfoSearch(); |
36 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | 36 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
37 | 37 | ||
38 | return $this->render('index', [ | 38 | return $this->render('index', [ |
@@ -42,7 +42,7 @@ class OptionsController extends Controller | @@ -42,7 +42,7 @@ class OptionsController extends Controller | ||
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | - * Displays a single Options model. | 45 | + * Displays a single UserInfo model. |
46 | * @param integer $id | 46 | * @param integer $id |
47 | * @return mixed | 47 | * @return mixed |
48 | */ | 48 | */ |
@@ -54,16 +54,16 @@ class OptionsController extends Controller | @@ -54,16 +54,16 @@ class OptionsController extends Controller | ||
54 | } | 54 | } |
55 | 55 | ||
56 | /** | 56 | /** |
57 | - * Creates a new Options model. | 57 | + * Creates a new UserInfo model. |
58 | * If creation is successful, the browser will be redirected to the 'view' page. | 58 | * If creation is successful, the browser will be redirected to the 'view' page. |
59 | * @return mixed | 59 | * @return mixed |
60 | */ | 60 | */ |
61 | public function actionCreate() | 61 | public function actionCreate() |
62 | { | 62 | { |
63 | - $model = new Options(); | 63 | + $model = new UserInfo(); |
64 | 64 | ||
65 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 65 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
66 | - return $this->redirect(['view', 'id' => $model->option_id]); | 66 | + return $this->redirect(['view', 'id' => $model->user_info_id]); |
67 | } else { | 67 | } else { |
68 | return $this->render('create', [ | 68 | return $this->render('create', [ |
69 | 'model' => $model, | 69 | 'model' => $model, |
@@ -72,7 +72,7 @@ class OptionsController extends Controller | @@ -72,7 +72,7 @@ class OptionsController extends Controller | ||
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | - * Updates an existing Options model. | 75 | + * Updates an existing UserInfo model. |
76 | * If update is successful, the browser will be redirected to the 'view' page. | 76 | * If update is successful, the browser will be redirected to the 'view' page. |
77 | * @param integer $id | 77 | * @param integer $id |
78 | * @return mixed | 78 | * @return mixed |
@@ -82,7 +82,7 @@ class OptionsController extends Controller | @@ -82,7 +82,7 @@ class OptionsController extends Controller | ||
82 | $model = $this->findModel($id); | 82 | $model = $this->findModel($id); |
83 | 83 | ||
84 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 84 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
85 | - return $this->redirect(['view', 'id' => $model->option_id]); | 85 | + return $this->redirect(['view', 'id' => $model->user_info_id]); |
86 | } else { | 86 | } else { |
87 | return $this->render('update', [ | 87 | return $this->render('update', [ |
88 | 'model' => $model, | 88 | 'model' => $model, |
@@ -91,7 +91,7 @@ class OptionsController extends Controller | @@ -91,7 +91,7 @@ class OptionsController extends Controller | ||
91 | } | 91 | } |
92 | 92 | ||
93 | /** | 93 | /** |
94 | - * Deletes an existing Options model. | 94 | + * Deletes an existing UserInfo model. |
95 | * If deletion is successful, the browser will be redirected to the 'index' page. | 95 | * If deletion is successful, the browser will be redirected to the 'index' page. |
96 | * @param integer $id | 96 | * @param integer $id |
97 | * @return mixed | 97 | * @return mixed |
@@ -104,15 +104,15 @@ class OptionsController extends Controller | @@ -104,15 +104,15 @@ class OptionsController extends Controller | ||
104 | } | 104 | } |
105 | 105 | ||
106 | /** | 106 | /** |
107 | - * Finds the Options model based on its primary key value. | 107 | + * Finds the UserInfo model based on its primary key value. |
108 | * If the model is not found, a 404 HTTP exception will be thrown. | 108 | * If the model is not found, a 404 HTTP exception will be thrown. |
109 | * @param integer $id | 109 | * @param integer $id |
110 | - * @return Options the loaded model | 110 | + * @return UserInfo the loaded model |
111 | * @throws NotFoundHttpException if the model cannot be found | 111 | * @throws NotFoundHttpException if the model cannot be found |
112 | */ | 112 | */ |
113 | protected function findModel($id) | 113 | protected function findModel($id) |
114 | { | 114 | { |
115 | - if (($model = Options::findOne($id)) !== null) { | 115 | + if (($model = UserInfo::findOne($id)) !== null) { |
116 | return $model; | 116 | return $model; |
117 | } else { | 117 | } else { |
118 | throw new NotFoundHttpException('The requested page does not exist.'); | 118 | throw new NotFoundHttpException('The requested page does not exist.'); |
frontend/models/Option.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\models; | ||
4 | - | ||
5 | -use Yii; | ||
6 | - | ||
7 | -/** | ||
8 | - * This is the model class for table "option". | ||
9 | - * | ||
10 | - * @property integer $option_id | ||
11 | - * @property string $model | ||
12 | - * @property integer $model_id | ||
13 | - * @property string $name | ||
14 | - * @property string $template | ||
15 | - * @property integer $parent_id | ||
16 | - */ | ||
17 | -class Option extends \yii\db\ActiveRecord | ||
18 | -{ | ||
19 | - /** | ||
20 | - * @inheritdoc | ||
21 | - */ | ||
22 | - public static function tableName() | ||
23 | - { | ||
24 | - return 'option'; | ||
25 | - } | ||
26 | - | ||
27 | - /** | ||
28 | - * @inheritdoc | ||
29 | - */ | ||
30 | - public function rules() | ||
31 | - { | ||
32 | - return [ | ||
33 | - [['model', 'model_id', 'name', 'template'], 'required'], | ||
34 | - [['model_id', 'option_pid'], 'integer'], | ||
35 | - [['model', 'name', 'template'], 'string', 'max' => 200] | ||
36 | - ]; | ||
37 | - } | ||
38 | - | ||
39 | - /** | ||
40 | - * @inheritdoc | ||
41 | - */ | ||
42 | - public function attributeLabels() | ||
43 | - { | ||
44 | - return [ | ||
45 | - 'option_id' => Yii::t('app', 'Option ID'), | ||
46 | - 'model' => Yii::t('app', 'Model'), | ||
47 | - 'model_id' => Yii::t('app', 'Model ID'), | ||
48 | - 'name' => Yii::t('app', 'Name'), | ||
49 | - 'template' => Yii::t('app', 'Template'), | ||
50 | - 'option_pid' => Yii::t('app', 'Parent ID'), | ||
51 | - 'date_add' => Yii::t('app', 'Date created'), | ||
52 | - 'translate' => Yii::t('app', 'Translatable'), | ||
53 | - ]; | ||
54 | - } | ||
55 | - | ||
56 | - public function getLangs() { | ||
57 | - return (new Language())->find()->where(['>', 'language_id', 0])->andWhere(['status' => 1])->asArray()->all(); | ||
58 | - } | ||
59 | - | ||
60 | - public static function change($id, $post, $modeldb, $model_id) { | ||
61 | - $models[$id] = Option::findOne($id); | ||
62 | - $modellang[$id] = array(); | ||
63 | - $langs = OptionLang::findAll(['option_language_id' => $id]); | ||
64 | - foreach($langs as $lang) { | ||
65 | - $modellang[$id][$lang->language_id] = $lang; | ||
66 | - } | ||
67 | - $children = (new Option())->find()->where(['option_pid' => $id])->all(); | ||
68 | - foreach($children as $child) { | ||
69 | - $models[$child->option_id] = $child; | ||
70 | - $modellang[$child->option_id] = array(); | ||
71 | - $langs = OptionLang::findAll(['option_id' =>$child->option_id]); | ||
72 | - foreach($langs as $lang) { | ||
73 | - $modellang[$child->option_id][$lang->language_id] = $lang; | ||
74 | - } | ||
75 | - } | ||
76 | - $ok = 1; | ||
77 | - if(!empty($post)) { | ||
78 | - foreach($post['Option'] as $key => $option) { | ||
79 | - if(in_array($key, array('model', 'model_id'))) { continue; } | ||
80 | - if(empty($option['value'][$models[$key]->name]) && !empty($option['lang'])) { | ||
81 | - foreach($option['lang'] as $language_id => $lang) { | ||
82 | - if(!empty($lang)) { | ||
83 | - $option['value'][$models[$key]->name] = $lang; | ||
84 | - break; | ||
85 | - } | ||
86 | - } | ||
87 | - } | ||
88 | - $modellang[$key][0]->value = $option['value'][$models[$key]->name]; | ||
89 | - if(empty($modellang[$key][0]->value) || !$modellang[$key][0]->save()) { | ||
90 | - $ok = 0; | ||
91 | - $models[$key]->addError('value', 'Value must be set'); | ||
92 | - $modellang[$key][0]->addError('value', 'Value must be set'); | ||
93 | - } | ||
94 | - if(!empty($option['lang'])) { | ||
95 | - foreach($option['lang'] as $language_id => $lang) { | ||
96 | - if(empty($modellang[$key][$language_id])) { | ||
97 | - $modellang[$key][$language_id] = new OptionLang(); | ||
98 | - $modellang[$key][$language_id]->option_id = $models[$key]->option_id; | ||
99 | - $modellang[$key][$language_id]->language_id = $language_id; | ||
100 | - $modellang[$key][$language_id]->value = $lang; | ||
101 | - } else { | ||
102 | - $modellang[$key][$language_id]->value = $lang; | ||
103 | - } | ||
104 | - if(!$modellang[$key][$language_id]->save()) { | ||
105 | - $ok = 0; | ||
106 | - } | ||
107 | - } | ||
108 | - } | ||
109 | - } | ||
110 | - if($ok) { | ||
111 | - return array('id' => $id, 'models' => $models, 'modelslang' => $modelslang, 'success' => true); | ||
112 | - } else { | ||
113 | - return array( | ||
114 | - 'models' => $models, | ||
115 | - 'modellang' => $modellang, | ||
116 | - 'modeldb' => $modeldb, | ||
117 | - 'model_id' => $model_id, | ||
118 | - 'success' => false | ||
119 | - ); | ||
120 | - } | ||
121 | - } | ||
122 | - return array( | ||
123 | - 'models' => $models, | ||
124 | - 'modellang' => $modellang, | ||
125 | - 'modeldb' => $modeldb, | ||
126 | - 'model_id' => $model_id, | ||
127 | - 'success' => false | ||
128 | - ); | ||
129 | - } | ||
130 | - | ||
131 | - public static function create($post, $modeldb, $model_id, $fields, $multiple) { | ||
132 | - $multiple = boolval($multiple); | ||
133 | - $model = new Option(); | ||
134 | - $modellang = new OptionLang(); | ||
135 | - if(!empty($post['Option'])) { | ||
136 | - $ok = 1; | ||
137 | - $parentid = null; | ||
138 | - $models = array(); | ||
139 | - foreach($post['Option'] as $index => $option) { | ||
140 | - if(in_array($index, array('model', 'model_id')) && $index !== 0) { continue; } | ||
141 | - $first = 1; | ||
142 | - foreach($option['value'] as $key => $value) { | ||
143 | - $models[$index][$key] = new Option(); | ||
144 | - $models[$index][$key]->model = $post['Option']['model']; | ||
145 | - $models[$index][$key]->model_id = $post['Option']['model_id']; | ||
146 | - $models[$index][$key]->template = $option[$key]['template']; | ||
147 | - $models[$index][$key]->translate = $option[$key]['translate']?1:0; | ||
148 | - $models[$index][$key]->name = $key; | ||
149 | - if(!$first) { | ||
150 | - $models[$index][$key]->option_pid = $parentid; | ||
151 | - } | ||
152 | - $modelslang[$index][$key][0] = new OptionLang(); | ||
153 | - if(!empty($option['lang'][$key])) { | ||
154 | - foreach($option['lang'][$key] as $code => $lang) { | ||
155 | - if(!empty($lang)) { | ||
156 | - $value = $lang; | ||
157 | - break; | ||
158 | - } | ||
159 | - } | ||
160 | - } | ||
161 | - if(!empty($value) && $models[$index][$key]->save()) { | ||
162 | - if($first) { | ||
163 | - $parentid = $models[$index][$key]->option_id; | ||
164 | - } | ||
165 | - $modelslang[$index][$key][0]->option_id = $models[$index][$key]->option_id; | ||
166 | - $modelslang[$index][$key][0]->language_id = 0; | ||
167 | - $modelslang[$index][$key][0]->value = $value; | ||
168 | - if($modelslang[$index][$key][0]->save()) { | ||
169 | - if(!empty($option['lang'][$key])) { | ||
170 | - foreach($option['lang'][$key] as $code => $lang) { | ||
171 | - if(!empty($lang)) { | ||
172 | - $modelslang[$index][$key][$code] = new OptionLang(); | ||
173 | - $modelslang[$index][$key][$code]->option_id = $models[$index][$key]->option_id; | ||
174 | - $modelslang[$index][$key][$code]->language_id = $code; | ||
175 | - $modelslang[$index][$key][$code]->value = $lang; | ||
176 | - if(!$modelslang[$index][$key][$code]->save()) { | ||
177 | - $ok = 0; | ||
178 | - } | ||
179 | - } | ||
180 | - } | ||
181 | - } | ||
182 | - } | ||
183 | - } else { | ||
184 | - $models[$index][$key]->validate(); | ||
185 | - $modelslang[$index][$key][0]->validate(); | ||
186 | - $modelslang[$index][$key][0]->addError('value', 'Value must be set'); | ||
187 | - if(!empty($option['lang'][$key])) { | ||
188 | - foreach($option['lang'][$key] as $code => $lang) { | ||
189 | - if(!empty($lang)) { | ||
190 | - $modelslang[$index][$key][$code] = new OptionLang(); | ||
191 | - $modelslang[$index][$key][$code]->option_id = $models[$index][$key]->option_id; | ||
192 | - $modelslang[$index][$key][$code]->language_id = $code; | ||
193 | - $modelslang[$index][$key][$code]->value = $lang; | ||
194 | - } | ||
195 | - } | ||
196 | - } | ||
197 | - $ok = 0; | ||
198 | - } | ||
199 | - $first = 0; | ||
200 | - } | ||
201 | - } | ||
202 | - if($ok) { | ||
203 | - if($modeldb == 'Feedback') { | ||
204 | - $newflag = new Option(); | ||
205 | - $newflag->model = $modeldb; | ||
206 | - $newflag->model_id = $model_id; | ||
207 | - $newflag->name = 'is_new'; | ||
208 | - $newflag->template = 'checkbox'; | ||
209 | - $newflag->option_pid = $parentid; | ||
210 | - $newflag->translate = 0; | ||
211 | - if($newflag->save()) { | ||
212 | - $newflaglang = new OptionLang(); | ||
213 | - $newflaglang->option_id = $newflag->option_id; | ||
214 | - $newflaglang->language_id = 0; | ||
215 | - $newflaglang->value = '1'; | ||
216 | - if(!$newflaglang->save()) { | ||
217 | - $newflag->delete(); | ||
218 | - } | ||
219 | - } | ||
220 | - } | ||
221 | - return array('models' => $models, 'modelslang' => $modelslang, 'success' => true); | ||
222 | - } else { | ||
223 | - return array( | ||
224 | - 'models' => $models, | ||
225 | - 'modellang' => $modelslang, | ||
226 | - 'modeldb' => $modeldb, | ||
227 | - 'model_id' => $model_id, | ||
228 | - 'fields' => $fields, | ||
229 | - 'success' => false, | ||
230 | - 'multiple' => $multiple | ||
231 | - ); | ||
232 | - } | ||
233 | - } else { | ||
234 | - return array( | ||
235 | - 'model' => $model, | ||
236 | - 'modeldb' => $modeldb, | ||
237 | - 'model_id' => $model_id, | ||
238 | - 'fields' => $fields, | ||
239 | - 'success' => false, | ||
240 | - 'multiple' => $multiple | ||
241 | - ); | ||
242 | - } | ||
243 | - } | ||
244 | - | ||
245 | - public function getOptions() { | ||
246 | - return $this->hasMany(Option::className(), ['option_pid' => 'option_id'])->indexBy('name'); | ||
247 | - } | ||
248 | - | ||
249 | - public function getOption() { | ||
250 | - return $this->hasOne(Option::className(), ['option_id' => 'option_pid']); | ||
251 | - } | ||
252 | - | ||
253 | - public function getOptionLangs() { | ||
254 | - return $this->hasMany(OptionLang::className(), ['option_id' => 'option_id']); | ||
255 | - } | ||
256 | - | ||
257 | - public function getOptionDefaultLang($array = false) { | ||
258 | - $query = $this->getOptionLangs()->where(['language_id' => 0]); | ||
259 | - if($array) { | ||
260 | - $query->asArray(); | ||
261 | - } | ||
262 | - return $query->one(); | ||
263 | - } | ||
264 | - | ||
265 | - public static function markOld($id) { | ||
266 | - $model = Option::findOne($id); | ||
267 | - $is_new = $model->getOptions()->where(['name' => 'is_new'])->one(); | ||
268 | - if(empty($is_new)) return false; | ||
269 | - $is_newlang = $is_new->getOptionDefaultLang(); | ||
270 | - $is_newlang->value = '0'; | ||
271 | - if($is_newlang->save()) { | ||
272 | - return true; | ||
273 | - } else { | ||
274 | - return false; | ||
275 | - } | ||
276 | - } | ||
277 | - | ||
278 | -} |
frontend/models/OptionLang.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\models; | ||
4 | - | ||
5 | -use Yii; | ||
6 | - | ||
7 | -/** | ||
8 | - * This is the model class for table "option_lang". | ||
9 | - * | ||
10 | - * @property integer $id | ||
11 | - * @property integer $language_id | ||
12 | - * @property string $value | ||
13 | - */ | ||
14 | -class OptionLang extends \yii\db\ActiveRecord | ||
15 | -{ | ||
16 | - /** | ||
17 | - * @inheritdoc | ||
18 | - */ | ||
19 | - public static function tableName() | ||
20 | - { | ||
21 | - return 'option_lang'; | ||
22 | - } | ||
23 | - | ||
24 | - /** | ||
25 | - * @inheritdoc | ||
26 | - */ | ||
27 | - public function rules() | ||
28 | - { | ||
29 | - return [ | ||
30 | - [['option_id', 'language_id'], 'required'], | ||
31 | - [['option_id', 'language_id'], 'integer'], | ||
32 | - [['value'], 'string'] | ||
33 | - ]; | ||
34 | - } | ||
35 | - | ||
36 | - /** | ||
37 | - * @inheritdoc | ||
38 | - */ | ||
39 | - public function attributeLabels() | ||
40 | - { | ||
41 | - return [ | ||
42 | - 'option_id' => Yii::t('app', 'ID'), | ||
43 | - 'language_id' => Yii::t('app', 'Lang ID'), | ||
44 | - 'value' => Yii::t('app', 'Value'), | ||
45 | - ]; | ||
46 | - } | ||
47 | -} |
frontend/models/OptionSearch.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\models; | ||
4 | - | ||
5 | -use Yii; | ||
6 | -use yii\base\Model; | ||
7 | -use yii\data\ActiveDataProvider; | ||
8 | -use frontend\models\Option; | ||
9 | - | ||
10 | -/** | ||
11 | - * OptionSearch represents the model behind the search form about `frontend\models\Option`. | ||
12 | - */ | ||
13 | -class OptionSearch extends Option | ||
14 | -{ | ||
15 | - /** | ||
16 | - * @inheritdoc | ||
17 | - */ | ||
18 | - public function rules() | ||
19 | - { | ||
20 | - return [ | ||
21 | - [['option_id', 'model_id', 'option_pid'], 'integer'], | ||
22 | - [['model', 'name', 'template'], 'safe'], | ||
23 | - ]; | ||
24 | - } | ||
25 | - | ||
26 | - /** | ||
27 | - * @inheritdoc | ||
28 | - */ | ||
29 | - public function scenarios() | ||
30 | - { | ||
31 | - // bypass scenarios() implementation in the parent class | ||
32 | - return Model::scenarios(); | ||
33 | - } | ||
34 | - | ||
35 | - /** | ||
36 | - * Creates data provider instance with search query applied | ||
37 | - * | ||
38 | - * @param array $params | ||
39 | - * | ||
40 | - * @return ActiveDataProvider | ||
41 | - */ | ||
42 | - public function search($params) | ||
43 | - { | ||
44 | - $query = Option::find(); | ||
45 | - | ||
46 | - $dataProvider = new ActiveDataProvider([ | ||
47 | - 'query' => $query, | ||
48 | - ]); | ||
49 | - $data = [ | ||
50 | - 'OptionSearch' => [ | ||
51 | - 'model' => 'Main' | ||
52 | - ] | ||
53 | - ]; | ||
54 | - | ||
55 | - $this->load($params); | ||
56 | - | ||
57 | - if (!$this->validate()) { | ||
58 | - // uncomment the following line if you do not want to return any records when validation fails | ||
59 | - // $query->where('0=1'); | ||
60 | - return $dataProvider; | ||
61 | - } | ||
62 | - | ||
63 | - $query->andWhere(['option_pid' => null]); | ||
64 | - | ||
65 | - $query->andFilterWhere([ | ||
66 | - 'option_id' => $this->option_id, | ||
67 | - 'model_id' => $this->model_id, | ||
68 | - 'option_pid' => $this->option_pid, | ||
69 | - ]); | ||
70 | - | ||
71 | - $query->andFilterWhere(['like', 'model', $this->model]) | ||
72 | - ->andFilterWhere(['like', 'name', $this->name]) | ||
73 | - ->andFilterWhere(['like', 'template', $this->template]); | ||
74 | - | ||
75 | - | ||
76 | - return $dataProvider; | ||
77 | - } | ||
78 | -} |
frontend/models/OptionValues.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\models; | ||
4 | - | ||
5 | -use Yii; | ||
6 | - | ||
7 | -/** | ||
8 | - * This is the model class for table "option_values". | ||
9 | - * | ||
10 | - * @property integer $option_value_id | ||
11 | - * @property string $option_key | ||
12 | - * @property string $option_value_text | ||
13 | - * @property integer $option_language_id | ||
14 | - * @property integer $option_value_parent | ||
15 | - * @property integer $option_user | ||
16 | - * | ||
17 | - * @property Language $optionLang | ||
18 | - */ | ||
19 | -class OptionValues extends \yii\db\ActiveRecord | ||
20 | -{ | ||
21 | - /** | ||
22 | - * @inheritdoc | ||
23 | - */ | ||
24 | - public static function tableName() | ||
25 | - { | ||
26 | - return 'option_values'; | ||
27 | - } | ||
28 | - | ||
29 | - /** | ||
30 | - * @inheritdoc | ||
31 | - */ | ||
32 | - public function rules() | ||
33 | - { | ||
34 | - return [ | ||
35 | - [['option_key', 'option_value_text'], 'required'], | ||
36 | - [['option_language_id', 'option_value_parent', 'option_user'], 'integer'], | ||
37 | - [['option_key'], 'string', 'max' => 200] | ||
38 | - ]; | ||
39 | - } | ||
40 | - | ||
41 | - /** | ||
42 | - * @inheritdoc | ||
43 | - */ | ||
44 | - public function attributeLabels() | ||
45 | - { | ||
46 | - return [ | ||
47 | - 'option_value_id' => Yii::t('app', 'Option Value ID'), | ||
48 | - 'option_key' => Yii::t('app', 'Option Key'), | ||
49 | - 'option_value_text' => Yii::t('app', 'Option Value Text'), | ||
50 | - 'option_language_id' => Yii::t('app', 'Option Lang ID'), | ||
51 | - 'option_value_parent' => Yii::t('app', 'Option Value Parent'), | ||
52 | - 'option_user' => Yii::t('app', 'Option User'), | ||
53 | - ]; | ||
54 | - } | ||
55 | - | ||
56 | - /** | ||
57 | - * @return \yii\db\ActiveQuery | ||
58 | - */ | ||
59 | - public function getOptionLang() | ||
60 | - { | ||
61 | - return $this->hasOne(Language::className(), ['language_id' => 'option_language_id']); | ||
62 | - } | ||
63 | - public function getLanguages() { | ||
64 | - return (new LanguageLang())->find()->orderBy('language_id ASC')->asArray()->all(); | ||
65 | - } | ||
66 | - public function getLanguagesCodes() { | ||
67 | - return (new Language())->find()->orderBy('language_id ASC')->asArray()->all(); | ||
68 | - } | ||
69 | - public function getDropDownArray() { | ||
70 | - $langs = array(); | ||
71 | - foreach($this->getLanguages() as $lang) { | ||
72 | - $langs[$lang['language_id']] = $lang['lang_title']; | ||
73 | - } | ||
74 | - return $langs; | ||
75 | - } | ||
76 | - public function beforeSave($insert) { | ||
77 | - if (parent::beforeSave($insert)) { | ||
78 | - $this->option_user = \Yii::$app->user->getId(); | ||
79 | - if($this->option_value_parent == 0) { | ||
80 | - unset($this->option_value_parent); | ||
81 | - } | ||
82 | - return true; | ||
83 | - } else { | ||
84 | - return false; | ||
85 | - } | ||
86 | - } | ||
87 | - public function getUserOptions() { | ||
88 | - return (new OptionValues())->find()->where('option_user=:user')->addParams([':user' => \Yii::$app->user->getID()])->andWhere(['not', ['option_user' => null]])->asArray()->all(); | ||
89 | - } | ||
90 | - public function getUserOptionsArray() { | ||
91 | - $options = array('0' => Yii::t('app', 'Default Parent')); | ||
92 | - foreach($this->getUserOptions() as $option) { | ||
93 | - $options[$option['option_value_id']] = $option['option_key'].' - '.$option['option_value_text']; | ||
94 | - } | ||
95 | - return $options; | ||
96 | - } | ||
97 | -} |
frontend/models/OptionValuesSearch.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\models; | ||
4 | - | ||
5 | -use Yii; | ||
6 | -use yii\base\Model; | ||
7 | -use yii\data\ActiveDataProvider; | ||
8 | -use frontend\models\OptionValues; | ||
9 | - | ||
10 | -/** | ||
11 | - * OptionValuesSearch represents the model behind the search form about `frontend\models\OptionValues`. | ||
12 | - */ | ||
13 | -class OptionValuesSearch extends OptionValues | ||
14 | -{ | ||
15 | - /** | ||
16 | - * @inheritdoc | ||
17 | - */ | ||
18 | - public function rules() | ||
19 | - { | ||
20 | - return [ | ||
21 | - [['option_value_id', 'option_language_id', 'option_value_parent', 'option_user'], 'integer'], | ||
22 | - [['option_key', 'option_value_text'], 'safe'], | ||
23 | - ]; | ||
24 | - } | ||
25 | - | ||
26 | - /** | ||
27 | - * @inheritdoc | ||
28 | - */ | ||
29 | - public function scenarios() | ||
30 | - { | ||
31 | - // bypass scenarios() implementation in the parent class | ||
32 | - return Model::scenarios(); | ||
33 | - } | ||
34 | - | ||
35 | - /** | ||
36 | - * Creates data provider instance with search query applied | ||
37 | - * | ||
38 | - * @param array $params | ||
39 | - * | ||
40 | - * @return ActiveDataProvider | ||
41 | - */ | ||
42 | - public function search($params) | ||
43 | - { | ||
44 | - $query = OptionValues::find(); | ||
45 | - | ||
46 | - $dataProvider = new ActiveDataProvider([ | ||
47 | - 'query' => $query, | ||
48 | - ]); | ||
49 | - | ||
50 | - $this->load($params); | ||
51 | - | ||
52 | - if (!$this->validate()) { | ||
53 | - // uncomment the following line if you do not want to return any records when validation fails | ||
54 | - // $query->where('0=1'); | ||
55 | - return $dataProvider; | ||
56 | - } | ||
57 | - | ||
58 | - $query->andFilterWhere([ | ||
59 | - 'option_value_id' => $this->option_value_id, | ||
60 | - 'option_language_id' => $this->option_language_id, | ||
61 | - 'option_value_parent' => $this->option_value_parent, | ||
62 | - 'option_user' => $this->option_user, | ||
63 | - ]); | ||
64 | - | ||
65 | - $query->andFilterWhere(['like', 'option_key', $this->option_key]) | ||
66 | - ->andFilterWhere(['like', 'option_value_text', $this->option_value_text]); | ||
67 | - | ||
68 | - return $dataProvider; | ||
69 | - } | ||
70 | -} |
frontend/models/Options.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\models; | ||
4 | - | ||
5 | -use Yii; | ||
6 | - | ||
7 | -/** | ||
8 | - * This is the model class for table "option". | ||
9 | - * | ||
10 | - * @property integer $option_id | ||
11 | - * @property string $option_key | ||
12 | - * @property integer $option_parent | ||
13 | - * @property integer $option_translatable | ||
14 | - * @property string $option_format | ||
15 | - * | ||
16 | - * @property OptionValues[] $optionValues | ||
17 | - * @property Options $optionParent | ||
18 | - * @property Options[] $options | ||
19 | - */ | ||
20 | -class Options extends \yii\db\ActiveRecord | ||
21 | -{ | ||
22 | - /** | ||
23 | - * @inheritdoc | ||
24 | - */ | ||
25 | - public static function tableName () | ||
26 | - { | ||
27 | - return 'option'; | ||
28 | - } | ||
29 | - | ||
30 | - /** | ||
31 | - * @inheritdoc | ||
32 | - */ | ||
33 | - public function rules () | ||
34 | - { | ||
35 | - return [ | ||
36 | - [['option_key'], 'required'], [['option_parent', 'option_translatable'], 'integer'], [['option_key', 'option_format'], 'string', 'max' => 200] | ||
37 | - ]; | ||
38 | - } | ||
39 | - | ||
40 | - /** | ||
41 | - * @inheritdoc | ||
42 | - */ | ||
43 | - public function attributeLabels () | ||
44 | - { | ||
45 | - return [ | ||
46 | - 'option_id' => Yii::t ('app', 'Option ID'), 'option_key' => Yii::t ('app', 'Option Key'), 'option_parent' => Yii::t ('app', 'Option Parent'), 'option_translatable' => Yii::t ('app', 'Option Translatable'), 'option_format' => Yii::t ('app', 'Option Format'), | ||
47 | - ]; | ||
48 | - } | ||
49 | - | ||
50 | - /** | ||
51 | - * @return \yii\db\ActiveQuery | ||
52 | - */ | ||
53 | - public function getOptionLang () | ||
54 | - { | ||
55 | - return $this->hasMany (OptionLang::className (), ['option_id' => 'option_id']); | ||
56 | - } | ||
57 | - | ||
58 | - public function getValue () | ||
59 | - { | ||
60 | - return $this->hasOne(OptionLang::className(), ['option_id' => 'option_id'])->where(['option_lang.language_id' => '0']); | ||
61 | - } | ||
62 | - | ||
63 | - /** | ||
64 | - * @return \yii\db\ActiveQuery | ||
65 | - */ | ||
66 | - public function getOptionParent() | ||
67 | - { | ||
68 | - return $this->hasOne(Options::className(), ['option_id' => 'option_parent']); | ||
69 | - } | ||
70 | - | ||
71 | - /** | ||
72 | - * @return \yii\db\ActiveQuery | ||
73 | - */ | ||
74 | - public function getOptions() | ||
75 | - { | ||
76 | - return $this->hasMany(Options::className(), ['option_parent' => 'option_id']); | ||
77 | - } | ||
78 | -} |
frontend/models/OptionsSearch.php deleted
1 | -<?php | ||
2 | - | ||
3 | -namespace frontend\models; | ||
4 | - | ||
5 | -use Yii; | ||
6 | -use yii\base\Model; | ||
7 | -use yii\data\ActiveDataProvider; | ||
8 | -use frontend\models\Options; | ||
9 | - | ||
10 | -/** | ||
11 | - * OptionsSearch represents the model behind the search form about `frontend\models\Options`. | ||
12 | - */ | ||
13 | -class OptionsSearch extends Options | ||
14 | -{ | ||
15 | - /** | ||
16 | - * @inheritdoc | ||
17 | - */ | ||
18 | - public function rules() | ||
19 | - { | ||
20 | - return [ | ||
21 | - [['option_id', 'option_parent', 'option_translatable'], 'integer'], | ||
22 | - [['option_key', 'option_format'], 'safe'], | ||
23 | - ]; | ||
24 | - } | ||
25 | - | ||
26 | - /** | ||
27 | - * @inheritdoc | ||
28 | - */ | ||
29 | - public function scenarios() | ||
30 | - { | ||
31 | - // bypass scenarios() implementation in the parent class | ||
32 | - return Model::scenarios(); | ||
33 | - } | ||
34 | - | ||
35 | - /** | ||
36 | - * Creates data provider instance with search query applied | ||
37 | - * | ||
38 | - * @param array $params | ||
39 | - * | ||
40 | - * @return ActiveDataProvider | ||
41 | - */ | ||
42 | - public function search($params) | ||
43 | - { | ||
44 | - $query = Options::find(); | ||
45 | - | ||
46 | - $dataProvider = new ActiveDataProvider([ | ||
47 | - 'query' => $query, | ||
48 | - ]); | ||
49 | - | ||
50 | - $this->load($params); | ||
51 | - | ||
52 | - if (!$this->validate()) { | ||
53 | - // uncomment the following line if you do not want to return any records when validation fails | ||
54 | - // $query->where('0=1'); | ||
55 | - return $dataProvider; | ||
56 | - } | ||
57 | - | ||
58 | - $query->andFilterWhere([ | ||
59 | - 'option_id' => $this->option_id, | ||
60 | - 'option_parent' => $this->option_parent, | ||
61 | - 'option_translatable' => $this->option_translatable, | ||
62 | - ]); | ||
63 | - | ||
64 | - $query->andFilterWhere(['like', 'option_key', $this->option_key]) | ||
65 | - ->andFilterWhere(['like', 'option_format', $this->option_format]); | ||
66 | - | ||
67 | - return $dataProvider; | ||
68 | - } | ||
69 | -} |
frontend/views/option-values/_form.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | -use yii\widgets\ActiveForm; | ||
5 | - | ||
6 | -/* @var $this yii\web\View */ | ||
7 | -/* @var $model frontend\models\OptionValues */ | ||
8 | -/* @var $form yii\widgets\ActiveForm */ | ||
9 | -?> | ||
10 | - | ||
11 | -<div class="option-values-form"> | ||
12 | - | ||
13 | - <?php $form = ActiveForm::begin(); ?> | ||
14 | - | ||
15 | - <?= $form->field($model, 'option_key')->textInput(['maxlength' => true]) ?> | ||
16 | - | ||
17 | - <div class="optionvalues-option_value_text-active"> | ||
18 | - <?= $form->field($model, 'option_value_text', ['enableClientValidation' => false])->label($model->getAttributeLabel('option_key').' | <span class="glyphicon glyphicon-globe add-langs"></span>')->textInput() ?> | ||
19 | - | ||
20 | - <?= $form->field($model, 'option_language_id')->dropDownList($model->getDropDownArray()) ?> | ||
21 | - </div> | ||
22 | - | ||
23 | - <?= $form->field($model, 'option_value_parent')->dropDownList($model->getUserOptionsArray()) ?> | ||
24 | - | ||
25 | - <div class="form-group"> | ||
26 | - <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
27 | - </div> | ||
28 | - | ||
29 | - <?php ActiveForm::end(); ?> | ||
30 | - | ||
31 | -</div> | ||
32 | -<div class="reserved_inputs"> | ||
33 | - <div class="lang-inputs form-group optionvalues-option_value_text-lang"> | ||
34 | - <label for="OptionValues[option_value_text][0]" class="col-xs-12 optionvalues-option_value_text" data-group="optionvalues-option_value_text"><?php echo $model->getAttributeLabel('option_key'); ?> | <span class="glyphicon glyphicon-globe remove-langs"></span></label> | ||
35 | - <?php foreach($model->getLanguagesCodes() as $lang) { | ||
36 | - ?> | ||
37 | - <div class="col-xs-1 text-right"><span><?=$lang['lang_code']?></span></div> | ||
38 | - <div class="col-xs-11"><input type="text" id="optionvalues-<?=$lang['lang_code']?>-option_value_text" class="form-control" name="OptionValues[option_value_text][<?=$lang['language_id']?>]" /></div> | ||
39 | - <?php | ||
40 | - }?> | ||
41 | - <div class="clearfix"></div> | ||
42 | - </div> | ||
43 | -</div> | ||
44 | -<script> | ||
45 | - $(function() { | ||
46 | - $(document).on('click', '.add-langs', function() { | ||
47 | - var group = $(this).parent().attr('for'); | ||
48 | - $(this).parent().parent().appendTo('.reserved_inputs'); | ||
49 | - $('.field-optionvalues-option_language_id').appendTo('.reserved_inputs'); | ||
50 | - $('.'+group+'-lang').appendTo('.'+group+'-active'); | ||
51 | - }); | ||
52 | - $(document).on('click', '.remove-langs', function() { | ||
53 | - var group = $(this).parent().data('group'); | ||
54 | - $(this).parent().parent().appendTo('.reserved_inputs'); | ||
55 | - console.log('field-'+group); | ||
56 | - $('.reserved_inputs .field-'+group).appendTo('.'+group+'-active'); | ||
57 | - $('.field-optionvalues-option_language_id').appendTo('.'+group+'-active'); | ||
58 | - }); | ||
59 | - }); | ||
60 | -</script> | ||
61 | \ No newline at end of file | 0 | \ No newline at end of file |
frontend/views/option-values/_search.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | -use yii\widgets\ActiveForm; | ||
5 | - | ||
6 | -/* @var $this yii\web\View */ | ||
7 | -/* @var $model frontend\models\OptionValuesSearch */ | ||
8 | -/* @var $form yii\widgets\ActiveForm */ | ||
9 | -?> | ||
10 | - | ||
11 | -<div class="option-values-search"> | ||
12 | - | ||
13 | - <?php $form = ActiveForm::begin([ | ||
14 | - 'action' => ['index'], | ||
15 | - 'method' => 'get', | ||
16 | - ]); ?> | ||
17 | - | ||
18 | - <?= $form->field($model, 'option_value_id') ?> | ||
19 | - | ||
20 | - <?= $form->field($model, 'option_key') ?> | ||
21 | - | ||
22 | - <?= $form->field($model, 'option_value_text') ?> | ||
23 | - | ||
24 | - <?= $form->field($model, 'option_language_id') ?> | ||
25 | - | ||
26 | - <?= $form->field($model, 'option_value_parent') ?> | ||
27 | - | ||
28 | - <?php // echo $form->field($model, 'option_user') ?> | ||
29 | - | ||
30 | - <div class="form-group"> | ||
31 | - <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
32 | - <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
33 | - </div> | ||
34 | - | ||
35 | - <?php ActiveForm::end(); ?> | ||
36 | - | ||
37 | -</div> |
frontend/views/option-values/view.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | -use yii\widgets\DetailView; | ||
5 | - | ||
6 | -/* @var $this yii\web\View */ | ||
7 | -/* @var $model frontend\models\OptionValues */ | ||
8 | - | ||
9 | -$this->title = $model->option_value_id; | ||
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Option Values'), 'url' => ['index']]; | ||
11 | -$this->params['breadcrumbs'][] = $this->title; | ||
12 | -?> | ||
13 | -<div class="option-values-view"> | ||
14 | - | ||
15 | - <h1><?= Html::encode($this->title) ?></h1> | ||
16 | - | ||
17 | - <p> | ||
18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->option_value_id], ['class' => 'btn btn-primary']) ?> | ||
19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->option_value_id], [ | ||
20 | - 'class' => 'btn btn-danger', | ||
21 | - 'data' => [ | ||
22 | - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | ||
23 | - 'method' => 'post', | ||
24 | - ], | ||
25 | - ]) ?> | ||
26 | - </p> | ||
27 | - | ||
28 | - <?= DetailView::widget([ | ||
29 | - 'model' => $model, | ||
30 | - 'attributes' => [ | ||
31 | - 'option_value_id', | ||
32 | - 'option_key', | ||
33 | - 'option_value_text:ntext', | ||
34 | - 'option_language_id', | ||
35 | - 'option_value_parent', | ||
36 | - 'option_user', | ||
37 | - ], | ||
38 | - ]) ?> | ||
39 | - | ||
40 | -</div> |
frontend/views/option/_form.php
@@ -4,125 +4,30 @@ use yii\helpers\Html; | @@ -4,125 +4,30 @@ use yii\helpers\Html; | ||
4 | use yii\widgets\ActiveForm; | 4 | use yii\widgets\ActiveForm; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $model frontend\models\Option */ | 7 | +/* @var $model common\models\Option */ |
8 | /* @var $form yii\widgets\ActiveForm */ | 8 | /* @var $form yii\widgets\ActiveForm */ |
9 | ?> | 9 | ?> |
10 | 10 | ||
11 | <div class="option-form"> | 11 | <div class="option-form"> |
12 | + | ||
12 | <?php $form = ActiveForm::begin(); ?> | 13 | <?php $form = ActiveForm::begin(); ?> |
13 | - <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | ||
14 | - <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | ||
15 | - <?php if($multiple) { ?><p class="text-right"><span class="glyphicon glyphicon-plus add_row"></span></p><?php }?> | ||
16 | - <?php if(empty($models)) { | ||
17 | - ?> | ||
18 | - <div class="form-group" id="main_row"> | ||
19 | - <?php foreach($fields as $index => $field) { | ||
20 | - ?> | ||
21 | - <div class="fields_block"> | ||
22 | - <label for="Option[0][<?=$field['name']?>]"><?php echo Yii::t('app', $field['name']); ?></label> | ||
23 | - <?php | ||
24 | - if($field['translate']) { ?><p class="text-right"><span class="glyphicon glyphicon-globe add_lang"></span></p><?php } | ||
25 | - ?> | ||
26 | - <input type="hidden" name="Option[0][<?=$field['name']?>][template]" value="<?=$field['template']?>"/> | ||
27 | - <input type="hidden" name="Option[0][<?=$field['name']?>][translate]" value="<?=$field['translate']?>"/> | ||
28 | - <input type="<?=$field['template']?>" name="Option[0][value][<?=$field['name']?>]" class="form-control required main_input" required/> | ||
29 | - <?php | ||
30 | - if($field['translate']) { | ||
31 | - ?> | ||
32 | - <div class="lang_inputs" style="display: none"> | ||
33 | - <?php | ||
34 | - foreach($model->getLangs() as $lang) { | ||
35 | - ?> | ||
36 | - <div class="form-group"> | ||
37 | - <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
38 | - <div class="col-xs-11"><input type="<?=$field['template']?>" name="Option[0][lang][<?=$field['name']?>][<?=$lang['language_id']?>]" class="form-control" /></div> | ||
39 | - <div class="clearfix"></div> | ||
40 | - </div> | ||
41 | - <?php | ||
42 | - } | ||
43 | - ?> | ||
44 | - </div> | ||
45 | - <?php | ||
46 | - } | ||
47 | - ?> | ||
48 | - </div> | ||
49 | - <?php | ||
50 | - }?> | ||
51 | - </div> | ||
52 | - <?php | ||
53 | - } else { | ||
54 | - $first = 1; | ||
55 | - foreach($models as $index => $row) { | ||
56 | - foreach($row as $key => $value) { | ||
57 | - if(!$modellang[$index][$key][0]->hasErrors('value')) { | ||
58 | - continue; | ||
59 | - } | ||
60 | - if($first) { | ||
61 | - ?> | ||
62 | - <div class="form-group" id="main_row"> | ||
63 | - <?php | ||
64 | - } | ||
65 | - ?> | ||
66 | - <div class="fields_block"> | ||
67 | - <label for="Option[0][<?=$key?>]"><?php echo Yii::t('app', $key); ?></label> | ||
68 | - <input type="hidden" name="Option[0][template]" value="<?=$value->template?>"/> | ||
69 | - <input type="<?=$value->template?>" name="Option[0][value][<?=$key?>]" class="form-control required main_input" required value="<?=$modellang[$index][$key][0]->value?>"/> | ||
70 | - <div class="help-block"><?=$modellang[$index][$key][0]->getFirstError('value')?></div> | ||
71 | - <?php | ||
72 | - if($field['translate']) { | ||
73 | - ?> | ||
74 | - <div class="lang_inputs"> | ||
75 | - <?php | ||
76 | - foreach($value->getLangs() as $lang) { | ||
77 | - ?> | ||
78 | - <div class="form-group"> | ||
79 | - <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
80 | - <div class="col-xs-11"><input type="<?=$value->template?>" name="Option[0][lang][<?=$key?>][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$index][$key][$lang['language_id']]->value?>"/></div> | ||
81 | - </div> | ||
82 | - <?php | ||
83 | - } | ||
84 | - ?> | ||
85 | - </div> | ||
86 | - <?php | ||
87 | - } ?> | ||
88 | - </div> | ||
89 | - <?php | ||
90 | - if($first) { | ||
91 | - ?> | ||
92 | - </div> | ||
93 | - <?php | ||
94 | - $first = 0; | ||
95 | - } | ||
96 | - } | ||
97 | - } | ||
98 | - }?> | ||
99 | - | 14 | + |
15 | + <?= $form->field($model, 'model')->textInput(['maxlength' => true]) ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'model_id')->textInput() ?> | ||
18 | + | ||
19 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | ||
20 | + | ||
21 | + <?= $form->field($model, 'template')->textInput(['maxlength' => true]) ?> | ||
22 | + | ||
23 | + <?= $form->field($model, 'option_pid')->textInput() ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'date_add')->textInput() ?> | ||
26 | + | ||
100 | <div class="form-group"> | 27 | <div class="form-group"> |
101 | <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | 28 | <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
102 | </div> | 29 | </div> |
103 | 30 | ||
104 | <?php ActiveForm::end(); ?> | 31 | <?php ActiveForm::end(); ?> |
105 | - <script> | ||
106 | - $(function() { | ||
107 | - var counter = 0; | ||
108 | - $(document).on('click', '.add_row', function() { | ||
109 | - counter++; | ||
110 | - var clone = $('#main_row').clone().html().replace(new RegExp("Option\\[0\\]", 'g'), "Option["+counter+"]"); | ||
111 | - $(clone).appendTo('#<?=$form->getId()?>'); | ||
112 | - $('#<?=$form->getId()?> button[type=submit]').parent().appendTo('#<?=$form->getId()?>'); | ||
113 | - }); | ||
114 | - $(document).on('click', '.add_lang', function() { | ||
115 | - var field_block = $(this).parent().parent(); | ||
116 | - if($(this).hasClass('active')) { | ||
117 | - $(field_block).find('.main_input').attr('required', '').show(); | ||
118 | - $(field_block).find('.lang_inputs').hide(); | ||
119 | - $(this).removeClass('active'); | ||
120 | - } else { | ||
121 | - $(field_block).find('.main_input').removeAttr('required').hide(); | ||
122 | - $(field_block).find('.lang_inputs').show(); | ||
123 | - $(this).addClass('active'); | ||
124 | - } | ||
125 | - }); | ||
126 | - }); | ||
127 | - </script> | 32 | + |
128 | </div> | 33 | </div> |
frontend/views/option/_form_edit.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | -use yii\widgets\ActiveForm; | ||
5 | - | ||
6 | -/* @var $this yii\web\View */ | ||
7 | -/* @var $model frontend\models\Option */ | ||
8 | -/* @var $form yii\widgets\ActiveForm */ | ||
9 | -?> | ||
10 | - | ||
11 | -<div class="option-form"> | ||
12 | - <?php $form = ActiveForm::begin(); ?> | ||
13 | - <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | ||
14 | - <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | ||
15 | - <?php foreach($models as $id => $row) { | ||
16 | - ?> | ||
17 | - <label for="Option[<?=$id?>][<?=$key?>]"><?php echo Yii::t('app', $key); ?></label> | ||
18 | - <input type="hidden" name="Option[<?=$id?>][id]" value="<?=$id?>" /> | ||
19 | - <input type="hidden" name="Option[<?=$id?>][template]" value="<?=$row->template?>"/> | ||
20 | - <input type="<?=$row->template?>" name="Option[<?=$id?>][value][<?=$row->name?>]" class="form-control required" required value="<?=$modellang[$id][0]->value?>"/> | ||
21 | - <?php if($row->hasErrors()) { ?><div class="help-block"><?php echo $modellang[$id][0]->getFirstError('value');?></div> <?php } ?> | ||
22 | - <?php | ||
23 | - if($row->translate) { | ||
24 | - foreach($row->getLangs() as $language_id => $lang) { | ||
25 | - ?> | ||
26 | - <div class="form-group"> | ||
27 | - <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
28 | - <div class="col-xs-11"><input type="<?=$row->template?>" name="Option[<?=$id?>][lang][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$id][$lang['language_id']]->value?>"/></div> | ||
29 | - </div> | ||
30 | - <?php | ||
31 | - } | ||
32 | - } | ||
33 | - | ||
34 | - }?> | ||
35 | - | ||
36 | - <div class="form-group"> | ||
37 | - <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
38 | - </div> | ||
39 | - | ||
40 | - <?php ActiveForm::end(); ?> | ||
41 | -</div> |
frontend/views/option/_search.php
@@ -4,7 +4,7 @@ use yii\helpers\Html; | @@ -4,7 +4,7 @@ use yii\helpers\Html; | ||
4 | use yii\widgets\ActiveForm; | 4 | use yii\widgets\ActiveForm; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $model frontend\models\OptionSearch */ | 7 | +/* @var $model common\models\OptionSearch */ |
8 | /* @var $form yii\widgets\ActiveForm */ | 8 | /* @var $form yii\widgets\ActiveForm */ |
9 | ?> | 9 | ?> |
10 | 10 | ||
@@ -15,17 +15,19 @@ use yii\widgets\ActiveForm; | @@ -15,17 +15,19 @@ use yii\widgets\ActiveForm; | ||
15 | 'method' => 'get', | 15 | 'method' => 'get', |
16 | ]); ?> | 16 | ]); ?> |
17 | 17 | ||
18 | - <?= $form->field($model, 'option_id') ?> | ||
19 | - | ||
20 | <?= $form->field($model, 'model') ?> | 18 | <?= $form->field($model, 'model') ?> |
21 | 19 | ||
20 | + <?= $form->field($model, 'option_id') ?> | ||
21 | + | ||
22 | <?= $form->field($model, 'model_id') ?> | 22 | <?= $form->field($model, 'model_id') ?> |
23 | 23 | ||
24 | <?= $form->field($model, 'name') ?> | 24 | <?= $form->field($model, 'name') ?> |
25 | 25 | ||
26 | <?= $form->field($model, 'template') ?> | 26 | <?= $form->field($model, 'template') ?> |
27 | 27 | ||
28 | - <?php // echo $form->field($model, 'parent_id') ?> | 28 | + <?php // echo $form->field($model, 'option_pid') ?> |
29 | + | ||
30 | + <?php // echo $form->field($model, 'date_add') ?> | ||
29 | 31 | ||
30 | <div class="form-group"> | 32 | <div class="form-group"> |
31 | <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | 33 | <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> |
frontend/views/option/create.php
@@ -4,16 +4,18 @@ use yii\helpers\Html; | @@ -4,16 +4,18 @@ use yii\helpers\Html; | ||
4 | 4 | ||
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $model frontend\models\Option */ | 7 | +/* @var $model common\models\Option */ |
8 | 8 | ||
9 | $this->title = Yii::t('app', 'Create Option'); | 9 | $this->title = Yii::t('app', 'Create Option'); |
10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; |
11 | $this->params['breadcrumbs'][] = $this->title; | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | ?> | 12 | ?> |
13 | <div class="option-create"> | 13 | <div class="option-create"> |
14 | + | ||
14 | <h1><?= Html::encode($this->title) ?></h1> | 15 | <h1><?= Html::encode($this->title) ?></h1> |
15 | - <?php foreach($forms as $oneform) { | ||
16 | - echo $this->render('_form', $oneform); | ||
17 | - }?> | 16 | + |
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
18 | 20 | ||
19 | </div> | 21 | </div> |
frontend/views/option/index.php
@@ -4,7 +4,7 @@ use yii\helpers\Html; | @@ -4,7 +4,7 @@ use yii\helpers\Html; | ||
4 | use yii\grid\GridView; | 4 | use yii\grid\GridView; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $searchModel frontend\models\OptionSearch */ | 7 | +/* @var $searchModel common\models\OptionSearch */ |
8 | /* @var $dataProvider yii\data\ActiveDataProvider */ | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
9 | 9 | ||
10 | $this->title = Yii::t('app', 'Options'); | 10 | $this->title = Yii::t('app', 'Options'); |
@@ -25,12 +25,13 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -25,12 +25,13 @@ $this->params['breadcrumbs'][] = $this->title; | ||
25 | 'columns' => [ | 25 | 'columns' => [ |
26 | ['class' => 'yii\grid\SerialColumn'], | 26 | ['class' => 'yii\grid\SerialColumn'], |
27 | 27 | ||
28 | - 'option_id', | ||
29 | 'model', | 28 | 'model', |
29 | + 'option_id', | ||
30 | 'model_id', | 30 | 'model_id', |
31 | 'name', | 31 | 'name', |
32 | 'template', | 32 | 'template', |
33 | - // 'parent_id', | 33 | + // 'option_pid', |
34 | + // 'date_add', | ||
34 | 35 | ||
35 | ['class' => 'yii\grid\ActionColumn'], | 36 | ['class' => 'yii\grid\ActionColumn'], |
36 | ], | 37 | ], |
frontend/views/option/update.php
@@ -3,19 +3,21 @@ | @@ -3,19 +3,21 @@ | ||
3 | use yii\helpers\Html; | 3 | use yii\helpers\Html; |
4 | 4 | ||
5 | /* @var $this yii\web\View */ | 5 | /* @var $this yii\web\View */ |
6 | -/* @var $model frontend\models\Option */ | 6 | +/* @var $model common\models\Option */ |
7 | 7 | ||
8 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ | 8 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
9 | 'modelClass' => 'Option', | 9 | 'modelClass' => 'Option', |
10 | -]) . ' ' . $forms[0]['models'][\Yii::$app->request->get('id')]->name; | 10 | +]) . ' ' . $model->name; |
11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; |
12 | -$this->params['breadcrumbs'][] = ['label' => $forms[0]['models'][\Yii::$app->request->get('id')]->name, 'url' => ['view', 'id' => $forms[0]['models'][\Yii::$app->request->get('id')]->option_id]]; | 12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->option_id]]; |
13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); |
14 | ?> | 14 | ?> |
15 | <div class="option-update"> | 15 | <div class="option-update"> |
16 | + | ||
16 | <h1><?= Html::encode($this->title) ?></h1> | 17 | <h1><?= Html::encode($this->title) ?></h1> |
17 | - <?php foreach($forms as $oneform) { | ||
18 | - echo $this->render('_form_edit', $oneform); | ||
19 | - }?> | 18 | + |
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
20 | 22 | ||
21 | </div> | 23 | </div> |
frontend/views/option/view.php
@@ -4,7 +4,7 @@ use yii\helpers\Html; | @@ -4,7 +4,7 @@ use yii\helpers\Html; | ||
4 | use yii\widgets\DetailView; | 4 | use yii\widgets\DetailView; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $model frontend\models\Option */ | 7 | +/* @var $model common\models\Option */ |
8 | 8 | ||
9 | $this->title = $model->name; | 9 | $this->title = $model->name; |
10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; |
@@ -28,12 +28,13 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -28,12 +28,13 @@ $this->params['breadcrumbs'][] = $this->title; | ||
28 | <?= DetailView::widget([ | 28 | <?= DetailView::widget([ |
29 | 'model' => $model, | 29 | 'model' => $model, |
30 | 'attributes' => [ | 30 | 'attributes' => [ |
31 | - 'option_id', | ||
32 | 'model', | 31 | 'model', |
32 | + 'option_id', | ||
33 | 'model_id', | 33 | 'model_id', |
34 | 'name', | 34 | 'name', |
35 | 'template', | 35 | 'template', |
36 | - 'parent_id', | 36 | + 'option_pid', |
37 | + 'date_add', | ||
37 | ], | 38 | ], |
38 | ]) ?> | 39 | ]) ?> |
39 | 40 |
frontend/views/options/create.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | - | ||
5 | - | ||
6 | -/* @var $this yii\web\View */ | ||
7 | -/* @var $model frontend\models\Options */ | ||
8 | - | ||
9 | -$this->title = Yii::t('app', 'Create Options'); | ||
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
11 | -$this->params['breadcrumbs'][] = $this->title; | ||
12 | -?> | ||
13 | -<div class="options-create"> | ||
14 | - | ||
15 | - <h1><?= Html::encode($this->title) ?></h1> | ||
16 | - | ||
17 | - <?= $this->render('_form', [ | ||
18 | - 'model' => $model, | ||
19 | - ]) ?> | ||
20 | - | ||
21 | -</div> |
frontend/views/options/index.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | -use yii\grid\GridView; | ||
5 | - | ||
6 | -/* @var $this yii\web\View */ | ||
7 | -/* @var $searchModel frontend\models\OptionsSearch */ | ||
8 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | - | ||
10 | -$this->title = Yii::t('app', 'Options'); | ||
11 | -$this->params['breadcrumbs'][] = $this->title; | ||
12 | -?> | ||
13 | -<div class="options-index"> | ||
14 | - | ||
15 | - <h1><?= Html::encode($this->title) ?></h1> | ||
16 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
17 | - | ||
18 | - <p> | ||
19 | - <?= Html::a(Yii::t('app', 'Create Options'), ['create'], ['class' => 'btn btn-success']) ?> | ||
20 | - </p> | ||
21 | - | ||
22 | - <?= GridView::widget([ | ||
23 | - 'dataProvider' => $dataProvider, | ||
24 | - 'filterModel' => $searchModel, | ||
25 | - 'columns' => [ | ||
26 | - ['class' => 'yii\grid\SerialColumn'], | ||
27 | - | ||
28 | - 'option_id', | ||
29 | - 'option_key', | ||
30 | - 'option_parent', | ||
31 | - 'option_translatable', | ||
32 | - 'option_format', | ||
33 | - | ||
34 | - ['class' => 'yii\grid\ActionColumn'], | ||
35 | - ], | ||
36 | - ]); ?> | ||
37 | - | ||
38 | -</div> |
frontend/views/options/update.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | - | ||
5 | -/* @var $this yii\web\View */ | ||
6 | -/* @var $model frontend\models\Options */ | ||
7 | - | ||
8 | -$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | - 'modelClass' => 'Options', | ||
10 | -]) . ' ' . $model->option_id; | ||
11 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
12 | -$this->params['breadcrumbs'][] = ['label' => $model->option_id, 'url' => ['view', 'id' => $model->option_id]]; | ||
13 | -$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | -?> | ||
15 | -<div class="options-update"> | ||
16 | - | ||
17 | - <h1><?= Html::encode($this->title) ?></h1> | ||
18 | - | ||
19 | - <?= $this->render('_form', [ | ||
20 | - 'model' => $model, | ||
21 | - ]) ?> | ||
22 | - | ||
23 | -</div> |
frontend/views/options/view.php deleted
1 | -<?php | ||
2 | - | ||
3 | -use yii\helpers\Html; | ||
4 | -use yii\widgets\DetailView; | ||
5 | - | ||
6 | -/* @var $this yii\web\View */ | ||
7 | -/* @var $model frontend\models\Options */ | ||
8 | - | ||
9 | -$this->title = $model->option_id; | ||
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
11 | -$this->params['breadcrumbs'][] = $this->title; | ||
12 | -?> | ||
13 | -<div class="options-view"> | ||
14 | - | ||
15 | - <h1><?= Html::encode($this->title) ?></h1> | ||
16 | - | ||
17 | - <p> | ||
18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->option_id], ['class' => 'btn btn-primary']) ?> | ||
19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->option_id], [ | ||
20 | - 'class' => 'btn btn-danger', | ||
21 | - 'data' => [ | ||
22 | - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | ||
23 | - 'method' => 'post', | ||
24 | - ], | ||
25 | - ]) ?> | ||
26 | - </p> | ||
27 | - | ||
28 | - <?= DetailView::widget([ | ||
29 | - 'model' => $model, | ||
30 | - 'attributes' => [ | ||
31 | - 'option_id', | ||
32 | - 'option_key', | ||
33 | - 'option_parent', | ||
34 | - 'option_translatable', | ||
35 | - 'option_format', | ||
36 | - ], | ||
37 | - ]) ?> | ||
38 | - | ||
39 | -</div> |
frontend/views/options/_form.php renamed to frontend/views/user-info/_form.php
100755 โ 100644
@@ -4,21 +4,47 @@ use yii\helpers\Html; | @@ -4,21 +4,47 @@ use yii\helpers\Html; | ||
4 | use yii\widgets\ActiveForm; | 4 | use yii\widgets\ActiveForm; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $model frontend\models\Options */ | 7 | +/* @var $model common\models\UserInfo */ |
8 | /* @var $form yii\widgets\ActiveForm */ | 8 | /* @var $form yii\widgets\ActiveForm */ |
9 | ?> | 9 | ?> |
10 | 10 | ||
11 | -<div class="options-form"> | 11 | +<div class="user-info-form"> |
12 | 12 | ||
13 | <?php $form = ActiveForm::begin(); ?> | 13 | <?php $form = ActiveForm::begin(); ?> |
14 | 14 | ||
15 | - <?= $form->field($model, 'option_key')->textInput(['maxlength' => true]) ?> | 15 | + <?= $form->field($model, 'user_id')->textInput() ?> |
16 | 16 | ||
17 | - <?= $form->field($model, 'option_parent')->textInput() ?> | 17 | + <?= $form->field($model, 'view_count')->textInput() ?> |
18 | 18 | ||
19 | - <?= $form->field($model, 'option_translatable')->textInput() ?> | 19 | + <?= $form->field($model, 'busy')->textInput(['maxlength' => true]) ?> |
20 | 20 | ||
21 | - <?= $form->field($model, 'option_format')->textInput(['maxlength' => true]) ?> | 21 | + <?= $form->field($model, 'date_visit')->textInput() ?> |
22 | + | ||
23 | + <?= $form->field($model, 'experience')->textInput() ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'rank')->textInput(['maxlength' => true]) ?> | ||
26 | + | ||
27 | + <?= $form->field($model, 'salary')->textInput(['maxlength' => true]) ?> | ||
28 | + | ||
29 | + <?= $form->field($model, 'job')->textInput(['maxlength' => true]) ?> | ||
30 | + | ||
31 | + <?= $form->field($model, 'location')->textInput(['maxlength' => true]) ?> | ||
32 | + | ||
33 | + <?= $form->field($model, 'soft')->textInput() ?> | ||
34 | + | ||
35 | + <?= $form->field($model, 'guarantee')->textInput() ?> | ||
36 | + | ||
37 | + <?= $form->field($model, 'contract')->textInput() ?> | ||
38 | + | ||
39 | + <?= $form->field($model, 'estimate')->textInput() ?> | ||
40 | + | ||
41 | + <?= $form->field($model, 'purchase')->textInput() ?> | ||
42 | + | ||
43 | + <?= $form->field($model, 'delivery')->textInput() ?> | ||
44 | + | ||
45 | + <?= $form->field($model, 'prepayment')->textInput() ?> | ||
46 | + | ||
47 | + <?= $form->field($model, 'about')->textarea(['rows' => 6]) ?> | ||
22 | 48 | ||
23 | <div class="form-group"> | 49 | <div class="form-group"> |
24 | <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | 50 | <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
frontend/views/options/_search.php renamed to frontend/views/user-info/_search.php
100755 โ 100644
@@ -4,26 +4,52 @@ use yii\helpers\Html; | @@ -4,26 +4,52 @@ use yii\helpers\Html; | ||
4 | use yii\widgets\ActiveForm; | 4 | use yii\widgets\ActiveForm; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $model frontend\models\OptionsSearch */ | 7 | +/* @var $model common\models\UserInfoSearch */ |
8 | /* @var $form yii\widgets\ActiveForm */ | 8 | /* @var $form yii\widgets\ActiveForm */ |
9 | ?> | 9 | ?> |
10 | 10 | ||
11 | -<div class="options-search"> | 11 | +<div class="user-info-search"> |
12 | 12 | ||
13 | <?php $form = ActiveForm::begin([ | 13 | <?php $form = ActiveForm::begin([ |
14 | 'action' => ['index'], | 14 | 'action' => ['index'], |
15 | 'method' => 'get', | 15 | 'method' => 'get', |
16 | ]); ?> | 16 | ]); ?> |
17 | 17 | ||
18 | - <?= $form->field($model, 'option_id') ?> | 18 | + <?= $form->field($model, 'user_id') ?> |
19 | 19 | ||
20 | - <?= $form->field($model, 'option_key') ?> | 20 | + <?= $form->field($model, 'view_count') ?> |
21 | 21 | ||
22 | - <?= $form->field($model, 'option_parent') ?> | 22 | + <?= $form->field($model, 'busy') ?> |
23 | 23 | ||
24 | - <?= $form->field($model, 'option_translatable') ?> | 24 | + <?= $form->field($model, 'date_visit') ?> |
25 | 25 | ||
26 | - <?= $form->field($model, 'option_format') ?> | 26 | + <?= $form->field($model, 'experience') ?> |
27 | + | ||
28 | + <?php // echo $form->field($model, 'rank') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'salary') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'job') ?> | ||
33 | + | ||
34 | + <?php // echo $form->field($model, 'location') ?> | ||
35 | + | ||
36 | + <?php // echo $form->field($model, 'soft') ?> | ||
37 | + | ||
38 | + <?php // echo $form->field($model, 'user_info_id') ?> | ||
39 | + | ||
40 | + <?php // echo $form->field($model, 'guarantee') ?> | ||
41 | + | ||
42 | + <?php // echo $form->field($model, 'contract') ?> | ||
43 | + | ||
44 | + <?php // echo $form->field($model, 'estimate') ?> | ||
45 | + | ||
46 | + <?php // echo $form->field($model, 'purchase') ?> | ||
47 | + | ||
48 | + <?php // echo $form->field($model, 'delivery') ?> | ||
49 | + | ||
50 | + <?php // echo $form->field($model, 'prepayment') ?> | ||
51 | + | ||
52 | + <?php // echo $form->field($model, 'about') ?> | ||
27 | 53 | ||
28 | <div class="form-group"> | 54 | <div class="form-group"> |
29 | <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | 55 | <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> |
frontend/views/option-values/create.php renamed to frontend/views/user-info/create.php
100755 โ 100644
@@ -4,13 +4,13 @@ use yii\helpers\Html; | @@ -4,13 +4,13 @@ use yii\helpers\Html; | ||
4 | 4 | ||
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $model frontend\models\OptionValues */ | 7 | +/* @var $model common\models\UserInfo */ |
8 | 8 | ||
9 | -$this->title = Yii::t('app', 'Create Option Values'); | ||
10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Option Values'), 'url' => ['index']]; | 9 | +$this->title = Yii::t('app', 'Create User Info'); |
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']]; | ||
11 | $this->params['breadcrumbs'][] = $this->title; | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | ?> | 12 | ?> |
13 | -<div class="option-values-create"> | 13 | +<div class="user-info-create"> |
14 | 14 | ||
15 | <h1><?= Html::encode($this->title) ?></h1> | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | 16 |
frontend/views/option-values/index.php renamed to frontend/views/user-info/index.php
100755 โ 100644
@@ -4,19 +4,19 @@ use yii\helpers\Html; | @@ -4,19 +4,19 @@ use yii\helpers\Html; | ||
4 | use yii\grid\GridView; | 4 | use yii\grid\GridView; |
5 | 5 | ||
6 | /* @var $this yii\web\View */ | 6 | /* @var $this yii\web\View */ |
7 | -/* @var $searchModel frontend\models\OptionValuesSearch */ | 7 | +/* @var $searchModel common\models\UserInfoSearch */ |
8 | /* @var $dataProvider yii\data\ActiveDataProvider */ | 8 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
9 | 9 | ||
10 | -$this->title = Yii::t('app', 'Option Values'); | 10 | +$this->title = Yii::t('app', 'User Infos'); |
11 | $this->params['breadcrumbs'][] = $this->title; | 11 | $this->params['breadcrumbs'][] = $this->title; |
12 | ?> | 12 | ?> |
13 | -<div class="option-values-index"> | 13 | +<div class="user-info-index"> |
14 | 14 | ||
15 | <h1><?= Html::encode($this->title) ?></h1> | 15 | <h1><?= Html::encode($this->title) ?></h1> |
16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | 16 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
17 | 17 | ||
18 | <p> | 18 | <p> |
19 | - <?= Html::a(Yii::t('app', 'Create Option Values'), ['create'], ['class' => 'btn btn-success']) ?> | 19 | + <?= Html::a(Yii::t('app', 'Create User Info'), ['create'], ['class' => 'btn btn-success']) ?> |
20 | </p> | 20 | </p> |
21 | 21 | ||
22 | <?= GridView::widget([ | 22 | <?= GridView::widget([ |
@@ -25,12 +25,24 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -25,12 +25,24 @@ $this->params['breadcrumbs'][] = $this->title; | ||
25 | 'columns' => [ | 25 | 'columns' => [ |
26 | ['class' => 'yii\grid\SerialColumn'], | 26 | ['class' => 'yii\grid\SerialColumn'], |
27 | 27 | ||
28 | - 'option_value_id', | ||
29 | - 'option_key', | ||
30 | - 'option_value_text:ntext', | ||
31 | - 'option_language_id', | ||
32 | - 'option_value_parent', | ||
33 | - // 'option_user', | 28 | + 'user_id', |
29 | + 'view_count', | ||
30 | + 'busy', | ||
31 | + 'date_visit', | ||
32 | + 'experience', | ||
33 | + // 'rank', | ||
34 | + // 'salary', | ||
35 | + // 'job', | ||
36 | + // 'location', | ||
37 | + // 'soft', | ||
38 | + // 'user_info_id', | ||
39 | + // 'guarantee', | ||
40 | + // 'contract', | ||
41 | + // 'estimate', | ||
42 | + // 'purchase', | ||
43 | + // 'delivery', | ||
44 | + // 'prepayment', | ||
45 | + // 'about:ntext', | ||
34 | 46 | ||
35 | ['class' => 'yii\grid\ActionColumn'], | 47 | ['class' => 'yii\grid\ActionColumn'], |
36 | ], | 48 | ], |
frontend/views/option-values/update.php renamed to frontend/views/user-info/update.php
100755 โ 100644
@@ -3,16 +3,16 @@ | @@ -3,16 +3,16 @@ | ||
3 | use yii\helpers\Html; | 3 | use yii\helpers\Html; |
4 | 4 | ||
5 | /* @var $this yii\web\View */ | 5 | /* @var $this yii\web\View */ |
6 | -/* @var $model frontend\models\OptionValues */ | 6 | +/* @var $model common\models\UserInfo */ |
7 | 7 | ||
8 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ | 8 | $this->title = Yii::t('app', 'Update {modelClass}: ', [ |
9 | - 'modelClass' => 'Option Values', | ||
10 | -]) . ' ' . $model->option_value_id; | ||
11 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Option Values'), 'url' => ['index']]; | ||
12 | -$this->params['breadcrumbs'][] = ['label' => $model->option_value_id, 'url' => ['view', 'id' => $model->option_value_id]]; | 9 | + 'modelClass' => 'User Info', |
10 | +]) . ' ' . $model->user_info_id; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->user_info_id, 'url' => ['view', 'id' => $model->user_info_id]]; | ||
13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); |
14 | ?> | 14 | ?> |
15 | -<div class="option-values-update"> | 15 | +<div class="user-info-update"> |
16 | 16 | ||
17 | <h1><?= Html::encode($this->title) ?></h1> | 17 | <h1><?= Html::encode($this->title) ?></h1> |
18 | 18 |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\UserInfo */ | ||
8 | + | ||
9 | +$this->title = $model->user_info_id; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="user-info-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->user_info_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->user_info_id], [ | ||
20 | + 'class' => 'btn btn-danger', | ||
21 | + 'data' => [ | ||
22 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | ||
23 | + 'method' => 'post', | ||
24 | + ], | ||
25 | + ]) ?> | ||
26 | + </p> | ||
27 | + | ||
28 | + <?= DetailView::widget([ | ||
29 | + 'model' => $model, | ||
30 | + 'attributes' => [ | ||
31 | + 'user_id', | ||
32 | + 'view_count', | ||
33 | + 'busy', | ||
34 | + 'date_visit', | ||
35 | + 'experience', | ||
36 | + 'rank', | ||
37 | + 'salary', | ||
38 | + 'job', | ||
39 | + 'location', | ||
40 | + 'soft', | ||
41 | + 'user_info_id', | ||
42 | + 'guarantee', | ||
43 | + 'contract', | ||
44 | + 'estimate', | ||
45 | + 'purchase', | ||
46 | + 'delivery', | ||
47 | + 'prepayment', | ||
48 | + 'about:ntext', | ||
49 | + ], | ||
50 | + ]) ?> | ||
51 | + | ||
52 | +</div> |