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 <?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 class Admin_DataController extends Zend_Controller_Action
{ {
function preDispatch() function preDispatch()
@ -209,7 +215,7 @@ class Admin_DataController extends Zend_Controller_Action
{ {
$add=(int)$this->_getParam('add'); $add=(int)$this->_getParam('add');
$edit=(int)$this->_getParam('edit'); $edit=(int)$this->_getParam('edit');
$delete=(int)$this->_getParam('delete'); $delete=(int)$this->_getParam('delete');
set_time_limit(0); set_time_limit(0);
if ($add) { if ($add) {
$form=new DatasetcdForm(); $form=new DatasetcdForm();
@ -1098,13 +1104,13 @@ class Admin_DataController extends Zend_Controller_Action
} //搜索 } //搜索
else{ else{
$select=$this->db->select(); $sql="select m.title as mdtitle,m.uuid,mr.id as mdid,mr.refid,mr.place,r.reference
$select->from('mdref',array('id as mdid','refid','place')) from mdref mr right join metadata m on mr.uuid=m.uuid
->join('metadata','metadata.uuid=mdref.uuid') left join reference r on mr.refid=r.id
->join('reference','reference.id=mdref.refid') order by m.ts_created desc,mr.place";
->order('metadata.ts_created desc') $re=$this->db->query($sql);
->order('mdref.place'); $row=$re->fetchAll();
$paginator = Zend_Paginator::factory($select); $paginator = Zend_Paginator::factory($row);
$paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(30); $paginator->setItemCountPerPage(30);
$paginator->setView($this->view); $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'); $id = $this->_getParam('attupdate');
$files=new files(); $files=new Files();
$msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],empty($uuid)?'file':'md'); $msg = $files -> upload($_FILES['Filedata'],empty($uuid)?'file/':'md/',true);
if(empty($msg['error'])) if(empty($msg['error']))
{ {
@ -1582,7 +1851,7 @@ class Admin_DataController extends Zend_Controller_Action
$filename = $msg['db_path']; $filename = $msg['db_path'];
$filesize = $msg['file_size']; $filesize = $msg['file_size'];
$filedesc = $this->_request->getParam('filedesc'); $filedesc = $this->_request->getParam('filedesc');
$filetype = $msg['file_type']; $filetype = 'md';
$realname = $msg['realname']; $realname = $msg['realname'];
@ -1901,8 +2170,8 @@ class Admin_DataController extends Zend_Controller_Action
exit(); exit();
} }
$files=new files(); $files=new Files();
$msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],empty($uuid)?'file':'md'); $msg = $files -> upload($_FILES['Filedata'],empty($uuid)?'file/':'md/',true);
if(empty($msg['error'])) if(empty($msg['error']))
{ {
@ -1910,7 +2179,7 @@ class Admin_DataController extends Zend_Controller_Action
$filename = $msg['db_path']; $filename = $msg['db_path'];
$filesize = $msg['file_size']; $filesize = $msg['file_size'];
$filedesc = $this->_request->getParam('filedesc'); $filedesc = $this->_request->getParam('filedesc');
$filetype = $msg['file_type']; $filetype = 'md';
$realname = $msg['realname']; $realname = $msg['realname'];
@ -1969,10 +2238,6 @@ class Admin_DataController extends Zend_Controller_Action
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$atts = $rs->fetchAll(); $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); echo Zend_Json::encode($atts);
exit(); exit();
}else }else
@ -2489,7 +2754,7 @@ class Admin_DataController extends Zend_Controller_Action
}else{ }else{
$mail->addTo($this->debug_email); $mail->addTo($this->debug_email);
} }
@$mail->send(); //@$mail->send();
$data = array("commited"=>1,"error"=>'该版本已经成功发布!'); $data = array("commited"=>1,"error"=>'该版本已经成功发布!');
$this->jsonexit($data); $this->jsonexit($data);
@ -3410,13 +3675,13 @@ class Admin_DataController extends Zend_Controller_Action
if(empty($uuid)) if(empty($uuid))
{ {
$rows = $fund->fetch(NULL,true,0,$keyword); $rows = $fund->fetch(NULL,true,0,$keyword);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this,10);
}else{ }else{
include('data/Metadata.php'); include('data/Metadata.php');
$md = new Metadata($this->db); $md = new Metadata($this->db);
$this->view->md = $md->view($uuid); $this->view->md = $md->view($uuid);
$rows = $fund->fetch($uuid); $rows = $fund->fetch($uuid);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this,10);
} }
return true; return true;
} }
@ -3426,7 +3691,7 @@ class Admin_DataController extends Zend_Controller_Action
$this->_helper->viewRenderer('fund-data-list'); $this->_helper->viewRenderer('fund-data-list');
$this->view->q = $q = $this->_getParam('q'); $this->view->q = $q = $this->_getParam('q');
$rows = $fund->fetchFromData(true,0,$q); $rows = $fund->fetchFromData(true,0,$q);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this,10);
return true; return true;
} }
@ -3437,7 +3702,7 @@ class Admin_DataController extends Zend_Controller_Action
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$this->view->fund = $fund->view($id); $this->view->fund = $fund->view($id);
$rows = $fund->fetchFromData($id,0,$q); $rows = $fund->fetchFromData($id,0,$q);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this,10);
return true; return true;
} }
@ -3569,7 +3834,7 @@ class Admin_DataController extends Zend_Controller_Action
$md = new Metadata($this->db); $md = new Metadata($this->db);
$this->view->md = $md->view($uuid); $this->view->md = $md->view($uuid);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this,10);
return true; return true;
}//formd }//formd
@ -3617,7 +3882,7 @@ class Admin_DataController extends Zend_Controller_Action
} }
$rows = $fund->getData($id,$keyword); $rows = $fund->getData($id,$keyword);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this,10);
} }
}//fund }//fund
@ -3627,6 +3892,7 @@ class Admin_DataController extends Zend_Controller_Action
$ac = $this->_getParam('ac'); $ac = $this->_getParam('ac');
$submit = $this->_getParam('submit'); $submit = $this->_getParam('submit');
$uuid = $this->_getParam('uuid'); $uuid = $this->_getParam('uuid');
$q=$this->_getParam('q');
include_once("data/Doi.php"); include_once("data/Doi.php");
$doi = new Doi($this->db); $doi = new Doi($this->db);
@ -3636,8 +3902,8 @@ class Admin_DataController extends Zend_Controller_Action
{ {
if(empty($uuid)) if(empty($uuid))
{ {
$rows = $doi->fetch(); $rows = $doi->fetch(0,$q);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this,10);
}else{ }else{
$this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid); $this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid);
return true; return true;
@ -3666,11 +3932,11 @@ class Admin_DataController extends Zend_Controller_Action
{ {
$this->view->uuid = $uuid; $this->view->uuid = $uuid;
$this->view->data = $doi->view($uuid); $this->view->data = $doi->view($uuid);
include('data/Metadata.php');
$md = new Metadata($this->db);
$metadata = $md->view($uuid);
if(empty($this->view->data)) if(empty($this->view->data))
{ {
include('data/Metadata.php');
$md = new Metadata($this->db);
$metadata = $md->view($uuid);
$this->view->data = array( $this->view->data = array(
'uuid'=>$uuid, 'uuid'=>$uuid,
'title'=>$metadata['title'], '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', 'publisher_en'=>'Cold and Arid Regions Science Data Center at Lanzhou',
); );
}else{ }else{
$this->view->data['doi'] = $metadata['doi'];
$this->view->data['info'] = $doi->data_process_out($this->view->data); $this->view->data['info'] = $doi->data_process_out($this->view->data);
} }
}else{ }else{

View File

@ -1,4 +1,12 @@
<?php <?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 class Admin_DownController extends Zend_Controller_Action
{ {
function preDispatch() function preDispatch()
@ -8,6 +16,7 @@ class Admin_DownController extends Zend_Controller_Action
$this->messenger=$this->_helper->getHelper('FlashMessenger'); $this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages(); $this->view->messages = $this->messenger->getMessages();
$this->_helper->layout->setLayout('administry'); $this->_helper->layout->setLayout('administry');
$this->view->Theme = new Theme();
} }
function postDispatch() function postDispatch()
{ {
@ -17,10 +26,151 @@ 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() function offlineappAction()
{ {
set_time_limit(0);
include_once("Dataorder.php"); include_once("Dataorder.php");
$DO = new Dataorder($this->db); $DO = new Dataorder($this->db);
@ -32,8 +182,23 @@ class Admin_DownController extends Zend_Controller_Action
$page =(int)$this->_getParam('page'); $page =(int)$this->_getParam('page');
$reset =(int)$this->_getParam('reset'); $reset =(int)$this->_getParam('reset');
$status =(int)$this->_getParam('status'); $status =(int)$this->_getParam('status');
$ac = $this->_getParam('ac');
$q = $this->_getParam('q'); $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 (!$page) $page=1;
if ($view) { if ($view) {
//查看此次申请的pdf //查看此次申请的pdf
@ -64,9 +229,17 @@ class Admin_DownController extends Zend_Controller_Action
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->send(); $mail->send();
$sql="select pdflink from offlineapp where id=?"; //如果是wsn数据则生成数据
$row=$this->db->fetchRow($sql,array($start)); $dataservice = new DataService();
$filecontent=file_get_contents($this->view->config->offline->savepath."/".$row['pdflink']); $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($row['pdflink']);
//对每条数据的管理员用户发送相应的邮件通知,同一用户的邮件需要合并 //对每条数据的管理员用户发送相应的邮件通知,同一用户的邮件需要合并
//需要取出对应数据的标题、uuid以及对应的作者的email一条数据可能有多个作者一次申请可能有多条数据对应同一个作者 //需要取出对应数据的标题、uuid以及对应的作者的email一条数据可能有多个作者一次申请可能有多条数据对应同一个作者
@ -229,8 +402,8 @@ class Admin_DownController extends Zend_Controller_Action
$role['distributor']=array(); $role['distributor']=array();
$role['publisher']=array(); $role['publisher']=array();
$role['author']=array(); $role['author']=array();
$single=array(); $single=array();
if ($rows) if ($rows)
{ {
foreach($rows as $row) foreach($rows as $row)
{ {
@ -390,9 +563,14 @@ class Admin_DownController extends Zend_Controller_Action
//$this->_redirect('/admin/down/offlineapp/'.$page); //$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=?"; $sql="update dataorder set status=5,ts_approved=now() where offlineappid=?";
$this->db->query($sql,array($finish)); $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)); $this->db->query($sql,array($finish));
$sql="select * from offlineapp where id=?"; $sql="select * from offlineapp where id=?";
$row=$this->db->fetchRow($sql,array($finish)); $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 // deal with ftp.westgis.ac.cn, use g6 to add path
// todo ... // todo ...
} }
//deal with ftp1&ftp2 account, for offline data //deal with ftp1&ftp2 account, for offline data
if ($has_ftp1 || $has_ftp2) { if ($has_ftp1 || $has_ftp2) {
$password=md5('westdc'.$row['userid'].rand(1000,9999)); $password=md5('westdc'.$row['userid'].rand(1000,9999));
@ -612,6 +791,68 @@ class Admin_DownController extends Zend_Controller_Action
$this->view->paginator=$paginator; $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() function offlineAction()
{ {
@ -710,21 +951,13 @@ class Admin_DownController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$sql="select * from offlineapp where ts_approved is not null and pdflink is not null order by ts_created desc"; $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); $rows=$this->db->fetchAll($sql);
foreach($rows as $row){ 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"; $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";
} }
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="offlineapp.csv"') $output = new Output($this->db);
->setHeader('Content-Length', strlen($content)) $output->Download("offlineapp.csv",$content,"string");
->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);
} //下载离线服务记录 } //下载离线服务记录
else if ($update) { else if ($update) {
@ -905,7 +1138,7 @@ class Admin_DownController extends Zend_Controller_Action
} }
$select=$this->db->select(); $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 = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($this->view->config->page->max); $paginator->setItemCountPerPage($this->view->config->page->max);

View File

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

View File

@ -7,12 +7,7 @@
$this->breadcrumb('<a href="/admin">后台首页</a>'); $this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('数据管理'); $this->breadcrumb('数据管理');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
$this->headLink()->appendStylesheet('/static/js/uploadify/uploadify.css'); $this->theme->AppendPlus($this,"uploadify");
$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');
?> ?>
<div id="leftPanel"> <div id="leftPanel">
<?= $this->partial('data/left.phtml'); ?> <?= $this->partial('data/left.phtml'); ?>
@ -21,7 +16,7 @@
<div class="ctrlplan"> <div class="ctrlplan">
<a href="/admin/data/md/att/1/uuid/<?php echo $this->uuid;?>">返回元数据附件列表</a> <a href="/admin/data/md/att/1/uuid/<?php echo $this->uuid;?>">返回元数据附件列表</a>
<a href="/data/<?php echo $this->uuid; ?>">查看元数据</a> <a href="/data/<?php echo $this->uuid; ?>">查看元数据</a>
<a href="/admin/data/attachments/">返回附件管理</a> <a href="/admin/data/attachments/">返回附件管理</a>
</div> </div>
@ -30,7 +25,8 @@
<input type="hidden" name="submit" value="1" /> <input type="hidden" name="submit" value="1" />
<p>注:可选择多个文件<br /> <p>注:可选择多个文件<br />
<ul id="datalist"></ul> <div id="datalist">
</div>
<input id="file_upload" name="Filedata" type="file" /> <input id="file_upload" name="Filedata" type="file" />
<input type="button" class="btn btn-small" onclick="$('#file_upload').uploadifyUpload();" value="上传" /> <input type="button" class="btn btn-small" onclick="$('#file_upload').uploadifyUpload();" value="上传" />
</p> </p>
@ -38,65 +34,79 @@
</form> </form>
</div> </div>
<script> <script>
$(document).ready(function() { var _this = {
$('#file_upload').uploadify({ SessionID : '<?php echo session_id(); ?>'
'uploader' : '/static/js/uploadify/uploadify.swf', };
'scriptData': {'PHPSESSID' : '<?php echo session_id(); ?>'}, var uploader;
'script' : '/admin/data/upload/<?php if(!empty($this->uuid)) echo "uuid/".$this->uuid; ?>', var param;
'cancelImg' : '/static/js/uploadify/cancel.png', param = {
'folder' : '/uploads', "PHPSESSID" : _this.SessionID,
'multi' : true, "multi" : 'yes'
'auto' : false, };
'displayData' : 'speed', $(function() {
'buttonImg' : '/static/js/uploadify/selectfile.gif', $('#file_upload').uploadify({
'onComplete' : function(event, ID, fileObj, response, data) { 'swf' : '/js/lib/uploadify/uploadify.swf',
var obj = jQuery.parseJSON(response); 'uploader' : '/admin/data/upload/<?php if(!empty($this->uuid)) echo "uuid/".$this->uuid; ?>',
var html; 'multi' : true,
if(obj.error=='') 'auto' : true,
{html = obj.html;}else{html = obj.error;} 'fileTypeExts' : '*',
$('<li/>', { 'onUploadSuccess' : function(file, data, response) {
"id":'uploadedItem_'+obj.attid, upload.onsuccess(file, data, response);
"class":'uploadifyQueueItem', },
"html": html 'onUploadStart' : function(file) {
}).appendTo('#datalist'); $('#file_upload').uploadify('settings','formData',param);
$('#deletebtn_'+obj.attid).bind('click', function() { }
deleteatt(obj.attid); });
}); });
}, var upload = {
'onError' : function (event,ID,fileObj,errorObj) { onsuccess : function(file, data, response){
alert(errorObj.type + ' Error: ' + errorObj.info); _data = $.parseJSON(data);
} if(!$.isEmptyObject(_data.error))
}); {
function deleteatt(id){ alert(_data.error);
$.ajax({ }else{
'type': "POST", $('#datalist').append(upload.makeFileHtml(_data));
'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('处理中出现问题,请重试');}
});
} }
},
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/',
'data':'uuid=<?php echo $this->uuid?>&mdattdel='+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('附件删除出错');
}
});
}
};
$(document).ready(function() {
$.getJSON("/admin/data/getatts/uuid/<?php echo $this->uuid;?>", function(data) { $.getJSON("/admin/data/getatts/uuid/<?php echo $this->uuid;?>", function(data) {
if(data) if(data)
{ {
$.each(data, function(key, val) { $.each(data, function(key, val) {
$('<li/>', { $('#datalist').append(upload.makeFileHtml(val));
"id":'uploadedItem_'+val['id'],
"class":'uploadifyQueueItem',
"html": val['html']
}).appendTo('#datalist');
$('#deletebtn_'+val['id']).bind('click', function() {
deleteatt(val['id']);
});
}); });
} }
}); });

View File

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

View File

@ -1,22 +1,23 @@
<ul> <ul>
<li class="title">数据管理</li> <li class="title">数据管理</li>
<li><a href="/admin/data/md">元数据管理</a></li> <li><a href="/admin/data/md">元数据管理</a></li>
<li><a href="/admin/data/newdata">新建元数据</a></li> <li><a href="/admin/data/newdata">新建元数据</a></li>
<li><a href="/admin/data/author">数据作者管理</a></li> <li><a href="/admin/data/author">数据作者管理</a></li>
<li><a href="/admin/data/version">数据版本管理</a></li> <li><a href="/admin/data/version">数据版本管理</a></li>
<li><a href="/admin/data/comment">数据反馈管理</a></li> <li><a href="/admin/data/comment">数据反馈管理</a></li>
<li><a href="/admin/data/reference">数据文献管理</a></li> <li><a href="/admin/data/reference">数据文献管理</a></li>
<li><a href="/admin/data/attachments">数据附件管理</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> <!--
<li><a href="/admin/data/batchimport">导入服务器元数据目录</a></li> <li><a href="/admin/data/import">上传元数据文件</a></li>
<li><a href="/admin/data/datafileimport">导入数据目录</a></li> <li><a href="/admin/data/batchimport">导入服务器元数据目录</a></li>
<li><a href="/admin/data/sync">同步GeoNetwork元数据</a></li> <li><a href="/admin/data/datafileimport">导入数据目录</a></li>
<li><a href="/admin/data/datasetcd">特色数据集管理</a></li> <li><a href="/admin/data/sync">同步GeoNetwork元数据</a></li>
<li><a href="/admin/data/newsletter">数据中心通讯管理</a></li> <li><a href="/admin/data/datasetcd">特色数据集管理</a></li>
<li><a href="/admin/data/feature">特色推荐</a></li> --> <li><a href="/admin/data/newsletter">数据中心通讯管理</a></li>
<li><a href="/admin/data/source">专题管理</a></li> <li><a href="/admin/data/feature">特色推荐</a></li> -->
<li><a href="/admin/data/project">汇交计划</a></li> <li><a href="/admin/data/source">专题管理</a></li>
<li><a href="/admin/data/fund">支持项目</a></li> <li><a href="/admin/data/project">汇交计划</a></li>
<li><a href="/admin/data/doi">DOI</a></li> <li><a href="/admin/data/fund">支持项目</a></li>
<li><a href="/admin/data/doi">DOI</a></li>
</ul> </ul>

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; $i=0;
$u=$item['uuid']; $u=$item['uuid'];
endif; 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>'; 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; endforeach;
echo '</ul>'; echo '</ul>';

View File

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

View File

@ -6,10 +6,9 @@
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>'); $this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/down">申请管理</a>'); $this->breadcrumb('<a href="/admin/down">申请管理</a>');
$this->headScript()->appendFile('/js/jquery-1.7.min.js'); $this->Theme->AppendPlus($this,'colorbox');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js'); $this->Theme->AppendPlus($this,'uploadify');
$this->headLink()->appendStylesheet('/css/author.css'); $this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('离线数据申请管理</a>'); $this->breadcrumb('离线数据申请管理</a>');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
?> ?>
@ -33,7 +32,7 @@
<a href="/admin/down/offlineapp/reset/-1" onclick="return confirm('是否重置该申请?')">重置1年前的所有未收到申请表的记录</a> <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/4">已收到的申请</a>
| <a href="/admin/down/offlineapp/status/-1">已拒绝的申请</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> | <a href="/admin/down/offline">已通过的申请(离线服务记录)</a>
<div class="search"> <div class="search">
<form action="/admin/down/offlineapp" method="get"> <form action="/admin/down/offlineapp" method="get">
@ -53,6 +52,7 @@
$autoindex++;?> $autoindex++;?>
<li id="list_<?php echo $item['id'];?>"> <li id="list_<?php echo $item['id'];?>">
<p> <p>
<?= $autoindex ?>.
<a href="mailto:<?= $item['email']; ?>?subject=答复数据申请问题"><?= $item['username']; ?></a> | <a href="mailto:<?= $item['email']; ?>?subject=答复数据申请问题"><?= $item['username']; ?></a> |
申请时间:<?= date('Y-m-d',strtotime($item['ts_created'])); ?> 申请时间:<?= date('Y-m-d',strtotime($item['ts_created'])); ?>
<?php if(!empty($item['ts_received'])) echo " | 收到时间:".date('Y-m-d',strtotime($item['ts_received']));?> <?php if(!empty($item['ts_received'])) echo " | 收到时间:".date('Y-m-d',strtotime($item['ts_received']));?>
@ -70,14 +70,19 @@
数据清单:<?= $item['datalist']; ?> 数据清单:<?= $item['datalist']; ?>
</p> </p>
<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) : ?> <?php if ($item['datastatus']==3) : ?>
<span id="start_<?= $item['id']; ?>"><a href="javascript:action('start',<?= $item['id']; ?>);" onclick="return confirm('确定收到该申请?')">收到</a></span> | <span id="start_<?= $item['id']; ?>"><a href="javascript:action('start',<?= $item['id']; ?>);" onclick="return confirm('确定收到该申请?')">收到</a></span> |
<?php endif; ?> <?php endif; ?>
<a href="javascript:action('finish',<?= $item['id']; ?>);" onclick="return confirm('确定确定通过该申请?')">通过</a> | <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('deleted',<?= $item['id']; ?>);" onclick="return confirm('确定将此记录删除?')">删除</a> |
<a href="javascript:action('deny',<?= $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> </p>
</li> </li>
<?php endforeach; <?php endforeach;
@ -86,8 +91,63 @@
<div class="pagenavi"><?= $this->paginator; ?></div> <div class="pagenavi"><?= $this->paginator; ?></div>
</div> </div>
</div> </div>
<div id="upload-form" class="modal hide fade" tabindex="-1" aria-hidden="true">
<script> <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){ function action(name,id){
var url; var url;
if(name == "start") 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"> <div class="hero-unit">
<h2><?= $this->content ?><?php if(!empty($this->url)) echo ",系统正在为您跳转..."?></h2> <h2><?= $this->content ?><?php if(!empty($this->url)) echo ",系统正在为您跳转..."?></h2>
<?php if(!empty($this->url)) {?> <?php if(!empty($this->url)) {?>
<?php if($this->url == -1) { ?> <?php if(is_numeric($this->url)) { ?>
<a href="javascript:history.go(-1);">如果没有跳转请点击这样</a> <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 {?> <?php }else {?>
<a href="<?= $this->url ?>">如果没有跳转请点击这样</a> <a href="<?= $this->url ?>">如果没有跳转请点击这样</a>
<script language="javascript">setTimeout("self.location='<?= $this->url?>'",3000);</script> <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> <table class="table table-bordered table-hover"><thead>
<tr> <tr>
<th width='600'>元数据标题</th> <th width='600'>元数据标题</th>
<th width='120'>责编辑</th> <th width='120'>编辑</th>
<th width='120'>接收时间</th> <th width='120'>接收时间</th>
<th width='180'>操作</th> <th width='180'>操作</th>
</tr></thead> </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 $item['realname'].'['.$item['username'].']'; ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td> <td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<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> </td>
</tr> </tr>
<?php endforeach; ?> <?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"> <ul class="nav nav-pills nav-stacked well">
<span class="label"><h4>元数据评审</h4></span> <span class="label"><h4>元数据评审</h4></span>
<li id="Nav-review-draft"><a href="/admin/review/draft">投稿元数据</a></li> <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-accept"><a href="/admin/review/accept">待审元数据</a></li>
<!-- <li id="Nav-review-inreview"><a href="/admin/review/inreview">在审元数据</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> <li id="Nav-review-myreview"><a href="/admin/review/myreview">我负责的元数据</a></li>

View File

@ -7,6 +7,7 @@
$this->breadcrumb('元数据评审'); $this->breadcrumb('元数据评审');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendModel($this,'sfadmin');
?> ?>
<style> <style>
table thead tr th {background:#EBF2F6;color:#444;} table thead tr th {background:#EBF2F6;color:#444;}
@ -50,10 +51,27 @@ table thead tr th {background:#EBF2F6;color:#444;}
<thead> <thead>
<tr> <tr>
<th style="width:13px;"><input type="checkbox" class="select_rows" data-tbody="list" /></th> <th style="width:13px;"><input type="checkbox" class="select_rows" data-tbody="list" /></th>
<th width='500'>元数据标题</th> <th width='500'>元数据标题<br />
<th width='80'>状态</th> <a href="?order=title&sort=desc" data-order="title" data-sort="desc"></a>
<th>接收时间</th> <a href="?order=title&sort=asc" data-order="title" data-sort="asc"></a>
<th>作者</th> </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> <th width="300">操作</th>
</tr> </tr>
</thead> </thead>
@ -75,6 +93,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
if($item['status'] == 4) echo "专家反馈"; if($item['status'] == 4) echo "专家反馈";
if($item['status'] == 5) echo "已发布"; if($item['status'] == 5) echo "已发布";
?></td> ?></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><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td><?= $item['author']?></td> <td><?= $item['author']?></td>
<td> <td>
@ -97,41 +116,6 @@ table thead tr th {background:#EBF2F6;color:#444;}
</div> </div>
</div> </div>
<script> <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) { $(document).ready(function(e) {
$('.version').click(function(){ $('.version').click(function(){
$(this).getversion({'id':$(this).attr('rel')}); $(this).getversion({'id':$(this).attr('rel')});
@ -167,6 +151,37 @@ function getids(){
return data; 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( $ ){ (function( $ ){
$.fn.getversion = function( options ) { $.fn.getversion = function( options ) {

View File

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

View File

@ -294,7 +294,7 @@ class AccountController extends Zend_Controller_Action
'controller' => $this->_request->getControllerName(), 'controller' => $this->_request->getControllerName(),
'action' => $this->_request->getActionName(), 'action' => $this->_request->getActionName(),
); );
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) if ($auth->hasIdentity())
{ {
@ -306,7 +306,12 @@ class AccountController extends Zend_Controller_Action
if(($options['module']=="default" && $options['controller'] == "account" && $options['action'] == "login")) 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)) if(!empty($tohref))
@ -364,13 +369,12 @@ class AccountController extends Zend_Controller_Action
} }
else else
{ {
if(!empty($tohref)) if(!empty($tohref))
{ {
view::Post($this,"登录成功,正在跳转",$tohref); view::Post($this,"登录成功,正在跳转",$tohref);
return true; return true;
} }
if($options['module']=="default" && $options['controller'] == "account" && $options['action'] == "login") if($options['module']=="default" && $options['controller'] == "account" && $options['action'] == "login")
{ {
view::Post($this,"登录成功,正在跳转",'/'); view::Post($this,"登录成功,正在跳转",'/');
@ -592,6 +596,7 @@ class AccountController extends Zend_Controller_Action
} }
} }
} } //找回密码
} }

View File

@ -6,6 +6,9 @@
@license http:// @license http://
@link http:// @link http://
*/ */
use data\DataService;
include_once("data/Author.php");
class AuthorController extends Zend_Controller_Action class AuthorController extends Zend_Controller_Action
{ {
private $limit=10; private $limit=10;
@ -709,8 +712,8 @@ class AuthorController extends Zend_Controller_Action
*/ */
function applyAction() function applyAction()
{ {
$ac = $this->_request->getParam('ac'); $ac = $this->_request->getParam('ac');
include_once('helper/view.php'); include_once('helper/view.php');
$this->view->id=view::User('id'); $this->view->id=view::User('id');
if($ac == "mydata") if($ac == "mydata")
@ -719,7 +722,7 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$email = view::User('email'); $email = view::User('email');
$realname=view::User('realname'); $realname=view::User('realname');
$sql = "SELECT distinct m.uuid,m.title,m.description,a.status,a.userid FROM normalmetadata m $sql = "SELECT distinct m.uuid,m.title,m.description,a.status,a.userid FROM normalmetadata m
@ -2565,7 +2568,7 @@ class AuthorController extends Zend_Controller_Action
function literatureAction() function literatureAction()
{ {
$ac = $this->_request->getParam('ac'); $ac = $this->_request->getParam('ac');
$uuid = $this->_request->getParam('uuid'); $this->view->uuid = $uuid = $this->_request->getParam('uuid');
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
@ -2596,9 +2599,14 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$refid = $this->_getParam('refid');
$content = $this->_getParam('content'); $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'=>'参数错误')); $this->jsonexit(array('error'=>'参数错误'));
return true; return true;
@ -2610,7 +2618,13 @@ class AuthorController extends Zend_Controller_Action
return true; 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) if($s !== true)
{ {
$this->jsonexit(array('error'=>'出现错误')); $this->jsonexit(array('error'=>'出现错误'));
@ -2713,7 +2727,7 @@ class AuthorController extends Zend_Controller_Action
//按文献浏览 //按文献浏览
else if($ac=="byliter") else if($ac=="byliter")
{ {
$keywords = $this->_request->getParam('q'); $keywords = $this->_request->getParam('q');
if(!empty($keywords)) if(!empty($keywords))
$this->view->q = $keywords; $this->view->q = $keywords;
$sql = "SELECT count(md.uuid) as c,r.reference,r.id FROM reference r $sql = "SELECT count(md.uuid) as c,r.reference,r.id FROM reference r
@ -2744,6 +2758,17 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer('literature-byliter'); $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") else if($ac=="bydata")
{ {
@ -2763,41 +2788,40 @@ class AuthorController extends Zend_Controller_Action
//添加文献信息 //添加文献信息
else if($ac == "add") else if($ac == "add")
{ {
$submit = $this->_request->getParam('submit'); $submit = $this->_request->getParam('submit');
if(!empty($submit)) if(!empty($submit))
{ {
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$data = ""; $data = "";
try{ try{
$uuid = $this->_request->getParam('uuid'); $uuid = $this->_request->getParam('uuid');
$ref=$this->_request->getParam('ref'); $ref=$this->_request->getParam('ref');
$reftype=$this->_request->getParam('reftype'); $reftype=$this->_request->getParam('reftype');
$url = $this->_request->getParam('url'); $url = $this->_request->getParam('url');
if(empty($uuid) || empty($ref) || !is_numeric($reftype))
{ if(empty($uuid) || empty($ref) || !is_numeric($reftype))
{
$data = array("error"=>"参数错误"); $data = array("error"=>"参数错误");
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
$sql="select * from mdauthor where userid=? and uuid=? and status=1"; $author = new Author($this->db);
$sth = $this->db->prepare($sql); if(!$author->checkAuthor($uuid))
$sth->execute(array($u_id,$uuid)); {
$row = $sth->fetch();
if (empty($row))
{
$data = array("error"=>$this->alertbox('warning','您不是该数据作者,无法添加对应文献信息。')); $data = array("error"=>$this->alertbox('warning','您不是该数据作者,无法添加对应文献信息。'));
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
$sql="select id from reference where reference=?"; $sql="select id from reference where reference=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($ref)); $sth->execute(array($ref));
$row = $sth->fetch(); $row = $sth->fetch();
if (!$row)
if(empty($row['id']))
{ {
$sql="insert into reference (reference,link) values(?,?)"; $sql="insert into reference (reference,link) values(?,?)";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -2811,7 +2835,7 @@ class AuthorController extends Zend_Controller_Action
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$ex=$sth->execute(array($uuid,$row['id'],$reftype)); $ex=$sth->execute(array($uuid,$row['id'],$reftype));
if($ex) if($ex)
{ {
$data = array("commited"=>1,"error"=>$this->alertbox('ok','成功添加文献!')); $data = array("commited"=>1,"error"=>$this->alertbox('ok','成功添加文献!'));
$this->jsonexit($data); $this->jsonexit($data);
@ -2821,8 +2845,9 @@ class AuthorController extends Zend_Controller_Action
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
}catch(Exception $e) {
$msg = "提交失败,请确认权限后重试"; }catch(Exception $e) {
$msg = "提交失败,您提交的数据可能已经存在";
if($this->debug>0) if($this->debug>0)
{$msg .= $e->getMessage();} {$msg .= $e->getMessage();}
$data = array("error"=>$this->alertbox('error',$msg)); $data = array("error"=>$this->alertbox('error',$msg));

File diff suppressed because it is too large Load Diff

View File

@ -1239,4 +1239,34 @@ class HeiheController extends DataController
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $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->_helper->layout->setLayout('hiwater');
$this->debug = 1; $this->debug = 1;
$acName = $this->_request->getActionName(); $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"; $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"; $this->view->pageIn = "collapse2";
} }
@ -28,15 +28,15 @@ class HiwaterController extends DataController
else if(in_array($acName,array("wsn","waternet","soilnet","bnunet",'bnulai'))) else if(in_array($acName,array("wsn","waternet","soilnet","bnunet",'bnulai')))
{ {
$this->view->pageIn = "collapse5"; $this->view->pageIn = "collapse5";
} }
else if(in_array($acName,array("mso","autometeo","ec",'las',"cosmos","tdp","isotope"))) else if(in_array($acName,array("mso","autometeo","ec",'las',"cosmos","tdp","isotope")))
{ {
$this->view->pageIn = "collapse6"; $this->view->pageIn = "collapse6";
} }
else if(in_array($acName,array("rsproduct","dem","precipitation",'sm',"snow","vegtype","vegcov",'phenology','npp'))) else if(in_array($acName,array("rsproduct","dem","precipitation",'sm',"snow","vegtype","vegcov",'phenology','npp')))
{ {
$this->view->pageIn = "collapse7"; $this->view->pageIn = "collapse7";
} }
else if(in_array($acName,array("browse","thumb","fund","tag","timeline","timemap",'author','organization'))) else if(in_array($acName,array("browse","thumb","fund","tag","timeline","timemap",'author','organization')))
{ {
$this->view->pageIn = "collapse10"; $this->view->pageIn = "collapse10";
@ -45,7 +45,7 @@ class HiwaterController extends DataController
{ {
$this->view->pageIn = "collapse9"; $this->view->pageIn = "collapse9";
} }
$this->view->pageID = "hiwater-".$acName; $this->view->pageID = "hiwater-".$acName;
$this->_helper->layout->setLayout('heihe'); $this->_helper->layout->setLayout('heihe');
} }
@ -119,23 +119,28 @@ class HiwaterController extends DataController
$this->getmdlimited('激光雷达','航空遥感'); $this->getmdlimited('激光雷达','航空遥感');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function ccdlidarAction()
{
$this->getmdlimited('CCD','航空遥感',"激光雷达");
$this->_helper->viewRenderer('base');
}
function widasAction() function widasAction()
{ {
$this->getmdlimited('WIDAS','航空遥感'); $this->getmdlimited('WIDAS','航空遥感');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function ccdAction() function ccdwidasAction()
{ {
$this->getmdlimited('CCD','航空遥感'); $this->getmdlimited('CCD','航空遥感','WIDAS');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function nearvisAction() function nearvisAction()
{ {
$this->getmdlimited('CASI','航空遥感'); $this->getmdlimited('CASI','航空遥感');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function thermalAction() function thermalAction()
{ {
$this->getmdlimited('热红外高光谱数据','航空遥感'); $this->getmdlimited('热红外高光谱数据','航空遥感');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
@ -145,36 +150,46 @@ class HiwaterController extends DataController
$this->getmd(array('航空遥感产品','种植结构图','植被类型图','植被结构参数','数字高程模型','数字表面模型','地表温度','地表土壤水文')); $this->getmd(array('航空遥感产品','种植结构图','植被类型图','植被结构参数','数字高程模型','数字表面模型','地表温度','地表土壤水文'));
$this->_helper->viewRenderer('base'); $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'); $this->_helper->viewRenderer('base');
} }
function vegparamAction() function vegparamAction()
{ {
$this->getmd(array('','植被结构参数')); $this->getmdlimited(array("",'植被结构参数'),"数据产品");
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function dsmAction() function soilmoistureAction()
{ {
$this->getmd(array('','数字表面模型')); $this->getmdlimited(array('','土壤水分'),"数据产品");
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function temperatureAction() function temperatureAction()
{ {
$this->getmd(array('','地表温度')); $this->getmdlimited(array('','地表温度'),"数据产品");
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function hmonAction() function hmonAction()
{ {
$this->getmdlimited(array('西支','黄藏寺','黄草沟','峨堡','景阳岭','阿柔阳坡','阿柔阴坡','戈壁站','神沙窝沙漠站','花寨子荒漠站','张掖湿地站','阿柔超级站','大满超级站','四道桥超级站'),'水文气象'); $this->getmdlimited(array('西支','黄藏寺','黄草沟','峨堡','景阳岭','阿柔阳坡','阿柔阴坡','戈壁站','神沙窝沙漠站','花寨子荒漠站','张掖湿地站','阿柔超级站','大满超级站','四道桥超级站'),'水文气象');
$md=$this->view->metadata; $md=$this->view->metadata;
$this->getmd(array('','河川径流观测')); $this->getmd(array('','河川径流观测'));
$this->view->metadata=array_merge($md,$this->view->metadata); $this->view->metadata=array_merge($md,$this->view->metadata);
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function superAction() function superAction()
{ {
$this->getmdlimited(array('阿柔超级站','大满超级站','四道桥超级站'),'水文气象'); $this->getmdlimited(array('阿柔超级站','大满超级站','四道桥超级站'),'水文气象');
@ -182,7 +197,8 @@ class HiwaterController extends DataController
} }
function normalAction() function normalAction()
{ {
$this->getmdlimited(array('西支','黄藏寺','黄草沟','峨堡','景阳岭','阿柔阳坡','阿柔阴坡','戈壁站','神沙窝沙漠站','花寨子荒漠站','张掖湿地站'),'水文气象'); $this->getmdlimited(array('景阳岭站','峨堡站','黄草沟站','阿柔阴坡站','阿柔阳坡站','黄藏寺站','大沙龙站','寺大隆站','排露沟林前气象站','水源涵养林研究院观测站','巴吉滩戈壁站','神沙窝沙漠站','张掖湿地站',
'花寒子荒漠站','五里墩气象站','四道桥混合林站','四道桥胡杨林站','四道桥裸地站','四道桥农田站','黑河上游生态-水文试验研究站','临泽内陆河流域研究站','阿拉善荒漠生态-水文实验研究站'),'水文气象');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
@ -190,16 +206,23 @@ class HiwaterController extends DataController
{ {
$this->getmd(array('','自动气象站')); $this->getmd(array('','自动气象站'));
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
} }
function ecAction() function ecAction()
{ {
$this->getmd(array('','涡动相关仪')); $this->getmd(array('','涡动相关仪'));
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
} }
function lasAction() function lasAction()
{ {
$this->getmd(array('','大孔径闪烁仪')); $this->getmd(array('','大孔径闪烁仪'));
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
} }
function precAction() function precAction()
{ {
@ -284,11 +307,13 @@ class HiwaterController extends DataController
{ {
$this->getmd('试验','theme'); $this->getmd('试验','theme');
} }
function msoAction() function msoAction()
{ {
$this->getmd(array('自动气象站','涡动相关仪','大孔径闪烁仪','稳定同位素观测系统','热扩散液流计TDP','宇宙射线土壤水分')); $this->getmd(array('自动气象站','涡动相关仪','大孔径闪烁仪','稳定同位素观测系统','热扩散液流计TDP','宇宙射线土壤水分'));
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('HiWATER-通量观测矩阵','about');
} }
function isotopeAction() function isotopeAction()
@ -296,18 +321,18 @@ class HiwaterController extends DataController
$this->getmd(array('','稳定同位素观测系统')); $this->getmd(array('','稳定同位素观测系统'));
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function tdpAction() function tdpAction()
{ {
$this->getmd(array('','热扩散液流计TDP')); $this->getmd(array('','热扩散液流计TDP'));
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function cosmosAction() function cosmosAction()
{ {
$this->getmd(array('','宇宙射线土壤水分')); $this->getmd(array('','宇宙射线土壤水分'));
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function rsproductAction() function rsproductAction()
{ {
@ -328,35 +353,35 @@ class HiwaterController extends DataController
} }
function smAction() function smAction()
{ {
$this->getmdlimited(array('土壤水分'),'数据产品'); $this->getmdlimited(array('土壤水分',"卫星遥感"),'数据产品');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function snowAction() function snowAction()
{ {
$this->getmdlimited(array('积雪'),'数据产品'); $this->getmdlimited(array('积雪',"卫星遥感"),'数据产品');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function vegtypeAction() function vegtypeAction()
{ {
$this->getmdlimited(array('植被类型','种植结构'),'数据产品'); $this->getmdlimited(array('植被类型','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function vegcovAction() function vegcovAction()
{ {
$this->getmdlimited(array('植被覆盖度',''),'数据产品'); $this->getmdlimited(array('植被覆盖度','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function phenologyAction() function phenologyAction()
{ {
$this->getmdlimited(array('物候期',''),'数据产品'); $this->getmdlimited(array('物候期','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function nppAction() function nppAction()
{ {
$this->getmdlimited(array('NPP',''),'数据产品'); $this->getmdlimited(array('NPP','卫星遥感'),'数据产品');
$this->_helper->viewRenderer('base'); $this->_helper->viewRenderer('base');
} }
function listAction() function listAction()
{ {
$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') order by timebegin,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') order by timebegin,title";
@ -494,15 +519,15 @@ class HiwaterController extends DataController
$row=$state->fetchAll(); $row=$state->fetchAll();
$sum=$row[0]['count']; $sum=$row[0]['count'];
//@todo: add order with title //@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->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit); $this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1; $this->view->offset=$offset+1;
} }
//获取多项条件并列关系的数据并必须满足limited条件 //获取多项条件并列关系的数据并必须满足limited条件
//$keyword:字符串或字符串数组 //$keyword:字符串或字符串数组
//$limited:限制字符串 //$limited:限制字符串
private function getmdlimited($keyword,$limited) private function getmdlimited($keyword,$limited)
{ {
$page=(int)$this->_request->getParam('page'); $page=(int)$this->_request->getParam('page');
@ -525,7 +550,7 @@ class HiwaterController extends DataController
$row=$state->fetchAll(); $row=$state->fetchAll();
$sum=$row[0]['count']; $sum=$row[0]['count'];
//@todo: add order with title //@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->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit); $this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1; $this->view->offset=$offset+1;
@ -599,8 +624,8 @@ class HiwaterController extends DataController
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} }
} }
} }
function fundAction() function fundAction()
{ {
$id = (int)$this->_request->getParam('id'); $id = (int)$this->_request->getParam('id');
@ -633,8 +658,8 @@ class HiwaterController extends DataController
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$this->_helper->viewRenderer('fund-list'); $this->_helper->viewRenderer('fund-list');
} }
} }
function organizationAction() function organizationAction()
{ {
$page = $this->_request->getParam('page'); $page = $this->_request->getParam('page');

View File

@ -18,7 +18,7 @@ class IndexController extends Zend_Controller_Action
$name=basename($this->view->newsletter,'.pdf'); $name=basename($this->view->newsletter,'.pdf');
list(,$this->view->newsletterno)=explode("_",$name); 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); $row=$this->db->fetchRow($sql);
$this->view->usernum=$row['usernum']; $this->view->usernum=$row['usernum'];
$this->view->metanum=$row['metanum']; $this->view->metanum=$row['metanum'];
@ -26,7 +26,7 @@ class IndexController extends Zend_Controller_Action
/*$sql='select count(*) from metadata'; /*$sql='select count(*) from metadata';
$row=$this->db->fetchRow($sql); $row=$this->db->fetchRow($sql);
$this->view->metanum=$row['count'];*/ $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); $rows=$this->db->fetchAll($sql);
foreach($rows as $row) foreach($rows as $row)
{ {

View File

@ -1,32 +1,32 @@
<?php <?php
class KnowledgeController extends Zend_Controller_Action class KnowledgeController extends Zend_Controller_Action
{ {
function indexAction() function indexAction()
{ {
} }
function preDispatch() function preDispatch()
{ {
$this->db=Zend_Registry::get('db'); $this->db=Zend_Registry::get('db');
$this->view->config = Zend_Registry::get('config'); $this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger'); $this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages(); $this->view->messages = $this->messenger->getMessages();
$this->view->theme=new Theme(); $this->view->theme=new Theme();
} }
function datacenterAction() function datacenterAction()
{ {
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk $siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
$sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.id desc"; $sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.id desc";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($siteid)); $sth->execute(array($siteid));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows); $paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10); $paginator->setItemCountPerPage(10);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} }
function userAction() function userAction()
{ {
$sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by id desc"; $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by id desc";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -37,8 +37,8 @@ class KnowledgeController extends Zend_Controller_Action
$paginator->setItemCountPerPage(10); $paginator->setItemCountPerPage(10);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} }
function authorAction() function authorAction()
{ {
$sql="select * from reference where id in (select refid from mdref where reftype=0 and uuid in (select uuid from normalmetadata)) order by id desc"; $sql="select * from reference where id in (select refid from mdref where reftype=0 and uuid in (select uuid from normalmetadata)) order by id desc";
@ -50,12 +50,12 @@ class KnowledgeController extends Zend_Controller_Action
$paginator->setItemCountPerPage(10); $paginator->setItemCountPerPage(10);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} }
function westplanAction() function westplanAction()
{ {
$sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc"; $sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
@ -64,11 +64,11 @@ class KnowledgeController extends Zend_Controller_Action
$paginator->setItemCountPerPage(10); $paginator->setItemCountPerPage(10);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} }
function searchAction() function searchAction()
{ {
$key=$this->_request->getParam('q'); $key=$this->_request->getParam('q');
$source=$this->_request->getParam('searchsource'); $source=$this->_request->getParam('searchsource');
if(preg_match("/\"|'|<|>/",$key)) if(preg_match("/\"|'|<|>/",$key))
{ {
@ -89,7 +89,7 @@ class KnowledgeController extends Zend_Controller_Action
if (!empty($key) && $source=='datasource') { if (!empty($key) && $source=='datasource') {
$search=new SimpleSearch($key); $search=new SimpleSearch($key);
$where=$search->sql_expr(array("reference")); $where=$search->sql_expr(array("reference"));
$sql="select * from reference where ".$where." order by id desc"; $sql="select * from reference where ".$where." order by id desc";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
@ -98,14 +98,14 @@ class KnowledgeController extends Zend_Controller_Action
$paginator->setItemCountPerPage(10); $paginator->setItemCountPerPage(10);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$this->view->key=$key; $this->view->key=$key;
$this->view->source=$source; $this->view->source=$source;
$this->_helper->viewRenderer('search-data'); $this->_helper->viewRenderer('search-data');
} }
else if (!empty($key) && $source=='westsource') { else if (!empty($key) && $source=='westsource') {
$search=new SimpleSearch($key); $search=new SimpleSearch($key);
$where=$search->sql_expr(array("c.title","a.author")); $where=$search->sql_expr(array("c.title","a.author"));
$sql="select distinct a.author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c left join knl_author a on c.item_id=a.item_id where c.url <>'' and a.place=1 and $where order by ts_created desc"; $sql="select distinct a.author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c left join knl_author a on c.item_id=a.item_id where c.url <>'' and a.place=1 and $where order by ts_created desc";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
@ -115,10 +115,28 @@ class KnowledgeController extends Zend_Controller_Action
$paginator->setItemCountPerPage(10); $paginator->setItemCountPerPage(10);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$this->view->key=$key; $this->view->key=$key;
$this->view->source=$source; $this->view->source=$source;
//$this->_helper->viewRenderer('search-data'); //$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,15 +123,72 @@ class ReviewController extends Zend_Controller_Action
* mdstatus status 字段值为 2,3,4 的元数据为正在进行评审的元数据 * mdstatus status 字段值为 2,3,4 的元数据为正在进行评审的元数据
*/ */
function inreviewAction(){ function inreviewAction(){
$this->view->pageID = "review-inreview";
$page=@(int)$this->_request->getParam('page'); include_once("helper/view.php");
if (empty($page)) $page=1; $ac = $this->_getParam('ac');
$offset=$this->limit*($page-1);
$row=$this->db->fetchAll("select count(s.*) from mdstatus s right join normalmetadata m on s.uuid=m.uuid where s.status in (2,3,4)"); if(empty($ac))
$sum=$row[0]['count']; {
$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->pageID = "review-inreview";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $page=@(int)$this->_request->getParam('page');
$this->view->page=new Pagination($sum,$page,$this->limit); if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
$row=$this->db->fetchAll("select count(s.*) from mdstatus s right join normalmetadata m on s.uuid=m.uuid where s.status in (2,3,4)");
$sum=$row[0]['count'];
$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 <?php
use Helpers\View;
use Helpers\dbh;
use Files\Files;
use Files\Output;
use Files\Listener\FileListener;
class ServiceController extends Zend_Controller_Action class ServiceController extends Zend_Controller_Action
{ {
private $limit=10; private $limit=10;
@ -868,21 +874,21 @@ class ServiceController extends Zend_Controller_Action
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$sql="select f.filename,f.id,s.uuid,f.depth,f.filesize as filesize,f.ts_created from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename"; $sql="select f.filename,f.id,s.uuid,f.depth,f.filesize as filesize,f.ts_created from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename";
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid)); $files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
//文件大小处理 //文件大小处理
foreach($files as $k=>$v) foreach($files as $k=>$v)
{ {
if ($v['filesize']<1024) if ($v['filesize']<1024)
{ {
$files[$k]['filesize']=$v['filesize'].'Byte'; $files[$k]['filesize']=$v['filesize'].'Byte';
} elseif($v['filesize']<1024*1024) { } elseif($v['filesize']<1024*1024) {
$files[$k]['filesize']=round($v['filesize']/1024,2).'KB'; $files[$k]['filesize']=round($v['filesize']/1024,2).'KB';
} elseif($v['filesize']<1024*1024*1024) { } elseif($v['filesize']<1024*1024*1024) {
$files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB'; $files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB';
} else { } else {
$files[$k]['filesize']=round($v['filesize']/1024/1024/1024,2).'GB'; $files[$k]['filesize']=round($v['filesize']/1024/1024/1024,2).'GB';
} }
$files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created'])); $files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
} }
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($files,JSON_NUMERIC_CHECK)); $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($files,JSON_NUMERIC_CHECK));
@ -904,22 +910,22 @@ class ServiceController extends Zend_Controller_Action
foreach($files as $k=>$v) foreach($files as $k=>$v)
{ {
$files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created'])); $files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
if ($v['filesize']<1024) if ($v['filesize']<1024)
{ {
$files[$k]['filesize']=$v['filesize'].'Byte'; $files[$k]['filesize']=$v['filesize'].'Byte';
} elseif($v['filesize']<1024*1024) { } elseif($v['filesize']<1024*1024) {
$files[$k]['filesize']=round($v['filesize']/1024,2).'KB'; $files[$k]['filesize']=round($v['filesize']/1024,2).'KB';
} elseif($v['filesize']<1024*1024*1024) { } elseif($v['filesize']<1024*1024*1024) {
$files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB'; $files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB';
} else { } else {
$files[$k]['filesize']=round($v['filesize']/1024/1024/1024,2).'GB'; $files[$k]['filesize']=round($v['filesize']/1024/1024/1024,2).'GB';
} }
if ($v['isdir']==1) if ($v['isdir']==1)
{ {
$files[$k]['filename']=substr(strrchr(substr($v['filename'],0,-1),'/'),1).'/';} $files[$k]['filename']=substr(strrchr(substr($v['filename'],0,-1),'/'),1).'/';}
else{ else{
$files[$k]['filename']=substr(strrchr($v['filename'],'/'),1); $files[$k]['filename']=substr(strrchr($v['filename'],'/'),1);
} }
$files[$k]['ext'] = ""; $files[$k]['ext'] = "";
$temp_arr = explode(".", $v['filename']); $temp_arr = explode(".", $v['filename']);
@ -1447,6 +1453,24 @@ class ServiceController extends Zend_Controller_Action
echo '</ul>'; echo '</ul>';
echo $pagnation; 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(){ function tagdatalistAction(){
@ -1548,7 +1572,57 @@ class ServiceController extends Zend_Controller_Action
} }
$this->view->url = $url; $this->view->url = $url;
} }
//上传申请表
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()
{
}
/* /*
输出验证码 输出验证码
@ -1727,5 +1801,10 @@ class ServiceController extends Zend_Controller_Action
$renderer_params = array('imageType' => 'png'); $renderer_params = array('imageType' => 'png');
Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params); 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

@ -1,75 +1,79 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author); $this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/author.css'); $this->theme->AppendPlus($this,'colorbox');
$this->breadcrumb('<a href="/">首页</a>'); $this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/author">数据作者</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('我的数据'); $this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb('我的数据');
?> $this->breadcrumb()->setSeparator(' > ');
<div class="row"> ?>
<div class="span3"> <div class="row">
<?= $this->partial('author/navi.phtml'); ?> <div class="span3">
</div> <?= $this->partial('author/navi.phtml'); ?>
<div class="span9"> </div>
<div class="span9">
<p>请输入元数据标题关键字进行搜索</p>
<div class="input-append"> <p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/accept/ac/search"> <div class="input-append">
<input class="span2" type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>"> <form id="datasearch" class="search_form" action="/author/accept/ac/search">
<button class="btn" type="submit">搜索</button> <input class="span2" type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>">
</form> <button class="btn" type="submit">搜索</button>
</div> </form>
<div> </div>
<?php <div>
if (count($this->paginator)): <?php
echo '<ul class="unstyled">'; if (count($this->paginator)):
$autoindex=0; echo '<ul class="unstyled">';
foreach ($this->paginator as $item): $autoindex=0;
$autoindex++;?> foreach ($this->paginator as $item):
<li class="well"> $autoindex++;?>
<h4><a href="/data/<?php echo $item['uuid'];?>" target="_blank" class="title"><?php echo $item['title'];?></a></h4> <li class="well">
<?php if($item['status']==1) : ?> <h4><a href="/data/<?php echo $item['uuid'];?>" target="_blank" class="title"><?php echo $item['title'];?></a></h4>
<span class="dtctrlplan">【操作: <?php if($item['status']==1) : ?>
<a href="/author/inauthor/ac/datalist/uuid/<?php echo $item['uuid']; ?>">申请管理</a> | <span class="dtctrlplan">【操作:
<a href="/author/comment/ac/view/uuid/<?php echo $item['uuid']; ?>">反馈</a> | <a href="/author/inauthor/ac/datalist/uuid/<?php echo $item['uuid']; ?>">申请管理</a> |
<a href="/author/document/uuid/<?php echo $item['uuid']; ?>">文档</a> | <a href="/author/comment/ac/view/uuid/<?php echo $item['uuid']; ?>">反馈</a> |
<a href="/author/literature/uuid/<?php echo $item['uuid']; ?>">文献</a> | <a href="/author/document/uuid/<?php echo $item['uuid']; ?>">文档</a> |
<a href="/author/literature/ac/add/uuid/<?php echo $item['uuid']; ?>">添加文献</a> | <a href="/author/literature/uuid/<?php echo $item['uuid']; ?>">文献</a> |
<a href="/service/geonetwork?url=metadata.edit?id=<?php echo $item['gid']; ?>" target="_blank">修改元数据</a> | <a href="/author/literature/ac/add/uuid/<?php echo $item['uuid']; ?>" class="more iframe">添加文献</a> |
<a href="/author/version/uuid/<?php echo $item['uuid']; ?>">版本</a> | <a href="/service/geonetwork?url=metadata.edit?id=<?php echo $item['gid']; ?>" target="_blank">修改元数据</a> |
<a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> | <a href="/author/version/uuid/<?php echo $item['uuid']; ?>">版本</a> |
<a href="/author/news/uuid/<?php echo $item['uuid']; ?>">新闻</a> | <a href="/author/qa/uuid/<?php echo $item['uuid']; ?>">QA</a> |
<a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a> <a href="/author/news/uuid/<?php echo $item['uuid']; ?>">新闻</a> |
<?php if($item['mdstatus']==6) {?> <a href="/author/viewauthors/uuid/<?php echo $item['uuid']; ?>">所有作者</a>
| <a href="/author/delegate/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定将该数据委托至数据中心?');">委托</a> <?php if($item['mdstatus']==6) {?>
<?php } if($item['mdstatus']==7){ ?> | <a href="/author/delegate/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定将该数据委托至数据中心?');">委托</a>
| <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a> <?php } if($item['mdstatus']==7){ ?>
<?php }?> | | <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a>
<a href="/author/sendmail/uuid/<?php echo $item['uuid']; ?>">邮件通知</a> | <?php }?> |
<a href="/author/fund/uuid/<?php echo $item['uuid']; ?>">支持项目</a> | <a href="/author/sendmail/uuid/<?php echo $item['uuid']; ?>">邮件通知</a> |
<a href="/author/doi/ac/edit/uuid/<?php echo $item['uuid']; ?>">DOI</a> <a href="/author/fund/uuid/<?php echo $item['uuid']; ?>">支持项目</a> |
<a href="/author/doi/ac/edit/uuid/<?php echo $item['uuid']; ?>">DOI</a>
</span>
<?php endif; ?> </span>
<?php endif; ?>
<p><?php echo mb_strlen($item['description'])>400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?></p>
<p> <p><?php echo mb_strlen($item['description'])>400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?></p>
<?php <p>
if ($item['status']==0) <?php
{ if ($item['status']==0)
echo '<img src="/images/list_extensions.gif" />您已经申请该数据(如果长时间没有收到回应请联系数据中心)'; {
} echo '<img src="/images/list_extensions.gif" />您已经申请该数据(如果长时间没有收到回应请联系数据中心)';
?> }
<span id="data_<?php echo $item['uuid'];?>"></span> ?>
</p> <span id="data_<?php echo $item['uuid'];?>"></span>
</li> </p>
<?php endforeach; </li>
echo "</ul>"; <?php endforeach;
endif; ?> echo "</ul>";
<div class="pagenavi"><?= $this->paginator; ?></div> endif; ?>
</div> <div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div> </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><?php echo $item['reference'];?></p>
<p> <p>
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a> <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 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 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> | <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']; ?>" /> <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> </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 "> <div class="control-group ">
<label class="control-label">数据用途</label> <label class="control-label">数据用途</label>
<div class="controls"> <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,14 +3,13 @@
$this->headTitle($this->config->title->data); $this->headTitle($this->config->title->data);
$this->headTitle('离线申请'); $this->headTitle('离线申请');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>'); $this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>'); $this->theme->AppendPlus($this,'colorbox');
$this->breadcrumb('离线申请'); $this->theme->AppendPlus($this,'uploadify');
$this->breadcrumb()->setSeparator(' > '); $this->theme->AppendModel($this,'offlineapp-uploader');
$this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
?> ?>
<?= $this->render('breadcrumbs.phtml') ?> <?= $this->render('breadcrumbs.phtml') ?>
<div class="row"> <div class="row">
<div class="span3"> <div class="span3">
<div class="well sidebar-nav"> <div class="well sidebar-nav">
@ -18,90 +17,127 @@ $this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
</div><!--/.well --> </div><!--/.well -->
</div><!--/span--> </div><!--/span-->
<div class="span9"> <div class="span9">
<h3>数据篮</h3> <h3>数据篮</h3>
<hr /> <hr />
<?php <?php
if(!empty($this->msg)) if(!empty($this->msg))
{ {
echo $this->msg; echo $this->msg;
} }
?> ?>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li id="Nav-order-offline1"><a href="/data/order/ac/offline1">未提交的数据</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">正在提交的数据</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">等待通过的申请</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">已通过的申请</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">在线数据</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> </ul>
<!-- content --> <!-- content -->
<?php if (!empty($this->paginator)) : ?> <?php if (!empty($this->paginator)) : ?>
<div class="pagenavi"><?= $this->paginator; ?></div> <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"> <table class="table table-bordered table-striped">
<thead> <thead>
<th>时间</th> <th>时间</th>
<th>标题</th> <th>标题</th>
<th> <th>
<?php if ($this->tabID=='order-offline1') { <?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') { } elseif ($this->tabID=='order-offline2') {
echo '<a class="btn btn-primary" href="/data/order/pdf/1">提交离线申请</a>'; if(count($this->paginator))
} elseif ($this->tabID=='order-offline3') { {
echo '申请状态'; echo '<a class="btn btn-primary" href="/data/order/pdf/1">生成pdf</a> ';
} elseif ($this->tabID=='order-offline4') { if($this->offlineappid >1)
echo '通过时间'; {
} 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') {
if(count($this->paginator))
{
echo "请等待审核";
}
} elseif ($this->tabID=='order-offline4') {
echo '通过时间';
}
?>
</th> </th>
</thead> </thead>
<tbody> <tbody>
<?php foreach($this->paginator as $order) : ?> <?php foreach($this->paginator as $order) : ?>
<tr> <tr>
<?php if($order['status'] < 4) { ?>
<td><?php echo date('Y-m-d H:i:s',strtotime($order['ts_created'])); ?></td> <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> <td><?php echo date('Y-m-d H:i:s',strtotime($order['ts_received'])); ?></td>
<?php <?php } ?>
if ($this->tabID=='order-offline1') { <td><a href="/data/<?php echo $order['uuid']; ?>"><?php echo $order['title']; ?></a></td>
echo '<a href="/data/order/apply/'.$order['id'].'" class="btn btn-primary">提交</a> <td>
<a href="/data/order/cancel/'.$order['id'].'" class="btn">取消</a>'; <?php
} elseif ($this->tabID=='order-offline2') { 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>';
} elseif ($this->tabID=='order-offline2') {
switch($order['status']) {
case 2:
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 '<span class="label label-success">申请表已上传</span>';
break;
default:
break;
}
} elseif ($this->tabID=='order-offline3') {
switch($order['status']) { switch($order['status']) {
case 2: case 3:
echo "请生成PDF申请表"; if(!empty($order['applicationform']))
echo ' <a class="btn" href="/data/order/cancel/'.$order['id'].'">取消</a>'; echo '<span class="label label-success">申请表已上传</span>';
break; else
case 3: echo '<span class="label label-warning">请上传申请表</span>';
echo "请打印签字然后扫描或拍照申请表并email或邮寄"; break;
break; case 4:
default: if(!empty($order['applicationform']))
break; { echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received']));}
} else
} elseif ($this->tabID=='order-offline3') { echo '<span class="label label-warning">请上传申请表</span>';
switch($order['status']) { break;
case 3: case 5:
echo "请打印签字然后扫描或拍照申请表并email或邮寄"; echo "已通过申请,请查收邮件";
break; break;
case 4: default:
echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received'])); break;
break; }
case 5: } elseif ($this->tabID=='order-offline4') {
echo "已通过申请,请查收邮件"; echo date('Y-m-d',strtotime($order['ts_approved']));
break; }
default: ?>
break;
}
} elseif ($this->tabID=='order-offline4') {
echo date('Y-m-d',strtotime($order['ts_approved']));
}
?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<?php endif; ?> <?php endif; ?>
<!-- /content --> <!-- /content -->
</div><!--/span--> </div><!--/span-->
</div><!--/row--> </div><!--/row-->
<script>$('#Nav-<?= $this->tabID?>').addClass("active");</script> <script>$('#Nav-<?= $this->tabID?>').addClass("active");</script>
<script>
var _this = {};
</script>
<?= $this->partial('data/offlineapp-uploaderform.phtml'); ?>

View File

@ -17,25 +17,118 @@
</div><!--/span--> </div><!--/span-->
<div class="span9"> <div class="span9">
<h3>离线申请提交</h3> <h3>离线申请提交</h3>
<h4>数据清单</h4> <h4>数据清单</h4>
<blockquote> <blockquote>
<ul class="unstyled"> <ul class="unstyled">
<?php foreach ($this->data2 as $i=>$md) : ?> <?php foreach ($this->data2 as $i=>$md) : ?>
<li><?php echo ($i+1).". ".$md['title']; ?></li> <li><?php echo ($i+1).". ".$md['title']; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul></blockquote> </ul></blockquote>
<hr /> <hr />
<h4>申请表填写说明</h4> <h4>申请表填写说明</h4>
<blockquote> <blockquote>
<p class="text-info">其中用途部分,请填写您的详细使用目的;项目类型请从列表中选择,若无对应的项目支持,请选择其他项目工程;如项目无编号信息,则填写“无”;硕博论文请在用途中注明。</p> <p class="text-info">其中用途部分,请填写您的详细使用目的;项目类型请从列表中选择,若无对应的项目支持,请选择其他项目工程;如项目无编号信息,则填写“无”;硕博论文请在用途中注明。</p>
<p class="text-success">详细准确的信息能使您更快通过申请。(数据提供者会根据您提供的信息来进行决策判断)</p></blockquote> <p class="text-success">详细准确的信息能使您更快通过申请。(数据提供者会根据您提供的信息来进行决策判断)</p></blockquote>
<h4>申请表(请务必填写真实信息以便审核通过)</h4> <h4>申请表(请务必填写真实信息以便审核通过)</h4>
<?php if ($this->messages): foreach($this->messages as $msg): ?> <?php if ($this->messages): foreach($this->messages as $msg): ?>
<div class="alert"><?php echo $msg; ?></div> <div class="alert"><?php echo $msg; ?></div>
<?php endforeach;endif; ?> <?php endforeach;endif; ?>
<?php if ($this->msg) : ?> <?php if ($this->msg) : ?>
<div class="alert"><p><?php echo $this->msg; ?></div> <?php echo $this->msg; ?>
<?php endif; ?> <?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><!--/span-->
</div> </div>

View File

@ -5,6 +5,9 @@
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?> ?>
<style> <style>
h3.gs_rt{font-size:110%;} 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> <h4><i class="icon-eye-open text-success"></i>Recommended References</h4>
<ol> <ol>
<?php foreach($this->ref as $ref) : <?php foreach($this->ref as $ref) :
echo '<li>'.$ref->reference;
if (empty($ref->link)) if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>'; echo '<li>'.$ref->reference.'</li>';
else else
@ -332,8 +336,11 @@ endforeach;
<?php else: ?> <?php else: ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="Free!"> <a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="Free!">
Put in the CART Put in the CART
</a> </a>
<?php endif;endif; ?> <?php endif;endif; ?>
<a href="javascript:void(0);" class="btn btn-block" title="喜欢此数据可以将它放到收藏夹中下次浏览">
收藏此数据
</a>
</div> </div>
</div> </div>
<hr /> <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->headLink()->appendStylesheet('/css/water.css');
$this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?> ?>
<?= $this->render('breadcrumbs.phtml') ?> <?= $this->render('breadcrumbs.phtml') ?>
<style> <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> <h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol> <ol>
<?php foreach($this->ref as $ref) : <?php foreach($this->ref as $ref) :
echo '<li>'.$ref->reference;
if (empty($ref->link)) if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>'; {
else if(!empty($ref->attid))
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>'; 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; endforeach;
?> ?>
</ol> </ol>
@ -102,8 +110,8 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
?> ?>
<?php else : ?> <?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p> <p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</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>英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)</p>
</p> </p>
<?php endif; ?> <?php endif; ?>
<?php if($this->data_archives){ ?> <?php if($this->data_archives){ ?>
@ -360,10 +368,21 @@ endforeach;
在线下载 在线下载
</a> </a>
<?php else: ?> <?php else: ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="免费!离线申请此数据(在线数据和离线数据都可申请)"> <?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> </a>
<?php endif;endif; ?> <?php endif;endif; ?>
<!--
<a href="javascript:void(0);" onclick="method.like('<?php echo $md->uuid; ?>',this)" class="btn btn-block" title="喜欢此数据可以将它放到收藏夹中下次浏览">
收藏此数据
</a>
-->
</div> </div>
</div> </div>
@ -506,4 +525,4 @@ var bound = {
<p>没有找到对应的元数据。</p> <p>没有找到对应的元数据。</p>
<?php endif;?> <?php endif;?>
</div> </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"> <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-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-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-ccdlidar"><a href="/hiwater/ccdlidar"><i class="icon-double-angle-right"></i>CCD影像(与激光雷达并飞)</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-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-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> <li id="Nav-hiwater-thermal"><a href="/hiwater/thermal"><i class="icon-double-angle-right"></i>热红外成像光谱仪</a></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<!--
<div class="accordion-group heihe-accordion-title"> <div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-airborne"> <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> <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 id="collapse2" class="accordion-body collapse">
<div class="accordion-inner"> <div class="accordion-inner">
<ul class="nav nav-list heihe-subnav"> <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-demdsm"><a href="/hiwater/demdsm"><i class="icon-double-angle-right"></i>DEM和DSM</a></li>
<li id="Nav-hiwater-vegtype"><a href="/hiwater/vegtype"><i class="icon-double-angle-right"></i>植被类型图</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-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-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> </ul>
</div> </div>
</div> </div>
</div> --> </div>
<div class="accordion-group heihe-accordion-title"> <div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-hmon"> <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> <a href="/hiwater/hmon" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
@ -58,8 +57,8 @@
</div> </div>
<div id="collapse3" class="accordion-body collapse"> <div id="collapse3" class="accordion-body collapse">
<div class="accordion-inner"> <div class="accordion-inner">
<ul class="nav nav-list heihe-subnav"> <ul class="nav nav-list heihe-subnav">
<li id="Nav-hiwater-super"><a href="/hiwater/super"><i class="icon-double-angle-right"></i>超级站</a></li> <li id="Nav-hiwater-super"><a href="/hiwater/super"><i class="icon-double-angle-right"></i>超级站</a></li>
<li id="Nav-hiwater-normal"><a href="/hiwater/normal"><i class="icon-double-angle-right"></i>普通站</a></li> <li id="Nav-hiwater-normal"><a href="/hiwater/normal"><i class="icon-double-angle-right"></i>普通站</a></li>
<li id="Nav-hiwater-prec"><a href="/hiwater/prec"><i class="icon-double-angle-right"></i>径流观测</a></li> <li id="Nav-hiwater-prec"><a href="/hiwater/prec"><i class="icon-double-angle-right"></i>径流观测</a></li>
</ul> </ul>
@ -100,27 +99,27 @@
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div class="accordion-group heihe-accordion-title"> <div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-mso"> <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 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 class="accordion-toggle" data-toggle="collapse" data-parent="#side_accordion" href="#collapse6">
地表蒸散发的多尺度观测试验 非均匀下垫面地表蒸散发的多尺度观测试验
</a> </a>
</div> </div>
<div id="collapse6" class="accordion-body collapse"> <div id="collapse6" class="accordion-body collapse">
<div class="accordion-inner"> <div class="accordion-inner">
<ul class="nav nav-list heihe-subnav"> <ul class="nav nav-list heihe-subnav">
<li id="Nav-hiwater-autometeo"><a href="/hiwater/autometeo"><i class="icon-double-angle-right"></i>自动气象站观测</a></li> <li id="Nav-hiwater-autometeo"><a href="/hiwater/autometeo"><i class="icon-double-angle-right"></i>自动气象站观测</a></li>
<li id="Nav-hiwater-ec"><a href="/hiwater/ec"><i class="icon-double-angle-right"></i>涡动相关观测</a></li> <li id="Nav-hiwater-ec"><a href="/hiwater/ec"><i class="icon-double-angle-right"></i>涡动相关观测</a></li>
<li id="Nav-hiwater-las"><a href="/hiwater/las"><i class="icon-double-angle-right"></i>大孔径闪烁仪观测</a></li> <li id="Nav-hiwater-las"><a href="/hiwater/las"><i class="icon-double-angle-right"></i>大孔径闪烁仪观测</a></li>
<li id="Nav-hiwater-isotope"><a href="/hiwater/isotope"><i class="icon-double-angle-right"></i>稳定同位素观测</a></li> <li id="Nav-hiwater-isotope"><a href="/hiwater/isotope"><i class="icon-double-angle-right"></i>稳定同位素观测</a></li>
<li id="Nav-hiwater-tdp"><a href="/hiwater/tdp"><i class="icon-double-angle-right"></i>树杆液流</a></li> <li id="Nav-hiwater-tdp"><a href="/hiwater/tdp"><i class="icon-double-angle-right"></i>树杆液流</a></li>
<li id="Nav-hiwater-cosmos"><a href="/hiwater/cosmos"><i class="icon-double-angle-right"></i>宇宙射线土壤水分观测COSMOS</a></li> <li id="Nav-hiwater-cosmos"><a href="/hiwater/cosmos"><i class="icon-double-angle-right"></i>宇宙射线土壤水分观测COSMOS</a></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<!-- <!--
<div class="accordion-group heihe-accordion-title"> <div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-water-document"> <div class="accordion-heading" id="Nav-water-document">
@ -150,43 +149,41 @@
下游绿洲生态耗水尺度转换遥感试验 下游绿洲生态耗水尺度转换遥感试验
</a> </a>
</div> </div>
</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-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>
<li id="Nav-hiwater-npp"><a href="/hiwater/npp"><i class="icon-double-angle-right"></i>NPP</a></li>
</ul>
</div>
</div>
</div>
<div class="accordion-group heihe-accordion-title"> <div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-satellite"> <div class="accordion-heading" id="Nav-hiwater-satellite">
<a class="accordion-toggle" href="/hiwater/satellite"> <a class="accordion-toggle" href="/hiwater/satellite">
卫星遥感 卫星遥感数据
</a> </a>
</div> </div>
</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-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>
<li id="Nav-hiwater-npp"><a href="/hiwater/npp"><i class="icon-double-angle-right"></i>NPP</a></li>
</ul>
</div>
</div>
</div>
<div class="accordion-group heihe-accordion-title"> <div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-document"> <div class="accordion-heading" id="Nav-hiwater-document">
<a class="accordion-toggle" href="/hiwater/document"> <a class="accordion-toggle" href="/hiwater/document">
试验文档 试验文档
</a> </a>
</div> </div>
</div> </div>
<div class="accordion-group heihe-accordion-title"> <div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-funtion"> <div class="accordion-heading" id="Nav-hiwater-funtion">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#side_accordion" href="#collapse10"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#side_accordion" href="#collapse10">
@ -196,14 +193,14 @@
<div id="collapse10" class="accordion-body collapse"> <div id="collapse10" class="accordion-body collapse">
<div class="accordion-inner"> <div class="accordion-inner">
<ul class="nav nav-list heihe-subnav"> <ul class="nav nav-list heihe-subnav">
<li id="Nav-hiwater-tag"><a href="/hiwater/tag"><i class="icon-double-angle-right"></i>关键词浏览</a></li> <li id="Nav-hiwater-tag"><a href="/hiwater/tag"><i class="icon-double-angle-right"></i>关键词浏览</a></li>
<li id="Nav-hiwater-thumb"><a href="/hiwater/thumb"><i class="icon-double-angle-right"></i>缩略图浏览</a></li> <li id="Nav-hiwater-thumb"><a href="/hiwater/thumb"><i class="icon-double-angle-right"></i>缩略图浏览</a></li>
<li id="Nav-hiwater-browse"><a href="/hiwater/browse"><i class="icon-double-angle-right"></i>全部浏览</a></li> <li id="Nav-hiwater-browse"><a href="/hiwater/browse"><i class="icon-double-angle-right"></i>全部浏览</a></li>
<li id="Nav-hiwater-timeline"><a href="/hiwater/timeline"><i class="icon-double-angle-right"></i>时间轴浏览</a></li> <li id="Nav-hiwater-timeline"><a href="/hiwater/timeline"><i class="icon-double-angle-right"></i>时间轴浏览</a></li>
<li id="Nav-hiwater-timemap"><a href="/hiwater/timemap"><i class="icon-double-angle-right"></i>时空浏览</a></li> <li id="Nav-hiwater-timemap"><a href="/hiwater/timemap"><i class="icon-double-angle-right"></i>时空浏览</a></li>
<li id="Nav-hiwater-fund"><a href="/hiwater/fund"><i class="icon-double-angle-right"></i>项目浏览</a></li> <li id="Nav-hiwater-fund"><a href="/hiwater/fund"><i class="icon-double-angle-right"></i>项目浏览</a></li>
<li id="Nav-hiwater-author"><a href="/hiwater/author"><i class="icon-double-angle-right"></i>作者浏览</a></li> <li id="Nav-hiwater-author"><a href="/hiwater/author"><i class="icon-double-angle-right"></i>作者浏览</a></li>
<li id="Nav-hiwater-organization"><a href="/hiwater/organization"><i class="icon-double-angle-right"></i>单位浏览</a></li> <li id="Nav-hiwater-organization"><a href="/hiwater/organization"><i class="icon-double-angle-right"></i>单位浏览</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -12,9 +12,12 @@
$this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验'); $this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?> ?>
<style> <style>
h3.gs_rt{font-size:110%;} h3.gs_rt{font-size:110%;}
#file-list li:hover {background-color: #f5f5f5;} #file-list li:hover {background-color: #f5f5f5;}
#file-list li li:hover {background-color: #dedede;} #file-list li li:hover {background-color: #dedede;}
#file-list li li li:hover {background-color: #eeeeee;} #file-list li li li:hover {background-color: #eeeeee;}
@ -22,59 +25,64 @@ h3.gs_rt{font-size:110%;}
<?= $this->render('breadcrumbs.phtml'); ?> <?= $this->render('breadcrumbs.phtml'); ?>
<?php $md=$this->metadata;if ($md):?> <?php $md=$this->metadata;if ($md):?>
<div class="row"> <div class="row">
<div class="span12"> <div class="span12">
<h3><?php echo $this->escape($md->title); <h3><?php echo $this->escape($md->title);
if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?> if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</h3> </h3>
<hr /> <hr />
</div> </div>
<div class="span8"> <div class="span8">
<div> <div>
<a class="colorbox pull-right" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>"/></a> <a class="colorbox pull-right" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>"/></a>
<p style="word-break:break-all;word-wrap:break-word;overflow:hidden;"> <p style="word-break:break-all;word-wrap:break-word;overflow:hidden;">
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?> <?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
</p> </p>
</div> </div>
<div> <div>
<?php if ($this->mcitation) : ?> <?php if ($this->mcitation) : ?>
<hr />
<h4><i class="icon-eye-open text-success"></i>本数据要求的多篇文献引用</h4>
<ol>
<?php foreach($this->mcitation as $ref) :
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>';
endforeach;
?>
</ol>
<?php else: ?>
<?php if ($md->citation) : ?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/platform/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?>
(下载引用:<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>)
<?php endif; ?>
</p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi;
echo ' ['.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->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; endif; if ($this->ref) : ?>
<hr /> <hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4> <h4><i class="icon-eye-open text-success"></i>本数据要求的多篇文献引用</h4>
<ol> <ol>
<?php foreach($this->ref as $ref) : <?php foreach($this->mcitation as $ref) :
if (empty($ref->link)) if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>'; echo '<li>'.$ref->reference.'</li>';
else else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>'; echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
endforeach; endforeach;
?> ?>
</ol>
<?php else: ?>
<?php if ($md->citation) : ?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/platform/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?>
(下载引用:<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>)
<?php endif; ?>
</p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi;
echo ' ['.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->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; endif; if ($this->ref) : ?>
<hr />
<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))
{
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> </ol>
<?php endif; ?> <?php endif; ?>
<?php if ($this->userref) : ?> <?php if ($this->userref) : ?>
@ -100,8 +108,8 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
?> ?>
<?php else : ?> <?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p> <p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</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>英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)</p>
</p> </p>
<?php endif; ?> <?php endif; ?>
<?php if($this->data_archives){ ?> <?php if($this->data_archives){ ?>
@ -114,19 +122,19 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</ul> </ul>
<hr /> <hr />
<?php }?> <?php }?>
<?php if ($md->suppinfo || $this->fund) : ?> <?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4> <h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?> <?php if(!empty($this->fund)) : ?>
<ul> <ul>
<?php foreach($this->fund as $k=>$v) : ?> <?php foreach($this->fund as $k=>$v) : ?>
<li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li> <li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php elseif(!empty($md->suppinfo)) : ?> <?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?> <?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?> <?php endif; ?>
<hr /> <hr />
<?php endif; ?> <?php endif; ?>
<?php if ($this->resources) : ?> <?php if ($this->resources) : ?>
<h4><i class="icon-bolt text-warning"></i>相关资源</h4> <h4><i class="icon-bolt text-warning"></i>相关资源</h4>
<ul class="unstyled inline"><?php foreach($this->resources as $link) : ?> <ul class="unstyled inline"><?php foreach($this->resources as $link) : ?>
@ -296,9 +304,9 @@ foreach($this->keys as $cg) :
echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'"><i class="icon-tag"></i>'.$cg['keyword'].'</a></li>'; echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'"><i class="icon-tag"></i>'.$cg['keyword'].'</a></li>';
endforeach; endforeach;
?></ul> ?></ul>
<?php if ($md->doi) : ?> <?php if ($md->doi) : ?>
<ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul> <ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php endif; ?> <?php endif; ?>
<div> <div>
<hr /> <hr />
@ -358,9 +366,15 @@ endforeach;
在线下载 在线下载
</a> </a>
<?php else: ?> <?php else: ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="免费!离线申请此数据(在线数据和离线数据都可申请)"> <?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> </a>
<?php endif;endif; ?> <?php endif;endif; ?>
</div> </div>
@ -460,7 +474,7 @@ $(function() {
{ {
googleSearch('<?php echo $ev;?>'); googleSearch('<?php echo $ev;?>');
} }
}); });
$('#show-list').click(function(e) { $('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel')); method.filelist.get($(this).attr('rel'));
}); });

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,14 +3,16 @@
<li id="Nav-review-myreview"><a href="/review/myreview"><i class="icon-chevron-right"></i>我参审的元数据</a></li> <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-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-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-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> <li id="Nav-review-help"><a href="/review/help"><i class="icon-chevron-right"></i>元数据评审说明</a></li>
</ul> </ul>
</div> </div>
<form method="post" action="/review/search" id="search" class="form-search"> <form method="post" action="/review/search" id="search" class="form-search">
<div class="input-append"> <div class="input-append">
<input class="span2" id="q" name="q" type="text" value="<?php echo (empty($this->key))?'':$this->key; ?>" placeholder="搜索标题和摘要"> <input class="span2" id="q" name="q" type="text" value="<?php echo (empty($this->key))?'':$this->key; ?>" placeholder="搜索标题和摘要">
<button type="submit" class="btn">搜索</button> <button type="submit" class="btn">搜索</button>
</div> </div>
</form> </form>

View File

@ -11,6 +11,9 @@
$this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/water",'title'=>'黑河综合遥感联合试验'); $this->nav[] = array('link'=>"/water",'title'=>'黑河综合遥感联合试验');
if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice");
}
?> ?>
<style> <style>
h3.gs_rt{font-size:110%;} 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->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.']'; 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> ?> (下载引用:<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 /> <hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4> <h4><i class="icon-eye-open text-success"></i>相关文献(作者推荐)</h4>
<ol> <ol>
<?php foreach($this->ref as $ref) : <?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)) if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>'; {
else if(!empty($ref->attid))
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>'; 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; endforeach;
?> ?>
</ol> </ol>
<?php endif; ?>
<?php if ($this->userref) : ?> <?php if ($this->userref) : ?>
<hr /> <hr />
<h4>数据用户发表文献</h4> <h4><i class="icon-eye-open text-success"></i>数据施引文献</h4>
<ol> <ol>
<?php foreach($this->userref as $ref) : <?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)) if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>'; {
else if(!empty($ref->attid))
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>'; 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; endforeach;
?> ?>
</ol> </ol>
@ -79,8 +113,8 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
?> ?>
<?php else : ?> <?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p> <p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</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>英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)</p>
</p> </p>
<?php endif; ?> <?php endif; ?>
<?php if($this->data_archives){ ?> <?php if($this->data_archives){ ?>
@ -336,9 +370,15 @@ endforeach;
在线下载 在线下载
</a> </a>
<?php else: ?> <?php else: ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="免费!离线申请此数据(在线数据和离线数据都可申请)"> <?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> </a>
<?php endif;endif; ?> <?php endif;endif; ?>
</div> </div>

View File

@ -1,91 +1,200 @@
<?php <?php
//生成西部数据中心离线申请表 //生成西部数据中心离线申请表
require_once('fpdf/chinese-unicode.php');
require_once('fpdi/fpdi.php'); use Helpers\View as view;
class ApplicantPDF extends FPDI
{ require_once('fpdf/chinese-unicode.php');
public $template;//模板文件的路径 require_once('fpdi/fpdi.php');
public $data;//包含具体的数据,数组 class ApplicantPDF extends FPDI
public $fontsize=10; {
function drawWestdc() public $template;//模板文件的路径
{ public $heihetemplate;//模板文件的路径
$pagecount = $this->setSourceFile($this->template); public $data;//包含具体的数据,数组
$tplidx = $this->importPage(1); public $fontsize=10;
$this->addPage(); public $pdflink;
$this->useTemplate($tplidx);
$this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro'); function __construct()
$this->SetFont('ugb','',$this->fontsize); {
$this->setXY(71,44); parent::__construct();
$this->Write($this->fontsize,$this->data['realname']); $this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro');
$this->SetXY(34,55); }
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['datalist'])); function drawWestdc()
$this->setXY(30,100); {
$this->MultiCell(166,4,trim($this->data['project'])); $pagecount = $this->setSourceFile($this->template);
//$this->setXY(34,239); $tplidx = $this->importPage(1);
//$this->Write($this->fontsize,$this->data['realname']); $this->addPage();
$this->setXY(32,225); $this->useTemplate($tplidx);
$this->Write($this->fontsize,$this->data['unit']); $this->SetFont('ugb','',$this->fontsize);
$this->setXY(112,225); $this->setXY(74,43);
$this->Write($this->fontsize,$this->data['email']); $this->Write($this->fontsize,$this->data['realname']);
$this->setXY(174,225); $this->SetXY(34,55);
$this->Write($this->fontsize,$this->data['postcode']); $this->MultiCell (166, 4, str_replace(";","\n",$this->data['westdclist']));
$this->setXY(32,231); $this->setXY(30,100);
$this->Write($this->fontsize,$this->data['address']); $this->MultiCell(166,4,trim($this->data['project']));
$this->setXY(112,231); //$this->setXY(34,239);
$this->Write($this->fontsize,$this->data['phone']); //$this->Write($this->fontsize,$this->data['realname']);
$t=date("Y-m-d"); $this->setXY(32,223);
$this->setXY(174,231); $this->Write($this->fontsize,$this->data['unit']);
$this->Write($this->fontsize,$t); $this->setXY(112,223);
} $this->Write($this->fontsize,$this->data['email']);
function addRef($mds) $this->setXY(174,223);
{ $this->Write($this->fontsize,$this->data['postcode']);
$this->addPage(); $this->setXY(32,230);
$this->SetFont('ugb','B',20); $this->Write($this->fontsize,$this->data['address']);
$this->ln(); $this->setXY(112,230);
$this->Cell(0,0,'附件:数据引用信息',0,2,'C'); $this->Write($this->fontsize,$this->data['phone']);
$this->setY(30); $t=date("Y-m-d");
foreach($mds as $i=>$md) $this->setXY(174,230);
{ $this->Write($this->fontsize,$t);
$this->SetFont('ugb','',12); }
$this->Write(5,($i+1).'. '.$md['title']); function drawHeihe()
$this->ln(); {
if ($md['citation']) $pagecount = $this->setSourceFile($this->heihetemplate);
{ $tplidx = $this->importPage(1);
$this->Write(5,'【建议引用方式】'.$md['citation']); $this->addPage();
$this->ln(); $this->useTemplate($tplidx);
} $this->SetFont('ugb','',$this->fontsize);
if ($md['suppinfo']) $this->setXY(88,43);
{ $this->Write($this->fontsize,$this->data['realname']);
$this->SetFont('ugb','I',10); $this->SetXY(34,55);
$this->Write(5,'【项目支持信息】'.$md['suppinfo']); $this->MultiCell (166, 4, str_replace(";","\n",$this->data['heihelist']));
$this->ln(); $this->setXY(30,100);
} $this->MultiCell(166,4,trim($this->data['project']));
$this->ln(); //$this->setXY(34,239);
} //$this->Write($this->fontsize,$this->data['realname']);
} $this->setXY(32,223);
function addSecurity($template_file) $this->Write($this->fontsize,$this->data['unit']);
{ $this->setXY(112,223);
$pagecount = $this->setSourceFile($template_file); $this->Write($this->fontsize,$this->data['email']);
$tplidx = $this->importPage(1); $this->setXY(174,223);
$this->addPage(); $this->Write($this->fontsize,$this->data['postcode']);
$this->useTemplate($tplidx); $this->setXY(32,230);
$this->SetFont('ugb','B',14); $this->Write($this->fontsize,$this->data['address']);
$this->setXY(46,43); $this->setXY(112,230);
$this->Write(10,$this->data['realname']); $this->Write($this->fontsize,$this->data['phone']);
$this->SetFont('ugb','',12); $t=date("Y-m-d");
$this->setXY(122,194); $this->setXY(174,230);
$this->Write(10,$this->data['realname']); $this->Write($this->fontsize,$t);
$this->setXY(122,201); }
$this->Write($this->fontsize,$this->data['address']); function addRef($mds)
$this->setXY(122,209); {
$this->Write($this->fontsize,$this->data['phone']); $this->addPage();
$this->setXY(122,216); $this->SetFont('ugb','B',20);
$this->Write($this->fontsize,$this->data['email']); $this->ln();
$t=date("Y-m-d"); $this->Cell(0,0,'附件:数据引用信息',0,2,'C');
$this->setXY(32,246); $this->setY(30);
$this->Write($this->fontsize,$t); foreach($mds as $i=>$md)
$this->setXY(122,246); {
$this->Write($this->fontsize,$t); $this->SetFont('ugb','',12);
} $this->Write(5,($i+1).'. '.$md['title']);
} $this->ln();
if ($md['reference'])
{
$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();
}
} 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);
$p=(!empty($md['fund']))?$md['fund']:$md['suppinfo'];
$this->Write(5,'【项目信息】'.$p);
$this->ln();
}
$this->ln();
}
}
function addSecurity($template_file)
{
$pagecount = $this->setSourceFile($template_file);
$tplidx = $this->importPage(1);
$this->addPage();
$this->useTemplate($tplidx);
$this->SetFont('ugb','B',14);
$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,208);
$this->Write($this->fontsize,$this->data['phone']);
$this->setXY(122,215);
$this->Write($this->fontsize,$this->data['email']);
$t=date("Y-m-d");
$this->setXY(32,242);
$this->Write($this->fontsize,$t);
$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,8 +24,12 @@ class Dataorder
if ($statu==4) if ($statu==4)
$wheresql[] = " (o.ts_approved is null and o.pdflink is not null and d.status=4) "; $wheresql[] = " (o.ts_approved is null and o.pdflink is not null and d.status=4) ";
elseif ($statu==-1) elseif ($statu==-1)
$wheresql[] = " (o.pdflink is not null and o.status=-1)"; $wheresql[] = " (o.pdflink is not null and d.status=-1)";
else 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))"; $wheresql[] = " (o.ts_approved is null and o.pdflink is not null and d.status in (3,4))";
if(!empty($q)) if(!empty($q))

View File

@ -48,7 +48,7 @@ class RegisterForm extends Zend_Form
$address=new Zend_Form_Element_Text('address'); $address=new Zend_Form_Element_Text('address');
$address->setLabel('联系地址')->setRequired(false); $address->setLabel('联系地址')->setRequired(false);
$project=new Zend_Form_Element_Textarea('project'); $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'); $id = new Zend_Form_Element_Hidden('id');

View File

@ -112,7 +112,25 @@ class Theme
'/js/lib/jquery.masonry.min.js' '/js/lib/jquery.masonry.min.js'
), ),
), ),
'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 //Google Map API v3

View File

@ -72,7 +72,15 @@ class Literature extends Author
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $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){ function byuuid($uuid){
include_once("helper/view.php"); include_once("helper/view.php");
@ -90,16 +98,33 @@ class Literature extends Author
return $rows; return $rows;
} }
function edit($id,$content){ function edit($mdrefid,$refid,$uuid,$content,$link,$reftype){
include_once("helper/dbh.php"); include_once("helper/dbh.php");
$dbh = new dbh($this->db); $dbh = new dbh($this->db);
$data = array( $data = array(
'reference' => $content 'reference' => $content,
'link'=>$link
); );
$s = $dbh->update("reference",$data," id=$id ",false); $s = $dbh->update("reference",$data," id=$refid ",false);
return $s;
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){ 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; $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)) 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{ }else{
$sql = "SELECT doi.* FROM ".$this->tbl_doi." doi $sql = "SELECT d.* FROM ".$this->tbl_doi." d
LEFT JOIN mdauthor a ON doi.uuid=a.uuid LEFT JOIN mdauthor a ON d.uuid=a.uuid
WHERE a.userid=".$uid." AND a.status>0 WHERE a.userid=".$uid." AND a.status>0 and ".$wheresql."
ORDER BY ts_published desc,ts_submitted desc,ts_created DESC ORDER BY d.ts_published desc,d.ts_submitted desc,d.ts_created DESC
"; ";
} }
$rs = $this->db->query($sql); $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对象. private $db; //传入PDO对象.
protected $events = NULL; //事件 protected $events = NULL; //事件
//使用到的公共变量 //相关数据表
public $tbl_reviewexp = "mdexpertreview"; public $tbl_reviewexp = "mdexpertreview";
public $tbl_mdreview = "mdreview"; public $tbl_mdreview = "mdreview";
public $tbl_user = "users"; public $tbl_user = "users";
function __construct($db) function __construct($db = NULL)
{ {
$this->db = $db; 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) public function events(Zend_EventManager_EventCollection $events = NULL)
{ {
if ($events !== NULL) { if ($events !== NULL) {
@ -24,7 +38,18 @@ class Review extends Zend_Controller_Plugin_Abstract
return $this->events; 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) 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)) 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) function getReviews($uuid)
{ {
$sql = "SELECT mr.*,u.username,u.realname FROM ".$this->tbl_mdreview." mr $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; 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'); include_once('helper/view.php');
$uid = view::User('id'); $uid = \view::User('id');
$wheresql = array(); $wheresql = array();
$ordersql = array();
$wheresql[] = " m.status in (1,2,3,4) "; $wheresql[] = " m.status in (1,2,3,4) ";
$wheresql[] = " u.id=$uid "; $wheresql[] = " u.id=$uid ";
@ -82,6 +183,15 @@ class Review extends Zend_Controller_Plugin_Abstract
{ {
$wheresql[] = " s.sourceid=".$filter['code']." "; $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) if(count($wheresql)>0)
{ {
@ -90,22 +200,39 @@ class Review extends Zend_Controller_Plugin_Abstract
$wheresql = ""; $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 FROM mdstatus m
right join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join geonetworkmetadata g on m.uuid=g.uuid left join geonetworkmetadata g on m.uuid=g.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
left join datasource s on s.uuid=md.uuid left join datasource s on s.uuid=md.uuid
left join mdreview r ON r.uuid=md.uuid
$wheresql $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); $re = $this->db->query($sql);
$rows = $re->fetchAll(); $rows = $re->fetchAll();
return $rows; return $rows;
} }
//发布 /*
* post() 通过评审
*
* @param $id int
* $param $emails array()
*
* return bool
*
* 元数据通过评审且发布
*/
function post($id,$emails) function post($id,$emails)
{ {
if(is_numeric($id)) 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) function checkAdmin($id,$userid = 0)
{ {
$id = (int)$id; $id = (int)$id;
@ -239,15 +375,15 @@ class ReviewListener implements Zend_EventManager_ListenerAggregate
$this->db->query($sql,array($id)); $this->db->query($sql,array($id));
//email message //email message
if(isset($emails) &&is_array($emails) && count($emails)>0) if(isset($emails) &&is_array($emails) && count($emails)>0)
{ {
$config=Zend_Registry::get('config'); $config=Zend_Registry::get('config');
$mail=new WestdcMailer($config->smtp); $mail=new WestdcMailer($config->smtp);
$sql="select m.uuid,m.title from metadata m left join mdstatus s on m.uuid=s.uuid where s.id='$id'"; $sql="select m.uuid,m.title from metadata m left join mdstatus s on m.uuid=s.uuid where s.id='$id'";
$rs=$this->db->query($sql); $rs=$this->db->query($sql);
$res=$rs->fetch(); $res=$rs->fetch();
$mailtp=new EmailText($this->db,'metadata-publish',array('uuid'=>$res['uuid'],'title'=>$res['title'])); $mailtp=new EmailText($this->db,'metadata-publish',array('uuid'=>$res['uuid'],'title'=>$res['title']));
$mail->setBodyText($mailtp->getBody()); $mail->setBodyText($mailtp->getBody());
$mail->setFrom($config->service->email,'西部数据中心服务组'); $mail->setFrom($config->service->email,'西部数据中心服务组');
foreach($emails as $email) $mail->addTo($email); foreach($emails as $email) $mail->addTo($email);
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
$mail->send(); $mail->send();

View File

@ -32,7 +32,8 @@ class files{
'md'=>$general, 'md'=>$general,
'literature'=>$general, 'literature'=>$general,
'document'=>$general, 'document'=>$general,
'heihe'=>$general 'heihe'=>$general,
'reference' => $general
); );
//最大文件大小 //最大文件大小
$max_size = 10485760; $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); $v = preg_replace("/\'/","''",$v);
} }
if(preg_match("/\"/",$v))
{
$v = preg_replace("/\"/","''",$v);
}
$ups[] = '"'.$k.'"=\''.$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 <?php
class view extends Zend_Controller_Plugin_Abstract class view extends \Zend_Controller_Plugin_Abstract
{ {
private $db; //传入PDO对象. private $db; //传入PDO对象.
private $product = 0; //产品环境 private $product = 0; //产品环境
@ -9,7 +9,7 @@ class view extends Zend_Controller_Plugin_Abstract
$this->db = $db; $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)) if(empty($request))
{ {
@ -21,11 +21,11 @@ class view extends Zend_Controller_Plugin_Abstract
$view = $ctl; $view = $ctl;
} }
$paginator = Zend_Paginator::factory($data); $paginator = \Zend_Paginator::factory($data);
$paginator->setCurrentPageNumber($page); $paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($limit); $paginator->setItemCountPerPage($limit);
$paginator->setView($view); $paginator->setView($view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); \Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$view->paginator = $paginator; $view->paginator = $paginator;
} }
@ -70,7 +70,7 @@ class view extends Zend_Controller_Plugin_Abstract
} }
static function User($param){ static function User($param){
$auth = Zend_Auth::getInstance(); $auth = \Zend_Auth::getInstance();
if($auth->hasIdentity()) if($auth->hasIdentity())
{ {
$user = $auth->getIdentity(); $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)) if(empty($msg))
{ {
@ -101,10 +101,20 @@ class view extends Zend_Controller_Plugin_Abstract
$msg = array('content'=>$msg,'url'=>$url); $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->layout->setLayout('layout');
$helper->viewRenderer->setNoRender(); $helper->viewRenderer->setNoRender();
echo $ctl->view->partial('post-message.phtml', $msg); echo $ctl->view->partial('post-message.phtml', $msg);
return true; 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