Новый статус для точки - отклонена модератором

This commit is contained in:
Krivchikov Dmitry 2015-12-04 17:04:09 +03:00
parent 1815000ba7
commit 226509fb7a
11 changed files with 243 additions and 201 deletions

View File

@ -22,7 +22,7 @@ class FeedController extends Controller
// --------- POINTS
$points = Point::model()->getAll(array(
'where' => '`moderate` = 1',
'where' => '`status` = "published"',
'order' => '`ord` DESC',
'limit' => 5,
));

View File

@ -9,7 +9,7 @@ class JsonController extends Controller
static function actionPoints()
{
if (App::$user && App::$user->isAdmin == 1) {
$points = Point::model()->getAll();
$points = Point::model()->getAll(array('where' => '`status` != "del"'));
} else {
$minEditDate = isset($_GET['time']) ? (int) $_GET['time'] : 0;
if (!isset($_GET['bounds']) || !isset($_GET['bounds'][0]) || !isset($_GET['bounds'][1]) || !isset($_GET['bounds'][2]) || !isset($_GET['bounds'][3])) {
@ -34,7 +34,7 @@ class JsonController extends Controller
$tempPoint['lat'] = $point->lat;
$tempPoint['lng'] = $point->lng;
$tempPoint['categoryId'] = $point->categoryId;
$tempPoint['moderate'] = $point->moderate ? 'show' : 'hide';
$tempPoint['status'] = $point->status;
$result[] = $tempPoint;
}
@ -56,7 +56,6 @@ class JsonController extends Controller
$point->descriptionHtml = nl2br($point->description);
$point->descriptionHtml = Helper::replaceLinks($point->descriptionHtml, 'js');
$point->name = htmlspecialchars($point->name);
$point->moderate = $point->moderate ? 'show' : 'hide';
$imgs = $point->photos;
$photosCount = 1;
@ -117,7 +116,7 @@ class JsonController extends Controller
{
$logName = isset($_POST['id']) && $_POST['id'] ? 'point_'.intval($_POST['id']) : 'point_0_NEW';
App::log('points/'.$logName, array(
'user' => App::$user->getValues(),
'user' => App::$user ? App::$user->getValues() : NULL,
'POST' => $_POST,
));
$errors = array();
@ -131,7 +130,7 @@ class JsonController extends Controller
$id = (int) $_POST['id'];
$point = $point->getByPK($id);
if ($point->author != App::$user->id || $point->moderate == 1) {
if ($point->author != App::$user->id || $point->status == Point::statusPublished) {
$errors[9] = 'Редактирование точек достурно только администратору или автору!';
}
}
@ -265,16 +264,16 @@ class JsonController extends Controller
if (App::$request['ajax']) {
$point = new Point();
unset($_POST['img']);
if (isset($_POST['id']) && $_POST['id']) {
// Редактирование существующей точки
$id = (int) $_POST['id'];
$_POST['dateEdit'] = time();
$_POST['moderate'] = (App::$user && App::$user->isAdmin == 1) ? $_POST['moderate'] : 0;
$_POST['status'] = (App::$user && App::$user->isAdmin == 1) ? Point::getStatusByString($_POST['status']) : Point::statusModeration;
$point = $point->getByPK($id);
if ($point->moderate == 0 AND $_POST['moderate'] == 1) {
// Публикация ранее неопубликованной точки
if ($point->status == Point::statusModeration AND Point::getStatusByString($_POST['status']) == Point::statusPublished) {
Notifications::model()->add(array(
'userId' => $point->author,
'objectId' => $id,
@ -284,13 +283,23 @@ class JsonController extends Controller
$_POST['ord'] = time();
}
if (Point::getStatusByString($_POST['status']) == Point::statusDel) {
Notifications::model()->add(array(
'userId' => $point->author,
'objectId' => $id,
'type' => Notifications::typePointDeleted,
'date' => time(),
));
$_POST['ord'] = time();
}
$point->setValues($_POST);
$point->save();
} else {
$_POST['author'] = App::$user->id;
$_POST['date'] = time();
$_POST['dateEdit'] = time();
$_POST['moderate'] = (App::$user && App::$user->isAdmin == 1) ? $_POST['moderate'] : 0;
$_POST['status'] = (App::$user && App::$user->isAdmin == 1) ? Point::getStatusByString($_POST['status']) : Point::statusModeration;
$_POST['ord'] = (App::$user && App::$user->isAdmin == 1) ? time() : 0;
$point->add($_POST);

View File

@ -25,7 +25,7 @@ class PageController extends Controller
// On moderation
if (App::$user && App::$user->isAdmin) {
$param['order'] = 'id DESC';
$param['where'] = '`moderate` = 0';
$param['where'] = '`status` = "moderation"';
$points = Point::model()->getAll($param);
$categories = Category::model()->getAll(array('order' => 'ord ASC'));
@ -44,7 +44,7 @@ class PageController extends Controller
// ------------------------------------------
$param = array();
$param['where'] = '`moderate` = 1';
$param['where'] = '`status` = "published"';
$pointsCount = Point::model()->getCount($param);
$pagesCount = intval(ceil($pointsCount/self::elementsByPage));
$page = isset($_GET['page']) ? abs((int)$_GET['page']) : $pagesCount;
@ -77,11 +77,11 @@ class PageController extends Controller
$param = array();
$param['order'] = '`ord` DESC';
if (App::getParam('category')) {
$param['where'] = 'categoryId = ' . (int) App::getParam('category') . ' AND `moderate` = 1';
$param['where'] = 'categoryId = ' . (int) App::getParam('category') . ' AND `status` = "published"';
} else if (App::getParam('user')) {
$param['where'] = '`author` = ' . (int) App::getParam('user') . ' AND `moderate` = 1';
$param['where'] = '`author` = ' . (int) App::getParam('user') . ' AND `status` = "published"';
} else {
$param['where'] = '`moderate` = 1';
$param['where'] = '`status` = "published"';
$param['limit'] = self::elementsByPage;
if($page) {
$param['offset'] = self::elementsByPage * ($pagesCount - $page);

View File

@ -2,109 +2,115 @@
class PointController extends Controller
{
static function actionIndex()
{
self::$layout = 'layouts/page.php';
$pointId = (int) App::getParam('id');
if ($pointId) {
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::addScript('/js/leaflet-0.7.3.js');
self::addScript('http://api-maps.yandex.ru/2.0/?load=package.map&lang=ru-RU');
self::addScript('/js/leaflet.markercluster.js');
self::addScript('/js/app.js?ver=' . App::getConfig('version'));
self::addScript('/js/mapPoint.js?ver=' . App::getConfig('version'));
self::addScript('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.js');
self::addStyle('/css/style.css?ver=' . App::getConfig('version'));
self::addStyle('/css/pageStyle.css?ver=' . App::getConfig('version'));
self::addStyle('/css/bootstrap.min.css');
self::addStyle('/css/bootstrap-theme.min.css');
self::addStyle('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.css');
self::addStyle('/css/leaflet-0.7.3.css');
self::addStyle('/css/MarkerCluster.css');
self::addStyle('/css/MarkerCluster.Default.css');
if (App::$user && App::$user->id) {
self::addVar('user', App::$user->id);
} else {
self::addVar('user', '0');
self::addScript('//ulogin.ru/js/ulogin.js');
}
$point = Point::model()->getByPK($pointId);
if ($point->id == NULL) {
App::error404();
}
$point->descriptionHtml = nl2br($point->description);
$point->name = htmlspecialchars($point->name);
App::setConfig('title', $point->name . ' wikipoints.ru');
self::addVar('pointLat', $point->lat);
self::addVar('pointLng', $point->lng);
self::addVar('pointId', $point->id);
$categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true));
$point->categoryIcon = $categories[$point->categoryId]['icon'];
$point->categoryName = $categories[$point->categoryId]['name'];
$point->descriptionHtml = Helper::replaceLinks($point->descriptionHtml, 'html');
preg_match_all("/.*?((([^.?!\s]{3,}?)[.?!](?:\s|$))|$)/s", $point->descriptionHtml, $items); // Разбиваем текст на предложения.
$point->inFavorites = Favorite::model()->checkIsMy($pointId);
$point->iLike = Like::model()->checkIsMy($pointId);
$photoLinks = PhotoLinks::model()->getAll(array('where' => '`pointId` = ' . $pointId));
$photoLinksRes = array();
if ($photoLinks) {
foreach ($photoLinks as $photoLink) {
if ($photoLink->host) {
$photoLinksRes[strtolower($photoLink->host)] = 1;
}
}
}
$photoLinksRes = implode('; ', array_keys($photoLinksRes));
$similarPoints = Point::model()->getAll(array('where' => '`moderate` = 1 AND categoryId = ' . $point->categoryId . ' AND `id` <> ' . $point->id . ' ORDER BY RAND() LIMIT 6;'));
$closestPoints = Point::model()->getClosestPoints($pointId);
$randomPoint = Point::model()->getRandom();
$randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8');
$randomPoint->description = Helper::replaceLinks($randomPoint->description);
$articlePoints = ArticlePoints::model()->getAll(array('where'=>'`pointId` = '.$pointId));
$articleIds = array();
$articles = array();
if ($articlePoints) {
foreach ($articlePoints as $articlePoint) {
$articleIds[] = (int)$articlePoint->articleId;
}
$articles = Article::model()->getAll(array('where'=>'`id` IN ('. implode(',', $articleIds).')'));
}
self::render('point.php', array(
'point' => $point,
'text' => $items[0],
'randomPoint' => $randomPoint,
'similarPoints' => $similarPoints,
'closestPoints' => $closestPoints,
'categories' => $categories,
'photos' => $point->photos,
'countInFavs' => Favorite::model()->countInFavs($pointId),
'countLikes' => Like::model()->countLikes($pointId),
'og' => Helper::buildOG($point),
'user' => App::$user,
'photoLinks' => $photoLinksRes,
'articles' => $articles,
'extraParams' => $point->getExtraParams(),
'goods' => Goods::model()->getRandom(6),
));
} else {
if (!$pointId) {
App::error404();
}
$point = Point::model()->getByPK($pointId);
if (!$point->id) {
App::error404();
}
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::addScript('/js/leaflet-0.7.3.js');
self::addScript('http://api-maps.yandex.ru/2.0/?load=package.map&lang=ru-RU');
self::addScript('/js/leaflet.markercluster.js');
self::addScript('/js/app.js?ver=' . App::getConfig('version'));
self::addScript('/js/mapPoint.js?ver=' . App::getConfig('version'));
self::addScript('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.js');
self::addStyle('/css/style.css?ver=' . App::getConfig('version'));
self::addStyle('/css/pageStyle.css?ver=' . App::getConfig('version'));
self::addStyle('/css/bootstrap.min.css');
self::addStyle('/css/bootstrap-theme.min.css');
self::addStyle('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.css');
self::addStyle('/css/leaflet-0.7.3.css');
self::addStyle('/css/MarkerCluster.css');
self::addStyle('/css/MarkerCluster.Default.css');
if (App::$user && App::$user->id) {
self::addVar('user', App::$user->id);
} else {
self::addVar('user', '0');
self::addScript('//ulogin.ru/js/ulogin.js');
}
if ($point->status != Point::statusPublished && !App::$user->isAdmin && $point->author != App::$user->id) {
App::error404();
}
$point->descriptionHtml = nl2br($point->description);
$point->name = htmlspecialchars($point->name);
App::setConfig('title', $point->name . ' wikipoints.ru');
self::addVar('pointLat', $point->lat);
self::addVar('pointLng', $point->lng);
self::addVar('pointId', $point->id);
$categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true));
$point->categoryIcon = $categories[$point->categoryId]['icon'];
$point->categoryName = $categories[$point->categoryId]['name'];
$point->descriptionHtml = Helper::replaceLinks($point->descriptionHtml, 'html');
preg_match_all("/.*?((([^.?!\s]{3,}?)[.?!](?:\s|$))|$)/s", $point->descriptionHtml, $items); // Разбиваем текст на предложения.
$point->inFavorites = Favorite::model()->checkIsMy($pointId);
$point->iLike = Like::model()->checkIsMy($pointId);
$photoLinks = PhotoLinks::model()->getAll(array('where' => '`pointId` = ' . $pointId));
$photoLinksRes = array();
if ($photoLinks) {
foreach ($photoLinks as $photoLink) {
if ($photoLink->host) {
$photoLinksRes[strtolower($photoLink->host)] = 1;
}
}
}
$photoLinksRes = implode('; ', array_keys($photoLinksRes));
$similarPoints = Point::model()->getAll(array('where' => '`status` = "published" AND categoryId = ' . $point->categoryId . ' AND `id` <> ' . $point->id . ' ORDER BY RAND() LIMIT 6;'));
$closestPoints = Point::model()->getClosestPoints($pointId);
$randomPoint = Point::model()->getRandom();
$randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8');
$randomPoint->description = Helper::replaceLinks($randomPoint->description);
$articlePoints = ArticlePoints::model()->getAll(array('where' => '`pointId` = ' . $pointId));
$articleIds = array();
$articles = array();
if ($articlePoints) {
foreach ($articlePoints as $articlePoint) {
$articleIds[] = (int) $articlePoint->articleId;
}
$articles = Article::model()->getAll(array('where' => '`id` IN (' . implode(',', $articleIds) . ')'));
}
self::render('point.php', array(
'point' => $point,
'text' => $items[0],
'randomPoint' => $randomPoint,
'similarPoints' => $similarPoints,
'closestPoints' => $closestPoints,
'categories' => $categories,
'photos' => $point->photos,
'countInFavs' => Favorite::model()->countInFavs($pointId),
'countLikes' => Like::model()->countLikes($pointId),
'og' => Helper::buildOG($point),
'user' => App::$user,
'photoLinks' => $photoLinksRes,
'articles' => $articles,
'extraParams' => $point->getExtraParams(),
'goods' => Goods::model()->getRandom(6),
));
}
}

View File

@ -5,6 +5,7 @@ class Notifications extends Model
private static $count = NULL;
const typePointConfirmed = 'pointConfirmed';
const typePointDeleted = 'pointDeleted';
const typeReply = 'reply';
const typeNewCommentPoint = 'newCommentPoint';
const typeNewCommentArticle = 'newCommentArticle';

View File

@ -2,6 +2,9 @@
class Point extends Model
{
const statusModeration = 'moderation';
const statusPublished = 'published';
const statusDel = 'del';
function __construct($fromArray = array())
{
@ -35,10 +38,10 @@ class Point extends Model
public function getRandom()
{
$res = App::DB()->query("SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `" . $this->_tableName_ . "` WHERE `moderate` = 1")->fetch(PDO::FETCH_ASSOC);
$res = App::DB()->query("SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `" . $this->_tableName_ . '` WHERE `status` = "published"')->fetch(PDO::FETCH_ASSOC);
$offset = $res['offset'];
$res = App::DB()->query('SELECT `id` FROM ' . $this->_tableName_ . ' WHERE `moderate` = 1 LIMIT ' . $offset . ',1;')->fetch(PDO::FETCH_ASSOC);
$res = App::DB()->query('SELECT `id` FROM ' . $this->_tableName_ . ' WHERE `status` = "published" LIMIT ' . $offset . ',1;')->fetch(PDO::FETCH_ASSOC);
$pointId = $res['id'];
return $this->getByPK($pointId);
@ -52,10 +55,10 @@ class Point extends Model
$query = '
SELECT *, (
SQRT(POW(`lat`-:lat,2)+POW(`lng`-:lng,2))
(POW(`lat`-:lat,2)+POW(`lng`-:lng,2))
) AS `dist` FROM `' . $this->_tableName_ . '`
WHERE
`moderate` = 1
`status` = "published"
AND
`lat` BETWEEN :minLat AND :maxLat
AND
@ -81,7 +84,7 @@ class Point extends Model
public function getCountByUser($userId)
{
$res = App::DB()->query('SELECT count(`id`) AS `cnt` FROM ' . $this->_tableName_ . ' WHERE `author` = ' . $userId . ' AND `moderate` = 1 ;')->fetch(PDO::FETCH_ASSOC);
$res = App::DB()->query('SELECT count(`id`) AS `cnt` FROM ' . $this->_tableName_ . ' WHERE `author` = ' . $userId . ' AND `status` = "published";')->fetch(PDO::FETCH_ASSOC);
return $res['cnt'];
}
@ -92,7 +95,7 @@ class Point extends Model
public function getAllPublished($bounds = false, $minEditDate = 0)
{
$userId = App::$user ? App::$user->id : 0;
$userId = App::$user ? intval(App::$user->id) : 0;
$minEditDate = intval($minEditDate);
if ($bounds) {
$b0 = $bounds[0] < $bounds[2] ? $bounds[0] : $bounds[2];
@ -100,9 +103,9 @@ class Point extends Model
$b1 = $bounds[1] < $bounds[3] ? $bounds[1] : $bounds[3];
$b3 = $bounds[1] < $bounds[3] ? $bounds[3] : $bounds[1];
return $this->getAll(array('where' => "(`moderate` = 1 OR `author` = $userId) AND (`dateEdit` >= $minEditDate) AND (`lat` BETWEEN '$b0' AND '$b2') AND(`lng` BETWEEN '$b1' AND '$b3')"));
return $this->getAll(array('where' => "((`status` = '" . Point::statusPublished . "') OR (`status` = '" . Point::statusModeration . "' AND `author` = $userId)) AND (`dateEdit` >= $minEditDate) AND (`lat` BETWEEN '$b0' AND '$b2') AND(`lng` BETWEEN '$b1' AND '$b3')"));
} else {
return $this->getAll(array('where' => "(`moderate` = 1 OR `author` = " . $userId . ") AND (`dateEdit` >= $minEditDate)"));
return $this->getAll(array('where' => "((`status` = '" . Point::statusPublished . "') OR (`status` = '" . Point::statusModeration . "' AND `author` = $userId)) AND (`dateEdit` >= $minEditDate)"));
}
}
@ -125,4 +128,18 @@ class Point extends Model
$res = App::DB()->query('SELECT count(`id`) AS `cnt` FROM ' . $this->_tableName_ . ' WHERE `author` = ' . $userId . ' AND `date` >= ' . $time . ';')->fetch(PDO::FETCH_ASSOC);
return (int)$res['cnt'];
}
public static function getStatusByString($status)
{
switch (strtolower($status)) {
case 'del':
return self::statusDel;
break;
case 'published':
return self::statusPublished;
break;
default:
return self::statusModeration;
}
}
}

View File

@ -283,7 +283,7 @@ function addPoint()
source: $('#addPointSource').val(),
lat: $('#addPointLat').val(),
lng: $('#addPointLng').val(),
moderate: $('#moderate').val() == 'show' ? 1:0,
status: $('#moderate').val(),
id: id
},
success: function (data) {
@ -384,7 +384,7 @@ function editPoint(id)
$('#addPointSource').val(pointsSources[id].source);
$('#addPointLat').val(pointsSources[id].lat);
$('#addPointLng').val(pointsSources[id].lng);
$('#moderate').val(pointsSources[id].moderate);
$('#moderate').val(pointsSources[id].status);
$('.extraImage', '#imgsContainer').remove();
$('.extraParam', '#extraParamsContainer').remove();

View File

@ -152,7 +152,7 @@ function constructPoint(data)
id = data['id'];
icon = categories[data['categoryId']];
if (data['moderate'] != 'show') {
if (data['status'] != 'published') {
icon = categories.lock;
data['name'] = 'На модерации: ' + data['name'];
}
@ -272,7 +272,7 @@ function drawInfoPopup(id, showPopup, doNotPushToHistory) {
}
onModerate = '';
if (data.moderate != 'show') {
if (data.status != 'published') {
onModerate = 'На модерации: ';
}
@ -285,7 +285,7 @@ function drawInfoPopup(id, showPopup, doNotPushToHistory) {
description += '<button type="button" class="btn btn-default" onclick="addRemoveLike(' + id + ')"><span id="myLikesButton" class="glyphicon glyphicon-' + (data.iLike ? 'ok' : 'thumbs-up') + '"></span> <span class="label">Нравится</span></button>';
description += '<button type="button" class="btn btn-default" onclick="addRemoveFavorite(' + id + ')"><span id="myFavoritesButton" class="glyphicon glyphicon-star' + (data.inFavorites ? '' : '-empty') + ' "></span> <span class="label">Хочу посетить</span></button>';
if (isAdmin == '1' || data.moderate == "hide")
if (isAdmin == '1' || data.status == "moderation")
{
description += '<button type="button" class="btn btn-default" onclick="editPoint(' + id + ')"><span class="glyphicon glyphicon-pencil"></span> <span class="label">Редактировать</span></button>';
if (getURLParameter('edit') == 'true')

View File

@ -5,91 +5,94 @@
<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" style="padding-bottom: 0;">
<?php if (!App::$user->isAdmin && Point::model()->getCountMyPointsToday() >= 3): ?>
Ещё раз здравствуйте!<br/>
Мы очень ценим ваш труд, за сегодня вы добавили уже 3 точки и это очень здорово!<br/>
В свою очередь мы просим вас немного отдохнуть, а пока наши модераторы всё проверят, дооформят и покажут на карте. Это вынужденная мера, так как точек добавляется много и мы просто физически не успеваем обработать этот поток информации. Очень надеемся, что уже завтра вы вернётесь! ;)<br/>
<br/>
<?php else: ?>
<img id="imgPreview" style="display: none; position: absolute; top: 10px; left: 180px; height: 150px; border: solid 3px #777;" src="" onclick="hidePerview()"/>
<form method="POST" action="/json/addpoint/" id="addPointForm" enctype="multipart/form-data">
<div class="form-group">
<label class="control-label" for="name">Название</label>
<label class="control-label error" for="name">(Слишком короткое название точки мининум 5 символов)</label>
<input type="text" id="addPointName" name="name" class="form-control" />
</div>
<form method="POST" action="/json/addpoint/" id="addPointForm" enctype="multipart/form-data">
<div class="modal-body" style="padding-bottom: 0;">
<?php if (!App::$user->isAdmin && Point::model()->getCountMyPointsToday() >= 3): ?>
Ещё раз здравствуйте!<br/>
Мы очень ценим ваш труд, за сегодня вы добавили уже 3 точки и это очень здорово!<br/>
В свою очередь мы просим вас немного отдохнуть, а пока наши модераторы всё проверят, дооформят и покажут на карте. Это вынужденная мера, так как точек добавляется много и мы просто физически не успеваем обработать этот поток информации. Очень надеемся, что уже завтра вы вернётесь! ;)<br/>
<br/>
<?php else: ?>
<img id="imgPreview" style="display: none; position: absolute; top: 10px; left: 180px; height: 150px; border: solid 3px #777;" src="" onclick="hidePerview()"/>
<div class="form-group">
<label class="control-label" for="name">Название</label>
<label class="control-label error" for="name">(Слишком короткое название точки мининум 5 символов)</label>
<input type="text" id="addPointName" name="name" class="form-control" />
</div>
<div class="form-group">
<label class="control-label" for="description">Описание</label>
<label class="control-label error" for="description">(Слишком короткое описание минимум 500 символов)</label>
<textarea id="addPointDescription" name="description" class="form-control" rows="4" placeholder="Название точки на русском языке (в скобках название на языке оригинала). Краткое описание точки. История создания, полное описание. Судьба точки в настоящее время. Интересные факты.<?= "\n"?>Если у вас нет информации для подобного описания, то подумайте, нужна-ли эта точка на карте? Будет-ли она интересна другим путешественникам?"></textarea>
</div>
<div class="form-group">
<label class="control-label" for="description">Описание</label>
<label class="control-label error" for="description">(Слишком короткое описание минимум 500 символов)</label>
<textarea id="addPointDescription" name="description" class="form-control" rows="4" placeholder="Название точки на русском языке (в скобках название на языке оригинала). Краткое описание точки. История создания, полное описание. Судьба точки в настоящее время. Интересные факты.<?= "\n" ?>Если у вас нет информации для подобного описания, то подумайте, нужна-ли эта точка на карте? Будет-ли она интересна другим путешественникам?"></textarea>
</div>
<div class="form-group extraHeader asLink">
<label class="control-label" for="imgs">Файлы и ссылки на изображения</label>
<label class="control-label error" for="imgs">(Что-то не так с изображениями!)</label>
<span class="btn btn-sm add button" onclick="addNewImage()" title="Добавить ещё одно изображение"><span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-camera"></span></span>
</div>
<div id="imgsContainer"></div>
<div class="form-group extraHeader asLink">
<label class="control-label" for="imgs">Дополнительные поля</label>
<span class="btn btn-sm add button" onclick="addNewExtraParam()" title="Добавить ещё одно изображение"><span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-bookmark"></span></span>
<div class="form-group extraHeader asLink">
<label class="control-label" for="imgs">Файлы и ссылки на изображения</label>
<label class="control-label error" for="imgs">(Что-то не так с изображениями!)</label>
<span class="btn btn-sm add button" onclick="addNewImage()" title="Добавить ещё одно изображение"><span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-camera"></span></span>
</div>
<div id="imgsContainer"></div>
<div class="form-group extraHeader asLink">
<label class="control-label" for="imgs">Дополнительные поля</label>
<span class="btn btn-sm add button" onclick="addNewExtraParam()" title="Добавить ещё одно изображение"><span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-bookmark"></span></span>
</div>
<div id="extraParamsContainer"></div>
<div class="form-group">
<label class="control-label" for="categoryId">Тип</label>
<select id="addPointCategoryId" name="categoryId" class="form-control">
<?php foreach ($categories as $category): ?>
<option value="<?= $category->id ?>"><?= $category->name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label class="control-label" for="source">Ссылка на источник</label>
<input type="text" id="addPointSource" name="source" class="form-control" placeholder="http://" />
</div>
<div class="form-group">
Координаты:
<input type="text" id="addPointLat" name="lat" class="form-control input-sm" style="width: 145px; display: inline-block;" readonly="readonly" />
<input type="text" id="addPointLng" name="lng" class="form-control input-sm" style="width: 145px; display: inline-block;" readonly="readonly" />
<button type="button" class="btn btn-sm btn-default" onclick="editSetNewCoords();"><span class="glyphicon glyphicon-screenshot"></span> изменить координаты</button>
</div>
</div>
<div id="extraParamsContainer"></div>
<div class="form-group">
<label class="control-label" for="categoryId">Тип</label>
<select id="addPointCategoryId" name="categoryId" class="form-control">
<?php foreach ($categories as $category): ?>
<option value="<?= $category->id ?>"><?= $category->name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label class="control-label" for="source">Ссылка на источник</label>
<input type="text" id="addPointSource" name="source" class="form-control" placeholder="http://" />
</div>
<div class="form-group">
Координаты:
<input type="text" id="addPointLat" name="lat" class="form-control input-sm" style="width: 145px; display: inline-block;" readonly="readonly" />
<input type="text" id="addPointLng" name="lng" class="form-control input-sm" style="width: 145px; display: inline-block;" readonly="readonly" />
<button type="button" class="btn btn-sm btn-default" onclick="editSetNewCoords();"><span class="glyphicon glyphicon-screenshot"></span> изменить координаты</button>
<div class="modal-footer">
<?php if (App::$user && App::$user->isAdmin == 1): ?>
<select id="moderate" name="status" class="form-control" style="width: 40%; display:inline-block; padding-top: 5px; float: left;">
<option value="moderation">Скрыта - на модераци</option>
<option value="published">Опубликована</option>
<option value="del">Отклонена, Удалена, Уничтожена</option>
</select>
<?php endif; ?>
<button type="button" class="btn btn-default" data-dismiss="modal">Отмена</button>
<button type="button" class="btn btn-primary" onclick="addPoint();">Сохранить</button>
</div>
</form>
</div>
<div class="modal-footer">
<select id="moderate" name="moderate" class="form-control" style="width: 40%; display: <?= (App::$user && App::$user->isAdmin == 1) ? 'inline-block' : 'none' ?>; padding-top: 5px; float: left;">
<option value="hide">Скрыта - на модераци</option>
<option value="show">Опубликована</option>
</select>
<button type="button" class="btn btn-default" data-dismiss="modal">Отмена</button>
<button type="button" class="btn btn-primary" onclick="addPoint();">Сохранить</button>
</div>
</form>
<div id="newIm">
<div class="form-group extraImage asLink" style="display: none;">
<div class="input-group">
<div class="input-group-addon type ico" title="Укажите ссылку на изображение"><input type="hidden" class="ordering" name="ordering[]" value="LINK" /><span class="glyphicon glyphicon-link"></span></div>
<input type="text" name="imgs[]" class="form-control images" placeholder="http://" />
<input type="text" name="photoLinks[]" class="form-control photoLinks" style="display: none;" placeholder="Ссылка на источник, страницу или картинку. http://..." />
<div class="input-group-addon type preview" style="border-left: 0;" onclick="showPreview($(this))" title="Предпросмотр"><span class="glyphicon glyphicon-eye-open"></span></div>
<div class="input-group-addon type button" onclick="switchType($(this))" title="Изменить поле на загрузку файла"><span class="glyphicon glyphicon-transfer"></span></div>
<div class="input-group-addon remove button" onclick="removeInput($(this))" title="Удалить это поле"><span class="glyphicon glyphicon-trash"></span></div>
<div id="newIm">
<div class="form-group extraImage asLink" style="display: none;">
<div class="input-group">
<div class="input-group-addon type ico" title="Укажите ссылку на изображение"><input type="hidden" class="ordering" name="ordering[]" value="LINK" /><span class="glyphicon glyphicon-link"></span></div>
<input type="text" name="imgs[]" class="form-control images" placeholder="http://" />
<input type="text" name="photoLinks[]" class="form-control photoLinks" style="display: none;" placeholder="Ссылка на источник, страницу или картинку. http://..." />
<div class="input-group-addon type preview" style="border-left: 0;" onclick="showPreview($(this))" title="Предпросмотр"><span class="glyphicon glyphicon-eye-open"></span></div>
<div class="input-group-addon type button" onclick="switchType($(this))" title="Изменить поле на загрузку файла"><span class="glyphicon glyphicon-transfer"></span></div>
<div class="input-group-addon remove button" onclick="removeInput($(this))" title="Удалить это поле"><span class="glyphicon glyphicon-trash"></span></div>
</div>
</div>
</div>
</div>
<div id="newExtraParam">
<div class="form-group extraParam" style="display: none;">
<div class="input-group">
<div class="input-group-addon type ico" title="Можно перетаскивать вверх и вних"><span class="glyphicon glyphicon-align-justify"></span></div>
<input type="text" name="extraParamNames[]" class="form-control names" placeholder="Имя параметра (тел., сайт, …)" maxlength="128" />
<input type="text" name="extraParamValues[]" class="form-control values" placeholder="Значение параметра" maxlength="256" />
<div class="input-group-addon remove button" onclick="removeInput($(this))" title="Удалить это поле"><span class="glyphicon glyphicon-trash"></span></div>
<div id="newExtraParam">
<div class="form-group extraParam" style="display: none;">
<div class="input-group">
<div class="input-group-addon type ico" title="Можно перетаскивать вверх и вних"><span class="glyphicon glyphicon-align-justify"></span></div>
<input type="text" name="extraParamNames[]" class="form-control names" placeholder="Имя параметра (тел., сайт, …)" maxlength="128" />
<input type="text" name="extraParamValues[]" class="form-control values" placeholder="Значение параметра" maxlength="256" />
<div class="input-group-addon remove button" onclick="removeInput($(this))" title="Удалить это поле"><span class="glyphicon glyphicon-trash"></span></div>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -5,6 +5,9 @@ $index = 0;
<div class="container" style="background-color: rgba(255,255,255, 0.8);margin-top: -10px;padding-bottom: 30px;">
<div class="row">
<div class="col-md-12">
<?php if ($point->status != Point::statusPublished): ?>
<h1 style="text-align: right; color: red;">Точка скрыта</h1>
<?php endif; ?>
<h1 style="text-align: right;"><?= $point->name ?></h1>
<div class="coords-container">
Координаты:&nbsp;

View File

@ -7,6 +7,9 @@ switch ($notification->type) {
case Notifications::typePointConfirmed:
print strftime('%d %b %H:%M', $notification->date).' — Ваша точка <a href="/point/'.$notification->objectId.'">"'.$notification->RefPoint->name.'"</a> прошла модерацию.';
break;
case Notifications::typePointDeleted:
print strftime('%d %b %H:%M', $notification->date).' — Ваша точка <a href="/point/'.$notification->objectId.'">"'.$notification->RefPoint->name.'"</a> ОТКЛОНЕНА модератором.';
break;
case Notifications::typeNewCommentPoint:
$comment = $notification->RefComment;
$point = Point::model()->getByPK($comment->parentId);