Начало работ по статьям в моддальном окне.
This commit is contained in:
parent
5a6408c059
commit
f3569f5ae4
|
|
@ -406,4 +406,26 @@ class JsonController extends Controller
|
||||||
self::renderPartial('json.php', array('query' => $search, 'suggestions' => $results));
|
self::renderPartial('json.php', array('query' => $search, 'suggestions' => $results));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Article / K.O. =)
|
||||||
|
*/
|
||||||
|
static function actionArticle()
|
||||||
|
{
|
||||||
|
$id = (int) App::getParam('id');
|
||||||
|
if ($id)
|
||||||
|
{
|
||||||
|
$article = Article::model()->getByPK($id);
|
||||||
|
|
||||||
|
if (!$article) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
// print_r($article->text);
|
||||||
|
self::renderPartial('modals/article.php',
|
||||||
|
array(
|
||||||
|
'title' => $article->title,
|
||||||
|
'text' => $article->text,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class User extends Model
|
||||||
{
|
{
|
||||||
$this->_tableName_ = 'users';
|
$this->_tableName_ = 'users';
|
||||||
parent::__construct($fromArray);
|
parent::__construct($fromArray);
|
||||||
$this->setRelation('category', 'catogoryId', 'Category', 'id', self::TO_ONE);
|
$this->setRelation('points', 'id', 'Point', 'id', self::TO_MANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function model()
|
static function model()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
<?php
|
||||||
|
$addWithoutConfirm = false;
|
||||||
|
if (App::$user) {
|
||||||
|
$addWithoutConfirm = Point::model()->getCountByUser(App::$user->id) > 0;
|
||||||
|
}
|
||||||
|
?>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<div id="control">
|
<div id="control">
|
||||||
<div class="glyphicon glyphicon-info-sign boxButtonInfo" title="Информация" onclick="openBox('Info')"></div>
|
<div class="glyphicon glyphicon-info-sign boxButtonInfo" title="Информация" onclick="openBox('Info')"></div>
|
||||||
|
|
@ -12,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
<?php if ($user): ?>
|
<?php if ($user): ?>
|
||||||
<div class="glyphicon glyphicon-map-marker _t" id="addPointButton" title="Добавить точку" onclick="activateAddPoint()"></div>
|
<div class="glyphicon glyphicon-map-marker _t" id="addPointButton" title="Добавить точку" onclick="<?= $addWithoutConfirm ? 'activateAddPoint()' : 'showArticle(1)'; ?>"></div>
|
||||||
<div class="glyphicon glyphicon-star _c boxButtonFavorites" onclick="openBox('Favorites')" title="Хочу посетить"></div>
|
<div class="glyphicon glyphicon-star _c boxButtonFavorites" onclick="openBox('Favorites')" title="Хочу посетить"></div>
|
||||||
<div class="glyphicon glyphicon-cloud-download _c boxButtonRoutes" onclick="openBox('Routes')" title="Мои маршруты"></div>
|
<div class="glyphicon glyphicon-cloud-download _c boxButtonRoutes" onclick="openBox('Routes')" title="Мои маршруты"></div>
|
||||||
<div class="glyphicon glyphicon-user _b boxButtonUser" onclick="openBox('User')" title="Профиль"></div>
|
<div class="glyphicon glyphicon-user _b boxButtonUser" onclick="openBox('User')" title="Профиль"></div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<div class="modal fade" id="articleModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title"><?= $title; ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<?= $text; ?>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -297,3 +297,14 @@ function setLayer(name)
|
||||||
$.cookie('mapLayer', layer);
|
$.cookie('mapLayer', layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showArticle(id)
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
url: "/json/article/id/" + id,
|
||||||
|
success: function (data) {
|
||||||
|
$('#articleModal').modal('hide').remove();
|
||||||
|
$('body').append($(data));
|
||||||
|
$('#articleModal').modal('show');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue