<?php
$index = 0;
?>
<div id="pageSmoothBackground" style="background-image: url(<?= $point->getImg('middle') ?>);"></div>
<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">
			<h1 style="text-align: right;"><?= $point->name ?></h1>
			<div class="coords-container">
				Координаты:&nbsp;
				<nobr>
					<?= $point->lat > 0 ? 'N' : 'S' ?><?= number_format(abs($point->lat), 5, '.', '') ?>°
					<?= $point->lng > 0 ? 'E' : 'W' ?><?= number_format(abs($point->lng), 5, '.', '') ?>°
				</nobr>
				&nbsp;&nbsp;/&nbsp;&nbsp;
				<nobr>
					<?= $point->lat > 0 ? 'N' : 'S' ?><?= Coord::dergeeToMinute($point->lat) ?>
					<?= $point->lng > 0 ? 'E' : 'W' ?><?= Coord::dergeeToMinute($point->lng) ?>
				</nobr>
				&nbsp;&nbsp;/&nbsp;&nbsp;
				<a href="/?point=<?= $point->id ?>">На карте</a>
				<?php if ($user && $user->isAdmin): ?>
					&nbsp;&nbsp;/&nbsp;&nbsp;
					<a href="/?point=<?= $point->id ?>&edit=true">Редактировать</a>
				<?php endif; ?>
			</div>

			<div style="text-align: justify;">
				<?php
				if (count($text) > 4) {
					for ($index = 0; $index < 4; $index++) {
						print $text[$index];
					}
				} else {
					print $point->descriptionHtml;
				}
				?>

				<?php if ($photos || $point->img): ?>
					<br/><br/>
					<div style="text-align: center;">
						<div class="dfotorama"  data-loop="true" data-nav="thumbs" data-thumbwidth="100" data-keyboard="true">
							<?php if ($point->img): ?>
								<img data-thumb="<?= $point->img ?>" src="<?= $point->img ?>">
							<?php endif; ?>
							<?php if ($photos): ?>
								<?php foreach ($photos as $photo): ?>
									<img data-thumb="/photos/small/<?= $photo->name ?>" src="/photos/middle/<?= $photo->name ?>" data-caption="<?= $photo->getOriginalLink()?>">
								<?php endforeach; ?>
							<?php endif; ?>
							<span data-thumb="/img/mapThumb.png">
								<div id="map" style="width: 100%; height: 100%; position: static; display: block;"></div>
							</span>
						</div>
					</div>
					<br/><br/>
				<?php endif; ?>

				<?php
				if (count($text) > 4) {
					for ($index = $index; $index < count($text); $index++) {
						print $text[$index] . ' ';
					}

					print "<br/><br/>";
				}
				?>

				<?php if ($photoLinks): ?>
					Использованы фотоматериалы с сайтов: <?= $photoLinks ?>
				<?php endif; ?>
			</div>

			<p style="margin-top: 25px; text-align: right;">
				<?php if (App::$user && App::$user->id): ?>
					[ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveFavorite(<?= $point->id ?>)"><span id="myFavoritesButton" class="glyphicon glyphicon-star<?= $point->inFavorites ? '' : '-empty' ?>"></span> Хочу посетить</button> ]
					[ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveLike(<?= $point->id ?>)"><span id="myLikesButton" class="glyphicon glyphicon-<?= $point->iLike ? 'ok' : 'thumbs-up' ?>"></span> Нравится</button> ]
				<?php else: ?>
					[ <span class="glyphicon glyphicon-star"></span> <?= $countInFavs ?> - в закладках ]
					[ <span class="glyphicon glyphicon-thumbs-up"></span> <?= $countLikes ?> - нравится ]
				<?php endif; ?>
				[ <span class="glyphicon glyphicon-user"></span> <?= $point->authorUser->nick ?> - <span class="glyphicon glyphicon-pencil" title="<?= date('d-m-Y H:i', $point->date) ?>"></span> <?= $point->authorUser->getPointsCount() ?> ]
				<?php if (App::$user && App::$user->isAdmin == 1): ?>
					[ <span class="glyphicon glyphicon-new-window"></span> <a href="<?= $point->source ?>" target="_blank">источник: <?= $point->source ?></a> ]
				<?php endif; ?>
			</p>
		</div>
	</div>
	<hr/>
	<!--googleoff: all-->
	<!--noindex-->
	<div class="row">
		<div class="col-md-12">
			<h3 style="margin-top: 0;">Поблизости:</h3>
			<?php if (empty($closestPoints)): ?>
				нет известных нам точек.
			<?php else: ?>
				<?php foreach ($closestPoints as $cPoint): ?><a href="/page/point/id/<?= $cPoint->id ?>" class="pagePoinsNearCards"><img src="<?= $cPoint->getImg() ?>" title="<?= $cPoint->name ?>" class="pagePoinsNearCardsImg"/></a><?php endforeach; ?>
			<?php endif; ?>
		</div>
	</div>
	<hr/>
	<div class="row">
		<div class="col-md-12">
			<h3 style="margin-top: 0;">Похожие:</h3>
			<?php foreach ($similarPoints as $sPoint): ?><a href="/page/point/id/<?= $sPoint->id ?>" class="pagePoinsNearCards"><img src="<?= $sPoint->getImg() ?>" title="<?= $sPoint->name ?>" class="pagePoinsNearCardsImg"/></a><?php endforeach; ?>
		</div>
	</div>
	<hr/>
	<div class="row">
		<div class="col-md-12">
			<a href="/page/point/id/<?= $randomPoint->id ?>" style="float: left; margin: 0 20px 0 0;"><img src="<?= $randomPoint->getImg() ?>" style="width: 200px;"/></a>
			<h3 style="margin-top: 0;">Это интересно: <?= $randomPoint->name ?></h3>
			<p>
				<?= mb_substr($randomPoint->description, 0, 400, 'UTF-8') ?>...
				<a class="" href="/page/point/id/<?= $randomPoint->id ?>" role="button"><nobr> читать далее »</nobr></a>
			</p>
		</div>
	</div>
	<!--/noindex-->
	<!--googleon: all-->
</div>
