切换为新的Archive类和ArchiveCategory类

This commit is contained in:
wlx 2012-11-30 15:12:27 +00:00
parent 24541f8ee7
commit a673040e9a
2 changed files with 30 additions and 37 deletions

View File

@ -14,8 +14,7 @@ class Admin_NewsController extends Zend_Controller_Action
} }
function indexAction() function indexAction()
{ {
include_once("news.php"); $News = new Archive($this->db);
$News = new news($this->db);
$sql = "SELECT count(id) as c FROM ".$News->tbl_archives; $sql = "SELECT count(id) as c FROM ".$News->tbl_archives;
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
@ -31,8 +30,7 @@ class Admin_NewsController extends Zend_Controller_Action
function newslistAction(){ function newslistAction(){
include_once("news.php"); $News = new Archive($this->db);
$News = new news($this->db);
$type = $this->_request->getParam('type'); $type = $this->_request->getParam('type');
@ -66,8 +64,8 @@ class Admin_NewsController extends Zend_Controller_Action
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$category = new Category($this->db); $category = new ArchiveCategory($this->db);
$this->view->types= $category->GetCategory(); $this->view->types= $category->GetFullCategory();
$this->view->type = $type; $this->view->type = $type;
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
}//newslistAction 新闻列表 }//newslistAction 新闻列表
@ -81,8 +79,7 @@ class Admin_NewsController extends Zend_Controller_Action
$edit = $this->_request->getParam('edit'); $edit = $this->_request->getParam('edit');
include_once("news.php"); $News = new Archive($this->db);
$News = new news($this->db);
if($add) if($add)
{ {
@ -90,8 +87,8 @@ class Admin_NewsController extends Zend_Controller_Action
$this->_helper->viewRenderer('category-add'); $this->_helper->viewRenderer('category-add');
$category = new Category($this->db); $category = new ArchiveCategory($this->db);
$catlogs = $category->GetCategory(); $catlogs = $category->GetFullCategory();
$this->view->categories=$catlogs; $this->view->categories=$catlogs;
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
@ -166,9 +163,9 @@ class Admin_NewsController extends Zend_Controller_Action
$this->_helper->viewRenderer('category-edit'); $this->_helper->viewRenderer('category-edit');
$this->view->ptype = $News->ptype; $this->view->ptype = $News->ptype;
$category = new Category($this->db); $category = new ArchiveCategory($this->db);
$this->view->info = $category->GetOne($edit); $this->view->info = $category->GetOne($edit);
$this->view->categories = $category->GetCategory(); $this->view->categories = $category->GetFullCategory();
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
if(!empty($submit)) if(!empty($submit))
@ -218,9 +215,9 @@ class Admin_NewsController extends Zend_Controller_Action
else else
{ {
include_once("news.php");
$category = new Category($this->db); $category = new ArchiveCategory($this->db);
$catlogs = $category->GetCategory(); $catlogs = $category->GetFullCategory();
$this->view->catlogs=$catlogs; $this->view->catlogs=$catlogs;
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
}//栏目列表 }//栏目列表
@ -267,10 +264,9 @@ class Admin_NewsController extends Zend_Controller_Action
//新闻添加页面 //新闻添加页面
function newsaddAction() function newsaddAction()
{ {
include_once("news.php"); $category = new ArchiveCategory($this->db);
$category = new Category($this->db); $catlogs = $category->GetFullCategory();
$catlogs = $category->GetCategory();
$this->view->types=$catlogs; $this->view->types=$catlogs;
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
}//newsadd 新闻添加 }//newsadd 新闻添加
@ -278,8 +274,8 @@ class Admin_NewsController extends Zend_Controller_Action
//文档编辑 //文档编辑
function newseditAction() function newseditAction()
{ {
include_once("news.php");
$News = new news($this->db); $News = new Archive($this->db);
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
@ -312,8 +308,8 @@ class Admin_NewsController extends Zend_Controller_Action
$this->view->keywords = join(",",$News->GetTags($id)); $this->view->keywords = join(",",$News->GetTags($id));
$category = new Category($this->db); $category = new ArchiveCategory($this->db);
$catlogs = $category->GetCategory(); $catlogs = $category->GetFullCategory();
$this->view->types=$catlogs; $this->view->types=$catlogs;
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
} }
@ -324,8 +320,8 @@ class Admin_NewsController extends Zend_Controller_Action
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
include_once("news.php");
$News = new news($this->db); $News = new Archive($this->db);
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
if($auth->hasIdentity()) if($auth->hasIdentity())
@ -490,8 +486,8 @@ class Admin_NewsController extends Zend_Controller_Action
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
include_once("news.php");
$News = new news($this->db); $News = new Archive($this->db);
$News->DeleteArchives($id); $News->DeleteArchives($id);
$this->messenger->addMessage('提示信息:档案删除成功!'); $this->messenger->addMessage('提示信息:档案删除成功!');

View File

@ -12,9 +12,8 @@ class NewsController extends Zend_Controller_Action
function indexAction() function indexAction()
{ {
include_once("news.php"); $News = new Archive($this->db);
$News = new news($this->db); $category = new ArchiveCategory($this->db);
$category = new Category($this->db);
$this->view->types = $category->GetCategory(); $this->view->types = $category->GetCategory();
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
@ -62,8 +61,7 @@ class NewsController extends Zend_Controller_Action
} }
include_once("news.php"); $News = new Archive($this->db);
$News = new news($this->db);
$sql = "SELECT id,code,title FROM ".$News->tbl_categorys." WHERE code='$type' AND is_pub=true "; $sql = "SELECT id,code,title FROM ".$News->tbl_categorys." WHERE code='$type' AND is_pub=true ";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
@ -79,7 +77,7 @@ class NewsController extends Zend_Controller_Action
$this->view->url = $row['code']; $this->view->url = $row['code'];
$this->view->title = $row['title']; $this->view->title = $row['title'];
$category = new Category($this->db); $category = new ArchiveCategory($this->db);
$this->view->types = $category->GetCategory(); $this->view->types = $category->GetCategory();
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
@ -118,13 +116,12 @@ class NewsController extends Zend_Controller_Action
$this->_forward('error', 'error', null, null); $this->_forward('error', 'error', null, null);
} }
include_once("news.php"); $News = new Archive($this->db);
$News = new news($this->db); $category = new ArchiveCategory($this->db);
$category = new Category($this->db);
$this->view->types = $category->GetCategory(); $this->view->types = $category->GetCategory();
$this->view->deepField = $category->DeepTitle; $this->view->deepField = $category->DeepTitle;
$time = date("Y-m-d H:i:s",time()); $time = date("Y-m-d",time());
$sql = "SELECT n.*,c.title as typename,c.code,u.realname as author FROM ".$News->tbl_archives." n $sql = "SELECT n.*,c.title as typename,c.code,u.realname as author FROM ".$News->tbl_archives." n
left join ".$News->tbl_catalog." ct on ct.aid=n.id left join ".$News->tbl_catalog." ct on ct.aid=n.id