数据附件调整,实现页面自动跳转
This commit is contained in:
parent
e30e560a16
commit
36a70053f7
|
@ -605,17 +605,8 @@ class DataController extends Zend_Controller_Action
|
|||
$sql.=" 1<>1 limit 10";
|
||||
$this->view->literature=$this->db->fetchAll($sql);
|
||||
//数据附件
|
||||
$sql = "select id from mdattach where uuid='$uuid'";
|
||||
$re = $this->db->query($sql);
|
||||
$row = $re->fetch();
|
||||
if(empty($row['id']))
|
||||
{
|
||||
$this->view->attachment = "无";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view->attachment = "<a href='/data/attach/uuid/$uuid'>有可下载的附件</a>";
|
||||
}
|
||||
$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);
|
||||
$this->view->attachments = $this->db->fetchAll($sql);
|
||||
//数据评论
|
||||
$sql="select * from comments where uuid=? order by id desc";
|
||||
$this->view->comments=$this->db->fetchAll($sql,array($uuid));
|
||||
|
@ -656,9 +647,15 @@ class DataController extends Zend_Controller_Action
|
|||
$formdata['email']=$user->email;
|
||||
}
|
||||
$commentForm->populate($formdata);
|
||||
$this->view->commentForm=$commentForm;
|
||||
|
||||
//metadata,keyword,series,category,
|
||||
$this->view->commentForm=$commentForm;
|
||||
//自动跳转
|
||||
$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读取
|
||||
|
@ -1266,7 +1263,7 @@ class DataController extends Zend_Controller_Action
|
|||
$atts = $re->fetchAll();
|
||||
|
||||
$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);
|
||||
if( $opened !== true ){
|
||||
die("cannot open {$url} for writing.");
|
||||
|
@ -1276,9 +1273,9 @@ class DataController extends Zend_Controller_Action
|
|||
|
||||
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'];
|
||||
$zip->addFile(Zend_Registry::get('upload').$v['filename'],'/'.basename($v['filename']));
|
||||
$zip->addFile($this->view->config->upload.$v['filename'],'/'.basename($v['filename']));
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
|
|
Loading…
Reference in New Issue