724 lines
25 KiB
PHP
724 lines
25 KiB
PHP
<?php
|
|
use Helpers\View as view;
|
|
|
|
class Admin_SysController extends Zend_Controller_Action
|
|
{
|
|
function preDispatch()
|
|
{
|
|
$this->db=Zend_Registry::get('db');
|
|
$this->view->config = Zend_Registry::get('config');
|
|
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
|
$this->view->messages = $this->messenger->getMessages();
|
|
$this->_helper->layout->setLayout('administry');//新UI
|
|
$this->view->theme = new Theme();
|
|
}
|
|
|
|
function postDispatch()
|
|
{
|
|
$this->view->messages = $this->messenger->getMessages();
|
|
}
|
|
|
|
function indexAction()
|
|
{
|
|
//$this->_helper->viewRenderer('');
|
|
//$this->messenger->addMessage('');
|
|
//$this->_redirect('');
|
|
}//indexAction 首页
|
|
|
|
function emailtextAction(){
|
|
|
|
$ac = $this->_request->getParam('ac');
|
|
$submit = $this->_request->getParam('submit');
|
|
$id = $this->_request->getParam('id');
|
|
|
|
if($ac=='add' && empty($submit))
|
|
{
|
|
$this->_helper->viewRenderer('emailtextadd');
|
|
}
|
|
|
|
if($ac=='add' && !empty($submit))
|
|
{
|
|
$title = $this->_request->getParam('title');
|
|
$template = $this->_request->getParam('template');
|
|
$body = $this->_request->getParam('body');
|
|
|
|
if(empty($title)) $title=='未命名模板';
|
|
|
|
$sql = "insert into emailtext (subject,template,body) values ('$title','$template','$body')";
|
|
|
|
try{
|
|
if($this->db->exec($sql)>0)
|
|
{
|
|
$this->messenger->addMessage('模板添加成功');
|
|
$this->_redirect('/admin/sys/emailtext');
|
|
}
|
|
}catch(Exception $e){
|
|
$this->messenger->addMessage('模板添加失败:'.$e->getMessage());
|
|
$this->_redirect('/admin/sys/emailtext');
|
|
}
|
|
}//创建新模板
|
|
|
|
else if($ac=='edit'&& !empty($id))
|
|
{
|
|
if(!empty($submit))
|
|
{
|
|
$title = $this->_request->getParam('title');
|
|
$template = $this->_request->getParam('template');
|
|
$body = $this->_request->getParam('body');
|
|
|
|
$sql = "update emailtext set subject='$title',template='$template',body='$body',ts_changed=now() where id='$id'";
|
|
|
|
try{
|
|
if($this->db->exec($sql)>0)
|
|
{
|
|
$this->messenger->addMessage('模板编辑成功');
|
|
$this->_redirect('/admin/sys/emailtext');
|
|
}
|
|
}catch(Exception $e){
|
|
$this->messenger->addMessage('模板编辑失败:'.$e->getMessage());
|
|
$this->_redirect('/admin/sys/emailtext');
|
|
}
|
|
}else{
|
|
$sql = "select * from emailtext where id='$id'";
|
|
$rs = $this->db->query($sql);
|
|
$rows = $rs->fetch();
|
|
$this->view->info = $rows;
|
|
$this->_helper->viewRenderer('emailtextedit');
|
|
}
|
|
|
|
}//模板编辑
|
|
|
|
else if($ac=='del'&& !empty($id))
|
|
{
|
|
$sql="delete from emailtext where id='$id' ";
|
|
$rs = $this->db->query($sql);
|
|
view::Post($this,'模板已删除',-1);
|
|
return;
|
|
|
|
}
|
|
|
|
else if($ac=='test'&& !empty($id))
|
|
{
|
|
if(!empty($submit))
|
|
{
|
|
try{
|
|
$subject = $this->_request->getParam('subject');
|
|
$email = $this->_request->getParam('email');
|
|
$body = $this->_request->getParam('body');
|
|
|
|
if(empty($subject) || empty($email))
|
|
{
|
|
$this->messenger->addMessage('请填写测试邮件发送信息');
|
|
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
|
}
|
|
|
|
$mailtp=new EmailText($this->db,$this->_request->getParam('id'),array('user' => $this->_request->getParam('user')));
|
|
$body = $mailtp->getBody();
|
|
if($body === false)
|
|
{
|
|
$this->messenger->addMessage('模板加载失败');
|
|
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
|
}
|
|
|
|
|
|
$mail=new WestdcMailer($this->view->config->smtp);
|
|
|
|
$mail->setBodyText($body);
|
|
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
|
$mail->addTo($email);
|
|
$mail->setSubject($subject);
|
|
|
|
if($mail->send()){
|
|
$this->messenger->addMessage('测试邮件发送成功');
|
|
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
|
}else{
|
|
$this->messenger->addMessage('测试邮件发送失败');
|
|
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
|
}
|
|
}catch(Exception $e){
|
|
$this->messenger->addMessage('测试邮件发送失败'.$e->getMessage());
|
|
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$sql = "select * from emailtext where id='$id'";
|
|
$rs = $this->db->query($sql);
|
|
$rows = $rs->fetch();
|
|
$this->view->info = $rows;
|
|
$this->_helper->viewRenderer('emailtexttest');
|
|
}
|
|
|
|
}//模板测试
|
|
|
|
else if($ac=='help')
|
|
{
|
|
$this->_helper->viewRenderer('emailtexthelp');
|
|
}
|
|
|
|
else
|
|
{
|
|
try{
|
|
$sql = "select id,subject,template,ts_created,ts_changed from emailtext order by ts_changed desc";
|
|
$rs = $this->db->query($sql);
|
|
$rows = $rs->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($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;
|
|
}catch (Exception $e){
|
|
echo $e->getMessage();
|
|
}
|
|
}//邮件模板管理首页
|
|
|
|
}//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 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 if($do=="listall")
|
|
{
|
|
$sql = "SELECT * FROM messages m
|
|
LEFT JOIN messages_logs ml ON m.id=ml.mid
|
|
ORDER BY m.sendtime DESC";
|
|
$result = $this->db->query($sql);
|
|
$rows = $result->fetchAll();
|
|
$paginator = Zend_Paginator::factory($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;
|
|
}
|
|
|
|
//标记为已读
|
|
else if($do=="close" && !empty($id))
|
|
{
|
|
$auth = Zend_Auth::getInstance();
|
|
if($auth->hasIdentity())
|
|
{
|
|
$user = $auth->getIdentity();
|
|
$userid = $user->id;
|
|
include_once("message.php");
|
|
$rs = message::read($this->db,$userid,$id);
|
|
$this->_redirect('/admin/sys/message');
|
|
}
|
|
|
|
}
|
|
|
|
//标记为已处理(不再推送给其他管理员)
|
|
else if($do=="over" && !empty($id))
|
|
{
|
|
$auth = Zend_Auth::getInstance();
|
|
if($auth->hasIdentity())
|
|
{
|
|
$user = $auth->getIdentity();
|
|
$userid = $user->id;
|
|
if($user->usertype == "administrator")
|
|
{
|
|
include_once("message.php");
|
|
$rs = message::over($this->db,$id);
|
|
if($rs){
|
|
echo "操作成功!";exit();
|
|
}else{
|
|
echo "操作失败!";exit();
|
|
}
|
|
}else{
|
|
echo "非法操作!";exit();
|
|
}
|
|
}else{
|
|
echo "非法操作!";exit();
|
|
}
|
|
}
|
|
|
|
//拉取新消息
|
|
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() 获取站内消息
|
|
|
|
//ftp测试
|
|
function ftptestAction()
|
|
{
|
|
}
|
|
|
|
//区域管理
|
|
function regionsAction()
|
|
{
|
|
include_once("data/Regions.php");
|
|
include_once("helper/view.php");
|
|
|
|
$region = new Region($this->db);
|
|
|
|
$ac = $this->_getParam('ac');
|
|
$id = $this->_getParam("id");
|
|
|
|
$RegionListener = new RegionListener();
|
|
@$region->events()->attachAggregate($RegionListener);
|
|
|
|
if(empty($ac) || $ac == "index")
|
|
{
|
|
$filter = array();
|
|
|
|
$q = $this->_getParam('keyword');
|
|
if(!empty($q))
|
|
{
|
|
$filter['q'] = $q;
|
|
$this->view->keyword = $q;
|
|
}
|
|
|
|
$data = $region->fetchRegion('all',$filter);
|
|
view::addPaginator($data,$this,NULL,15);
|
|
}
|
|
|
|
if($ac == "add" || $ac == "edit")
|
|
{
|
|
$this->_helper->viewRenderer('regions-add');
|
|
$submit = $this->_getParam('submit');
|
|
if(!empty($submit))
|
|
{
|
|
$this->view->data = $data = $this->_getParam("data");
|
|
$s = $region->addRegion($data,$id);
|
|
if($s === true)
|
|
{
|
|
$msg = "添加成功";
|
|
if(!empty($id))
|
|
$msg = "编辑成功";
|
|
|
|
view::Post($this,$msg,"/admin/sys/regions");
|
|
return true;
|
|
}else{
|
|
if(is_string($s))
|
|
{
|
|
$this->view->error = view::Error($s);
|
|
return true;
|
|
}else{
|
|
$this->view->error = view::Error("操作失败请重试");
|
|
return true;
|
|
}
|
|
}
|
|
}else{
|
|
if(!empty($id))
|
|
{
|
|
$this->view->data = $region->get($id);
|
|
}
|
|
}
|
|
}//添加
|
|
|
|
if($ac == "del")
|
|
{
|
|
$langid = $this->_getParam('langid');
|
|
if(!empty($id) && !empty($langid))
|
|
{
|
|
$region->del($id,$langid);
|
|
}else{
|
|
$region->del($id);
|
|
}
|
|
view::Post($this,"删除成功",-1);
|
|
}//删除
|
|
|
|
}//区域管理
|
|
|
|
function recoveryAction()
|
|
{
|
|
$pages=20;
|
|
$ac=$this->_request->getParam('ac');
|
|
if ($ac=='' || $ac=='online')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
|
t.filecount from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
|
where s.status>4 and m.datatype=0 and ds.host='ftp1.westgis.ac.cn'
|
|
ORDER BY m.id DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
$ac='online';
|
|
} else if ($ac=='heihe')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
|
t.filecount from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
|
left join datasource on datasource.uuid=m.uuid
|
|
left join source on datasource.sourceid=source.id
|
|
where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='heihe'
|
|
ORDER BY m.id DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
} else if ($ac=='water')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
|
t.filecount from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
|
left join datasource on datasource.uuid=m.uuid
|
|
left join source on datasource.sourceid=source.id
|
|
where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='water'
|
|
ORDER BY m.title DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
} else if ($ac=='heihe1')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
|
t.filecount from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join datasource on datasource.uuid=m.uuid
|
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
|
left join source on datasource.sourceid=source.id
|
|
where s.status in (2,3,4) and ds.host='ftp1.westgis.ac.cn' and source.code='heihe'
|
|
ORDER BY m.title DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
} else if ($ac=='hiwater')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
|
t.filecount from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
|
left join datasource on datasource.uuid=m.uuid
|
|
left join source on datasource.sourceid=source.id
|
|
where ds.host='ftp1.westgis.ac.cn' and source.code='hiwater'
|
|
ORDER BY m.title DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
}else if ($ac=='westee')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
|
t.filecount from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
|
where ds.host='ftp1.westgis.ac.cn' and m.uuid in (select uuid from westeemd)
|
|
ORDER BY m.title DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
}else if ($ac=='other')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
|
t.filecount from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
|
where ds.host='ftp1.westgis.ac.cn' and m.uuid not in (select uuid from datasource) and m.uuid not in (select uuid from westeemd)
|
|
ORDER BY m.title DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
}
|
|
$this->view->activeID="btn-".$ac;
|
|
}
|
|
|
|
function problemAction()
|
|
{
|
|
$pages=20;
|
|
$ac=$this->_request->getParam('ac');
|
|
if ($ac=='' || $ac=='ref')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,m.citation,g.id as gid from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
left join geonetworkmetadata g on g.uuid=m.uuid
|
|
where s.status>4 and m.citation like '%??%'
|
|
ORDER BY m.id DESC";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
$this->_helper->viewRenderer('problem-ref');
|
|
$ac='ref';
|
|
} else if ($ac=='file')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,m.filesize,ds.host,ds.path from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
where s.status>4 and ds.id not in (select distinct dsid from datafile)
|
|
group by m.title,m.uuid,ds.host,ds.path,m.filesize
|
|
ORDER BY m.title DESC;";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
} else if ($ac=='tiny')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
|
floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize,
|
|
count(datafile.id) as filecount
|
|
from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
|
left join datasource on datasource.uuid=m.uuid
|
|
left join datafile on ds.id=datafile.dsid
|
|
left join source on datasource.sourceid=source.id
|
|
where s.status>4 and ds.id in (select t.dsid from (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t
|
|
where t.filesize<1024*5)
|
|
group by m.title,m.uuid,ds.host,ds.path
|
|
ORDER BY m.title DESC;";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
} else if ($ac=='heihefund')
|
|
{
|
|
$sql = "SELECT m.title,m.uuid,g.id as gid
|
|
from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
left join datasource on datasource.uuid=m.uuid
|
|
left join source on datasource.sourceid=source.id
|
|
left join mdfund mf on mf.uuid=m.uuid
|
|
left join geonetworkmetadata g on m.uuid=g.uuid
|
|
where s.status>4 and source.code='heihe' and mf.fid is null
|
|
ORDER BY m.title DESC;";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
$this->_helper->viewRenderer('problem-md');
|
|
} else if ($ac=='noemail')
|
|
{
|
|
$sql = "SELECT distinct m.title,m.uuid,g.id as gid
|
|
from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
left join role on role.uuid=m.uuid
|
|
left join geonetworkmetadata g on m.uuid=g.uuid
|
|
where m.datatype=1 and s.status>4 and m.uuid not in (
|
|
select role.uuid from role left join responsible res on role.resid=res.id
|
|
where res.email is not null and role.role in ('resourceProvider','owner','pointOfContact','custodian')
|
|
)
|
|
ORDER BY m.title DESC;";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
$this->_helper->viewRenderer('problem-md');
|
|
} else if ($ac=='unmoved')
|
|
{
|
|
$sql = "SELECT distinct m.title,m.uuid,g.id as gid
|
|
from metadata m
|
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
|
left join geonetworkmetadata g on m.uuid=g.uuid
|
|
left join dataset ds on ds.uuid=m.uuid
|
|
where s.status>4 and ds.path like '%upload%'
|
|
ORDER BY m.title DESC;";
|
|
$sth = $this->db->prepare($sql);
|
|
$sth->execute();
|
|
$rows = $sth->fetchAll();
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
$paginator->setItemCountPerPage($pages);
|
|
$paginator->setView($this->view);
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
$this->view->paginator=$paginator;
|
|
$this->_helper->viewRenderer('problem-md');
|
|
}
|
|
$this->view->activeID="btn-".$ac;
|
|
}
|
|
}
|
|
|