listday.php

来自「极限OA开源系统」· PHP 代码 · 共 249 行

PHP
249
字号
<?
/********************************************************************************/
/* 极限办公自动化系统 (极限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(31,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:memassist.php?action=diary");
}

if($sysaction == 'add') {
	checkright(31,11,2);
	if($title && $des) {
		if($id) {
			checkright(31,11,3);
			$stime = "$stime_1:$stime_2";
			$etime = "$etime_1:$etime_2";
			$db->query("update $table_listday set title='$title',des='$des',executant='$executant',tdate='$tdate',stime='$stime',etime='$etime',awoke='$awoke',scope='$scope',level='$level' where id='$id'");
		}else {
			$stime = "$stime_1:$stime_2";
			$etime = "$etime_1:$etime_2";
			$db->query("insert into $table_listday (title,des,executant,tdate,stime,etime,awoke,scope,level,mid,admin,time) 
			values ('$title','$des','$executant','$tdate','$stime','$etime','$awoke','$scope','$level','$union_uid','$union_user','$timestamp')");
		}
		header("Location:dailyop.php?action=listday&type=$type");
	}else {
		$pre_s = false;
		if($id) {
			checkright(31,11,3);
			$lis_t = $db->query_fetch("select * from $table_listday where id='$id'");
		}else {
			$lis_t[scope] = '-1';
		}
		$ttime = $ttime?$ttime:date('Y-m-d',$timestamp);
		$ttime = $id?$mem_t['time']:$ttime;
		$lis_t[st_t] = $lis_t[st_t]?$lis_t[st_t]:'12';
		$st_t = array($lis_t[st_t]=>' selected');
		$st_t2 = array($lis_t[st_t2]=>' selected');
		for($i=0;$i<=24;$i++) {
			if($i < 24) {
				$start_htm .= "<option value=$i$st_t[$i]>$i".'时</option>';
				$to_htm .= "<option value=$i$st_t[$i]>$i".'时</option>';
				$awoke_htm .= "<option value=$i>$i</option>";
			}else
				$awoke_htm .= "<option value=$i>$i</option>";
		}
		for($i=0;$i<60;$i=$i+5) {
			$start2_htm .= "<option value=$i$st_t2[$i]>$i".'分</option>';
			$to2_htm .= "<option value=$i$st_t2[$i]>$i".'分</option>';
		}

		$query = $db->query("select * from $table_department where fig='1' order by id ASC");
		$num = $db->num_rows($query);
		while($list = $db->fetch_array($query)) {
			if($list[id] == $lis_t[scope]) $list[sel] = ' selected';
			else $list[sel] = '';
			$depart_list[$list[id]] = $list;
		}
		$now = date('Y-m-d H:i:s',$timestamp);
	}
}elseif($sysaction == 'show') {

	$lis_t = $db->query_fetch("select * from $table_listday where id='$id'");
	foreach($lis_t as $key=>$val) {
		if(empty($val))
			$lis_t[$key] = '空';
	}
	if($lis_t[scope] == -1)
		$lis_t[scope] = '私人';
	elseif($lis_t[scope] == 0)
		$lis_t[scope] = '所有部门';
	else {
		$ps32 = $db->query_fetch("select name from $table_department where id='$lis_t[scope]'");
		$lis_t[scope] = $ps32[name];
	}
	$lis_t[time] = date('Y-m-d H:i:s',$lis_t[time]);
	//$dia_t[content] = nl2br($dia_t[content]);
	include getData('dailyop_listday_show');
	exit;
}elseif($sysaction == 'view') {
	$mem_list = array();
	$query = $db->query("select * from $table_members where employ>0");
	while($list = $db->fetch_array($query)) {
		$mem_list[] = $list[employ];
	}


	$query = $db->query("select * from $table_dict order by id ASC");
	while($list = $db->fetch_array($query)) {
		$dict_list[$list[id]] = $list;
	}

	$query = $db->query("select * from $table_department where fig='1' order by id ASC");
	$num = $db->num_rows($query);
	while($list = $db->fetch_array($query)) {
		if($depart_type == $list[id]) $list[sel] = ' selected';
		else $list[sel] = '';
		$depart_list[$list[id]] = $list;
	}
	if($depart_type) {
		$condi = " e.depart='$depart_type'";
	}else
		$condi = '';

	$perpage = 20;
	if(!$page) {
		$page = 1;
	}
	$offset = ($page - 1) * $perpage;
	$query = $db->query("SELECT COUNT(*) FROM $table_members m,$table_employees e where m.employ=e.id$condi");
	$num = $total = $db->result($query, 0);
	$multipage = pages($num, $perpage, $page, "system.php?action=employee&depart_type=$depart_type");

	$cid = $cid?intval($cid):1;
	$query = $db->query("select m.*,e.depart,e.duty,e.telphone from $table_members m,$table_employees e where m.employ=e.id$condi order by id ASC LIMIT $offset, $perpage");
	while($list = $db->fetch_array($query)) {
		$list[depart] = $depart_list[$list[depart]][name];
		$list[duty] = $dict_list[$list[duty]][name];
		if(in_array($list[id],$mem_list)) {
			$list[yesfig] = 1;
		}
		$member_list[$list[uid]] = $list;
	}
	$pre_s = false;
}


if($pre_s) {
	if($type == 'day' || !$type) {
		if($sear_day) {
			$tmp_ds = explode('-',$sear_day);
			$timestamp_s = mktime(0,0,0,$tmp_ds[1],$tmp_ds[2],$tmp_ds[0]);
		}
		$timestamp2 = $timestamp2?$timestamp2:$timestamp;
		$s_year = date('Y',$timestamp2);
		$s_mon = date('m',$timestamp2);
		$s_day = date('d',$timestamp2);
		if($qtype == 'next') {
			$timestamp2 = mktime(0,0,0,$s_mon,$s_day+1,$s_year);
		}elseif($qtype == 'prev') {
			$timestamp2 = mktime(0,0,0,$s_mon,$s_day-1,$s_year);
		}elseif($qtype == 'this' || !$qtype) {
			$timestamp2 = $sear_day?$timestamp_s:$timestamp;
		}
		$now = date('Y-m-d 星期',$timestamp2);
		$now_week = date('w',$timestamp2);
		$now_week2 = array("日","一","二","三","四","五","六");
		$now = date("Y-m-d 星期",$timestamp2).$now_week2[$now_week];
		include 'dailyop/listday_cal_day.php';

		$temp_00 = date('Y-m-d',$timestamp2);
		$condi = " && tdate='$temp_00'";
	}elseif($type == 'week') {
		$timestamp2 = $timestamp2?$timestamp2:$timestamp;
		$s_year = date('Y',$timestamp2);
		$s_mon = date('m',$timestamp2);
		$s_day = date('d',$timestamp2);
		if($qtype == 'next') {
			$timestamp2 = mktime(0,0,0,$s_mon,$s_day+7,$s_year);
		}elseif($qtype == 'prev') {
			$timestamp2 = mktime(0,0,0,$s_mon,$s_day-7,$s_year);
		}elseif($qtype == 'this' || !$qtype) {
			$week = date("w");
			$timestamp2 = strtotime("-1 week",strtotime(7-$week." day"));
		}
		$now = date("Y年m月",$timestamp2);
		include 'dailyop/listday_cal_week.php';

		$temp_00 = date('Y-m-d',$timestamp2);
		$s_year2 = date('Y',$timestamp2);
		$s_mon2 = date('m',$timestamp2);
		$s_day2 = date('d',$timestamp2);
		$temp_02 = date('Y-m-d',mktime(0,0,0,$s_mon2,$s_day2+6,$s_year2));
		$condi = " && tdate>='$temp_00' && tdate<='$temp_02'";
	}elseif($type == 'month') {
		$timestamp2 = $timestamp2?$timestamp2:$timestamp;
		$s_year = date('Y',$timestamp2);
		$s_mon = date('m',$timestamp2);
		$s_day = date('d');
		if($qtype == 'next') {
			if($s_mon == 12) {
				$s_year2 = $s_year + 1;
				$s_mon2 = 1;
			}else {
				$s_year2 = $s_year;
				$s_mon2 = $s_mon + 1;
			}
			$timestamp2 = mktime(0,0,0,$s_mon2,1,$s_year2);
		}elseif($qtype == 'prev') {
			if($s_mon == 1) {
				$s_year2 = $s_year - 1;
				$s_mon2 = 12;
			}else {
				$s_year2 = $s_year;
				$s_mon2 = $s_mon - 1;
			}
			$timestamp2 = mktime(0,0,0,$s_mon2,1,$s_year2);
		}elseif($qtype == 'this' || !$qtype) {
			$s_year2 = date('Y');
			$s_mon2 = date('m');
			$timestamp2 = $timestamp;
		}
		$now = date("Y年m月",$timestamp2);
		include 'dailyop/listday_cal_month.php';

		$temp_00 = date('Y-m-d',$timestamp2);
		$s_year2 = date('Y',$timestamp2);
		$s_mon2 = date('m',$timestamp2);
		$s_day2 = date('d',$timestamp2);
		$temp_02 = date('Y-m-d',mktime(0,0,0,$s_mon2,$s_day2+34,$s_year2));
		$condi = " && tdate>='$temp_00' && tdate<='$temp_02'";
	}
	
	$listday_list = array();
	$query = $db->query("select * from $table_listday where mid='$union_uid'$condi order by time DESC");
	while($list = $db->fetch_array($query)) {
		$list[title] = wordscut($list[title],10,'');
		$listday_count[$list['tdate']] ++;
		$listday_list[$list['id']] = $list;
	}

	$D=new Calendar($timestamp2,$listday_list,$listday_count);
	$out = $D->OUT();

}



include getData('dailyop_listday');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?