#443 将黑河数据汇交计划管理功能移动到datacontroller并添加class Heihe
This commit is contained in:
parent
6d73b502b2
commit
4f0f8e3ad2
|
@ -9,6 +9,7 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$this->view->messages = $this->messenger->getMessages();
|
||||
$this->debug = 1; //1:debug, 0:release
|
||||
$this->debug_email='wangliangxu@lzb.ac.cn';
|
||||
$this->view->theme = new Theme();
|
||||
}
|
||||
function postDispatch()
|
||||
{
|
||||
|
@ -2875,10 +2876,10 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
$this->_helper->viewRenderer('newdata-add-bydata');
|
||||
}
|
||||
//元数据格式检查
|
||||
else if ($ac=="validate")
|
||||
{
|
||||
}
|
||||
//元数据格式检查
|
||||
else if ($ac=="validate")
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
|
@ -2888,19 +2889,19 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$sth=$this->db->prepare($sql);
|
||||
$sth->execute(array($id));
|
||||
$row=$sth->fetch();
|
||||
|
||||
|
||||
$iso=new ISO19115();
|
||||
@$iso->loadXML($row['data']);
|
||||
if ($iso->validate())
|
||||
{
|
||||
$data=array("error"=>"元数据中发现错误。<br />".implode("<br />",$iso->error));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
} else {
|
||||
$data=array("error"=>"元数据中没有发现错误。<br />");
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
@$iso->loadXML($row['data']);
|
||||
if ($iso->validate())
|
||||
{
|
||||
$data=array("error"=>"元数据中发现错误。<br />".implode("<br />",$iso->error));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
} else {
|
||||
$data=array("error"=>"元数据中没有发现错误。<br />");
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//提交数据
|
||||
else if($ac=="commit")
|
||||
|
@ -2989,6 +2990,463 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
|
||||
}// newdataAction() 新建元数据
|
||||
|
||||
/*
|
||||
* projectsAction() 数据汇交计划
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function projectAction()
|
||||
{
|
||||
include_once("Heihe.php");
|
||||
$heihe = new Heihe($this->db);
|
||||
|
||||
$this->view->input_NameDefaultVal = "专家姓名";
|
||||
$this->view->input_EmailDefaultVal = "专家email";
|
||||
|
||||
$projectTable = $heihe->tbl_heiheproject;
|
||||
|
||||
$ac = $this->_getParam('ac');
|
||||
|
||||
if(empty($ac) || $ac == "index")
|
||||
{
|
||||
$this->_helper->viewRenderer('project');
|
||||
|
||||
//Search Link
|
||||
$this->view->searchLink = "/admin/heihe/project/ac/index/";
|
||||
|
||||
$q = $this->_getParam('q');
|
||||
|
||||
$wheresql = array();
|
||||
|
||||
if(!empty($q))
|
||||
{
|
||||
$wheresql[] = " (title LIKE '%$q%' OR
|
||||
code LIKE '%$q%' OR
|
||||
name LIKE '%$q%' OR
|
||||
email LIKE '%$q%')";
|
||||
$this->view->searchKeyword = $q;
|
||||
}
|
||||
|
||||
if(count($wheresql)>0)
|
||||
{
|
||||
$wheresql = join(" AND ",$wheresql);
|
||||
}else{
|
||||
$wheresql = "";
|
||||
}
|
||||
|
||||
if(!empty($wheresql))
|
||||
{
|
||||
$wheresql = " WHERE ".$wheresql;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM $projectTable $wheresql
|
||||
ORDER BY id ASC";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
foreach ($rows as $k=>$v)
|
||||
{
|
||||
$rows[$k]['status_alias'] = $heihe->getStatus($v['status']);
|
||||
}
|
||||
|
||||
$this->view->Count = count($rows);
|
||||
|
||||
$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;
|
||||
|
||||
$this->view->project_status = $heihe->project_status;
|
||||
|
||||
return true;
|
||||
}//ac == index
|
||||
|
||||
//邀请专家
|
||||
if($ac == "invite")
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$pid = $this->_getParam('id');
|
||||
$name = $this->_getParam('name');
|
||||
$email = $this->_getParam('email');
|
||||
|
||||
if(!is_numeric($pid))
|
||||
{
|
||||
$this->jsonexit(array("error"=>"参数错误"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(empty($name) || $name == $this->view->input_NameDefaultVal)
|
||||
{
|
||||
$this->jsonexit(array("error"=>"请输入专家姓名"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(empty($email) || $email == $this->view->input_EmailDefaultVal)
|
||||
{
|
||||
$this->jsonexit(array("error"=>"请输入专家Email"));
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM $projectTable WHERE id=$pid";
|
||||
$sth = $this->db->query($sql);
|
||||
$row = $sth->fetch();
|
||||
|
||||
$expert_name = $this->getArray($row['expert_name']);
|
||||
$expert_email = $this->getArray($row['expert_email']);
|
||||
$expert_validation = $this->getArray($row['expert_validation']);
|
||||
$expert_created = $this->getArray($row['expert_created']);
|
||||
|
||||
$name_list = array();
|
||||
$email_list = array();
|
||||
$validation_list = array();
|
||||
$created_list = array();
|
||||
|
||||
if(is_array($expert_name) && count($expert_name)>0)
|
||||
{
|
||||
if(in_array($name,$expert_name))
|
||||
{
|
||||
$this->jsonexit(array("error"=>"该专家的姓名已经存在"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($expert_email) && count($expert_email)>0)
|
||||
{
|
||||
if(in_array($email,$expert_email))
|
||||
{
|
||||
$this->jsonexit(array("error"=>"该专家的Email已经存在"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$expert_name[] = $name;
|
||||
$expert_email[] = $email;
|
||||
$code = substr(md5($email),5,12);
|
||||
$expert_validation[] = $code;
|
||||
$expert_created[] = date("Y-m-d H:i:s",time());
|
||||
|
||||
|
||||
$name_list = $this->mkArray($expert_name);
|
||||
$email_list = $this->mkArray($expert_email);
|
||||
$validation_list = $this->mkArray($expert_validation);
|
||||
$created_list = $this->mkArray($expert_created);
|
||||
|
||||
$update = array(
|
||||
"expert_name"=>$name_list,
|
||||
"expert_email"=>$email_list,
|
||||
"expert_validation"=>$validation_list,
|
||||
"expert_created"=>$created_list
|
||||
);
|
||||
$where = "id=$pid";
|
||||
|
||||
if($this->db->update($projectTable,$update,$where))
|
||||
{
|
||||
$this->sendMailToExpert($pid,$name,$email,$code);
|
||||
$this->jsonexit(array("msg"=>"专家邀请成功!","invited"=>1));
|
||||
return true;
|
||||
}else{
|
||||
$this->jsonexit(array("error"=>"邀请失败,请重试"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}// 邀请专家
|
||||
|
||||
if($ac == "showexpert")
|
||||
{
|
||||
$del = $this->_getParam('del');
|
||||
|
||||
if(isset($del))
|
||||
{
|
||||
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
}else{
|
||||
$this->_helper->layout->setLayout('layout-iframe');
|
||||
$this->_helper->viewRenderer('project-showexpert');
|
||||
}
|
||||
|
||||
$pid = $this->_getParam('id');
|
||||
|
||||
if(empty($pid) || !is_numeric($pid))
|
||||
{
|
||||
$this->view->error = "参数错误";
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->view->pid = $pid;
|
||||
|
||||
$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']);
|
||||
|
||||
$experts = array();
|
||||
|
||||
foreach($names as $k=>$v)
|
||||
{
|
||||
$experts[$k] = array(
|
||||
"name"=>$names[$k],
|
||||
"email"=>$emails[$k],
|
||||
"validation"=>$validations[$k],
|
||||
"created"=>$created[$k],
|
||||
"url"=>$this->makeInviteLink($pid,$validations[$k])
|
||||
);
|
||||
}
|
||||
|
||||
$this->view->experts = $experts;
|
||||
|
||||
$del = $this->_getParam('del');
|
||||
|
||||
if(isset($del))
|
||||
{
|
||||
|
||||
if(!is_numeric($del))
|
||||
{
|
||||
$this->jsonexit(array("error"=>"参数错误"));
|
||||
return true;
|
||||
}
|
||||
|
||||
unset($names[$del]);
|
||||
unset($emails[$del]);
|
||||
unset($validations[$del]);
|
||||
unset($created[$del]);
|
||||
|
||||
$update = array(
|
||||
"expert_name"=>$this->mkArray($names),
|
||||
"expert_email"=>$this->mkArray($emails),
|
||||
"expert_validation"=>$this->mkArray($validations),
|
||||
"expert_created"=>$this->mkArray($created),
|
||||
);
|
||||
$where = "id=$pid";
|
||||
|
||||
if($this->db->update($projectTable,$update,$where))
|
||||
{
|
||||
$this->jsonexit(array("deleted"=>1));
|
||||
return true;
|
||||
}else{
|
||||
$this->jsonexit(array("error"=>"邀请失败,请重试"));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}//ac == showexpert 查看跟踪专家
|
||||
|
||||
if($ac == "upload")
|
||||
{
|
||||
$this->_helper->layout->setLayout('layout-iframe');
|
||||
$this->_helper->viewRenderer('project-upload');
|
||||
|
||||
$submit = $this->_getParam('submit');
|
||||
|
||||
$pid = $this->_getParam('pid');
|
||||
|
||||
if(empty($pid) || !is_numeric($pid))
|
||||
{
|
||||
$this->view->error = "参数错误";
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->view->pid = $pid;
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$uid = $user->id;
|
||||
}
|
||||
|
||||
if(!empty($submit) && empty($this->view->error))
|
||||
{
|
||||
|
||||
$files=new files();
|
||||
$msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],'heihe');
|
||||
|
||||
if(empty($msg['error']))
|
||||
{
|
||||
$msg['error']="";
|
||||
$filename = $msg['db_path'];
|
||||
$filesize = $msg['file_size'];
|
||||
$filedesc = $this->_request->getParam('filedesc');
|
||||
$filetype = $msg['file_type'];
|
||||
$realname = $msg['realname'];
|
||||
|
||||
if(!empty($row['attachid']))
|
||||
{
|
||||
$sql = "SELECT * FROM attachments WHERE id={$row['attachid']}";
|
||||
$sth = $this->db->query($sql);
|
||||
$attach = $sth->fetch();
|
||||
$this->db->exec("DELETE FROM attachments WHERE id={$row['attachid']} AND filetype='heihe'");
|
||||
@unlink($this->view->config->upload.$attach['filename']);
|
||||
}
|
||||
|
||||
$sql = " INSERT INTO attachments (filename,filetype,filedesc,userid,filesize,realname) values
|
||||
('$filename','heihe','$filedesc','$uid','$filesize','$realname') RETURNING id";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$att = $sth->fetch(PDO::FETCH_ASSOC);
|
||||
$msg['attid'] = $attid = $att['id'];
|
||||
|
||||
$sql = "UPDATE heiheproject SET attachid=$attid WHERE id=$pid";
|
||||
$sth = $this->db->exec($sql);
|
||||
|
||||
if($sth)
|
||||
{
|
||||
$this->view->message = "上传成功";
|
||||
}else{
|
||||
@unlink($filename);
|
||||
$this->view->error = '附件上传失败:写入附件表出错';
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
@unlink($filename);
|
||||
$this->view->error = "附件上传失败".$msg['error'];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM heiheproject WHERE id=$pid";
|
||||
$sth = $this->db->query($sql);
|
||||
$row = $sth->fetch();
|
||||
|
||||
if(!empty($row['attachid']))
|
||||
{
|
||||
$sql = "SELECT * FROM attachments WHERE id = {$row['attachid']}";
|
||||
$sth = $this->db->query($sql);
|
||||
$this->view->att = $sth->fetch();
|
||||
}
|
||||
|
||||
return true;
|
||||
}//ac == upload
|
||||
|
||||
//改变状态
|
||||
if($ac == "changestatus")
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$project = $this->_getParam('p');
|
||||
$status = $this->_getParam('s');
|
||||
|
||||
if(!is_numeric($status))
|
||||
{
|
||||
$this->jsonexit(array('error'=>'参数错误'));
|
||||
return true;
|
||||
}
|
||||
|
||||
$code = $heihe->ChangeStatus($project,$status);
|
||||
|
||||
if($code > 0)
|
||||
{
|
||||
$this->jsonexit(
|
||||
array(
|
||||
'msg'=>'修改成功!',
|
||||
'status'=>$heihe->getStatus($status)
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}else{
|
||||
$this->jsonexit(array('error'=>'参数错误'));
|
||||
return true;
|
||||
}
|
||||
|
||||
}//ac == "changestatus"
|
||||
|
||||
}//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 sendMailToExpert($pid,$name,$email,$code)
|
||||
{
|
||||
$url = $this->makeInviteLink($pid,$code);
|
||||
|
||||
include_once("EmailText.php");
|
||||
$mailtp=new EmailText($this->db,"expert-invite",array(
|
||||
'name' => $name,
|
||||
'url' => $url,
|
||||
));
|
||||
//Email test code
|
||||
|
||||
/*
|
||||
$mail_config = array(
|
||||
'ssl' => 'ssl',
|
||||
'port' => 465,
|
||||
'auth' => 'login',
|
||||
'username' => 'la5c@qq.com',
|
||||
'password' => ''
|
||||
);
|
||||
$transport = new Zend_Mail_Transport_Smtp('smtp.qq.com', $mail_config);
|
||||
Zend_Mail::setDefaultTransport($transport);
|
||||
|
||||
$mail=new Zend_Mail();
|
||||
$mail->setBodyText($mailtp->getBody());
|
||||
$mail->setFrom('la5c@qq.com','Jack');
|
||||
$mail->addTo($email);
|
||||
$mail->setSubject($mailtp->getSubject());
|
||||
$mail->send();
|
||||
*/
|
||||
|
||||
$mail=new WestdcMailer($this->view->config->smtp);
|
||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||
$mail->setBodyText($mailtp->getBody());
|
||||
$mail->setSubject($mailtp->getSubject());
|
||||
$mail->addTo($email);
|
||||
$mail->send();
|
||||
}//发送邀请邮件
|
||||
|
||||
//生成邀请连接
|
||||
function makeInviteLink($pid,$code)
|
||||
{
|
||||
$http_base = "http://".$_SERVER ['HTTP_HOST'];
|
||||
$url = $http_base."/heihe/projects/invite/".$code.'/pid/'.$pid;
|
||||
return $url;
|
||||
}//生成邀请连接
|
||||
|
||||
/*
|
||||
获得单个文件的信息
|
||||
|
|
|
@ -16,4 +16,5 @@
|
|||
<li><a href="/admin/data/newsletter">数据中心通讯管理</a></li>
|
||||
<li><a href="/admin/data/feature">特色推荐</a></li>
|
||||
<li><a href="/admin/data/source">项目来源管理</a></li>
|
||||
<li><a href="/admin/data/project">汇交计划</a></li>
|
||||
</ul>
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle('后台管理');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/admin.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/heihe">黑河数据集</a>');
|
||||
$this->breadcrumb('黑河数据集');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
||||
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
||||
$this->headLink()->appendStylesheet('/css/author.css');
|
||||
?>
|
||||
<?php
|
||||
if(!empty($this->error))
|
||||
{
|
||||
echo $this->error;
|
||||
echo "<script>setTimeout('parent.$.fn.colorbox.close();',2000);</script>";
|
||||
}else{?>
|
||||
<div class="content" id="datalist">
|
||||
<ul>
|
||||
<?php
|
||||
foreach($this->experts as $k=>$v)
|
||||
{
|
||||
echo '<li id="item_'.$k.'"><p>'.$v['name'] ." - ".
|
||||
$v['email'].' - '.
|
||||
$v['validation'].' - '.
|
||||
str_replace("\"","",$v['created']) .'
|
||||
<lable id="delBtn_'.$k.'">
|
||||
【<a href="javascript:void(0);" onclick="del(\''.$k.'\')">删除</a>】</lable</p>
|
||||
<p>邀请链接:'.$v['url'].'</p>
|
||||
</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
function del(id){
|
||||
var dom = "#delBtn_"+id;
|
||||
var html = $(dom).html();
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/admin/heihe/project/ac/showexpert',
|
||||
'data':'id=<?= $this->pid;?>&del='+id,
|
||||
'success':function(data){
|
||||
if (typeof(data)=='object')
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{Alert(data.error);return false;}
|
||||
if(typeof(data.msg)!='undefined')
|
||||
{Alert(data.msg);}
|
||||
if(typeof(data.deleted)!='undefined')
|
||||
{$('#item_'+id).fadeOut(function(){$(this).remove();});}
|
||||
}
|
||||
else{
|
||||
Alert('出现错误,请稍后再试');
|
||||
}
|
||||
},
|
||||
'timeout': 30000,
|
||||
'error': function(){Alert('处理中出现错误,请刷新页面后重试');},
|
||||
'beforeSend':function(){$(dom).html('<img src="/images/ajax-load-small.gif" />');$(dom).attr("disabled","disabled")},
|
||||
'complete':function(){$(dom).html(html);$(dom).removeAttr("disabled");dom = null;}
|
||||
});
|
||||
}
|
||||
function Alert(html){
|
||||
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
|
||||
}
|
||||
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle('上传计划');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/admin.css');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
||||
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
||||
$this->headLink()->appendStylesheet('/css/author.css');
|
||||
$this->headScript()->appendFile('/static/js/uploadify/swfobject.js');
|
||||
$this->headScript()->appendFile('/static/js/uploadify/jquery.uploadify.v2.1.4.min.js');
|
||||
$this->headLink()->appendStylesheet('/static/js/uploadify/uploadify.css');
|
||||
?>
|
||||
<?php
|
||||
if(!empty($this->error))
|
||||
{
|
||||
echo $this->error;
|
||||
echo "<script>setTimeout('parent.$.fn.colorbox.close();',2000);</script>";
|
||||
}else{?>
|
||||
<?php if(!empty($this->message))
|
||||
{
|
||||
echo "<p>".$this->message."</p>";
|
||||
}?>
|
||||
<?php
|
||||
if(!empty($this->att))
|
||||
{
|
||||
echo '<div id="datalist">
|
||||
<ul>'.
|
||||
'<li>'.$this->att['realname']."(". round(($this->att['filesize'])/1024,2) .'KB) 【<a href="/service/attach/id/'.$this->att['id'].'">下载</a>】</li>'
|
||||
.'</ul></div>';
|
||||
}
|
||||
?>
|
||||
<div id="wapper">
|
||||
<form id="fileUpdate" action="/admin/heihe/project/ac/upload/pid/<?= $this->pid ?>" method="post" enctype="multipart/form-data">
|
||||
<p>注:只能选择一个文件,如果重新上传,将自动替换之前上传的文件<br />
|
||||
<input id="file_upload" name="Filedata" type="file" />
|
||||
<input type="hidden" name="submit" value="1" />
|
||||
<input type="submit" class="btn btn-small btn-green" value="上传" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle('后台管理');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/admin.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('黑河数据集');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->theme->AppendPlus($this,'jquery');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
$this->headLink()->appendStylesheet('/css/author.css');
|
||||
?>
|
||||
<div id="leftPanel">
|
||||
<?= $this->partial('data/left.phtml'); ?>
|
||||
</div>
|
||||
<div id="rightPanel">
|
||||
<?php if(!empty($this->searchLink)){ ?>
|
||||
<div>
|
||||
<form id="datasearch" class="search_form" action="<?= $this->searchLink ?>">
|
||||
<input type="text" id="keyword" name="q" value="<?= $this->searchKeyword; ?>" />
|
||||
<button type="submit" class="btn" id="search_btn">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div>
|
||||
共 <?= $this->Count; ?> 条记录
|
||||
</div>
|
||||
<div id="datalist">
|
||||
<?php
|
||||
if (count($this->paginator)):
|
||||
echo "<ul>";
|
||||
$autoindex=0;
|
||||
foreach ($this->paginator as $item):
|
||||
$autoindex++;
|
||||
?>
|
||||
<li>
|
||||
<p><span class="title"><?php echo $item['title'];?></span></p>
|
||||
<p>编号:<label><?= $item['code'];?></label> | 负责人:<?= $item['name'];?> | 开始时间:<?= $item['pstart'];?> |
|
||||
状态:<span id="status_alias_<?= $item['id']?>"><?= $item['status_alias'];?></span></p>
|
||||
<p>
|
||||
<a href="javascript:void(0);" onclick="$('#inviteFrom_<?= $item['id'];?>').toggle();">邀请跟踪专家</a> |
|
||||
<a class="iframe" href="/admin/data/project/ac/showexpert/id/<?= $item['id'];?>">查看跟踪专家</a> |
|
||||
<a href="/admin/data/project/ac/upload/pid/<?= $item['id']?>" class="iframe">上传计划</a> |
|
||||
<a href="javascript:void(0);" onclick="changeStatus(<?= $item['id'];?>,<?= $item['status']?>)">状态修改</a>
|
||||
</p>
|
||||
<p id="inviteFrom_<?= $item['id'];?>" style="display:none;">
|
||||
<input type="text" id="expert_name_<?= $item['id'];?>" value="<?= $this->input_NameDefaultVal ?>"
|
||||
onfocus="if(this.value=='<?= $this->input_NameDefaultVal ?>'){this.value=''}" onblur="if(this.value==''){this.value='<?= $this->input_NameDefaultVal ?>'}" />
|
||||
<input type="text" id="expert_email_<?= $item['id'];?>" value="<?= $this->input_EmailDefaultVal ?>"
|
||||
onfocus="if(this.value=='<?= $this->input_EmailDefaultVal ?>'){this.value=''}" onblur="if(this.value==''){this.value='<?= $this->input_EmailDefaultVal ?>'}" />
|
||||
<button type="button" class="btn btn-green" onclick="invite(<?= $item['id'];?>)" id="inviteBtn_<?= $item['id'];?>">邀请</button>
|
||||
</p>
|
||||
</li>
|
||||
<?php
|
||||
endforeach;
|
||||
echo "</ul>";
|
||||
endif; ?>
|
||||
</div>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
<div style="display:none;">
|
||||
<div id="confirm_dialog" class="cbox_content">
|
||||
<div class="sepH_c tac"><strong>状态修改</strong></div>
|
||||
<div id="cbox_dialog_content" class="sepH_c">
|
||||
<select id="status_selector" style="width:300px;" name="">
|
||||
<?php
|
||||
foreach($this->project_status as $k=>$v)
|
||||
{
|
||||
echo '<option value="'.$k.'">'.$v.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="tac" id="cbox_ctl_btns">
|
||||
<a href="javascript:void(0);" class="btn btn-green" id="confirm_yes"
|
||||
onclick="changeStatusAction($('#status_selector').attr('name'),$('#status_selector').val());">OK</a>
|
||||
<a href="javascript:void(0);" class="btn" id="confirm_no" onclick="$.colorbox.close();">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function changeStatus(project,status)
|
||||
{
|
||||
$('#status_selector').attr('name',project);
|
||||
$.colorbox({
|
||||
initialHeight: '0',
|
||||
initialWidth: '0',
|
||||
href: "#confirm_dialog",
|
||||
inline: true,
|
||||
opacity: '0.7'
|
||||
});
|
||||
}
|
||||
|
||||
function changeStatusAction(project,code)
|
||||
{
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/admin/data/project/ac/changestatus',
|
||||
'data':'p='+project + '&s='+code,
|
||||
'success':function(data){
|
||||
if (typeof(data)=='object')
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{Alert(data.error);return false;}
|
||||
if(typeof(data.msg)!='undefined')
|
||||
{Alert(data.msg);}
|
||||
if(typeof(data.status)!='undefined')
|
||||
{$('#status_alias_'+project).html(data.status);}
|
||||
}
|
||||
else{
|
||||
Alert('出现错误,请稍后再试');
|
||||
}
|
||||
},
|
||||
'timeout': 30000,
|
||||
'error': function(){Alert('处理中出现错误,请刷新页面后重试');}
|
||||
});
|
||||
}
|
||||
|
||||
function invite(id){
|
||||
var dom = "#inviteBtn_"+id;
|
||||
var html = $(dom).html();
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/admin/data/project/ac/invite',
|
||||
'data':'id='+id+'&name='+$('#expert_name_'+id).val()+'&email='+$('#expert_email_'+id).val(),
|
||||
'success':function(data){
|
||||
if (typeof(data)=='object')
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{Alert(data.error);return false;}
|
||||
if(typeof(data.msg)!='undefined')
|
||||
{Alert(data.msg);}
|
||||
if(typeof(data.invited)!='undefined')
|
||||
{$('#expert_name_'+id).val('');$('#expert_email_'+id).val('');}
|
||||
}
|
||||
else{
|
||||
Alert('出现错误,请稍后再试');
|
||||
}
|
||||
},
|
||||
'timeout': 30000,
|
||||
'error': function(){Alert('处理中出现错误,请刷新页面后重试');},
|
||||
'beforeSend':function(){$(dom).html('<img src="/images/ajax-load-small.gif" />');$(dom).attr("disabled","disabled")},
|
||||
'complete':function(){$(dom).html(html);$(dom).removeAttr("disabled");dom = null;}
|
||||
});
|
||||
}
|
||||
function Alert(html){
|
||||
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
|
||||
}
|
||||
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
|
||||
</script>
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* Heihe 黑河项目通用类
|
||||
*/
|
||||
|
||||
class Heihe
|
||||
{
|
||||
|
||||
private $db;//传入PDO对象
|
||||
|
||||
//使用到的公共变量
|
||||
public $tbl_heiheproject = "heiheproject" ; //黑河项目表
|
||||
public $tbl_heiheuser = "heiheuser"; //黑河用户表
|
||||
public $project_status; //汇交项目计划状态
|
||||
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->project_status = array(
|
||||
0 => "计划未提交",
|
||||
1 => "计划未审核",
|
||||
2 => "跟踪专家审核",
|
||||
3 => "跟踪专家通过",
|
||||
4 => "数据委员会通过"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取汇交状态
|
||||
public function getStatus($code){
|
||||
|
||||
$status = $this->project_status;
|
||||
|
||||
if(isset($status[$code]))
|
||||
{
|
||||
return $status[$code];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//改变状态
|
||||
public function ChangeStatus($p,$s){
|
||||
|
||||
$sql = "UPDATE ".$this->tbl_heiheproject." SET status=? WHERE id=?";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
|
||||
$rs = $sth->execute(array($s,$p));
|
||||
|
||||
return $rs;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -84,4 +84,8 @@ q {quotes:none;}
|
|||
q:before, q:after {content:'';}
|
||||
q cite {display:block;font-size:14px;color:#444;}
|
||||
q {display:block;font-style:normal;quotes:"" "";background:url("../images/quote.png") no-repeat scroll 0 8px transparent;display:block;font-size:14px;min-height:14px;padding:0 0 0 0px;color:#666;
|
||||
font-family:Georgia,"Times New Roman",Times,serif;margin:1em 0;}
|
||||
font-family:Georgia,"Times New Roman",Times,serif;margin:1em 0;}
|
||||
|
||||
.sepH_c {margin-bottom:20px}
|
||||
.tac {text-align:center}
|
||||
#confirm_dialog{margin:20px;}
|
Loading…
Reference in New Issue