You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
<?php
|
|
|
|
namespace app\admin\controller\example;
|
|
|
|
use app\common\controller\Backend;
|
|
|
|
/**
|
|
* 表格模板示例
|
|
*
|
|
* @icon fa fa-table
|
|
* @remark 可以通过使用表格模板将表格中的行渲染成一样的展现方式,基于此功能可以任意定制自己想要的展示列表
|
|
*/
|
|
class Tabletemplate extends Backend
|
|
{
|
|
protected $model = null;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = model('AdminLog');
|
|
}
|
|
|
|
/**
|
|
* 查看
|
|
*/
|
|
public function index()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams(null);
|
|
$total = $this->model
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->count();
|
|
$list = $this->model
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->limit($offset, $limit)
|
|
->select();
|
|
$result = array("total" => $total, "rows" => $list);
|
|
|
|
return json($result);
|
|
}
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
/**
|
|
* 详情
|
|
*/
|
|
public function detail($ids)
|
|
{
|
|
$row = $this->model->get(['id' => $ids]);
|
|
if (!$row) {
|
|
$this->error(__('No Results were found'));
|
|
}
|
|
$this->view->assign("row", $row->toArray());
|
|
return $this->view->fetch();
|
|
}
|
|
}
|
|
|