修改后台若干细节,增加按栏目查看文档的功能

This commit is contained in:
Li Jianxuan 2014-03-06 02:16:50 +00:00
parent 5c2f05a50d
commit cae314fda8
4 changed files with 101 additions and 66 deletions

View File

@ -29,8 +29,12 @@ class ArticleController extends AbstractActionController
$record = new \Sookon\Article\Article;
$filter = new \Sookon\Search\Filter;
$category = new \Sookon\Article\Category;
$this->ViewModel->setVariable("categories",$category->getFullCategory());
$keyword = isset($_GET['q']) ? $filter->mixedKeyword($_GET['q']):"";
$cata = isset($_GET['cate']) ? $_GET["cate"] : "";
if(!empty($keyword))
{
$this->ViewModel->setVariable('keyword',$keyword);
@ -69,8 +73,23 @@ class ArticleController extends AbstractActionController
}
$record->opt->logic = "AND";
}
if($ac == "bycategory")
{
if(isset($record->opt->where) && count($record->opt->where))
{
$record->opt->where = array(
"(".join(" OR ",$record->opt->where).")",
"cate.id=$cata"
);
}else{
$record->opt->where = array("cate.id=$cata");
}
$record->opt->logic = "AND";
}
view::addPaginator($record->fetchAll(),$this,10,"layout/admin/pagination");
$this->ViewModel->setTemplate('layout/admin/article/list');

View File

@ -26,6 +26,18 @@
<a href="<?php echo $this->url('admin',array('controller'=>'article','action'=>'index','ac'=>'list')) ?>" class="btn btn-success">所有文章</a>
<a href="<?php echo $this->url('admin',array('controller'=>'article','action'=>'index','ac'=>'mine')) ?>" class="btn btn-success">我的文章</a>
<a href="<?php echo $this->url('admin',array('controller'=>'article','action'=>'add')) ?>" class="btn btn-success">添加新文章</a>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
按栏目查看 <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php if(!empty($this->categories)) { ?>
<?php foreach($this->categories as $v) { ?>
<li><a href="<?= $this->url('admin',array('controller'=>'article','action'=>'index','ac'=>'bycategory')) ?>?cate=<?=$v['id']?>"><?= str_repeat("- ",$v['ROOTDEEP']) ?><?= $v['title'] ?></a></li>
<?php } ?>
<?php } ?>
</ul>
</div>
</div>
</div>
@ -36,6 +48,7 @@
<th>id</th>
<th>标题</th>
<th>状态</th>
<th>栏目</th>
<th>发布时间</th>
<th>添加时间</th>
<th>作者</th>
@ -47,6 +60,7 @@
<td><?= $v['id'] ?></td>
<td><?= $v['title'] ?></td>
<td><?= $v['is_pub'] == 1 ? "发布":'<font color="red">未发布</font>' ?></td>
<td><?= $v['category'] ?></td>
<td><?= date("Y-m-d H:i",strtotime($v['ts_published'])) ?></td>
<td><?= date("Y-m-d H:i",strtotime($v['ts_created'])) ?></td>
<td><?= $v['username'] ?></td>

View File

@ -1,65 +1,65 @@
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div>
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo $this->url('home') ?>">三江源数据门户</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="<?php echo $this->url('admin') ?>"><?php echo $this->translate('后台首页') ?></a></li>
<li class="dropdown" id="collapseArchive">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-alt"></i> 数据<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('admin',array('controller'=>'metadata','action'=>'index','ac'=>'list')) ?>"><?= $this->translate('数据管理') ?></a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'metadata','action'=>'sync')) ?>"><?= $this->translate('数据同步') ?></a></li>
</ul>
</li>
<li class="dropdown" id="collapseArchive">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-alt"></i> 新闻<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('admin',array('controller'=>'article','action'=>'index')) ?>">文档管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'article','action'=>'add')) ?>">文档添加</a></li>
<li class="divider"></li>
<li><a href="<?= $this->url('admin',array('controller'=>'category','action'=>'index')) ?>">栏目管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'category','action'=>'add')) ?>">栏目添加</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'category','action'=>'map')) ?>">栏目地图</a></li>
</ul>
</li>
<li class="dropdown" id="collapseSys">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-wrench"></i> 系统<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('admin',array('controller'=>'users','action'=>'index','ac'=>'list')) ?>">用户管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'users','action'=>'config')) ?>">邮件模板</a></li>
</ul>
</li>
</ul>
<?php $user = \Sookon\Helpers\View::User(); ?>
<ul class="nav navbar-nav user_menu pull-right">
<li class="divider-vertical hidden-phone hidden-tablet"></li>
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-wrench"></i>
<?php
if(isset($user->avatar))
{
echo '<img src="'.$user->avatar.'" alt="" class="user_avatar" style="height:16px;margin-right:3px;" />';
}
echo $user->username;
?>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('home') ?>">前台首页</a></li>
<li><a href="<?= $this->url('home/default',array('controller'=>'account','action'=>'index')) ?>">个人资料</a></li>
<li><a href="<?= $this->url('home/default',array('controller'=>'account','action'=>'edit')) ?>">编辑</a></li>
<li class="divider"></li>
<li><a href="<?= $this->url('home/default',array('controller'=>'account','action'=>'logout')) ?>">注销</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div>
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo $this->url('home') ?>">三江源数据门户</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="<?php echo $this->url('admin') ?>"><?php echo $this->translate('后台首页') ?></a></li>
<li class="dropdown" id="collapseArchive">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-alt"></i> 数据<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('admin',array('controller'=>'metadata','action'=>'index','ac'=>'list')) ?>"><?= $this->translate('数据管理') ?></a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'metadata','action'=>'sync')) ?>"><?= $this->translate('数据同步') ?></a></li>
</ul>
</li>
<li class="dropdown" id="collapseArchive">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-alt"></i> 新闻<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('admin',array('controller'=>'article','action'=>'index','ac'=>'all')) ?>">文档管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'article','action'=>'add')) ?>">文档添加</a></li>
<li class="divider"></li>
<li><a href="<?= $this->url('admin',array('controller'=>'category','action'=>'index')) ?>">栏目管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'category','action'=>'add')) ?>">栏目添加</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'category','action'=>'map')) ?>">栏目地图</a></li>
</ul>
</li>
<li class="dropdown" id="collapseSys">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-wrench"></i> 系统<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('admin',array('controller'=>'users','action'=>'index','ac'=>'list')) ?>">用户管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'users','action'=>'config')) ?>">邮件模板</a></li>
</ul>
</li>
</ul>
<?php $user = \Sookon\Helpers\View::User(); ?>
<ul class="nav navbar-nav user_menu pull-right">
<li class="divider-vertical hidden-phone hidden-tablet"></li>
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-wrench"></i>
<?php
if(isset($user->avatar))
{
echo '<img src="'.$user->avatar.'" alt="" class="user_avatar" style="height:16px;margin-right:3px;" />';
}
echo $user->username;
?>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('home') ?>">前台首页</a></li>
<li><a href="<?= $this->url('home/default',array('controller'=>'account','action'=>'index')) ?>">个人资料</a></li>
<li><a href="<?= $this->url('home/default',array('controller'=>'account','action'=>'edit')) ?>">编辑</a></li>
<li class="divider"></li>
<li><a href="<?= $this->url('home/default',array('controller'=>'account','action'=>'logout')) ?>">注销</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>

View File

@ -77,9 +77,11 @@ class Article
}
$sql = "SELECT
ar.* ,mb.username
ar.* ,mb.username ,cate.code ,cate.title as category
FROM {$this->table->arc_article} ar
LEFT JOIN {$this->table->member} mb ON ar.userid = mb.id
LEFT JOIN (select aid,min(cid) as cid from {$this->table->arc_catelog} group by aid) as log ON ar.id = log.aid
LEFT JOIN {$this->table->arc_category} cate ON log.cid = cate.id
$wheresql
ORDER BY $order {$this->opt->sort} ";