为元数据评审前台控制器添加php风格文档

This commit is contained in:
Li Jianxuan 2012-01-13 09:12:02 +00:00
parent 56ede4a5d6
commit 6a66c49a71
1 changed files with 151 additions and 8 deletions

View File

@ -1,4 +1,12 @@
<?php
/**
* ReviewController
*
* @description 元数据评审控制器
* @version 2012/1/13 15:42
* @category Controller
* @package ReviewController
*/
class ReviewController extends Zend_Controller_Action
{
private $limit=10;
@ -9,6 +17,11 @@ class ReviewController extends Zend_Controller_Action
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
}
/*
* indexAction() 元数据评审首页
*/
function indexAction()
{
//最新10个收稿
@ -26,8 +39,14 @@ class ReviewController extends Zend_Controller_Action
//统计数字
$sql="select (select count(*) from mdexperts) as experts,(select count(*) from mdstatus where status=0) as draft,(select count(*) from mdstatus where status=1) as accept,(select count(*) from mdstatus where status in (2,3,4)) as inreview,(select count(*) from mdstatus where status=5) as reviewed,(select count(*) from mdreview) as openreview,(select count(distinct(userid)) from mdreview) as openreviewuser";
$this->view->stat=$this->db->fetchRow($sql);
}
}// 元数据评审首页
/*
* myreviewAction() 我参数的元数据
*
* 通过用户ID来获得此列表未登录用户无权限浏览该页面
*/
function myreviewAction(){
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
@ -51,6 +70,14 @@ class ReviewController extends Zend_Controller_Action
}
}//我参审的
/*
* draftAction() 最新收稿的元数据
*
* [@param $page int]
*
* mdstatus 中status 字段值为 0 的元数据为收稿元数据
*/
function draftAction(){
$page=@(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
@ -62,6 +89,14 @@ class ReviewController extends Zend_Controller_Action
$this->view->page=new Pagination($sum,$page,$this->limit);
}//最新收稿
/*
* acceptAction() 最新进入评审的元数据
*
* [@param $page int]
*
* mdstatus status 字段值为 1 的元数据为进入评审的元数据
*/
function acceptAction(){
$page=@(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
@ -71,8 +106,16 @@ class ReviewController extends Zend_Controller_Action
$sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (1) order by s.ts_created desc,m.title limit ? offset ?";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
}//最新收稿
}
/*
* inreviewAction() 在审元数据
*
* [@param $page(int)]
*
* mdstatus status 字段值为 2,3,4 的元数据为正在进行评审的元数据
*/
function inreviewAction(){
$page=@(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
@ -85,6 +128,13 @@ class ReviewController extends Zend_Controller_Action
}//在审阶段的元数据
/*
* reviewedAction() 已通过评审的元数据
*
* [@param $page int]
*
* mdstatus status 字段值为 5 的元数据为已经通过评审的元数据
*/
function reviewedAction(){
$page=@(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
@ -97,6 +147,13 @@ class ReviewController extends Zend_Controller_Action
}//已完成评审的元数据
/*
* rewritestatus() 将评审状态转化为文字说明
*
* @param $status int
*
* return string
*/
function rewritestatus($status){
if($status==-1)
{return "取消评审";}
@ -116,6 +173,14 @@ class ReviewController extends Zend_Controller_Action
{return "";}
}//function rewriterstatus
/*
* replace() 重写表单中提交的html数据
*
* @param $string string
*
* return string
*/
function replace($string){
$patterns = array("/\"/i","/\'/i");
$replacements = array("","");
@ -124,6 +189,14 @@ class ReviewController extends Zend_Controller_Action
return preg_replace($patterns, $replacements, $string);
}
/*
* reviewAction() 元数据评审页面
*
* @param $uuid uuid
*
* return view
*/
function reviewAction() {
$uuid = $this->_request->getParam('uuid');
@ -145,6 +218,17 @@ class ReviewController extends Zend_Controller_Action
}
}//reviewAction()
/*
* allreviewAction() 列出所有评审意见
*
* @param $uuid uuid
* @param $page int default 0
*
* return string
*
* 使用ajax输出所有评审意见UUID为数据评审页面的uuid参数。包含列表的html标签包含分页代码
* 分页模板review/pagination_ajax.phtml
*/
function allreviewAction(){
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
@ -207,6 +291,24 @@ class ReviewController extends Zend_Controller_Action
}//allreviewAction() 所有评论 ajax
/*
* saveAction() 保存/提交评审意见
*
* @param $do string //空值或其它时为存草稿submit为提交到后台
* @param $conclusion int //总体意见
* @param $mdcomment string //给元数据意见
* @param $datacomment string //给数据中心意见
* @param $editorcomment string //给元数据作者意见
* @param $att array[] //附件
* @param $uuid uuid
*
* return string
*
* ajax保存、提交元数据评审意见返回提示html提示信息
* 当用户未删除附件直接离开页面会产生冗余因为附件没有即时删除是否在离开事件中添加ajax删除未提交的附件)
* 评审成功后发送邮件到系统邮箱,并为后台推送管理员消息
*/
function saveAction(){
$this->_helper->layout->disableLayout();
@ -383,6 +485,14 @@ class ReviewController extends Zend_Controller_Action
}// saveAction 存草稿 ajax
/*
* searchAction() 搜索
*
* @param $key string
*
* 搜索包含输入关键词的评审元数据
*/
function searchAction()
{
$key=$this->_request->getParam('q');
@ -431,6 +541,16 @@ class ReviewController extends Zend_Controller_Action
{
}
/*
* attlistAction() 元数据评审附件列表
*
* @param $rid status //元数据评审意见的ID
*
* return string
*
* ajax获得评审意见的附件列表输出html
*/
function attlistAction()
{
@ -482,6 +602,17 @@ class ReviewController extends Zend_Controller_Action
}// ajax 评审附件列表
/*
* downattAction() 附加下载
*
* @param $id int //附件ID
*
* return file
*
* 判断附件类型后输出相应下载
* 如果输出html错误提示需要输出完整的html页面
*/
function downattAction(){
$this->_helper->layout->disableLayout();
@ -563,6 +694,18 @@ class ReviewController extends Zend_Controller_Action
}// downattAction 下载附件
/*
* denyinviteAction() 专家拒绝邀请
*
* @param id int //用户ID
* @param uuid uuid //元数据UUID
*
* return view->message
*
* 要求专家后会发送通知邮件到专家邮箱,邮箱中包含拒绝邀请的链接
* 链接地址 /review/denyinvite/id/{userid}/uuid/{uuid}
*/
function denyinviteAction()
{