Исправлены ошибки от новых моделей, исправлена ошибка в JS, при близких точках и зумме
This commit is contained in:
parent
27e4f6d577
commit
e3dacb03ab
|
|
@ -39,10 +39,9 @@ class IndexController extends Controller
|
||||||
$category = Category::model()->getAll();
|
$category = Category::model()->getAll();
|
||||||
|
|
||||||
$routes = array();
|
$routes = array();
|
||||||
if (App::$user)
|
if (App::$user && App::$user->id)
|
||||||
{
|
{
|
||||||
$routes = new Route();
|
$routes = Route::model()->getByAuthor(App::$user->id);
|
||||||
$routes = $routes->getByAuthor(App::$user->id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self::addVar('isAdmin', (int)(App::$user && App::$user->isAdmin == 1) );
|
self::addVar('isAdmin', (int)(App::$user && App::$user->isAdmin == 1) );
|
||||||
|
|
@ -56,8 +55,7 @@ class IndexController extends Controller
|
||||||
{
|
{
|
||||||
$id = (int) $_GET['point'];
|
$id = (int) $_GET['point'];
|
||||||
|
|
||||||
$point = new Point();
|
$point = Point::model()->getByPK($id);
|
||||||
$point = $point->getByPK($id);
|
|
||||||
$point->name = htmlspecialchars($point->name);
|
$point->name = htmlspecialchars($point->name);
|
||||||
$point->descriptionHtml = htmlspecialchars($point->description);
|
$point->descriptionHtml = htmlspecialchars($point->description);
|
||||||
$point->descriptionHtml .= ' Посмотреть на карте: http://wikipoints.ru/?point='.$id;
|
$point->descriptionHtml .= ' Посмотреть на карте: http://wikipoints.ru/?point='.$id;
|
||||||
|
|
@ -90,8 +88,8 @@ class IndexController extends Controller
|
||||||
|
|
||||||
static function actionUser()
|
static function actionUser()
|
||||||
{
|
{
|
||||||
$routes = new Route();
|
App::error404();
|
||||||
$routes = $routes->getByAuthor(App::$user->id);
|
$routes = Route::model()->getByAuthor(App::$user->id);
|
||||||
|
|
||||||
var_dump($routes);
|
var_dump($routes);
|
||||||
}
|
}
|
||||||
|
|
@ -109,9 +107,8 @@ class IndexController extends Controller
|
||||||
//var_dump($uLoginUser);die;
|
//var_dump($uLoginUser);die;
|
||||||
$uLoginUser['identity'] = md5($uLoginUser['uid'].$uLoginUser['network'].'=P');
|
$uLoginUser['identity'] = md5($uLoginUser['uid'].$uLoginUser['network'].'=P');
|
||||||
|
|
||||||
$user = new User();
|
$user = User::model()->getByUID($uLoginUser['identity']);
|
||||||
$user->getByUID($uLoginUser['identity']);
|
|
||||||
//var_dump($uLoginUser,'<br><br>', $user);die;
|
|
||||||
if( !$user->id )
|
if( !$user->id )
|
||||||
{
|
{
|
||||||
$user = $user->add(array(
|
$user = $user->add(array(
|
||||||
|
|
@ -137,8 +134,7 @@ class IndexController extends Controller
|
||||||
{
|
{
|
||||||
$xml = new SimpleXMLElement('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"/>');
|
$xml = new SimpleXMLElement('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"/>');
|
||||||
|
|
||||||
$points = new Point();
|
$points = Point::model()->getAll(array('order' => 'ID DESC', 'asArray' => true));
|
||||||
$points = $points->getAll('', 'ID DESC');
|
|
||||||
|
|
||||||
foreach ($points as $point)
|
foreach ($points as $point)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,7 @@ class JsonController extends Controller
|
||||||
'points' => json_encode($_POST['points']),
|
'points' => json_encode($_POST['points']),
|
||||||
);
|
);
|
||||||
|
|
||||||
$route = new Route();
|
$route = Route::model()->add($request);
|
||||||
$route = $route->add($request);
|
|
||||||
|
|
||||||
self::renderPartial('json.php', $route->id);
|
self::renderPartial('json.php', $route->id);
|
||||||
}
|
}
|
||||||
|
|
@ -160,8 +159,7 @@ class JsonController extends Controller
|
||||||
$id = (int) App::getParam('id');
|
$id = (int) App::getParam('id');
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$route = new Route();
|
$route = Route::model()->getByPK($id);
|
||||||
$route = $route->getByPK($id);
|
|
||||||
self::renderPartial('json.php', $route->points);
|
self::renderPartial('json.php', $route->points);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
|
@ -174,8 +172,7 @@ class JsonController extends Controller
|
||||||
$id = (int) App::getParam('id');
|
$id = (int) App::getParam('id');
|
||||||
if ($id && App::$user)
|
if ($id && App::$user)
|
||||||
{
|
{
|
||||||
$route = new Route();
|
$route = Route::model()->getByPK($id);
|
||||||
$route = $route->getByPK($id);
|
|
||||||
|
|
||||||
if ($route->author == App::$user->id)
|
if ($route->author == App::$user->id)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,11 @@ class PageController extends Controller
|
||||||
self::addStyle('/css/bootstrap.min.css');
|
self::addStyle('/css/bootstrap.min.css');
|
||||||
self::addStyle('/css/bootstrap-theme.min.css');
|
self::addStyle('/css/bootstrap-theme.min.css');
|
||||||
|
|
||||||
$point = new Point();
|
$point = Point::model()->getByPK($id);
|
||||||
$point = $point->getByPK($id);
|
|
||||||
$point->descriptionHtml = nl2br($point->description);
|
$point->descriptionHtml = nl2br($point->description);
|
||||||
$point->name = htmlspecialchars($point->name);
|
$point->name = htmlspecialchars($point->name);
|
||||||
|
|
||||||
$categories = new Category();
|
$categories = Category::model()->getAll(array('asArray' => true));
|
||||||
$categories = $categories->getAll();
|
|
||||||
|
|
||||||
$point->categoryIcon = $categories[$point->categoryId]['icon'];
|
$point->categoryIcon = $categories[$point->categoryId]['icon'];
|
||||||
$point->categoryName = $categories[$point->categoryId]['name'];
|
$point->categoryName = $categories[$point->categoryId]['name'];
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
<label class="control-label" for="categoryId">Тип</label>
|
<label class="control-label" for="categoryId">Тип</label>
|
||||||
<select id="addPointCategoryId" name="categoryId" class="form-control">
|
<select id="addPointCategoryId" name="categoryId" class="form-control">
|
||||||
<?php foreach ($categories as $category): ?>
|
<?php foreach ($categories as $category): ?>
|
||||||
<option value="<?=$category['id']?>"><?=$category['name']?></option>
|
<option value="<?= $category->id ?>"><?= $category->name ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ var route = false;
|
||||||
var addPointInProcess = false;
|
var addPointInProcess = false;
|
||||||
var layer;
|
var layer;
|
||||||
var layers = Array();
|
var layers = Array();
|
||||||
|
var defaultZoom = 13;
|
||||||
|
|
||||||
categories.im = L.icon({
|
categories.im = L.icon({
|
||||||
iconUrl: '/ico/man.png',
|
iconUrl: '/ico/man.png',
|
||||||
|
|
@ -40,7 +41,7 @@ ymaps.ready(function(){
|
||||||
* @returns true
|
* @returns true
|
||||||
*/
|
*/
|
||||||
function init(lat, lng) {
|
function init(lat, lng) {
|
||||||
myMap = L.map('map',{zoomControl: false}).setView([lat, lng], 11);
|
myMap = L.map('map',{zoomControl: false}).setView([lat, lng], defaultZoom);
|
||||||
markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 45});
|
markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 45});
|
||||||
|
|
||||||
layers['quest'] = L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', {attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',maxZoom: 18});
|
layers['quest'] = L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', {attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',maxZoom: 18});
|
||||||
|
|
@ -164,11 +165,10 @@ function initPoints()
|
||||||
function showInfo(id)
|
function showInfo(id)
|
||||||
{
|
{
|
||||||
marker = points[id];
|
marker = points[id];
|
||||||
markers.zoomToShowLayer(marker,function() {});
|
|
||||||
|
|
||||||
if (!(id in points) || marker.options.description == undefined)
|
if (!(id in points) || marker.options.description == undefined)
|
||||||
{
|
{
|
||||||
marker.bindPopup("Загрузка...").openPopup();
|
marker.bindPopup("Загрузка...").openPopup();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/json/point/id/" + id,
|
url: "/json/point/id/" + id,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|
@ -198,14 +198,19 @@ function showInfo(id)
|
||||||
description = description + '</div><div class="clear"></div>';
|
description = description + '</div><div class="clear"></div>';
|
||||||
|
|
||||||
marker.options.description = description;
|
marker.options.description = description;
|
||||||
marker.bindPopup(marker.options.description, {maxWidth: 500, maxHeight: 300}).openPopup();
|
marker.bindPopup(marker.options.description, {maxWidth: 500, maxHeight: 300});
|
||||||
|
|
||||||
bounds = myMap.getBounds();
|
markers.zoomToShowLayer(marker,function() {
|
||||||
diff = (bounds._northEast.lat - bounds._southWest.lat)/4;
|
marker.openPopup();
|
||||||
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
history.pushState({}, document.title, "/?point=" + id);
|
||||||
|
|
||||||
history.pushState({}, document.title, "/?point=" + id);
|
bounds = myMap.getBounds();
|
||||||
document.title = data.name;
|
diff = (bounds._northEast.lat - bounds._southWest.lat)/4;
|
||||||
|
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
||||||
|
|
||||||
|
history.pushState({}, document.title, "/?point=" + id);
|
||||||
|
document.title = data.name;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -258,7 +263,7 @@ function searchAdderess()
|
||||||
{
|
{
|
||||||
if (data.lat && data.lng)
|
if (data.lat && data.lng)
|
||||||
{
|
{
|
||||||
myMap.setView([data.lat, data.lng], 13);
|
myMap.setView([data.lat, data.lng], defaultZoom);
|
||||||
L.popup()
|
L.popup()
|
||||||
.setLatLng([data.lat, data.lng])
|
.setLatLng([data.lat, data.lng])
|
||||||
.setContent('Координаты: lat:'+data.lat+' lng:'+data.lng)
|
.setContent('Координаты: lat:'+data.lat+' lng:'+data.lng)
|
||||||
|
|
@ -281,7 +286,7 @@ function showMeOnTheMap()
|
||||||
coords = [pos.coords.latitude, pos.coords.longitude];
|
coords = [pos.coords.latitude, pos.coords.longitude];
|
||||||
myMap.removeLayer(points.im);
|
myMap.removeLayer(points.im);
|
||||||
points.im.setLatLng(coords).addTo(myMap);
|
points.im.setLatLng(coords).addTo(myMap);
|
||||||
myMap.setView(coords, 15);
|
myMap.setView(coords, defaultZoom);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue