index.php
5.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
use yii\helpers\Html;
use frontend\themes\defaults\assets\AppAsset;
use frontend\modules\map\Map;
/**
* @author FilamentV <vortex.filament@gmail.com>
* @author Alla Kuzmenko
* @copyright (c), Thread
*
*/
$asset = AppAsset::register($this);
$urlMapResource = Map::getUrlListByType('resource');
$urlMapProjects = Map::getUrlListByType('project');
$urlList = Map::getUrlList();
?>
<div class="col-xs-12 text-center">
<div class="main-map-container">
<div class="static-btn-container">
<?= Html::a(Yii::t('front', 'resource potential'), $urlMapResource, [
'class' => 'static-btn static-btn-resours'
])
. Html::a(Yii::t('front', 'projects'), $urlMapProjects, [
'class' => 'static-btn static-btn-project'
])
?>
</div>
<div class="main-map">
<?php
echo Html::a(Html::img($asset->baseUrl . '/img/map.png', [
'class' => 'img-responsive',
'alt' => 'map'
]), $urlMapProjects, [
'class' => 'main-map-link'
]);
//MAP MENU
echo Html::a(Html::tag('span', Yii::t('front', 'hydro'), [
]), $urlMapProjects . '?area=1', [
'class' => 'bubble hydro',
])
. Html::a(Html::tag('span', Yii::t('front', 'solar'), [
]), $urlMapProjects . '?area=4', [
'class' => 'bubble solar',
])
. Html::a(Html::tag('span', Yii::t('front', 'wind'), [
]), $urlMapProjects . '?area=5', [
'class' => 'bubble wind',
])
. Html::a(Html::tag('span', Yii::t('front', 'efective'), [
]), $urlMapProjects . '?area=6', [
'class' => 'bubble efective',
])
. Html::a(Html::tag('span', Yii::t('front', 'bio'), [
]), $urlMapProjects . '?area=15', [
'class' => 'bubble bio',
]);
?>
</div>
<?php if (Yii::$app->getUser()->isGuest): ?>
<div class="registration text-left hide-on-med-and-down">
<div class="registration-text">
<?= Yii::t('front', 'Register on the system to add your project to the map') ?>
</div>
<?= Html::button(Yii::t('front', 'Registration'),
['class' => 'open-popup btn btn-default btn-sm',
'data-id' => 'registrationPopup']) ?>
<div class="registration-popap-info">
<?= \frontend\modules\page\models\StaticTextBlock::give_me('register_text') ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php
/*
$xml = simplexml_load_string(file_get_contents(Yii::getAlias('@frontend-web') . '/bio.kml'));
//
function xml2array($xml)
{
$arr = array();
foreach ($xml->children() as $r) {
$t = array();
if (count($r->children()) == 0) {
$arr[$r->getName()] = strval($r);
} else {
$arr[$r->getName()][] = xml2array($r);
}
}
return $arr;
}
//
$xmlarray = xml2array($xml);
//XMLToArrayFlat($xml, $xmlarray, '', true);
//var_dump($xmlarray);
foreach ($xmlarray as $document => $doc_array) {
foreach ($doc_array as $folder => $f_array) {
foreach ($f_array as $k => $data) {
foreach ($data as $datum) {
foreach ($datum['Placemark'] as $item) {
// var_dump($item);
$e_data = '<br>';
if (isset($item['ExtendedData'][0]['Data'])) {
foreach ($item['ExtendedData'][0]['Data'] as $key) {
$e_data .= $key['value'] . '<br>';
}
}
// var_dump($e_data);
// break;
$coords = [0 => '0', 1 => '0'];
if (isset($item['Point'][0]['coordinates'])) {
$coords = explode(',', trim($item['Point'][0]['coordinates']));
}
//
$obj = new \backend\modules\map\models\Item([
'scenario' => 'backend',
'alias' => mb_substr($item['name'], 0, 100) . '' . uniqid(),
'type' => 'resource',
'region_id' => '0',
'type_id' => '3',
'area_id' => '17',
'user_id' => '1',
'coordinates' => '(' . $coords[1] . ',' . $coords[0] . ')',
'published' => '1',
'heat_capacity' => '0',
'date_of_entry' => '',
'share_of_project_equity_offered' => '',
]);
$obj->save(false);
//
$objL = new \backend\modules\map\models\ItemLang([
'scenario' => 'backend',
'rid' => $obj['id'],
'lang' => 'uk-UA',
'title' => mb_substr(trim($item['name']), 0, 255),
'address' => $item['address'] ?? '',
'description' => (isset($item['description']) ? trim($item['description']) : '') . $e_data,
'investment_schedule' => '',
'annual_power_production' => '',
'annual_heat_production' => '',
'power_price' => '',
'heat_price' => '',
]);
$objL->save(false);
}
}
}
}
}
*/