remove unused code in todownload action and translation

This commit is contained in:
wlx 2013-11-11 06:32:58 +00:00
parent 7bc34ff31c
commit 3bf1e7015b
2 changed files with 17 additions and 310 deletions

View File

@ -940,311 +940,18 @@ class DataController extends Zend_Controller_Action
}//else echo "<li>No comments.</li>"; }//else echo "<li>No comments.</li>";
}//评论列表 }//评论列表
/** /** * 判断用户是否填写了申请信息 * @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; }
* @param string $uuid 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;
* @param int $userid $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; } }
function todownloadAction() { if(!is_numeric($datas['postcode'])) { $this->view->error = "Phone and zip code must be number."; return true; }
$this->view->pageID = "account-dataorder"; 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; }
$this->_helper->viewRenderer('onlineapp-download'); $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.<a href=\"".$this->view->jump_url."\"> Or click here to visit the download url.</a>"; $msg = "用户{$data['username']} 填写了在线数据申请表 <a href=\"/admin/down/online/show/{$row['id']}\">查看详细</a>"; $title = "用户 {$data['username']} 申请了在线下载数据"; include_once("message.php"); message::post($this->db,0,-1,$title,$msg);
$this->view->uuid = $uuid = $this->_request->getParam('uuid'); 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; }
$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)){
$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 = "您的信息已经提交成功,可以进行下载。请等待页面自动跳转,<a href=\"".$this->view->jump_url."\">或点击这里进入下载页面</a>";
$msg = "用户{$data['username']} 填写了在线数据申请表 <a href=\"/admin/down/online/show/{$row['id']}\">查看详细</a>";
$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.'<script>alert("每一项内容都需要填写")</script>';
exit();
}
}
if(!is_numeric($datas['postcode']))
{
echo $form.'<script>alert("联系电话和邮政编码请填写数字")</script>';
exit();
}
if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
{
echo $form.'<script>alert("请填写正确的email地址")</script>';
exit();
}
if(mb_strlen($datas['project'],"utf-8")<8)
{
echo $form.'<script>alert("项目介绍内容不少于8个字符")</script>';
exit();
}
if(preg_match('/^\d+$/',$datas['project']))
{
echo $form.'<script>alert("请输入有意义的项目介绍内容")</script>';
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 "您的信息已经提交成功,可以进行下载。<br />
如果页面没有自动跳转,<a href='/data/download/uuid/$uuid/onlineappid/{$row['id']}'>请点击这里进入下载页面</a>
<script>self.location='/data/download/uuid/$uuid/onlineappid/{$row['id']}'</script>";
$msg = "用户{$data['username']} 填写了在线数据申请表 <a href=\"/admin/down/online/show/{$row['id']}\">查看详细</a>";
$title = "用户 {$data['username']} 申请了在线下载数据";
include_once("message.php");
message::post($this->db,0,-1,$title,$msg);
exit();
}
else {
echo $form.'<script>alert("服务器忙,请重试")</script>';
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();
}
}
}
/* /*
* 数据下载根据UUID进行判断 * 数据下载根据UUID进行判断

View File

@ -1,10 +1,10 @@
<ul class="nav nav-list"> <ul class="nav nav-list">
<li class="nav-header">应用</li> <li class="nav-header">App</li>
<li id="Nav-account-dataorder"><a href="/data/order">数据篮</a></li> <li id="Nav-account-dataorder"><a href="/data/order">Data Cart</a></li>
<!-- <li id="Nav-account-myfav"><a href="/account/myfav">我的收藏</a></li> --> <!-- <li id="Nav-account-myfav"><a href="/account/myfav">我的收藏</a></li> -->
<li class="nav-header">账户</li> <li class="nav-header">Account</li>
<li id="Nav-account-index"><a href="/account">账户信息</a></li> <li id="Nav-account-index"><a href="/account">Account info</a></li>
<li id="Nav-account-secure"><a href="/account/secure">安全性</a></li> <li id="Nav-account-secure"><a href="/account/secure">Security</a></li>
<li id="Nav-account-edit"><a href="/account/edit">设置</a></li> <li id="Nav-account-edit"><a href="/account/edit">Setting</a></li>
<!-- <li><a href="/account/linkin">关联账号</a></li> --> <!-- <li><a href="/account/linkin">关联账号</a></li> -->
</ul> </ul>