diff --git a/application/admin/controllers/SysController.php b/application/admin/controllers/SysController.php index 0bfd9ff4..7b31a082 100644 --- a/application/admin/controllers/SysController.php +++ b/application/admin/controllers/SysController.php @@ -164,45 +164,118 @@ class Admin_SysController extends Zend_Controller_Action }//emailtextAction 邮件模板管理 - function seekspaceAction() - { - set_time_limit(0); - $submit = $this->_request->getParam('submit'); - if (!empty($submit)) - { - $sql="select item_id from knl_article order by id desc"; - $row=$this->db->fetchRow($sql); - try { - $this->db->beginTransaction(); - $sql="insert into knl_article (item_id) select item_id from knl_dcvalue where dc_type_id=66 and text_value='Article' and item_id>".$row['item_id']; - $this->db->query($sql); - $sql="update knl_article k set title=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=64) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; - $this->db->query($sql); - $sql="update knl_article k set url=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=25) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; - $this->db->query($sql); - $sql="update knl_article k set publisher=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=39) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; - $this->db->query($sql); - $sql="update knl_article k set ts_issued=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=15) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; - $this->db->query($sql); - $sql="update knl_article k set ts_created=cast(t.text_value as timestamp without time zone) from (select text_value,item_id from knl_dcvalue where dc_type_id=12) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; - $this->db->query($sql); - $sql="update knl_article k set keywords[t.place]=t.text_value from (select text_value,item_id,place from knl_dcvalue where dc_type_id=57) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; - $this->db->query($sql); - $sql="insert into knl_keyword (keyword,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=57 and item_id>".$row['item_id']; - $this->db->query($sql); - $sql="insert into knl_author (author,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=3 and item_id>".$row['item_id']; - $this->db->query($sql); - $this->db->query("delete from knl_keyword where item_id not in (select item_id from knl_article)"); - $this->db->query("delete from knl_author where item_id not in (select item_id from knl_article)"); - $this->db->commit(); - } catch(Exception $e) { - $this->db->rollBack(); - $this->view->msg=$e->getMessage(); - } - $this->view->msg='与文献平台同步成功!'; - } - $sql="select (select count(*) from knl_article) as westdccount,(select count(*) from knl_dcvalue where dc_type_id=66 and text_value='Article') as seekcount"; - $this->view->count=$this->db->fetchRow($sql); + function seekspaceAction() + { + set_time_limit(0); + $submit = $this->_request->getParam('submit'); + if (!empty($submit)) + { + $sql="select item_id from knl_article order by id desc"; + $row=$this->db->fetchRow($sql); + try { + $this->db->beginTransaction(); + $sql="insert into knl_article (item_id) select item_id from knl_dcvalue where dc_type_id=66 and text_value='Article' and item_id>".$row['item_id']; + $this->db->query($sql); + $sql="update knl_article k set title=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=64) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; + $this->db->query($sql); + $sql="update knl_article k set url=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=25) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; + $this->db->query($sql); + $sql="update knl_article k set publisher=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=39) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; + $this->db->query($sql); + $sql="update knl_article k set ts_issued=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=15) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; + $this->db->query($sql); + $sql="update knl_article k set ts_created=cast(t.text_value as timestamp without time zone) from (select text_value,item_id from knl_dcvalue where dc_type_id=12) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; + $this->db->query($sql); + $sql="update knl_article k set keywords[t.place]=t.text_value from (select text_value,item_id,place from knl_dcvalue where dc_type_id=57) as t where k.item_id=t.item_id and k.item_id>".$row['item_id']; + $this->db->query($sql); + $sql="insert into knl_keyword (keyword,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=57 and item_id>".$row['item_id']; + $this->db->query($sql); + $sql="insert into knl_author (author,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=3 and item_id>".$row['item_id']; + $this->db->query($sql); + $this->db->query("delete from knl_keyword where item_id not in (select item_id from knl_article)"); + $this->db->query("delete from knl_author where item_id not in (select item_id from knl_article)"); + $this->db->commit(); + } catch(Exception $e) { + $this->db->rollBack(); + $this->view->msg=$e->getMessage(); + } + $this->view->msg='与文献平台同步成功!'; + } + $sql="select (select count(*) from knl_article) as westdccount,(select count(*) from knl_dcvalue where dc_type_id=66 and text_value='Article') as seekcount"; + $this->view->count=$this->db->fetchRow($sql); } + + function getmsgAction(){ + $this->_helper->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $msg = array(); + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + if($user->usertype == "administrator") + { + include_once("message.php"); + $rs = message::getNew($this->db,$userid,"admin"); + echo Zend_Json::encode($rs); + exit(); + }else{ + $msg['error'] = "您没有权限"; + echo Zend_Json::encode($msg); + exit(); + } + }else{ + $msg['error'] = "您没有权限"; + echo Zend_Json::encode($msg); + exit(); + } + } + + function messageAction(){ + $do = $this->_request->getParam('do'); + $id = $this->_request->getParam('id'); + + if($do=='read' && !empty($id)) + { + $this->_helper->viewRenderer('messageview'); + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + if($user->usertype == "administrator") + { + include_once("message.php"); + $rs = message::getOne($this->db,$userid,$id); + $this->view->info = $rs['info']; + } + } + } + + //拉取新消息 + else + { + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + if($user->usertype == "administrator") + { + include_once("message.php"); + $rs = message::getNew($this->db,$userid,"admin"); + $this->view->totle = $rs['count']; + $paginator = Zend_Paginator::factory($rs['rows']); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage($this->view->config->page->max); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + } + }//end + + }//getmessageAction() 获取站内消息 } diff --git a/application/admin/views/scripts/index/index.phtml b/application/admin/views/scripts/index/index.phtml index 521feba3..8b760a50 100755 --- a/application/admin/views/scripts/index/index.phtml +++ b/application/admin/views/scripts/index/index.phtml @@ -1,22 +1,31 @@ -headTitle($this->config->title->site); - $this->headTitle('后台管理'); - $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); - $this->breadcrumb('首页'); - $this->breadcrumb('后台管理首页'); - $this->breadcrumb()->setSeparator(' > '); -?> -
标题 | +时间 | +操作 | +
+ | + | [查看] [标记为已读] | +