diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index f2f4a029..8856b5ec 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -867,8 +867,23 @@ class ServiceController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(); $uuid=$this->_request->getParam('uuid'); - $sql="select f.filename,f.id,s.uuid,f.depth 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)); + $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)); + //文件大小处理 + foreach($files as $k=>$v) + { + if ($v['filesize']<1024) + { + $files[$k]['filesize']=$v['filesize'].'Byte'; + } elseif($v['filesize']<1024*1024) { + $files[$k]['filesize']=round($v['filesize']/1024,2).'KB'; + } elseif($v['filesize']<1024*1024*1024) { + $files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB'; + } else { + $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'])); + } $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($files,JSON_NUMERIC_CHECK)); return true; @@ -883,13 +898,29 @@ class ServiceController extends Zend_Controller_Action $subpath=(int)$this->_request->getParam('subpath'); $depth=(int)$this->_request->getParam('depth'); $depth++; - $sql="select f.* from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename"; + $sql="select f.*,s.uuid from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename"; $files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid)); foreach($files as $k=>$v) { $files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created'])); - $files[$k]['filesize'] = round($v['filesize']/1024,2) ."MB"; + if ($v['filesize']<1024) + { + $files[$k]['filesize']=$v['filesize'].'Byte'; + } elseif($v['filesize']<1024*1024) { + $files[$k]['filesize']=round($v['filesize']/1024,2).'KB'; + } elseif($v['filesize']<1024*1024*1024) { + $files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB'; + } else { + $files[$k]['filesize']=round($v['filesize']/1024/1024/1024,2).'GB'; + } + if ($v['isdir']==1) + { + $files[$k]['filename']=substr(strrchr(substr($v['filename'],0,-1),'/'),1).'/';} + else{ + $files[$k]['filename']=substr(strrchr($v['filename'],'/'),1); + } + $files[$k]['ext'] = ""; $temp_arr = explode(".", $v['filename']); if($temp_arr) diff --git a/application/default/views/scripts/hiwater/view.phtml b/application/default/views/scripts/hiwater/view.phtml index e6fea0e6..61eaf709 100644 --- a/application/default/views/scripts/hiwater/view.phtml +++ b/application/default/views/scripts/hiwater/view.phtml @@ -14,7 +14,10 @@ $this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验'); ?> = $this->render('breadcrumbs.phtml'); ?> metadata;if ($md):?> @@ -299,7 +302,7 @@ endforeach;
datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 - escape($md->citation);?>
- datadoi) && !strpos($md->citation,$md->datadoi)) : ?> -数据的引用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.', '.$md->publish_year.'. doi:'.$md->doi.']'; - ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)
- ref) : ?> -