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

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
$points = Point::model()->getAll(array( $points = Point::model()->getAll(array(
'where' => '`moderate` = 1', 'where' => '`status` = "published"',
'order' => '`ord` DESC', 'order' => '`ord` DESC',
'limit' => 5, 'limit' => 5,
)); ));

View File

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

View File

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

View File

@ -2,12 +2,21 @@
class PointController extends Controller class PointController extends Controller
{ {
static function actionIndex() static function actionIndex()
{ {
self::$layout = 'layouts/page.php'; self::$layout = 'layouts/page.php';
$pointId = (int) App::getParam('id'); $pointId = (int) App::getParam('id');
if ($pointId) { 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-2.1.0.min.js');
self::addScript('/js/jquery-ui-1.10.4.custom.min.js'); self::addScript('/js/jquery-ui-1.10.4.custom.min.js');
self::addScript('/js/bootstrap.min.js'); self::addScript('/js/bootstrap.min.js');
@ -35,12 +44,11 @@ class PointController extends Controller
self::addScript('//ulogin.ru/js/ulogin.js'); self::addScript('//ulogin.ru/js/ulogin.js');
} }
$point = Point::model()->getByPK($pointId); if ($point->status != Point::statusPublished && !App::$user->isAdmin && $point->author != App::$user->id) {
if ($point->id == NULL) {
App::error404(); App::error404();
} }
$point->descriptionHtml = nl2br($point->description); $point->descriptionHtml = nl2br($point->description);
$point->name = htmlspecialchars($point->name); $point->name = htmlspecialchars($point->name);
App::setConfig('title', $point->name . ' wikipoints.ru'); App::setConfig('title', $point->name . ' wikipoints.ru');
@ -70,20 +78,20 @@ class PointController extends Controller
} }
$photoLinksRes = implode('; ', array_keys($photoLinksRes)); $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;')); $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); $closestPoints = Point::model()->getClosestPoints($pointId);
$randomPoint = Point::model()->getRandom(); $randomPoint = Point::model()->getRandom();
$randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8'); $randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8');
$randomPoint->description = Helper::replaceLinks($randomPoint->description); $randomPoint->description = Helper::replaceLinks($randomPoint->description);
$articlePoints = ArticlePoints::model()->getAll(array('where'=>'`pointId` = '.$pointId)); $articlePoints = ArticlePoints::model()->getAll(array('where' => '`pointId` = ' . $pointId));
$articleIds = array(); $articleIds = array();
$articles = array(); $articles = array();
if ($articlePoints) { if ($articlePoints) {
foreach ($articlePoints as $articlePoint) { foreach ($articlePoints as $articlePoint) {
$articleIds[] = (int)$articlePoint->articleId; $articleIds[] = (int) $articlePoint->articleId;
} }
$articles = Article::model()->getAll(array('where'=>'`id` IN ('. implode(',', $articleIds).')')); $articles = Article::model()->getAll(array('where' => '`id` IN (' . implode(',', $articleIds) . ')'));
} }
self::render('point.php', array( self::render('point.php', array(
@ -103,8 +111,6 @@ class PointController extends Controller
'extraParams' => $point->getExtraParams(), 'extraParams' => $point->getExtraParams(),
'goods' => Goods::model()->getRandom(6), 'goods' => Goods::model()->getRandom(6),
)); ));
} else {
App::error404();
}
} }
} }

View File

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

View File

@ -2,6 +2,9 @@
class Point extends Model class Point extends Model
{ {
const statusModeration = 'moderation';
const statusPublished = 'published';
const statusDel = 'del';
function __construct($fromArray = array()) function __construct($fromArray = array())
{ {
@ -35,10 +38,10 @@ class Point extends Model
public function getRandom() 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']; $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']; $pointId = $res['id'];
return $this->getByPK($pointId); return $this->getByPK($pointId);
@ -52,10 +55,10 @@ class Point extends Model
$query = ' $query = '
SELECT *, ( SELECT *, (
SQRT(POW(`lat`-:lat,2)+POW(`lng`-:lng,2)) (POW(`lat`-:lat,2)+POW(`lng`-:lng,2))
) AS `dist` FROM `' . $this->_tableName_ . '` ) AS `dist` FROM `' . $this->_tableName_ . '`
WHERE WHERE
`moderate` = 1 `status` = "published"
AND AND
`lat` BETWEEN :minLat AND :maxLat `lat` BETWEEN :minLat AND :maxLat
AND AND
@ -81,7 +84,7 @@ class Point extends Model
public function getCountByUser($userId) 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']; return $res['cnt'];
} }
@ -92,7 +95,7 @@ class Point extends Model
public function getAllPublished($bounds = false, $minEditDate = 0) 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); $minEditDate = intval($minEditDate);
if ($bounds) { if ($bounds) {
$b0 = $bounds[0] < $bounds[2] ? $bounds[0] : $bounds[2]; $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]; $b1 = $bounds[1] < $bounds[3] ? $bounds[1] : $bounds[3];
$b3 = $bounds[1] < $bounds[3] ? $bounds[3] : $bounds[1]; $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 { } 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); $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']; 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(), source: $('#addPointSource').val(),
lat: $('#addPointLat').val(), lat: $('#addPointLat').val(),
lng: $('#addPointLng').val(), lng: $('#addPointLng').val(),
moderate: $('#moderate').val() == 'show' ? 1:0, status: $('#moderate').val(),
id: id id: id
}, },
success: function (data) { success: function (data) {
@ -384,7 +384,7 @@ function editPoint(id)
$('#addPointSource').val(pointsSources[id].source); $('#addPointSource').val(pointsSources[id].source);
$('#addPointLat').val(pointsSources[id].lat); $('#addPointLat').val(pointsSources[id].lat);
$('#addPointLng').val(pointsSources[id].lng); $('#addPointLng').val(pointsSources[id].lng);
$('#moderate').val(pointsSources[id].moderate); $('#moderate').val(pointsSources[id].status);
$('.extraImage', '#imgsContainer').remove(); $('.extraImage', '#imgsContainer').remove();
$('.extraParam', '#extraParamsContainer').remove(); $('.extraParam', '#extraParamsContainer').remove();

View File

@ -152,7 +152,7 @@ function constructPoint(data)
id = data['id']; id = data['id'];
icon = categories[data['categoryId']]; icon = categories[data['categoryId']];
if (data['moderate'] != 'show') { if (data['status'] != 'published') {
icon = categories.lock; icon = categories.lock;
data['name'] = 'На модерации: ' + data['name']; data['name'] = 'На модерации: ' + data['name'];
} }
@ -272,7 +272,7 @@ function drawInfoPopup(id, showPopup, doNotPushToHistory) {
} }
onModerate = ''; onModerate = '';
if (data.moderate != 'show') { if (data.status != 'published') {
onModerate = 'На модерации: '; 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="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>'; 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>'; 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') if (getURLParameter('edit') == 'true')

View File

@ -5,6 +5,7 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Добавление новой точки</h4> <h4 class="modal-title" id="myModalLabel">Добавление новой точки</h4>
</div> </div>
<form method="POST" action="/json/addpoint/" id="addPointForm" enctype="multipart/form-data">
<div class="modal-body" style="padding-bottom: 0;"> <div class="modal-body" style="padding-bottom: 0;">
<?php if (!App::$user->isAdmin && Point::model()->getCountMyPointsToday() >= 3): ?> <?php if (!App::$user->isAdmin && Point::model()->getCountMyPointsToday() >= 3): ?>
Ещё раз здравствуйте!<br/> Ещё раз здравствуйте!<br/>
@ -13,7 +14,6 @@
<br/> <br/>
<?php else: ?> <?php else: ?>
<img id="imgPreview" style="display: none; position: absolute; top: 10px; left: 180px; height: 150px; border: solid 3px #777;" src="" onclick="hidePerview()"/> <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"> <div class="form-group">
<label class="control-label" for="name">Название</label> <label class="control-label" for="name">Название</label>
<label class="control-label error" for="name">(Слишком короткое название точки мининум 5 символов)</label> <label class="control-label error" for="name">(Слишком короткое название точки мининум 5 символов)</label>
@ -23,7 +23,7 @@
<div class="form-group"> <div class="form-group">
<label class="control-label" for="description">Описание</label> <label class="control-label" for="description">Описание</label>
<label class="control-label error" for="description">(Слишком короткое описание минимум 500 символов)</label> <label class="control-label error" for="description">(Слишком короткое описание минимум 500 символов)</label>
<textarea id="addPointDescription" name="description" class="form-control" rows="4" placeholder="Название точки на русском языке (в скобках название на языке оригинала). Краткое описание точки. История создания, полное описание. Судьба точки в настоящее время. Интересные факты.<?= "\n"?>Если у вас нет информации для подобного описания, то подумайте, нужна-ли эта точка на карте? Будет-ли она интересна другим путешественникам?"></textarea> <textarea id="addPointDescription" name="description" class="form-control" rows="4" placeholder="Название точки на русском языке (в скобках название на языке оригинала). Краткое описание точки. История создания, полное описание. Судьба точки в настоящее время. Интересные факты.<?= "\n" ?>Если у вас нет информации для подобного описания, то подумайте, нужна-ли эта точка на карте? Будет-ли она интересна другим путешественникам?"></textarea>
</div> </div>
<div class="form-group extraHeader asLink"> <div class="form-group extraHeader asLink">
@ -57,16 +57,19 @@
<input type="text" id="addPointLng" name="lng" 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> <button type="button" class="btn btn-sm btn-default" onclick="editSetNewCoords();"><span class="glyphicon glyphicon-screenshot"></span> изменить координаты</button>
</div> </div>
</form>
</div> </div>
<div class="modal-footer"> <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;"> <?php if (App::$user && App::$user->isAdmin == 1): ?>
<option value="hide">Скрыта - на модераци</option> <select id="moderate" name="status" class="form-control" style="width: 40%; display:inline-block; padding-top: 5px; float: left;">
<option value="show">Опубликована</option> <option value="moderation">Скрыта - на модераци</option>
<option value="published">Опубликована</option>
<option value="del">Отклонена, Удалена, Уничтожена</option>
</select> </select>
<?php endif; ?>
<button type="button" class="btn btn-default" data-dismiss="modal">Отмена</button> <button type="button" class="btn btn-default" data-dismiss="modal">Отмена</button>
<button type="button" class="btn btn-primary" onclick="addPoint();">Сохранить</button> <button type="button" class="btn btn-primary" onclick="addPoint();">Сохранить</button>
</div> </div>
</form>
<div id="newIm"> <div id="newIm">
<div class="form-group extraImage asLink" style="display: none;"> <div class="form-group extraImage asLink" style="display: none;">

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="container" style="background-color: rgba(255,255,255, 0.8);margin-top: -10px;padding-bottom: 30px;">
<div class="row"> <div class="row">
<div class="col-md-12"> <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> <h1 style="text-align: right;"><?= $point->name ?></h1>
<div class="coords-container"> <div class="coords-container">
Координаты:&nbsp; Координаты:&nbsp;

View File

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