【php开源代码栏目提醒】:网学会员在php开源代码频道为大家收集整理了AdminMeeting.php提供大家参考,希望对大家有所帮助!
<?php
require_once("common/common.php");
require_once("common/page.php");
require_once("Meeting.php");
//**********************************************************
class CThisPage extends CPhpPage
{
public $m_meetings;
public $m_meeting;
public $m_ids;
public function __construct()
{
parent::__construct(__FILE__);
$this->Dispatch();
}
public function OnLoad($para)
{
parent::setPageTitle('会议通知管理');
if($this->IsPostBack()) {
$this->m_ids = $_POST['ids'];
$this->m_meeting = new Meeting();
$this->m_meeting->m_title = trim($_POST['title']);
$this->m_meeting->m_username = $_SESSION['uid'];
$this->m_meeting->m_execute_time= trim($_POST['execute_time']) . ':00';
$this->m_meeting->m_content = trim($_POST['content']);
}
return true;
}
public function OnFinalize()
{
Meeting::getAll($this->m_meetings);
}
public function btnToAdd_click($para = null)
{
if(!$this->validate()) return;
$this->m_meeting = new Meeting();
$this->setPageAction('ADD');
}
public function btnAdd_click($para = null)
{
if(!$this->validate()) return;
if(!$this->m_meeting->add()) {
$this->setError('添加失败');
}
}
public function btnDelete_click($para = null)
{
if(!$this->validate()) return;
Meeting::deleteById($this->m_ids);
}
public function linkToEdit_click($para = null)
{
if(!$this->validate() || empty($para)) return;
$this->m_meeting = Meeting::getById($para);
$this->setPageAction('EDIT');
}
public function btnEdit_click($para = null)
{
if(!$this->validate() || empty($para)) return;
if(!$this->m_meeting->edit($para)) {
$this->setError('修改失败');
}
}
// 服务器端数据验证函数
public function validate()
{
// ... 实现略
return true;
}
}
$page = new CThisPage();
require_once('common/header.inc.php');
?>
<form name='frmSubmit' method='post' action='AdminMeeting.php'>
<?$page->vsLocate();?>
<script language="javascript">
<!--
function doAddCheck(){
if(document.frmSubmit.title.value==""){
alert('请输入标题!');
return false;
}
// 使用正则表达式验证出生日期的格式
var pattern = /^20\d{2}-((0[1-9])|(1[1-2]))-((0[1-9])|([1-2]\d)|(3[0-1])) (([0-1]\d)|(2[1-3])):[0-5]\d$/;
if (! pattern.test(document.frmSubmit.execute_time.value) ) {
alert('时间填写不正确!');
return false;
}
return true;
}
-->
</script>
<table border='1' cellpadding='3' cellspacing='0' width='100%' bordercolor='skyblue' style='border-collapse:collapse'>
<tr class='caption_bg'><th></th><th>标题</th><th>发文人</th><th>发文时间</th><th>开会时间</th><th>操作</th></tr>
<?php
for($i = 0; $i < count($page->m_meetings); ++$i) {
$meeting = $page->m_meetings[$i];
$color = $i % 2 ? '#eeeeee' : 'ffffff';
echo "<tr bgcolor='$color'>";
echo "<td><input type='checkbox' id='ids<?echo $i;?>' name='ids[]' value='{$meeting->m_id}'/></td>";
echo "<td>{$meeting->m_title}</td>";
echo "<td>{$meeting->m_username}</td>";
echo "<td>" . reformat_date($meeting->m_publish_time) . "</td>";
echo "<td>" . reformat_date_ymdhm($meeting->m_execute_time) . "</td>";
echo "<td><a href=\"javascript:VsEvent('linkToEdit_click({$meeting->m_id})')\">编辑</a></td></tr>\n";
}
?>
</table>
<br />
<div id='to_add' class='<?echo ($page->isOk() && $page->getPageAction() == 'SHOW')?'assistBar':'hidden';?>'>
<a class='link_btn' href="javascript:VsEvent('btnToAdd_click()');">添加</a>
<a class='link_btn' href="javascript:VsEvent('btnDelete_click()')">删除</a>
</div>
<div id='frmAdd' <?if($page->isOk() && $page->getPageAction() == 'SHOW') echo "class='hidden'";?> >
<table border='0' cellpadding='5' cellspacing='0' width='560px'>
<tr><td colspan="2" align="center" class="alert"><?echo $page->getError();?></td></tr>
<tr><td width='18%'>标题:</td><td>
<input type='text' id='title' name='title' style='width:220px' maxlength='50' <?outputVO($page->m_meeting,'m_title');?> />
</td></tr>
<tr><td>时间:</td>
<td><input type='text' id='execute_time' name='execute_time' class='textinput' maxlength='16'
<?outputVO($page->m_meeting,'m_execute_time','reformat_date_ymdhm');?> /> 格式如:2007-01-01 18:00</td></tr>
<tr><td>内容:</td>
<td><textarea id='content' name='content' cols='52' rows='20'><?echo $page->m_meeting->m_content;?></textarea></td></tr>
</table><br/>
<div id='add_cancel'>
<?if($page->getPageAction() == 'EDIT') { ?>
<a class='link_btn' href="javascript:VsEvent('btnEdit_click(<?echo $page->m_meeting->m_id;?>)', doAddCheck);">修改</a>
<?}else{?>
<a c