Файл: modules/news/index.php
Строк: 83
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_news';
# including header
$title = _t('news');
include_header($title);
$tpl->div('title', _t('news'));
# count news
$news_n = $db->query("SELECT * FROM `news`")->rowCount();
# start paginating
$pages = new Paginator($news_n, $ames);
# if not news show alert
if($news_n == 0)
{
$tpl->div('menu', _t('no_news'));
}
else # or show news
{
# create query
$news_q = $db->query("SELECT * FROM `news` ORDER by name DESC LIMIT $start, $ames");
# show news
while($news = $news_q->fetch())
{
$tpl->div('menu', img('news.png') .'<a href="/news/article/'. $news['id'] .'/">'. $news['name'] .'</a> '.($user['level'] >= 6 ? '<a href="/news/delete_news?news_id='. $news['id'] .'">'. img('delete.png') .'</a> <a href="/news/edit_news?news_id='. $news['id'] .'">'. img('edit.png') .'</a>' : NULL) .'');
}
$pages->view();
}
# navigation
$add_news = (User::logged() && $user['level'] >= 6 ? NAV .'<a href="/news/add_news/">'. _t('add_news') .'</a><br/>' : NULL);
$tpl->div('block', $add_news . HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>