/** 默认页 @param void @return void */ function indexAction() { $data = []; $cond = []; $url = '/admin/replace/index?1=1'; if ($this->getRequest()->getQuery('dosubmit')) { $url .= '&dosubmit=dosubmit'; if ($id = intval($this->getRequest()->getQuery('id'))) { $cond['id'] = $id; $url .= '&id=' . $cond['id']; } if ($Keywords = core::safe_str($this->getRequest()->getQuery('keywords'))) { $cond['keywords'] = $Keywords; $url .= '&Keywords=' . $cond['keywords']; } $this->getView()->assign('cond', $cond); } $page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1; //每页显示数 $offset = 15; $start = ($page - 1) * $offset; $data['data'] = $this->Keyword->search_replacewords_list($cond, $start, $offset); $total = $this->Keyword->count($cond, 'keywords'); $totalpage = ceil($total / $offset); //超过一页显示分页 if ($totalpage > 1) { $url .= '&page='; $data['page'] = (new multi())->getSubContent($url, '', $totalpage, $page, 20, ' target="_self" ', '', '', 'no'); } //每页实际显示数 $data['perNum'] = $page > $totalpage ? 0 : $page == $totalpage ? $total % $offset : $offset; $this->getView()->assign('data', $data); }
public function editAction() { $id = intval($this->getRequest()->getQuery('id')); if ($this->getRequest()->isPost()) { $value = ['username' => core::safe_str($this->getRequest()->getPost('username')), 'name' => core::safe_str($this->getRequest()->getPost('name')), 'nickname' => core::safe_str($this->getRequest()->getPost('nickname')), 'gender' => intval($this->getRequest()->getPost('gender')), 'phone' => core::safe_str($this->getRequest()->getPost('phone')), 'email' => core::is_email($this->getRequest()->getPost('email')) ? $this->getRequest()->getPost('email') : NULL, 'status' => intval($this->getRequest()->getPost('status')), 'birthday' => misc::is_date($this->getRequest()->getPost('birthday'), '-') ? strtotime($this->getRequest()->getPost('birthday')) : NULL]; if ($this->member->update($value, ['id' => intval($this->getRequest()->getPost('id'))])) { Alert::success('更新成功!'); } else { Alert::success('没有任何变化!'); } $this->redirect($this->getRequest()->getPost('referer')); } else { if ($data = $this->member->getMemberByAttribute(['id' => $id])) { $data['referer'] = $_SERVER["HTTP_REFERER"]; $this->getView()->assign('data', $data); } else { Alert::success('没有此用户!'); $this->redirect('/admin/managemember/index'); } } }
/** 默认页 @param void @return void */ function indexAction() { $data = []; $cond = []; $cond['status'] = 99; $url = '/admin/document/index?1=1'; $page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1; if ($this->getRequest()->getQuery('catsubmit')) { $url .= '&catsubmit=catsubmit'; if ($catid = intval($this->getRequest()->getQuery('catid'))) { $cond['catid'] = $catid; $url .= '&catid=' . $cond['catid']; } if ($title = core::safe_str($this->getRequest()->getQuery('title'))) { $cond['title'] = $title; $url .= '&title=' . $cond['title']; } $data['data'] = $this->category->catelist($cond['catid']); $this->getView()->assign('cond', $cond); } //每页显示数 $offset = 50; $start = ($page - 1) * $offset; $category_list = $this->category->catelist(); $data['data'] ? $data['data'] : ($data['data'] = $category_list); //总页数 $total = $this->category->get_category_count(); $totalpage = ceil($total / $offset); //超过一页显示分页 if ($totalpage > 1) { $data['page'] = (new multi())->getSubContent('/admin/category/index?page=', '', $totalpage, $page, 9, ' target="_self" ', '', '', 'no'); } $this->getView()->assign('data', $data); //格式化栏目列表 //$category_list_format = $this->treeForCategory($category_list, 7); $this->getView()->assign('category_list', $category_list); }
/** 默认页 @param void @return void */ function dexAction() { $data = []; $cond = []; $url = '/admin/page/index?1=1'; if ($this->getRequest()->getQuery('dosubmit')) { $url .= '&dosubmit=dosubmit'; if ($id = intval($this->getRequest()->getQuery('id'))) { $cond['id'] = $id; $url .= '&id=' . $cond['id']; } if ($catid = intval($this->getRequest()->getQuery('catid'))) { $cond['catid'] = $catid; $url .= '&catid=' . $cond['catid']; } if ($title = core::safe_str($this->getRequest()->getQuery('title'))) { $cond['title'] = $title; $url .= '&title=' . $cond['title']; } $this->getView()->assign('cond', $cond); } $page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1; //栏目 $data['category'] = $this->category->categoryList(['parentid' => 7], 0, 50); //每页显示数 $offset = 20; $start = ($page - 1) * $offset; $data['data'] = $this->page->pageList($cond, $start, $offset); $total = $this->page->count($cond); $totalpage = ceil($total / $offset); //超过一页显示分页 if ($totalpage > 1) { $url .= '&page='; $data['page'] = (new multi())->getSubContent($url, '', $totalpage, $page, 20, ' target="_self" ', '', '', 'no'); } //每页实际显示数 $data['perNum'] = $page > $totalpage ? 0 : $page == $totalpage ? $total % $offset : $offset; $this->getView()->assign('data', $data); }