123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- namespace app\admin\controller\article;
- use app\common\controller\Backend;
- class ArticleLangs extends Backend
- {
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\article\ArticleLangs;
- $this->view->assign("langlistList", $this->model->getLanglistList());
- }
- public function import()
- {
- parent::import();
- }
-
-
- public function index()
- {
-
- $this->relationSearch = false;
-
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
-
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $list = $this->model
- ->where($where)
- ->order($sort, $order)
- ->paginate($limit);
- foreach ($list as $row) {
- $row->visible(['id', 'article_id', 'langlist', 'title', 'createtime']);
- }
- $result = array("total" => $list->total(), "rows" => $list->items());
- return json($result);
- }
- return $this->view->fetch();
- }
-
- public function add()
- {
- if ($this->request->isPost()) {
- $params = $this->request->post("row/a");
- if ($this->model->where('article_id', $params['article_id'])->where('langlist', $params['langlist'])->find()) {
- $this->error(__('Same Language Data'));
- }
- }
- return parent::add();
- }
-
- public function edit($ids = null)
- {
- if ($this->request->isPost()) {
- $params = $this->request->post("row/a");
- if ($this->model->where('id', '<>', $ids)->where('article_id', $params['article_id'])->where('langlist', $params['langlist'])->find()) {
- $this->error(__('Same Language Data'));
- }
- }
- return parent::edit($ids);
- }
- }
|