Commit ad6304d6d4477d80e00bc9ba96763d8b321d6c3a
1 parent
cda2c1c9
test
Showing
4 changed files
with
464 additions
and
164 deletions
Show diff stats
common/models/Project.php
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use Yii; | |
6 | + use yii\base\Model; | |
7 | + use yii\data\ActiveDataProvider; | |
8 | + | |
9 | + /** | |
10 | + * TenderSearch represents the model behind the search form about `common\models\UserInfo`. | |
11 | + */ | |
12 | + class TenderSearch extends Project | |
13 | + { | |
14 | + | |
15 | + public $specialization; | |
16 | + | |
17 | + public $city; | |
18 | + | |
19 | + public $budget_from; | |
20 | + | |
21 | + public $budget_to; | |
22 | + | |
23 | + public $budget_currency; | |
24 | + | |
25 | + public $contractual; | |
26 | + | |
27 | + public $payment; | |
28 | + | |
29 | + /** | |
30 | + * @inheritdoc | |
31 | + */ | |
32 | + public function rules() | |
33 | + { | |
34 | + return [ | |
35 | + [ | |
36 | + [ | |
37 | + 'specialization', | |
38 | + 'budget_currency', | |
39 | + 'contractual', | |
40 | + ], | |
41 | + 'integer', | |
42 | + ], | |
43 | + [ | |
44 | + [ | |
45 | + 'city', | |
46 | + 'payment', | |
47 | + ], | |
48 | + 'safe', | |
49 | + ], | |
50 | + [ | |
51 | + [ | |
52 | + 'budget_from', | |
53 | + 'budget_to', | |
54 | + ], | |
55 | + 'number', | |
56 | + 'min' => 0, | |
57 | + ], | |
58 | + [ | |
59 | + [ | |
60 | + 'payment', | |
61 | + ], | |
62 | + 'default', | |
63 | + 'value' => Payment::find() | |
64 | + ->asArray() | |
65 | + ->column(), | |
66 | + ], | |
67 | + [ | |
68 | + [ | |
69 | + 'budget_currency', | |
70 | + ], | |
71 | + 'default', | |
72 | + 'value' => 3, | |
73 | + ], | |
74 | + ]; | |
75 | + } | |
76 | + | |
77 | + /** | |
78 | + * @inheritdoc | |
79 | + */ | |
80 | + public function attributeLabels() | |
81 | + { | |
82 | + return [ | |
83 | + 'specialization' => Yii::t('app', 'Специализация'), | |
84 | + 'budget_currency' => Yii::t('app', 'Валюта'), | |
85 | + 'contractual' => Yii::t('app', 'Договорной'), | |
86 | + 'city' => Yii::t('app', 'Город'), | |
87 | + 'payment' => Yii::t('app', 'Способ оплаты'), | |
88 | + 'budget_from' => Yii::t('app', 'от'), | |
89 | + 'budget_to' => Yii::t('app', 'до'), | |
90 | + ]; | |
91 | + } | |
92 | + | |
93 | + /** | |
94 | + * @inheritdoc | |
95 | + */ | |
96 | + public function scenarios() | |
97 | + { | |
98 | + // bypass scenarios() implementation in the parent class | |
99 | + return Model::scenarios(); | |
100 | + } | |
101 | + | |
102 | + /** | |
103 | + * Creates data provider instance with search query applied | |
104 | + * | |
105 | + * @param array $params | |
106 | + * | |
107 | + * @return ActiveDataProvider | |
108 | + */ | |
109 | + public function search($params) | |
110 | + { | |
111 | + $query = Project::find() | |
112 | + ->joinWith('projectSpecializations') | |
113 | + ->joinWith('projectPayments'); | |
114 | + | |
115 | + $dataProvider = new ActiveDataProvider([ | |
116 | + 'query' => $query, | |
117 | + ]); | |
118 | + | |
119 | + /*$dataProvider->setSort([ | |
120 | + 'defaultOrder' => [ | |
121 | + 'name' => SORT_ASC, | |
122 | + ], | |
123 | + 'attributes' => [ | |
124 | + 'name' => [ | |
125 | + 'asc' => [ | |
126 | + 'company_info.name' => SORT_ASC, | |
127 | + 'firstname' => SORT_ASC, | |
128 | + 'lastname' => SORT_ASC, | |
129 | + ], | |
130 | + 'desc' => [ | |
131 | + 'company_info.name' => SORT_DESC, | |
132 | + 'firstname' => SORT_DESC, | |
133 | + 'lastname' => SORT_DESC, | |
134 | + ], | |
135 | + 'default' => SORT_ASC, | |
136 | + 'label' => 'Название', | |
137 | + ], | |
138 | + 'staff' => [ | |
139 | + 'asc' => [ | |
140 | + 'company_info.staff' => SORT_ASC, | |
141 | + ], | |
142 | + 'desc' => [ | |
143 | + 'company_info.staff' => SORT_DESC, | |
144 | + ], | |
145 | + 'default' => SORT_DESC, | |
146 | + 'label' => 'Количество сотрудников', | |
147 | + ], | |
148 | + 'visit' => [ | |
149 | + 'asc' => [ | |
150 | + 'user_info.date_visit' => SORT_ASC, | |
151 | + ], | |
152 | + 'desc' => [ | |
153 | + 'user_info.date_visit' => SORT_DESC, | |
154 | + ], | |
155 | + 'default' => SORT_DESC, | |
156 | + 'label' => 'Последний визит', | |
157 | + ], | |
158 | + 'city' => [ | |
159 | + 'asc' => [ | |
160 | + 'user_info.city' => SORT_ASC, | |
161 | + ], | |
162 | + 'desc' => [ | |
163 | + 'user_info.city' => SORT_DESC, | |
164 | + ], | |
165 | + 'default' => SORT_ASC, | |
166 | + 'label' => 'Город', | |
167 | + ], | |
168 | + ], | |
169 | + ]);*/ | |
170 | + | |
171 | + $this->load($params); | |
172 | + | |
173 | + if(!$this->validate()) { | |
174 | + // uncomment the following line if you do not want to return any records when validation fails | |
175 | + // $query->where('0=1'); | |
176 | + return $dataProvider; | |
177 | + } | |
178 | + | |
179 | + $query->distinct(true); | |
180 | + | |
181 | + $query->andWhere([ | |
182 | + '>=', | |
183 | + 'date_end', | |
184 | + date('Y-m-d'), | |
185 | + ]); | |
186 | + | |
187 | + $query->andFilterWhere([ | |
188 | + 'project_specialization.specialization_id' => $this->specialization, | |
189 | + 'project_payment.payment_id' => $this->payment, | |
190 | + 'city' => $this->city, | |
191 | + ]) | |
192 | + ->andWhere([ | |
193 | + 'project_payment.payment_id' => $this->payment, | |
194 | + ]); | |
195 | + | |
196 | + if(!empty( $this->contractual )) { | |
197 | + $query->andWhere([ | |
198 | + 'contractual' => $this->contractual, | |
199 | + ]); | |
200 | + } else { | |
201 | + $currencies = Currency::find() | |
202 | + ->select([ | |
203 | + 'rate', | |
204 | + 'currency_id', | |
205 | + ]) | |
206 | + ->asArray() | |
207 | + ->indexBy('currency_id') | |
208 | + ->column(); | |
209 | + | |
210 | + if(!empty($this->budget_from) && !empty($this->budget_to)) { | |
211 | + $query->andFilterWhere([ | |
212 | + 'between', | |
213 | + 'total_budget', | |
214 | + $this->budget_from * $currencies[ $this->budget_currency ], | |
215 | + $this->budget_to * $currencies[ $this->budget_currency ], | |
216 | + ]); | |
217 | + } elseif(!empty($this->budget_from)) { | |
218 | + $query->andFilterWhere([ | |
219 | + '>=', | |
220 | + 'total_budget', | |
221 | + $this->budget_from * $currencies[ $this->budget_currency ], | |
222 | + ]); | |
223 | + } elseif(!empty($this->budget_to)) { | |
224 | + $query->andFilterWhere([ | |
225 | + '<=', | |
226 | + 'total_budget', | |
227 | + $this->budget_to * $currencies[ $this->budget_currency ], | |
228 | + ]); | |
229 | + } | |
230 | + | |
231 | + } | |
232 | + | |
233 | + return $dataProvider; | |
234 | + } | |
235 | + } | ... | ... |
frontend/controllers/SearchController.php
1 | 1 | <?php |
2 | 2 | namespace frontend\controllers; |
3 | 3 | |
4 | +use common\models\Currency; | |
4 | 5 | use common\models\CustomerSearch; |
6 | +use common\models\Payment; | |
5 | 7 | use common\models\Project; |
6 | 8 | use common\models\Specialization; |
9 | +use common\models\TenderSearch; | |
7 | 10 | use common\models\UserInfo; |
8 | 11 | use common\models\Vacancy; |
9 | 12 | use frontend\models\SearchPerformerForm; |
... | ... | @@ -58,14 +61,20 @@ use common\models\Social; |
58 | 61 | |
59 | 62 | public function actionProject() |
60 | 63 | { |
61 | - $projects = new ActiveDataProvider([ | |
62 | - 'query' => Project::find(), | |
63 | - 'pagination' => [ | |
64 | - 'pageSize' => 9, | |
65 | - ], | |
64 | + $model = new TenderSearch(); | |
65 | + $dataProvider = $model->search(Yii::$app->request->queryParams); | |
66 | + $dataProvider->setPagination([ | |
67 | + 'pageSize' => 10, | |
66 | 68 | ]); |
69 | + $specialization = Specialization::specializationsList(); | |
70 | + $currencies = Currency::getCurrencyDropdown(); | |
71 | + $payments = Payment::find()->select(['name', 'payment_id'])->asArray()->indexBy('payment_id')->column(); | |
67 | 72 | return $this->render('project', [ |
68 | - 'projects' => $projects, | |
73 | + 'model' => $model, | |
74 | + 'dataProvider' => $dataProvider, | |
75 | + 'specialization' => $specialization, | |
76 | + 'currencies' => $currencies, | |
77 | + 'payments' => $payments, | |
69 | 78 | ]); |
70 | 79 | } |
71 | 80 | ... | ... |
frontend/views/search/project.php
1 | 1 | <?php |
2 | + /** | |
3 | + * @var View $this | |
4 | + * @var TenderSearch $model | |
5 | + * @var ActiveDataProvider $dataProvider | |
6 | + * @var array $specialization | |
7 | + * @var array $currencies | |
8 | + * @var array $payments | |
9 | + */ | |
10 | + use common\models\TenderSearch; | |
11 | + use kartik\select2\Select2; | |
12 | + use yii\data\ActiveDataProvider; | |
13 | + use \yii\helpers\Html; | |
14 | + use yii\web\JsExpression; | |
15 | + use yii\web\View; | |
16 | + use yii\widgets\ActiveForm; | |
17 | + use yii\widgets\ListView; | |
2 | 18 | |
3 | -use \yii\helpers\Html; | |
4 | -use yii\widgets\ListView; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $projects yii\data\ActiveDataProvider */ | |
8 | - | |
9 | -$this->title = 'My Yii Application'; | |
19 | + $this->title = 'My Yii Application'; | |
10 | 20 | ?> |
11 | 21 | |
12 | 22 | <div class="section-box content"> |
... | ... | @@ -14,6 +24,82 @@ $this->title = 'My Yii Application'; |
14 | 24 | <div class="box-wr"> |
15 | 25 | <div class="box-all"> |
16 | 26 | <div class="left-search-work"> |
27 | + <?php | |
28 | + $form = ActiveForm::begin([ | |
29 | + 'method' => 'get', | |
30 | + 'options' => [ 'class' => 'search-work-form' ], | |
31 | + 'action' => [ '' ], | |
32 | + ]); | |
33 | + echo $form->field($model, 'specialization') | |
34 | + ->dropDownList($specialization, [ 'prompt' => 'Любая' ]); | |
35 | + | |
36 | + echo $form->field($model, 'city') | |
37 | + ->widget(Select2::classname(), [ | |
38 | + 'options' => [ 'placeholder' => 'Выбор города ...' ], | |
39 | + 'pluginOptions' => [ | |
40 | + 'allowClear' => true, | |
41 | + 'minimumInputLength' => 3, | |
42 | + 'ajax' => [ | |
43 | + 'url' => \yii\helpers\Url::to([ 'site/city' ]), | |
44 | + 'dataType' => 'json', | |
45 | + 'data' => new JsExpression('function(params) { return {q:params.term}; }'), | |
46 | + ], | |
47 | + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), | |
48 | + 'templateResult' => new JsExpression('function(city) { return city.text; }'), | |
49 | + 'templateSelection' => new JsExpression('function (city) { return city.text; }'), | |
50 | + ], | |
51 | + ]); | |
52 | + | |
53 | + ?> | |
54 | + <div class="blocks-check-list-wrapp"> | |
55 | + <div class="blocks-check-title">Бюджет</div> | |
56 | + <div class="form-price-wr"> | |
57 | + <?= $form->field($model, 'budget_from', [ | |
58 | + 'template' => "{input}\n{error}", | |
59 | + 'options' => [ 'tag' => 'span' ], | |
60 | + ]) | |
61 | + ->textInput([ 'placeholder' => $model->getAttributeLabel('budget_from') ]) ?> | |
62 | + <?= $form->field($model, 'budget_to', [ | |
63 | + 'template' => "{input}\n{error}", | |
64 | + 'options' => [ 'tag' => 'span' ], | |
65 | + ]) | |
66 | + ->textInput([ 'placeholder' => $model->getAttributeLabel('budget_to') ]) ?> | |
67 | + <?= $form->field($model, 'budget_currency', [ | |
68 | + 'template' => "{input}\n{error}", | |
69 | + 'options' => [ 'class' => 'blocks-check-list-wrapp check-valuta' ], | |
70 | + ]) | |
71 | + ->dropDownList($currencies) ?> | |
72 | + </div> | |
73 | + <?= $form->field($model, 'contractual', [ 'template' => "{input}\n{error}", 'options' => ['class' => ''] ]) | |
74 | + ->checkboxList([1 => $model->getAttributeLabel('contractual')], [ | |
75 | + 'item' => function($index, $label, $name, $checked, $value) { | |
76 | + $return = '<div class="blocks-check-list" style="margin-bottom: 3px">'; | |
77 | + $return .= '<input type="checkbox" '.($checked ? "checked" : "" ).' name="' . $name . '" class="check-search" value="' . $value . '" id="theme-'.$index.'">'; | |
78 | + $return .= '<label for="theme-'.$index.'"><span></span>'.$label.'</label>'; | |
79 | + $return .= '</div>'; | |
80 | + return $return; | |
81 | + } | |
82 | + ]); ?> | |
83 | + <?= $form->field($model, 'payment', [ 'template' => "{input}\n{error}" ]) | |
84 | + ->checkboxList($payments, [ | |
85 | + 'item' => function($index, $label, $name, $checked, $value) { | |
86 | + $return = '<div class="blocks-check-list">'; | |
87 | + $return .= '<input type="checkbox" '.($checked ? "checked" : "" ).' name="' . $name . '" class="check-search" value="' . $value . '" id="theme-'.$index.'">'; | |
88 | + $return .= '<label for="theme-'.$index.'"><span></span>'.$label.'</label>'; | |
89 | + $return .= '</div>'; | |
90 | + return $return; | |
91 | + } | |
92 | + ]); ?> | |
93 | + </div> | |
94 | + <div class="blocks-check-list-submit"> | |
95 | + <?php | |
96 | + echo Html::submitInput('Найти'); | |
97 | + ?> | |
98 | + </div> | |
99 | + <?php | |
100 | + $form->end(); | |
101 | + /* | |
102 | + ?> | |
17 | 103 | <form action="" class="search-work-form"> |
18 | 104 | |
19 | 105 | <div class="blocks-check-list-wrapp"> |
... | ... | @@ -47,7 +133,7 @@ $this->title = 'My Yii Application'; |
47 | 133 | <div class="blocks-check-title">Регион</div> |
48 | 134 | <select> |
49 | 135 | <option selected value="">Все страны</option> |
50 | - <option style="color: #000; font-weight: bold !important;" value="">Украина</option> | |
136 | + <option style="color: #000; font-weight: bold !important;" value="">Украина</option> | |
51 | 137 | <option value="">Россия</option> |
52 | 138 | <option value="">Белорусь</option> |
53 | 139 | </select> |
... | ... | @@ -98,17 +184,16 @@ $this->title = 'My Yii Application'; |
98 | 184 | <input type="submit" value="Найти"/> |
99 | 185 | </div> |
100 | 186 | </form> |
187 | + */?> | |
101 | 188 | </div> |
102 | 189 | <div class="right-search-work"> |
103 | - <div class="search-worker-title style">Сейчас <?= $projects->totalCount ?> предложений</div> | |
190 | + <div class="search-worker-title style">Сейчас <?= $dataProvider->totalCount ?> предложений</div> | |
104 | 191 | <div class="search-profile-blocks-wr style"> |
105 | - <?= | |
106 | - ListView::widget( [ | |
107 | - 'dataProvider' => $projects, | |
108 | - 'itemView'=>'_projects_list_view', | |
109 | - 'layout' => "{items}\n<div class='navi-buttons-wr style navi-buttons-yet-wr'>{pager}</div>" | |
110 | - ] ); | |
111 | - ?> | |
192 | + <?= ListView::widget([ | |
193 | + 'dataProvider' => $dataProvider, | |
194 | + 'itemView' => '_projects_list_view', | |
195 | + 'layout' => "{items}\n<div class='navi-buttons-wr style navi-buttons-yet-wr'>{pager}</div>", | |
196 | + ]); ?> | |
112 | 197 | </div> |
113 | 198 | |
114 | 199 | </div> |
... | ... | @@ -122,191 +207,164 @@ $this->title = 'My Yii Application'; |
122 | 207 | <div class="map-settings-wrapp"> |
123 | 208 | <div class="min_markers-wrapp"> |
124 | 209 | <ul class="min_markers"> |
125 | - <li class="active_m"><span></span><p>Все</p></li> | |
126 | - <li><span><img src="/images/markers/marker-min-1.png"/></span><p>Жилые</p></li> | |
127 | - <li><span><img src="/images/markers/marker-min-2.png"/></span><p>Офисные</p></li> | |
128 | - <li><span><img src="/images/markers/marker-min-3.png"/></span><p>Торговые</p></li> | |
129 | - <li><span><img src="/images/markers/marker-min-4.png"/></span><p>Мосты</p></li> | |
130 | - <li><span><img src="/images/markers/marker-min-5.png"/></span><p>Дороги</p></li> | |
131 | - <li><span><img src="/images/markers/marker-min-6.png"/></span><p>Сооружения</p></li> | |
132 | - <li><span><img src="/images/markers/marker-min-7.png"/></span><p>Склады</p></li> | |
133 | - <li><span><img src="/images/markers/marker-min-8.png"/></span><p>Заводы</p></li> | |
134 | - <li><span><img src="/images/markers/marker-min-9.png"/></span><p>Разное</p></li> | |
210 | + <li class="active_m"><span></span> | |
211 | + <p>Все</p></li> | |
212 | + <li><span><img src="/images/markers/marker-min-1.png"/></span> | |
213 | + <p>Жилые</p></li> | |
214 | + <li><span><img src="/images/markers/marker-min-2.png"/></span> | |
215 | + <p>Офисные</p></li> | |
216 | + <li><span><img src="/images/markers/marker-min-3.png"/></span> | |
217 | + <p>Торговые</p></li> | |
218 | + <li><span><img src="/images/markers/marker-min-4.png"/></span> | |
219 | + <p>Мосты</p></li> | |
220 | + <li><span><img src="/images/markers/marker-min-5.png"/></span> | |
221 | + <p>Дороги</p></li> | |
222 | + <li><span><img src="/images/markers/marker-min-6.png"/></span> | |
223 | + <p>Сооружения</p></li> | |
224 | + <li><span><img src="/images/markers/marker-min-7.png"/></span> | |
225 | + <p>Склады</p></li> | |
226 | + <li><span><img src="/images/markers/marker-min-8.png"/></span> | |
227 | + <p>Заводы</p></li> | |
228 | + <li><span><img src="/images/markers/marker-min-9.png"/></span> | |
229 | + <p>Разное</p></li> | |
135 | 230 | </ul> |
136 | 231 | <ul class="min_markers_two"> |
137 | - <li><span><img src="/images/markers/marker-min-10.png"/></span><p>проекты</p></li> | |
138 | - <li><span><img src="/images/markers/marker-min-11.png"/></span><p>подряды</p></li> | |
232 | + <li><span><img src="/images/markers/marker-min-10.png"/></span> | |
233 | + <p>проекты</p></li> | |
234 | + <li><span><img src="/images/markers/marker-min-11.png"/></span> | |
235 | + <p>подряды</p></li> | |
139 | 236 | </ul> |
140 | 237 | </div> |
141 | 238 | </div> |
142 | 239 | <div class="slider-map"></div> |
143 | 240 | <div id="map_cloud" style="display: none;"> |
144 | 241 | <script type="text/javascript"> |
145 | - function initialize() { | |
242 | + function initialize() | |
243 | + { | |
146 | 244 | var start_position = new google.maps.LatLng('56', '30'); |
147 | 245 | var settings = { |
148 | - zoom: 7, | |
149 | - // scrollwheel: false, | |
150 | - center: start_position, | |
151 | - mapTypeControl: false, | |
152 | - mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, | |
153 | - navigationControl: false, | |
154 | - navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, | |
155 | - scaleControl: false, | |
156 | - streetViewControl: false, | |
157 | - rotateControl: false, | |
158 | - zoomControl: false, | |
159 | - mapTypeId: google.maps.MapTypeId.ROADMAP}; | |
246 | + zoom : 7, // scrollwheel: false, | |
247 | + center : start_position, mapTypeControl : false, | |
248 | + mapTypeControlOptions : {style : google.maps.MapTypeControlStyle.DROPDOWN_MENU}, | |
249 | + navigationControl : false, | |
250 | + navigationControlOptions : {style : google.maps.NavigationControlStyle.SMALL}, | |
251 | + scaleControl : false, streetViewControl : false, rotateControl : false, | |
252 | + zoomControl : false, mapTypeId : google.maps.MapTypeId.ROADMAP | |
253 | + }; | |
160 | 254 | var map = new google.maps.Map(document.getElementById("map_canvas"), settings); |
161 | 255 | |
162 | - | |
163 | - var image1 = new google.maps.MarkerImage('/images/markers/marker-we-1.png', | |
164 | - new google.maps.Size(21, 32), | |
165 | - new google.maps.Point(0,0), | |
166 | - new google.maps.Point(16, 35) | |
256 | + var image1 = new google.maps.MarkerImage( | |
257 | + '/images/markers/marker-we-1.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
167 | 258 | ); |
168 | - var image2 = new google.maps.MarkerImage('/images/markers/marker-we-2.png', | |
169 | - new google.maps.Size(21, 32), | |
170 | - new google.maps.Point(0,0), | |
171 | - new google.maps.Point(16, 35) | |
259 | + var image2 = new google.maps.MarkerImage( | |
260 | + '/images/markers/marker-we-2.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
172 | 261 | ); |
173 | - var image3 = new google.maps.MarkerImage('/images/markers/marker-we-3.png', | |
174 | - new google.maps.Size(21, 32), | |
175 | - new google.maps.Point(0,0), | |
176 | - new google.maps.Point(16, 35) | |
262 | + var image3 = new google.maps.MarkerImage( | |
263 | + '/images/markers/marker-we-3.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
177 | 264 | ); |
178 | - var image4 = new google.maps.MarkerImage('/images/markers/marker-we-4.png', | |
179 | - new google.maps.Size(21, 32), | |
180 | - new google.maps.Point(0,0), | |
181 | - new google.maps.Point(16, 35) | |
265 | + var image4 = new google.maps.MarkerImage( | |
266 | + '/images/markers/marker-we-4.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
182 | 267 | ); |
183 | - var image5 = new google.maps.MarkerImage('/images/markers/marker-we-5.png', | |
184 | - new google.maps.Size(21, 32), | |
185 | - new google.maps.Point(0,0), | |
186 | - new google.maps.Point(16, 35) | |
268 | + var image5 = new google.maps.MarkerImage( | |
269 | + '/images/markers/marker-we-5.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
187 | 270 | ); |
188 | - var image6 = new google.maps.MarkerImage('/images/markers/marker-we-6.png', | |
189 | - new google.maps.Size(21, 32), | |
190 | - new google.maps.Point(0,0), | |
191 | - new google.maps.Point(16, 35) | |
271 | + var image6 = new google.maps.MarkerImage( | |
272 | + '/images/markers/marker-we-6.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
192 | 273 | ); |
193 | - var image7 = new google.maps.MarkerImage('/images/markers/marker-we-7.png', | |
194 | - new google.maps.Size(21, 32), | |
195 | - new google.maps.Point(0,0), | |
196 | - new google.maps.Point(16, 35) | |
274 | + var image7 = new google.maps.MarkerImage( | |
275 | + '/images/markers/marker-we-7.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
197 | 276 | ); |
198 | - var image8 = new google.maps.MarkerImage('/images/markers/marker-we-8.png', | |
199 | - new google.maps.Size(21, 32), | |
200 | - new google.maps.Point(0,0), | |
201 | - new google.maps.Point(16, 35) | |
277 | + var image8 = new google.maps.MarkerImage( | |
278 | + '/images/markers/marker-we-8.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
202 | 279 | ); |
203 | - var image9 = new google.maps.MarkerImage('/images/markers/marker-we-9.png', | |
204 | - new google.maps.Size(21, 32), | |
205 | - new google.maps.Point(0,0), | |
206 | - new google.maps.Point(16, 35) | |
280 | + var image9 = new google.maps.MarkerImage( | |
281 | + '/images/markers/marker-we-9.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
207 | 282 | ); |
208 | - var image10 = new google.maps.MarkerImage('/images/markers/marker-empl-1.png', | |
209 | - new google.maps.Size(21, 32), | |
210 | - new google.maps.Point(0,0), | |
211 | - new google.maps.Point(16, 35) | |
283 | + var image10 = new google.maps.MarkerImage( | |
284 | + '/images/markers/marker-empl-1.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
212 | 285 | ); |
213 | - var image11 = new google.maps.MarkerImage('/images/markers/marker-empl-2.png', | |
214 | - new google.maps.Size(21, 32), | |
215 | - new google.maps.Point(0,0), | |
216 | - new google.maps.Point(16, 35) | |
286 | + var image11 = new google.maps.MarkerImage( | |
287 | + '/images/markers/marker-empl-2.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
217 | 288 | ); |
218 | - var image12 = new google.maps.MarkerImage('/images/markers/marker-empl-3.png', | |
219 | - new google.maps.Size(21, 32), | |
220 | - new google.maps.Point(0,0), | |
221 | - new google.maps.Point(16, 35) | |
289 | + var image12 = new google.maps.MarkerImage( | |
290 | + '/images/markers/marker-empl-3.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
222 | 291 | ); |
223 | - var image13 = new google.maps.MarkerImage('/images/markers/marker-empl-4.png', | |
224 | - new google.maps.Size(21, 32), | |
225 | - new google.maps.Point(0,0), | |
226 | - new google.maps.Point(16, 35) | |
292 | + var image13 = new google.maps.MarkerImage( | |
293 | + '/images/markers/marker-empl-4.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
227 | 294 | ); |
228 | - var image14 = new google.maps.MarkerImage('/images/markers/marker-empl-5.png', | |
229 | - new google.maps.Size(21, 32), | |
230 | - new google.maps.Point(0,0), | |
231 | - new google.maps.Point(16, 35) | |
295 | + var image14 = new google.maps.MarkerImage( | |
296 | + '/images/markers/marker-empl-5.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
232 | 297 | ); |
233 | - var image15 = new google.maps.MarkerImage('/images/markers/marker-empl-6.png', | |
234 | - new google.maps.Size(21, 32), | |
235 | - new google.maps.Point(0,0), | |
236 | - new google.maps.Point(16, 35) | |
298 | + var image15 = new google.maps.MarkerImage( | |
299 | + '/images/markers/marker-empl-6.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
237 | 300 | ); |
238 | - var image16 = new google.maps.MarkerImage('/images/markers/marker-empl-7.png', | |
239 | - new google.maps.Size(21, 32), | |
240 | - new google.maps.Point(0,0), | |
241 | - new google.maps.Point(16, 35) | |
301 | + var image16 = new google.maps.MarkerImage( | |
302 | + '/images/markers/marker-empl-7.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
242 | 303 | ); |
243 | - var image17 = new google.maps.MarkerImage('/images/markers/marker-empl-8.png', | |
244 | - new google.maps.Size(21, 32), | |
245 | - new google.maps.Point(0,0), | |
246 | - new google.maps.Point(16, 35) | |
304 | + var image17 = new google.maps.MarkerImage( | |
305 | + '/images/markers/marker-empl-8.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
247 | 306 | ); |
248 | - var image18 = new google.maps.MarkerImage('/images/markers/marker-empl-9.png', | |
249 | - new google.maps.Size(21, 32), | |
250 | - new google.maps.Point(0,0), | |
251 | - new google.maps.Point(16, 35) | |
307 | + var image18 = new google.maps.MarkerImage( | |
308 | + '/images/markers/marker-empl-9.png', new google.maps.Size(21, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 35) | |
252 | 309 | ); |
253 | 310 | |
254 | 311 | var markers = []; |
255 | 312 | |
256 | - var marker = new google.maps.Marker({ | |
257 | - position: new google.maps.LatLng('56', '35.3'), | |
258 | - map: map, | |
259 | - title: 'Marker Title2', | |
260 | - icon: image1 | |
261 | - }); | |
313 | + var marker = new google.maps.Marker( | |
314 | + { | |
315 | + position : new google.maps.LatLng('56', '35.3'), map : map, | |
316 | + title : 'Marker Title2', icon : image1 | |
317 | + } | |
318 | + ); | |
262 | 319 | markers.push(marker); |
263 | 320 | |
264 | - var marker = new google.maps.Marker({ | |
265 | - position: new google.maps.LatLng('56', '36'), | |
266 | - map: map, | |
267 | - title: 'Marker Title2', | |
268 | - icon: image2 | |
269 | - }); | |
321 | + var marker = new google.maps.Marker( | |
322 | + { | |
323 | + position : new google.maps.LatLng('56', '36'), map : map, | |
324 | + title : 'Marker Title2', icon : image2 | |
325 | + } | |
326 | + ); | |
270 | 327 | markers.push(marker); |
271 | 328 | |
272 | - var marker = new google.maps.Marker({ | |
273 | - position: new google.maps.LatLng('56', '34.5'), | |
274 | - map: map, | |
275 | - title: 'Marker Title3', | |
276 | - icon: image18 | |
277 | - }); | |
329 | + var marker = new google.maps.Marker( | |
330 | + { | |
331 | + position : new google.maps.LatLng('56', '34.5'), map : map, | |
332 | + title : 'Marker Title3', icon : image18 | |
333 | + } | |
334 | + ); | |
278 | 335 | markers.push(marker); |
279 | 336 | |
280 | - var marker = new google.maps.Marker({ | |
281 | - position: new google.maps.LatLng('56', '35'), | |
282 | - map: map, | |
283 | - title: 'Marker Title4', | |
284 | - icon: image13 | |
285 | - }); | |
337 | + var marker = new google.maps.Marker( | |
338 | + { | |
339 | + position : new google.maps.LatLng('56', '35'), map : map, | |
340 | + title : 'Marker Title4', icon : image13 | |
341 | + } | |
342 | + ); | |
286 | 343 | markers.push(marker); |
287 | 344 | |
288 | - | |
289 | 345 | var clusterStyles = [ |
290 | 346 | { |
291 | - url: '/images/markers/clasters.png', | |
292 | - height: 36, | |
293 | - width: 36 | |
347 | + url : '/images/markers/clasters.png', height : 36, width : 36 | |
294 | 348 | } |
295 | 349 | |
296 | 350 | ]; |
297 | - markerClusterer = new MarkerClusterer(map, markers, | |
351 | + markerClusterer = new MarkerClusterer( | |
352 | + map, markers, { | |
353 | + maxZoom : 10, gridSize : 100, styles : clusterStyles | |
354 | + } | |
355 | + ); | |
356 | + //балун | |
357 | + var infowindow = new google.maps.InfoWindow( | |
298 | 358 | { |
299 | - maxZoom: 10, | |
300 | - gridSize: 100, | |
301 | - styles: clusterStyles | |
302 | - }); | |
303 | -//балун | |
304 | - var infowindow = new google.maps.InfoWindow({ | |
305 | - content: '<div style="width: 112px;"><a href="#" style="text-decoration: none; color: #333"><img style="width: 112px; height: 60px" src="/images/infowindow_marker_slider.jpg" alt=""/><p style="width: 100%; text-align: center; font-family: Ubuntu Bold; font-size: 11px;">Трц “Дарница”</p></a></div>' | |
306 | - }); | |
307 | - google.maps.event.addListener(marker, 'click', function() { | |
308 | - infowindow.open(map, this); | |
309 | - }); | |
359 | + content : '<div style="width: 112px;"><a href="#" style="text-decoration: none; color: #333"><img style="width: 112px; height: 60px" src="/images/infowindow_marker_slider.jpg" alt=""/><p style="width: 100%; text-align: center; font-family: Ubuntu Bold; font-size: 11px;">Трц “Дарница”</p></a></div>' | |
360 | + } | |
361 | + ); | |
362 | + google.maps.event.addListener( | |
363 | + marker, 'click', function() | |
364 | + { | |
365 | + infowindow.open(map, this); | |
366 | + } | |
367 | + ); | |
310 | 368 | } |
311 | 369 | </script> |
312 | 370 | </div> |
... | ... | @@ -397,8 +455,8 @@ $this->title = 'My Yii Application'; |
397 | 455 | </ul> |
398 | 456 | </div> |
399 | 457 | <div id="demo5-btn" class="text-center"> |
400 | - <a id="demo5-backward"></a> | |
401 | - <a id="demo5-forward"></a> | |
458 | + <a id="demo5-backward"></a> | |
459 | + <a id="demo5-forward"></a> | |
402 | 460 | </div> |
403 | 461 | </div> |
404 | 462 | </div> | ... | ... |