use docAction in admin/review

This commit is contained in:
wlx 2011-10-17 08:49:43 +00:00
parent e5e0b9ea0e
commit 6c5fb1691e
1 changed files with 27 additions and 8 deletions

View File

@ -309,7 +309,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo($expinfo['email']); $mail->addTo($expinfo['email']);
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/data/doc/uuid/'.$uuid); $filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/admin/review/doc/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $md['title'].'.doc'); $mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $md['title'].'.doc');
if($mail->send()) if($mail->send())
{ {
@ -769,7 +769,7 @@ class Admin_ReviewController extends Zend_Controller_Action
}//expertsAction 专家库 }//expertsAction 专家库
/* /*
* 转换元数据为WORD DOC格式 * 转换元数据为WORD DOC格式,并附加评审意见表和评审说明
*/ */
public function docAction() public function docAction()
{ {
@ -779,8 +779,24 @@ class Admin_ReviewController extends Zend_Controller_Action
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
if (!empty($uuid)) if (!empty($uuid))
{ {
$sql="select x.data,m.title,m.description,g.id from xml x left join metadata m on m.id=x.id left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid); $sql="select x.data,m.title,m.description,g.id,m.projection from xml x left join metadata m on m.id=x.id left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql); $row=$this->db->fetchRow($sql);
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=?";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$reference='<ol>';
foreach($ref as $refer)
{
$reference.='<li>'.$refer['reference'].'</li>';
}
$reference.='</ol>';
if (is_numeric($row['projection']))
{
$sql="select proj4text from spatial_ref_sys where auth_srid=?";
$rs=$this->db->fetchRow($sql,array((int)$row->projection));
if ($rs) $projection=$rs['proj4text'];
}
if (empty($prjection)) $projection=$row['projection'];
} }
$dom = new DOMDocument(); $dom = new DOMDocument();
@ -798,6 +814,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$xslt->registerPHPFunctions(); $xslt->registerPHPFunctions();
$xslt->setParameter('', 'thumburl', $thumburl); $xslt->setParameter('', 'thumburl', $thumburl);
$xslt->setParameter('', 'abstract', $abs); $xslt->setParameter('', 'abstract', $abs);
$xslt->setParameter('','projection',$projection);
$xslt->setParameter('','reference',$reference);
$XSL = new DOMDocument(); $XSL = new DOMDocument();
$XSL->load( '../data/doc.xsl', LIBXML_NOCDATA); $XSL->load( '../data/doc.xsl', LIBXML_NOCDATA);
$xslt->importStylesheet($XSL); $xslt->importStylesheet($XSL);
@ -824,6 +842,7 @@ class Admin_ReviewController extends Zend_Controller_Action
</head> </head>
<body>'; <body>';
$content.=$xslt->transformToXML($dom); $content.=$xslt->transformToXML($dom);
$content.=file_get_contents('../data/review-table.htm',true);
$content.="</body></html>"; $content.="</body></html>";
$this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc') $this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc')
->setHeader('Content-Disposition','attachment; filename="'.$row['title'].'.doc"') ->setHeader('Content-Disposition','attachment; filename="'.$row['title'].'.doc"')