数据附件调整,实现页面自动跳转
This commit is contained in:
parent
e30e560a16
commit
36a70053f7
|
@ -605,17 +605,8 @@ class DataController extends Zend_Controller_Action
|
||||||
$sql.=" 1<>1 limit 10";
|
$sql.=" 1<>1 limit 10";
|
||||||
$this->view->literature=$this->db->fetchAll($sql);
|
$this->view->literature=$this->db->fetchAll($sql);
|
||||||
//数据附件
|
//数据附件
|
||||||
$sql = "select id from mdattach where uuid='$uuid'";
|
$sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid);
|
||||||
$re = $this->db->query($sql);
|
$this->view->attachments = $this->db->fetchAll($sql);
|
||||||
$row = $re->fetch();
|
|
||||||
if(empty($row['id']))
|
|
||||||
{
|
|
||||||
$this->view->attachment = "无";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->view->attachment = "<a href='/data/attach/uuid/$uuid'>有可下载的附件</a>";
|
|
||||||
}
|
|
||||||
//数据评论
|
//数据评论
|
||||||
$sql="select * from comments where uuid=? order by id desc";
|
$sql="select * from comments where uuid=? order by id desc";
|
||||||
$this->view->comments=$this->db->fetchAll($sql,array($uuid));
|
$this->view->comments=$this->db->fetchAll($sql,array($uuid));
|
||||||
|
@ -657,8 +648,14 @@ class DataController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
$commentForm->populate($formdata);
|
$commentForm->populate($formdata);
|
||||||
$this->view->commentForm=$commentForm;
|
$this->view->commentForm=$commentForm;
|
||||||
|
//自动跳转
|
||||||
//metadata,keyword,series,category,
|
$sql="select s.* from datasource d left join source s on d.sourceid=s.id where d.uuid=?";
|
||||||
|
$row=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
|
||||||
|
$jump=(int)$this->_request->getParam('jump');
|
||||||
|
if ($row->has_pages && ($jump!=0))
|
||||||
|
{
|
||||||
|
$this->_helper->viewRenderer($row->code.'/view',null,true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 数据评论,根据UUID读取
|
* 数据评论,根据UUID读取
|
||||||
|
@ -1266,7 +1263,7 @@ class DataController extends Zend_Controller_Action
|
||||||
$atts = $re->fetchAll();
|
$atts = $re->fetchAll();
|
||||||
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
$url=Zend_Registry::get('upload')."tmp/attachments_$uuid.zip";//创建临时文件
|
$url=$this->view->config->upload."tmp/attachments_$uuid.zip";//创建临时文件
|
||||||
$opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
|
$opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
|
||||||
if( $opened !== true ){
|
if( $opened !== true ){
|
||||||
die("cannot open {$url} for writing.");
|
die("cannot open {$url} for writing.");
|
||||||
|
@ -1276,9 +1273,9 @@ class DataController extends Zend_Controller_Action
|
||||||
|
|
||||||
foreach ($atts as $k=>$v)
|
foreach ($atts as $k=>$v)
|
||||||
{
|
{
|
||||||
if (is_file(Zend_Registry::get('upload').$v['filename'])) {
|
if (is_file($this->view->config->upload.$v['filename'])) {
|
||||||
$updates[]=$v['id'];
|
$updates[]=$v['id'];
|
||||||
$zip->addFile(Zend_Registry::get('upload').$v['filename'],'/'.basename($v['filename']));
|
$zip->addFile($this->view->config->upload.$v['filename'],'/'.basename($v['filename']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$zip->close();
|
$zip->close();
|
||||||
|
|
Loading…
Reference in New Issue