diff --git a/application/admin/controllers/NewsController.php b/application/admin/controllers/NewsController.php index c84d1049..167080a2 100644 --- a/application/admin/controllers/NewsController.php +++ b/application/admin/controllers/NewsController.php @@ -85,187 +85,7 @@ class Admin_NewsController extends Zend_Controller_Action $this->view->deepField = $category->DeepTitle; }//newslistAction 新闻列表 - function catlogAction() - { - $add = $this->_request->getParam('add'); - $submit = $this->_request->getParam('submit'); - $delete = $this->_request->getParam('delete'); - - $edit = $this->_request->getParam('edit'); - - $News = new Archive($this->db); - - if($add) - { - $this->view->ptype = $News->ptype; - - $this->_helper->viewRenderer('category-add'); - - $category = new ArchiveCategory($this->db); - $catlogs = $category->GetFullCategory(); - $this->view->categories=$catlogs; - $this->view->deepField = $category->DeepTitle; - - if(empty($submit)){ - - //$this->_helper->viewRenderer('category-add'); - - }else{ - - $data = array(); - - $data['title'] = $this->_request->getParam('ctitle'); - $data['code'] = $this->_request->getParam('code'); - $data['fid'] = $this->_request->getParam('fid'); - $data['ptype'] = $this->_request->getParam('ptype'); - - $data['is_pub'] = 1; - - $this->view->info = $data; - - if(empty($data['title'])) - { - $this->view->error = "请输入标题"; - return true; - } - - if(empty($data['code'])) - { - $this->view->error = "请输入栏目连接,如http://westdc.westgis.ac.cn/news/notice,则只需要输入notice"; - return true; - } - - if(!preg_match("/^[a-z]+$/",$data['code'])) - { - $this->view->error = "url格式不正确,仅允许26个小写字母"; - return true; - } - - $LftRgt = $category->Insert($data['fid']); - $data['tid'] = $data['fid']; - $data['lft'] = $LftRgt['left']; - $data['rgt'] = $LftRgt['right']; - unset($data['fid']); - - if($this->db->insert($category->CategoryTable,$data)) - { - $this->view->msg = '提示信息:栏目添加成功!'; - $this->view->jump_url = '/admin/news/catlog'; - return true; - }else{ - $this->view->error = "添加失败,请重试"; - return true; - } - - } - - }//栏目添加 - if($delete>0) - { - $sql = "delete from ".$News->tbl_categorys." where id='$delete'"; - if($this->db->exec($sql)>0) - { - $this->messenger->addMessage('提示信息:栏目删除成功!'); - $this->_redirect('/admin/news/catlog'); - } - - }//栏目删除 - - if($edit>0) - { - $submit = $this->_getParam('submit'); - $this->_helper->viewRenderer('category-edit'); - - $this->view->ptype = $News->ptype; - $category = new ArchiveCategory($this->db); - $this->view->info = $category->GetOne($edit); - $this->view->categories = $category->GetFullCategory(); - $this->view->deepField = $category->DeepTitle; - - if(!empty($submit)) - { - - $data = array(); - - $data['title'] = $this->_request->getParam('ctitle'); - $data['code'] = $this->_request->getParam('code'); - $data['fid'] = $this->_request->getParam('fid'); - $data['ptype'] = $this->_request->getParam('ptype'); - $data['is_pub'] = $this->_request->getParam('is_pub'); - - $this->view->info = $data; - - if(empty($data['title'])) - { - $this->view->error = "请输入标题"; - return true; - } - - if(empty($data['code'])) - { - $this->view->error = "请输入栏目连接,如http://westdc.westgis.ac.cn/news/notice,则只需要输入notice"; - return true; - } - - if(!preg_match("/^[a-z]+$/",$data['code'])) - { - $this->view->error = "url格式不正确,仅允许26个小写字母"; - return true; - } - - $LftRgt = $category->Insert($data['fid']); - $data['tid'] = $data['fid']; - $data['lft'] = $LftRgt['left']; - $data['rgt'] = $LftRgt['right']; - unset($data['fid']); - - if($this->db->update($News->tbl_categorys,$data,"id=$edit")) - { - $this->view->msg = '提示信息:栏目添加成功!'; - $this->view->jump_url = '/admin/news/catlog'; - return true; - }else{ - $this->view->error = "添加失败,请重试"; - return true; - } - - } - - }//栏目编辑 - - else - { - - $category = new ArchiveCategory($this->db); - $News = new Archive($this->db); - - $catlogs = $category->GetFullCategory(); - $ptype = $News->ptype; - - foreach($catlogs as $k=>$v) - { - $url_parts = array( - "ptype"=>$v['ptype'], - "type_code"=>$v['code'] - ); - $catlogs[$k]['url'] = $News->makeCategoryUrl($url_parts); - - foreach($ptype as $kk=>$vv) - { - if($catlogs[$k]['ptype'] == $vv) - { - $catlogs[$k]['ptype'] = $kk; - } - } - } - $this->view->catlogs=$catlogs; - $this->view->deepField = $category->DeepTitle; - }//栏目列表 - - - }//栏目管理 - function getSubCategory($fid) { $sql = "SELECT * FROM news_category WHERE fid=?"; diff --git a/application/admin/views/scripts/news/left.phtml b/application/admin/views/scripts/news/left.phtml index 023a4138..e6664d9d 100644 --- a/application/admin/views/scripts/news/left.phtml +++ b/application/admin/views/scripts/news/left.phtml @@ -1,8 +1,6 @@
\ No newline at end of file