fix the bug in author contorller

This commit is contained in:
Li Jianxuan 2013-04-24 10:35:53 +00:00
parent d2e3a4ad33
commit bb4eacce87
3 changed files with 116 additions and 118 deletions

View File

@ -1595,14 +1595,11 @@ class AuthorController extends Zend_Controller_Action
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($uuid)); $sth->execute(array($uuid));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll(PDO::FETCH_BOTH);
$paginator = Zend_Paginator::factory($rows); include_once("helper/view.php");
$paginator->setCurrentPageNumber($this->_getParam('page')); view::addPaginator($rows,$this->view,$this->_request);
$paginator->setItemCountPerPage(10); $this->view->datas = $rows;
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}else{ }else{
$this->view->error = "参数有误"; $this->view->error = "参数有误";
} }
@ -2041,9 +2038,9 @@ class AuthorController extends Zend_Controller_Action
return true; return true;
} }
else if ($row['status']==2 || $row['status']==3 || $row['status']==4)//已发送过外审邮件,需由编辑告知变化信息 else if ($row['status']==2 || $row['status']==3 || $row['status']==4)//已发送过外审邮件,需由编辑告知变化信息
{ {
//同步元数据 //同步元数据
$iso=new ISO19115(); $iso=new ISO19115();
@$iso->loadXML($row['xml']); @$iso->loadXML($row['xml']);
//email to admin //email to admin
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);
@ -2089,11 +2086,11 @@ class AuthorController extends Zend_Controller_Action
} }
@$mail->send(); @$mail->send();
//email to experts //email to experts
$sql="select u.username,u.email from mdexpertreview e left join users u on e.id=u.id where e.status in (0,1) and e.uuid=?"; $sql="select u.username,u.email from mdexpertreview e left join users u on e.id=u.id where e.status in (0,1) and e.uuid=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($row['uuid'])); $sth->execute(array($row['uuid']));
$experts = $sth->fetchAll(); $experts = $sth->fetchAll();
unset($mail); unset($mail);
unset($mailtp); unset($mailtp);
@ -2108,10 +2105,10 @@ class AuthorController extends Zend_Controller_Action
)); ));
$mail->setBodyText($mailtp->getBody()); $mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/data/doc/review/1/uuid/'.$uuid); $filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/data/doc/review/1/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.doc'); $mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.doc');
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/service/pdf/uuid/'.$uuid); $filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/service/pdf/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.pdf'); $mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.pdf');
if($this->debug==0) if($this->debug==0)
{ {
foreach ($experts as $expert) $mail->addTo($expert['email']); foreach ($experts as $expert) $mail->addTo($expert['email']);
@ -2240,7 +2237,7 @@ class AuthorController extends Zend_Controller_Action
if (!empty($id) && empty($ac)) if (!empty($id) && empty($ac))
{ {
$this->view->url='metadata.show?id='.$id; $this->view->url='metadata.show?id='.$id;
$this->_helper->viewRenderer('newdata-view'); $this->_helper->viewRenderer('newdata-view');
} }
//查看属于自己的所有的未提交数据列表 //查看属于自己的所有的未提交数据列表
else if((empty($ac) && empty($uuid))|| $ac=='list') else if((empty($ac) && empty($uuid))|| $ac=='list')

View File

@ -1,58 +1,60 @@
<?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->headLink()->appendStylesheet('/css/author.css');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>'); $this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('新建数据'); $this->breadcrumb('新建数据');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
?> ?>
<div class="row"> <div class="row">
<div class="span3"> <div class="span3">
<?= $this->partial('author/navi.phtml'); ?> <?= $this->partial('author/navi.phtml'); ?>
</div> </div>
<div class="span9"> <div class="span9">
<div> <div>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class=""><a href="/author/newdata">未提交数据列表</a></li> <li class=""><a href="/author/newdata">未提交数据列表</a></li>
<li class=""><a class="iframe" href="/service/geonetwork?url=metadata.xmlinsert.form">导入元数据</a></li> <li class=""><a class="iframe" href="/service/geonetwork?url=metadata.xmlinsert.form">导入元数据</a></li>
<li class=""><a href="/author/newdata/ac/add-by-template">根据模板新建元数据</a></li> <li class=""><a href="/author/newdata/ac/add-by-template">根据模板新建元数据</a></li>
<li class="active"><a href="/author/newdata/ac/add-by-data">根据已有数据新建元数据</a></li> <li class="active"><a href="/author/newdata/ac/add-by-data">根据已有数据新建元数据</a></li>
</ul> </ul>
</div> </div>
<div> <div>
<h2>根据已有数据创建元数据</h2> <h2>根据已有数据创建元数据</h2>
<form id="datasearch" class="search_form" action="/author/newdata/ac/add-by-data"> <div class="input-append">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" /> <form id="datasearch" class="search_form" action="/author/newdata/ac/add-by-data">
<button type="submit" class="btn" id="search_btn">搜索</button> <input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
</form> <button type="submit" class="btn" id="search_btn">搜索</button>
<?php </form>
if (count($this->paginator)): </div>
echo '<ul class="unstyled">'; <?php
$autoindex=0; if (count($this->paginator)):
foreach ($this->paginator as $item): echo '<ul class="unstyled">';
$autoindex++; $autoindex=0;
?> foreach ($this->paginator as $item):
<li class="well"> $autoindex++;
<h4><?php echo $item['title'];?></h4> ?>
<p><a href="/service/geonetwork?url=metadata.create?group=2<?php echo urlencode('&id='.$item['gid']); ?>" target="_blank">以此为模板新建</a> <li class="well">
| <a href="/data/<?php echo $item['uuid'];?>" target="_blank">查看数据</a></p> <h4><?php echo $item['title'];?></h4>
<p><?php echo mb_strlen($item['description'])>400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?></p> <p><a href="/service/geonetwork?url=metadata.create?group=2<?php echo urlencode('&id='.$item['gid']); ?>" target="_blank">以此为模板新建</a>
</li> | <a href="/data/<?php echo $item['uuid'];?>" target="_blank">查看数据</a></p>
<?php <p><?php echo mb_strlen($item['description'])>400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?></p>
endforeach; </li>
echo "</ul>"; <?php
endif; ?> endforeach;
</div> echo "</ul>";
<div class="pagenavi"><?= $this->paginator; ?></div> endif; ?>
</div>
</div> <div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<script> </div>
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"}); </div>
$('#wapper').width($('body').width()-300); <script>
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
$('#wapper').width($('body').width()-300);
</script> </script>

View File

@ -1,42 +1,41 @@
<?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->headScript()->appendFile('/js/jquery-1.7.min.js'); $this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/author.css'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('<a href="/author">数据作者</a>'); $this->breadcrumb('查看数据作者');
$this->breadcrumb('查看数据作者'); $this->breadcrumb()->setSeparator(' > ');
$this->breadcrumb()->setSeparator(' > '); ?>
?> <div class="row">
<div class="row"> <div class="span3">
<div class="span3"> <?= $this->partial('author/navi.phtml'); ?>
<?= $this->partial('author/navi.phtml'); ?> </div>
</div> <div class="span9">
<div class="span9">
<?php
<?php if(!empty($this->error))
if(!empty($this->error)) {
{ echo $this->error;
echo $this->error; }
} ?>
?> <h3><a href="/data/<?php echo $this->datas[0]['uuid']; ?>"><?php echo $this->datas[0]['title']; ?></a> </h3>
<h3><a href="/data/<?php echo $this->paginator[0]['uuid']; ?>"><?php echo $this->paginator[0]['title']; ?></a> </h3> <div class="well">
<div class="well"> <?php
<?php if (count($this->paginator)):
if (count($this->paginator)): echo "<ul>";
echo "<ul>"; $autoindex=0;
$autoindex=0; foreach ($this->paginator as $item):
foreach ($this->paginator as $item): $autoindex++;?>
$autoindex++;?> <li>
<li> <p><?php echo $item['realname'];?> (<?php echo $item['email'];?>)</p>
<p><?php echo $item['realname'];?> (<?php echo $item['email'];?>)</p> <p>单位:<?php echo $item['unit'];?></p>
<p>单位:<?php echo $item['unit'];?></p> </li>
</li> <?php endforeach;
<?php endforeach; echo "</ul>";
echo "</ul>"; endif; ?>
endif; ?> </div>
</div> <div class="pagenavi"><?= $this->paginator; ?></div>
<div class="pagenavi"><?= $this->paginator; ?></div> </div>
</div>
</div> </div>