Commit df45665bc11346630c825b2acdafdfedc55eed6b

Authored by Yarik
2 parents f819c230 ea8c5991

Merge remote-tracking branch 'origin/master'

Showing 43 changed files with 81 additions and 114 deletions   Show diff stats
.bowerrc 100644 → 100755
backend/views/specialization/_form.php
... ... @@ -14,15 +14,24 @@ use yii\helpers\ArrayHelper;
14 14  
15 15 <?= $form->field($model, 'specialization_pid')->dropDownList(ArrayHelper::map($model->find()->all(), 'specialization_id', 'specialization_name'), ['prompt' => 'Выберие родителя']) ?>
16 16 <?= $form->field($model, 'specialization_name')->textInput(['maxlength' => true]) ?>
17   - <?= \common\widgets\ImageUploader::widget([
18   - 'model'=> $model,
19   - 'field'=>'img',
20   - 'width'=>240,
21   - 'height'=>160,
22   - 'multi'=>false,
23   - 'gallery' =>$model->img,
24   - 'name' => 'Загрузить картинку'
25   - ]); ?>
  17 +
  18 + <?php
  19 +
  20 + echo $form->field($model, 'background')->textInput();
  21 +
  22 + if($model->specialization_pid == 0 && !empty($model->specialization_id) ){
  23 + echo \common\widgets\ImageUploader::widget([
  24 + 'model'=> $model,
  25 + 'field'=>'image',
  26 + 'width'=>940,
  27 + 'height'=>324,
  28 + 'multi'=>false,
  29 + 'gallery' =>$model->image,
  30 + 'name' => 'Загрузить картинку'
  31 + ]);
  32 + }
  33 + ?>
  34 +
26 35 <div class="form-group">
27 36 <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
28 37 </div>
... ...
common/models/CompanyInfo.php 100644 → 100755
common/models/CompanyInfoSearch.php 100644 → 100755
common/models/Job.php 100644 → 100755
common/models/JobSearch.php 100644 → 100755
common/models/Specialization.php
... ... @@ -10,10 +10,11 @@ use Yii;
10 10 * @property integer $specialization_id
11 11 * @property integer $specialization_pid
12 12 * @property string $specialization_name
  13 + * @property string $image
  14 + * @property string $background
13 15 */
14 16 class Specialization extends \yii\db\ActiveRecord
15 17 {
16   - public $img;
17 18 /**
18 19 * @inheritdoc
19 20 */
... ... @@ -28,10 +29,10 @@ class Specialization extends \yii\db\ActiveRecord
28 29 public function rules()
29 30 {
30 31 return [
31   - [['specialization_pid'], 'integer'],
  32 + [['specialization_pid','status'], 'integer'],
32 33 [['specialization_pid'], 'default', 'value' => '0',],
33 34 [['specialization_name'], 'required'],
34   - [['specialization_name'], 'string', 'max' => 255],
  35 + [['specialization_name','image','background'], 'string', 'max' => 255],
35 36 ];
36 37 }
37 38  
... ... @@ -45,6 +46,9 @@ class Specialization extends \yii\db\ActiveRecord
45 46 'specialization_pid' => 'Specialization Pid',
46 47 'specialization_name' => 'Specialization Name',
47 48 'specialization_parent_name' => 'Specialization Parent Name',
  49 + 'image' => 'Картинка',
  50 + 'background' => 'Background',
  51 + 'status' => 'Status',
48 52 ];
49 53 }
50 54  
... ... @@ -54,4 +58,9 @@ class Specialization extends \yii\db\ActiveRecord
54 58 return $this->hasOne(self::className(), ['specialization_id' => 'specialization_pid']);
55 59 }
56 60  
  61 + public function getChildren()
  62 + {
  63 + return $this->hasMany(self::className(), ['specialization_pid' => 'specialization_id']);
  64 + }
  65 +
57 66 }
... ...
common/widgets/FieldEditor.php
... ... @@ -33,6 +33,7 @@ class FieldEditor extends Widget
33 33 protected function findModel()
34 34 {
35 35  
  36 +
36 37 if (($model = Fields::find()->where([
37 38 'table_id'=>$this->item_id,
38 39 'table_name'=>$this->model,
... ...
common/widgets/views/education_field.php
1 1 <?php
2 2 use yii\helpers\Html;
  3 +
3 4 ?>
4 5 <fieldset>
5 6  
... ... @@ -8,16 +9,18 @@ use yii\helpers\Html;
8 9 <p class="btn btn-success add_field">Добавить поле</p>
9 10  
10 11  
11   - <?php for($i=1; $i <= count($model); $i++):
  12 + <?php $t = 0; for($i=1; $i <= count($model); $i++):
12 13 $row = $i;
  14 +
13 15 ?>
14 16  
15 17 <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?>
16   - <input type="text" placeholder="С" class="form-control" value="<?= isset($model[$i]['value']) ? $model[$i]['value'] : '' ?>" name="Fields[education][<?=$row?>][0][year_from]" />
17   - <input type="text" placeholder="По" class="form-control" value="<?= isset($model[++$i]['value']) ? $model[$i]['value'] : '' ?>" name="Fields[education][<?=$row?>][1][year_to]" />
18   - <textarea placeholder="Место" name="Fields[education][<?=$row?>][2][place]" /><?= isset($model[++$i]['value']) ? $model[$i]['value'] : '' ?></textarea>
  18 + <input type="text" placeholder="С" class="form-control" value="<?= isset($model[$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[education][<?=$row?>][0][year_from]" />
  19 + <input type="text" placeholder="По" class="form-control" value="<?= isset($model[++$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[education][<?=$row?>][1][year_to]" />
  20 + <textarea placeholder="Место" name="Fields[education][<?=$row?>][2][place]" /><?= isset($model[++$t]['value']) ? $model[$t]['value'] : '' ?></textarea>
19 21 <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>
20 22 <?= Html::endTag('div')?>
  23 + <?php $i = ++ $t; ?>
21 24 <?php endfor; ?>
22 25  
23 26  
... ... @@ -30,7 +33,7 @@ use yii\helpers\Html;
30 33 var block = $(this).parent('fieldset');
31 34 var block_id = $(this).parent('fieldset');
32 35 var sub_block = '<div class="form-group" >'+
33   - '<input type="text" placeholder="С" class="form-control" value="" name="Fields[education]['+ start_i++ +'][0][year_from]" />'+
  36 + '<input type="text" placeholder="С" class="form-control" value="" name="Fields[education]['+ ++start_i +'][0][year_from]" />'+
34 37 '<input type="text" placeholder="По" class="form-control" value="" name="Fields[education]['+ start_i +'][1][year_to]" />'+
35 38 '<textarea placeholder="Место" name="Fields[education]['+ start_i +'][2][place]" /></textarea>'+
36 39 '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+
... ...
console/migrations/m160202_090343_user_add_fields.php 100644 → 100755
console/migrations/m160202_094943_user_info_country_city.php 100644 → 100755
console/migrations/m160203_133308_add_field_specialization.php 100644 → 100755
console/migrations/m160203_140144_add_field_user_info.php 100644 → 100755
frontend/assets/AppAsset.php
... ... @@ -19,7 +19,7 @@ class AppAsset extends AssetBundle
19 19 public $css = [
20 20 'css/style.css',
21 21 '/admin/css/flags32.css',
22   - //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin',
  22 + 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin',
23 23 ];
24 24 public $js = [
25 25 '/js/script.js',
... ...
frontend/controllers/AccountsController.php
... ... @@ -48,11 +48,10 @@ class AccountsController extends Controller
48 48  
49 49 $langs = Language::getActiveLanguages();
50 50  
51   -
52 51 if ($user->load(Yii::$app->request->post()) && $user->save()) {
53 52 $user->userInfo->load(Yii::$app->request->post());
54 53 $user->userInfo->save();
55   - Fields::saveFieldData( Yii::$app->request->post('Fields'), $user->id, $user::className());
  54 + Fields::saveFieldData( Yii::$app->request->post('Fields'), $user->id, $user::className(),'ru');
56 55 return $this->render('cabinet', [
57 56 'user' => $user,
58 57 'user_info' => $user->userInfo,
... ...
frontend/controllers/CompanyInfoController.php 100644 → 100755
frontend/controllers/JobController.php 100644 → 100755
frontend/controllers/SiteController.php
1 1 <?php
2 2 namespace frontend\controllers;
3 3  
  4 +use common\models\Specialization;
4 5 use common\models\UserInfo;
5 6 use Yii;
6 7 use common\models\LoginForm;
... ... @@ -62,7 +63,11 @@ class SiteController extends Controller
62 63 */
63 64 public function actionIndex()
64 65 {
65   - return $this->render('index');
  66 + $specializations = Specialization::find()->where(['specialization_pid'=>0])->all();
  67 +
  68 + return $this->render('index',[
  69 + 'specializations' => $specializations,
  70 + ]);
66 71 }
67 72  
68 73 /**
... ...
frontend/views/accounts/_form.php
... ... @@ -56,7 +56,7 @@ use mihaildev\elfinder\ElFinder;
56 56 'template'=>'education',
57 57 'item_id'=> $user->id,
58 58 'model'=>'common\models\User',
59   - 'language'=>'0'
  59 + 'language'=>'ru'
60 60 ]); ?>
61 61  
62 62  
... ...
frontend/views/accounts/_job_form.php 100644 → 100755
frontend/views/accounts/add-skills.php 100644 → 100755
frontend/views/accounts/contacts.php 100644 → 100755
frontend/views/accounts/employment.php 100644 → 100755
frontend/views/accounts/gallery.php 100644 → 100755
frontend/views/accounts/general.php 100644 → 100755
frontend/views/accounts/portfolio.php 100644 → 100755
frontend/views/accounts/service.php 100644 → 100755
frontend/views/accounts/setting.php 100644 → 100755
frontend/views/company-info/_form.php 100644 → 100755
frontend/views/company-info/_search.php 100644 → 100755
frontend/views/company-info/create.php 100644 → 100755
frontend/views/company-info/index.php 100644 → 100755
frontend/views/company-info/update.php 100644 → 100755
frontend/views/company-info/view.php 100644 → 100755
frontend/views/job/_form.php 100644 → 100755
frontend/views/job/_search.php 100644 → 100755
frontend/views/job/create.php 100644 → 100755
frontend/views/job/index.php 100644 → 100755
frontend/views/job/update.php 100644 → 100755
frontend/views/job/view.php 100644 → 100755
frontend/views/layouts/admin.php
... ... @@ -9,18 +9,6 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
9 9 ?>
10 10 <div class="wrap">
11 11 <div class="container">
12   - <div class="left_block">
13   - <?php
14   - echo Menu::widget([
15   - 'options' => ['class' => 'nav nav-pills nav-stacked'],
16   - 'items' => [
17   - ['label' => 'Кабинет', 'url' => ['accounts/cabinet']],
18   -
19   - ['label' => 'Выход', 'url' => ['/site/logout']],
20   - ],
21   - ]);
22   - ?>
23   - </div>
24 12 <div class="right_block">
25 13 <?= Breadcrumbs::widget([
26 14 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
... ... @@ -71,6 +59,10 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
71 59 'label' => 'Галерея',
72 60 'url' => ['accounts/gallery'],
73 61 ],
  62 + [
  63 + 'label' => 'Выход',
  64 + 'url' => ['/site/logout']
  65 + ],
74 66 ],
75 67 ]);
76 68 ?>
... ...
frontend/views/layouts/performer.php
... ... @@ -3,7 +3,7 @@
3 3 use yii\widgets\Breadcrumbs;
4 4 use yii\widgets\Menu;
5 5  
6   -\frontend\assets\AdminAsset::register($this);
  6 +\frontend\assets\AppAsset::register($this);
7 7 /* @var $content string */
8 8 $this->beginContent('@app/views/layouts/main.php');
9 9 ?>
... ...
frontend/views/site/index.php
1 1 <?php
2 2  
3 3 use \yii\helpers\Html;
4   -
5   -/* @var $this yii\web\View */
  4 +use \common\models\Specialization;
  5 +/**
  6 + * @var $this yii\web\View
  7 + * @var $specializations common\models\Specialization
  8 + */
6 9  
7 10 $this->title = 'My Yii Application';
8 11 ?>
... ... @@ -49,83 +52,29 @@ $this-&gt;title = &#39;My Yii Application&#39;;
49 52 <div class="menu-two-wrapp-title">Специализация работ по исполнителям</div>
50 53 <div class="menu-two-wrapp" style="background: url('/images/menu-pic-1.jpg') 100% 100% no-repeat">
51 54 <ul class="content-menu-first">
52   - <li data-img="/images/menu-pic-1-2.jpg">
53   - <span data-menu-bg="#bb0f3f" style="background: #bb0f3f"></span><a href="#">Жилые</a>
54   - <ul>
55   - <li>
56   - <a href="#">Жилые дома</a>
57   - <ul>
58   - <li><a href="#">Дизайн</a></li>
59   - <li>
60   - <a href="#">Разработка градостроительной документации</a>
61   - <ul>
62   - <li><a href="#">Архитекторы</a></li>
63   - <li><a href="#">Junior-архитекторы</a></li>
64   - </ul>
65   - </li>
66   - <li><a href="#">Проектирование объектов архитектуры</a></li>
67   - <li><a href="#">Инжиниринговая деятельность в сфере строительства</a>
68   - <ul>
69   - <li><a href="#">йййййй</a></li>
70   - <li><a href="#">ййййййййййй</a></li>
71   - </ul>
72   - </li>
73   - <li><a href="#">Анимация и реклама</a></li>
74   - </ul>
75   - </li>
76   - <li><a href="#">Виллы</a></li>
77   - <li><a href="#">Коттеджи</a></li>
78   - <li><a href="#">Гостиницы</a></li>
79   - <li>
80   - <a href="#">Базы отдыха</a>
81   - <ul>
82   - <li><a href="#">2---2</a></li>
83   - <li><a href="#">2---3</a></li>
84   - <li><a href="#">2---4</a></li>
85   - </ul>
86   - </li>
87   - <li><a href="#">Таунхаусы</a></li>
88   - <li><a href="#">Квартиры</a></li>
89   - <li><a href="#">Квартиры</a></li>
90   - <li><a href="#">Квартиры</a></li>
91   - </ul>
92   - </li>
93   - <li data-img="/images/menu-pic-1.jpg">
94   - <span data-menu-bg="#ea640b" style="background: #ea640b"></span><a href="#">Офисные</a>
95   - <ul>
96   - <li>
97   - <a href="#">Коттеджи</a>
98   - <ul>
99   - <li><a href="#">1---1</a></li>
100   - <li>
101   - <a href="#">1---2</a>
102   - <ul>
103   - <li><a href="#">Архитекторы</a></li>
104   - <li><a href="#">Junior-архитекторы</a></li>
105   - </ul>
106   - </li>
107   - <li><a href="#">1---3</a></li>
108   - <li><a href="#">1---4</a></li>
109   - </ul>
110   - </li>
111   - <li><a href="#">Гостиницы</a></li>
112   - <li>
113   - <a href="#">Базы отдыха</a>
114   - <ul>
115   - <li><a href="#">2---2</a></li>
116   - <li><a href="#">2---3</a></li>
117   - <li><a href="#">2---4</a></li>
118   - </ul>
119   - </li>
120   - </ul>
121   - </li>
122   - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#f7a901" style="background: #f7a901"></span><a href="#">Торговые</a></li>
123   - <li data-img="/images/menu-pic-1.jpg"><span data-menu-bg="#53a827" style="background: #53a827"></span><a href="#">Мосты</a></li>
124   - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#018232" style="background: #018232"></span><a href="#">Дороги</a></li>
125   - <li data-img="/images/menu-pic-1.jpg"><span data-menu-bg="#02857d" style="background: #02857d"></span><a href="#">Сооружения</a></li>
126   - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#019abf" style="background: #019abf"></span><a href="#">Склады</a></li>
127   - <li data-img="/images/menu-pic-1.jpg"><span data-menu-bg="#116da8" style="background: #116da8"></span><a href="#">Заводы</a></li>
128   - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#413e7f" style="background: #413e7f"></span><a href="#">Разное</a></li>
  55 + <?php foreach($specializations as $specialization):?>
  56 + <li data-img="<?= $specialization->image?>">
  57 + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name?></a>
  58 + <ul>
  59 + <?php foreach($specialization->children as $child_first):?>
  60 +
  61 + <?php if($child_first instanceof Specialization):?>
  62 + <li>
  63 + <a href="#"><?= $child_first->specialization_name?></a>
  64 + <ul>
  65 + <?php foreach($child_first->children as $child_second):?>
  66 + <?php if($child_first instanceof Specialization): ?>
  67 + <li><a href="#"><?= $child_second->specialization_name?></a></li>
  68 + <?php endif;?>
  69 + <?php endforeach; ?>
  70 + </ul>
  71 + </li>
  72 + <?php endif; ?>
  73 + <?php endforeach; ?>
  74 +
  75 + </ul>
  76 + </li>
  77 + <?php endforeach; ?>
129 78 </ul>
130 79 </div>
131 80 </div>
... ...