Страница со списком точек

This commit is contained in:
Krivchikov Dmitry 2014-06-14 23:56:28 +04:00
parent a78328830a
commit 746a0fcd1a
5 changed files with 164 additions and 1 deletions

View File

@ -0,0 +1,47 @@
<?php
class PageController extends Controller
{
static function actionPoints()
{
self::$layout = 'layoutPage.php';
self::addScript('/js/jquery-2.1.0.min.js');
self::addScript('/js/jquery-ui-1.10.4.custom.min.js');
self::addScript('/js/bootstrap.min.js');
self::addStyle('/css/bootstrap.min.css');
self::addStyle('/css/bootstrap-theme.min.css');
$categoryId = (int)App::getParam('category');
$where = $categoryId ? 'categoryId = '.$categoryId : '';
$points = new Point();
$points = $points->getAll($where, 'id DESC');
$categories = new Category();
$categories = $categories->getAll('', 'ord');
$users = new User();
$users = $users->getAll();
$result = array();
foreach ($points as $point)
{
$result[$point['id']]['id'] = $point['id'];
$result[$point['id']]['name'] = $point['name'];
$result[$point['id']]['img'] = $point['img'];
$result[$point['id']]['categoryIcon'] = $categories[$point['categoryId']]['icon'];
$result[$point['id']]['author'] = $users[$point['author']]['nick'];
}
$res = App::$DB->query("SELECT COUNT(`id`) pointsCount FROM `points`")->fetch(PDO::FETCH_ASSOC);
App::setConfig('title', $res['pointsCount'] . ' или даже больше поводов не сидеть дома');
self::render('pointsTemplate.php', array(
'categories' => $categories,
'user' => App::$user,
'points' => $result,
));
}
}

View File

@ -33,6 +33,8 @@
<a onclick="$('#howToUseModal').modal('show');" href="#">Как пользоваться</a> <a onclick="$('#howToUseModal').modal('show');" href="#">Как пользоваться</a>
| |
<a onclick="$('#categoriesModal').modal('show');" href="#">Легенда</a> <a onclick="$('#categoriesModal').modal('show');" href="#">Легенда</a>
|
<a href="/page/points">Список точек</a>
</span> </span>
</div> </div>
<?= isset($content) && !empty($content) ? $content : 'No content =(' ?> <?= isset($content) && !empty($content) ? $content : 'No content =(' ?>

106
ground/views/layoutPage.php Normal file
View File

@ -0,0 +1,106 @@
<!DOCTYPE html>
<html>
<head>
<title><?= App::getConfig('title') ?></title>
<?php if ($styles): ?>
<?php foreach ($styles as $style): ?>
<link href="<?= $style ?>" media="all" rel="stylesheet" type="text/css" />
<?php endforeach; ?>
<?php endif; ?>
<?php if ($scripts): ?>
<?php foreach ($scripts as $script): ?>
<script src="<?= $script ?>" type="text/javascript"></script>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($vars): ?>
<script type="text/javascript">
<?php foreach ($vars as $varName => $var): ?>
var <?= $varName ?> = '<?= $var ?>';
<?php endforeach; ?>
</script>
<?php endif; ?>
</head>
<body style="padding: 10px 25px;">
<div class="header">
<h1>WikiPoints</h1>
<span class="mainMenu">
<a href="/">На карту</a>
|
<a onclick="$('#aboutModal').modal('show');" href="#">О проекте</a>
|
<a onclick="$('#howToUseModal').modal('show');" href="#">Как пользоваться</a>
|
<a onclick="$('#categoriesModal').modal('show');" href="#">Легенда</a>
</span>
</div>
<?= isset($content) && !empty($content) ? $content : 'No content =(' ?>
<div class="modal fade" id="aboutModal" tabindex="-1" role="dialog" aria-labelledby="Информация о проекте" 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">&times;</button>
<h4 class="modal-title" id="myModalLabel">Информация о проекте WikiPoints.ru</h4>
</div>
<div class="modal-body">
<p><b>Добрый день!</b></p>
<p>В детстве каждый мечтает быть первооткрывателем, великим путешественником, покорителем севера, мир кажется огромным и непознанным... Но с возрастом всё начинает восприниматься немного прозаичнее земной шар теперь не кажется таким же большим, ведь за каких-то несколько часов можно оказаться на другом краю света, а родной город, кажется, давно раскрыл все свои тайны.</p>
<p>Для кого-то может стать открытием, что совсем рядом есть множество интересных неизведанных мест, полных загадок и таинств. Посетить их стоит только за тем, чтобы еще раз испытать те самые ощущения из детства. Замки, родовые имения, руины, религиозные сооружения, музеи да мало ли ещё целей для поездки с семьёй или друзьями! Потратьте выходные на увлекательное путешествие, осуществите свою детскую мечту.</p>
<p>Каждый из вас знает несколько достопримечательностей или просто любопытных мест в городе или за его пределами, которые можно порекомендовать к просмотру. Добавляйте их на карту это займёт всего пару минут. Давайте поможем друг другу открывать нечто необычное и ни на что не похожее!</p>
<p>Цель проекта очень проста поделиться знаниями, рассказать о родном крае и, конечно, самому найти интересные направления для путешествий по всему миру.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="howToUseModal" tabindex="-1" role="dialog" aria-labelledby="Курс молодого бойца" 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">&times;</button>
<h4 class="modal-title" id="myModalLabel">Курс молодого бойца</h4>
</div>
<div class="modal-body">
<p><b>Информация о точках</b></p>
<p>На карте вы видите пиктограммы ими отмечены места, интересные для посещения. При клике на пиктограмму вы увидите небольшое окно с информацией и фотографию объекта. В конце описания есть ссылка на более подробное описание.</p>
<br />
<p><b>Добавление новой точки</b></p>
<p>Добавление точки состоит из ряда простых шагов, а именно: подготовка информации об объекте (описание, ссылка на изображение, подробная статья); поиск нужной точки на карте wikipoints. Теперь вы готовы добавить точку на карту. Нажмите кнопку «Добавить точку» (нижний правый угол), курсор изменится на «+», кликните на нужном месте карты и заполните форму.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter24682772 = new Ya.Metrika({id:24682772,
trackLinks:true});
} catch(e) { }
});
var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); };
s.type = "text/javascript";
s.async = true;
s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";
if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/24682772" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
</body>
</html>

View File

@ -7,7 +7,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<?php foreach ($categories as $category): ?> <?php foreach ($categories as $category): ?>
<img src="<?=$category['icon']?>"> - <?=$category['name']?><br/> <img src="<?=$category['icon']?>"> - <a href="/page/points/category/<?=$category['id']?>"><?=$category['name']?></a><br/>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

View File

@ -0,0 +1,8 @@
<h3>Список точек</h3>
<?php foreach ($points as $point): ?>
#<?=$point['id']?> <img src="<?=$point['categoryIcon']?>" /> <a href="/?point=<?=$point['id']?>"><?=$point['name']?></a>
<?=$point['author']?>
<br/>
<?php endforeach; ?>
<?= self::renderPartial('modals/categories.php', array('categories' => $categories), true) ?>