调整表结构,移除EmailText使用

This commit is contained in:
wlx 2011-10-12 13:45:45 +00:00
parent 748a6f7f53
commit b2d402ee6b
1 changed files with 16 additions and 32 deletions

View File

@ -36,12 +36,12 @@ class Admin_SysController extends Zend_Controller_Action
if($ac=='add' && !empty($submit))
{
$title = $this->_request->getParam('title');
$description = $this->_request->getParam('description');
$template = $this->_request->getParam('template');
$body = $this->_request->getParam('body');
if(empty($title)) $title=='未命名模板';
$sql = "insert into emailtext (title,description,content,ts_create) values ('$title','$description','$body','".time()."')";
$sql = "insert into emailtext (subject,template,body) values ('$title','$template','$body')";
try{
if($this->db->exec($sql)>0)
@ -60,10 +60,10 @@ class Admin_SysController extends Zend_Controller_Action
if(!empty($submit))
{
$title = $this->_request->getParam('title');
$description = $this->_request->getParam('description');
$template = $this->_request->getParam('template');
$body = $this->_request->getParam('body');
$sql = "update emailtext set title='$title',description='$description',content='$body' where id='$id'";
$sql = "update emailtext set subject='$title',template='$template',body='$body',ts_changed=now() where id='$id'";
try{
if($this->db->exec($sql)>0)
@ -77,13 +77,9 @@ class Admin_SysController extends Zend_Controller_Action
}
}else{
$sql = "select * from emailtext where id='$id'";
$rs = $this->db->query($sql);
$rows = $rs->fetch();
$this->view->info = $rows;
$this->_helper->viewRenderer('emailtextedit');
}
@ -94,24 +90,11 @@ class Admin_SysController extends Zend_Controller_Action
if(!empty($submit))
{
try{
$mailbody=new emailtext();
$mailbody->db = $this->db;
$mailbody->tmpid = $id;
$mailbody->data = array(
'user' => $this->_request->getParam('user')
);
$body=$mailbody->loadtmp();
if($body){
$body;
}else{
$this->messenger->addMessage('模板加载出错');
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
}
$subject = $this->_request->getParam('title');
$email = $this->_request->getParam('email');
if(empty($subject)||empty($email))
$subject = $this->_request->getParam('subject');
$email = $this->_request->getParam('email');
$body = $this->_request->getParam('body');
$body=str_replace("[username]",$this->_request->getParam('user'),$body);
if(empty($subject) || empty($email))
{
$this->messenger->addMessage('请填写测试邮件发送信息');
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
@ -120,7 +103,6 @@ class Admin_SysController extends Zend_Controller_Action
$mail->setBodyText($body);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$body.=date("H:i:s",time());
$mail->addTo($email);
$mail->setSubject($subject);
@ -134,12 +116,14 @@ class Admin_SysController extends Zend_Controller_Action
}catch(Exception $e){
$this->messenger->addMessage('测试邮件发送失败'.$e->getMessage());
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
}
}
}
else
{
$this->view->id = $id;
{
$sql = "select * from emailtext where id='$id'";
$rs = $this->db->query($sql);
$rows = $rs->fetch();
$this->view->info = $rows;
$this->_helper->viewRenderer('emailtexttest');
}
@ -147,7 +131,7 @@ class Admin_SysController extends Zend_Controller_Action
else
{
$sql = "select id,title,userid,ts_create,description,usetimes from emailtext";
$sql = "select id,subject,template,ts_created,ts_changed from emailtext";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();