ADD UserController
This commit is contained in:
parent
d98a0cfe5d
commit
91566e2ad9
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
static function actionIndex()
|
||||
{
|
||||
if (!App::getParam('id')) {
|
||||
if (App::$user) {
|
||||
App::redirect('/user/'.App::$user->id);
|
||||
} else {
|
||||
App::redirect('/');
|
||||
}
|
||||
}
|
||||
|
||||
$id = (int) App::getParam('id');
|
||||
$user = User::model()->getByPK($id);
|
||||
|
||||
if (!$user) {
|
||||
App::error404();
|
||||
}
|
||||
|
||||
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::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');
|
||||
|
||||
|
||||
$articles = Article::model()->getAll(array('where'=>'`author`='.(int)$user->id));
|
||||
|
||||
$randomPoint = Point::model()->getRandom();
|
||||
$randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8');
|
||||
$randomPoint->description = Helper::replaceLinks($randomPoint->description);
|
||||
|
||||
self::render('user/index.php', array(
|
||||
'user' => $user,
|
||||
'articles' => $articles,
|
||||
'randomPoint' => $randomPoint,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<div id="pageSmoothBackground" style="background-image: url(<?= $randomPoint->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;"><?= $user->nick ?> <img src="/img/avatars/<?= $user->id ?>.jpg"></h1>
|
||||
|
||||
|
||||
<div style="text-align: justify;">
|
||||
<h2>Общая информация</h2>
|
||||
Имя: <b><?= $user->name ?></b><br/>
|
||||
Ссылка на профиль с соц. сети: <a href="<?= $user->profile?>" target="_blank"><?= $user->network?></a><br/>
|
||||
Создано точек: <b><?= $user->getPointsCount() ?></b><br/>
|
||||
|
||||
<h2>Статьи: </h2>
|
||||
<?php if ($articles): foreach ($articles as $article): ?>
|
||||
<b><a href="/page/article/id/<?= $article->id ?>" target="_blank"><?= $article->title ?></a></b><br/>
|
||||
<?php endforeach;
|
||||
else: ?>
|
||||
Пока нет статей.
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<!--googleoff: all-->
|
||||
<!--noindex-->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<a href="/point/<?= $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="/point/<?= $randomPoint->id ?>" role="button"><nobr> читать далее »</nobr></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--/noindex-->
|
||||
<!--googleon: all-->
|
||||
</div>
|
||||
Loading…
Reference in New Issue