#416 修改黑河计划前台页面,增加负责人的计划上传功能

This commit is contained in:
Li Jianxuan 2012-11-12 09:57:42 +00:00
parent 568203006b
commit 46c006ccea
2 changed files with 145 additions and 4 deletions

View File

@ -743,11 +743,20 @@ class HeiheController extends DataController
$ac = $this->_getParam('ac');
$invite = $this->_getParam('invite');
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uid = $user->id;
$this->view->user_email = $user_email = $user->email;
}
if(empty($ac) || $ac == "index")
{
$this->_helper->viewRenderer('project-index');
$sql = "SELECT * FROM heiheproject";
$sql = "SELECT * FROM heiheproject
ORDER BY id DESC";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll();
@ -767,19 +776,95 @@ class HeiheController extends DataController
if($ac == "submitting")
{
$this->_helper->viewRenderer('project-index');
$sql = "SELECT * FROM heiheproject WHERE status<4";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll();
foreach ($rows as $k=>$v)
{
$rows[$k]['status'] = $this->replacestatus($v['status']);
}
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}//ac == submitting 正在提交
if($ac == "unsubmit")
{
$this->_helper->viewRenderer('project-index');
$sql = "SELECT * FROM heiheproject WHERE attachid IS NULL OR attachid=0";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll();
foreach ($rows as $k=>$v)
{
$rows[$k]['status'] = $this->replacestatus($v['status']);
}
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}//ac == unsubmit 未提交
if($ac == "submit")
{
$this->_helper->viewRenderer('project-index');
$sql = "SELECT * FROM heiheproject WHERE status=4";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll();
foreach ($rows as $k=>$v)
{
$rows[$k]['status'] = $this->replacestatus($v['status']);
}
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}//ac == submit 已提交
if($ac == "upload")
{
$pid = $this->_getParam('pid');
if(empty($pid) || !is_numeric($pid))
{
$this->view->error = "参数错误";
return true;
}
if(empty($uid))
{
$this->view->error = "请先登录";
return true;
}
$sql = "SELECT * FROM heiheproject WHERE id=$pid";
$sth = $this->db->query($sql);
$row = $sth->fetch();
if($row['email']!= $user_email)
{
$this->view->error = "您没有权限进行此操作";
return true;
}
}
if(!empty($invite))
{
@ -805,13 +890,61 @@ class HeiheController extends DataController
return true;
}
$sql = "SELECT * FROM $projectTable WHERE id=$pid";
$sth = $this->db->query($sql);
$row = $sth->fetch();
if(empty($row['expert_name']))
{
$this->view->error = "此项目尚未邀请跟踪专家";
return true;
}
$names = $this->getArray($row['expert_name']);
$emails = $this->getArray($row['expert_email']);
$validations = $this->getArray($row['expert_validation']);
$created = $this->getArray($row['expert_created']);
if(!in_array($validations))
{
$this->view->error = "您不在被邀请的专家名单内";
return true;
}
}//专家邀请链接
}//projectsAction()
//从pgsql读取数组并拆分为php数组
function getArray($str){
if(strlen($str)>3)
{
return explode(",",substr($str,1,-1));
}else{
return NULL;
}
}
//将php数组组装成pgsql中的数组
function mkArray($array){
if(!is_array($array))
{
return "{".$array."}";
}
if(count($array)==1)
{
$key = max(array_keys($array));
return "{".$array[$key]."}";
}
if(count($array)>1)
{
return "{".join(",",$array)."}";
}
}
function replacestatus($status)
{
if($status == 0)

View File

@ -25,9 +25,10 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
<div style="overflow:hidden;">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata">正在提交</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata/do/add">未提交</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/project/ac/commited">已提交</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/projects/">所有项目</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/projects/ac/submitting">正在提交</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/projects/ac/unsubmit">未提交</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/projects/ac/submit">已提交</a></li>
</ul>
</div>
<div id="datalist">
@ -41,6 +42,13 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
<li>
<p><span class="title"><?php echo $item['title'];?></span></p>
<p>编号:<label><?= $item['code'];?></label> | 负责人:<?= $item['name'];?> | 开始时间:<?= $item['pstart'];?> | 状态:<?= $item['status'];?></p>
<?php
if($this->user_email == $item['email'])
{ ?>
<p><a href="/heihe/projects/ac/upload/pid/<?= $item['id']?>" class="iframe">上传计划</a></p>
<?php }
?>
</li>
<?php
endforeach;