merge from heihedata branch to r4013.

This commit is contained in:
wlx 2013-10-28 14:54:21 +00:00
parent 18f541c43d
commit 4e9a496f63
151 changed files with 13204 additions and 2895 deletions

View File

@ -1,4 +1,10 @@
<?php
use Helpers\View as view;
use Reference\Reference;
use Reference\Ris;
use Helpers\dbh;
use \Files\Files;
class Admin_DataController extends Zend_Controller_Action
{
function preDispatch()
@ -1098,13 +1104,13 @@ class Admin_DataController extends Zend_Controller_Action
} //搜索
else{
$select=$this->db->select();
$select->from('mdref',array('id as mdid','refid','place'))
->join('metadata','metadata.uuid=mdref.uuid')
->join('reference','reference.id=mdref.refid')
->order('metadata.ts_created desc')
->order('mdref.place');
$paginator = Zend_Paginator::factory($select);
$sql="select m.title as mdtitle,m.uuid,mr.id as mdid,mr.refid,mr.place,r.reference
from mdref mr right join metadata m on mr.uuid=m.uuid
left join reference r on mr.refid=r.id
order by m.ts_created desc,mr.place";
$re=$this->db->query($sql);
$row=$re->fetchAll();
$paginator = Zend_Paginator::factory($row);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(30);
$paginator->setView($this->view);
@ -1113,6 +1119,269 @@ class Admin_DataController extends Zend_Controller_Action
}//列表
}
//文献管理
public function refAction()
{
$this->view->ac = $ac = $this->_getParam('ac');
$submit = $this->_getParam('submit');
$keyword = $this->view->q = trim($this->_getParam('q'));
$order = $this->view->search_order = trim($this->_getParam('order'));
$sort = $this->view->search_sort = trim($this->_getParam('sort'));
$reference = new Reference();
if(!empty($keyword))
{
$reference->keyword = $keyword;
}
if(!empty($order))
{
$reference->order = $order;
}
if(!empty($sort))
{
$reference->sort = $sort;
}
//文献首页
if(empty($ac))
{
$this->view->referenceType = $reference->referenceType();
view::addPaginator($reference->fetchReferences(),$this,12);
return true;
}
else if ($ac == "water")
{
$this->view->referenceType = $reference->referenceType();
view::addPaginator($reference->fetchThemeReferences('water'),$this,10);
return true;
}
else if ($ac == "westdc")
{
$this->view->referenceType = $reference->referenceType();
view::addPaginator($reference->fetchWestdcReferences(),$this,10);
return true;
}
else if ($ac == "todo")
{
$this->view->referenceType = $reference->referenceType();
view::addPaginator($reference->fetchTodoReferences(),$this,10);
return true;
}
//添加
if($ac == "add")
{
$this->_helper->viewRenderer('ref-add');
$id = $this->_getParam('id');
$attid = $this->_getParam('attid');
if(!empty($submit))
{
$this->view->data = $reference->getReferenceParam();
$attid = $this->view->data['attid'];
if(empty($id) || !is_numeric($id))
{
$status = $reference->reference();
}else{
$status = $reference->reference($id);
}
if($status !== true)
{
$this->view->error = view::Error($status);
}else{
if(!empty($id))
{
$msg = "文献修改成功!";
view::Post($this,$msg,-2);
return true;
}else{
$msg = "文献添加成功!";
view::Post($this,$msg,"/admin/data/ref/ac/add");
return true;
}
}
}else{
$this->view->data = array();
if(!empty($id) && is_numeric($id))
{
$this->view->data = $reference->getOneReferenceData($id);
}
}
if(!empty($attid))
{
$files = new Files();
$attfile = $files->getOne($attid);
$this->view->data['attid'] = $attid;
$this->view->data['file'] = $attfile;
}
return true;
}
//上传pdf
if($ac == "pdfupload")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$autoread = false;
if($this->_getParam('multi'))
{
$autoread = true;
}
$statu = $reference->uploadReferencePdf($_FILES['Filedata'],$autoread);
$this->jsonexit($statu);
return true;
}
//删除已上传的文件
if($ac == "delete")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$statu = $reference->deleteReferenceAttchment($this->_getParam('attid'));
$this->jsonexit($statu);
return true;
}
//批量上传
if($ac == "multiupload")
{
$this->_helper->viewRenderer('ref-multiupload');
return true;
}
//文件管理
if($ac == "files")
{
$this->_helper->viewRenderer('ref-files');
view::addPaginator($reference->getReferenceFiles(),$this,10);
return true;
}
//删除文献
if($ac == "deleteref")
{
$refid = $this->_getParam('id');
if($reference->deleteReference($refid))
{
view::Post($this,"删除成功!",-1);
}else{
view::Post($this,"删除失败!",-1);
}
return true;
}
//相关数据
if($ac == "data")
{
$refid = $this->view->refid = $this->_getParam('id');
if(view::isXmlHttpRequest($this)){
$this->jsonexit($reference->getDataByReference($refid));
return true;
}else{
$this->_helper->viewRenderer('ref-metadatas');
$this->view->referenceType = $reference->referenceType();
view::addPaginator($reference->getDataByReference($refid),$this,10);
return true;
}
}
//添加数据文献
if($ac == "mdref" && view::isXmlHttpRequest($this))
{
$mdrefid = $this->_getParam('id');
$status = $reference->makeMdref($mdrefid);
if($status !== true)
{
$this->jsonexit(array('error'=>$status));
}else{
$this->jsonexit(array('success' => 1));
}
return true;
}
//移除数据文献
if($ac == "delmdref")
{
$mdrefid = $this->_getParam('id');
$status = $reference->delMdref($mdrefid);
if($status === true)
{
view::Post($this,"移除成功",-1);
}else{
view::Post($this,$status,-1);
}
return true;
}
//ris
if($ac == "ris")
{
$this->_helper->viewRenderer('ref-ris');
$submit = $this->_getParam('submit');
if(!empty($submit))
{
$ris = new \Reference\Ris();
$this->view->data = $ris->loadout();
try{
$ris->pushToDataTable($this->view->data);
}catch(Exception $e)
{
view::Dump($e->getMessage(),false);
}
}
}
//ris更新单篇
if($ac == "singleris")
{
$this->_helper->viewRenderer('ref-singleris');
$id = (int)$this->_getParam('id');
$this->view->ristext = $this->_getParam('ristext');
if($id < 1)
{
view::Post($this,"参数错误!",-1);
return true;
}
$this->view->referenceData = $reference->getOneReferenceData($id);
if(!empty($submit))
{
$ris = new Ris();
$data = $ris->loadout();
if(count($data) < 1)
{
view::Post($this,"输入的RIS信息有误".'<a href="/admin/data/ref/ac/add/id/'.$id.'">查看详细</a>',-1);
return true;
}
if($ris->updateWithRis($id,$data[0]) === true)
{
view::Post($this,"编辑成功!".'<a href="/admin/data/ref/ac/add/id/'.$id.'">查看详细</a>',-2);
return true;
}else{
view::Post($this,"编辑失败!".'<a href="/admin/data/ref/ac/add/id/'.$id.'">查看详细</a>',-1);
return true;
}
}
return true;
}//ris单篇更新
}//文献管理 refAction()
/*
* 删除元数据,删除前有确认
*/
@ -1573,8 +1842,8 @@ class Admin_DataController extends Zend_Controller_Action
$id = $this->_getParam('attupdate');
$files=new files();
$msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],empty($uuid)?'file':'md');
$files=new Files();
$msg = $files -> upload($_FILES['Filedata'],empty($uuid)?'file/':'md/',true);
if(empty($msg['error']))
{
@ -1582,7 +1851,7 @@ class Admin_DataController extends Zend_Controller_Action
$filename = $msg['db_path'];
$filesize = $msg['file_size'];
$filedesc = $this->_request->getParam('filedesc');
$filetype = $msg['file_type'];
$filetype = 'md';
$realname = $msg['realname'];
@ -1901,8 +2170,8 @@ class Admin_DataController extends Zend_Controller_Action
exit();
}
$files=new files();
$msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],empty($uuid)?'file':'md');
$files=new Files();
$msg = $files -> upload($_FILES['Filedata'],empty($uuid)?'file/':'md/',true);
if(empty($msg['error']))
{
@ -1910,7 +2179,7 @@ class Admin_DataController extends Zend_Controller_Action
$filename = $msg['db_path'];
$filesize = $msg['file_size'];
$filedesc = $this->_request->getParam('filedesc');
$filetype = $msg['file_type'];
$filetype = 'md';
$realname = $msg['realname'];
@ -1969,10 +2238,6 @@ class Admin_DataController extends Zend_Controller_Action
$rs = $this->db->query($sql);
$atts = $rs->fetchAll();
foreach($atts as $k=>$v)
{
$atts[$k]['html']= $v['realname'].'['. round($v['filesize']/1024,2) .' kb]<input type="hidden" name="atts[]" value="'.$v['id'].'" /><div class="cancel"><a href="javascript:;" id="deletebtn_'.$v['id'].'"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>';
}
echo Zend_Json::encode($atts);
exit();
}else
@ -2489,7 +2754,7 @@ class Admin_DataController extends Zend_Controller_Action
}else{
$mail->addTo($this->debug_email);
}
@$mail->send();
//@$mail->send();
$data = array("commited"=>1,"error"=>'该版本已经成功发布!');
$this->jsonexit($data);
@ -3410,13 +3675,13 @@ class Admin_DataController extends Zend_Controller_Action
if(empty($uuid))
{
$rows = $fund->fetch(NULL,true,0,$keyword);
view::addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this,10);
}else{
include('data/Metadata.php');
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$rows = $fund->fetch($uuid);
view::addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this,10);
}
return true;
}
@ -3426,7 +3691,7 @@ class Admin_DataController extends Zend_Controller_Action
$this->_helper->viewRenderer('fund-data-list');
$this->view->q = $q = $this->_getParam('q');
$rows = $fund->fetchFromData(true,0,$q);
view::addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this,10);
return true;
}
@ -3437,7 +3702,7 @@ class Admin_DataController extends Zend_Controller_Action
$id = $this->_getParam('id');
$this->view->fund = $fund->view($id);
$rows = $fund->fetchFromData($id,0,$q);
view::addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this,10);
return true;
}
@ -3569,7 +3834,7 @@ class Admin_DataController extends Zend_Controller_Action
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
view::addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this,10);
return true;
}//formd
@ -3617,7 +3882,7 @@ class Admin_DataController extends Zend_Controller_Action
}
$rows = $fund->getData($id,$keyword);
view::addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this,10);
}
}//fund
@ -3627,6 +3892,7 @@ class Admin_DataController extends Zend_Controller_Action
$ac = $this->_getParam('ac');
$submit = $this->_getParam('submit');
$uuid = $this->_getParam('uuid');
$q=$this->_getParam('q');
include_once("data/Doi.php");
$doi = new Doi($this->db);
@ -3636,8 +3902,8 @@ class Admin_DataController extends Zend_Controller_Action
{
if(empty($uuid))
{
$rows = $doi->fetch();
view::addPaginator($rows,$this->view,$this->_request);
$rows = $doi->fetch(0,$q);
view::addPaginator($rows,$this,10);
}else{
$this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid);
return true;
@ -3666,11 +3932,11 @@ class Admin_DataController extends Zend_Controller_Action
{
$this->view->uuid = $uuid;
$this->view->data = $doi->view($uuid);
if(empty($this->view->data))
{
include('data/Metadata.php');
$md = new Metadata($this->db);
$metadata = $md->view($uuid);
if(empty($this->view->data))
{
$this->view->data = array(
'uuid'=>$uuid,
'title'=>$metadata['title'],
@ -3681,6 +3947,7 @@ class Admin_DataController extends Zend_Controller_Action
'publisher_en'=>'Cold and Arid Regions Science Data Center at Lanzhou',
);
}else{
$this->view->data['doi'] = $metadata['doi'];
$this->view->data['info'] = $doi->data_process_out($this->view->data);
}
}else{

View File

@ -1,4 +1,12 @@
<?php
use Helpers\View as view;
use Files\Files;
use Files\Output;
use Files\Listener\FileListener;
use Order\Manager\Offlineapp;
use data\DataService;
use Mail\Mail;
class Admin_DownController extends Zend_Controller_Action
{
function preDispatch()
@ -8,6 +16,7 @@ class Admin_DownController extends Zend_Controller_Action
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
$this->_helper->layout->setLayout('administry');
$this->view->Theme = new Theme();
}
function postDispatch()
{
@ -18,9 +27,150 @@ class Admin_DownController extends Zend_Controller_Action
//其他连接
}
//新离线数据申请管理
function offlineappsAction()
{
$this->view->navIn = $ac = $this->_getParam('ac');
$this->view->offlineAppId = $offlineappid = $this->_getParam('offlineappid');
$submit = $this->_getParam('submit');
$search = $this->_getParam('search');
if(empty($ac))
{
$this->view->navIn = $ac = "notreceived";
}
if($ac == "view")
{
if(empty($offlineappid))
{
view::Post($this,"参数错误",-1);
return true;
}
$offlineapp = new Offlineapp();
if(view::isXmlHttpRequest() !== true)
{
$this->_helper->viewRenderer('offlineapps-view');
$this->view->data = $offlineapp->getOneAppInfo($offlineappid);
}else{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->jsonexit($offlineapp->getOneAppInfo($offlineappid));
}
return true;
}
if($ac == "notreceived")
{
$this->_helper->viewRenderer('offlineapps-notreceived');
$offlineapp = new Offlineapp();
$data = $offlineapp->fetchNotReceived();
view::addPaginator($data,$this,20);
return true;
}//未接收的
if($ac == "nopdf")
{
$this->_helper->viewRenderer('offlineapps-nopdf');
$offlineapp = new Offlineapp();
$data = $offlineapp->fetchNoPdf();
view::addPaginator($data,$this,20);
return true;
}//没有上传申请表的
if($ac == "notpassed")
{
$this->_helper->viewRenderer('offlineapps-notpassed');
$offlineapp = new Offlineapp();
$data = $offlineapp->fetchNotApprove();
view::addPaginator($data,$this,20);
return true;
}
//接收
if($ac == "receive")
{
$offlineapp = new Offlineapp();
$statue = $offlineapp->receive($offlineappid);
if($statue !== true)
{
view::Post($this,$statue);
}else{
view::Post($this,"接收成功",-1);
}
return true;
}
//发送给作者
if($ac == "toauthor")
{
$this->_helper->viewRenderer('offlineapps-toauthor');
if(empty($submit))
{
}else{
$offlineapp = new Offlineapp();
}
return true;
}
//拒绝
if($ac == "deny")
{
$this->_helper->viewRenderer('offlineapps-deny');
if(empty($offlineappid))
{
view::Post($this,"参数错误",-1);
return true;
}
if(empty($submit))
{
$offlineapp = new Offlineapp();
$this->view->data = $offlineapp->getOneAppInfo($offlineappid);
$mail = new Mail();
$data = array(
'user' => $this->view->data[0]['username'],
'datalist' => $this->view->data[0]['datalist'],
);
$mail->loadTemplate("offline-deny",$data);
$this->view->mail_body = $mail->body;
$this->view->mail_subject = $mail->subject;
}
return;
}
//重置申请表
if($ac == "resetappform")
{
if(empty($offlineappid))
{
view::Post($this,"参数错误",-1);
return true;
}
$offlineapp = new Offlineapp();
$statue = $offlineapp->resetAppForm($offlineappid);
if($statue !== true)
{
view::Post($this,$statue);
}else{
view::Post($this,"重置成功",-1);
}
return true;
}
}
//离线数据申请管理
function offlineappAction()
{
set_time_limit(0);
include_once("Dataorder.php");
$DO = new Dataorder($this->db);
@ -32,8 +182,23 @@ class Admin_DownController extends Zend_Controller_Action
$page =(int)$this->_getParam('page');
$reset =(int)$this->_getParam('reset');
$status =(int)$this->_getParam('status');
$ac = $this->_getParam('ac');
$q = $this->_getParam('q');
if($ac == "pending")
{
$keyword = "";
if(!empty($q))
{
$keyword = $q;
}
$rows = $DO->fetchAllOfflineApp(3,$keyword);
view::addPaginator($rows,$this,10);
return true;
}
if (!$page) $page=1;
if ($view) {
//查看此次申请的pdf
@ -64,9 +229,17 @@ class Admin_DownController extends Zend_Controller_Action
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->send();
$sql="select pdflink from offlineapp where id=?";
//如果是wsn数据则生成数据
$dataservice = new DataService();
$offlineapp = new Offlineapp();
if ($offlineapp->hasWsnData($start))
{
@$dataservice->makeWsnData(array('uid'=>$row['userid'],'action'=>'prepare'));
}
$sql="select applicationform as pdflink from offlineapp where id=?";
$row=$this->db->fetchRow($sql,array($start));
$filecontent=file_get_contents($this->view->config->offline->savepath."/".$row['pdflink']);
$filecontent=file_get_contents($row['pdflink']);
//对每条数据的管理员用户发送相应的邮件通知,同一用户的邮件需要合并
//需要取出对应数据的标题、uuid以及对应的作者的email一条数据可能有多个作者一次申请可能有多条数据对应同一个作者
@ -390,9 +563,14 @@ class Admin_DownController extends Zend_Controller_Action
//$this->_redirect('/admin/down/offlineapp/'.$page);
}
//如果是wsn数据则生成数据
//wsn数据在ftp服务器端进行处理
/*$dataservice = new DataService();
@$dataservice->makeWsnData();*/
$sql="update dataorder set status=5,ts_approved=now() where offlineappid=?";
$this->db->query($sql,array($finish));
$sql="update offlineapp set ts_approved=now() where id=? and ts_approved is null";
$sql="update offlineapp set ts_approved=now(),status=5 where id=? and ts_approved is null";
$this->db->query($sql,array($finish));
$sql="select * from offlineapp where id=?";
$row=$this->db->fetchRow($sql,array($finish));
@ -409,6 +587,7 @@ class Admin_DownController extends Zend_Controller_Action
// deal with ftp.westgis.ac.cn, use g6 to add path
// todo ...
}
//deal with ftp1&ftp2 account, for offline data
if ($has_ftp1 || $has_ftp2) {
$password=md5('westdc'.$row['userid'].rand(1000,9999));
@ -612,6 +791,68 @@ class Admin_DownController extends Zend_Controller_Action
$this->view->paginator=$paginator;
}
//上传申请表
function uploadapplicationformAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('orderid');
if(empty($id))
{
$this->jsonexit(array('error'=>"参数错误"));
return true;
}
$files = new Files();
$FileListener = new FileListener();
@$files->events()->attachAggregate($FileListener);
$statu = $files->uploadApplicationForm($_FILES['Filedata'],$id);
if(isset($statu['error']))
{
$this->jsonexit($statu);
return true;
}else{
$sql = "UPDATE offlineapp SET applicationform='{$statu['file']}' WHERE id=$id";
if($this->db->exec($sql))
{
$this->jsonexit(array("success"=>1));
return true;
}else{
$this->jsonexit(array('error'=>"数据库记录更新失败".$sql));
return true;
}
}
}
public function applicationformAction()
{
$ac = $this->_getParam('ac');
if($ac == "view")
{
$link = $this->_getParam('link');
$content=file_get_contents($link);
header("Content-Disposition: inline; filename=applicationform.pdf");
header("Content-Type:application/pdf");
echo $content;
exit();
}
if($ac == "download")
{
$link = $this->_getParam('link');
$content=file_get_contents($link);
$output = new Output();
$output->pushDownload($content,"申请表.pdf",'pdf');
exit();
}
}
//离线数据服务记录
function offlineAction()
{
@ -710,21 +951,13 @@ class Admin_DownController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender();
$sql="select * from offlineapp where ts_approved is not null and pdflink is not null order by ts_created desc";
$rows=$this->db->fetchAll($sql);
foreach($rows as $row){
$content.='"'.$row['username'].'","'.$row['unit'].'","'.$row['phone'].'","'.$row['address'].'","'.$row['postcoe'].'","'.str_replace("\"","'",$row['project']).'","'.str_replace("\"","'",$row['datalist']).'","'.$row['email'].'",'.$row['ts_created']."\n";
}
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="offlineapp.csv"')
->setHeader('Content-Length', strlen($content))
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($content);
foreach($rows as $row){
$content.='"'.$row['username'].'","'.$row['unit'].'","'.$row['phone'].'","'.$row['address'].'","'.$row['postcode'].'","'.str_replace("\"","'",$row['project']).'","'.str_replace("\"","'",$row['datalist']).'","'.$row['email'].'",'.$row['ts_created']."\r\n";
}
$output = new Output($this->db);
$output->Download("offlineapp.csv",$content,"string");
} //下载离线服务记录
else if ($update) {
@ -905,7 +1138,7 @@ class Admin_DownController extends Zend_Controller_Action
}
$select=$this->db->select();
$select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->where('status=0')->order('ts_created desc');
$select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->where('status>=0')->order('ts_created desc');
$paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($this->view->config->page->max);

View File

@ -123,6 +123,24 @@ class Admin_ReviewController extends Zend_Controller_Action
}
}//changestatus 更改状态
function editorAction()
{
include_once("helper/view.php");
include_once("data/Review.php");
$this->view->keyword = $keyword = $this->_request->getParam('keyword');
$review = new Review();
if(!empty($keyword))
{
$filter['keyword'] = $keyword;
$data = $review->needEditor($filter);
}else{
$data = $review->needEditor();
}
\view::addPaginator($data,$this,NULL,20);
}
/*
* acceptAction()待审元数据
@ -191,16 +209,12 @@ class Admin_ReviewController extends Zend_Controller_Action
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m
right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid
where m.status in (1,2,3,4) order by m.ts_created desc";
where m.status in (1,2,3,4)
order by m.ts_created desc";
$re = $this->db->query($sql);
$rows = $re->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;
\view::addPaginator($rows,$this,NULL,20);
}//列表
}//acceptAction
@ -586,6 +600,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$search=$this->_request->getParam('search');
$filter['keyword'] = $this->_request->getParam('keyword');
$filter['code'] = $this->_request->getParam('code');
$filter['order'] = $this->_request->getParam('order');
$filter['sort'] = $this->_request->getParam('sort');
$review = new Review($this->db);
if(!empty($search) && !empty($filter))
@ -593,6 +609,9 @@ class Admin_ReviewController extends Zend_Controller_Action
$rows = $review->adminReviews($filter);
$this->view->keyword = $filter['keyword'];
$this->view->code = $filter['code'];
}if(!empty($filter))
{
$rows = $review->adminReviews($filter);
}else{
$rows = $review->adminReviews();
}

View File

@ -7,12 +7,7 @@
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('数据管理');
$this->breadcrumb()->setSeparator(' > ');
$this->headLink()->appendStylesheet('/static/js/uploadify/uploadify.css');
$this->headScript()->appendFile('/static/js/jquery-1.7.2.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->headScript()->appendFile('/static/js/uploadify/swfobject.js');
$this->headScript()->appendFile('/static/js/uploadify/jquery.uploadify.v2.1.4.min.js');
$this->theme->AppendPlus($this,"uploadify");
?>
<div id="leftPanel">
<?= $this->partial('data/left.phtml'); ?>
@ -30,7 +25,8 @@
<input type="hidden" name="submit" value="1" />
<p>注:可选择多个文件<br />
<ul id="datalist"></ul>
<div id="datalist">
</div>
<input id="file_upload" name="Filedata" type="file" />
<input type="button" class="btn btn-small" onclick="$('#file_upload').uploadifyUpload();" value="上传" />
</p>
@ -38,65 +34,79 @@
</form>
</div>
<script>
$(document).ready(function() {
var _this = {
SessionID : '<?php echo session_id(); ?>'
};
var uploader;
var param;
param = {
"PHPSESSID" : _this.SessionID,
"multi" : 'yes'
};
$(function() {
$('#file_upload').uploadify({
'uploader' : '/static/js/uploadify/uploadify.swf',
'scriptData': {'PHPSESSID' : '<?php echo session_id(); ?>'},
'script' : '/admin/data/upload/<?php if(!empty($this->uuid)) echo "uuid/".$this->uuid; ?>',
'cancelImg' : '/static/js/uploadify/cancel.png',
'folder' : '/uploads',
'swf' : '/js/lib/uploadify/uploadify.swf',
'uploader' : '/admin/data/upload/<?php if(!empty($this->uuid)) echo "uuid/".$this->uuid; ?>',
'multi' : true,
'auto' : false,
'displayData' : 'speed',
'buttonImg' : '/static/js/uploadify/selectfile.gif',
'onComplete' : function(event, ID, fileObj, response, data) {
var obj = jQuery.parseJSON(response);
var html;
if(obj.error=='')
{html = obj.html;}else{html = obj.error;}
$('<li/>', {
"id":'uploadedItem_'+obj.attid,
"class":'uploadifyQueueItem',
"html": html
}).appendTo('#datalist');
$('#deletebtn_'+obj.attid).bind('click', function() {
deleteatt(obj.attid);
});
'auto' : true,
'fileTypeExts' : '*',
'onUploadSuccess' : function(file, data, response) {
upload.onsuccess(file, data, response);
},
'onError' : function (event,ID,fileObj,errorObj) {
alert(errorObj.type + ' Error: ' + errorObj.info);
'onUploadStart' : function(file) {
$('#file_upload').uploadify('settings','formData',param);
}
});
function deleteatt(id){
});
var upload = {
onsuccess : function(file, data, response){
_data = $.parseJSON(data);
if(!$.isEmptyObject(_data.error))
{
alert(_data.error);
}else{
$('#datalist').append(upload.makeFileHtml(_data));
}
},
makeFileHtml : function(data){
return '<div class="alert alert-success">'
+ '<button type="button" class="close" data-dismiss="alert" onclick="upload.deleteFile('+data.id+')"><i class="icon-trash icon-white"></i></button>'
+ data.realname
+'<input type="hidden" name="attid" value="'+data.id+'"></input>'
+'</div>';
},
deleteFile : function(id){
$.ajax({
'type':"POST",
'url': "/admin/data/attachments/",
'url':'/admin/data/attachments/',
'data':'uuid=<?php echo $this->uuid?>&mdattdel='+id,
'success':function(data){
if(data==null){Alert('遇到错误,请重试');return false;}
if(data.error!=null){Alert(data.error);return false;}
if(data.status==1){$('#uploadedItem_'+id).fadeOut("slow");}
},
'beforeSend':function(){},
'complete':function(){},
'timeout': 20000,
'dataType': 'json',
'error': function(){Alert('处理中出现问题,请重试');}
});
if(typeof(data) == 'undefined')
{
alert("数据源错误,请联系管理员");
return false;
}
if(!$.isEmptyObject(data.error))
{
alert(data.error);
return false;
}
},
'timeout': 30000,
'error': function(){
alert('附件删除出错');
}
});
}
};
$(document).ready(function() {
$.getJSON("/admin/data/getatts/uuid/<?php echo $this->uuid;?>", function(data) {
if(data)
{
$.each(data, function(key, val) {
$('<li/>', {
"id":'uploadedItem_'+val['id'],
"class":'uploadifyQueueItem',
"html": val['html']
}).appendTo('#datalist');
$('#deletebtn_'+val['id']).bind('click', function() {
deleteatt(val['id']);
});
$('#datalist').append(upload.makeFileHtml(val));
});
}
});

View File

@ -59,7 +59,9 @@ table thead tr th {background:#EBF2F6;}
<a href="/admin/data/doi/ac/edit/uuid/<?= $item['uuid']?>">编辑</a>
<a href="/admin/data/doi/ac/convert/uuid/<?= $item['uuid']?>">导出</a>
<a href="javascript:void(0);" rel="/admin/data/doi/ac/verified/uuid/<?= $item['uuid']?>" class="verified_btn">验证</a>
<?php if(empty($item['ts_published'])) {?>
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
<?php } ?>
</td>
</tr>
<?php endforeach; ?>

View File

@ -6,6 +6,7 @@
<li><a href="/admin/data/version">数据版本管理</a></li>
<li><a href="/admin/data/comment">数据反馈管理</a></li>
<li><a href="/admin/data/reference">数据文献管理</a></li>
<li><a href="/admin/data/ref">文献管理</a></li>
<li><a href="/admin/data/attachments">数据附件管理</a></li>
<!--
<li><a href="/admin/data/import">上传元数据文件</a></li>

View File

@ -0,0 +1,198 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,"uploadify");
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="inputTitle">文章标题</label>
<div class="controls">
<input type="text" name="title" id="inputTitle" class="input-block-level" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputYear">出版年份</label>
<div class="controls">
<input type="text" name="year" id="inputYear" value="<?= isset($this->data['year']) ? $this->data['year']:"" ?>">
<select class="span2">
<?php for($i=2000;$i<=(int)date("Y");$i++) {?>
<option value="<?= $i ?>" onclick="$('#inputYear').val(this.value)"><?= $i ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputYear">出版社/期刊</label>
<div class="controls">
<input type="text" name="publisher" id="inputYear" class="input-block-level" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputReference">引用方式(前台显示)</label>
<div class="controls">
<textarea name="reference" id="inputReference" class="input-block-level"><?= isset($this->data['reference']) ? $this->data['reference']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputLink">链接(自动填写请留空)</label>
<div class="controls">
<input type="text" name="link" id="inputLink" class="input-block-level" value="<?= isset($this->data['link']) ? $this->data['link']:"" ?>"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputType">类型</label>
<div class="controls">
<input type="text" name="type" id="inputType" class="input-block-level" value="<?= isset($this->data['type']) ? $this->data['type']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputLanguage">语言</label>
<div class="controls">
<input type="text" name="language" id="inputLanguage" class="input-block-level" value="<?= isset($this->data['language']) ? $this->data['language']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputDoi">DOI</label>
<div class="controls">
<input type="text" name="doi" id="inputDoi" class="input-block-level" value="<?= isset($this->data['doi']) ? $this->data['doi']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputBibtex">ris</label>
<div class="controls">
<textarea name="ris" id="inputBibtex" class="input-block-level"><?= isset($this->data['ris']) ? $this->data['ris']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputAbstract">摘要</label>
<div class="controls">
<textarea name="abstract" id="inputAbstract" class="input-block-level"><?= isset($this->data['abstract']) ? $this->data['abstract']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputNote">备注</label>
<div class="controls">
<textarea name="note" id="inputNote" class="input-block-level"><?= isset($this->data['note']) ? $this->data['note']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPDF">PDF</label>
<div class="controls">
<input type="file" name="Filedata" id="file_upload" />
<div id="uploadedFile"></div>
</div>
</div>
<div class="form-actions">
<input type="hidden" name="submit" value="1" />
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</div>
</form>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
$(document).ready(function(e) {
$('#btn-add-author').click(function(e) {
html = '';
$('#author_inputs').append('');
});
});
var _this = {
SessionID : '<?php echo session_id(); ?>'
};
var uploader;
var param;
param = {
"PHPSESSID" : _this.SessionID,
};
$(function() {
$('#file_upload').uploadify({
'swf' : '/js/lib/uploadify/uploadify.swf',
'uploader' : '/admin/data/ref/ac/pdfupload',
'multi' : false,
'auto' : true,
'fileTypeExts' : '*.pdf',
'onUploadSuccess' : function(file, data, response) {
upload.onsuccess(file, data, response);
},
'onUploadStart' : function(file) {
$('#file_upload').uploadify('settings','formData',param);
}
});
});
var upload = {
onsuccess : function(file, data, response){
_data = $.parseJSON(data);
if(!$.isEmptyObject(_data.error))
{
alert(_data.error);
}else{
$('#uploadedFile').html(upload.makeFileHtml(_data));
}
},
makeFileHtml : function(data){
return '<div class="alert alert-success">'
+'<button type="button" class="close" data-dismiss="alert" onclick="upload.deleteFile('+data.id+')"><i class="icon-trash icon-white"></i></button>'
+ data.realname
+'<input type="hidden" name="attid" value="'+data.id+'"></input>'
+'</div>';
},
deleteFile : function(id){
$.ajax({
'type':"POST",
'url':'/admin/data/ref/ac/delete',
'data':'attid=' + id,
'success':function(data){
if(typeof(data) == 'undefined')
{
alert("数据源错误,请联系管理员");
return false;
}
if(!$.isEmptyObject(data.error))
{
alert(data.error);
return false;
}
},
'timeout': 30000,
'error': function(){
alert('附件删除出错');
}
});
}
};
</script>
<?php if(isset($this->data['attid']) && !empty($this->data['attid'])){ ?>
<input type="hidden" id="reference_file_content" value='<?= json_encode($this->data['file']) ?>' />
<script>
upload.onsuccess('',$('#reference_file_content').val(),"");
</script>
<?php } ?>

View File

@ -0,0 +1,105 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</div>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>文件名</th>
<th>状态</th>
<th width="140">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<tr id="DataLine_<?= $item['id']?>">
<td><?= $item['realname'] ?></td>
<td><?= empty($item['attid']) ? '<font color="#CC0000">未编辑</font>':"已编辑" ?></td>
<td>
<a class="file-editor" href="/admin/data/ref/ac/add/<?= empty($item['attid']) ? 'attid/'.$item['id'] : 'id/'.$item['refid']?>">编辑</a>
<a href="javascript:void(0);" onclick="file.delete(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
$(document).ready(function(e) {
});
var file = {
delete : function(id){
if(confirm("是否确定删除?") == false)
{
return false;
}
$.ajax({
'type':"POST",
'url':'/admin/data/ref/ac/delete',
'data':'attid=' + id,
'success':function(data){
if(typeof(data) == 'undefined')
{
alert("数据源错误,请联系管理员");
return false;
}
if(!$.isEmptyObject(data.error))
{
alert(data.error);
return false;
}
$('#DataLine_'+id).fadeOut();
},
'timeout': 30000,
'error': function(){
alert('附件删除出错');
}
});
}
}
</script>

View File

@ -0,0 +1,48 @@
<div class="modal hide fade" id="mdref-form">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>添加数据文献</h3>
</div>
<div class="modal-body">
<form id="mdref" method="post" class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputRefid">文献ID</label>
<div class="controls">
<input type="text" name="refid" id="inputRefid" placeholder="文献ID" value="<?= empty($this->refid) ? "":$this->refid ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputUuid">元数据UUID</label>
<div class="controls">
<input type="text" name="uuid" id="inputUuid" placeholder="UUID">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPlace">排序数值(数字)</label>
<div class="controls">
<input type="text" name="place" id="inputPlace" placeholder="排序">
</div>
</div>
<div class="control-group">
<label class="control-label">文献类型</label>
<div class="controls">
<?php foreach($this->referenceType as $k=>$v) { ?>
<label class="radio">
<input type="radio" name="reftype" value="<?= $k ?>" /> <?= $v ?>
</label>
<?php } ?>
</div>
</div>
<input type="hidden" name="id" value="" />
</form>
</div>
<div id="alert-info"></div>
<div class="modal-footer">
<div class="progress progress-striped active" id="submit-loading" style="display:none;">
<div class="bar" style="width:100%;"></div>
</div>
<button onclick="$('#mdref')[0].reset();" class="btn">Reset</button>
<button onclick="$('#mdref-form').modal('hide');" class="btn">Close</button>
<button onclick="mdref.create()" class="btn btn-primary" id="submit_btn">Save changes</button>
</div>
</div>

View File

@ -0,0 +1,69 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
$this->theme->AppendModel($this,'admin-data-ref');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<button type="button" class="btn btn-primary" onclick="$('#mdref')[0].reset();$('#mdref-form').modal('show');">添加一条</button>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>元数据</th>
<th>类型</th>
<th>排序</th>
<th width="140">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<tr id="DataLine_<?= $item['id']?>">
<td><?= $item['title'] ?></td>
<td><?= isset($this->referenceType[$item['reftype']]) ? $this->referenceType[$item['reftype']]:"" ?></td>
<td><?= $item['place'] ?></td>
<td>
<a href="javascript:void(0);" onclick="mdref.edit(<?= $item['id'] ?>,<?= $item['refid']?>,'<?= $item['uuid'] ?>',<?= $item['reftype'] ?>,<?= $item['place'] ?>)">编辑</a>
<a href="/admin/data/ref/ac/delmdref/id/<?= $item['id']?>">移除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<?= $this->partial('data/ref-mdref-form.phtml',array('referenceType'=>$this->referenceType,'refid'=>$this->refid)); ?>
<script>
$(document).ready(function(e) {
});
</script>

View File

@ -0,0 +1,120 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,"uploadify");
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="inputPassword">PDF</label>
<div class="controls">
<input type="file" name="Filedata" id="file_upload" />
<div id="uploadedFile"></div>
</div>
</div>
<div class="form-actions">
<a class="btn btn-primary" href="/admin/data/ref/ac/files">文件管理</a>
</div>
</form>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
var _this = {
SessionID : '<?php echo session_id(); ?>'
};
var uploader;
var param;
param = {
"PHPSESSID" : _this.SessionID,
"multi" : 'yes'
};
$(function() {
$('#file_upload').uploadify({
'swf' : '/js/lib/uploadify/uploadify.swf',
'uploader' : '/admin/data/ref/ac/pdfupload',
'multi' : true,
'auto' : true,
'fileTypeExts' : '*.pdf',
'onUploadSuccess' : function(file, data, response) {
upload.onsuccess(file, data, response);
},
'onUploadStart' : function(file) {
$('#file_upload').uploadify('settings','formData',param);
}
});
});
var upload = {
onsuccess : function(file, data, response){
_data = $.parseJSON(data);
if(!$.isEmptyObject(_data.error))
{
alert(_data.error);
}else{
$('#uploadedFile').append(upload.makeFileHtml(_data));
}
},
makeFileHtml : function(data){
return '<div class="alert alert-success">'
//+'<button type="button" class="close" data-dismiss="alert" onclick="upload.deleteFile('+data.id+')"><i class="icon-trash icon-white"></i></button>'
+ data.realname
+'<input type="hidden" name="attid" value="'+data.id+'"></input>'
+'</div>';
},
deleteFile : function(id){
$.ajax({
'type':"POST",
'url':'/admin/data/ref/ac/delete',
'data':'attid=' + id,
'success':function(data){
if(typeof(data) == 'undefined')
{
alert("数据源错误,请联系管理员");
return false;
}
if(!$.isEmptyObject(data.error))
{
alert(data.error);
return false;
}
},
'timeout': 30000,
'error': function(){
alert('附件删除出错');
}
});
}
};
</script>
<?php if(isset($this->data['attid']) && !empty($this->data['attid'])){ ?>
<input type="hidden" id="reference_file_content" value='<?= json_encode($this->data['file']) ?>' />
<script>
upload.onsuccess('',$('#reference_file_content').val(),"");
</script>
<?php } ?>

View File

@ -0,0 +1,10 @@
<ul class="nav nav-tabs">
<li <?= empty($this->ac) ? 'class="active"':"" ?>><a href="/admin/data/ref">浏览所有</a></li>
<li <?= $this->ac=="water" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/water">WATER文献</a></li>
<li <?= $this->ac=="westdc" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/westdc">数据中心文献</a></li>
<li <?= $this->ac=="todo" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/todo">待处理文献</a></li>
<li <?= $this->ac=="add" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/add">单篇添加</a></li>
<li <?= $this->ac=="multiupload" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/multiupload">批量上传</a></li>
<li <?= $this->ac=="files" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/files">文件管理</a></li>
<li <?= $this->ac=="ris" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/ris">RIS导入</a></li>
</ul>

View File

@ -0,0 +1,67 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,"uploadify");
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<?php if(empty($this->data)) { ?>
<form class="form-horizontal" method="post" enctype="multipart/form-data">
<div class="control-group">
<label class="control-label" for="inputPassword">RIS文件</label>
<div class="controls">
<input type="file" name="Filedata" id="file_upload" />
<div id="uploadedFile"></div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">RIS文本</label>
<div class="controls">
<textarea class="input-block-level" name="ristext" rows="5"></textarea>
</div>
</div>
<div class="form-actions">
<input type="hidden" name="submit" value="1" />
<button type="submit" class="btn btn-primary">导入</button>
</div>
</form>
<?php }else{ ?>
<?php
foreach($this->data as $k=>$ref)
{
echo '<ul>';
foreach($ref as $index=>$value)
{
$v = is_array($value) ? join("|",$value) : $value;
echo '<li>'.$index .":". $v .'</li>';
}
echo "</ul>";
}
?>
<?php } ?>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->

View File

@ -0,0 +1,63 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,"uploadify");
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<h3><?= empty($this->referenceData['title']) ? $this->referenceData['reference'] : $this->referenceData['title'] ?></h3>
<hr />
<?php if(empty($this->data)) { ?>
<form class="form-horizontal" method="post" enctype="multipart/form-data">
<div class="control-group">
<label class="control-label" for="inputPassword">RIS文本</label>
<div class="controls">
<textarea class="input-block-level" name="ristext" rows="5"><?= $this->ristext ?></textarea>
<span class="help-block">* 此功能是使用单个文献的 RIS 文本导入并覆盖以前填写过的信息</span>
</div>
</div>
<div class="form-actions">
<input type="hidden" name="submit" value="1" />
<button type="submit" class="btn btn-primary">导入</button>
</div>
</form>
<?php }else{ ?>
<?php
foreach($this->data as $k=>$ref)
{
echo '<ul>';
foreach($ref as $index=>$value)
{
$v = is_array($value) ? join("|",$value) : $value;
echo '<li>'.$index .":". $v .'</li>';
}
echo "</ul>";
}
?>
<?php } ?>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->

View File

@ -0,0 +1,102 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
$this->theme->AppendModel($this,'admin-data-ref');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<input type="hidden" name="order" value="<?php if(!empty($this->search_order)) echo $this->search_order; ?>" />
<input type="hidden" name="sort" value="<?php if(!empty($this->search_sort)) echo $this->search_sort; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</div>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>标题
<a href="?order=title&sort=ASC&q=<?php if(!empty($this->q)) echo $this->q; ?>"><i class="icon-arrow-up"></i></a>
<a href="?order=title&sort=DESC&q=<?php if(!empty($this->q)) echo $this->q; ?>"><i class="icon-arrow-down"></i></a>
</th>
<th>年份
<a href="?order=year&sort=ASC&q=<?php if(!empty($this->q)) echo $this->q; ?>"><i class="icon-arrow-up"></i></a>
<a href="?order=year&sort=DESC&q=<?php if(!empty($this->q)) echo $this->q; ?>"><i class="icon-arrow-down"></i></a>
</th>
<th>记录创建
<a href="?order=ts_created&sort=ASC&q=<?php if(!empty($this->q)) echo $this->q; ?>"><i class="icon-arrow-up"></i></a>
<a href="?order=ts_created&sort=DESC&q=<?php if(!empty($this->q)) echo $this->q; ?>"><i class="icon-arrow-down"></i></a>
</th>
<th width="140">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<tr id="DataLine_<?= $item['id']?>">
<?php if(!empty($item['title']) || !empty($item['year'])) { ?>
<td><?= $item['title'] ?></td>
<td><?= $item['year'] ?></td>
<td><?= date("Y-m-d H:i",strtotime($item['ts_created'])) ?></td>
<td rowspan="2">
<a href="/admin/data/ref/ac/add/id/<?= $item['id']?>">编辑</a>
<a href="/admin/data/ref/ac/singleris/id/<?= $item['id'] ?>">RIS编辑</a>
<a href="/admin/data/ref/ac/data/id/<?= $item['id'] ?>">数据</a>(<a href="javascript:void(0);" onclick="$('#mdref')[0].reset();mdref.edit('',<?= $item['id']?>,'',0,0)">+</a>)
<a href="/admin/data/ref/ac/deleteref/id/<?= $item['id']?>">删除</a>
</td>
</tr>
<tr>
<td colspan="2"><?= $item['reference'] ?></td>
</tr>
<?php } ?>
<?php if(empty($item['title']) && empty($item['year'])) { ?>
<td colspan="2"><?= $item['reference'] ?></td>
<td><?= date("Y-m-d H:i",strtotime($item['ts_created'])) ?></td>
<td>
<a href="/admin/data/ref/ac/add/id/<?= $item['id']?>">编辑</a>
<a href="/admin/data/ref/ac/singleris/id/<?= $item['id'] ?>">RIS编辑</a>
<a href="/admin/data/ref/ac/data/id/<?= $item['id'] ?>">数据</a>
<a href="/admin/data/ref/ac/deleteref/id/<?= $item['id']?>">删除</a>
</td>
</tr>
<?php } ?>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<?= $this->partial('data/ref-mdref-form.phtml',array('referenceType'=>$this->referenceType)); ?>

View File

@ -56,7 +56,7 @@ foreach ($this->paginator as $item):
$i=0;
$u=$item['uuid'];
endif;
if ($i==0) echo '<div class="well"><h4>元数据:<a href="/data/'.$item['uuid'].'">'.$item['title'].'</a><a href="/admin/data/reference/add/1/uuid/'.$item['uuid'].'">添加</a></h4><ol>';
if ($i==0) echo '<div class="well"><h4>元数据:<a href="/data/'.$item['uuid'].'">'.$item['mdtitle'].'</a><a href="/admin/data/reference/add/1/uuid/'.$item['uuid'].'">添加</a></h4><ol>';
echo '<li>文献(<a href="/admin/data/reference/edit/'.$item['mdid'].'">编辑</a> <a href="/admin/data/reference/delete/'.$item['mdid'].'">删除</a> <a href="javascript:void(0);" class="order" rel="'.$item['mdid'].'" rev="'.$item['place'].'">排序</a>'.$item['place'].'. '.$item['reference'].'</li>';
endforeach;
echo '</ul>';

View File

@ -1,6 +1,7 @@
<ul>
<li class="title">申请管理与在线下载记录</li>
<li><a href="/admin/down/offlineapp">离线数据申请管理</a></li>
<li><a href="/admin/down/offlineapps">离线数据申请管理(新)</a></li>
<li><a href="/admin/down/offline">离线数据服务记录</a></li>
<li><a href="/admin/down/fixoffline">手动同步离线申请用户与网站帐号</a></li>
<li><a href="/admin/down/online">在线数据下载记录从20110908开始</a></li>

View File

@ -6,10 +6,9 @@
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/down">申请管理</a>');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->Theme->AppendPlus($this,'colorbox');
$this->Theme->AppendPlus($this,'uploadify');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('离线数据申请管理</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
@ -33,7 +32,7 @@
<a href="/admin/down/offlineapp/reset/-1" onclick="return confirm('是否重置该申请?')">重置1年前的所有未收到申请表的记录</a>
| <a href="/admin/down/offlineapp/status/4">已收到的申请</a>
| <a href="/admin/down/offlineapp/status/-1">已拒绝的申请</a>
| <a href="/admin/down/offlineapp">待处理的申请</a>
| <a href="/admin/down/offlineapp/ac/pending">待处理的申请</a>
| <a href="/admin/down/offline">已通过的申请(离线服务记录)</a>
<div class="search">
<form action="/admin/down/offlineapp" method="get">
@ -53,6 +52,7 @@
$autoindex++;?>
<li id="list_<?php echo $item['id'];?>">
<p>
<?= $autoindex ?>.
<a href="mailto:<?= $item['email']; ?>?subject=答复数据申请问题"><?= $item['username']; ?></a> |
申请时间:<?= date('Y-m-d',strtotime($item['ts_created'])); ?>
<?php if(!empty($item['ts_received'])) echo " | 收到时间:".date('Y-m-d',strtotime($item['ts_received']));?>
@ -70,14 +70,19 @@
数据清单:<?= $item['datalist']; ?>
</p>
<p>
<a href="/admin/down/offlineapp/view/<?= $item['id']; ?>">申请表</a> |
<a href="/admin/down/offlineapp/view/<?= $item['id']; ?>">原始申请表</a> |
<?php if ($item['datastatus']==3) : ?>
<span id="start_<?= $item['id']; ?>"><a href="javascript:action('start',<?= $item['id']; ?>);" onclick="return confirm('确定收到该申请?')">收到</a></span> |
<?php endif; ?>
<a href="javascript:action('finish',<?= $item['id']; ?>);" onclick="return confirm('确定确定通过该申请?')">通过</a> |
<a href="javascript:action('deleted',<?= $item['id']; ?>);" onclick="return confirm('确定将此记录删除?')">删除</a> |
<a href="javascript:action('deny',<?= $item['id']; ?>);" onclick="return confirm('确定拒绝该申请?')">拒绝</a> |
<a href="javascript:action('reset',<?= $item['id']; ?>);" onclick="return confirm('是否重置该申请?')">重置</a>
<a href="javascript:action('reset',<?= $item['id']; ?>);" onclick="return confirm('是否重置该申请?')">重置</a> |
<a href="javascript:void(0);" onclick="upload.showUploadForm(<?= $item['id'] ?>);">上传签字申请表</a>
<?php if(!empty($item['applicationform'])) { ?>
| <a href="/admin/down/applicationform/ac/view/?link=<?= urlencode($item['applicationform'])?>">查看签字申请表</a>
| <a href="/admin/down/offlineapps/ac/resetappform/?offlineappid=<?= $item['id'] ?>" onclick="return confirm('是否重置该申请表?')">重置申请表</a>
<?php }?>
</p>
</li>
<?php endforeach;
@ -86,8 +91,63 @@
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<div id="upload-form" class="modal hide fade" tabindex="-1" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">申请表上传</h3>
</div>
<div class="modal-body">
<form id="application-form">
<div id="fsUploadProgress">允许上传30M以内的 PDF 文件</div>
<input type="file" name="Filedata" id="file_upload" />
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">取消上传</button>
<button class="btn btn-primary">上传完成</button>
</div>
</div>
<script>
//var param = {};
//var upload_count = 0;
var uploader;
var param;
$(function() {
$('#file_upload').uploadify({
'swf' : '/js/lib/uploadify/uploadify.swf',
'uploader' : '/admin/down/uploadapplicationform',
'multi' : false,
'auto' : true,
'fileTypeExts' : '*.pdf; *.jpg',
'onUploadSuccess' : function(file, data, response) {
upload.onsuccess(file, data, response);
},
'onUploadStart' : function(file) {
$('#file_upload').uploadify('settings','formData',param);
}
});
});
var upload = {
onsuccess : function(file, data, response){
_data = $.parseJSON(data);
if(!$.isEmptyObject(_data.error))
{
alert(_data.error);
}else{
$('#upload-form').modal('hide');
window.location = window.location;
}
},
showUploadForm : function(id){
$('#upload-form').modal('show');
param = {
"PHPSESSID" : "<?php echo session_id(); ?>",
'orderid' : id
};
}
};
function action(name,id){
var url;
if(name == "start")

View File

@ -0,0 +1,15 @@
<ul class="nav nav-pills">
<li class="<?= $this->navIn == "notreceived" ? "active":"" ?>">
<a href="/admin/down/offlineapps/ac/notreceived">未接收</a>
</li>
<li class="<?= $this->navIn == "nopdf" ? "active":"" ?>">
<a href="/admin/down/offlineapps/ac/nopdf">已接收未上传申请表</a>
</li>
<li class="<?= $this->navIn == "notpassed" ? "active":"" ?>">
<a href="/admin/down/offlineapps/ac/notpassed">待审批</a>
</li>
<li class="<?= $this->navIn == "passed" ? "active":"" ?>">
<a href="/admin/down/offlineapps/ac/passed">已上传申请表已通过</a>
</li>
</ul>

View File

@ -0,0 +1,73 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb()->setSeparator(' > ');
$this->Theme->AppendPlus($this,'colorbox');
$this->Theme->AppendPlus($this,'uploadify');
$this->Theme->AppendModel($this,'admin-down-offlineapps');
$this->Theme->AppendModel($this,'sfadmin');
function applicationform($form)
{
if(empty($form))
{
return "未提交";
}else{
return '<a href="/admin/down/applicationform/ac/download">点击下载</a>';
}
}
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div class="span9">
<?= $this->partial('down/offlineapps-navpills.phtml',array('navIn'=>$this->navIn)); ?>
<form action="" method="get" class="search input-append">
<input type="hidden" name="search" value='1' />
<input type="text" name="keyword" class="q" value="<?php echo $this->keyword; ?>" />
<button type="submit" class="btn">搜索</button>
</form>
<table class="table table-bordered table-hover"><thead>
<tr>
<th><input type="checkbox" class="select_rows" data-tbody="list" /></th>
<th>申请者</th>
<th>提交时间</th>
<th>申请表</th>
<th>操作</th>
</tr></thead>
<?php if (count($this->paginator)): ?>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><input type="checkbox" class="select_item" value="<?= $item['orderid']?>" /></td>
<td><?php echo $item['realname'].'['.$item['username'].'] <span title="'.$item['title'].'">'.mb_substr($item['title'],0,15,"UTF-8")."</span>";echo mb_strlen($item['title'],"UTF-8") > 15 ? "...":"";?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?></td>
<td><?= applicationform($item['applicationform']) ?></td>
<td>
<a href="/admin/down/offlineapps/ac/view/?offlineappid=<?= $item['id'] ?>">查看详细</a>
<a href="/admin/down/offlineapps/ac/receive/?offlineappid=<?= $item['id'] ?>">接收</a>
<a href="/admin/down/offlineapps/ac/return/?offlineappid=<?= $item['id'] ?>">退回</a>
<a href="javascript:void(0);" onclick="upload.showUploadForm(<?= $item['id'] ?>);">上传申请表</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div><!-- span9 -->
</div>
<script>
var _this = {};
sfadmin.init();
</script>
<?= $this->partial('down/offlineapps-uploaderform.phtml'); ?>

View File

@ -0,0 +1,73 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb()->setSeparator(' > ');
$this->Theme->AppendPlus($this,'colorbox');
$this->Theme->AppendPlus($this,'uploadify');
$this->Theme->AppendModel($this,'admin-down-offlineapps');
$this->Theme->AppendModel($this,'sfadmin');
function applicationform($form)
{
if(empty($form))
{
return "未提交";
}else{
return '<a href="/admin/down/applicationform/ac/view?link='.$form.'">查看</a>';
}
}
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div class="span9">
<?= $this->partial('down/offlineapps-navpills.phtml',array('navIn'=>$this->navIn)); ?>
<form action="" method="get" class="search input-append">
<input type="hidden" name="search" value='1' />
<input type="text" name="keyword" class="q" value="<?php echo $this->keyword; ?>" />
<button type="submit" class="btn">搜索</button>
</form>
<table class="table table-bordered table-hover"><thead>
<tr>
<th><input type="checkbox" class="select_rows" data-tbody="list" /></th>
<th>申请者</th>
<th>提交时间</th>
<th>申请表</th>
<th>操作</th>
</tr></thead>
<?php if (count($this->paginator)): ?>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><input type="checkbox" class="select_item" value="<?= $item['orderid']?>" /></td>
<td><?php echo $item['realname'].'['.$item['username'].'] <span title="'.$item['title'].'">'.mb_substr($item['title'],0,15,"UTF-8")."</span>";echo mb_strlen($item['title'],"UTF-8") > 15 ? "...":"";?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?></td>
<td><?= applicationform($item['applicationform']) ?></td>
<td>
<a href="/admin/down/offlineapps/ac/view/?offlineappid=<?= $item['id'] ?>">查看详细</a>
<a href="/admin/down/offlineapps/ac/toauthor/?offlineappid=<?= $item['id'] ?>">发给作者</a>
<a href="javascript:void(0);" onclick="upload.showUploadForm(<?= $item['id'] ?>);">上传申请表</a>
<a href="/admin/down/offlineapps/ac/resetappform/?offlineappid=<?= $item['id'] ?>" onclick="return confirm('是否确认重置该用户的申请表?')">重置申请表</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div><!-- span9 -->
</div>
<script>
var _this = {};
sfadmin.init();
</script>
<?= $this->partial('down/offlineapps-uploaderform.phtml'); ?>

View File

@ -0,0 +1,74 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb()->setSeparator(' > ');
$this->Theme->AppendPlus($this,'colorbox');
$this->Theme->AppendPlus($this,'uploadify');
$this->Theme->AppendModel($this,'admin-down-offlineapps');
$this->Theme->AppendModel($this,'sfadmin');
function applicationform($form)
{
if(empty($form))
{
return "未提交";
}else{
return '<a href="/admin/down/applicationform/ac/view?link='.$form.'">查看</a> <a href="/admin/down/applicationform/ac/download?link='.$form.'">下载</a>';
}
}
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div class="span9">
<?= $this->partial('down/offlineapps-navpills.phtml',array('navIn'=>$this->navIn)); ?>
<form action="" method="get" class="search input-append">
<input type="hidden" name="search" value='1' />
<input type="text" name="keyword" class="q" value="<?php echo $this->keyword; ?>" />
<button type="submit" class="btn">搜索</button>
</form>
<table class="table table-bordered table-hover"><thead>
<tr>
<th><input type="checkbox" class="select_rows" data-tbody="list" /></th>
<th>申请者</th>
<th>提交时间</th>
<th>申请表</th>
<th>操作</th>
</tr></thead>
<?php if (count($this->paginator)): ?>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><input type="checkbox" class="select_item" value="<?= $item['orderid']?>" /></td>
<td><?php echo $item['realname'].'['.$item['username'].'] <span title="'.$item['title'].'">'.mb_substr($item['title'],0,15,"UTF-8")."</span>";echo mb_strlen($item['title'],"UTF-8") > 15 ? "...":"";?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?></td>
<td><?= applicationform($item['applicationform']) ?></td>
<td>
<a href="/admin/down/offlineapps/ac/view/?offlineappid=<?= $item['id'] ?>">查看详细</a>
<a href="/admin/down/offlineapps/ac/receive/?offlineappid=<?= $item['id'] ?>">接收</a>
<a href="/admin/down/offlineapps/ac/return/?offlineappid=<?= $item['id'] ?>">退回</a>
<a href="javascript:void(0);" onclick="upload.showUploadForm(<?= $item['id'] ?>);">上传申请表</a>
<a href="/admin/down/offlineapps/ac/resetappform/?offlineappid=<?= $item['id'] ?>" onclick="return confirm('是否确认重置该用户的申请表?')">重置申请表</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div><!-- span9 -->
</div>
<script>
var _this = {};
sfadmin.init();
</script>
<?= $this->partial('down/offlineapps-uploaderform.phtml'); ?>

View File

@ -0,0 +1,42 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb()->setSeparator(' > ');
$this->Theme->AppendPlus($this,'colorbox');
$this->Theme->AppendPlus($this,'uploadify');
$this->Theme->AppendModel($this,'admin-down-offlineapps');
$this->Theme->AppendModel($this,'sfadmin');
function applicationform($form)
{
if(empty($form))
{
return "未提交";
}else{
return '<a href="/admin/down/applicationform/ac/download">点击下载</a>';
}
}
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div class="span9">
<?= $this->partial('down/offlineapps-navpills.phtml',array('navIn'=>$this->navIn)); ?>
<h2>发给作者</h2>
</div><!-- span9 -->
</div>
<script>
var _this = {};
sfadmin.init();
</script>
<?= $this->partial('down/offlineapps-uploaderform.phtml'); ?>

View File

@ -0,0 +1,19 @@
<div id="upload-form" class="modal hide fade" tabindex="-1" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">申请表上传</h3>
</div>
<div class="modal-body">
<form id="application-form">
<div id="fsUploadProgress">允许上传20M以内的 PDF 文件</div>
<input type="file" name="Filedata" id="file_upload" />
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">取消上传</button>
<button class="btn btn-primary">上传完成</button>
</div>
</div>
<script>
_this.SessionID = '<?php echo session_id(); ?>';
</script>

View File

@ -0,0 +1,63 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb()->setSeparator(' > ');
$this->Theme->AppendPlus($this,'colorbox');
$this->Theme->AppendPlus($this,'uploadify');
$this->Theme->AppendModel($this,'admin-down-offlineapps');
$this->Theme->AppendModel($this,'sfadmin');
function applicationform($form)
{
if(empty($form))
{
return "未提交";
}else{
return '<a href="/admin/down/applicationform/ac/download">点击下载</a>';
}
}
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div class="span9">
<?= $this->partial('down/offlineapps-navpills.phtml',array('navIn'=>$this->navIn)); ?>
<h2>查看详细</h2>
<ul>
<li>申请者:<?= $this->data[0]['username'] ?></li>
<li>单位:<?= $this->data[0]['unit'] ?></li>
<li>电话:<?= $this->data[0]['phone'] ?></li>
<li>地址:<?= $this->data[0]['address'] ?></li>
<li>邮编:<?= $this->data[0]['postcode'] ?></li>
<li>未签字pdf<?= $this->data[0]['pdflink'] ?></li>
<li>签字pdf<?= ( isset($this->data[0]['applicationform']) && !empty($this->data[0]['applicationform'])) ? '<a href="">查看</a> <a href="">下载</a>':"未提交"?></li>
<li>数据列表:<?= $this->data[0]['datalist'] ?></li>
<li>邮箱:<?= $this->data[0]['email'] ?></li>
<li>项目编号:<?= $this->data[0]['project_id'] ?></li>
<li>项目类型:<?= $this->data[0]['project_type'] ?></li>
<li>项目名称:<?= $this->data[0]['project_title'] ?></li>
<li>项目负责人:<?= $this->data[0]['leader'] ?></li>
<li>项目负责人职称:<?= $this->data[0]['leadertitle'] ?></li>
<li>项目介绍:<?= $this->data[0]['project'] ?></li>
<li>申请时间:<?= $this->data[0]['ts_created'] ?></li>
<li>接收时间:<?= $this->data[0]['ts_received'] ?></li>
<li>通过时间:<?= $this->data[0]['ts_approved'] ?></li>
</ul>
</div><!-- span9 -->
</div>
<script>
var _this = {};
sfadmin.init();
</script>
<?= $this->partial('down/offlineapps-uploaderform.phtml'); ?>

View File

@ -0,0 +1,50 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb()->setSeparator(' > ');
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div class="span9">
<?= $this->partial('down/offlineapps-navpills.phtml',array('navIn'=>$this->navIn)); ?>
<form action="" method="get" class="search input-append">
<input type="hidden" name="search" value='1' />
<input type="text" name="keyword" class="q" value="<?php echo $this->keyword; ?>" />
<button type="submit" class="btn">搜索</button>
</form>
<table class="table table-bordered table-hover"><thead>
<tr>
<th width='600'>元数据标题</th>
<th width='120'>责任编辑</th>
<th width='120'>接收时间</th>
<th width='180'>操作</th>
</tr></thead>
<?php if (count($this->paginator)): ?>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><a href="/data/<?php echo $item['uuid'];?>"><?= $item['title']?></a></td>
<td><?php echo $item['realname'].'['.$item['username'].']'; ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td>
<a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">分配编辑</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div><!-- span9 -->
</div>

View File

@ -10,9 +10,9 @@ if(!empty($this->pageTitle))
<div class="hero-unit">
<h2><?= $this->content ?><?php if(!empty($this->url)) echo ",系统正在为您跳转..."?></h2>
<?php if(!empty($this->url)) {?>
<?php if($this->url == -1) { ?>
<?php if(is_numeric($this->url)) { ?>
<a href="javascript:history.go(-1);">如果没有跳转请点击这样</a>
<script language="javascript">setTimeout("history.go(-1)",3000);</script>
<script language="javascript">setTimeout("history.go(<?= $this->url ?>)",3000);</script>
<?php }else {?>
<a href="<?= $this->url ?>">如果没有跳转请点击这样</a>
<script language="javascript">setTimeout("self.location='<?= $this->url?>'",3000);</script>

View File

@ -36,7 +36,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
<table class="table table-bordered table-hover"><thead>
<tr>
<th width='600'>元数据标题</th>
<th width='120'>责编辑</th>
<th width='120'>编辑</th>
<th width='120'>接收时间</th>
<th width='180'>操作</th>
</tr></thead>
@ -48,7 +48,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
<td><?php echo $item['realname'].'['.$item['username'].']'; ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td>
<a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">分配编辑</a>
<a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">更改责任编辑</a>
</td>
</tr>
<?php endforeach; ?>

View File

@ -0,0 +1,60 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('元数据评审');
$this->breadcrumb()->setSeparator(' > ');
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('review/left.phtml'); ?>
</div>
<div class="span9">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<form action="" method="get" class="search input-append">
<input type="hidden" name="search" value='1' />
<input type="text" name="keyword" class="q" value="<?php echo $this->keyword; ?>" />
<button type="submit" class="btn">搜索</button>
</form>
<table class="table table-bordered table-hover"><thead>
<tr>
<th width='600'>元数据标题</th>
<th width='120'>责任编辑</th>
<th width='120'>接收时间</th>
<th width='180'>操作</th>
</tr></thead>
<?php if (count($this->paginator)): ?>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><a href="/data/<?php echo $item['uuid'];?>"><?= $item['title']?></a></td>
<td><?php echo $item['realname'].'['.$item['username'].']'; ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td>
<a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">分配编辑</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div><!-- span9 -->
</div>

View File

@ -1,6 +1,7 @@
<ul class="nav nav-pills nav-stacked well">
<span class="label"><h4>元数据评审</h4></span>
<li id="Nav-review-draft"><a href="/admin/review/draft">投稿元数据</a></li>
<li id="Nav-review-editor"><a href="/admin/review/editor">分配责任编辑</a></li>
<li id="Nav-review-accept"><a href="/admin/review/accept">待审元数据</a></li>
<!-- <li id="Nav-review-inreview"><a href="/admin/review/inreview">在审元数据</a></li> -->
<li id="Nav-review-myreview"><a href="/admin/review/myreview">我负责的元数据</a></li>

View File

@ -7,6 +7,7 @@
$this->breadcrumb('元数据评审');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendModel($this,'sfadmin');
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
@ -50,10 +51,27 @@ table thead tr th {background:#EBF2F6;color:#444;}
<thead>
<tr>
<th style="width:13px;"><input type="checkbox" class="select_rows" data-tbody="list" /></th>
<th width='500'>元数据标题</th>
<th width='80'>状态</th>
<th>接收时间</th>
<th>作者</th>
<th width='500'>元数据标题<br />
<a href="?order=title&sort=desc" data-order="title" data-sort="desc"></a>
<a href="?order=title&sort=asc" data-order="title" data-sort="asc"></a>
</th>
<th width='80'>
状态<br />
<a href="?order=status&sort=desc" data-order="status" data-sort="desc"></a>
<a href="?order=status&sort=asc" data-order="status" data-sort="asc"></a>
</th>
<th>意见<br />
<a href="?order=reviews&sort=desc" data-order="reviews" data-sort="desc"></a>
<a href="?order=reviews&sort=asc" data-order="reviews" data-sort="asc"></a>
</th>
<th>接收时间<br />
<a href="?order=ts_accepted&sort=desc" data-order="ts_accepted" data-sort="desc"></a>
<a href="?order=ts_accepted&sort=asc" data-order="ts_accepted" data-sort="asc"></a>
</th>
<th>投稿人<br />
<a href="?order=author&sort=desc" data-order="author" data-sort="desc"></a>
<a href="?order=author&sort=asc" data-order="author" data-sort="asc"></a>
</th>
<th width="300">操作</th>
</tr>
</thead>
@ -75,6 +93,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
if($item['status'] == 4) echo "专家反馈";
if($item['status'] == 5) echo "已发布";
?></td>
<td style="text-align:center"><a href="/admin/review/comments/ac/list/uuid/<?php echo $item['uuid'];?>"><?= $item['reviews'] ?></a></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td><?= $item['author']?></td>
<td>
@ -97,41 +116,6 @@ table thead tr th {background:#EBF2F6;color:#444;}
</div>
</div>
<script>
var sfadmin = {
def_data_tag : 'tbody',
def_select_input : '.select_item',
init: function() {
$('.select_rows').click(function () {
var tableid = $(this).data(sfadmin.def_data_tag);
$('#'+tableid).find(sfadmin.def_select_input).attr('checked', this.checked);
});
sfadmin.ajax.error();
},
getSelected : function(tableid){
if(tableid == "")
{
dom = $(sfadmin.def_select_input + ':checked');
}else{
dom = $(sfadmin.def_select_input + ':checked', '#'+tableid);
}
datas = new Array();
dom.each(function(index, element) {
datas.push($(this).val());
});
return datas;
},
ajax : {
error : function(){
$(document).ajaxError(function(event, request, settings) {
sfadmin.Alert("请求中发生错误");
})
}
},
Alert : function(content){
$.colorbox({width:'50%',html:'<div class="ajax_error"><div class="text"><h2>'+content+'</h2></div></div>'});
}
}
$(document).ready(function(e) {
$('.version').click(function(){
$(this).getversion({'id':$(this).attr('rel')});
@ -167,6 +151,37 @@ function getids(){
return data;
}
(function( $ ){
$.fn.changeorder = function( options ) {
var settings = $.extend( {
order:'',
srt: '',
}, options);
var methods = {
change : function(dom)
{
href = window.location.href + "?order="+settings.order+'&sort';
}
}
this.each(function() {
settings.order = $(this).data('order');
settings.srt = $(this).data('sort');
if( settings.order == '' || settings.srt == "")
{
alert('参数错误');
}
methods.change(this);
});
};
})( jQuery );
(function( $ ){
$.fn.getversion = function( options ) {

View File

@ -34,12 +34,14 @@ smtp.password=ilovewestdc
smtp.host=smtp.cstnet.cn
smtp.ssl=TLS
smtp.auth=login
smtp.name=数据中心服务组
ftp.user=newwestdc
ftp.password=westdcforsmall
download.max=5 //最多同时申请下载个数
page.max=10 //每页显示条目数
offline.template=../data/offline.pdf
offline.heihetemplate=../data/heihe.pdf
offline.security=../data/security.pdf
offline.water_template=../data/water_offline.pdf
offline.font=../data/simhei.ttf

View File

@ -306,7 +306,12 @@ class AccountController extends Zend_Controller_Action
if(($options['module']=="default" && $options['controller'] == "account" && $options['action'] == "login"))
{
$this->view->href = '/';
$this->view->href = $_SERVER['REQUEST_URI'];
}
if($tohref == "/account/login")
{
$this->view->href = $tohref = "/";
}
if(!empty($tohref))
@ -364,7 +369,6 @@ class AccountController extends Zend_Controller_Action
}
else
{
if(!empty($tohref))
{
view::Post($this,"登录成功,正在跳转",$tohref);
@ -592,6 +596,7 @@ class AccountController extends Zend_Controller_Action
}
}
}
} //找回密码
}

View File

@ -6,6 +6,9 @@
@license http://
@link http://
*/
use data\DataService;
include_once("data/Author.php");
class AuthorController extends Zend_Controller_Action
{
private $limit=10;
@ -2565,7 +2568,7 @@ class AuthorController extends Zend_Controller_Action
function literatureAction()
{
$ac = $this->_request->getParam('ac');
$uuid = $this->_request->getParam('uuid');
$this->view->uuid = $uuid = $this->_request->getParam('uuid');
$id = $this->_request->getParam('id');
$auth = Zend_Auth::getInstance();
@ -2596,9 +2599,14 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
$refid = $this->_getParam('refid');
$content = $this->_getParam('content');
$link = $this->_getParam('link');
$reftype = $this->_getParam('reftype');
$uuid = $this->_getParam('uuid');
if(empty($id))
if(empty($id) || empty($uuid))
{
$this->jsonexit(array('error'=>'参数错误'));
return true;
@ -2610,7 +2618,13 @@ class AuthorController extends Zend_Controller_Action
return true;
}
$s = $author->Literature->edit($id,$content);
if(empty($reftype))
{
$this->jsonexit(array('error'=>'请选择文献类型'));
return true;
}
$s = $author->Literature->edit($id,$refid,$uuid,$content,$link,$reftype);
if($s !== true)
{
$this->jsonexit(array('error'=>'出现错误'));
@ -2744,6 +2758,17 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer('literature-byliter');
}
//单条文献的信息
else if ($ac == "get")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
$data = $author->Literature->getOne($id);
$this->jsonexit($data);
return true;
}
//按数据浏览
else if($ac=="bydata")
{
@ -2775,6 +2800,7 @@ class AuthorController extends Zend_Controller_Action
$ref=$this->_request->getParam('ref');
$reftype=$this->_request->getParam('reftype');
$url = $this->_request->getParam('url');
if(empty($uuid) || empty($ref) || !is_numeric($reftype))
{
$data = array("error"=>"参数错误");
@ -2782,11 +2808,8 @@ class AuthorController extends Zend_Controller_Action
return true;
}
$sql="select * from mdauthor where userid=? and uuid=? and status=1";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id,$uuid));
$row = $sth->fetch();
if (empty($row))
$author = new Author($this->db);
if(!$author->checkAuthor($uuid))
{
$data = array("error"=>$this->alertbox('warning','您不是该数据作者,无法添加对应文献信息。'));
$this->jsonexit($data);
@ -2797,7 +2820,8 @@ class AuthorController extends Zend_Controller_Action
$sth = $this->db->prepare($sql);
$sth->execute(array($ref));
$row = $sth->fetch();
if (!$row)
if(empty($row['id']))
{
$sql="insert into reference (reference,link) values(?,?)";
$sth = $this->db->prepare($sql);
@ -2821,8 +2845,9 @@ class AuthorController extends Zend_Controller_Action
$this->jsonexit($data);
return true;
}
}catch(Exception $e) {
$msg = "提交失败,请确认权限后重试";
$msg = "提交失败,您提交的数据可能已经存在";
if($this->debug>0)
{$msg .= $e->getMessage();}
$data = array("error"=>$this->alertbox('error',$msg));

View File

@ -1,4 +1,8 @@
<?php
use \data\DataService;
use Helpers\View as view;
use Order\Order;
class DataController extends Zend_Controller_Action
{
private $limit=10;
@ -26,16 +30,16 @@ class DataController extends Zend_Controller_Action
$state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
$this->view->category=$state->fetchAll();
//关键词
$state=$this->db->query("select keyword,count(*) from keyword where keytype='place' group by keyword order by count desc limit 20");
$state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='place' group by keyword order by count desc limit 20");
$k1=$state->fetchAll();
$state=$this->db->query("select keyword,count(*) from keyword where keytype='theme' group by keyword order by count desc limit 20");
$state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='theme' group by keyword order by count desc limit 20");
//$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
$k2=$state->fetchAll();
$state=$this->db->query("select keyword,count(*) from keyword where keytype='discipline' group by keyword order by count desc limit 20");
$state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='discipline' group by keyword order by count desc limit 20");
$k3=$state->fetchAll();
$state=$this->db->query("select keyword,count(*) from keyword where keytype='stratum' group by keyword order by count desc limit 20");
$state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='stratum' group by keyword order by count desc limit 20");
$k4=$state->fetchAll();
$state=$this->db->query("select keyword,count(*) from keyword where keytype='temporal' group by keyword order by count desc limit 20");
$state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='temporal' group by keyword order by count desc limit 20");
//$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='temporal' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
$k5=$state->fetchAll();
$this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
@ -205,7 +209,7 @@ class DataController extends Zend_Controller_Action
if (empty($page)) $page=1;
$limit=10;
$offset=$limit*($page-1);
$sql='select keyword,count(*),keytype from keyword ';
$sql='select keyword,count(*),keytype from keyword right join normalmetadata on keyword.id=normalmetadata.id ';
if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" where keytype='".$keytype."'";
$sql.=' group by keyword,keytype order by keytype,keyword,count desc';
$state=$this->db->query($sql);
@ -307,7 +311,7 @@ class DataController extends Zend_Controller_Action
if ($code>0 && $code<20) {
$where=$this->db->quoteInto('code = ?',$code);
$row=$this->db->fetchRow("select * from categorycode where ".$where);
$this->view->codename=$row['name'];
$this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
$sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?';
$row=$this->db->fetchRow($sql,array($code));
$sum=$row['count'];
@ -601,10 +605,18 @@ class DataController extends Zend_Controller_Action
$sql="select * from onlineresource where uuid=? and (linkage not like '%ftp.westgis%') and name<>'元数据地址'";
$sql=$this->db->quoteInto($sql,$uuid);
$this->view->resources=$this->db->fetchAll($sql);
//建议参考文献
//相关文献:作者建议
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=0 order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$this->view->ref=$this->db->fetchAll($sql);
//数据的参考文献
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=2 order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$this->view->dataref=$this->db->fetchAll($sql);
//数据的专题文献
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=4 order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$this->view->themeref=$this->db->fetchAll($sql);
//用户发表文献
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=1";
$sql=$this->db->quoteInto($sql,$uuid);
@ -668,6 +680,9 @@ class DataController extends Zend_Controller_Action
$fund = new Fund($this->db);
$this->view->fund = $fund->fetch($uuid);
//判断特殊数据服务
$this->view->dataService= $this->checkDataService($uuid);
//自动跳转
$sql="select s.* from datasource d left join source s on d.sourceid=s.id where d.uuid=?";
$row=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
@ -679,6 +694,160 @@ class DataController extends Zend_Controller_Action
}
} //viewAction
//检查特殊数据服务是否存在
private function checkDataService($uuid)
{
$order = new \Order\mount\OrderOperate();
$service = $order->getDataService($uuid);
if(empty($service))
{
return NULL;
}else{
if($order->checkOrderHas($uuid))
{
return NULL;
}else{
return $service;
}
}
}//checkDataService
//特殊数据服务
public function dataserviceAction()
{
$uuid = $this->_getParam('uuid');
if(empty($uuid))
{
$this->jsonexit(array("error"=>"参数错误"));
}
$dataservice = new \data\DataService();
$info = $dataservice->get($uuid);
//暂时只有wsn
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$data = array(
"type"=>"wsn", //服务类型
"info"=>$info, //信息 dataservice 表中的字段
"callback"=>"westdc.dataservice.wsn.request()", //成功后的js回调函数
);
$data['data'] = $dataservice->getWsnData("site",$uuid);
if(empty($data['data']))
{
$this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
return true;
}
if(!is_array($data['data']))
{
$this->jsonexit(array("error"=>$data['data']));
return true;
}
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->jsonexit($data);
}
// WSN end
}
public function wsnAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$type = $this->_getParam('type');
$uuid = $this->_getParam("uuid");
$dataservice = new DataService();
if($type == 'var')
{
$sites = array(
"chk"=>$this->_getParam("siteid")
);
$info = $dataservice->get($uuid);
$data = array(
"type"=>"wsn", //服务类型
"info"=>$info, //信息 dataservice 表中的字段
"callback"=>"westdc.dataservice.wsn.Submit()", //成功后的js回调函数
);
$data['data'] = $dataservice->getWsnData("var",$uuid,$sites);
if(empty($data['data']))
{
$this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
return true;
}
if(!is_array($data['data']))
{
$this->jsonexit(array("error"=>$data['data']));
return true;
}
$this->jsonexit($data);
return true;
}
if($type == "submit")
{
$info = $dataservice->get($uuid);
$param = array(
"site" => $this->_getParam("site"),
);
$data = array(
"type"=>"wsn", //服务类型
"info"=>$info, //信息 dataservice 表中的字段
"callback"=>"westdc.dataservice.wsn.Submited()", //成功后的js回调函数
);
$data['data'] = $dataservice->getWsnData("submit",$uuid,$param);
if(empty($data['data']))
{
$this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
return true;
}
if(!is_array($data['data']))
{
$this->jsonexit(array("error"=>$data['data']));
return true;
}
$order = new Order();
$status = $order->addOrder($uuid,json_encode($data['data']['site'],JSON_NUMERIC_CHECK));
if($status !== true)
{
$this->jsonexit(array("error"=>$status));
return true;
}
$this->jsonexit($data);
return true;
}
}
/*
getversionAction() 获取数据版本
*/
@ -1043,6 +1212,7 @@ class DataController extends Zend_Controller_Action
$datas['project_id'] = $this->_request->getParam('project_id');
$datas['project_type'] = $this->_request->getParam('project_type');
$datas['project_title'] = $this->_request->getParam('project_title');
$datas['project_leader']= $this->_request->getParam('project_leader');
$this->view->info = $datas;
@ -1093,7 +1263,8 @@ class DataController extends Zend_Controller_Action
'email' =>$datas['email'],
'project_id'=>$datas['project_id'],
'project_title'=>$datas['project_title'],
'project_type'=>$datas['project_type']
'project_type'=>$datas['project_type'],
'project_leader'=>$datas['project_leader']
);
if($this->db->insert('onlineapp',$data))
@ -1145,6 +1316,7 @@ class DataController extends Zend_Controller_Action
$datas['project_id'] = $rows['project_id'];
$datas['project_type'] = $rows['project_type'];
$datas['project_title'] = $rows['project_title'];
$datas['project_leader'] = $rows['project_leader'];
$this->view->info = $datas;
return true;
}
@ -1166,6 +1338,7 @@ class DataController extends Zend_Controller_Action
$datas['project_id'] = $this->_request->getParam('projectid');
$datas['project_type'] = $this->_request->getParam('projecttype');
$datas['project_title'] = $this->_request->getParam('projecttitle');
$datas['project_leader'] = $this->_request->getParam('projectleader');
@ -1218,7 +1391,8 @@ class DataController extends Zend_Controller_Action
'email' =>$datas['email'],
'project_id'=>$datas['project_id'],
'project_title'=>$datas['project_title'],
'project_type'=>$datas['project_type']
'project_type'=>$datas['project_type'],
'project_leader'=>$datas['project_leader']
);
if($this->db->insert('onlineapp',$data))
@ -1261,7 +1435,7 @@ class DataController extends Zend_Controller_Action
$datas['project_id'] = $rows['project_id'];
$datas['project_type'] = $rows['project_type'];
$datas['project_title'] = $rows['project_title'];
$datas['project_leader'] = $rows['project_leader'];
echo $this->creatform($datas);
exit();
}
@ -1277,7 +1451,7 @@ class DataController extends Zend_Controller_Action
$datas['project_id'] = $rows['project_id'];
$datas['project_type'] = $rows['project_type'];
$datas['project_title'] = $rows['project_title'];
$datas['project_leader'] = $rows['project_leader'];
echo $this->creatform($datas);
exit();
}
@ -1450,68 +1624,103 @@ class DataController extends Zend_Controller_Action
function orderAction()
{
$this->view->pageID = "account-dataorder";
$ac = $this->_request->getParam('ac');
$uuid = $this->_request->getParam('uuid');
$del = $this->_request->getParam('del');
$apply = $this->_request->getParam('apply');
$finish = $this->_request->getParam('finish');
$cancel = $this->_request->getParam('cancel');
$wsn = $this->_request->getParam('wsn');
$pdf = $this->_request->getParam('pdf');
$ac = $this->_request->getParam('ac');
$selections = $this->_request->getParam('data');
//if (empty($uuid)) $this->_redirect('/data');
$userid=Zend_Auth::getInstance()->getIdentity()->id;
include_once("helper/view.php");
$userid = view::User('id');
//添加到数据篮
if ($uuid)
{
//处理数据入库
//离线申请的数据不应该重复因此需要在数据库限制还是在WEB端限制
//在数据库中控制只保证uuid,userid,status唯一就可以?
//存在历史遗留问题,原来的数据并不能保证唯一
//status: 1 开始进入离线申请申请程序中
// 2 填写并提交离线申请表
// 3 邮寄离线申请表
// 4 收到离线申请表
// 5 处理离线申请表
// 10:离线申请完成?
// -1: 取消了在线下载进程
//首先判断离线申请的数据数量是否超过系统限制
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid=? and status>0 and status<3";
$r=$this->db->fetchRow($this->db->quoteInto($sql,$userid));
//保证添加的离线数据申请未申请
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid='$userid' and uuid=? and status in (1,2,3,4)";
$r1=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
//保证添加的离线数据是正式发布的数据
$sql="select count(*) as mdcount from normalmetadata where uuid=?";
$r2=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
if ($r['datacount']<$this->view->config->download->max && $r1['datacount']<1 && $r2['mdcount']>0) {
$sql="insert into dataorder (uuid,ts_created,userid,status) values(?,now(),?,?)";
$this->db->query($sql,array($uuid,$userid,1));
//成功信息提示
$sql=$this->db->quoteInto("select title,uuid from metadata where uuid=?",$uuid);
$this->view->md=$this->db->fetchRow($sql);
$order = new Order();
$state = $order->addOrder($uuid);
if($state !== true)
{
if(!is_array($state))
{
$this->view->msg = view::Msg('alert-error',$state);
}else{
if ($r1['datacount']>=1)
$this->view->msg=view::Msg('alert-error',"错误:您申请的数据已经在数据蓝中!",0);
elseif ($r2['mdcount']==0)
$this->view->msg=view::Msg('alert-error',"错误:您申请的数据不存在。",0);
else
$this->view->msg=view::Msg('alert-error',"错误:您正在进行的离线申请的数据数已经超过系统允许的最大值,请在完成本次离线申请后再进行操作!",0);
$service_type = $order->serviceTypeTest($state['service_type']);
if($service_type !== false)
{
view::Post($this,$service_type,$state['service_url']."?href=".urlencode(view::getHostLink()."/data/order/")."&uuid=".$state['uuid']."&uid=".$userid);
}else{
$this->view->msg = view::Msg('alert-error',"无法申请:此元数据的数据类型未知");
}
}
if (empty($ac)) $ac='offline1';
} elseif ($del) {
//删除数据申请
$sql=$this->db->quoteInto("delete from dataorder where userid=".$userid." and status in (1,2) and id=?",$del);
$this->db->query($sql);
$this->_redirect('/data/order');
} elseif ($apply) {
if ($apply=='all') {
$sql=$this->db->quoteInto("update dataorder set status=2 where status=1 and userid=?",$userid);
$this->db->query($sql);
}else{
$sql="update dataorder set status=2 where status=1 and userid=? and id=?";
$this->db->query($sql,array($userid,(int)$apply));
$this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表");
}
if (empty($ac)) $ac='offline1';
}
elseif ($selections)
{
if(empty($uuid))
{
$this->view->msg = view::Msg('alert-error',"无法申请:参数出错,请通过正确的途径访问");
}
$order = new Order();
$state = $order->addOrder($uuid,$selections);
if($state !== true)
{
$this->view->msg = view::Msg('alert-error',$state);
}else{
$this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表");
}
if (empty($ac)) $ac='offline1';
}
//删除申请
elseif ($del) {
$order = new Order();
$state = $order->del($del);
if($state !== true)
{
$this->view->msg = view::Msg('alert-error',$state);
}else{
$this->view->msg = view::Msg('alert-success',"数据申请取消成功");
}
$this->_redirect('/data/order');
}
//提交申请
elseif ($apply) {
if($apply == "all" || !is_numeric($apply))
{
$apply = -1;
}
$order = new Order();
$state = $order->apply($apply);
if($state !== true)
{
$this->view->msg = view::Msg('alert-error',$state);
}else{
$this->view->msg = view::Msg('alert-success',"提交成功您可以点击“提交离线申请”来生成PDF申请表");
}
if (empty($ac)) $ac='offline2';
} elseif ($finish) {
}
//完成
elseif ($finish) {
if ($finish=='all') {
$sql=$this->db->quoteInto("update dataorder set ts_approved=now() where status=0 and userid=?",$userid);
$this->db->query($sql);
@ -1523,7 +1732,16 @@ class DataController extends Zend_Controller_Action
$sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0";
$this->db->query($sql,array($userid));
}
} elseif ($cancel) {
}
elseif($wsn)
{
$this->_helper->viewRenderer('order-wsn');
return true;
}
elseif ($cancel) {
if ($cancel=='all') {
$sql=$this->db->quoteInto("update dataorder set ts_approved=now(),status=-1 where status=0 and userid=?",$userid);
$this->db->query($sql);
@ -1536,172 +1754,192 @@ class DataController extends Zend_Controller_Action
$this->db->query($sql,array($userid));
}
if (empty($ac)) $ac='offline2';
} elseif ($pdf) {
}
//生成PDF离线申请文件
elseif ($pdf) {
//用户信息可以从SESSION中读取离线申请信息
//$sql="select * from users where id=?";
$sql="select m.title||'('||m.filesize::text||'MB)' as title,m.citation,m.suppinfo from dataorder d left join metadata m on d.uuid=m.uuid where d.status=2 and d.userid=? order by d.ts_created desc";
$rows=$this->db->fetchAll($sql,array($userid));
if ($rows) {
$this->view->data2=$rows;
$this->view->form=new OfflinePdfForm();
$order = new Order();
$rows = $order->getOrderItemForPdf();
$this->view->projectType = $order->projectType;
if ($rows) {
$this->_helper->viewRenderer('pdf');
$this->view->data2 = $rows;
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
$this->view->formData = $formData = $this->_request->getPost();
$datalist='';
foreach($rows as $i=>$row) $datalist.=($i+1).". ".$row['title'].";";
$formData['datalist']=$datalist;
if ($this->view->form->isValid($formData)) {
if (@$formData['save']) {
//保存
//根据pdflink字段以判断是否已经提交
//在数据库中创建rules在更新offlineapp表时同时更新users表中对应的信息
$sql="select id from offlineapp where userid=? and (pdflink is null or pdflink='') and (ts_approved is null)";
$row=$this->db->fetchRow($sql,array($userid));
if ($row) {
$sql="update offlineapp set username=?,email=?,phone=?,address=?,postcode=?,project=?,unit=?,datalist=?,ts_created=now(),project_type=?,project_id=?,project_title=? where id=?";
$this->db->query($sql,array($formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$formData['project_type'],$formData['project_id'],$formData['project_title'],$row['id']));
} else {
$sql="insert into offlineapp (userid,username,email,phone,address,postcode,project,unit,datalist,project_type,project_id,project_title) values(?,?,?,?,?,?,?,?,?,?,?,?)";
$this->db->query($sql,array($userid,$formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$formData['project_type'],$formData['project_id'],$formData['project_title']));
foreach($rows as $i=>$row)
{
$datalist.=($i+1).". ".$row['title'].";";
}
$formData['datalist'] = $datalist;
if (@$formData['save']) {
$order->setPdfData($rows);
$s = $order->SaveOrder($formData);
if($s !== true)
{
$this->view->error = view::Msg('alert-error',$s);
return true;
}
//不能修改顺序
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
//生成PDF
$pdf = new ApplicantPDF();
$pdf->template=$this->view->config->offline->template;
$formData['project'].='['.$formData['project_title'].' | '.$formData['project_type'].' | '.$formData['project_id'].']';
$pdf->data = $formData;
$pdf->drawWestdc();
$pdf->addRef($rows);
$pdf->addSecurity($this->view->config->offline->security);
header("Content-Disposition: inline; filename=westdc-data-apply.pdf");
header("Content-Type:application/pdf");
//header("Content-Length: " . strlen($pdfstring));
echo $pdf->Output('westdc-data-apply.pdf','S');
die();
//exit;
return true;
} elseif ($formData['submit']) {
//提交
//生成PDF
$pdf = new ApplicantPDF();
$pdf->template=$this->view->config->offline->template;
$pdf->data = $formData;
$pdf->data['project'].='['.$formData['project_title'].' | '.$formData['project_type'].' | '.$formData['project_id'].']';
$pdf->drawWestdc();
$pdf->addRef($rows);
$pdf->addSecurity($this->view->config->offline->security);
$fn=$formData['realname'].date('YmdHis').".pdf";
$pdf->Output($this->view->config->offline->savepath."/".$fn, 'F');
$order->setPdfData($rows);
$s = $order->SubmitOrder($formData);
//保存到数据库
$sql="select id from offlineapp where userid=? and pdflink is null and (ts_approved is null)";
$row=$this->db->fetchRow($sql,array($userid));
if ($row) {
$sql="update offlineapp set username=?,email=?,phone=?,address=?,postcode=?,project=?,unit=?,datalist=?,ts_created=now(),pdflink=?,project_type=?,project_id=?,project_title=? where id=?";
$this->db->query($sql,array($formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$fn,$formData['project_type'],$formData['project_id'],$formData['project_title'],$row['id']));
} else {
$sql="insert into offlineapp (userid,username,email,phone,address,postcode,project,unit,datalist,pdflink,project_type,project_id,project_title) values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
$this->db->query($sql,array($userid,$formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$fn,$formData['project_type'],$formData['project_id'],$formData['project_title']));
$sql="select id from offlineapp where userid=? and pdflink=?";
$row=$this->db->fetchRow($sql,array($userid,$fn));
if($s !== true)
{
$this->view->error = view::Msg('alert-error',$s);
return true;
}
$sql="update dataorder set status=3, offlineappid=? where status=2 and userid=?";
$this->db->query($sql,array($row['id'],$userid));
//发送用户邮件进行信息提示和说明
//$mail = new Zend_Mail('utf-8');
$data = array(
"user"=>$formData['realname'],
"datalist"=>str_replace(";","\n",$datalist)
);
$mailtp=new EmailText($this->db,'offline-email',$data);
$mail = new WestdcMailer($this->view->config->smtp);
$mail->setBodyText($mailtp->getBody());
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo($formData['email']);
$mail->setSubject($mailtp->getSubject());
$attach=$mail->createAttachment($pdf->Output('applicant','S'));
$attach->filename='数据申请-'.$formData['realname'].'.pdf';
$mail->send();
$this->_helper->viewRenderer('order');
//跳转到/data/order并提示帮助信息告知用户已经发送EMAIL
$this->view->msg=view::Msg('alert-success',"提示信息您的离线申请已经提交系统已经发送一封邮件给您请打印出申请表、签字后拍照或扫描并email给数据中心服务组仍然可以采用邮寄方式具体信息请参考邮件说明。",0);
$this->view->msg = view::Msg('alert-success','提示信息:您的离线申请已经提交,请<a href="/data/order/ac/offline3">在线上传PDF的签字版PDF文件</a>。',0);
if (empty($ac)) $ac='offline3';
//$this->_redirect('/data/order');
}
}
} else {
$sql="select u.* from users u left join offlineapp o on u.id=o.userid where u.id=?";
$sql="select u.* from users u left join offlineapp o on u.id=o.userid where u.id=? ORDER BY o.id DESC";
$row=$this->db->fetchRow($sql,array($userid));
/*$row=$ut->fetchRow('id='.$userid);
$formData['email']=$row->email;
$formData['phone']=$row->phone;
$formData['realname']=$row->realname;
$formData['unit']=$row->unit;
$formData['address']=$row->address;
$formData['purpose']=$row->project;
$formData['id']=$row->id;*/
$this->view->form->populate($row);
$this->view->formData = $row;
}
} else
} else{
$this->view->msg=view::Msg('alert-error',"错误:您还没有提交任何离线申请的数据,或您的数据申请已经提交(等待处理过程中)!",0);
}
return true;
}//pdf
if($ac == "commitapplicationform")
{
$offlineappid = $this->_getParam('offlineappid');
if(!is_numeric($offlineappid) || $offlineappid < 1)
{
view::Post($this,"参数错误",-1);
return true;
}
$order = new Order();
$status = $order->commitApplicationForm($offlineappid);
if( $status !== true)
{
view::Post($this,$status,-1);
}else{
view::Post($this,"申请已提交,请等待管理员接收并通过数据所有者审核",'/data/order/ac/offline3');
}
return true;
}
//index
$this->view->ac = $ac;
$this->_helper->viewRenderer('order');
if ($ac=='' || $ac=='online')
{
$status='d.status=0 and d.ts_approved is not null';
$this->view->tabID='order-online';
} else if ($ac=='offline1') {
$status='d.status in (1)';
$this->view->tabID='order-offline1';
} else if ($ac=='offline2') {
$status='d.status in (2)';
$this->view->tabID='order-offline2';
} else if ($ac=='offline3') {
$status='d.status in (3,4)';
$this->view->tabID='order-offline3';
} else if ($ac=='offline4') {
$status='d.status in (5)';
$this->view->tabID='order-offline4';
}
//显示已经申请的数据,包括已经提交的申请和未提交的申请,还有已经处理完成的申请,正在进行的在线数据下载
$sql="select d.*,m.title,m.datatype from dataorder d left join metadata m on d.uuid=m.uuid
where $status and d.userid=? order by d.status,d.ts_created desc";
$sql="select d.*,m.title,m.datatype,off.applicationform from dataorder d
left join metadata m on d.uuid=m.uuid
left join offlineapp off ON off.id = d.offlineappid
where d.userid=? order by d.status,d.ts_created desc";
$rows=$this->db->fetchAll($sql,array($userid));
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
/*foreach($rows as $row) {
switch ($row['status']){
$showorders = array();
$counts = array(
'onlineapp' => 0,
'offline1' => 0,
'offline2' => 0,
'offline3' => 0,
'offline4' => 0
);
if(count($rows) > 0) {
foreach($rows as $k=>$v)
{
switch($v['status']) {
case 0:
$dataorder0[]=$row;
$counts['onlineapp'] ++;
break;
case 1:
$dataorder1[]=$row;
$counts['offline1'] ++;
break;
case 2:
$counts['offline2'] ++;
break;
case 3:
$counts['offline3'] ++;
break;
case 4:
$dataorder2[]=$row;
$counts['offline3'] ++;
break;
case 5:
$dataorder3[]=$row;
$counts['offline4'] ++;
break;
}
switch($ac){
default :
if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
break;
case 'online' :
if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
break;
case 'offline1' :
if($v['status'] == 1) $showorders[] = $rows[$k];
break;
case 'offline2' :
if($v['status'] == 2)
{
$showorders[] = $rows[$k];
$this->view->offlineappid = $v['offlineappid'];
$this->view->applicationform = $v['applicationform'];
$this->view->offlineappstatus = $v['status'];
}
break;
case 'offline3' :
if($v['status'] == 3 || $v['status'] == 4)
{
$showorders[] = $rows[$k];
$this->view->offlineappid = $v['offlineappid'];
$this->view->applicationform = $v['applicationform'];
$this->view->offlineappstatus = $v['status'];
}
break;
case 'offline4' :
if($v['status'] == 5) $showorders[] = $rows[$k];
break;
}
}
@$this->view->dataorder0=$dataorder0;
@$this->view->dataorder1=$dataorder1;
@$this->view->dataorder2=$dataorder2;
@$this->view->dataorder3=$dataorder3;*/
}
$this->view->counts = $counts;
view::addPaginator($showorders,$this,10);
}
/*
* 查看数据缩略图
*/

View File

@ -1239,4 +1239,34 @@ class HeiheController extends DataController
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
function onlinelistAction()
{
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$limit=30;
$offset=$limit*($page-1);
$state=$this->db->query("select count(*) from heihemetadata where datatype=0 and uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe')");
$row=$state->fetchAll();
$sum=$row[0]['count'];
$select=$this->db->select();
$select->from('heihemetadata','*')->where('datatype=0')->where("uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe')")->order('title')->limitPage($page,$limit);
$this->view->metadata = $this->db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$limit);
}
function offlinelistAction()
{
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$limit=30;
$offset=$limit*($page-1);
$state=$this->db->query("select count(*) from heihemetadata where datatype=1 and uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe')");
$row=$state->fetchAll();
$sum=$row[0]['count'];
$select=$this->db->select();
$select->from('heihemetadata','*')->where('datatype=1')->where("uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe')")->order('title')->limitPage($page,$limit);
$this->view->metadata = $this->db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$limit);
}
}

View File

@ -9,11 +9,11 @@ class HiwaterController extends DataController
//$this->_helper->layout->setLayout('hiwater');
$this->debug = 1;
$acName = $this->_request->getActionName();
if(in_array($acName,array("aviation","radiometer","lidar","widas",'ccd',"nearvis","thermal")))
if(in_array($acName,array("aviation","radiometer","lidar","ccdlidar","widas",'ccdwidas',"nearvis","thermal")))
{
$this->view->pageIn = "collapse1";
}
else if(in_array($acName,array("airborne","vegstructure","vegparam","temperature","soilmoisture")))
else if(in_array($acName,array("airborne","demdsm","reflectance","vegtypeair","vegparam","temperature","soilmoisture")))
{
$this->view->pageIn = "collapse2";
}
@ -119,14 +119,19 @@ class HiwaterController extends DataController
$this->getmdlimited('激光雷达','航空遥感');
$this->_helper->viewRenderer('base');
}
function ccdlidarAction()
{
$this->getmdlimited('CCD','航空遥感',"激光雷达");
$this->_helper->viewRenderer('base');
}
function widasAction()
{
$this->getmdlimited('WIDAS','航空遥感');
$this->_helper->viewRenderer('base');
}
function ccdAction()
function ccdwidasAction()
{
$this->getmdlimited('CCD','航空遥感');
$this->getmdlimited('CCD','航空遥感','WIDAS');
$this->_helper->viewRenderer('base');
}
function nearvisAction()
@ -145,25 +150,35 @@ class HiwaterController extends DataController
$this->getmd(array('航空遥感产品','种植结构图','植被类型图','植被结构参数','数字高程模型','数字表面模型','地表温度','地表土壤水文'));
$this->_helper->viewRenderer('base');
}
function vegstructureAction()
function demdsmAction()
{
$this->getmd(array('','种植结构图'));
$this->getmdlimited(array('DEM','DSM','DOM'),"数据产品");
$this->_helper->viewRenderer('base');
}
function reflectanceAction()
{
$this->getmdlimited(array('地表反照率','地表反射率'),"数据产品");
$this->_helper->viewRenderer('base');
}
function vegtypeairAction()
{
$this->getmdlimited(array('植被类型',''),'数据产品');
$this->_helper->viewRenderer('base');
}
function vegparamAction()
{
$this->getmd(array('','植被结构参数'));
$this->getmdlimited(array("",'植被结构参数'),"数据产品");
$this->_helper->viewRenderer('base');
}
function dsmAction()
function soilmoistureAction()
{
$this->getmd(array('','数字表面模型'));
$this->getmdlimited(array('','土壤水分'),"数据产品");
$this->_helper->viewRenderer('base');
}
function temperatureAction()
{
$this->getmd(array('','地表温度'));
$this->getmdlimited(array('','地表温度'),"数据产品");
$this->_helper->viewRenderer('base');
}
@ -182,7 +197,8 @@ class HiwaterController extends DataController
}
function normalAction()
{
$this->getmdlimited(array('西支','黄藏寺','黄草沟','峨堡','景阳岭','阿柔阳坡','阿柔阴坡','戈壁站','神沙窝沙漠站','花寨子荒漠站','张掖湿地站'),'水文气象');
$this->getmdlimited(array('景阳岭站','峨堡站','黄草沟站','阿柔阴坡站','阿柔阳坡站','黄藏寺站','大沙龙站','寺大隆站','排露沟林前气象站','水源涵养林研究院观测站','巴吉滩戈壁站','神沙窝沙漠站','张掖湿地站',
'花寒子荒漠站','五里墩气象站','四道桥混合林站','四道桥胡杨林站','四道桥裸地站','四道桥农田站','黑河上游生态-水文试验研究站','临泽内陆河流域研究站','阿拉善荒漠生态-水文实验研究站'),'水文气象');
$this->_helper->viewRenderer('base');
}
@ -190,16 +206,23 @@ class HiwaterController extends DataController
{
$this->getmd(array('','自动气象站'));
$this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
}
function ecAction()
{
$this->getmd(array('','涡动相关仪'));
$this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
}
function lasAction()
{
$this->getmd(array('','大孔径闪烁仪'));
$this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
}
function precAction()
{
@ -289,6 +312,8 @@ class HiwaterController extends DataController
{
$this->getmd(array('自动气象站','涡动相关仪','大孔径闪烁仪','稳定同位素观测系统','热扩散液流计TDP','宇宙射线土壤水分'));
$this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
}
function isotopeAction()
@ -328,32 +353,32 @@ class HiwaterController extends DataController
}
function smAction()
{
$this->getmdlimited(array('土壤水分'),'数据产品');
$this->getmdlimited(array('土壤水分',"卫星遥感"),'数据产品');
$this->_helper->viewRenderer('base');
}
function snowAction()
{
$this->getmdlimited(array('积雪'),'数据产品');
$this->getmdlimited(array('积雪',"卫星遥感"),'数据产品');
$this->_helper->viewRenderer('base');
}
function vegtypeAction()
{
$this->getmdlimited(array('植被类型','种植结构'),'数据产品');
$this->getmdlimited(array('植被类型','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base');
}
function vegcovAction()
{
$this->getmdlimited(array('植被覆盖度',''),'数据产品');
$this->getmdlimited(array('植被覆盖度','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base');
}
function phenologyAction()
{
$this->getmdlimited(array('物候期',''),'数据产品');
$this->getmdlimited(array('物候期','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base');
}
function nppAction()
{
$this->getmdlimited(array('NPP',''),'数据产品');
$this->getmdlimited(array('NPP','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base');
}
@ -494,7 +519,7 @@ class HiwaterController extends DataController
$row=$state->fetchAll();
$sum=$row[0]['count'];
//@todo: add order with title
$sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by timebegin,title limit ? offset ?";
$sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by title limit ? offset ?";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1;
@ -525,7 +550,7 @@ class HiwaterController extends DataController
$row=$state->fetchAll();
$sum=$row[0]['count'];
//@todo: add order with title
$sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and id in (select id from keyword where keyword='".$limited."') and id in (select id from keyword where keyword in ".$keyword.") order by timebegin,title limit ? offset ?";
$sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and id in (select id from keyword where keyword='".$limited."') and id in (select id from keyword where keyword in ".$keyword.") order by title limit ? offset ?";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1;

View File

@ -18,7 +18,7 @@ class IndexController extends Zend_Controller_Action
$name=basename($this->view->newsletter,'.pdf');
list(,$this->view->newsletterno)=explode("_",$name);
//统计数据
$sql='select (select count(*) from users) as usernum,(select count(*) from metadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum';
$sql='select (select count(*) from users) as usernum,(select count(*) from normalmetadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum';
$row=$this->db->fetchRow($sql);
$this->view->usernum=$row['usernum'];
$this->view->metanum=$row['metanum'];
@ -26,7 +26,7 @@ class IndexController extends Zend_Controller_Action
/*$sql='select count(*) from metadata';
$row=$this->db->fetchRow($sql);
$this->view->metanum=$row['count'];*/
$sql="select sum(filesize) as sum,datatype from metadata group by datatype";
$sql="select sum(filesize) as sum,datatype from normalmetadata group by datatype";
$rows=$this->db->fetchAll($sql);
foreach($rows as $row)
{

View File

@ -121,4 +121,22 @@ class KnowledgeController extends Zend_Controller_Action
//$this->_helper->viewRenderer('search-data');
}
}
function paperAction()
{
$id = (int)$this->_request->getParam('id');
$sql="select * from reference where id=$id";
$sth = $this->db->prepare($sql);
$sth->execute();
$this->view->paper = $sth->fetch();
$sql="select * from ref_author where id=$id order by place";
$sth = $this->db->prepare($sql);
$sth->execute();
$this->view->author = $sth->fetchAll();
$sql="select * from ref_tag where id=$id";
$sth = $this->db->prepare($sql);
$sth->execute();
$this->view->tag = $sth->fetchAll();
}
}

View File

@ -123,6 +123,12 @@ class ReviewController extends Zend_Controller_Action
* mdstatus status 字段值为 2,3,4 的元数据为正在进行评审的元数据
*/
function inreviewAction(){
include_once("helper/view.php");
$ac = $this->_getParam('ac');
if(empty($ac))
{
$this->view->pageID = "review-inreview";
$page=@(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
@ -132,6 +138,57 @@ class ReviewController extends Zend_Controller_Action
$sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s right join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (2,3,4) order by s.ts_created desc,m.title limit ? offset ?";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page = new Pagination($sum,$page,$this->limit);
}
if($ac == "require")
{
$this->_helper->viewRenderer('inreview-require');
$this->view->pageID = "review-inreview-require";
$uid = view::User('id');
if(empty($uid))
{
view::Post($this,"请先登录","/account/login/?href=".urlencode("/review/inreview/ac/require"));
}
$sql = "select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename,r.ts_created,r.id as rid,e.id as eid
from mdstatus s
right join normalmetadata m on s.uuid=m.uuid
left join geonetworkmetadata g on g.uuid=m.uuid
left join thumbnail t on t.id=m.id
left join mdreview r ON m.uuid=r.uuid
left join mdexpertreview e ON e.uuid=m.uuid
WHERE s.status in (2,3,4) AND r.id IS NULL
GROUP BY m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id,t.filename,s.ts_created,r.ts_created,r.id,e.id
order by e.id DESC,s.ts_created desc,m.title";
$rs = $this->db->query($sql);
view::addPaginator($rs->fetchAll(),$this,NULL,$this->limit);
}
if($ac == "reviewed")
{
$this->_helper->viewRenderer('inreview-reviewed');
$this->view->pageID = "review-inreview-reviewed";
$uid = view::User('id');
if(empty($uid))
{
view::Post($this,"请先登录","/account/login/?href=".urlencode("/review/inreview/ac/reviewed"));
}
$sql = "select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename,r.ts_created
from mdstatus s
right join normalmetadata m on s.uuid=m.uuid
left join geonetworkmetadata g on g.uuid=m.uuid
left join thumbnail t on t.id=m.id
left join mdreview r ON m.uuid=r.uuid
WHERE s.status in (2,3,4) AND r.userid=$uid
GROUP BY m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id,t.filename,s.ts_created,r.ts_created
order by s.ts_created desc,m.title";
$rs = $this->db->query($sql);
view::addPaginator($rs->fetchAll(),$this,NULL,$this->limit);
}
}//在审阶段的元数据

View File

@ -1,4 +1,10 @@
<?php
use Helpers\View;
use Helpers\dbh;
use Files\Files;
use Files\Output;
use Files\Listener\FileListener;
class ServiceController extends Zend_Controller_Action
{
private $limit=10;
@ -1448,6 +1454,24 @@ class ServiceController extends Zend_Controller_Action
echo $pagnation;
}//文档页面相关数据
function refdatacountAction()
{
if(view::isXmlHttpRequest($this))
{
$id = (int)$this->_getParam('id');
if($id < 1){
echo 0;
return;
}
$sql = "select count(md.id) as total from mdref mr
right join normalmetadata md on md.uuid=mr.uuid
where mr.refid=$id";
$rs = $this->db->query($sql);
$row = $rs->fetch();
echo $row['total'];
}
}
function tagdatalistAction(){
$this->_helper->layout->disableLayout();
@ -1550,6 +1574,56 @@ class ServiceController extends Zend_Controller_Action
}
//上传申请表
function uploadapplicationformAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('offlineappid');
if(empty($id))
{
$this->jsonexit(array('error'=>"参数错误"));
return true;
}
$uid = view::User('id');
if(!is_numeric($uid))
{
$this->jsonexit(array('error'=>"用户信息读取失败,请重试"));
return true;
}
$files = new Files();
$FileListener = new FileListener();
@$files->events()->attachAggregate($FileListener);
$statu = $files->uploadApplicationForm($_FILES['Filedata'],$id);
if(isset($statu['error']))
{
$this->jsonexit($statu);
return true;
}else{
$sql = "UPDATE offlineapp SET applicationform='{$statu['file']}' WHERE id=$id AND userid=$uid";
if($this->db->exec($sql))
{
$this->jsonexit(array("success"=>1));
return true;
}else{
$this->jsonexit(array('error'=>"申请表上传失败".$sql));
return true;
}
}
}
//下载申请表
public function downloadapplicationformAction()
{
}
/*
输出验证码
*/
@ -1728,4 +1802,9 @@ class ServiceController extends Zend_Controller_Action
Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params);
}
public function jsonexit($data){
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
return true;
}
}

View File

@ -2,6 +2,7 @@
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
@ -36,7 +37,7 @@ $this->breadcrumb()->setSeparator(' > ');
<a href="/author/comment/ac/view/uuid/<?php echo $item['uuid']; ?>">反馈</a> |
<a href="/author/document/uuid/<?php echo $item['uuid']; ?>">文档</a> |
<a href="/author/literature/uuid/<?php echo $item['uuid']; ?>">文献</a> |
<a href="/author/literature/ac/add/uuid/<?php echo $item['uuid']; ?>">添加文献</a> |
<a href="/author/literature/ac/add/uuid/<?php echo $item['uuid']; ?>" class="more iframe">添加文献</a> |
<a href="/service/geonetwork?url=metadata.edit?id=<?php echo $item['gid']; ?>" target="_blank">修改元数据</a> |
<a href="/author/version/uuid/<?php echo $item['uuid']; ?>">版本</a> |
<a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> |
@ -73,3 +74,6 @@ $this->breadcrumb()->setSeparator(' > ');
</div>
</div>
<script>
$(".iframe").colorbox({iframe:true, width:"60%", height:"80%"});
</script>

View File

@ -38,7 +38,7 @@ $this->breadcrumb()->setSeparator(' > ');
<p><?php echo $item['reference'];?></p>
<p>
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a>
| <a href="javascript:void(0);" class="edit" rel="<?= $item['id'];?>">编辑</a>
| <a href="javascript:void(0);" class="edit" rel="<?= $item['mrid'];?>" rev="<?= $item['uuid']?>">编辑</a>
| <a href="javascript:void(0);" class="order" rel="<?= $item['mrid'];?>" rev="<?= $item['place']?>">排序</a>
| <a onclick="return confirm('是否确定删除该文献?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a>
| <a href="/author/literature/ac/add/uuid/<?php echo $item['uuid'];?>" class="more iframe">添加文献</a>

View File

@ -0,0 +1,18 @@
<div id="upload-form" class="modal hide fade" tabindex="-1" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">申请表上传</h3>
</div>
<div class="modal-body">
<form id="application-form">
<div id="fsUploadProgress">允许上传20M以内的 PDF 文件</div>
<input type="file" name="Filedata" id="file_upload" />
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">取消上传</button>
</div>
</div>
<script>
_this.SessionID = '<?php echo session_id(); ?>';
</script>

View File

@ -111,6 +111,12 @@
<input class="input-block-level" type="text" name="project_title" value="<?php echo empty($this->info['project_title']) ? "":$this->info['project_title']; ?>" />
</div>
</div>
<div class="control-group ">
<label class="control-label">项目负责人</label>
<div class="controls">
<input class="input-block-level" type="text" name="project_leader" value="<?php echo empty($this->info['project_leader']) ? "":$this->info['project_leader']; ?>" />
</div>
</div>
<div class="control-group ">
<label class="control-label">数据用途</label>
<div class="controls">

View File

@ -0,0 +1,33 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('离线申请');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('离线申请');
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class="row">
<div class="span3">
<div class="well sidebar-nav">
<?= $this->partial('account/left.phtml'); ?>
</div><!--/.well -->
</div><!--/span-->
<div class="span9">
<h3>数据篮</h3>
<hr />
<?php
if(!empty($this->msg))
{
echo $this->msg;
}
?>
<h2>请选择要下载的数据</h2>
<!-- /content -->
</div><!--/span-->
</div><!--/row-->
<script>$('#Nav-<?= $this->tabID?>').addClass("active");</script>

View File

@ -3,11 +3,10 @@
$this->headTitle($this->config->title->data);
$this->headTitle('离线申请');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('离线申请');
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'uploadify');
$this->theme->AppendModel($this,'offlineapp-uploader');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class="row">
@ -28,26 +27,47 @@ $this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
?>
<ul class="nav nav-tabs">
<li id="Nav-order-offline1"><a href="/data/order/ac/offline1">未提交的数据</a></li>
<li id="Nav-order-offline2"><a href="/data/order/ac/offline2">正在提交的数据</a></li>
<li id="Nav-order-offline3"><a href="/data/order/ac/offline3">等待通过的申请</a></li>
<li id="Nav-order-offline4"><a href="/data/order/ac/offline4">已通过的申请</a></li>
<li id="Nav-order-online"><a href="/data/order/ac/online">在线数据</a></li>
<li id="Nav-order-offline1"><a href="/data/order/ac/offline1">未生成的申请<?= !empty($this->counts['offline1']) ? '<span class="badge badge-info">'.$this->counts['offline1'].'</span>':'' ?></a></li>
<li id="Nav-order-offline2"><a href="/data/order/ac/offline2">待提交的订单<?= !empty($this->counts['offline2']) ? '<span class="badge badge-info">'.$this->counts['offline2'].'</span>':'' ?></a></li>
<li id="Nav-order-offline3"><a href="/data/order/ac/offline3">待审批的订单<?= !empty($this->counts['offline3']) ? '<span class="badge badge-info">'.$this->counts['offline3'].'</span>':'' ?></a></li>
<li id="Nav-order-offline4"><a href="/data/order/ac/offline4">已通过的申请<?= !empty($this->counts['offline4']) ? '<span class="badge badge-info">'.$this->counts['offline4'].'</span>':'' ?></a></li>
<li id="Nav-order-online"><a href="/data/order/ac/online">在线数据<?= !empty($this->counts['onlineapp']) ? '<span class="badge badge-info">'.$this->counts['onlineapp'].'</span>':'' ?></a></li>
</ul>
<!-- content -->
<?php if (!empty($this->paginator)) : ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php if ($this->tabID=='order-offline2') { ?>
<div class="well alert alert-error">重要说明:完成一个订单需要三个步骤,即<strong>生成pdf</strong><strong>上传签字后的pdf</strong><strong>确认订单</strong>。请确保上传的pdf和当前订单中的数据相同否则无法受理。若不相同请重新生成、上传。</div>
<?php } ?>
<table class="table table-bordered table-striped">
<thead>
<th>时间</th>
<th>标题</th>
<th>
<?php if ($this->tabID=='order-offline1') {
echo '<a class="btn btn-primary" href="/data/order/apply/all">提交所有数据</a>(一次最多5条';
echo '<a class="btn btn-primary" href="/data/order/apply/all">全部放入订单</a>最多5条';
} elseif ($this->tabID=='order-offline2') {
echo '<a class="btn btn-primary" href="/data/order/pdf/1">提交离线申请</a>';
if(count($this->paginator))
{
echo '<a class="btn btn-primary" href="/data/order/pdf/1">生成pdf</a> ';
if($this->offlineappid >1)
{
if(empty($this->applicationform))
{
echo '<a class="btn btn-primary" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">上传pdf</a>';
}
else
{
echo '<a class="btn btn-warning" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">重新上传pdf</a>
<a class="btn btn-success" href="/data/order/ac/commitapplicationform/?offlineappid='.$this->offlineappid.'">确认订单</a>';
}
}
}
} elseif ($this->tabID=='order-offline3') {
echo '申请状态';
if(count($this->paginator))
{
echo "请等待审核";
}
} elseif ($this->tabID=='order-offline4') {
echo '通过时间';
}
@ -58,21 +78,27 @@ echo '通过时间';
<tbody>
<?php foreach($this->paginator as $order) : ?>
<tr>
<?php if($order['status'] < 4) { ?>
<td><?php echo date('Y-m-d H:i:s',strtotime($order['ts_created'])); ?></td>
<td><a href="<?php echo $order['uuid']; ?>"><?php echo $order['title']; ?></a></td>
<?php }else{ ?>
<td><?php echo date('Y-m-d H:i:s',strtotime($order['ts_received'])); ?></td>
<?php } ?>
<td><a href="/data/<?php echo $order['uuid']; ?>"><?php echo $order['title']; ?></a></td>
<td>
<?php
if ($this->tabID=='order-offline1') {
echo '<a href="/data/order/apply/'.$order['id'].'" class="btn btn-primary">提交</a>
<a href="/data/order/cancel/'.$order['id'].'" class="btn">取消</a>';
echo '<a href="/data/order/apply/'.$order['id'].'" class="btn btn-primary">放入订单</a>
<a href="/data/order/cancel/'.$order['id'].'" class="btn">移除</a>';
} elseif ($this->tabID=='order-offline2') {
switch($order['status']) {
case 2:
echo "请生成PDF申请表";
echo ' <a class="btn" href="/data/order/cancel/'.$order['id'].'">取消</a>';
if(empty($order['applicationform']))
echo "请生成pdf并上传".' <a class="btn" href="/data/order/cancel/'.$order['id'].'">移除</a>';
else
echo '<span class="label label-success">PDF已上传,请确认订单</span>';
break;
case 3:
echo "请打印签字然后扫描或拍照申请表并email或邮寄";
echo '<span class="label label-success">申请表已上传</span>';
break;
default:
break;
@ -80,10 +106,16 @@ if ($this->tabID=='order-offline1') {
} elseif ($this->tabID=='order-offline3') {
switch($order['status']) {
case 3:
echo "请打印签字然后扫描或拍照申请表并email或邮寄";
if(!empty($order['applicationform']))
echo '<span class="label label-success">申请表已上传</span>';
else
echo '<span class="label label-warning">请上传申请表</span>';
break;
case 4:
echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received']));
if(!empty($order['applicationform']))
{ echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received']));}
else
echo '<span class="label label-warning">请上传申请表</span>';
break;
case 5:
echo "已通过申请,请查收邮件";
@ -105,3 +137,7 @@ if ($this->tabID=='order-offline1') {
</div><!--/span-->
</div><!--/row-->
<script>$('#Nav-<?= $this->tabID?>').addClass("active");</script>
<script>
var _this = {};
</script>
<?= $this->partial('data/offlineapp-uploaderform.phtml'); ?>

View File

@ -34,8 +34,101 @@
<div class="alert"><?php echo $msg; ?></div>
<?php endforeach;endif; ?>
<?php if ($this->msg) : ?>
<div class="alert"><p><?php echo $this->msg; ?></div>
<?php echo $this->msg; ?>
<?php endif; ?>
<?php echo $this->form;?>
<?php if ($this->error) : ?>
<?php echo $this->error; ?>
<?php endif; ?>
<form id="OfflinePdf" enctype="application/x-www-form-urlencoded" class="form-horizontal" action="" method="post">
<div class="control-group">
<label class="control-label" name="realname">真实姓名</label>
<div class="controls">
<input type="text" name="realname" id="realname" value="<?= empty($this->formData['realname']) ? "":$this->formData['realname']?>" helper="formText"> </div>
</div>
<div class="control-group">
<label class="control-label" name="email">E-Mail</label>
<div class="controls">
<input type="text" name="email" id="email" value="<?= empty($this->formData['email']) ? "":$this->formData['email']?>" helper="formText"> </div>
</div>
<div class="control-group">
<label class="control-label" name="phone">电话</label>
<div class="controls">
<input type="text" name="phone" id="phone" value="<?= empty($this->formData['phone']) ? "":$this->formData['phone']?>" helper="formText"> </div>
</div>
<div class="control-group">
<label class="control-label" name="unit">单位</label>
<div class="controls">
<input type="text" name="unit" id="unit" value="<?= empty($this->formData['unit']) ? "":$this->formData['unit']?>" helper="formText" class="input-block-level"> </div>
</div>
<div class="control-group">
<label class="control-label" name="address">联系地址</label>
<div class="controls">
<input type="text" name="address" id="address" value="<?= empty($this->formData['address']) ? "":$this->formData['address']?>" helper="formText" class="input-block-level"> </div>
</div>
<div class="control-group">
<label class="control-label" name="postcode">邮编</label>
<div class="controls">
<input type="text" name="postcode" id="postcode" value="<?= empty($this->formData['postcode']) ? "":$this->formData['postcode']?>" helper="formText"> </div>
</div>
<div class="control-group">
<label class="control-label" name="project_id">项目编号</label>
<div class="controls">
<input type="text" name="project_id" id="project_id" value="<?= empty($this->formData['project_id']) ? "":$this->formData['project_id']?>" helper="formText"> </div>
</div>
<div class="control-group">
<label class="control-label" name="project_type">项目类型</label>
<div class="controls">
<select name="project_type" id="project_type" helper="formSelect">
<option value="" label="请选择项目类型" <?= empty($this->formData['project_type']) ? 'selected="selected"':"" ?>>请选择项目类型</option>
<?php foreach($this->projectType as $k=>$v) {?>
<option value="<?= $v ?>" <?= $this->formData['project_type'] == $v ? 'selected="selected"':"" ?>><?= $k ?></option>
<?php }?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" name="project_title">项目名称</label>
<div class="controls">
<input type="text" name="project_title" id="project_title" value="<?= empty($this->formData['project_title']) ? "":$this->formData['project_title']?>" helper="formText" class="input-block-level">
</div>
</div>
<div class="control-group">
<label class="control-label" name="leader">项目负责人</label>
<div class="controls">
<input type="text" name="project_leader" id="leader" value="<?= empty($this->formData['project_leader']) ? "":$this->formData['project_leader']?>" helper="formText" class="input">
</div>
</div>
<div class="control-group">
<label class="control-label" name="project">用途<br/>(请详细描述使用目的)</label>
<div class="controls">
<textarea name="project" id="project" helper="formTextarea" rows="3" class="input-block-level" cols="80"><?= empty($this->formData['project']) ? "":$this->formData['project']?></textarea> </div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="id" value="8018" helper="formHidden" id="id">
<input type="submit" name="save" id="savebutton" value="预览PDF" class="btn">
<input type="submit" name="submit" id="submitbutton" value="生成并下载PDF" class="btn btn-primary">
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="alert alert-success">生成PDF并下载后打印并签字之后将申请表制作成PDF文件并且<a href="/data/order/ac/offline2">在线上传PDF</a>通过Email或者邮寄方式提交的申请将被拒绝</div>
</div>
</div>
</form>
</div><!--/span-->
</div>

View File

@ -5,6 +5,9 @@
$this->headTitle()->setSeparator(' - ');
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?>
<style>
h3.gs_rt{font-size:110%;}
@ -46,6 +49,7 @@ echo '<a href="http://westdc.westgis.ac.cn/data/'.$md->uuid.'"><img src="/images
<h4><i class="icon-eye-open text-success"></i>Recommended References</h4>
<ol>
<?php foreach($this->ref as $ref) :
echo '<li>'.$ref->reference;
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
@ -334,6 +338,9 @@ endforeach;
Put in the CART
</a>
<?php endif;endif; ?>
<a href="javascript:void(0);" class="btn btn-block" title="喜欢此数据可以将它放到收藏夹中下次浏览">
收藏此数据
</a>
</div>
</div>
<hr />

View File

@ -0,0 +1,34 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('离线数据浏览');
$this->headTitle()->setSeparator(' - ');
$this->nav[] = array('link'=>"/heihe/offline",'title'=>'离线数据浏览');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class="row">
<div class="span2">
<?= $this->partial('heihe/navi.phtml'); ?>
</div>
<div class="span10">
<?php echo $this->page->getNavigation(); ?>
<hr />
<div class="mdlist">
<ol start="<?php echo $this->offset; ?>">
<?php foreach($this->metadata as $md) : ?>
<div class="media well well-small">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="pull-left colorbox">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/heihe/view/uuid/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
</ol>
</div>
<hr />
<?php echo $this->page->getNavigation(); ?>
</div>
</div>

View File

@ -0,0 +1,34 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('在线数据浏览');
$this->headTitle()->setSeparator(' - ');
$this->nav[] = array('link'=>"/heihe/offline",'title'=>'在线数据浏览');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class="row">
<div class="span2">
<?= $this->partial('heihe/navi.phtml'); ?>
</div>
<div class="span10">
<?php echo $this->page->getNavigation(); ?>
<hr />
<div class="mdlist">
<ol start="<?php echo $this->offset; ?>">
<?php foreach($this->metadata as $md) : ?>
<div class="media well well-small">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="pull-left colorbox">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/heihe/view/uuid/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
</ol>
</div>
<hr />
<?php echo $this->page->getNavigation(); ?>
</div>
</div>

View File

@ -11,6 +11,9 @@
$this->headLink()->appendStylesheet('/css/water.css');
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?>
<?= $this->render('breadcrumbs.phtml') ?>
<style>
@ -71,10 +74,15 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol>
<?php foreach($this->ref as $ref) :
echo '<li>'.$ref->reference;
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
{
if(!empty($ref->attid))
echo '<a href="/service/attach/id/'.$ref->attid.'"><i class="icon-download text-success"></i>下载</a>';
}else{
echo '<a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a>';
}
echo "</li>";
endforeach;
?>
</ol>
@ -102,8 +110,8 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
?>
<?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Environmental and Ecological Science Data Center for West China,National Natural Science Foundation of China (http://westdc.westgis.ac.cn)</p>
<p>中文发表的成果参考以下规范注明: 数据来源于黑河计划数据管理中心、寒区旱区科学数据中心(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)</p>
</p>
<?php endif; ?>
<?php if($this->data_archives){ ?>
@ -360,10 +368,21 @@ endforeach;
在线下载
</a>
<?php else: ?>
<?php
if(!empty($this->dataService)) { ?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?>
<a href="javascript:void(0);" class="btn btn-primary btn-large btn-block" title="此数据需要选择要下载的子集" onclick="westdc.dataservice.choiceData('<?= $md->uuid ?>',this);">
<?php }else{ ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="免费!离线申请此数据(在线数据和离线数据都可申请)">
<?php } ?>
放入数据篮
</a>
<?php endif;endif; ?>
<!--
<a href="javascript:void(0);" onclick="method.like('<?php echo $md->uuid; ?>',this)" class="btn btn-block" title="喜欢此数据可以将它放到收藏夹中下次浏览">
收藏此数据
</a>
-->
</div>
</div>
@ -506,4 +525,4 @@ var bound = {
<p>没有找到对应的元数据。</p>
<?php endif;?>
</div>
<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js?uid=1336100079460458" charset="utf-8"></script>
<!--<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js?uid=1336100079460458" charset="utf-8"></script>-->

View File

@ -19,15 +19,15 @@
<ul class="nav nav-list heihe-subnav">
<li id="Nav-hiwater-radiometer"><a href="/hiwater/radiometer"><i class="icon-double-angle-right"></i>微波辐射计</a></li>
<li id="Nav-hiwater-lidar"><a href="/hiwater/lidar"><i class="icon-double-angle-right"></i>激光雷达</a></li>
<li id="Nav-hiwater-widas"><a href="/hiwater/widas"><i class="icon-double-angle-right"></i>WiDAS</a></li>
<li id="Nav-hiwater-ccd"><a href="/hiwater/ccd"><i class="icon-double-angle-right"></i>CCD</a></li>
<li id="Nav-hiwater-ccdlidar"><a href="/hiwater/ccdlidar"><i class="icon-double-angle-right"></i>CCD影像(与激光雷达并飞)</a></li>
<li id="Nav-hiwater-widas"><a href="/hiwater/widas"><i class="icon-double-angle-right"></i>多角度多波段成像观测系统WiDAS</a></li>
<li id="Nav-hiwater-ccdwidas"><a href="/hiwater/ccdwidas"><i class="icon-double-angle-right"></i>CCD影像(与多角度多波段成像观测系统并飞)</a></li>
<li id="Nav-hiwater-nearvis"><a href="/hiwater/nearvis"><i class="icon-double-angle-right"></i>可见光和近红外成像光谱仪</a></li>
<li id="Nav-hiwater-thermal"><a href="/hiwater/thermal"><i class="icon-double-angle-right"></i>热红外成像光谱仪</a></li>
</ul>
</div>
</div>
</div>
<!--
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-airborne">
<a href="/hiwater/airborne" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
@ -38,17 +38,16 @@
<div id="collapse2" class="accordion-body collapse">
<div class="accordion-inner">
<ul class="nav nav-list heihe-subnav">
<li id="Nav-hiwater-vegstructure"><a href="/hiwater/vegstructure"><i class="icon-double-angle-right"></i>种植结构图</a></li>
<li id="Nav-hiwater-vegtype"><a href="/hiwater/vegtype"><i class="icon-double-angle-right"></i>植被类型图</a></li>
<li id="Nav-hiwater-demdsm"><a href="/hiwater/demdsm"><i class="icon-double-angle-right"></i>DEM和DSM</a></li>
<li id="Nav-hiwater-reflectance"><a href="/hiwater/reflectance"><i class="icon-double-angle-right"></i>地表反射率/反照率</a></li>
<li id="Nav-hiwater-vegtypeair"><a href="/hiwater/vegtypeair"><i class="icon-double-angle-right"></i>植被类型分布</a></li>
<li id="Nav-hiwater-vegparam"><a href="/hiwater/vegparam"><i class="icon-double-angle-right"></i>植被结构参数</a></li>
<li id="Nav-hiwater-dem"><a href="/hiwater/dem"><i class="icon-double-angle-right"></i>数字高程模型</a></li>
<li id="Nav-hiwater-dsm"><a href="/hiwater/dsm"><i class="icon-double-angle-right"></i>数字表面模型</a></li>
<li id="Nav-hiwater-temperature"><a href="/hiwater/temperature"><i class="icon-double-angle-right"></i>地表温度</a></li>
<li id="Nav-hiwater-soilmoisture"><a href="/hiwater/soilmoisture"><i class="icon-double-angle-right"></i>地表土壤水分</a></li>
<li id="Nav-hiwater-soilmoisture"><a href="/hiwater/soilmoisture"><i class="icon-double-angle-right"></i>土壤水分</a></li>
</ul>
</div>
</div>
</div> -->
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-hmon">
<a href="/hiwater/hmon" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
@ -105,7 +104,7 @@
<div class="accordion-heading" id="Nav-hiwater-mso">
<a href="/hiwater/mso" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#side_accordion" href="#collapse6">
地表蒸散发的多尺度观测试验
非均匀下垫面地表蒸散发的多尺度观测试验
</a>
</div>
<div id="collapse6" class="accordion-body collapse">
@ -151,20 +150,25 @@
</a>
</div>
</div> -->
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-satellite">
<a class="accordion-toggle" href="/hiwater/satellite">
卫星遥感数据
</a>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-rsproduct">
<a href="/hiwater/rsproduct" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#side_accordion" href="#collapse7">
遥感产品
卫星遥感产品
</a>
</div>
<div id="collapse7" class="accordion-body collapse">
<div class="accordion-inner">
<ul class="nav nav-list heihe-subnav">
<li id="Nav-hiwater-dem"><a href="/hiwater/dem"><i class="icon-double-angle-right"></i>DEM和DSM</a></li>
<li id="Nav-hiwater-precipitation"><a href="/hiwater/precipitation"><i class="icon-double-angle-right"></i>降水</a></li>
<li id="Nav-hiwater-sm"><a href="/hiwater/sm"><i class="icon-double-angle-right"></i>土壤水分</a></li>
<li id="Nav-hiwater-snow"><a href="/hiwater/snow"><i class="icon-double-angle-right"></i>积雪</a></li>
<li id="Nav-hiwater-sm"><a href="/hiwater/sm"><i class="icon-double-angle-right"></i>土壤水分</a></li>
<li id="Nav-hiwater-vegtype"><a href="/hiwater/vegtype"><i class="icon-double-angle-right"></i>植被类型分布</a></li>
<li id="Nav-hiwater-vegcov"><a href="/hiwater/vegcov"><i class="icon-double-angle-right"></i>植被覆盖度</a></li>
<li id="Nav-hiwater-phenology"><a href="/hiwater/phenology"><i class="icon-double-angle-right"></i>物候期</a></li>
@ -173,13 +177,6 @@
</div>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-satellite">
<a class="accordion-toggle" href="/hiwater/satellite">
卫星遥感
</a>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-document">
<a class="accordion-toggle" href="/hiwater/document">

View File

@ -12,6 +12,9 @@
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?>
<style>
h3.gs_rt{font-size:110%;}
@ -69,10 +72,15 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol>
<?php foreach($this->ref as $ref) :
echo '<li>'.$ref->reference;
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
{
if(!empty($ref->attid))
echo '<a href="/service/attach/id/'.$ref->attid.'"><i class="icon-download text-success"></i>下载</a>';
}else{
echo '<a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a>';
}
echo "</li>";
endforeach;
?>
</ol>
@ -100,8 +108,8 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
?>
<?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Environmental and Ecological Science Data Center for West China,National Natural Science Foundation of China (http://westdc.westgis.ac.cn)</p>
<p>中文发表的成果参考以下规范注明: 数据来源于黑河计划数据管理中心、寒区旱区科学数据中心(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)</p>
</p>
<?php endif; ?>
<?php if($this->data_archives){ ?>
@ -358,7 +366,13 @@ endforeach;
在线下载
</a>
<?php else: ?>
<?php
if(!empty($this->dataService)) { ?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?>
<a href="javascript:void(0);" class="btn btn-primary btn-large btn-block" title="此数据需要选择要下载的子集" onclick="westdc.dataservice.choiceData('<?= $md->uuid ?>',this);">
<?php }else{ ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="免费!离线申请此数据(在线数据和离线数据都可申请)">
<?php } ?>
放入数据篮
</a>
<?php endif;endif; ?>

View File

@ -0,0 +1,106 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('知识积累');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
$this->breadcrumb('文章查看');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div class="row">
<div class="span3">
<?= $this->partial('knowledge/navi.phtml'); ?>
</div>
<div class="span9">
<div id="content">
<?php if(!empty($this->paper['title'])){ ?>
<h3><?php echo $this->paper['title']; ?></h3>
<hr />
<?php } ?>
<?php if(count($this->author) > 0) {?>
<h4>作者</h4>
<ul>
<?php foreach($this->author as $a) : ?>
<li><?php echo $a['lastname'];if (!empty($a['firstname'])) echo ', '.$a['firstname']; ?></li>
<?php endforeach; ?>
</ul>
<hr />
<?php } ?>
<?php if ($this->paper['abstract']){ ?>
<h4>摘要</h4>
<p><?php echo $this->paper['abstract']; ?></p>
<hr />
<?php } ?>
<?php if(count($this->tag) > 0) { ?>
<h4>关键词</h4>
<ul>
<?php foreach($this->tag as $t) : ?>
<li><?php echo $t['tag']; ?></li>
<?php endforeach; ?>
</ul>
<hr />
<?php } ?>
<?php if(!empty($this->paper['reference'])) { ?>
<h4>引用方式</h4>
<blockquote>
<?php echo $this->paper['reference']; ?>
</blockquote>
<hr />
<?php } ?>
<div>
<?php
if (empty($this->paper['link']))
{
if(!empty($this->paper['attid']))
{
echo '<a href="/service/attach/id/'.$this->paper['attid'].'"><i class="icon-download text-success"></i>PDF下载</a>';
}
}else{
echo '<a href="'.$this->paper['link'].'"><i class="icon-download text-success"></i>PDF下载</a>';
}
if (!empty($item['link'])) :
echo ' <a href="'.$item['link'].'">下载</a>';
endif;
?>
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $this->paper['id'];?>',0)">相关数据(共<span id="referenceDataCount"></span>条)</a>
</div>
</div><!-- content -->
</div>
</div>
<script type="text/javascript" >
$('#Nav-knowledge-author').addClass('active');
</script>
<script>
function showdata(id,page){
var url="/service/refdatalist/id/"+id;
$.ajax({
'type':"GET",
'url':url,
'data':'page='+page,
'dataType':'html',
'success':function(html){$.colorbox({'html':html,'innerHeight':230});}
});
}
function displayDataCount()
{
$.ajax({
'type':"GET",
'url':"/service/refdatacount/id/<?php echo $this->paper['id'];?>",
'data':'',
'dataType':'html',
'success':function(html){$('#referenceDataCount').html(html)}
});
}
displayDataCount();
</script>

View File

@ -0,0 +1,53 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->review);
$this->headTitle('在审元数据');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/review">'.$this->config->title->review.'</a>');
$this->breadcrumb('在审元数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row">
<div class="span3">
<?= $this->partial('review/navi.phtml'); ?>
</div>
<div class="span9">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>名称</th>
<th>接收时间</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<tr>
<td><a href="/review/review/uuid/<?= $item['uuid'] ?>"><?= $item['title'] ?></a><?= empty($item['eid']) ? "":"[受邀评审]"?></td>
<td><?= date("Y-m-d",strtotime($item['ts_accepted'])) ?></td>
<td>
<a href="/review/review/uuid/<?= $item['uuid']?>">评审</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<?php if(!empty($this->md)) { ?>
暂无数据,点击标题右侧添加按钮为此数据添加项目
<?php }else{ ?>
暂无数据
<?php } ?>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div>

View File

@ -0,0 +1,55 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->review);
$this->headTitle('在审元数据');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/review">'.$this->config->title->review.'</a>');
$this->breadcrumb('在审元数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row">
<div class="span3">
<?= $this->partial('review/navi.phtml'); ?>
</div>
<div class="span9">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>名称</th>
<th>接收时间</th>
<th>评审时间</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<tr>
<td><a href="/review/review/uuid/<?= $item['uuid'] ?>"><?= $item['title'] ?></a></td>
<td><?= date("Y-m-d",strtotime($item['ts_accepted'])) ?></td>
<td><?= date("Y-m-d",strtotime($item['ts_created'])) ?></td>
<td>
<a href="/review/review/uuid/<?= $item['uuid']?>">查看</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<?php if(!empty($this->md)) { ?>
暂无数据,点击标题右侧添加按钮为此数据添加项目
<?php }else{ ?>
暂无数据
<?php } ?>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div>

View File

@ -3,7 +3,9 @@
<li id="Nav-review-myreview"><a href="/review/myreview"><i class="icon-chevron-right"></i>我参审的元数据</a></li>
<li id="Nav-review-draft"><a href="/review/draft"><i class="icon-chevron-right"></i>投稿元数据</a></li>
<li id="Nav-review-accept"><a href="/review/accept"><i class="icon-chevron-right"></i>已接收元数据</a></li>
<li id="Nav-review-inreview"><a href="/review/inreview"><i class="icon-chevron-right"></i>评审中元数据</a></li>
<li id="Nav-review-inreview-require"><a href="/review/inreview/ac/require"><i class="icon-chevron-right"></i>等待我评审的元数据</a></li>
<li id="Nav-review-inreview-reviewed"><a href="/review/inreview/ac/reviewed"><i class="icon-chevron-right"></i>我评审过的元数据</a></li>
<li id="Nav-review-inreview"><a href="/review/inreview"><i class="icon-chevron-right"></i>所有评审中元数据</a></li>
<li id="Nav-review-reviewed"><a href="/review/reviewed"><i class="icon-chevron-right"></i>已通过元数据</a></li>
<li id="Nav-review-help"><a href="/review/help"><i class="icon-chevron-right"></i>元数据评审说明</a></li>
</ul>

View File

@ -11,6 +11,9 @@
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/water",'title'=>'黑河综合遥感联合试验');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?>
<style>
h3.gs_rt{font-size:110%;}
@ -43,28 +46,59 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi;
echo ' ['.substr($md->author_en,1,-1).'. '.$md->title_en.'. '.$md->publisher_en.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; if ($this->ref) : ?>
<?php endif; endif; ?>
<?php endif; if ($this->ref) : ?>
<hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<h4><i class="icon-eye-open text-success"></i>相关文献(作者推荐)</h4>
<ol>
<?php foreach($this->ref as $ref) :
echo '<li>'.$ref->reference;
echo '<a href="/knowledge/paper/id/'.$ref->id.'"><i class="icon-info-sign text-success"></i>查看</a>';
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
{
if(!empty($ref->attid))
echo '<a href="/service/attach/id/'.$ref->attid.'"><i class="icon-download text-success"></i>下载</a>';
}else{
echo '<a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a>';
}
echo "</li>";
endforeach;
?>
</ol>
<?php endif; if ($this->themeref) :?>
<hr />
<h4><i class="icon-eye-open text-success"></i>专题文献</h4>
<ol>
<?php foreach($this->themeref as $ref) :
echo '<li>'.$ref->reference;
echo '<a href="/knowledge/paper/id/'.$ref->id.'"><i class="icon-info-sign text-success"></i>查看</a>';
if (empty($ref->link))
{
if(!empty($ref->attid))
echo ' | <a href="/service/attach/id/'.$ref->attid.'"><i class="icon-download text-success"></i>下载</a>';
}else{
echo ' | <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a>';
}
echo "</li>";
endforeach;
?>
</ol>
<?php endif; ?>
<?php if ($this->userref) : ?>
<hr />
<h4>数据用户发表文献</h4>
<h4><i class="icon-eye-open text-success"></i>数据施引文献</h4>
<ol>
<?php foreach($this->userref as $ref) :
echo '<li>'.$ref->reference;
echo '<a href="/knowledge/paper/id/'.$ref->id.'"><i class="icon-info-sign text-success"></i>查看</a>';
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
{
if(!empty($ref->attid))
echo '<a href="/service/attach/id/'.$ref->attid.'"><i class="icon-download text-success"></i>下载</a>';
}else{
echo '<a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a>';
}
echo "</li>";
endforeach;
?>
</ol>
@ -79,8 +113,8 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
?>
<?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Environmental and Ecological Science Data Center for West China,National Natural Science Foundation of China (http://westdc.westgis.ac.cn)</p>
<p>中文发表的成果参考以下规范注明: 数据来源于黑河计划数据管理中心、寒区旱区科学数据中心(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)</p>
</p>
<?php endif; ?>
<?php if($this->data_archives){ ?>
@ -336,7 +370,13 @@ endforeach;
在线下载
</a>
<?php else: ?>
<?php
if(!empty($this->dataService)) { ?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?>
<a href="javascript:void(0);" class="btn btn-primary btn-large btn-block" title="此数据需要选择要下载的子集" onclick="westdc.dataservice.choiceData('<?= $md->uuid ?>',this);">
<?php }else{ ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="免费!离线申请此数据(在线数据和离线数据都可申请)">
<?php } ?>
放入数据篮
</a>
<?php endif;endif; ?>

View File

@ -1,40 +1,79 @@
<?php
//生成西部数据中心离线申请表
use Helpers\View as view;
require_once('fpdf/chinese-unicode.php');
require_once('fpdi/fpdi.php');
class ApplicantPDF extends FPDI
{
public $template;//模板文件的路径
public $heihetemplate;//模板文件的路径
public $data;//包含具体的数据,数组
public $fontsize=10;
public $pdflink;
function __construct()
{
parent::__construct();
$this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro');
}
function drawWestdc()
{
$pagecount = $this->setSourceFile($this->template);
$tplidx = $this->importPage(1);
$this->addPage();
$this->useTemplate($tplidx);
$this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro');
$this->SetFont('ugb','',$this->fontsize);
$this->setXY(71,44);
$this->setXY(74,43);
$this->Write($this->fontsize,$this->data['realname']);
$this->SetXY(34,55);
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['datalist']));
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['westdclist']));
$this->setXY(30,100);
$this->MultiCell(166,4,trim($this->data['project']));
//$this->setXY(34,239);
//$this->Write($this->fontsize,$this->data['realname']);
$this->setXY(32,225);
$this->setXY(32,223);
$this->Write($this->fontsize,$this->data['unit']);
$this->setXY(112,225);
$this->setXY(112,223);
$this->Write($this->fontsize,$this->data['email']);
$this->setXY(174,225);
$this->setXY(174,223);
$this->Write($this->fontsize,$this->data['postcode']);
$this->setXY(32,231);
$this->setXY(32,230);
$this->Write($this->fontsize,$this->data['address']);
$this->setXY(112,231);
$this->setXY(112,230);
$this->Write($this->fontsize,$this->data['phone']);
$t=date("Y-m-d");
$this->setXY(174,231);
$this->setXY(174,230);
$this->Write($this->fontsize,$t);
}
function drawHeihe()
{
$pagecount = $this->setSourceFile($this->heihetemplate);
$tplidx = $this->importPage(1);
$this->addPage();
$this->useTemplate($tplidx);
$this->SetFont('ugb','',$this->fontsize);
$this->setXY(88,43);
$this->Write($this->fontsize,$this->data['realname']);
$this->SetXY(34,55);
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['heihelist']));
$this->setXY(30,100);
$this->MultiCell(166,4,trim($this->data['project']));
//$this->setXY(34,239);
//$this->Write($this->fontsize,$this->data['realname']);
$this->setXY(32,223);
$this->Write($this->fontsize,$this->data['unit']);
$this->setXY(112,223);
$this->Write($this->fontsize,$this->data['email']);
$this->setXY(174,223);
$this->Write($this->fontsize,$this->data['postcode']);
$this->setXY(32,230);
$this->Write($this->fontsize,$this->data['address']);
$this->setXY(112,230);
$this->Write($this->fontsize,$this->data['phone']);
$t=date("Y-m-d");
$this->setXY(174,230);
$this->Write($this->fontsize,$t);
}
function addRef($mds)
@ -49,15 +88,36 @@ class ApplicantPDF extends FPDI
$this->SetFont('ugb','',12);
$this->Write(5,($i+1).'. '.$md['title']);
$this->ln();
if ($md['citation'])
if ($md['reference'])
{
$this->Write(5,'【建议引用方式】'.$md['citation']);
$this->Write(5,'【引用方式】'.$md['reference']);
$this->ln();
if (!empty($md['publish_year']))
{
$this->Write(5,'【数据的引用】'.substr($md['authors'],1,-1).'. '.$md['doititle'].'. '.$md['publisher'].', '
.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).
'. doi:'.$md['datadoi'].' ['.str_replace('"','',substr($md['author_en'],1,-1)).'. '.$md['title_en']
.'. '.$md['publisher_en'].', '.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).'. doi:'.$md['datadoi'].']');
$this->ln();
}
if ($md['suppinfo'])
} elseif ($md['citation'])
{
$this->Write(5,'【引用方式】'.$md['citation']);
$this->ln();
if (!empty($md['publish_year']) && !strpos($md['citation'],$md['datadoi']))
{
$this->Write(5,'【数据的引用】'.substr($md['authors'],1,-1).'. '.$md['doititle'].'. '.$md['publisher'].', '
.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).
'. doi:'.$md['datadoi'].' ['.str_replace('"','',substr($md['author_en'],1,-1)).'. '.$md['title_en']
.'. '.$md['publisher_en'].', '.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).'. doi:'.$md['datadoi'].']');
$this->ln();
}
}
if ($md['suppinfo'] || $md['fund'])
{
$this->SetFont('ugb','I',10);
$this->Write(5,'【项目支持信息】'.$md['suppinfo']);
$p=(!empty($md['fund']))?$md['fund']:$md['suppinfo'];
$this->Write(5,'【项目信息】'.$p);
$this->ln();
}
$this->ln();
@ -70,22 +130,71 @@ class ApplicantPDF extends FPDI
$this->addPage();
$this->useTemplate($tplidx);
$this->SetFont('ugb','B',14);
$this->setXY(46,43);
$this->setXY(46,51);
$this->Write(10,$this->data['realname']);
$this->SetFont('ugb','',12);
$this->setXY(122,194);
$this->Write(10,$this->data['realname']);
$this->setXY(122,201);
$this->Write($this->fontsize,$this->data['address']);
$this->setXY(122,209);
$this->setXY(122,208);
$this->Write($this->fontsize,$this->data['phone']);
$this->setXY(122,216);
$this->setXY(122,215);
$this->Write($this->fontsize,$this->data['email']);
$t=date("Y-m-d");
$this->setXY(32,246);
$this->setXY(32,242);
$this->Write($this->fontsize,$t);
$this->setXY(122,246);
$this->setXY(122,242);
$this->Write($this->fontsize,$t);
}
//如果有dataservice内容则添加
public function addSelection($data)
{
$line = array();
foreach($data as $k=>$v)
{
if(!empty($v['selection']))
{
$selection = json_decode($v['selection'],true);
$thisline = "".$v['title']."\r\n";
foreach($selection as $s)
{
$thisline .= "".$s['name'].": ";
if($s['var'] == -1)
{
$thisline .= "全部";
}else{
foreach($s['var'] as $var)
{
$thisline.= $var["nameview"]."/";
}
}
$thisline .= $s['starttime'] ." - ". $s['endtime'];
$thisline .= "\r\n\r\n";
}
$line[] = $thisline."";
}
}
if(count($line) < 1)
{
return;
}
$this->addPage();
$this->SetFont('ugb','B',20);
$this->ln();
$this->Cell(0,0,'附件:申请的数据子集',0,2,'C');
$this->setY(30);
foreach($line as $k=>$v)
{
$this->SetFont('ugb','',10);
$this->Write(5,($k+1).'. ' .$v ."\r\n");
$this->ln();
}
}
}
?>

View File

@ -24,7 +24,11 @@ class Dataorder
if ($statu==4)
$wheresql[] = " (o.ts_approved is null and o.pdflink is not null and d.status=4) ";
elseif ($statu==-1)
$wheresql[] = " (o.pdflink is not null and o.status=-1)";
$wheresql[] = " (o.pdflink is not null and d.status=-1)";
elseif ($statu == 3)
$wheresql[] = " (o.applicationform is not null and d.status=3 ) ";
elseif ($statu == 5)
$wheresql[] = " (o.status=5) ";
else
$wheresql[] = " (o.ts_approved is null and o.pdflink is not null and d.status in (3,4))";

View File

@ -48,7 +48,7 @@ class RegisterForm extends Zend_Form
$address=new Zend_Form_Element_Text('address');
$address->setLabel('联系地址')->setRequired(false);
$project=new Zend_Form_Element_Textarea('project');
$project->setLabel('隶属西部项目')->setRequired(false)->setAttrib('rows',4);
$project->setLabel('科研项目')->setRequired(false)->setAttrib('rows',4);
$id = new Zend_Form_Element_Hidden('id');

View File

@ -113,6 +113,24 @@ class Theme
),
),
'uploadify' => array(
$this->ScriptKey => array(
'/js/lib/uploadify/jquery.uploadify.min.js'
),
$this->CSSKey => array(
'/js/lib/uploadify/uploadify.css'
),
),
'datepicker' => array(
$this->ScriptKey => array(
'/js/lib/datepicker/jquery-ui-1.10.3.custom.min.js'
),
$this->CSSKey => array(
'/js/lib/datepicker/jquery-ui-1.10.3.custom.min.css'
)
),
/*********谷歌地图*********/
//Google Map API v3

View File

@ -74,6 +74,14 @@ class Literature extends Author
$this->db = $db;
}
function getOne($id,$uuid = ""){
$sql = "select m.uuid,r.reference,r.link,m.reftype,r.id as refid from reference r left join mdref m on r.id=m.refid where m.id=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($id));
$row = $sth->fetch();
return $row;
}
function byuuid($uuid){
include_once("helper/view.php");
$uid = view::User('id');
@ -90,16 +98,33 @@ class Literature extends Author
return $rows;
}
function edit($id,$content){
function edit($mdrefid,$refid,$uuid,$content,$link,$reftype){
include_once("helper/dbh.php");
$dbh = new dbh($this->db);
$data = array(
'reference' => $content
'reference' => $content,
'link'=>$link
);
$s = $dbh->update("reference",$data," id=$id ",false);
return $s;
$s = $dbh->update("reference",$data," id=$refid ",false);
if($s)
{
$data = array(
'reftype'=>$reftype
);
$d = $dbh->update("mdref",$data," id=$mdrefid ",false);
if($d)
{
return true;
}else{
return false;
}
}else{
return false;
}
}
function order($id,$order){

View File

@ -0,0 +1,118 @@
<?php
namespace data;
use Helpers\View as view;
use Helpers\Curl;
class DataService
{
private $db; //传入PDO对象.
//使用到的公共变量
public $tbl_dataservice = "dataservice";
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
function Fetch()
{
$sql = "SELECT * FROM ".$this->tbl_dataservice."";
$rs = $this->db->query($sql);
return $rs->fetchAll();
}
function get($uuid)
{
$sql = "SELECT * FROM ".$this->tbl_dataservice." WHERE uuid='$uuid' LIMIT 1";
$rs = $this->db->query($sql);
return $rs->fetch();
}
public function getWsnData($type,$uuid = "",$param = ""){
$info = $this->get($uuid);
$curl = new Curl();
$uid = view::User('id');
if(!is_numeric($uid) || $uid <1)
{
return "请先登录";
}
if($type == 'site')
{
$param = array(
'uuid'=>$uuid,
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
'uid'=> view::User('id')
);
$data = $curl->request($info['service_url']."site/",$param,"POST");
$data = json_decode($data['response'],TRUE);
}//site
if($type == 'var')
{
$param_temp = array(
'uuid'=>$uuid,
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
'uid'=> view::User('id'),
);
$param = array_merge($param,$param_temp);
$data = $curl->request($info['service_url']."var/",$param,"POST");
$data = json_decode($data['response'],TRUE);
}
if($type == 'submit')
{
$param_temp = array(
'uuid'=>$uuid,
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
'uid'=> view::User('id'),
);
$param = array_merge($param,$param_temp);
$data = $curl->request($info['service_url']."insert/",$param,"POST");
$data = json_decode($data['response'],TRUE);
}
if($data['status'] == 0)
{
return $data['error'];
}
else if($data['status'] == 1)
{
return $data['data'];
}
else
{
return NULL;
}
}//获取Wsn数据
//访问wsn端生成数据的webservice
public function makeWsnData($param)
{
$param_temp = array(
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
);
$param = array_merge($param,$param_temp);
$url = "http://ftp2.westgis.ac.cn/wsndata.php";
$curl = new Curl();
$data = $curl->request($url,$param);
$data = json_decode($data['response'],TRUE);
}
}

View File

@ -12,16 +12,25 @@ class Doi extends Zend_Controller_Plugin_Abstract
$this->db = $db;
}
function fetch($uid=0)
function fetch($uid=0,$keyword='')
{
$wheresql=' 1=1 ';
if(!empty($keyword))
{
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql.=" and d.title like '%$keyword%'";
}
if(empty($uid))
{
$sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY ts_published desc,ts_submitted desc,ts_created DESC";
$sql = "SELECT * FROM ".$this->tbl_doi." d where ".$wheresql."ORDER BY d.ts_published desc,d.ts_submitted desc,d.ts_created DESC";
}else{
$sql = "SELECT doi.* FROM ".$this->tbl_doi." doi
LEFT JOIN mdauthor a ON doi.uuid=a.uuid
WHERE a.userid=".$uid." AND a.status>0
ORDER BY ts_published desc,ts_submitted desc,ts_created DESC
$sql = "SELECT d.* FROM ".$this->tbl_doi." d
LEFT JOIN mdauthor a ON d.uuid=a.uuid
WHERE a.userid=".$uid." AND a.status>0 and ".$wheresql."
ORDER BY d.ts_published desc,d.ts_submitted desc,d.ts_created DESC
";
}
$rs = $this->db->query($sql);

View File

@ -0,0 +1,94 @@
<?php
namespace data;
class Favorite extends Zend_Controller_Plugin_Abstract
{
public $db; //传入PDO对象.
private $auth = NULL; //Zend_Auth 对象
//使用到的公共变量
public $tbl_metadata = "metadata"; //元数据
public $tbl_favorite = "favorite"; //用户收藏表
public $fav_max;
function __construct($db)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$this->fav_max = empty($this->config->favorite->limit) ? 50 : $this->config->favorite->limit ;
}
function like($uuid,$uid = 0)
{
if(empty($uid))
{
$uid = \view::User('id');
}
if(!is_numeric($uid))
{
$uid = \view::User('id');
}
if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{
return "参数错误";
}
if($this->checkUserFavNum($uid))
{
if($this->checkAlreadyLike($uuid,$uid))
{
$sql = "INSERT INTO {$this->tbl_favorite} (uid,uuid) VALUES ($uid,'$uuid')";
if($this->db->exec($sql))
{
return true;
}else{
return "收藏失败,请重试";
}
}else{
return "您已经收藏过此数据";
}
}else{
return "您的收藏量已达到系统允许的上限";
}
}
//检查是否达到允许的收藏上限
public function checkUserFavNum($uid)
{
$sql = "SELECT count(id) as c FROM {$this->tbl_favorite} WHERE uid=$uid";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if($row['c'] >= $this->fav_max)
{
return false;
}else{
return true;
}
}
//检查是否已经搜藏过
public function checkAlreadyLike($uuid,$uid)
{
$sql = "SELECT * FROM {$this->tbl_favorite} WHERE uid=$uid AND uuid='$uuid'";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(isset($row['uuid']) && !empty($row['uuid']))
{
return false;
}else{
return true;
}
}
}

View File

@ -4,16 +4,30 @@ class Review extends Zend_Controller_Plugin_Abstract
private $db; //传入PDO对象.
protected $events = NULL; //事件
//使用到的公共变量
//相关数据表
public $tbl_reviewexp = "mdexpertreview";
public $tbl_mdreview = "mdreview";
public $tbl_user = "users";
function __construct($db)
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = Zend_Registry::get('db');
}else{
$this->db = $db;
}
}
/*
* events() 事件枚举
*
* @param $events Zend_EventManager_EventCollection default null
*
* return Zend_EventManager_EventManager
*
* 使用Zend_EventManager_EventManager枚举评审操作中的事件
*/
public function events(Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
@ -24,7 +38,18 @@ class Review extends Zend_Controller_Plugin_Abstract
return $this->events;
}
//接受或者拒绝评审
/*
* invite() 接受或者拒绝评审
*
* @param $id int
* @param $uuid uuid
* @param $uid int
* @param $status string
*
* return bool/string
*
* 处理评审邀请,接受或者拒绝
*/
function invite($id,$uuid,$uid,$status)
{
if(empty($id) || empty($uuid) || !is_numeric($id) ||!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
@ -50,7 +75,15 @@ class Review extends Zend_Controller_Plugin_Abstract
}
}
//根据UUID获得评审意见
/*
* getReviews() 根据UUID获得评审意见
*
* @param $uuid uuid
*
* return array
*
* 传入评审数据的UUID返回评审意见记录
*/
function getReviews($uuid)
{
$sql = "SELECT mr.*,u.username,u.realname FROM ".$this->tbl_mdreview." mr
@ -63,13 +96,81 @@ class Review extends Zend_Controller_Plugin_Abstract
return $reviews;
}
//后台我负责的评审
function adminReviews($filter = "",$order="")
/*
* needEditor() 需要分配责任编辑的元数据评审
*
* @param $filter array
*
* return array
*
* filter参数帮助生成sql语句中的where、order、sort条件
*/
function needEditor($filter = "")
{
$wheresql = array();
$ordersql = array();
$wheresql[] = " m.status in (1,2,3,4) ";
$wheresql[] = " (m.userid IS NULL OR u.usertype != 'administrator') ";
if(isset($filter['keyword']) && !empty($filter['keyword']))
{
$wheresql[] = " (md.title like '%".$filter['keyword']."%' OR u.username LIKE '%".$filter['keyword']."%' OR u.realname LIKE '%".$filter['keyword']."%') ";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
if(isset($filter['order']) && !empty($filter['order']))
{
$sort = "DESC";
if(isset($filter['sort']) && !empty($filter['sort']) && in_array( strtolower($filter['sort']),array('desc','asc')))
{
$sort = $filter['sort'];
}
$ordersql[] = " {$filter['order']} $sort ";
}
if(count($ordersql)>0)
{
$ordersql = " ORDER BY ".join(',',$ordersql);
}else{
$ordersql = " ORDER BY m.ts_created desc ";
}
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m
right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid
$wheresql
$ordersql";
$re = $this->db->query($sql);
$rows = $re->fetchAll();
return $rows;
}
/*
* adminReviews() 我负责的评审
*
* @param $filter array
*
* return array
*
* filter参数帮助生成sql语句中的where、order、sort条件
* 此函数返回当前登录的用户(管理员)负责的元数据评审
*/
function adminReviews($filter = "")
{
include_once('helper/view.php');
$uid = view::User('id');
$uid = \view::User('id');
$wheresql = array();
$ordersql = array();
$wheresql[] = " m.status in (1,2,3,4) ";
$wheresql[] = " u.id=$uid ";
@ -82,6 +183,15 @@ class Review extends Zend_Controller_Plugin_Abstract
{
$wheresql[] = " s.sourceid=".$filter['code']." ";
}
if(isset($filter['order']) && !empty($filter['order']))
{
$sort = "DESC";
if(isset($filter['sort']) && !empty($filter['sort']) && in_array( strtolower($filter['sort']),array('desc','asc')))
{
$sort = $filter['sort'];
}
$ordersql[] = " {$filter['order']} $sort ";
}
if(count($wheresql)>0)
{
@ -90,22 +200,39 @@ class Review extends Zend_Controller_Plugin_Abstract
$wheresql = "";
}
$sql = "select m.id,g.id as gid, md.uuid,md.title,u.username,u.realname,m.status,md.id as mdid,md.author,m.ts_accepted
if(count($ordersql)>0)
{
$ordersql = " ORDER BY ".join(',',$ordersql);
}else{
$ordersql = " ORDER BY m.status desc,m.ts_accepted desc ";
}
$sql = "select m.id,g.id as gid, md.uuid,md.title,u.username,u.realname,m.status,md.id as mdid,md.author,m.ts_accepted,count(r.id) as reviews
FROM mdstatus m
right join metadata md on md.uuid=m.uuid
left join geonetworkmetadata g on m.uuid=g.uuid
left join users u on u.id=m.userid
left join datasource s on s.uuid=md.uuid
left join mdreview r ON r.uuid=md.uuid
$wheresql
order by m.status desc,m.ts_accepted desc";
GROUP BY m.id,g.id, md.uuid,md.title,u.username,u.realname,m.status,md.id,md.author,m.ts_accepted
$ordersql";
$re = $this->db->query($sql);
$rows = $re->fetchAll();
return $rows;
}
//发布
/*
* post() 通过评审
*
* @param $id int
* $param $emails array()
*
* return bool
*
* 元数据通过评审且发布
*/
function post($id,$emails)
{
if(is_numeric($id))
@ -131,7 +258,16 @@ class Review extends Zend_Controller_Plugin_Abstract
}//发布
//检查管理员
/*
* post() 检查管理员
*
* @param $id int
* $param $emails array()
*
* return bool
*
* 元数据通过评审且发布
*/
function checkAdmin($id,$userid = 0)
{
$id = (int)$id;

View File

@ -32,7 +32,8 @@ class files{
'md'=>$general,
'literature'=>$general,
'document'=>$general,
'heihe'=>$general
'heihe'=>$general,
'reference' => $general
);
//最大文件大小
$max_size = 10485760;

View File

@ -0,0 +1,144 @@
<?php
namespace helper;
class Curl
{
private $options;
public function __construct($options = array())
{
$this->options = array_merge(array(
'debug' => false,
'http_port' => '80',
'user_agent' => 'Westdc DataService',
'timeout' => 20,
'curlopts' => null,
'verifyssl' => true,
), $options);
}
/**
* Send a request to the server, receive a response
*
* @param string $apiPath Request API path
* @param array $parameters Parameters
* @param string $httpMethod HTTP method to use
*
* @return string HTTP response
*/
public function request($url, array $parameters = array(), $httpMethod = 'GET', array $options = array())
{
$options = array_merge($this->options, $options);
$curlOptions = array();
$headers = array();
if ('POST' === $httpMethod) {
$curlOptions += array(
CURLOPT_POST => true,
);
}
elseif ('PUT' === $httpMethod) {
$curlOptions += array(
CURLOPT_POST => true, // This is so cURL doesn't strip CURLOPT_POSTFIELDS
CURLOPT_CUSTOMREQUEST => 'PUT',
);
}
elseif ('DELETE' === $httpMethod) {
$curlOptions += array(
CURLOPT_CUSTOMREQUEST => 'DELETE',
);
}
if (!empty($parameters))
{
if('GET' === $httpMethod)
{
$queryString = utf8_encode($this->buildQuery($parameters));
$url .= '?' . $queryString;
} elseif ('POST' === $httpMethod) {
$curlOptions += array(
CURLOPT_POSTFIELDS => is_array($parameters) ? http_build_query($parameters) : $parameters,
);
} else {
$curlOptions += array(
CURLOPT_POSTFIELDS => json_encode($parameters)
);
$headers[] = 'Content-Type: application/json';
}
} else {
$headers[] = 'Content-Length: 0';
}
$this->debug('send '.$httpMethod.' request: '.$url);
$curlOptions += array(
CURLOPT_URL => $url,
CURLOPT_PORT => $options['http_port'],
CURLOPT_USERAGENT => $options['user_agent'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => $options['timeout'],
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => $options['verifyssl'],
);
if (ini_get('open_basedir') == '' && ini_get('safe_mode') != 'On') {
$curlOptions[CURLOPT_FOLLOWLOCATION] = true;
}
if (is_array($options['curlopts'])) {
$curlOptions += $options['curlopts'];
}
if (isset($options['proxy'])) {
$curlOptions[CURLOPT_PROXY] = $options['proxy'];
}
$response = $this->doCurlCall($curlOptions);
return $response;
}
/**
* Get a JSON response and transform it to a PHP array
*
* @return array the response
*/
protected function decodeResponse($response)
{
// "false" means a failed curl request
if (false === $response['response']) {
$this->debug(print_r($response, true));
return false;
}
return parent::decodeResponse($response);
}
protected function doCurlCall(array $curlOptions)
{
$curl = curl_init();
curl_setopt_array($curl, $curlOptions);
$response = curl_exec($curl);
$headers = curl_getinfo($curl);
$errorNumber = curl_errno($curl);
$errorMessage = curl_error($curl);
curl_close($curl);
return compact('response', 'headers', 'errorNumber', 'errorMessage');
}
protected function buildQuery($parameters)
{
return http_build_query($parameters, '', '&');
}
protected function debug($message)
{
if($this->options['debug'])
{
print $message."\n";
}
}
}

View File

@ -80,6 +80,10 @@ class dbh
{
$v = preg_replace("/\'/","''",$v);
}
if(preg_match("/\"/",$v))
{
$v = preg_replace("/\"/","''",$v);
}
$ups[] = '"'.$k.'"=\''.$v."'";
}
}

View File

@ -0,0 +1,164 @@
<?php
namespace helper;
class email
{
private $db;
private $config;
public $mail; //Zend_Mail Object
private $charset = "utf-8";
private $name = "寒区旱区科学数据中心";
private $tbl_mailTemplate = "emailtext";
protected $events = NULL;
public $subject;
public $body;
public $type;
function __construct($db = NULL,Zend_Mail_Transport_Smtp $transport = NULL)
{
if(empty($db))
{
$this->db = Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = Zend_Registry::get('config');
$smtp = $this->config->smtp;
$mail_config = array(
'ssl' => $smtp->ssl,
'auth'=> $smtp->auth,
'username'=> $smtp->username,
'password'=> $smtp->password
);
$transport = new Zend_Mail_Transport_Smtp($smtp->host, $mail_config);
Zend_Mail::setDefaultTransport($transport);
if(empty($mail))
{
$this->mail = new Zend_Mail();
}else{
$this->mail = $mail;
}
}
public function events(Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//默认使用westdc作为发件人
public function withWestdc()
{
$this->mail->setFrom($this->config->supportemail,$this->name);
}
//加载模板
public function loadTemplate($id,$data){
if(is_numeric($this->tmpid))
{
$sql = "SELECT * FROM {$this->tbl_mailTemplate} WHERE id='".$id."'";
}else{
$sql = "SELECT * FROM {$this->tbl_mailTemplate} WHERE \"template\"='".$id."'";
}
$rs = $this->db->query($sql);
$row = $rs->fetch();
$subject = $row['subject'];
$body = $row['body'];
if(count($data) > 0)
{
$patterns = array();
$replacements = array();
foreach($this->data as $k=>$v)
{
$patterns[]='/{'.$k.'}/i';
$replacements[]=$v;
}
ksort($patterns);
ksort($replacements);
$body = preg_replace($patterns, $replacements, $body);
$subject = preg_replace($patterns, $replacements, $subject);
}//count($this->data)
$this->subject = $subject;
$this->body = $body;
$this->type = $row['type'];
}//加载模板
//使用loadTemplate 的结果发送邮件
//在此之前需要使用 $this->mail->addTo()添加收件人
public function send($from = NULL){
if(empty($this->subject) || empty($this->body))
{
return "邮件信息不完整";
}
if($this->type == 'html')
{
$this->mail->setBodyHtml($this->body);
}else{
$this->mail->setBodyText($this->body);
}
if(empty($from))
{
$this->withWestdc();
}else{
$this->mail->setFrom($from['email'],$from['name']);
}
$this->mail->setSubject($this->subject);
$this->mail->send();
}
}
class EmailListener implements Zend_EventManager_ListenerAggregate
{
private $db;
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = Zend_Registry::get('config');
}
public function attach(Zend_EventManager_EventCollection $events)
{
$events->attach('send', array($this, 'send'), 100);
}
public function detach(Zend_EventManager_EventCollection $events)
{
}
public function send()
{
//邮件发送事件
}
}

View File

@ -1,5 +1,5 @@
<?php
class view extends Zend_Controller_Plugin_Abstract
class view extends \Zend_Controller_Plugin_Abstract
{
private $db; //传入PDO对象.
private $product = 0; //产品环境
@ -9,7 +9,7 @@ class view extends Zend_Controller_Plugin_Abstract
$this->db = $db;
}
static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request = NULL,$limit = 10)
static function addPaginator($data,$ctl,\Zend_Controller_Request_Abstract $request = NULL,$limit = 10)
{
if(empty($request))
{
@ -21,11 +21,11 @@ class view extends Zend_Controller_Plugin_Abstract
$view = $ctl;
}
$paginator = Zend_Paginator::factory($data);
$paginator = \Zend_Paginator::factory($data);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($limit);
$paginator->setView($view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
\Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$view->paginator = $paginator;
}
@ -70,7 +70,7 @@ class view extends Zend_Controller_Plugin_Abstract
}
static function User($param){
$auth = Zend_Auth::getInstance();
$auth = \Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
@ -90,7 +90,7 @@ class view extends Zend_Controller_Plugin_Abstract
}
}
static function Post(Zend_Controller_Action $ctl,$msg,$url=""){
static function Post(\Zend_Controller_Action $ctl,$msg,$url=""){
if(empty($msg))
{
@ -101,10 +101,20 @@ class view extends Zend_Controller_Plugin_Abstract
$msg = array('content'=>$msg,'url'=>$url);
}
$helper = new Zend_Controller_Action_HelperBroker($ctl);
$helper = new \Zend_Controller_Action_HelperBroker($ctl);
$helper->layout->setLayout('layout');
$helper->viewRenderer->setNoRender();
echo $ctl->view->partial('post-message.phtml', $msg);
return true;
}
static function getHostLink()
{
$protocol = "http";
if(strpos(strtolower($_SERVER['SERVER_PROTOCOL']),"https"))
{
$protocol = "https";
}
return $protocol."://".$_SERVER['SERVER_NAME'];
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Files\Event;
interface FileEvent
{
public function checkExt(\Zend_EventManager_Event $e);
public function checkSize(\Zend_EventManager_Event $e);
public function makeThumb(\Zend_EventManager_Event $e);
}

View File

@ -0,0 +1,394 @@
<?php
namespace Files;
use Files\Thumbnail;
use Files\Listener\FileListener;
class Files{
public $tbl_att = "attachments";
public $db;
public $source = "";
protected $events = NULL; //事件
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$this->event = new \Zend_EventManager_EventManager();
$FileListener = new FileListener();
@$this->events()->attachAggregate($FileListener);
}
public function events(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//上传申请表
public function uploadApplicationForm($file,$orderid)
{
try{
if (empty($file) !== false) {
return array("error"=>"请选择要上传的文件");
}
if (@is_uploaded_file($file['tmp_name']) === false) {
return array("error"=>"文件上传失败,请重新上传");
}
if($file['size'] > 20 * 1024 * 1024)
{
return array('error'=>"文件大小超出限制");
}
$ext = $this->getFileTextExt($file['name']);
$filename = $orderid.".".$ext;
$dir = "../data/application_form/";
if (!file_exists($dir)) {
mkdir($dir);
}
$dir.=date("Y")."/";
if (!file_exists($dir)) {
mkdir($dir);
}
$new_filepath = $dir.$filename;
if (move_uploaded_file($file['tmp_name'], $new_filepath) === false) {
return array("error"=>"上传失败,请重试");
}
return array("file"=>$new_filepath);
}catch(Exception $e)
{
return array("error"=>$e->getMessage());
}
}
/**
* upload
*
* 文件上传
*
* @param Array $files e.g. $_FILES['Filedata']
*
* return Array $msg e.g. if($msg['error'])
*/
public function upload($files,$dir = "",$append = false,$filename="",$makeThumb = false)
{
if (empty($files) !== false) {
return array("error"=>"请选择要上传的文件");
}
if (@is_uploaded_file($files['tmp_name']) === false) {
return array("error"=>"文件上传失败,请重新上传");
}
$file = $files;
$results = $this->events()->trigger('upload.checkExt', $this, compact('file'));
$cache_data = $results->bottom();
if($cache_data !== true)
{
return $cache_data;
}
$results = $this->events()->trigger('upload.checkSize', $this, compact('file','conf'));
$cache_data = $results->bottom();
if($cache_data !== true)
{
return $cache_data;
}
$msg = array();
$file_name = $files['name']; //原文件名
$file_size = $files['size']; //文件大小
$results = $this->makeUploadTarget($dir,$append);
if(isset($results['error']))
{
return $results;
}//文件夹问题
$new_file_basename = $this->gen_uuid();
$file_ext = $this->getFileTextExt($file_name);
$new_file_name = $new_file_basename . '.' . $file_ext;//新文件名
//移动文件
$file_path = $results['save_path'] . $new_file_name ;
if (move_uploaded_file($file['tmp_name'], $file_path) === false) {
return array("error"=>"上传失败,请重试");
}
$dbsave = $db_path = $results['dbsave'];
$dbsave .= $new_file_name;//数据库最终存储的文件
$file_url = $dbsave;//文件链接
$msg['file_url'] = $file_url;
$msg['file_size'] = $file_size;
$msg['db_path'] = $this->config->upload . $dbsave;
$msg['realname'] = $file_name;
$msg['file_ext'] = $file_ext;
$msg['file_mime'] = $this->getFileMime($file_path);
return $msg;
}//文件上传
//生成上传文件的地址
public function makeUploadTarget($dir = "",$append = false)
{
//文件保存目录路径
if(empty($dir))
{
$save_path = $this->config->upload;
}else{
if($append === true)
{
$save_path = $this->config->upload.$dir;
}else{
$save_path = $dir;
}
}
if (@is_dir($save_path) === false) {
return array("error"=>"上传目录不存在。请联系管理员");
}
if (@is_writable($save_path) === false) {
return array("error"=>"上传目录没有写权限。请联系管理员");
}
$dbsave = ""; //数据库中存放的路径
if($append === true)
{
$dbsave = $dir;
}
$y = date("Y");
$m = date("m");
$d = date("d");
$save_path .= $y . "/";
$dbsave .= $y.'/';
if (!file_exists($save_path)) {
mkdir($save_path);
}
$save_path .= $m . "/";
$dbsave .= $m.'/';
if (!file_exists($save_path)) {
mkdir($save_path);
}
$save_path .= $d . "/";
$dbsave .= $d.'/';
if (!file_exists($save_path)) {
mkdir($save_path);
}
return array("save_path"=>$save_path,"dbsave"=>$dbsave);
}//创建上传文件的地址
//获取文件扩展名
public function getFileTextExt($file_name)
{
$temp_arr = explode(".", $file_name);
$file_ext = array_pop($temp_arr);
$file_ext = trim($file_ext);
$file_ext = strtolower($file_ext);
return $file_ext;
}
//获取文件Mime通过finfo扩展
public function getFileMime($file_name)
{
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$filetype = finfo_file($finfo, $file_name) ; //文件mime类型
finfo_close($finfo);
return $filetype;
}
//文件名uuid
public function gen_uuid() {
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
// 16 bits for "time_mid"
mt_rand( 0, 0xffff ),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
mt_rand( 0, 0x0fff ) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
mt_rand( 0, 0x3fff ) | 0x8000,
// 48 bits for "node"
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
);
}
/**
* getOne()
*
* 从数据库获取单个文件的信息
*
* @param int id
*
* return array
*/
public function getOne($id){
$db = $this->db;
//下载单个附件
$sql = $db->query("select a.* from ".$this->tbl_att." a where a.id=$id order by a.ts_created desc");
$att = $sql->fetch();
if(empty($att['id']))
{
return false;
}
return $att;
}
public function delete($id){
$att = $this->getOne($id);
if(file_exists($this->config->upload.$att['filename'])){
if(unlink($this->config->upload.$att['filename']))
{
$sql = "DELETE FROM ".$this->tbl_att." WHERE id=$id";
if($this->db->exec($sql))
{
return true;
}else{
return "文件删除成功,数据库记录删除失败";
}
}else{
return "删除失败";
}
}else{
$sql = "DELETE FROM ".$this->tbl_att." WHERE id=$id";
if($this->db->exec($sql))
{
return "文件不存在,数据库记录删除成功";
}else{
return "文件不存在,数据库记录删除失败";
}
}
}
public function getAll($fields = ""){
$wheresql = array();
if($fields!="")
{
$wheresql[] = " a.id IN ($fields) ";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(",",$wheresql);
}else{
$wheresql = "";
}
$sql = "SELECT a.*,u.username,u.id as uid FROM ".$this->tbl_att." a
LEFT JOIN tbl_member u ON a.userid=u.id
$wheresql
ORDER BY a.id DESC";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
return $rows;
}
/**
* downloadFile
*
* 文件下载
*
* @param String $fullPath e.g. Zend_Registry::get('upload').$fileurl
*
* return file
*/
static function downloadFile( $fullPath ){
//判断是否已经输出头部
if( headers_sent() )
{
return false;
}
else{
// Required for some browsers
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
// File Exists?
if( file_exists($fullPath) ){
// Parse Info / Get Extension
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
// Determine Content Type
switch ($ext) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
header('Content-Description: File Transfer');
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($fullPath)."\";" );
header("Content-Transfer-Encoding: binary\n");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
header("Content-Length: ".$fsize);
ob_clean();
flush();
if(readfile($fullPath))
return true;
else
return false;
} else
{return false;}
}
} //文件下载
}

View File

@ -0,0 +1,28 @@
<?php
namespace Files\Listener;
use Files\Operation\FileOperate;
class FileListener implements \Zend_EventManager_ListenerAggregate
{
private $event;
function __construct()
{
$this->event = new \Zend_EventManager_EventManager();
}
public function attach(\Zend_EventManager_EventCollection $events)
{
$_Events = new FileOperate();
$events->attach('upload.checkExt', array($_Events, 'checkExt'), 100);
$events->attach('upload.checkSize', array($_Events, 'checkSize'), 80);
$events->attach('upload.makeThumb', array($_Events, 'makeThumb'), 70);
}
public function detach(\Zend_EventManager_EventCollection $events)
{
}
}

View File

@ -0,0 +1,126 @@
<?php
namespace Files\Operation;
use Files\Thumbnail;
class FileOperate implements \Files\Event\FileEvent
{
private $db; //传入PDO对象
private $DefaultFetchMode = \PDO::FETCH_BOTH; //默认检索模式防止出现sdtClass错误
private $config; //全局配置
public $def_allow_ext = array(
'gif', 'jpg', 'jpeg', 'png', 'bmp',
'flv','swf', 'mp3', 'wav', 'wma', 'wmv', 'mid', 'avi', 'mpg', 'asf', 'rm', 'rmvb',
'pdf','doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2'
);
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
public function checkExt(\Zend_EventManager_Event $e){
$file = $e->getParam('file');
$ext_arr = $this->def_allow_ext;
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$filetype = finfo_file($finfo, $file['tmp_name']) ; //文件mime类型
finfo_close($finfo);
foreach($ext_arr as $v)
{
if(strpos($filetype,$v) !== false)
{
return true;
}
}
return array("error"=>"您上传的文件不在允许的范围内".$filetype." was not in ".join(",",$ext_arr));
}//checkParam
public function checkSize(\Zend_EventManager_Event $e){
$file = $e->getParam('file');
$file_size = $file['size'];
if(!isset($conf->maxsize) && !empty($conf->maxsize))
{
$max_size = (int)$conf->maxsize;
}else{
$max_size = 30*1024*1024;
}
if($file_size > $max_size)
{
return array("error"=>'上传的文件超过了允许的文件大小');
}
return true;
}//checkSize
public function makeThumb(\Zend_EventManager_Event $e)
{
$file_path = $e->getParam('file_path');
$conf = $e->getParam('conf');
$save_path = $conf->upload;
$dbsave = $e->getParam('db_path');
$file_ext = $e->getParam('file_ext');
$new_file_basename = $e->getParam('new_file_basename');
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$filetype = finfo_file($finfo, $file_path) ; //文件mime类型
finfo_close($finfo);
$thumb_conf = new \Zend_Config_Ini("../application/conf/thumb.ini", "thumb");
if($thumb_conf->makethumb != "on")
{
return array();
}
$allowmime = $thumb_conf->imagemime;
if(empty($allowmime))
{
$allowmime = array('image/jpeg','image/png','image/gif');
}else{
$allowmime = explode(",",$allowmime);
}
if(!in_array($filetype,$allowmime))
{
return array();
}
$thumb_size = explode(",",$thumb_conf->thumbsize);
$thumbnail = array();
foreach($thumb_size as $v)
{
$v = (int)$v;
$thumb = new Thumbnail($v, $v);
$image = file_get_contents($file_path);
$thumb->loadData($image, $filetype);
$thumbfile = $save_path.$dbsave.$new_file_basename.'_'.$v. '.' .$file_ext;
$thumbnail[$v] = array(
'size' => $v,
'ext' => $file_ext,
'file' => $thumbfile,
'url' => $dbsave.$new_file_basename.'_'.$v. '.' .$file_ext ,
);
$thumb->buildThumb($thumbfile);
}
return $thumbnail;
}//makeThumb
}

View File

@ -0,0 +1,207 @@
<?php
namespace Files;
class Output
{
private $db;//传入PDO对象
function __construct($db)
{
$this->db = $db;
}
//输出下载
public function Download($filename,$content,$filetype="JSON",$zfmvc=""){
if(empty($filename) || empty($content) || empty($filetype))
{
return false;
}
$filetype = strtolower($filetype);
//支持的输出类型
$functions = array(
"json"=>"JsonOutPut",
"xml"=>"XMLOutPut",
"csv"=>"CSVOutPut",
"string"=>"StringOutPut",
);
$file_type_functions = array();
foreach($functions as $k=>$v)
{
$file_type_functions[] = $k;
}
if(!in_array($filetype,$file_type_functions))
{
return false;
}
$output_body = $this->$functions[$filetype]($content);
$this->pushDownload($output_body,$filename,$filetype,$zfmvc);
}//Download
//输出JSON内容
public function JsonOutPut($content,$numeric = true){
if($numeric == true)
{
return json_encode($content,JSON_NUMERIC_CHECK);
}else{
return json_encode($content);
}
}//JsonOutPut()
//输出XML内容
public function XMLOutPut($content){
}//JsonOutPut()
public function StringOutPut($content){
if(strpos($_SERVER["HTTP_USER_AGENT"],"Windows"))
{
$head = "\xEF\xBB\xBF";
}else{
$head = "";
}
return $head.$content;
}
//输出CSV内容
public function CSVOutPut($data,$head = ""){
$split = ",";
$content = "";
//如果是windows输出一个BOM头
if(strpos($_SERVER["HTTP_USER_AGENT"],"Windows"))
{
$content = "\xEF\xBB\xBF";
}else{
$content = "";
}
if(!empty($head))
{
$content .= join($split,$head)."\r\n";
}
foreach($data as $k=>$v)
{
foreach($v as $kk=>$vv)
{
if(strpos($vv,"\""))
{
$vv = preg_replace("/\"/",'""',$vv);
}
$v[$kk] = "\"".$vv."\"";
}
$content .= join($split,$v)."\r\n";
}
return $content;
}//JsonOutPut()
//输出下载
public function pushDownload($content,$filename,$type="",$zfmvc="")
{
if(headers_sent())
{
return false;
}
if(empty($filename) || empty($content))
{
return false;
}
$content_type = $this->ContentTypes($type);
$fsize = strlen($content);
//没有在zf controller 中使用
if(empty($zfmvc))
{
header('Content-Description: File Transfer');
header("Cache-Control: private",false);
header("Content-Type: ".$content_type);
header("Content-Disposition: attachment; filename=\"".$filename."\";" );
header("Content-Transfer-Encoding: binary\n");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
header("Content-Length: ".$fsize);
ob_clean();
flush();
echo $content;
exit();
}else{
$zfmvc->getResponse()->setHeader('Content-Type', $content_type)
->setHeader('Content-Disposition','attachment; filename="'.$filename.'"')
->setHeader('Content-Length', strlen($content))
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($content);
exit();
}
}//pushDownload
//Content-Type
public function ContentTypes($ext){
$ext = strtolower($ext);
$def = "application/force-download";
if(empty($ext))
{
return $def;
}
$content_types = array(
"csv" => "text/csv",
"pdf"=>"application/pdf",
"exe"=>"application/octet-stream",
"gzip"=>"application/zip",
"doc"=>"application/msword",
"xls"=>"application/vnd.ms-excel",
"ppt"=>"application/vnd.ms-powerpoint",
"gif"=>"image/gif",
"png"=>"image/png",
"jpeg"=>"image/jpg",
"jpg"=>"image/jpg",
"xml"=>"text/xml",
"xsl"=>"text/xml"
);
if(!isset($content_types[$ext]))
{
return $def;
}else{
return $content_types[$ext];
}
}//ContentTypes
}

View File

@ -0,0 +1,176 @@
<?php
namespace Files;
/**
* 生成缩略图(支持加载图片文件和字符串2种方式)
* @param $maxWidth 缩略图最大宽度
* @param $maxHeight 缩略图最大高度
* @param bool $scale 是否按比例缩小,否则拉伸
* @param bool $inflate 是否放大以来填充缩略图
*/
class Thumbnail {
private $maxWidth;
private $maxHeight;
private $scale;
private $inflate;
private $types;
private $imgLoaders;
private $imgCreators;
private $source;
private $sourceWidth;
private $sourceHeight;
private $sourceMime;
private $thumb;
private $thumbWidth;
private $thumbHeight;
public function __construct($maxWidth, $maxHeight, $scale = true, $inflate = false) {
$this->maxWidth = $maxWidth;
$this->maxHeight = $maxHeight;
$this->scale = $scale;
$this->inflate = $inflate;
$this->types = array(
'image/jpeg',
'image/png',
'image/gif'
);
//加载MIME类型图像的函数名称
$this->imgLoaders = array(
'image/jpeg' => 'imagecreatefromjpeg',
'image/png' => 'imagecreatefrompng',
'image/gif' => 'imagecreatefromgif'
);
//储存创建MIME类型图片的函数名称
$this->imgCreators = array(
'image/jpeg' => 'imagejpeg',
'image/png' => 'imagepng',
'image/gif' => 'imagegif'
);
}
/**
* 文件方式加载图片
* @param string $image 源图片
* @return bool
*/
public function loadFile($image){
if(!$dims = @getimagesize($image)){
trigger_error("源图片不存在");
}
if(in_array($dims['mime'], $this->types)){
$loader = $this->imgLoaders[$dims['mime']];
$this->source = $loader($image);
if($dims['mime'] == 'image/png' || $dims['mime'] == 'image/gif'){
imagesavealpha($this->source, true);
}
$this->sourceWidth = $dims[0];
$this->sourceHeight = $dims[1];
$this->sourceMime = $dims['mime'];
$this->initThumb();
return TRUE;
}else{
trigger_error('不支持'.$dims['mime']."图片类型");
}
}
/**
* 字符串方式加载图片
* @param string $image 字符串
* @param string $mime 图片类型
* @return type
*/
public function loadData($image,$mime){
if(in_array($mime, $this->types)){
if($this->source = @imagecreatefromstring($image)){
$this->sourceWidth = imagesx($this->source);
$this->sourceHeight = imagesy($this->source);
$this->sourceMime = $mime;
$this->initThumb();
return TRUE;
}else{
trigger_error("不能从字符串加载图片");
}
}else{
trigger_error("不支持".$mime."图片格式");
}
}
/**
* 生成缩略图
* @param string $file 文件名。如果不为空则储存为文件,否则直接输出到浏览器
*/
public function buildThumb($file = NULL){
$creator = $this->imgCreators[$this->sourceMime];
if(isset($file) && $this->thumb !== NULL){
return $creator($this->thumb,$file);
}else{
return false;
}
}
/**
* 处理缩放
*/
public function initThumb(){
if($this->scale){
if($this->sourceWidth > $this->sourceHeight){
$this->thumbWidth = $this->maxWidth;
$this->thumbHeight = floor($this->sourceHeight*($this->maxWidth/$this->sourceWidth));
}elseif($this->sourceWidth < $this->sourceHeight){
$this->thumbHeight = $this->maxHeight;
$this->thumbWidth = floor($this->sourceWidth*($this->maxHeight/$this->sourceHeight));
}else{
$this->thumbWidth = $this->maxWidth;
$this->thumbHeight = $this->maxHeight;
}
}
if($this->sourceWidth <= $this->maxWidth && $this->sourceHeight <= $this->maxHeight && $this->inflate == FALSE){
$this->thumb = NULL;
}else{
$this->thumb = imagecreatetruecolor($this->thumbWidth, $this->thumbHeight);
if($this->sourceMime == 'image/png' || $this->sourceMime == 'image/gif')
{
imagealphablending($this->thumb, true);
imagesavealpha($this->thumb, true);
if($this->sourceMime == 'image/gif')
{
$bgcolor=imagecolorallocate($this->thumb,0,0,0);
$transparent = imagecolortransparent($this->thumb,$bgcolor) ;
}
if($this->sourceMime == 'image/png')
{
$transparent = imagecolorallocatealpha($this->thumb, 0, 0, 0, 127);
}
imagefill($this->thumb, 0, 0, $transparent);
}
imagecopyresampled($this->thumb, $this->source, 0, 0, 0, 0, $this->thumbWidth, $this->thumbHeight, $this->sourceWidth, $this->sourceHeight);
}
}
public function getMine(){
return $this->sourceMime;
}
public function getThumbWidth(){
return $this->thumbWidth;
}
public function getThumbHeight(){
return $this->thumbHeight;
}
}
/**
* 缩略图类调用示例(文件)
$thumb = new Thumbnail(200, 200);
$thumb->loadFile('wap.gif');
header('Content-Type:'.$thumb->getMine());
$thumb->buildThumb();
/**
* 缩略图类调用示例(字符串)
$thumb = new Thumbnail(200, 200);
$image = file_get_contents('wap.gif');
$thumb->loadData($image, 'image/jpeg');
$thumb->buildThumb('wap_thumb.gif');
*/

View File

@ -0,0 +1,145 @@
<?php
namespace Helpers;
class Curl
{
private $options;
public function __construct($options = array())
{
$this->options = array_merge(array(
'debug' => false,
'http_port' => '80',
'user_agent' => 'Westdc DataService',
'timeout' => 20,
'curlopts' => null,
'verifyssl' => true,
), $options);
}
/**
* Send a request to the server, receive a response
*
* @param string $apiPath Request API path
* @param array $parameters Parameters
* @param string $httpMethod HTTP method to use
*
* @return string HTTP response
*/
public function request($url, array $parameters = array(), $httpMethod = 'GET', array $options = array())
{
$options = array_merge($this->options, $options);
$curlOptions = array();
$headers = array();
if ('POST' === $httpMethod) {
$curlOptions += array(
CURLOPT_POST => true,
);
}
elseif ('PUT' === $httpMethod) {
$curlOptions += array(
CURLOPT_POST => true, // This is so cURL doesn't strip CURLOPT_POSTFIELDS
CURLOPT_CUSTOMREQUEST => 'PUT',
);
}
elseif ('DELETE' === $httpMethod) {
$curlOptions += array(
CURLOPT_CUSTOMREQUEST => 'DELETE',
);
}
if (!empty($parameters))
{
if('GET' === $httpMethod)
{
$queryString = utf8_encode($this->buildQuery($parameters));
$url .= '?' . $queryString;
} elseif ('POST' === $httpMethod) {
$curlOptions += array(
CURLOPT_POSTFIELDS => is_array($parameters) ? http_build_query($parameters) : $parameters,
);
} else {
$curlOptions += array(
CURLOPT_POSTFIELDS => json_encode($parameters)
);
$headers[] = 'Content-Type: application/json';
}
} else {
$headers[] = 'Content-Length: 0';
}
$this->debug('send '.$httpMethod.' request: '.$url);
$curlOptions += array(
CURLOPT_URL => $url,
CURLOPT_PORT => $options['http_port'],
CURLOPT_USERAGENT => $options['user_agent'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => $options['timeout'],
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => $options['verifyssl'],
);
if (ini_get('open_basedir') == '' && ini_get('safe_mode') != 'On') {
$curlOptions[CURLOPT_FOLLOWLOCATION] = true;
}
if (is_array($options['curlopts'])) {
$curlOptions += $options['curlopts'];
}
if (isset($options['proxy'])) {
$curlOptions[CURLOPT_PROXY] = $options['proxy'];
}
$response = $this->doCurlCall($curlOptions);
return $response;
}
/**
* Get a JSON response and transform it to a PHP array
*
* @return array the response
*/
protected function decodeResponse($response)
{
// "false" means a failed curl request
if (false === $response['response']) {
$this->debug(print_r($response, true));
return false;
}
return parent::decodeResponse($response);
}
protected function doCurlCall(array $curlOptions)
{
$curl = curl_init();
curl_setopt_array($curl, $curlOptions);
$response = curl_exec($curl);
$headers = curl_getinfo($curl);
$errorNumber = curl_errno($curl);
$errorMessage = curl_error($curl);
curl_close($curl);
return compact('response', 'headers', 'errorNumber', 'errorMessage');
}
protected function buildQuery($parameters)
{
return http_build_query($parameters, '', '&');
}
protected function debug($message)
{
if($this->options['debug'])
{
print $message."\n";
}
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Helpers;
class Table
{
//附件
public $attachments = "attachments";
//文献
public $reference = "reference";
public $metadata_reference = "mdref";
public $reference_author = "ref_author";
public $reference_tag = "ref_tag";
//数据申请
public $offlineapp = "offlineapp";
//Source
public $source = "source";
//元数据
public $metadata = "metadata";
}

View File

@ -0,0 +1,175 @@
<?php
namespace Helpers;
class View extends \Zend_Controller_Plugin_Abstract
{
private $db; //传入PDO对象.
private $product = 0; //产品环境
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
}
static function addPaginator($data,$ctl,$limit = 10)
{
$request = $ctl->getRequest();
$page = $request->getParam('page');
$paginator = \Zend_Paginator::factory($data);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($limit);
$paginator->setView($ctl->view);
\Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$ctl->view->paginator = $paginator;
}
static function Msg($type,$content,$url=''){
$html = '<div class="alert '.$type.'">'."\r\n";
$html.= '<a data-dismiss="alert" class="close">×</a>'."\r\n";
$html.= $content."\r\n";
$html.= '</div>'."\r\n";
if(!empty($url))
{
if($url == -1){
$html.= '<script language="javascript">setTimeout("window.history.back(-1);",3000);</script>'."\r\n";
}else{
$html.= '<script language="javascript">setTimeout("self.location=\''.$url.'\'",3000);</script>'."\r\n";
}
}
return $html;
}
static function Error($content,$type='',$url=''){
if(empty($type))
{
$AlertType = "alert-error";
}else{
$AlertType = $type;
}
$html = '<div class="alert alert-block fade in '.$AlertType.'" id="Alert-error-box">'."\r\n";
$html.= '<a class="close" data-dismiss="alert" href="#">×</a>'."\r\n";
if(!is_array($content)) {
$html.= '<h4 class="alert-heading">'.$content.'</h4>'."\r\n";
}else{
$html.= '<ul>'."\r\n";
foreach($content as $v) {
$html.='<li>'.$v.'</li>'."\r\n";
}
$html.= '</ul>'."\r\n";
}
$html.= '</div>'."\r\n";
return $html;
}
static function User($param = NULL){
$auth = \Zend_Auth::getInstance();
if($auth->hasIdentity())
{
if(!empty($param))
{
$user = $auth->getIdentity();
return $user->$param;
}else{
$user = $auth->getIdentity();
return $user;
}
}else{
return false;
}
}
static function setUserStorage($user)
{
$auth = \Zend_Auth::getInstance();
if($auth->hasIdentity())
{
if(get_class($user) == 'stdClass')
{
$auth->getStorage()->write($user);
return true;
}
}
return false;
}
static function Dump($data,$exit = true){
echo "<pre>"."\r\n";
var_dump($data);
echo "\r\n";
echo "</pre>";
if($exit)
{
exit();
}
}
static function Post(\Zend_Controller_Action $ctl,$msg,$url=""){
if(empty($msg))
{
return false;
}
if(!is_array($msg))
{
$msg = array('content'=>$msg,'url'=>$url);
}
$helper = new \Zend_Controller_Action_HelperBroker($ctl);
$helper->viewRenderer->setNoRender();
echo $ctl->view->partial('post-message.phtml', $msg);
return true;
}
static function HttpError($ctl,$code = 404){
$ctl->getResponse()->setHttpResponseCode($code);
$helper = new \Zend_Controller_Action_HelperBroker($ctl);
$helper->layout->setLayout('layout');
$helper->viewRenderer->setNoRender();
echo $ctl->view->partial('error/404.phtml');
return true;
}
static function getHostLink()
{
$protocol = "http";
if(strpos(strtolower($_SERVER['SERVER_PROTOCOL']),"https"))
{
$protocol = "https";
}
return $protocol."://".$_SERVER['SERVER_NAME'];
}
static function isXmlHttpRequest($ctl = NULL)
{
$request = new \Zend_Controller_Request_Http();
if($request->isXmlHttpRequest())
{
if(!empty($ctl))
{
$helper = new \Zend_Controller_Action_HelperBroker($ctl);
$helper->layout->disableLayout();
$helper->viewRenderer->setNoRender();
}
return true;
}else{
return false;
}
}
static function isUuid($uuid)
{
if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{
return false;
}else{
return true;
}
}
}

View File

@ -0,0 +1,178 @@
<?php
namespace Helpers;
class dbh
{
private $db; //传入PDO对象.
private $product = 0; //产品环境
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
}
function insert($table,$data,$return=false)
{
$fields = array();
$datas = array();
foreach($data as $k=>$v)
{
$fields[] = '"'.$k.'"';
if(is_int($v) || is_float($v) || is_bool($v))
{
$datas[] = $v;
}else{
if(preg_match("/\'/",$v))
{
$v = preg_replace("/\'/","''",$v);
}
$datas[] = "'".$v."'";
}
}
$fields = join(",",$fields);
$datas = join(",",$datas);
if($return == false){
$sql = "INSERT INTO \"".$table."\" ($fields) VALUES ($datas)";
try{
return $this->db->exec($sql);
}catch (Exception $e) {
if($this->product)
{
return false;
}else{
echo 'Caught exception: '. $e->getMessage(). "\n";
}
}
}else{
$sql = "INSERT INTO \"".$table."\" ($fields) VALUES ($datas) RETURNING id";
try{
$sth = $this->db->prepare($sql);
if($sth->execute())
{
$temp = $sth->fetch(\PDO::FETCH_ASSOC);
return $temp['id'];
}else{
return false;
}
}catch (Exception $e) {
if($this->product)
{
return false;
}else{
echo 'Caught exception: '. $e->getMessage(). "\n";
}
}
}
}//insert
function update($table,$data,$condition="",$return=false)
{
$ups = array();
foreach($data as $k=>$v)
{
if(is_int($v) || is_float($v) || is_bool($v))
{
$ups[] = '"'.$k.'"='.$v;
}else{
if(preg_match("/\'/",$v))
{
$v = preg_replace("/\'/","''",$v);
}
if(preg_match("/\"/",$v))
{
$v = preg_replace("/\"/","''",$v);
}
$ups[] = '"'.$k.'"=\''.$v."'";
}
}
$fields = join(",",$ups);
if(!empty($condition))
{
$wheresql = " WHERE ".$condition;
}else{
$wheresql = "";
}
if($return == false){
try{
$sql = "UPDATE \"".$table."\" SET $fields $wheresql";
if($this->db->exec($sql))
{
return true;
}else{
return false;
}
}catch (Exception $e) {
if($this->product)
{
return false;
}else{
echo 'Caught exception: '. $e->getMessage(). "\n";
}
}
}else{
try{
$sql = "UPDATE \"".$table."\" SET $fields $wheresql";
return $this->db->exec($sql);
}catch (Exception $e) {
if($this->product)
{
return false;
}else{
echo "<pre>";
echo $sql."\r\n";
echo 'Caught exception: '. $e->getMessage(). "\r\n";
echo "</pre>";
}
}
}
}//update
//select
public function select($opt,$debug = false)
{
$field = (isset($opt['field']) && !empty($opt['field'])) ? $opt['field']:"*";
$tbl = (isset($opt['table']) && !empty($opt['table'])) ? $opt['table'] : "";
$join = (isset($opt['join']) && !empty($opt['join'])) ? $opt['join'] : "";
$wheresql = (isset($opt['where']) && !empty($opt['where'])) ? " WHERE ".$opt['where']:" ";
$limit = (isset($opt['limit']) && !empty($opt['limit'])) ? " LIMIT ".$opt['limit']:"";
$offset = (isset($opt['start']) && !empty($opt['start'])) ? " OFFSET ".$opt['start']:"";
$order = (isset($opt['order']) && !empty($opt['order'])) ? " ORDER BY ".$opt['order']:"";
$order .= (isset($opt['sort']) && !empty($opt['sort']) && $order !== '') ? " ".$opt['sort']:"";
$sql = "SELECT $field FROM $tbl
" . $join . "
" . $wheresql . "
" . $order . "
" . $limit . "
" . $offset . "
";
if($debug) return $sql;
$rs = $this->db->query($sql);
return $rs->fetchAll();
}
public function chk($p)
{
if(!isset($p) || empty($p))
{
return false;
}else{
return true;
}
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Mail\Event;
interface MailEvent
{
public function preSend(\Zend_EventManager_Event $e);
public function mailSended(\Zend_EventManager_Event $e);
}

View File

@ -0,0 +1,26 @@
<?php
namespace Mail\Listener;
use Mail\Operation\MailOperate;
class MailListener implements \Zend_EventManager_ListenerAggregate
{
private $event;
function __construct()
{
$this->event = new \Zend_EventManager_EventManager();
}
public function attach(\Zend_EventManager_EventCollection $events)
{
$Events = new MailOperate();
$events->attach('mail.presend', array($Events, 'preSend'), 100);
$events->attach('mail.sended', array($Events, 'mailSended'), 100);
}
public function detach(\Zend_EventManager_EventCollection $events)
{
}
}

View File

@ -0,0 +1,162 @@
<?php
namespace Mail;
use Helpers\dbh;
class Mail
{
private $db; //传入PDO对象.
private $conf; //邮件设置
private $config; //站点设置
protected $events = NULL;
private $tbl_mailTemplate = "emailtext";
public $mail; //邮件
public $subject;
public $body;
public $type;
function __construct($db = NULL,$mail = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$this->conf = new \stdClass();
$this->loadconf();
$this->smtp();
if(empty($mail))
{
$this->mail = new \Zend_Mail('UTF-8');
}else{
$this->mail = $mail;
}
}
private function loadconf()
{
$this->conf->host = $this->config->smtp->host;
$this->conf->username = $this->config->smtp->username;
$this->conf->password = $this->config->smtp->password;
$this->conf->port = 994;
$this->conf->ssl = $this->config->smtp->ssl;
$this->conf->auth = $this->config->smtp->auth;
$this->conf->name = $this->config->smtp->name;
}
private function smtp()
{
$mail_config = array(
'ssl' => $this->conf->ssl,
//'port' => $this->conf->port,
'auth' => $this->conf->auth,
'username' => $this->conf->username,
'password' => $this->conf->password
);
$transport = new \Zend_Mail_Transport_Smtp($this->conf->host, $mail_config);
\Zend_Mail::setDefaultTransport($transport);
}
public function events(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//设置默认发件人
public function setDefaultForm()
{
$this->mail->setFrom($this->conf->username,$this->conf->name);
}
//设置默认收件人
public function setDefaultTo()
{
$this->mail->addTo($this->conf->username,$this->conf->name);
}
//加载模板
public function loadTemplate($id,$data){
if(is_numeric($id))
{
$sql = "SELECT * FROM {$this->tbl_mailTemplate} WHERE id='".$id."'";
}else{
$sql = "SELECT * FROM {$this->tbl_mailTemplate} WHERE \"template\"='".$id."'";
}
$rs = $this->db->query($sql);
$row = $rs->fetch();
$subject = $row['subject'];
$body = $row['body'];
if(count($data) > 0)
{
$patterns = array();
$replacements = array();
foreach($data as $k=>$v)
{
$patterns[]='/{'.$k.'}/i';
$replacements[]=$v;
}
ksort($patterns);
ksort($replacements);
$body = preg_replace($patterns, $replacements, $body);
$subject = preg_replace($patterns, $replacements, $subject);
}//count($this->data)
$this->subject = $subject;
$this->body = $body;
$this->type = $row['type'];
}//加载模板
public function addTo($email,$name)
{
$this->mail->addTo($email,$name);
}
//使用loadTemplate 的结果发送邮件
//在此之前需要使用 $this->mail->addTo()添加收件人
public function send($from = NULL){
if(empty($this->subject) || empty($this->body))
{
return "邮件信息不完整";
}
if($this->type == 'html')
{
$this->mail->setBodyHtml($this->body);
}else{
$this->mail->setBodyText($this->body);
}
if(empty($from))
{
$this->setDefaultForm();
}else{
$this->mail->setFrom($from['email'],$from['name']);
}
$this->mail->setSubject($this->subject);
@$this->mail->send();
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace Mail\Operation;
use Helpers\View as view;
use Helpers\dbh;
//事件中存在的操作
class MailOperate implements \Mail\Event\MailEvent
{
private $db; //传入PDO对象误
private $config; //全局配置
public $tbl_maillog = ""; //邮件日志表
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
public function preSend(\Zend_EventManager_Event $e)
{
$email = $e->getParam('email');
return true;
}
public function mailSended(\Zend_EventManager_Event $e)
{
$email = $e->getParam('email');
$time = date("Y-m-d H:i:s");
$title = $e->getParam('title');
$content = $e->getParam('content');
return true;
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Open;
use Open\Open as open;
class app extends open implements openbase
{
public $tbl_oauth_clients = "oauth_clients"; //oauth 客户端表
public function __construct($db = NULL,$auth = NULL)
{
$this->load();
}
//获得用户创建的app
public function getUserApp($uid = 0)
{
if(empty($uid))
{
$uid = $this->user->id;
}
$sql = "SELECT * FROM ".$this->tbl_oauth_clients." WHERE user_id=".$this->user->id;
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
return $rows;
}
//获得某个App的信息
public function getAppInfo($id)
{
if(empty($id))
{
return false;
}
$sql = "SELECT * FROM ".$this->tbl_oauth_clients." WHERE id=".$id;
$rs = $this->db->query($sql);
$rows = $rs->fetch();
return $rows;
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace open;
interface openbase
{
public function __construct($db = NULL,$auth = NULL);
}
interface openextend extends openbase
{
public function load();
}
abstract class open extends \Zend_Controller_Plugin_Abstract implements openextend
{
public $db;
public $auth = NULL;
public $user;
public $checkFiled = array('phone','realname','unit','address');
public function load($db = NULL,$auth = NULL){
$this->config = \Zend_Registry::get('config');
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
if(empty($auth))
{
$this->auth = \Zend_Auth::getInstance();
if($this->auth->hasIdentity())
{
$this->user = $this->auth->getIdentity();
}
}else{
$this->auth = false;
}
}
//检查用户资料完整性
public function checkinfo()
{
if($this->auth === false)
{
return "未登陆";
}
include_once("Users.php");
$user = new \Users($this->db);
$info = $user->getUserInfo($this->user->id);
foreach($this->checkFiled as $v)
{
if(empty($info[$v]))
{
return "请完善个人信息";
}
}
return true;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Open;
class Server extends \Zend_Controller_Plugin_Abstract
{
public $db;
public $auth = NULL;
public $user;
private $config;
public function __construct($db = NULL,$auth = NULL){
$this->config = \Zend_Registry::get('config');
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
if(empty($auth))
{
$this->auth = \Zend_Auth::getInstance();
if($this->auth->hasIdentity())
{
$this->user = $this->auth->getIdentity();
}
}else{
$this->auth = false;
}
}
public function bootstrap()
{
$dsn = "pgsql:dbname={$this->config->db->params->dbname};host={$this->config->db->params->host}";
$storage = new \OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $this->config->db->params->username, 'password' => $this->config->db->params->password));
$server = new \OAuth2\Server($storage);
$server->addGrantType(new \OAuth2\GrantType\ClientCredentials($storage));
$server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($storage));
//应用授权
//$server->handleTokenRequest(OAuth2\Request::createFromGlobals())->send();
return $server;
}
}

View File

@ -0,0 +1,160 @@
<?php
namespace Order\Manager;
use Helpers\View as view;
use Helpers\dbh;
use Order\listener\ManagerListener;
class Offlineapp
{
private $db;
private $config;
protected $events = NULL;
public $pdfData;
function __construct()
{
$this->db = \Zend_Registry::get('db');
$this->config = \Zend_Registry::get('config');
$Listener = new ManagerListener();
@$this->events()->attachAggregate($Listener);
}
public function events(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
/*************
status:
1 开始进入离线申请申请程序中
2 填写并提交离线申请表
3 邮寄离线申请表
4 收到离线申请表
5 处理离线申请表
10:离线申请完成?
-1: 取消了在线下载进程
**************/
//接收
public function receive($id)
{
if(empty($id) || !is_numeric($id))
{
return "参数错误";
}
$sql="update dataorder set status=4,ts_received=now() where offlineappid=$id";
if($this->db->exec($sql) > 0)
{
@$this->db->exec("UPDATE offlineapp SET status=4,ts_received=now() WHERE id=$id");
@$this->events()->trigger('offlineapp.received', $this, compact('id'));
return true;
}else{
return "接收失败,请重试";
}
}
//获取一个申请的详细信息
public function getOneAppInfo($id)
{
$sql = "SELECT off.*,o.status,o.uuid FROM offlineapp off
LEFT JOIN dataorder o ON off.id=o.offlineappid
WHERE off.id = $id
";
$rs = $this->db->query($sql);
return $rs->fetchAll();
}//
//判断是否存在wsn数据申请
public function hasWsnData($id)
{
$sql="select count(d.id) as wsn from dataorder d left join dataservice s on d.uuid=s.uuid where d.offlineappid=$id and s.service_type in (1,2) and position('waterwsn' in s.service_url)>0 and d.selection is not null";
$rs=$this->db->query($sql);
$row=$rs->fetch();
return $row['wsn'];
}
//重置申请表
public function resetAppForm($id)
{
$sql = "SELECT * FROM offlineapp WHERE id=$id";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$ids = array();
if(file_exists($row['applicationform']))
{
@unlink($row['applicationform']);
}
if($this->db->exec("UPDATE offlineapp SET applicationform=NULL WHERE id=$id")>0)
{
@$this->events()->trigger('offlineapp.AppFormReseted', $this, compact('id'));
return true;
}else{
return "重置遇到问题,请重试";
}
}
//提交给作者的时候需要处理的内容
public function sendToAuthor()
{
}
///////////////////////////////////////////
public function offLineAppMakeQuery($opt)
{
$def = array(
'field' => ' off.*,o.id as orderid,o.status,u.realname,u.username,md.title ',
'table' => ' dataorder o ',
'join' => ' LEFT JOIN offlineapp off ON off.id=o.offlineappid
LEFT JOIN users u ON u.id = off.userid
LEFT JOIN metadata md ON md.uuid=o.uuid',
'order' => ' o.id DESC '
);
return array_merge($def,$opt);
}
public function fetchNotReceived()
{
$opt = $this->offLineAppMakeQuery(array(
'where' => ' o.offlineappid != -1 AND o.status=3'
));
$dbh = new dbh();
//echo $dbh->select($opt,true);exit();
return $dbh->select($opt);
}//未接受的
public function fetchNoPdf()
{
$opt = $this->offLineAppMakeQuery(array(
'where' => ' o.offlineappid != -1 AND o.status=4 AND (off.applicationform IS NULL OR off.applicationform=\'\') '
));
$dbh = new dbh();
//echo $dbh->select($opt,true);exit();
return $dbh->select($opt);
}//没有pdf的
public function fetchNotApprove()
{
$opt = $this->offLineAppMakeQuery(array(
'where' => ' o.offlineappid != -1 AND o.status=4 AND (off.applicationform IS NOT NULL || off.applicationform!=\'\') '
));
$dbh = new dbh();
return $dbh->select($opt);
}//待审核
}

View File

@ -0,0 +1,472 @@
<?php
namespace Order;
use Helpers\View as view;
use Mail\Mail;
use Order\listener\OrderListener;
use Files\Output;
class Order
{
private $db;
private $config;
protected $events = NULL;
public $projectType = array(
"国家973计划项目课题" => "国家973计划项目课题",
"国家863计划课题"=>"国家863计划课题",
"国家级科技支撑课题" => "国家级科技支撑课题",
"国家级科技重大专项" => "国家级科技重大专项",
"国家级国家重大工程" => "国家级国家重大工程",
"国家级国家自然科学基金" => "国家级国家自然科学基金",
"国际合作项目"=>"国际合作项目",
"省部级项目" => "省部级项目",
"其他项目工程" => "其他项目工程",
);//申请中的项目类型
public $pdfData;
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$Listener = new OrderListener();
@$this->events()->attachAggregate($Listener);
}
public function events(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
/*************
status:
1 开始进入离线申请申请程序中
2 填写并提交离线申请表
3 邮寄离线申请表
4 收到离线申请表
5 处理离线申请表
10:离线申请完成?
-1: 取消了在线下载进程
**************/
//添加到数据篮
public function addOrder($uuid,$selection = NULL,$uid = 0){
if(empty($uid))
{
$uid = view::User('id');
}
if(!is_numeric($uid))
{
$uid = view::User('id');
}
if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{
return "参数错误";
}
$results = $this->events()->trigger('submit', $this, compact('uuid','uid'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
if(empty($selection))
{
$results = $this->events()->trigger('checksource', $this, compact('uuid'));
$data = $results->bottom();
if(!empty($data))
{
return $data;
}
if($this->pushToDataorder($uuid,$uid) === true)
{
return true;
}else{
return "操作中出现错误,请重试";
}
}else{
if($this->pushToDataorder($uuid,$uid,$selection) === true)
{
return true;
}else{
return "操作中出现错误,请重试";
}
}
}//addOrder
//放到数据篮中
public function pushToDataorder($uuid,$uid = 0,$selection = NULL)
{
if(empty($uid))
{
$uid = view::User('id');
}
if(empty($selection))
{
$sql="insert into dataorder (uuid,ts_created,userid,status) values(?,now(),?,?)";
$rs = $this->db->query($sql,array($uuid,$uid,1));
}else{
$sql="insert into dataorder (uuid,ts_created,userid,status,selection) values(?,now(),?,?,?)";
$rs = $this->db->query($sql,array($uuid,$uid,1,$selection));
}
if($rs)
{
return true;
}else{
return false;
}
}//pushToDataorder
//提交
public function apply($id,$uid = 0)
{
if(!is_numeric($id) || !is_numeric($uid))
{
return "参数错误";
}
if(empty($uid))
{
$uid = view::User('id');
}
if($id == -1)
{
$sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and userid=?",$uid);
if($this->db->exec($sql))
{
return true;
}else{
return "处理中遇到问题,请重试";
}
}
if($id > 0)
{
$sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and userid=$uid and id=?",$id);
if($this->db->exec($sql))
{
return true;
}else{
return "处理中遇到问题,请重试";
}
}
return "参数错误";
}//apply()
//删除
public function del($id,$uid = 0)
{
if(!is_numeric($id) || !is_numeric($uid))
{
return "参数错误";
}
if(empty($uid))
{
$uid = view::User('id');
}
if($id > 0)
{
$sql = $this->db->quoteInto("delete from dataorder where userid=$uid and status in (1,2) and id=?",$id);
if($this->db->exec($sql))
{
return true;
}else{
return "处理中遇到错误,请重试";
}
}
return "参数错误";
}
//设置PDF上显示的内容 getOrderItemForPdf() 的返回结果
public function setPdfData($data)
{
$this->pdfData = $data;
}
//保存预览
public function SaveOrder($formData,$uid = 0)
{
if(empty($uid) || !is_numeric($uid))
{
$uid = view::User('id');
}
$results = $this->events()->trigger('order.formcheck', $this, compact('formData'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
$results = $this->events()->trigger('order.pdfNumCheck', $this, compact('uid'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
$results = $this->events()->trigger('order.onUpdate', $this, compact('formData','uid'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
$this->pdfPrint($formData,$uid);
return true;
}//SaveOrder
//生成并下载PDF
public function SubmitOrder($formData,$uid = 0)
{
if(empty($uid) || !is_numeric($uid))
{
$uid = view::User('id');
}
$results = $this->events()->trigger('order.formcheck', $this, compact('formData'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
$results = $this->events()->trigger('order.pdfNumCheck', $this, compact('uid'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
$pdf = $this->pdfPrint($formData,$uid,true,true);
$returnid = true;
$results = $this->events()->trigger('order.onUpdate', $this, compact('formData','uid','returnid'));
$oid = $results->bottom();
if(!is_numeric($oid) || $oid<1)
{
return "参数错误";
}
$results = $this->events()->trigger('order.onSubmited', $this, compact('formData','uid','oid','pdf'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
$this->pushPdfDownload($pdf->pdflink);
return true;
}//SubmitOrder()
public function pushPdfDownload($fn)
{
$output = new Output();
$path = realpath($this->config->offline->savepath);
$content = file_get_contents($path.DIRECTORY_SEPARATOR.$fn);
$output->pushDownload($content,"申请表.pdf",'pdf');
exit();
}
//生成pdf
public function pdfPrint($formData,$userid = 0,$save = false,$returnpdf = false)
{
$sql="SELECT m.title||'('||m.filesize::text||'MB)' as title FROM dataorder d
RIGHT JOIN heihemetadata m ON d.uuid=m.uuid
WHERE d.status=2 AND d.userid=?";
$list = $this->db->fetchAll($sql,array($userid));
foreach($list as $i=>$row){
@$formData['heihelist'].=($i+1).". ".$row['title'].";";
}
$sql="SELECT m.title||'('||m.filesize::text||'MB)' as title FROM dataorder d
RIGHT JOIN normalmetadata m ON d.uuid=m.uuid WHERE d.uuid not in (select uuid from heihemetadata) AND d.status=2 AND d.userid=?";
$list = $this->db->fetchAll($sql,array($userid));
foreach($list as $i=>$row){
@$formData['westdclist'].=($i+1).". ".$row['title'].";";
}
$pdf = new \ApplicantPDF();
$pdf->template = $this->config->offline->template;
$pdf->heihetemplate = $this->config->offline->heihetemplate;
$formData['project'].='['.$formData['project_title'].' | '.$formData['project_type'].' | '.$formData['project_id'].' | ' . $formData['project_leader'] . ']';
$pdf->data = $formData;
if (isset($formData['westdclist'])) $pdf->drawWestdc();
if (isset($formData['heihelist'])) $pdf->drawHeihe();
$pdf->addRef($this->pdfData);
$pdf->addSelection($this->pdfData);
$pdf->addSecurity($this->config->offline->security);
if($save === false)
{
header("Content-Disposition: inline; filename=westdc-data-apply.pdf");
header("Content-Type:application/pdf");
//header("Content-Length: " . strlen($pdfstring));
echo $pdf->Output('westdc-data-apply.pdf','S');
}else{
//$fn = $formData['realname'].date('YmdHis').".pdf";
$fn = date('YmdHis').".pdf";
$path = realpath($this->config->offline->savepath);
$pdf->pdflink = $fn;
@$pdf->Output($path.DIRECTORY_SEPARATOR.$fn, 'F');
}
if($returnpdf === true)
{
return $pdf;
}
}
//获得要生成pdf的信息
public function getOrderItemForPdf($uid = 0 , $statu = 2)
{
if(empty($uid))
{
$uid = view::User('id');
}
$sql = "select m.title||'('||m.filesize::text||'MB)' as title,m.ts_published,date_part('year',doi.ts_published) as publish_year,m.citation,m.suppinfo,d.selection,
array_to_string(ARRAY(
select r.reference from mdref mr left join reference r on mr.refid=r.id
where mr.reftype=3 and mr.uuid=d.uuid order by mr.place),'\n'::text) as reference,
array_to_string(array(
select fund.fund_type||':'||fund.title||'(编号:'||fund.fund_id||')'
from fund left join mdfund on fund.id=mdfund.fid where mdfund.uuid=d.uuid order by mdfund.place),'\n'::text) as fund,
doi.doi as datadoi,doi.authors,doi.publisher,doi.title as doititle,doi.author_en,doi.publisher_en,doi.title_en
from dataorder d left join metadata m on d.uuid=m.uuid left join datadoi doi on doi.uuid=d.uuid
where d.status=$statu and d.userid=? order by d.ts_created desc
";
$rows = $this->db->fetchAll($sql,array($uid));
return $rows;
}
//确认申请
public function commitApplicationForm($offlineappid)
{
$user = view::User();
if($user === false)
{
return false;
}
$uid = $user->id;
$results = $this->events()->trigger('order.pdfNumCheck', $this, compact('uid'));
$data = $results->bottom();
if($data !== true)
{
return $data;
}
$sql = "update dataorder set status=3 where status=2 and userid=$uid and offlineappid=$offlineappid";
if($this->db->exec($sql) < 0)
{
return "数据篮状态更新失败,请重试";
}
$sql = "UPDATE offlineapp SET status=3 WHERE id=$offlineappid ";
if($this->db->exec($sql) < 0)
{
return "数据篮状态更新有误,请联系管理员";
}
$data = array(
"user" => empty($user->realname) ? $user->username : $user->realname,
"link"=> view::getHostLink() . '/admin/down/offlineapp/ac/view/offlineappid/'.$offlineappid
);
$mail = new Mail();
$mail->loadTemplate("offline-pdf-commited",$data);
$mail->setDefaultTo();
$mail->send();
return true;
}//确认申请
//service_type 选择
public function serviceTypeTest($type)
{
if(empty($type) || !is_numeric($type))
{
return false;
}
switch($type)
{
case 0:
return "此数据为在线查看数据";
break;
case 1:
return "此数据有可以选择的子集";
break;
case 2:
return "此数据有多个子集供选择";
break;
case 3:
return "";
break;
case 4:
return "";
break;
case 5:
return "";
break;
case 6:
return "";
break;
}
return false;
}//serviceTypeTest
}

View File

@ -0,0 +1,10 @@
<?php
namespace Order\listener;
//接口 需要实现的Listener中的方法
interface ManagerEvents
{
public function received(\Zend_EventManager_Event $e);
public function appFormReseted(\Zend_EventManager_Event $e);
}

View File

@ -0,0 +1,40 @@
<?php
namespace Order\listener;
use Order\mount\ManagerOperate;
//侦听
class ManagerListener implements \Zend_EventManager_ListenerAggregate
{
private $db;
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
public function attach(\Zend_EventManager_EventCollection $events)
{
$this->attachOnOfflineapp($events);
}
public function detach(\Zend_EventManager_EventCollection $events)
{
}
public function attachOnOfflineapp(\Zend_EventManager_EventCollection $events)
{
$mountedClass = new ManagerOperate();
$events->attach('offlineapp.received', array($mountedClass, 'received'), 100);
$events->attach('offlineapp.AppFormReseted',array($mountedClass, 'appFormReseted'), 100);
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Order\listener;
//接口 需要实现的Listener中的方法
interface OrderEvents
{
//申请提交事件
public function submit(\Zend_EventManager_Event $e);
//检查数据来源事件
//区别是直接下载的数据或是wsn来源的数据
//wsn来源的数据需要用户在提交申请的时候选择要下载的内容
public function checksource(\Zend_EventManager_Event $e);
}

View File

@ -0,0 +1,53 @@
<?php
namespace Order\listener;
use Order\mount\OrderOperate;
use Order\mount\PdfForm;
use Order\mount\PdfOperate;
//侦听
class OrderListener implements \Zend_EventManager_ListenerAggregate
{
private $db;
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
public function attach(\Zend_EventManager_EventCollection $events)
{
$this->attachOnOrder($events);
$this->attachOnPdf($events);
}
public function detach(\Zend_EventManager_EventCollection $events)
{
}
public function attachOnOrder(\Zend_EventManager_EventCollection $events)
{
$mountedClass = new OrderOperate();
$events->attach('submit', array($mountedClass, 'submit'), 100);
$events->attach('checksource',array($mountedClass,'checksource'),100);
}
public function attachOnPdf(\Zend_EventManager_EventCollection $events)
{
$PdfFormClass = new PdfForm();
$events->attach('order.formcheck', array($PdfFormClass, 'checkPdfOrderField'), 100);
$PdfClass = new PdfOperate();
$events->attach('order.pdfNumCheck', array($PdfClass, 'checkPdfOrderNum'), 100);
$events->attach('order.onUpdate', array($PdfClass, 'updateUserInfo'), 100);
$events->attach('order.onSubmited', array($PdfClass, 'orderSubmited'), 100);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Order\listener;
//接口 需要实现的Listener中的方法
interface PdfEvents
{
//检查该填写的字段
public function updateUserInfo(\Zend_EventManager_Event $e);
//提交成功后
public function orderSubmited(\Zend_EventManager_Event $e);
}

View File

@ -0,0 +1,9 @@
<?php
namespace Order\listener;
//接口 需要实现的Listener中的方法
interface PdfFormEvents
{
//检查该填写的字段
public function checkPdfOrderField(\Zend_EventManager_Event $e);
}

View File

@ -0,0 +1,92 @@
<?php
namespace Order\mount;
use Helpers\View as view;
use Helpers\dbh;
use Mail\Mail;
use Order\Manager\Offlineapp;
//事件中存在的操作
class ManagerOperate implements \Order\listener\ManagerEvents
{
private $db;
private $config;
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
//申请成功提交之后
public function received(\Zend_EventManager_Event $e)
{
$id = $e->getParam('id');
try{
$OM = new Offlineapp();
$data = $OM->getOneAppInfo($id);
$emailkeys = array(
"user"=>$data[0]['username'],
"datalist"=>str_replace(";","\n",$data[0]['datalist']),
);
$mail = new Mail();
$mail->loadTemplate("offline-start",$emailkeys);
$mail->addTo($data[0]['email'],$data[0]['username']);
$mail->send();
}catch(Exception $e)
{
return $e->getMessage();
}
return true;
}
//申请表重置
public function appFormReseted(\Zend_EventManager_Event $e)
{
$id = $e->getParam('id');
try{
$OM = new Offlineapp();
$data = $OM->getOneAppInfo($id);
$emailkeys = array(
"user"=>$data[0]['username'],
"link"=> view::getHostLink() . '/data/order/ac/offline2'
);
$mail = new Mail();
$mail->loadTemplate("offline-appformreseted",$emailkeys);
$mail->addTo($data[0]['email'],$data[0]['username']);
$mail->send();
}catch(Exception $e)
{
return $e->getMessage();
}
return true;
}
//专题数据集
public function checkDataSource()
{
}
}

View File

@ -0,0 +1,143 @@
<?php
namespace Order\mount;
use Helpers\View as view;
//事件中存在的操作
class OrderOperate implements \Order\listener\OrderEvents
{
private $db;
private $config;
//!!!!!!important!!!!!
//不同项目使用时是否要修改此项??
public $tbl_metadata = "heihemetadata";
public $tbl_dataorder = "dataorder";
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
}
//提交申请
public function submit(\Zend_EventManager_Event $e)
{
$uuid = $e->getParam('uuid');
$uid = $e->getParam('uid');
try{
if($this->checkOrderUUID($uuid) !== false)
{
return "此数据尚未正式发布,还不能申请";
}
if($this->checkOrderNum(true,$uid) === false)
{
return "您的数据篮中存放的数据已达到可申请的数量";
}
if($this->checkOrderHas($uuid,$uid))
{
return "此数据已经在数据篮中";
}
}catch(Exception $e)
{
\view::Dump($e->getMessage());
}
return true;
}
//检查元数据是否已发布(存在于metadata表中)
public function checkOrderUUID($uuid)
{
$sql = "select count(*) as mdcount from {$this->tbl_metadata} where uuid=?";
$rs = $this->db->fetchRow($this->db->quoteInto($sql,$uuid));
if($rs['mdcount'] == 0)
{
return true;
}else{
return false;
}
}
//检查用户是否已经提交了该数据的申请
public function checkOrderHas($uuid,$uid = 0)
{
if(empty($uid))
{
$uid = view::User('id');
}
$sql = "select count(*) as datacount from {$this->tbl_dataorder} where (ts_approved is null) and userid=$uid and uuid=? and status in (1,2,3,4)";
$rs = $this->db->fetchRow($this->db->quoteInto($sql,$uuid),\PDO::FETCH_BOTH);
if($rs['datacount']>=1)
{
return true;
}else{
return false;
}
}//CheckOrderHas()
//检查用户已经在数据篮中的申请的数量
// 已经超过返回 true
public function checkOrderNum($bool = true,$uid = 0)
{
if(empty($uid))
{
$uid = view::User('id');
}
$sql = "select count(*) as datacount from {$this->tbl_dataorder} where (ts_approved is null) and userid=? and status>0 and status<3";
$rs = $this->db->fetchRow($this->db->quoteInto($sql,$uid));
if($bool === true)
{
if($rs['datacount'] <= $this->config->download->max - 1)
{
return true;
}else{
return false;
}
}else{
return $rs['datacount'];
}
}//checkOrderNum
//检查数据来源
public function checksource(\Zend_EventManager_Event $e)
{
$uuid = $e->getParam('uuid');
return $this->getDataService($uuid);
}
//获得数据服务类型
public function getDataService($uuid){
$sql = "SELECT * FROM dataservice WHERE uuid='$uuid'";
$rs = $this->db->query($sql);
$row = $rs->fetch(\PDO::FETCH_BOTH);
if(isset($row['uuid']) && !empty($row['uuid']))
{
return $row;
}else{
return NULL;
}
}
}

Some files were not shown because too many files have changed in this diff Show More