public function getAll() { $count = $this->join('category c', 'article.cid', '=', 'c.id')->count('article.id'); $page = Page::row(5)->pageNum(5)->make($count); $data = $this->table('article a')->field('a.title,a.id,c.catname,a.addtime')->join('category c', 'a.cid', '=', 'c.id')->limit(Page::limit())->get(); // $data[] = $this->where('notice',1)->get(); return array('page' => $page, 'data' => $data); }
public function addAction() { $form = new PageForm($this->getServiceLocator()->get('Admin\\Model\\StatusTable'), $this->getServiceLocator()->get('Admin\\Model\\SiteMetaTable')); $form->get('submit')->setValue('Add'); $request = $this->getRequest(); if ($request->isPost()) { $page = new Page(); $form->setInputFilter($page->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $page->exchangeArray($form->getData()); $this->getPageTable()->savePage($page, $request->getPost('page_meta')); $this->flashMessenger()->addSuccessMessage('Page added successfully..!!'); // Redirect to list of pages return $this->redirect()->toRoute('admin/page'); } } return array('form' => $form); }
public function getDelAll() { $cate_id = Q('cate_id'); if ($cate_id) { $page = Page::row(20)->make($this->where('cate_id', $cate_id)->where('is_delete', 1)->count()); $data = $this->where('cate_id', $cate_id)->where('is_delete', 1)->limit(Page::limit())->get(); } else { $page = Page::row(20)->make($this->where('is_delete', 1)->count()); $data = $this->where('is_delete', 1)->limit(Page::limit())->get(); } foreach ($data as $k => $v) { $brand = Db::table('shop_brand')->where('brand_id', $v['brand_id'])->first(); $data[$k]['brand'] = $brand; $cate = Db::table('shop_cate')->where('cate_id', $v['cate_id'])->first(); $data[$k]['cate'] = $cate; } $goods['data'] = $data; $goods['page'] = $page; return $goods; }