Commit 004b229889335ecfdc40ae089d9289cc9dd83f49

Authored by Yarik
1 parent 65326361

test

backend/controllers/AdminMenuController.php
... ... @@ -83,7 +83,7 @@ class AdminMenuController extends Controller
83 83 $model = $this->findModel($id);
84 84  
85 85 if ($model->load(Yii::$app->request->post()) && $model->save()) {
86   - return $this->redirect(['view', 'id' => $model->adminmenu_id]);
  86 + return $this->redirect(['view', 'id' => $model->admin_menu_id]);
87 87 } else {
88 88 return $this->render('update', [
89 89 'model' => $model,
... ...
common/behaviors/MapsBehavior.php
... ... @@ -58,7 +58,7 @@
58 58 $location .= $owner->$location_attribute;
59 59 $first = false;
60 60 }
61   - $location = Html::encode($location);
  61 + $location = urlencode(Html::encode($location));
62 62 $ch = curl_init();
63 63 if(!$ch) {
64 64 throw new ErrorException('Curl error');
... ...
common/models/Portfolio.php
... ... @@ -2,6 +2,7 @@
2 2  
3 3 namespace common\models;
4 4  
  5 + use common\behaviors\MapsBehavior;
5 6 use common\modules\comment\models\Comment;
6 7 use common\modules\comment\models\Rating;
7 8 use Yii;
... ... @@ -66,6 +67,17 @@
66 67 [
67 68 'class' => 'common\behaviors\ShowImage',
68 69 ],
  70 + 'maps' => [
  71 + 'class' => MapsBehavior::className(),
  72 + 'location_attributes' => [
  73 + 'city',
  74 + 'street',
  75 + 'house',
  76 + ],
  77 + 'required_attributes' => [
  78 + 'city',
  79 + ],
  80 + ],
69 81 ];
70 82 }
71 83  
... ...
common/models/Specialization.php
... ... @@ -97,4 +97,18 @@ class Specialization extends \yii\db\ActiveRecord
97 97  
98 98 }
99 99  
  100 + public function getStack()
  101 + {
  102 + $stack[] = $this->specialization_id;
  103 + if(!empty($this->children)) {
  104 + foreach($this->children as $child) {
  105 + $stack[] = $child->specialization_id;
  106 + if(!empty($child->children)) {
  107 + $stack = array_merge($stack, ArrayHelper::getColumn($child->children, 'specialization_id', false));
  108 + }
  109 + }
  110 + }
  111 + return $stack;
  112 + }
  113 +
100 114 }
... ...
frontend/assets/AppAsset.php
... ... @@ -43,6 +43,7 @@
43 43 '/js/myGallery_min.js',
44 44 '/js/fieldWidget.js',
45 45 '/js/owl.carousel.min.js',
  46 + '/js/artbox.maps.js',
46 47 ];
47 48  
48 49 public $depends = [
... ...
frontend/controllers/CompanyController.php
... ... @@ -77,7 +77,7 @@
77 77 }
78 78  
79 79 $projectProvider = new ActiveDataProvider([
80   - 'query' => $company->getProjects(),
  80 + 'query' => $company->getPortfolios(),
81 81 ]);
82 82  
83 83 $blogProvider = new ActiveDataProvider([
... ...
frontend/controllers/PortfolioController.php 0 โ†’ 100644
  1 +<?php
  2 + namespace frontend\controllers;
  3 +
  4 + use common\models\Portfolio;
  5 + use common\models\Specialization;
  6 + use common\models\User;
  7 + use yii\web\Controller;
  8 + use yii\web\NotFoundHttpException;
  9 +
  10 + /**
  11 + * Portfolio AJAX controller
  12 + */
  13 + class PortfolioController extends Controller
  14 + {
  15 +
  16 + public $enableCsrfValidation = false;
  17 +
  18 + public function behaviors()
  19 + {
  20 + return [
  21 +
  22 + ];
  23 + }
  24 +
  25 + /**
  26 + * @param int $user_id
  27 + * @param null|int $specialization_id
  28 + * @param int $start
  29 + *
  30 + * @return array
  31 + * @throws NotFoundHttpException
  32 + */
  33 + public function actionPortfolio($user_id, $specialization_id = NULL, $start = 0)
  34 + {
  35 + /**
  36 + * @var Specialization $specialization
  37 + * @var User $user
  38 + */
  39 + $request = \Yii::$app->request;
  40 + $response = \Yii::$app->response;
  41 + $response->format = $response::FORMAT_JSON;
  42 + $user = User::findOne($user_id);
  43 + if(empty( $user )) {
  44 + throw new NotFoundHttpException('User not found');
  45 + }
  46 + if(!empty( $specialization_id )) {
  47 + $specializations[] = $specialization_id;
  48 + $specialization = Specialization::find()
  49 + ->where([ 'specialization_id' => $specialization_id ])
  50 + ->one();
  51 + if(!empty( $specialization )) {
  52 + $specializations = $specialization->stack;
  53 + } else {
  54 + $specializations = NULL;
  55 + }
  56 + } else {
  57 + $specializations = NULL;
  58 + }
  59 + $portfolios = $user->getPortfolios()
  60 + ->asArray()
  61 + ->joinWith('specializations')
  62 + ->andWhere([
  63 + 'not',
  64 + [ 'portfolio.lat' => NULL ],
  65 + ])
  66 + ->andWhere([
  67 + 'not',
  68 + [ 'portfolio.lng' => NULL ],
  69 + ])
  70 + ->andWhere([
  71 + '>=',
  72 + 'portfolio.date_add',
  73 + date('Y-m-d', $start),
  74 + ])
  75 + ->andFilterWhere([ 'specialization.specialization_id' => $specializations ])
  76 + ->all();
  77 + return [ 'result' => $portfolios ];
  78 + }
  79 +
  80 + public function actionPortfolioAll()
  81 + {
  82 + $request = \Yii::$app->request;
  83 + $response = \Yii::$app->response;
  84 + $response->format = $response::FORMAT_JSON;
  85 + $portfolios = Portfolio::find()
  86 + ->asArray()
  87 + ->andWhere([
  88 + 'not',
  89 + [ 'portfolio.lat' => NULL ],
  90 + ])
  91 + ->andWhere([
  92 + 'not',
  93 + [ 'portfolio.lng' => NULL ],
  94 + ])
  95 + ->all();
  96 + return [ 'result' => $portfolios ];
  97 + }
  98 +
  99 + }
... ...
frontend/controllers/ProjectController.php 0 โ†’ 100644
  1 +<?php
  2 + namespace frontend\controllers;
  3 +
  4 + use common\models\Portfolio;
  5 + use common\models\Project;
  6 + use common\models\Specialization;
  7 + use common\models\User;
  8 + use yii\web\Controller;
  9 + use yii\web\NotFoundHttpException;
  10 +
  11 + /**
  12 + * Project AJAX controller
  13 + */
  14 + class ProjectController extends Controller
  15 + {
  16 +
  17 + public $enableCsrfValidation = false;
  18 +
  19 + public function behaviors()
  20 + {
  21 + return [
  22 +
  23 + ];
  24 + }
  25 +
  26 + public function actionProjectAll()
  27 + {
  28 + $request = \Yii::$app->request;
  29 + $response = \Yii::$app->response;
  30 + $response->format = $response::FORMAT_JSON;
  31 + $projects = Project::find()
  32 + ->asArray()
  33 + ->andWhere([
  34 + 'not',
  35 + [ 'project.lat' => NULL ],
  36 + ])
  37 + ->andWhere([
  38 + 'not',
  39 + [ 'project.lng' => NULL ],
  40 + ])
  41 + ->all();
  42 + return [ 'result' => $projects ];
  43 + }
  44 +
  45 + }
... ...
frontend/views/company/common.php
... ... @@ -6,6 +6,7 @@
6 6 * @var ActiveDataProvider $blogProvider
7 7 * @var ActiveDataProvider $commentProvider
8 8 */
  9 + use common\models\Specialization;
9 10 use common\models\User;
10 11 use yii\data\ActiveDataProvider;
11 12 use yii\helpers\ArrayHelper;
... ... @@ -37,179 +38,56 @@
37 38 <div class="box-wr">
38 39 <div class="box-all">
39 40 <div class="company-performer-type-title style">ะะฐัˆะธ ะพะฑัŠะตะบั‚ั‹ (<?= $projectProvider->totalCount ?>)</div>
40   - <div class="settings-map-ul">
  41 + <div class="settings-map-ul company_map_time" data-map="company_map">
41 42 <ul>
42   - <li><a href="#" class="active"><span>ะŸะพัะปะตะดะฝะธะน ะณะพะด</span></a></li>
43   - <li><a href="#"><span>ะŸะพัะปะตะดะฝะธะต ะฟัั‚ัŒ ะปะตั‚</span></a></li>
44   - <li><a href="#"><span>ะ’ะตััŒ ะฟะตั€ะธะพะด</span></a></li>
  43 + <li>
  44 + <a href="#" class="active company_map_time_link" data-start="<?= strtotime('-1 years') ?>"><span>ะŸะพัะปะตะดะฝะธะน ะณะพะด</span></a>
  45 + </li>
  46 + <li>
  47 + <a href="#" class="company_map_time_link" data-start="<?= strtotime('-5 years') ?>"><span>ะŸะพัะปะตะดะฝะธะต ะฟัั‚ัŒ ะปะตั‚</span></a>
  48 + </li>
  49 + <li>
  50 + <a href="#" class="company_map_time_link" data-start="0"><span>ะ’ะตััŒ ะฟะตั€ะธะพะด</span></a>
  51 + </li>
45 52 </ul>
46 53 </div>
47 54 <div class="company-performer-type-map style">
48 55 <div class="section-box-map">
49 56 <div class="shadow-map"></div>
50   - <div id="map_cloud" style="display: none;">
51   - <script type="text/javascript">
52   - function initialize()
53   - {
54   - var start_position = new google.maps.LatLng('49', '33');
55   - var settings = {
56   - zoom : 7, scrollwheel : true, center : start_position,
57   - mapTypeControl : false,
58   - mapTypeControlOptions : {style : google.maps.MapTypeControlStyle.DROPDOWN_MENU},
59   - navigationControl : false,
60   - navigationControlOptions : {style : google.maps.NavigationControlStyle.SMALL},
61   - scaleControl : false, streetViewControl : false,
62   - rotateControl : false, zoomControl : true,
63   - mapTypeId : google.maps.MapTypeId.ROADMAP
64   - };
65   - var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
66   -
67   - var image1 = new google.maps.MarkerImage(
68   - '/images/markers/marker-we-1.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
69   - );
70   - var image2 = new google.maps.MarkerImage(
71   - '/images/markers/marker-we-2.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
72   - );
73   - var image3 = new google.maps.MarkerImage(
74   - '/images/markers/marker-we-3.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
75   - );
76   - var image4 = new google.maps.MarkerImage(
77   - '/images/markers/marker-we-4.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
78   - );
79   - var image5 = new google.maps.MarkerImage(
80   - '/images/markers/marker-we-5.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
81   - );
82   - var image6 = new google.maps.MarkerImage(
83   - '/images/markers/marker-we-6.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
84   - );
85   - var image7 = new google.maps.MarkerImage(
86   - '/images/markers/marker-we-7.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
87   - );
88   - var image8 = new google.maps.MarkerImage(
89   - '/images/markers/marker-we-8.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
90   - );
91   - var image9 = new google.maps.MarkerImage(
92   - '/images/markers/marker-we-9.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
93   - );
94   - var image10 = new google.maps.MarkerImage(
95   - '/images/markers/marker-empl-1.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
96   - );
97   - var image11 = new google.maps.MarkerImage(
98   - '/images/markers/marker-empl-2.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
99   - );
100   - var image12 = new google.maps.MarkerImage(
101   - '/images/markers/marker-empl-3.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
102   - );
103   - var image13 = new google.maps.MarkerImage(
104   - '/images/markers/marker-empl-4.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
105   - );
106   - var image14 = new google.maps.MarkerImage(
107   - '/images/markers/marker-empl-5.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
108   - );
109   - var image15 = new google.maps.MarkerImage(
110   - '/images/markers/marker-empl-6.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
111   - );
112   - var image16 = new google.maps.MarkerImage(
113   - '/images/markers/marker-empl-7.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
114   - );
115   - var image17 = new google.maps.MarkerImage(
116   - '/images/markers/marker-empl-8.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
117   - );
118   - var image18 = new google.maps.MarkerImage(
119   - '/images/markers/marker-empl-9.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
120   - );
121   -
122   - var markers = [];
123   -
124   - var marker = new google.maps.Marker(
125   - {
126   - position : new google.maps.LatLng('49', '32.3'),
127   - map : map, title : 'Marker Title2', icon : image1
128   - }
129   - );
130   - markers.push(marker);
131   -
132   - var marker = new google.maps.Marker(
133   - {
134   - position : new google.maps.LatLng('49', '36'),
135   - map : map, title : 'Marker Title2', icon : image2
136   - }
137   - );
138   - markers.push(marker);
139   -
140   - var marker = new google.maps.Marker(
141   - {
142   - position : new google.maps.LatLng('49', '34.5'),
143   - map : map, title : 'Marker Title3', icon : image18
144   - }
145   - );
146   - markers.push(marker);
147   -
148   - var marker = new google.maps.Marker(
149   - {
150   - position : new google.maps.LatLng('49', '35'),
151   - map : map, title : 'Marker Title4', icon : image15
152   - }
153   - );
154   - markers.push(marker);
155   -
156   - var clusterStyles = [
157   - {
158   - url : '/images/markers/clasters.png', height : 36,
159   - width : 36
160   - }
161   -
162   - ];
163   - markerClusterer = new MarkerClusterer(
164   - map, markers, {
165   - maxZoom : 10, gridSize : 100, styles : clusterStyles
166   - }
167   - );
168   - }
169   - </script>
170   - </div>
171   - <div id="map_canvas" style="width: 100%; height:100%;"></div>
  57 + <div id="map_company" style="width: 100%; height:100%;" data-user="<?= $company->id ?>"></div>
172 58 <div class="company-performer-map-menu">
173   -
  59 + <?php
  60 + $specializations = Specialization::find()
  61 + ->where([ 'specialization_pid' => 0 ])
  62 + ->with('children.children')
  63 + ->orderBy('specialization_id')
  64 + ->all();
  65 + ?>
174 66 <ul class="content-menu-first">
175   - <li>
176   - <span data-menu-bg="#bb0f3f" style="background: #bb0f3f"></span><a href="#">ะ–ะธะปั‹ะต</a>
177   - <ul>
178   - <li><a href="#">ะ–ะธะปั‹ะต ะดะพะผะฐ</a></li>
179   - <li><a href="#">ะ’ะธะปะปั‹</a></li>
180   - <li><a href="#">ะšะพั‚ั‚ะตะดะถะธ</a></li>
181   - <li><a href="#">ะ“ะพัั‚ะธะฝะธั†ั‹</a></li>
182   - <li><a href="#">ะ‘ะฐะทั‹ ะพั‚ะดั‹ั…ะฐ</a></li>
183   - <li><a href="#">ะขะฐัƒะฝั…ะฐัƒัั‹</a></li>
184   - <li><a href="#">ะšะฒะฐั€ั‚ะธั€ั‹</a></li>
185   - <li><a href="#">ะšะฒะฐั€ั‚ะธั€ั‹</a></li>
186   - <li><a href="#">ะšะฒะฐั€ั‚ะธั€ั‹</a></li>
187   - </ul>
188   - </li>
189   - <li>
190   - <span data-menu-bg="#ea640b" style="background: #ea640b"></span><a href="#">ะžั„ะธัะฝั‹ะต</a>
191   - <ul>
192   - <li><a href="#">ะšะพั‚ั‚ะตะดะถะธ</a></li>
193   - <li><a href="#">ะ“ะพัั‚ะธะฝะธั†ั‹</a></li>
194   - <li><a href="#">ะ‘ะฐะทั‹ ะพั‚ะดั‹ั…ะฐ</a></li>
195   - </ul>
196   - </li>
197   - <li><span data-menu-bg="#f7a901" style="background: #f7a901"></span><a href="#">ะขะพั€ะณะพะฒั‹ะต</a>
198   - </li>
199   - <li><span data-menu-bg="#53a827" style="background: #53a827"></span><a href="#">ะœะพัั‚ั‹</a>
200   - </li>
201   - <li><span data-menu-bg="#018232" style="background: #018232"></span><a href="#">ะ”ะพั€ะพะณะธ</a>
202   - </li>
203   - <li><span data-menu-bg="#02857d" style="background: #02857d"></span><a href="#">ะกะพะพั€ัƒะถะตะฝะธั</a>
204   - </li>
205   - <li><span data-menu-bg="#019abf" style="background: #019abf"></span><a href="#">ะกะบะปะฐะดั‹</a>
206   - </li>
207   - <li><span data-menu-bg="#116da8" style="background: #116da8"></span><a href="#">ะ—ะฐะฒะพะดั‹</a>
208   - </li>
209   - <li><span data-menu-bg="#413e7f" style="background: #413e7f"></span><a href="#">ะ ะฐะทะฝะพะต</a>
210   - </li>
  67 + <?php
  68 + foreach($specializations as $specialization) {
  69 + ?>
  70 + <li data-img="<?= $specialization->image ?>">
  71 + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#" data-id="<?= $specialization->specialization_id ?>" class="map_company_filter"><?= $specialization->specialization_name ?></a>
  72 + <ul>
  73 + <?php foreach($specialization->children as $child_first) { ?>
  74 + <li>
  75 + <a href="#" data-id="<?= $child_first->specialization_id ?>" class="map_company_filter"><?= $child_first->specialization_name ?></a>
  76 + <ul>
  77 + <?php foreach($child_first->children as $child_second) { ?>
  78 + <li>
  79 + <a href="#" title="<?= $child_second->specialization_name ?>" data-id="<?= $child_second->specialization_id ?>" class="map_company_filter"><?= $child_second->specialization_name ?></a>
  80 + </li>
  81 + <?php } ?>
  82 + </ul>
  83 + </li>
  84 + <?php } ?>
  85 + </ul>
  86 + </li>
  87 + <?php
  88 + }
  89 + ?>
211 90 </ul>
212   -
213 91 </div>
214 92 </div>
215 93 </div>
... ...
frontend/views/site/index.php
... ... @@ -10,26 +10,6 @@
10 10 $this->title = 'My Yii Application';
11 11 ?>
12 12 <div class="section-box-1">
13   - <?php
14   - /* Yarik map fun
15   - ?>
16   - <div id="map_test" style="width:100%;height:500px;">
17   -
18   - </div>
19   - <script>
20   - $(function() {
21   - initMap();
22   - });
23   - var map;
24   - function initMap() {
25   - map = new google.maps.Map(document.getElementById('map_test'), {
26   - center: {lat: -34.397, lng: 150.644},
27   - zoom: 8
28   - })
29   - }
30   - </script>
31   - */
32   - ?>
33 13 <div class="box-wr">
34 14 <div class="box-all">
35 15 <div class="section-box-base">
... ... @@ -107,134 +87,15 @@
107 87 <div class="all-project-home-title_menu">
108 88 <p>ะŸั€ะพะตะบั‚ั‹ ะฝะฐ ะฝะฐัˆะตะผ ัะฐะนั‚ะต</p>
109 89 <ul>
110   - <li class="project-home-active"><span>ะขะตะบัƒั‰ะธะต</span></li>
111   - <li><span>ะ—ะฐะฒะตั€ัˆะตะฝะฝั‹ะต</span></li>
  90 + <li class="project-home-active main_map_link" data-action="project"><span>ะขะตะบัƒั‰ะธะต</span></li>
  91 + <li class="main_map_link" data-action="portfolio"><span>ะ—ะฐะฒะตั€ัˆะตะฝะฝั‹ะต</span></li>
112 92 </ul>
113 93 </div>
114 94 </div>
115 95 </div>
116 96 <div class="section-box-map">
117 97 <div class="shadow-map"></div>
118   - <div id="map_cloud" style="display: none;">
119   - <script type="text/javascript">
120   - // function initialize()
121   - // {
122   - // var start_position = new google.maps.LatLng('56', '30');
123   - // var settings = {
124   - // zoom : 7, scrollwheel : false, center : start_position,
125   - // mapTypeControl : false,
126   - // mapTypeControlOptions : {style : google.maps.MapTypeControlStyle.DROPDOWN_MENU},
127   - // navigationControl : false,
128   - // navigationControlOptions : {style : google.maps.NavigationControlStyle.SMALL},
129   - // scaleControl : false, streetViewControl : false, rotateControl : false,
130   - // zoomControl : true, mapTypeId : google.maps.MapTypeId.ROADMAP
131   - // };
132   - // var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
133   - //
134   - // var image1 = new google.maps.MarkerImage(
135   - // '/images/markers/marker-we-1.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
136   - // );
137   - // var image2 = new google.maps.MarkerImage(
138   - // '/images/markers/marker-we-2.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
139   - // );
140   - // var image3 = new google.maps.MarkerImage(
141   - // '/images/markers/marker-we-3.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
142   - // );
143   - // var image4 = new google.maps.MarkerImage(
144   - // '/images/markers/marker-we-4.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
145   - // );
146   - // var image5 = new google.maps.MarkerImage(
147   - // '/images/markers/marker-we-5.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
148   - // );
149   - // var image6 = new google.maps.MarkerImage(
150   - // '/images/markers/marker-we-6.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
151   - // );
152   - // var image7 = new google.maps.MarkerImage(
153   - // '/images/markers/marker-we-7.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
154   - // );
155   - // var image8 = new google.maps.MarkerImage(
156   - // '/images/markers/marker-we-8.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
157   - // );
158   - // var image9 = new google.maps.MarkerImage(
159   - // '/images/markers/marker-we-9.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
160   - // );
161   - // var image10 = new google.maps.MarkerImage(
162   - // '/images/markers/marker-empl-1.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
163   - // );
164   - // var image11 = new google.maps.MarkerImage(
165   - // '/images/markers/marker-empl-2.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
166   - // );
167   - // var image12 = new google.maps.MarkerImage(
168   - // '/images/markers/marker-empl-3.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
169   - // );
170   - // var image13 = new google.maps.MarkerImage(
171   - // '/images/markers/marker-empl-4.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
172   - // );
173   - // var image14 = new google.maps.MarkerImage(
174   - // '/images/markers/marker-empl-5.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
175   - // );
176   - // var image15 = new google.maps.MarkerImage(
177   - // '/images/markers/marker-empl-6.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
178   - // );
179   - // var image16 = new google.maps.MarkerImage(
180   - // '/images/markers/marker-empl-7.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
181   - // );
182   - // var image17 = new google.maps.MarkerImage(
183   - // '/images/markers/marker-empl-8.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
184   - // );
185   - // var image18 = new google.maps.MarkerImage(
186   - // '/images/markers/marker-empl-9.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35)
187   - // );
188   - //
189   - // var markers = [];
190   - //
191   - // var marker = new google.maps.Marker(
192   - // {
193   - // position : new google.maps.LatLng('56', '35.3'), map : map,
194   - // title : 'Marker Title2', icon : image1
195   - // }
196   - // );
197   - // markers.push(marker);
198   - //
199   - // var marker = new google.maps.Marker(
200   - // {
201   - // position : new google.maps.LatLng('56', '36'), map : map,
202   - // title : 'Marker Title2', icon : image2
203   - // }
204   - // );
205   - // markers.push(marker);
206   - //
207   - // var marker = new google.maps.Marker(
208   - // {
209   - // position : new google.maps.LatLng('56', '34.5'), map : map,
210   - // title : 'Marker Title3', icon : image18
211   - // }
212   - // );
213   - // markers.push(marker);
214   - //
215   - // var marker = new google.maps.Marker(
216   - // {
217   - // position : new google.maps.LatLng('56', '35'), map : map,
218   - // title : 'Marker Title4', icon : image13
219   - // }
220   - // );
221   - // markers.push(marker);
222   - //
223   - // var clusterStyles = [
224   - // {
225   - // url : '/images/markers/clasters.png', height : 36, width : 36
226   - // }
227   - //
228   - // ];
229   - // markerClusterer = new MarkerClusterer(
230   - // map, markers, {
231   - // maxZoom : 10, gridSize : 100, styles : clusterStyles
232   - // }
233   - // );
234   - // }
235   - </script>
236   - </div>
237   - <div id="map_canvas" style="width: 100%; height:100%;"></div>
  98 + <div id="map_main" style="width: 100%; height:100%;"></div>
238 99 </div>
239 100 </div>
240 101  
... ...
frontend/web/js/artbox.maps.js 0 โ†’ 100644
  1 +var company_map = [];
  2 +var main_map = [];
  3 +$(
  4 + function()
  5 + {
  6 + initMap(company_map);
  7 + initMainMap(main_map);
  8 + $(document).on(
  9 + 'click', '.map_company_filter', function(e)
  10 + {
  11 + e.preventDefault();
  12 + var id = $(this).data('id');
  13 + var user = $('#map_company').data('user');
  14 + $.ajax(
  15 + {
  16 + url : '/portfolio/portfolio',
  17 + data : {
  18 + user_id : user,
  19 + specialization_id : id,
  20 + start: company_map['start']
  21 + },
  22 + success : function(data)
  23 + {
  24 + if(data['result'].length > 0)
  25 + {
  26 + showMarkers(company_map, data['result']);
  27 + company_map['map'].fitBounds(company_map['bounds']);
  28 + } else
  29 + {
  30 + clearMap(company_map);
  31 + }
  32 + },
  33 + dataType : 'json'
  34 + }
  35 + );
  36 + }
  37 + );
  38 + $(document).on('click', '.company_map_time_link', function(e) {
  39 + e.preventDefault();
  40 + $('.company_map_time_link').removeClass('active');
  41 + $(this).addClass('active');
  42 + company_map['start'] = $(this).data('start');
  43 + });
  44 + $(document).on('click', '.main_map_link', function(e) {
  45 + e.preventDefault();
  46 + var action = $(this).data('action');
  47 + $.ajax(
  48 + {
  49 + url : '/'+action+'/'+action+'-all',
  50 + data : {},
  51 + success : function(data)
  52 + {
  53 + if(data['result'].length > 0)
  54 + {
  55 + showMarkers(main_map, data['result']);
  56 + main_map['map'].fitBounds(main_map['bounds']);
  57 + } else
  58 + {
  59 + clearMap(main_map);
  60 + }
  61 + },
  62 + dataType : 'json'
  63 + }
  64 + );
  65 + });
  66 + }
  67 +);
  68 +function showMarkers(variable, elements)
  69 +{
  70 + console.log(elements);
  71 + var position = {
  72 + lat : undefined,
  73 + lng : undefined
  74 + };
  75 + var color;
  76 + var title;
  77 + setMapOnAll(variable['markers'], null);
  78 + variable['markers'] = [];
  79 + if(variable['clusterer'] !== undefined)
  80 + {
  81 + variable['clusterer'].clearMarkers();
  82 + }
  83 + variable['bounds'] = new google.maps.LatLngBounds();
  84 + for(var i = 0; i < elements.length; i++)
  85 + {
  86 + position.lat = parseFloat(elements[i].lat);
  87 + position.lng = parseFloat(elements[i].lng);
  88 + title = elements[i].name;
  89 + if(elements[i].specializations !== null && elements[i].specializations !== undefined) {
  90 + color = elements[i].specializations[0].background;
  91 + }
  92 + icon = variable['icon'];
  93 + if(color !== null && color !== undefined)
  94 + {
  95 + icon.fillColor = color;
  96 + }
  97 + marker = new google.maps.Marker(
  98 + {
  99 + position : position,
  100 + title : title,
  101 + icon : icon
  102 + }
  103 + );
  104 + variable['markers'].push(marker);
  105 + variable['bounds'].extend(marker.getPosition());
  106 + }
  107 + setMapOnAll(variable['markers'], variable['map']);
  108 + replaceClusterer(variable);
  109 +}
  110 +function clearMap(variable) {
  111 + setMapOnAll(variable['markers'], null);
  112 + variable['markers'] = [];
  113 + if(variable['clusterer'] !== undefined)
  114 + {
  115 + variable['clusterer'].clearMarkers();
  116 + }
  117 +}
  118 +function replaceClusterer(variable)
  119 +{
  120 + if(variable['clusterer' !== undefined])
  121 + {
  122 + variable['clusterer'].clearMarkers();
  123 + }
  124 + variable['clusterer'] = new MarkerClusterer(
  125 + variable['map'], variable['markers'], {
  126 + maxZoom : 10,
  127 + gridSize : 100,
  128 + styles : variable['clusterer_style']
  129 + }
  130 + );
  131 +}
  132 +function setMapOnAll(markers, map)
  133 +{
  134 + for(var i = 0; i < markers.length; i++)
  135 + {
  136 + markers[i].setMap(map);
  137 + }
  138 +}
  139 +function initMap(variable)
  140 +{
  141 + if(document.getElementById('map_company') == null) {
  142 + return false;
  143 + }
  144 + variable['settings'] = {
  145 + zoom : 7,
  146 + scrollwheel : true,
  147 + maxZoom: 18,
  148 + center : {
  149 + "lat" : 50.4501,
  150 + "lng" : 30.5234
  151 + },
  152 + mapTypeControl : false,
  153 + mapTypeControlOptions : {style : google.maps.MapTypeControlStyle.DROPDOWN_MENU},
  154 + navigationControl : false,
  155 + navigationControlOptions : {style : google.maps.NavigationControlStyle.SMALL},
  156 + scaleControl : false,
  157 + streetViewControl : false,
  158 + rotateControl : false,
  159 + zoomControl : true,
  160 + mapTypeId : google.maps.MapTypeId.ROADMAP,
  161 + };
  162 + variable['map'] = new google.maps.Map(document.getElementById('map_company'), variable['settings']);
  163 + variable['markers'] = [];
  164 + variable['clusterer'] = undefined;
  165 + variable['icon'] = {
  166 + path : 'M0-48c-9.8 0-17.7 7.8-17.7 17.4 0 15.5 17.7 30.6 17.7 30.6s17.7-15.4 17.7-30.6c0-9.6-7.9-17.4-17.7-17.4z',
  167 + fillColor : 'white',
  168 + fillOpacity : 0.8,
  169 + scale : 0.5
  170 + };
  171 + variable['clusterer_style'] = [
  172 + {
  173 + url : '/images/markers/clasters.png',
  174 + height : 36,
  175 + width : 36
  176 + }
  177 + ];
  178 + variable['bounds'] = new google.maps.LatLngBounds();
  179 + variable['start'] = $('.company_map_time_link.active').data('start');
  180 + $.ajax(
  181 + {
  182 + url : '/portfolio/portfolio',
  183 + data : {
  184 + user_id : $('#map_company').data('user')
  185 + },
  186 + success : function(data)
  187 + {
  188 + if(data['result'].length > 0)
  189 + {
  190 + showMarkers(company_map, data['result']);
  191 + company_map['map'].fitBounds(company_map['bounds']);
  192 + } else
  193 + {
  194 + clearMap(company_map);
  195 + }
  196 + },
  197 + dataType : 'json'
  198 + }
  199 + );
  200 +}
  201 +function initMainMap(variable)
  202 +{
  203 + if(document.getElementById('map_main') == null) {
  204 + return false;
  205 + }
  206 + variable['settings'] = {
  207 + zoom : 7,
  208 + scrollwheel : true,
  209 + maxZoom: 18,
  210 + center : {
  211 + "lat" : 50.4501,
  212 + "lng" : 30.5234
  213 + },
  214 + mapTypeControl : false,
  215 + mapTypeControlOptions : {style : google.maps.MapTypeControlStyle.DROPDOWN_MENU},
  216 + navigationControl : false,
  217 + navigationControlOptions : {style : google.maps.NavigationControlStyle.SMALL},
  218 + scaleControl : false,
  219 + streetViewControl : false,
  220 + rotateControl : false,
  221 + zoomControl : true,
  222 + mapTypeId : google.maps.MapTypeId.ROADMAP
  223 + };
  224 + variable['map'] = new google.maps.Map(document.getElementById('map_main'), variable['settings']);
  225 + variable['markers'] = [];
  226 + variable['clusterer'] = undefined;
  227 + variable['icon'] = {
  228 + path : 'M0-48c-9.8 0-17.7 7.8-17.7 17.4 0 15.5 17.7 30.6 17.7 30.6s17.7-15.4 17.7-30.6c0-9.6-7.9-17.4-17.7-17.4z',
  229 + fillColor : 'white',
  230 + fillOpacity : 0.8,
  231 + scale : 0.5
  232 + };
  233 + variable['clusterer_style'] = [
  234 + {
  235 + url : '/images/markers/clasters.png',
  236 + height : 36,
  237 + width : 36
  238 + }
  239 + ];
  240 + variable['bounds'] = new google.maps.LatLngBounds();
  241 + $.ajax(
  242 + {
  243 + url : '/project/project-all',
  244 + data : {},
  245 + success : function(data)
  246 + {
  247 + if(data['result'].length > 0)
  248 + {
  249 + showMarkers(main_map, data['result']);
  250 + main_map['map'].fitBounds(main_map['bounds']);
  251 + } else
  252 + {
  253 + clearMap(main_map);
  254 + }
  255 + },
  256 + dataType : 'json'
  257 + }
  258 + );
  259 +}
0 260 \ No newline at end of file
... ...
frontend/web/js/no-comprss/script-nocompress.js
... ... @@ -165,23 +165,23 @@ $(document).ready(function(){
165 165 });
166 166 }
167 167  
168   - function newMenuMap(){
169   - $('.company-performer-map-menu .content-menu-first>li>ul').addClass('content-menu-map-first');
170   - $('.company-performer-map-menu .content-menu-first>li>ul>li').addClass('content-menu-map-second');
171   - $('.company-performer-map-menu .content-menu-first>li').addClass('old-content-menu-map-zero');
172   - $('.company-performer-map-menu .content-menu-map-first').parent().removeClass('old-content-menu-map-zero').addClass('content-menu-map-zero');
173   - $('.company-performer-map-menu .content-menu-map-zero').click(function(e){
174   - e.preventDefault();
175   - });
176   - $('.company-performer-map-menu .content-menu-map-second, .company-performer-map-menu .old-content-menu-map-zero').click(function(e){
177   - e.preventDefault()
178   - $.post("maps/maps.php", function (data) {
179   - $("#map_cloud").empty();
180   - $("#map_cloud").append(data);
181   - initialize();
182   - });
183   - });
184   - }
  168 +// function newMenuMap(){
  169 +// $('.company-performer-map-menu .content-menu-first>li>ul').addClass('content-menu-map-first');
  170 +// $('.company-performer-map-menu .content-menu-first>li>ul>li').addClass('content-menu-map-second');
  171 +// $('.company-performer-map-menu .content-menu-first>li').addClass('old-content-menu-map-zero');
  172 +// $('.company-performer-map-menu .content-menu-map-first').parent().removeClass('old-content-menu-map-zero').addClass('content-menu-map-zero');
  173 +// $('.company-performer-map-menu .content-menu-map-zero').click(function(e){
  174 +// e.preventDefault();
  175 +// });
  176 +// $('.company-performer-map-menu .content-menu-map-second, .company-performer-map-menu .old-content-menu-map-zero').click(function(e){
  177 +// e.preventDefault()
  178 +// $.post("maps/maps.php", function (data) {
  179 +// $("#map_cloud").empty();
  180 +// $("#map_cloud").append(data);
  181 +// initialize();
  182 +// });
  183 +// });
  184 +// }
185 185  
186 186 function projectAllMenu() {
187 187 $('.all-project-home-title_menu li').click(function(){
... ... @@ -190,28 +190,27 @@ $(document).ready(function(){
190 190 })
191 191 }
192 192  
193   - function mapLoad(){
194   - $('.settings-map-ul ul li a').click(function (e) {
195   - e.preventDefault();
196   - $('.settings-map-ul ul li a').removeClass('active')
197   - $(this).addClass('active')
198   - $.post("maps/maps.php", function (data) {
199   - $("#map_cloud").empty();
200   - $("#map_cloud").append(data);
201   - initialize();
202   - });
203   - });
204   - }
205   - mapLoadNewMenus()
206   - function mapLoadNewMenus(){
207   - $('.all-project-home-title_menu ul li').click(function () {
208   - $.post("maps/maps.php", function (data) {
209   - $("#map_cloud").empty();
210   - $("#map_cloud").append(data);
211   - initialize();
212   - });
213   - });
214   - }
  193 +// function mapLoad(){
  194 +// $('.settings-map-ul ul li a').click(function (e) {
  195 +// e.preventDefault();
  196 +// $('.settings-map-ul ul li a').removeClass('active')
  197 +// $(this).addClass('active')
  198 +// $.post("maps/maps.php", function (data) {
  199 +// $("#map_cloud").empty();
  200 +// $("#map_cloud").append(data);
  201 +// initialize();
  202 +// });
  203 +// });
  204 +// }
  205 +// mapLoadNewMenus()
  206 +// $('.all-project-home-title_menu ul li').click(function () {
  207 +// $.post("maps/maps.php", function (data) {
  208 +// $("#map_cloud").empty();
  209 +// $("#map_cloud").append(data);
  210 +// initialize();
  211 +// });
  212 +// });
  213 +// }
215 214  
216 215 function federationHome(){
217 216 var menu_width = 0;
... ...
frontend/web/js/script.js
... ... @@ -11,7 +11,7 @@ $(document).ready(
11 11 scrolling();
12 12 menuBg();
13 13 projectAllMenu();
14   - mapLoad();
  14 +// mapLoad();
15 15 federationHome();
16 16 //validationForms();
17 17 //menuContent();
... ... @@ -19,7 +19,7 @@ $(document).ready(
19 19 box15Height();
20 20 formRezume();
21 21 fileVal();
22   - newMenuMap();
  22 + //newMenuMap();
23 23 seeAllComm();
24 24 gallerPage();
25 25 selectAfter();
... ... @@ -214,33 +214,33 @@ $(document).ready(
214 214 );
215 215 }
216 216  
217   - function newMenuMap()
218   - {
219   - $('.company-performer-map-menu .content-menu-first>li>ul').addClass('content-menu-map-first');
220   - $('.company-performer-map-menu .content-menu-first>li>ul>li').addClass('content-menu-map-second');
221   - $('.company-performer-map-menu .content-menu-first>li').addClass('old-content-menu-map-zero');
222   - $('.company-performer-map-menu .content-menu-map-first').parent().removeClass('old-content-menu-map-zero').addClass('content-menu-map-zero');
223   - $('.company-performer-map-menu .content-menu-map-zero').click(
224   - function(e)
225   - {
226   - e.preventDefault();
227   - }
228   - );
229   - $('.company-performer-map-menu .content-menu-map-second, .company-performer-map-menu .old-content-menu-map-zero').click(
230   - function(e)
231   - {
232   - e.preventDefault()
233   - $.post(
234   - "maps/maps.php", function(data)
235   - {
236   - $("#map_cloud").empty();
237   - $("#map_cloud").append(data);
238   - initialize();
239   - }
240   - );
241   - }
242   - );
243   - }
  217 +// function newMenuMap()
  218 +// {
  219 +// $('.company-performer-map-menu .content-menu-first>li>ul').addClass('content-menu-map-first');
  220 +// $('.company-performer-map-menu .content-menu-first>li>ul>li').addClass('content-menu-map-second');
  221 +// $('.company-performer-map-menu .content-menu-first>li').addClass('old-content-menu-map-zero');
  222 +// $('.company-performer-map-menu .content-menu-map-first').parent().removeClass('old-content-menu-map-zero').addClass('content-menu-map-zero');
  223 +// $('.company-performer-map-menu .content-menu-map-zero').click(
  224 +// function(e)
  225 +// {
  226 +// e.preventDefault();
  227 +// }
  228 +// );
  229 +// $('.company-performer-map-menu .content-menu-map-second, .company-performer-map-menu .old-content-menu-map-zero').click(
  230 +// function(e)
  231 +// {
  232 +// e.preventDefault()
  233 +// $.post(
  234 +// "maps/maps.php", function(data)
  235 +// {
  236 +// $("#map_cloud").empty();
  237 +// $("#map_cloud").append(data);
  238 +// initialize();
  239 +// }
  240 +// );
  241 +// }
  242 +// );
  243 +// }
244 244  
245 245 function projectAllMenu()
246 246 {
... ... @@ -253,43 +253,43 @@ $(document).ready(
253 253 )
254 254 }
255 255  
256   - function mapLoad()
257   - {
258   - $('.settings-map-ul ul li a').click(
259   - function(e)
260   - {
261   - e.preventDefault();
262   - $('.settings-map-ul ul li a').removeClass('active')
263   - $(this).addClass('active')
264   - $.post(
265   - "maps/maps.php", function(data)
266   - {
267   - $("#map_cloud").empty();
268   - $("#map_cloud").append(data);
269   - initialize();
270   - }
271   - );
272   - }
273   - );
274   - }
275   -
276   - mapLoadNewMenus()
277   - function mapLoadNewMenus()
278   - {
279   - $('.all-project-home-title_menu ul li').click(
280   - function()
281   - {
282   - $.post(
283   - "maps/maps.php", function(data)
284   - {
285   - $("#map_cloud").empty();
286   - $("#map_cloud").append(data);
287   - initialize();
288   - }
289   - );
290   - }
291   - );
292   - }
  256 +// function mapLoad()
  257 +// {
  258 +// $('.settings-map-ul ul li a').click(
  259 +// function(e)
  260 +// {
  261 +// e.preventDefault();
  262 +// $('.settings-map-ul ul li a').removeClass('active')
  263 +// $(this).addClass('active')
  264 +// $.post(
  265 +// "maps/maps.php", function(data)
  266 +// {
  267 +// $("#map_cloud").empty();
  268 +// $("#map_cloud").append(data);
  269 +// initialize();
  270 +// }
  271 +// );
  272 +// }
  273 +// );
  274 +// }
  275 +//
  276 +// mapLoadNewMenus()
  277 +// function mapLoadNewMenus()
  278 +// {
  279 +// $('.all-project-home-title_menu ul li').click(
  280 +// function()
  281 +// {
  282 +// $.post(
  283 +// "maps/maps.php", function(data)
  284 +// {
  285 +// $("#map_cloud").empty();
  286 +// $("#map_cloud").append(data);
  287 +// initialize();
  288 +// }
  289 +// );
  290 +// }
  291 +// );
  292 +// }
293 293  
294 294 function federationHome()
295 295 {
... ...