diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php
index 1643f52e..6521abfb 100755
--- a/application/default/controllers/DataController.php
+++ b/application/default/controllers/DataController.php
@@ -940,311 +940,18 @@ class DataController extends Zend_Controller_Action
}//else echo "
No comments.";
}//评论列表
- /**
- * 判断用户是否填写了申请信息
- * @param string $uuid
- * @param int $userid
- */
- function todownloadAction() {
-
- $this->view->pageID = "account-dataorder";
-
- $this->_helper->viewRenderer('onlineapp-download');
-
- $this->view->uuid = $uuid = $this->_request->getParam('uuid');
-
- $auth = Zend_Auth::getInstance();
- if (!$auth->hasIdentity())
- {
- $this->view->AlertType = "alert-error";
- $this->view->msg = "请先登录您的账户后进行下载,页面将自动跳转";
- $this->view->jump_url = '/account/login/?href=/data/todownload/uuid/'.$uuid;
- return true;
- }
-
- if(empty($uuid))
- {
- $this->view->AlertType = "alert-error";
- $this->view->msg = "参数错误!";
- $this->view->jump_url = "/data";
- return true;
- }
-
- $this->view->projectType = array(
- "请选择项目类型" => "",
- "国家973计划项目课题" => "国家973计划项目课题",
- "国家863计划课题"=>"国家863计划课题",
- "国家级科技支撑课题" => "国家级科技支撑课题",
- "国家级科技重大专项" => "国家级科技重大专项",
- "国家级国家重大工程" => "国家级国家重大工程",
- "国家级国家自然科学基金" => "国家级国家自然科学基金",
- "国际合作项目"=>"国际合作项目",
- "省部级项目" => "省部级项目",
- "其他项目工程" => "其他项目工程",
- );
-
- $userid = Zend_Auth::getInstance()->getIdentity()->id;
-
- $submit = $this->_getParam('submit');
- if(!empty($submit)){
+ /**
* 判断用户是否填写了申请信息
* @param string $uuid
* @param int $userid
*/
function todownloadAction() {
$this->view->pageID = "account-dataorder";
$this->_helper->viewRenderer('onlineapp-download');
$this->view->uuid = $uuid = $this->_request->getParam('uuid');
+ $auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity())
{
$this->view->AlertType = "alert-error";
$this->view->msg = "Please login first.";
$this->view->jump_url = '/account/login/?href=/data/todownload/uuid/'.$uuid;
return true;
}
+ if(empty($uuid))
{
$this->view->AlertType = "alert-error";
$this->view->msg = "Wrong Parameter.";
$this->view->jump_url = "/data";
return true;
}
$this->view->projectType = array(
"Choose Funding type" => "",
"National Funding" => "National Funding",
"Thesis or Dissertation"=>"Thesis or Dissertation",
"Others" => "Others",
);
$userid = Zend_Auth::getInstance()->getIdentity()->id;
+ $submit = $this->_getParam('submit');
if(!empty($submit)){
$datas = array();
$datas['realname'] = $this->_request->getParam('realname');
$datas['unit'] = $this->_request->getParam('unit');
$datas['phone'] = $this->_request->getParam('phone');
$datas['address'] = $this->_request->getParam('address');
$datas['postcode'] = $this->_request->getParam('postcode');
$datas['email'] = $this->_request->getParam('email');
$datas['project'] = $this->_request->getParam('project');
$datas['project_id'] = $this->_request->getParam('project_id');
$datas['project_type'] = $this->_request->getParam('project_type');
$datas['project_title'] = $this->_request->getParam('project_title');
$datas['project_leader']= $this->_request->getParam('project_leader');
$this->view->info = $datas;
+ $this->view->AlertType = "alert-error";
foreach($datas as $k=>$v)
{
if(empty($v))
{
$this->view->error = "Every input could not be empty.";
return true;
}
}
+ if(!is_numeric($datas['postcode']))
{
$this->view->error = "Phone and zip code must be number.";
return true;
}
- $datas = array();
- $datas['realname'] = $this->_request->getParam('realname');
- $datas['unit'] = $this->_request->getParam('unit');
- $datas['phone'] = $this->_request->getParam('phone');
- $datas['address'] = $this->_request->getParam('address');
- $datas['postcode'] = $this->_request->getParam('postcode');
- $datas['email'] = $this->_request->getParam('email');
- $datas['project'] = $this->_request->getParam('project');
- $datas['project_id'] = $this->_request->getParam('project_id');
- $datas['project_type'] = $this->_request->getParam('project_type');
- $datas['project_title'] = $this->_request->getParam('project_title');
- $datas['project_leader']= $this->_request->getParam('project_leader');
-
- $this->view->info = $datas;
-
- $this->view->AlertType = "alert-error";
-
- foreach($datas as $k=>$v)
- {
- if(empty($v))
- {
- $this->view->error = "每一项内容都需要填写";
- return true;
- }
- }
-
- if(!is_numeric($datas['postcode']))
- {
- $this->view->error = "联系电话和邮政编码请填写数字";
- return true;
- }
-
- if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
- {
- $this->view->error = "请填写正确的email地址";
- return true;
- }
-
- if(mb_strlen($datas['project'],"utf-8")<8)
- {
- $this->view->error = "项目介绍内容不少于8个字符";
- return true;
- }
-
- if(preg_match('/^\d+$/',$datas['project']))
- {
- $this->view->error = "请输入有意义的项目介绍内容";
- return true;
- }
-
- $data = array(
- 'userid' => $userid,
- 'username' => $datas['realname'],
- 'unit' => $datas['unit'],
- 'phone' => $datas['phone'],
- 'address' => $datas['address'],
- 'postcode' => $datas['postcode'],
- 'project' => $datas['project'],
- 'uuid' =>$uuid,
- 'email' =>$datas['email'],
- 'project_id'=>$datas['project_id'],
- 'project_title'=>$datas['project_title'],
- 'project_type'=>$datas['project_type'],
- 'project_leader'=>$datas['project_leader']
- );
-
- if($this->db->insert('onlineapp',$data))
- {
- $select = "select id from onlineapp where userid='$userid' order by id desc";
- $re=$this->db->query($select);
- $row=$re->fetch();
-
- $this->view->AlertType = "alert-success";
- $this->view->jump_url = '/data/download/uuid/'.$uuid.'/onlineappid/'.$row['id'];
- $this->view->msg = "您的信息已经提交成功,可以进行下载。请等待页面自动跳转,view->jump_url."\">或点击这里进入下载页面";
-
- $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细";
- $title = "用户 {$data['username']} 申请了在线下载数据";
- include_once("message.php");
- message::post($this->db,0,-1,$title,$msg);
-
- return true;
- }
- else {
- $this->view->AlertType = "alert-error";
- $this->view->error = "申请失败,请稍后重新尝试";
- $this->view->info = $data;
- return true;
- }
-
- return true;
- }else{
-
- $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
- $result=$this->db->query($testsql);
- $rows = $result->fetch();
- if (empty($rows['id']))
- {
- include_once("Users.php");
- $usr = new Users($this->db);
- $this->view->info = $usr->getUserInfo($userid);
- return true;
- }
- else
- {
- $datas['realname'] = $rows['username'];
- $datas['unit'] = $rows['unit'];
- $datas['phone'] = $rows['phone'];
- $datas['address'] = $rows['address'];
- $datas['postcode'] = $rows['postcode'];
- $datas['email'] = $rows['email'];
- $datas['project'] = $rows['project'];
- $datas['project_id'] = $rows['project_id'];
- $datas['project_type'] = $rows['project_type'];
- $datas['project_title'] = $rows['project_title'];
- $datas['project_leader'] = $rows['project_leader'];
- $this->view->info = $datas;
- return true;
- }
- }
-
- return true;
-
- $userid=Zend_Auth::getInstance()->getIdentity()->id;
-
- $datas = array();
- $submited = $this->_request->getParam('submited');
- $datas['username'] = $this->_request->getParam('username');
- $datas['unit'] = $this->_request->getParam('unit');
- $datas['phone'] = $this->_request->getParam('phone');
- $datas['address'] = $this->_request->getParam('address');
- $datas['postcode'] = $this->_request->getParam('postcode');
- $datas['email'] = $this->_request->getParam('email');
- $datas['project'] = $this->_request->getParam('project');
- $datas['project_id'] = $this->_request->getParam('projectid');
- $datas['project_type'] = $this->_request->getParam('projecttype');
- $datas['project_title'] = $this->_request->getParam('projecttitle');
- $datas['project_leader'] = $this->_request->getParam('projectleader');
-
-
-
- $form=$this->creatform($datas);
-
- if (!empty($submited) && $ft==0){
-
- foreach($datas as $k=>$v)
- {
- if($v == '')
- {
- echo $form.'';
- exit();
- }
- }
-
- if(!is_numeric($datas['postcode']))
- {
- echo $form.'';
- exit();
- }
-
- if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
- {
- echo $form.'';
- exit();
- }
-
- if(mb_strlen($datas['project'],"utf-8")<8)
- {
- echo $form.'';
- exit();
- }
-
- if(preg_match('/^\d+$/',$datas['project']))
- {
- echo $form.'';
- exit();
- }
-
- $data = array(
- 'userid' => $userid,
- 'username' => $datas['username'],
- 'unit' => $datas['unit'],
- 'phone' => $datas['phone'],
- 'address' => $datas['address'],
- 'postcode' => $datas['postcode'],
- 'project' => $datas['project'],
- 'uuid' =>$uuid,
- 'email' =>$datas['email'],
- 'project_id'=>$datas['project_id'],
- 'project_title'=>$datas['project_title'],
- 'project_type'=>$datas['project_type'],
- 'project_leader'=>$datas['project_leader']
- );
-
- if($this->db->insert('onlineapp',$data))
- {
- $select = "select id from onlineapp where userid='$userid' order by id desc";
- $re=$this->db->query($select);
- $row=$re->fetch();
- echo "您的信息已经提交成功,可以进行下载。
- 如果页面没有自动跳转,请点击这里进入下载页面
- ";
- $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细";
- $title = "用户 {$data['username']} 申请了在线下载数据";
- include_once("message.php");
- message::post($this->db,0,-1,$title,$msg);
- exit();
- }
- else {
- echo $form.'';
- exit();
- }
-
- }else if( $ft==1 )
- {
- $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
- $result=$this->db->query($testsql);
- $rows = $result->fetch();
- if (empty($rows['id']))
- {
- $sql="select * from users where id='$userid'";
- $result=$this->db->query($sql);
- $rows = $result->fetch();
-
- $datas['username'] = $rows['realname'];
- $datas['unit'] = $rows['unit'];
- $datas['phone'] = $rows['phone'];
- $datas['address'] = $rows['address'];
- $datas['postcode'] = $rows['postcode'];
- $datas['email'] = $rows['email'];
- $datas['project'] = $rows['project'];
- $datas['project_id'] = $rows['project_id'];
- $datas['project_type'] = $rows['project_type'];
- $datas['project_title'] = $rows['project_title'];
- $datas['project_leader'] = $rows['project_leader'];
- echo $this->creatform($datas);
- exit();
- }
- else
- {
- $datas['username'] = $rows['username'];
- $datas['unit'] = $rows['unit'];
- $datas['phone'] = $rows['phone'];
- $datas['address'] = $rows['address'];
- $datas['postcode'] = $rows['postcode'];
- $datas['email'] = $rows['email'];
- $datas['project'] = $rows['project'];
- $datas['project_id'] = $rows['project_id'];
- $datas['project_type'] = $rows['project_type'];
- $datas['project_title'] = $rows['project_title'];
- $datas['project_leader'] = $rows['project_leader'];
- echo $this->creatform($datas);
- exit();
- }
- }
-
- }
+ if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
{
$this->view->error = "Please correct your email";
return true;
}
+ if(mb_strlen($datas['project'],"utf-8")<8)
{
$this->view->error = "The content of the fund must large than 8 chars.";
return true;
}
if(preg_match('/^\d+$/',$datas['project']))
{
$this->view->error = "Please input the content of the fund.";
return true;
}
+ $data = array(
'userid' => $userid,
'username' => $datas['realname'],
'unit' => $datas['unit'],
'phone' => $datas['phone'],
'address' => $datas['address'],
'postcode' => $datas['postcode'],
'project' => $datas['project'],
'uuid' =>$uuid,
'email' =>$datas['email'],
'project_id'=>$datas['project_id'],
'project_title'=>$datas['project_title'],
'project_type'=>$datas['project_type'],
'project_leader'=>$datas['project_leader']
);
+ if($this->db->insert('onlineapp',$data))
{
$select = "select id from onlineapp where userid='$userid' order by id desc";
$re=$this->db->query($select);
$row=$re->fetch();
$this->view->AlertType = "alert-success";
$this->view->jump_url = '/data/download/uuid/'.$uuid.'/onlineappid/'.$row['id'];
$this->view->msg = "You are successful submit your online data download information, just wait a moment to auto jump to the download url.view->jump_url."\"> Or click here to visit the download url.";
$msg = "用户{$data['username']} 填写了在线数据申请表 查看详细";
$title = "用户 {$data['username']} 申请了在线下载数据";
include_once("message.php");
message::post($this->db,0,-1,$title,$msg);
+ return true;
}else {
$this->view->AlertType = "alert-error";
$this->view->error = "Failure.";
$this->view->info = $data;
return true;
}
return true;
}else{
$testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
$result=$this->db->query($testsql);
$rows = $result->fetch();
if (empty($rows['id']))
{
include_once("Users.php");
$usr = new Users($this->db);
$this->view->info = $usr->getUserInfo($userid);
return true;
}else{
$datas['realname'] = $rows['username'];
$datas['unit'] = $rows['unit'];
$datas['phone'] = $rows['phone'];
$datas['address'] = $rows['address'];
$datas['postcode'] = $rows['postcode'];
$datas['email'] = $rows['email'];
$datas['project'] = $rows['project'];
$datas['project_id'] = $rows['project_id'];
$datas['project_type'] = $rows['project_type'];
$datas['project_title'] = $rows['project_title'];
$datas['project_leader'] = $rows['project_leader'];
$this->view->info = $datas;
return true;
}
}
return true;
}
/*
* 数据下载,根据UUID进行判断
diff --git a/application/default/views/scripts/account/left.phtml b/application/default/views/scripts/account/left.phtml
index 8608f255..19a539a1 100644
--- a/application/default/views/scripts/account/left.phtml
+++ b/application/default/views/scripts/account/left.phtml
@@ -1,10 +1,10 @@
\ No newline at end of file