📄 bulletin_admin.php
字号:
<?
/********************************************************************************/
/* 极限办公自动化系统 (极限OA) */
/* ======================== */
/* 欢迎使用 极限OA,在您开始使用之前,请务必完整阅读本软件附带的全部说明档 */
/********************************************************************************/
/* Welcome to http://www.xsp.cn & http://oa.xsp.cn */
/* 技术支持论坛 http://www.1119.net */
/********************************************************************************/
/* 商业购买请联系 临海市极限网络有限公司 */
/* 联系电话: (0576) 5131349 邮件: mkt@xsp.cn QQ: 562873 */
/********************************************************************************/
if(!defined('KIN_UNION')){die("Hacking attempt");}
$pre_s = true;
if($sysaction == 'del') {
checkright(21,11,4);
if(is_array($delete)) {
$ids = "0";
foreach($delete as $val) {
$ids .= ",$val";
}
$db->query("DELETE FROM $table_diary WHERE id IN ($ids)");
}elseif($id) {
$db->query("DELETE FROM $table_diary WHERE id='$id'");
}
header("Location:communion.php?action=bulletin_admin");
}
if($sysaction == 'add') {
checkright(21,11,2);
if($title && $content) {
$tmp1 = explode('-',$tdate);
$time1 = mktime(0,0,0,$tmp1[1],$tmp1[2],$tmp1[0]);
$time2 = $time1 + 3600*24*$daynum;
if($id) {
checkright(21,11,3);
$db->query("update $table_bulletin set type='$type',title='$title',content='$content',keyword='$keyword',tdate='$tdate',time='$time1',daynum='$daynum',time2='$time2',scope='$scope' where id='$id'");
}else {
$db->query("insert into $table_bulletin (type,title,content,keyword,tdate,time,daynum,time2,scope,mid,admin)
values ('$type','$title','$content','$keyword','$tdate','$timestamp','$daynum','$time2','$scope','$union_uid','$union_user')");
}
header("Location:communion.php?action=bulletin_admin");
}else {
$pre_s = false;
if($id) {
checkright(21,11,3);
$bul_t = $db->query_fetch("select * from $table_bulletin where id='$id'");
$bul_t[$bul_t[type]] = ' checked';
}else {
$bul_t[scope] = '-1';
$bul_t[公告] = ' checked';
}
$st_t = array($bul_t[daynum]=>' selected');
for($i=1;$i<30;$i++) {
$daynum_htm .= "<option value=$i$st_t[$i]>$i</option>";
}
$query = $db->query("select * from $table_department where fig='1' order by id ASC");
$depart_list[0] = array('id'=>0,'name'=>'**所有部门**');
while($list = $db->fetch_array($query)) {
if($list[id] == $bul_t[scope]) $list[sel] = ' selected';
else $list[sel] = '';
$depart_list[$list[id]] = $list;
}
$now = $id?$bul_t[tdate]:date('Y-m-d',$timestamp);
}
}elseif($sysaction == 'show') {
checkright(21,11,0);
$bul_t = $db->query_fetch("select * from $table_bulletin where id='$id'");
$bul_t[state] = $bul_t[state]?$bul_t[state]:'未开始';
foreach($bul_t as $key=>$val) {
if(empty($val) && $val != 0)
$bul_t[$key] = '空';
}
if($bul_t[scope] == -1)
$bul_t[scope] = '私人';
elseif($bul_t[scope] == 0)
$bul_t[scope] = '所有部门';
else {
$ps32 = $db->query_fetch("select name from $table_department where id='$bul_t[scope]'");
$bul_t[scope] = $ps32[name];
}
$bul_t[time] = date('Y-m-d H:i:s',$bul_t[time]);
//$dia_t[content] = nl2br($dia_t[content]);
include getData('dailyop_task_show');
exit;
}
if($pre_s) {
$depart_list = array();
$depart_list[0] = array('id'=>0,'name'=>'所有部门');
$query = $db->query("select * from $table_department");
while($list = $db->fetch_array($query)) {
$depart_list[$list[id]] = $list;
}
$departsel[$s_scope] = ' selected';
if($s_admin) {
$condi = " where id>0";
if($s_tdate && $s_tdate2) {
$condi .= " && tdate>='$s_tdate' && tdate<='$s_tdate2'";
}
if($s_scope) {
$condi .= " && scope='$s_scope'";
}
if($s_state) {
if($s_state == 1) {
$condi .= " && time>'$timestamp'";
}elseif($s_state == 2) {
$condi .= " && ( time <= '$timestamp' && (time2 > '$timestamp') )";
}else
$condi .= " && ( time <= '$timestamp' && (time2 < '$timestamp') )";
}
}
$perpage = 15;
if(!$page) {
$page = 1;
}
$offset = ($page - 1) * $perpage;
$query = $db->query("SELECT COUNT(*) FROM $table_bulletin$condi");
$num = $total = $db->result($query, 0);
$multipage = pages($num, $perpage, $page, "communion.php?action=bulletin_admin&s_admin=1&s_tdate=$s_tdate&s_tdate2=$s_tdate2&s_scope=$s_scope&s_state=$s_state");
$query = $db->query("select * from $table_bulletin$condi order by time DESC LIMIT $offset, $perpage");
while($list = $db->fetch_array($query)) {
$list[title] = wordscut($list[title],30,'');
if($list[time] > $timestamp)
$list[state] = '待发布';
elseif( $list[time] <= $timestamp && $list[time2] > $timestamp )
$list[state] = '发布中';
else
$list[state] = '已结束';
$list[depart] = $depart_list[$list[scope]][name];
$bulletin_list[$list['id']] = $list;
}
}
include getData('communion_bulletin_admin');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -