修改后台若干细节,增加按栏目查看文档的功能
This commit is contained in:
parent
5c2f05a50d
commit
cae314fda8
|
@ -29,8 +29,12 @@ class ArticleController extends AbstractActionController
|
||||||
|
|
||||||
$record = new \Sookon\Article\Article;
|
$record = new \Sookon\Article\Article;
|
||||||
$filter = new \Sookon\Search\Filter;
|
$filter = new \Sookon\Search\Filter;
|
||||||
|
$category = new \Sookon\Article\Category;
|
||||||
|
$this->ViewModel->setVariable("categories",$category->getFullCategory());
|
||||||
|
|
||||||
$keyword = isset($_GET['q']) ? $filter->mixedKeyword($_GET['q']):"";
|
$keyword = isset($_GET['q']) ? $filter->mixedKeyword($_GET['q']):"";
|
||||||
|
$cata = isset($_GET['cate']) ? $_GET["cate"] : "";
|
||||||
|
|
||||||
if(!empty($keyword))
|
if(!empty($keyword))
|
||||||
{
|
{
|
||||||
$this->ViewModel->setVariable('keyword',$keyword);
|
$this->ViewModel->setVariable('keyword',$keyword);
|
||||||
|
@ -69,8 +73,23 @@ class ArticleController extends AbstractActionController
|
||||||
}
|
}
|
||||||
|
|
||||||
$record->opt->logic = "AND";
|
$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");
|
view::addPaginator($record->fetchAll(),$this,10,"layout/admin/pagination");
|
||||||
|
|
||||||
$this->ViewModel->setTemplate('layout/admin/article/list');
|
$this->ViewModel->setTemplate('layout/admin/article/list');
|
||||||
|
|
|
@ -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'=>'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'=>'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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -36,6 +48,7 @@
|
||||||
<th>id</th>
|
<th>id</th>
|
||||||
<th>标题</th>
|
<th>标题</th>
|
||||||
<th>状态</th>
|
<th>状态</th>
|
||||||
|
<th>栏目</th>
|
||||||
<th>发布时间</th>
|
<th>发布时间</th>
|
||||||
<th>添加时间</th>
|
<th>添加时间</th>
|
||||||
<th>作者</th>
|
<th>作者</th>
|
||||||
|
@ -47,6 +60,7 @@
|
||||||
<td><?= $v['id'] ?></td>
|
<td><?= $v['id'] ?></td>
|
||||||
<td><?= $v['title'] ?></td>
|
<td><?= $v['title'] ?></td>
|
||||||
<td><?= $v['is_pub'] == 1 ? "发布":'<font color="red">未发布</font>' ?></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_published'])) ?></td>
|
||||||
<td><?= date("Y-m-d H:i",strtotime($v['ts_created'])) ?></td>
|
<td><?= date("Y-m-d H:i",strtotime($v['ts_created'])) ?></td>
|
||||||
<td><?= $v['username'] ?></td>
|
<td><?= $v['username'] ?></td>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<li class="dropdown" id="collapseArchive">
|
<li class="dropdown" id="collapseArchive">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-alt"></i> 新闻<b class="caret"></b></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-alt"></i> 新闻<b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu">
|
<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'=>'index','ac'=>'all')) ?>">文档管理</a></li>
|
||||||
<li><a href="<?= $this->url('admin',array('controller'=>'article','action'=>'add')) ?>">文档添加</a></li>
|
<li><a href="<?= $this->url('admin',array('controller'=>'article','action'=>'add')) ?>">文档添加</a></li>
|
||||||
<li class="divider"></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'=>'index')) ?>">栏目管理</a></li>
|
||||||
|
|
|
@ -77,9 +77,11 @@ class Article
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
ar.* ,mb.username
|
ar.* ,mb.username ,cate.code ,cate.title as category
|
||||||
FROM {$this->table->arc_article} ar
|
FROM {$this->table->arc_article} ar
|
||||||
LEFT JOIN {$this->table->member} mb ON ar.userid = mb.id
|
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
|
$wheresql
|
||||||
ORDER BY $order {$this->opt->sort} ";
|
ORDER BY $order {$this->opt->sort} ";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue