westdc-zf1/application/default/controllers/AboutController.php

107 lines
3.6 KiB
PHP
Executable File

<?php
class AboutController extends Zend_Controller_Action
{
function indexAction()
{
}
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
$this->db=Zend_Registry::get('db');
$this->view->pageID = "about-".$this->_request->getActionName();
}
function contactAction()
{
$form=new ContactForm();
$this->view->form=$form;
$this->view->addHelperPath('helper','Zend_View_Helper_');
if ($this->_request->isPost()) {
//发送邮件
$formData=$this->_request->getPost();
include_once("bcspamblock.php");
if (bcspamblock_verify() && $form->isValid($formData)) {
$mail=new Zend_Mail('utf-8');
$mail->setFrom($formData['email'],$formData['username']);
$mail->setBodyText($formData['body']);
$mail->setSubject($formData['subject']);
$mail->addTo($this->view->config->supportemail);
$mail->send();
$this->messenger->addMessage('发送成功!');
$this->_redirect('/about/contact');
}
} else {
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$user=$auth->getIdentity();
$formData['username']=($user->realname)?$user->realname:$user->username;
$formData['email']=$user->email;
$form->populate($formData);
}
}
}
function termsAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('使用条款和免责声明');
}
function backgroundAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('发展历史');
}
function legalAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('隐私政策');
}
function supportusAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('支持我们');
}
function copyrightAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('数据与版权');
}
function linkAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('友情链接');
}
function honorAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('服务成效');
}
function sponsorsAction()
{
$archives=new Archive($this->db);
$this->view->item=$archives->getAboutArchive('支持项目');
}
function publicationAction()
{
$ac = $this->_request->getParam("ac");
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
if(empty($ac))
{
$sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? and mr.reftype=0 order by r.year desc,r.title asc";
$sth = $this->db->prepare($sql);
$sth->execute(array($siteid));
$rows = $sth->fetchAll();
} elseif ($ac=='patent' || $ac=='report') {
$archives=new Archive($this->db);
$rows=$archives->getArchive($ac);
$this->_helper->viewRenderer($ac);
}
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
}