<?php
/*
	[Office 515158] (C) 2009-2014 天生创想 Inc.
	$Id: mod_plan mobile $
*/
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
empty($do) && $do = 'list';
$type=getGP('type','G');
$type_name='工作计划';	
if ($do == 'list') {
	if($type=='1'){
		$wheresql .= " where participation LIKE '%".get_realname($_USER->id)."%' ";
	}elseif($type=='2'){
		$wheresql .= " where person LIKE '%".get_realname($_USER->id)."%' ";	
	}elseif($type=='3'){
		$wheresql .= " where completiondate!='' AND (person LIKE '%".get_realname($_USER->id)."%' or participation LIKE '%".get_realname($_USER->id)."%')";	
	}else{
		$wheresql = " where uid='".$_USER->id."'";
	}
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."plan ".$wheresql."  order by id desc");
    $sql = "SELECT * FROM ".DB_TABLEPRE."plan ".$wheresql." ORDER BY id desc LIMIT 0,100";
	$result = $db->fetch_all($sql);
	include_once('template/plan.php');

}elseif ($do == 'views') {
	$id = getGP('id','G','int');
	if($id!=''){
		$row = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."plan  WHERE id = '".$id."'");
	}
	include_once('template/plan_view.php');
}
?>