File size: 1.2Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.pp.ua *
**********************************/
$locate = 'in_news';
$title = $lang->word('news');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('news'));
$news_n = $db->query("SELECT * FROM `news`")->rowCount();
$pages = new Paginator($news_n, $ames);
if($news_n == 0)
{
$tpl->div('menu', $lang->word('no_news'));
}
else {
$news_q = $db->query("SELECT * FROM `news` ORDER by name DESC LIMIT $start, $ames");
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/del_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('/news/?');
}
$add_news = ''.(isset($user) && $user['level'] >= '6' ? NAV .'<a href="/news/add_news/">'. $lang->word('add_news') .'</a><br/>' : NULL).'';
$tpl->div('block', $add_news . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>