增加了系统管理控制器

修改了导航栏
Ticket #193 增加了邮件模板管理功能
This commit is contained in:
Li Jianxuan 2011-10-11 10:06:51 +00:00
parent e6db135f41
commit 7da6f12c04
7 changed files with 596 additions and 26 deletions

View File

@ -0,0 +1,124 @@
<?php
class Admin_SysController extends Zend_Controller_Action
{
function preDispatch()
{
$this->db=Zend_Registry::get('db');
$this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
$this->_helper->layout->setLayout('administry');//新UI
}
function postDispatch()
{
$this->view->messages = $this->messenger->getMessages();
}
function indexAction()
{
//$this->_helper->viewRenderer('');
//$this->messenger->addMessage('');
//$this->_redirect('');
}//indexAction 首页
function emailtextAction(){
$ac = $this->_request->getParam('ac');
$submit = $this->_request->getParam('submit');
$id = $this->_request->getParam('id');
if($ac=='add' && !empty($submit))
{
$title = $this->_request->getParam('title');
$description = $this->_request->getParam('description');
$body = $this->_request->getParam('body');
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
}
if(empty($title)) $title=='未命名模板';
$sql = "insert into emailtext (title,description,content,userid,ts_create) values ('$title','$description','$body','$userid','".time()."')";
try{
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('模板添加成功');
$this->_redirect('/admin/sys/emailtext');
}
}catch(Exception $e){
$this->messenger->addMessage('模板添加失败:'.$e->getMessage());
$this->_redirect('/admin/sys/emailtext');
}
}//创建新模板
else if($ac=='edit'&& !empty($id))
{
if(!empty($submit))
{
$title = $this->_request->getParam('title');
$description = $this->_request->getParam('description');
$body = $this->_request->getParam('body');
$sql = "update emailtext set title='$title',description='$description',content='$body' where id='$id'";
try{
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('模板编辑成功');
$this->_redirect('/admin/sys/emailtext');
}
}catch(Exception $e){
$this->messenger->addMessage('模板编辑失败:'.$e->getMessage());
$this->_redirect('/admin/sys/emailtext');
}
}//模板编辑
else if($ac=='test'&& !empty($id))
{
if(!empty($submit))
{
$this->_helper->viewRenderer('emailtext_test');
}
}//模板测试
else
{
$sql = "select * from emailtext where id='$id'";
$rs = $this->db->query($sql);
$rows = $rs->fetch();
$this->view->info = $rows;
$this->_helper->viewRenderer('emailtext_edit');
}//模板列表
}
else
{
$sql = "select id,title,userid,ts_create,description,usetimes from emailtext";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}//邮件模板管理首页
}//emailtextAction 邮件模板管理
}

View File

@ -12,6 +12,7 @@
<li><a href="/admin/review"><span>元数据评审</span></a></li>
<li><a href="/admin/news"><span>新闻中心</span></a></li>
<li><a href="/admin/stat"><span>统计数据</span></a></li>
<li><a href="/admin/sys"><span>系统管理</span></a></li>
</ul>
<div id="userNavi">
<?php

View File

@ -0,0 +1,148 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.dataTables.min.js');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>系统管理</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('sys/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<?php if ($this->msg or $this->messages) :?>
<div class="box box-info">
<?php if ($this->msg) : ?>
<?php echo $this->msg; ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php echo $msg; ?>
<?php endforeach;endif; ?>
<script language="javascript">
setTimeout('$(".box-info").remove()',5000);
</script>
</div>
<?php endif; ?>
<div id="tabs">
<ul>
<li><a class="corner-tl" href="#tabs-1">邮件模板</a></li>
<li><a class="" href="#tabs-2">创建新模板</a></li>
<li><a class="corner-tr" href="#tabs-3" id="showhelp">模板编辑说明</a></li>
</ul>
<div id="tabs-1">
<table id="report" class="stylized full" style="">
<thead>
<tr>
<th width="50%">模板名称</th>
<th width="50%">管理</th>
</tr>
</thead>
<tbody>
<?php if (count($this->paginator)): ?>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td class="title">
<div><a href="#"><b><?php echo $item['title'];?></b></a>
<div class="listingDetails">
<div class="pad">
<ul>
<li>模板说明:<?php echo $item['description'];?></li>
<li>创建时间:<?php echo date("Y-m-d H:i",$item['ts_create']);?></li>
<li>使用次数: <?php echo $item['usetimes'];?></li>
</ul>
</div>
</div>
</div>
</td>
<td>
<a href="/admin/sys/emailtext/ac/del/id/<?php echo $item['id'];?>">删除</a> |
<a href="/admin/sys/emailtext/ac/edit/id/<?php echo $item['id'];?>">查看更改</a> |
<a href="/admin/sys/emailtext/ac/test/id/<?php echo $item['id'];?>">发送测试</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?></div>
</div>
<div id="tabs-2">
<h3>创建新邮件模板</h3>
<form name="form" method="post" action="/admin/sys/emailtext/">
<input type="hidden" name="ac" value="add" />
<input type="hidden" name="submit" value="1" />
<fieldset>
<p>
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half title" value="" name="title"/>
</p>
<p>
<label for="description">介绍</label><br/>
<textarea id="description" class="small half" name="description"></textarea>
</p>
<p>
<label for="body">模板内容</label><br/>
<textarea id="body" class="large full" name="body"></textarea>
<small><a href="javascript:showhelp();">查看说明?</a></small>
</p>
<p class="box"><input type="submit" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
</div>
<div id="tabs-3">
<p>
</p>
</div>
</div>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript">
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
/* expandable rows */
Administry.expandableRows();
/* nav */
$('#nav_sys').addClass("current");
/* tabs */
$("#tabs").tabs();
});
function showhelp(){$('#showhelp').click();}
</script>

View File

@ -0,0 +1,76 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>系统管理</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('sys/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<h3>邮件模板编辑</h3>
<form name="form" method="post" action="/admin/sys/emailtext/">
<input type="hidden" name="ac" value="edit" />
<input type="hidden" name="submit" value="1" />
<input type="hidden" name="id" value="<?php echo $this->info['id'];?>" />
<fieldset>
<p>
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half title" value="<?php echo $this->info['title'];?>" name="title"/>
</p>
<p>
<label for="description">介绍</label><br/>
<textarea id="description" class="small half" name="description"><?php echo $this->info['description'];?></textarea>
</p>
<p>
<label for="body">模板内容</label><br/>
<textarea id="body" class="large full" name="body"><?php echo $this->info['content'];?></textarea>
<small><a href="javascript:showhelp();">查看说明?</a></small>
</p>
<p class="box"><input type="submit" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<img src="http://designerz-crew.info/start/callb.png">
<script type="text/javascript">
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
$('#nav_sys').addClass("current");
});
</script>

View File

@ -0,0 +1,148 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.dataTables.min.js');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>系统管理</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('sys/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<?php if ($this->msg or $this->messages) :?>
<div class="box box-info">
<?php if ($this->msg) : ?>
<?php echo $this->msg; ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php echo $msg; ?>
<?php endforeach;endif; ?>
<script language="javascript">
setTimeout('$(".box-info").remove()',5000);
</script>
</div>
<?php endif; ?>
<div id="tabs">
<ul>
<li><a class="corner-tl" href="#tabs-1">邮件模板</a></li>
<li><a class="" href="#tabs-2">创建新模板</a></li>
<li><a class="corner-tr" href="#tabs-3" id="showhelp">模板编辑说明</a></li>
</ul>
<div id="tabs-1">
<table id="report" class="stylized full" style="">
<thead>
<tr>
<th width="50%">模板名称</th>
<th width="50%">管理</th>
</tr>
</thead>
<tbody>
<?php if (count($this->paginator)): ?>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td class="title">
<div><a href="#"><b><?php echo $item['title'];?></b></a>
<div class="listingDetails">
<div class="pad">
<ul>
<li>模板说明:<?php echo $item['description'];?></li>
<li>创建时间:<?php echo date("Y-m-d H:i",$item['ts_create']);?></li>
<li>使用次数: <?php echo $item['usetimes'];?></li>
</ul>
</div>
</div>
</div>
</td>
<td>
<a href="/admin/sys/emailtext/ac/del/id/<?php echo $item['id'];?>">删除</a> |
<a href="/admin/sys/emailtext/ac/edit/id/<?php echo $item['id'];?>">查看更改</a> |
<a href="/admin/sys/emailtext/ac/test/id/<?php echo $item['id'];?>">发送测试</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?></div>
</div>
<div id="tabs-2">
<h3>创建新邮件模板</h3>
<form name="form" method="post" action="/admin/sys/emailtext/">
<input type="hidden" name="ac" value="add" />
<input type="hidden" name="submit" value="1" />
<fieldset>
<p>
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half title" value="" name="title"/>
</p>
<p>
<label for="description">介绍</label><br/>
<textarea id="description" class="small half" name="description"></textarea>
</p>
<p>
<label for="body">模板内容</label><br/>
<textarea id="body" class="large full" name="body"></textarea>
<small><a href="javascript:showhelp();">查看说明?</a></small>
</p>
<p class="box"><input type="submit" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
</div>
<div id="tabs-3">
<p>
</p>
</div>
</div>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript">
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
/* expandable rows */
Administry.expandableRows();
/* nav */
$('#nav_sys').addClass("current");
/* tabs */
$("#tabs").tabs();
});
function showhelp(){$('#showhelp').click();}
</script>

View File

@ -0,0 +1,50 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>系统管理</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('sys/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<img src="http://designerz-crew.info/start/callb.png">
<script type="text/javascript">
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
$('#nav_sys').addClass("current");
});
</script>

View File

@ -0,0 +1,23 @@
<div id="rightmenu">
<header>
<h3>系统管理</h3>
</header>
<dl class="first">
<dt><img width="16" height="16" alt="" SRC="/static/img/90.png"></dt>
<dd><a href="/admin/sys/emailtext">邮件模板管理</a></dd>
<dd class="last">发送电子邮件时使用的邮件模板</dd>
</dl>
</div>
<div class="content-box">
<header>
<h3>Tips</h3>
</header>
<section>
<dl>
<dt>No Tips</dt>
<dd></dd>
</dl>
</section>
</div>