diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 56072932..10d95ea8 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -654,7 +654,7 @@ class DataController extends Zend_Controller_Action { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); - $uuid=$this->_request->getParam('uuid'); + $uuid=$this->_request->getParam('uuid'); if (empty($uuid)) die(); $sql="select * from comments where uuid=? order by id desc"; $comments=$this->db->fetchAll($sql,array($uuid)); @@ -669,7 +669,143 @@ class DataController extends Zend_Controller_Action print "
".$author." 发表于".date('Y-m-d H:i:s',strtotime($c['ts_created']))."

".($c['content'])."

"; } }//else echo "
  • No comments.
  • "; - } + } + + function creatform($datas) { + return ' +
    温馨提示:您需要填写以下信息才可以下载该数据
    +
    + + + + + + + + +
    真实姓名
    单位名称
    联系电话
    联系地址
    邮政编码
    电子邮箱
    项目说明
    + 请您填写完整的数据用途信息,包括项目类型、编号、题目、负责人等信息;若仅用于论文写作,请告知研究题目或主要内容,并注明导师姓名;其他用途如实注明即可。清晰明确的数据用途有助于我们更快得审核和通过申请,也会使您更快获得数据!
    + 例一:
    + 项目类型:973
    + 项目名称:飞行终端区复杂场景建模的理论与方法子课题:基于多源遥感影像的目标和场景三维重建研究
    + 项目编号:2010CB731801
    + 项目负责人:邵振峰
    + 使用目的:用于模拟基于多源遥感影像的目标和场景
    +
    + 例二:
    + 硕士毕业论文:《全波形激光雷达数据处理研究》,导师:李传荣研究员。
    + + +
    '; + } + /* + * 判断用户是否填写了申请信息 + * @param string $uuid + * @param int $userid + */ + function todownloadAction() { + + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $uuid = $this->_request->getParam('uuid'); + $ft = $this->_request->getParam('ft'); + + if (empty($uuid)) $this->_redirect('/data'); + + $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'); + + $userid=Zend_Auth::getInstance()->getIdentity()->id; + + $form=$this->creatform($datas); + + if (!empty($submited) && $ft==0){ + + foreach($datas as $k=>$v) + { + if(empty($v)) + { + echo $form.''; + exit(); + } + $datas[$k]=preg_replace("/\"/i","'",$v); + } + + if(!is_numeric($datas['postcode'])) + { + echo $form.''; + exit(); + } + + if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email'])) + { + echo $form.''; + exit(); + } + + $sql="insert into onlineapp (userid,username,unit,phone,address,postcode,project,uuid,email) + values ('$userid','{$datas['username']}','{$datas['unit']}','{$datas['phone']}','{$datas['address']}','{$datas['postcode']}','{$datas['project']}','$uuid','{$datas['email']}') + "; + + if($this->db->exec($sql)) + { + echo "您的信息已经提交成功,可以进行下载。
    + 如果页面没有自动跳转,请点击这里进入下载页面 + "; + 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']; + + 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']; + + echo $this->creatform($datas); + exit(); + } + } + + } + /* * 数据下载,根据UUID进行判断 * 一次只下载一个数据(一个元数据项) @@ -679,6 +815,18 @@ class DataController extends Zend_Controller_Action $uuid=$this->_request->getParam('uuid'); if (empty($uuid)) $this->_redirect('/data'); $userid=Zend_Auth::getInstance()->getIdentity()->id; + /* + * 判断用户是否浑水摸鱼的去下载 + + $testsql="select id from onlineapp where userid='$userid' and uuid='$uuid'"; + $result=$this->db->query($sql,$id); + $rows = $result->fetch(); + if (empty($rows['id'])) + { + $this->_redirect('/data/'.$uuid); + } + */ + // block end! $this->view->username='westdc'.Zend_Auth::getInstance()->getIdentity()->id; $sql=$this->db->quoteInto("select o.* from onlineresource o left join metadata m on o.uuid=m.uuid where m.datatype=0 and m.uuid=?",$uuid); $rows=$this->db->fetchAll($sql); diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml index e20f5472..31af2d62 100755 --- a/application/default/views/scripts/data/view.phtml +++ b/application/default/views/scripts/data/view.phtml @@ -14,7 +14,7 @@ $this->headScript()->appendFile('/js/prototype.js'); $this->headScript()->appendFile('/js/OpenLayers.js'); - $this->headScript()->appendFile('/js/window.js'); + $this->headScript()->appendFile('/js/window.js'); $this->headLink()->appendStylesheet('/js/theme/default/style.css'); ?> metadata;if ($md):?> @@ -97,7 +97,7 @@ else
    datatype) : ?> - +
    @@ -252,30 +252,6 @@ echo '';

    数据评论

    - commentForm; ?> @@ -290,8 +266,42 @@ function reportError(request) - +