<?php

/**
 *      【橙创家校通v4.0】 (C)2010-2012 Tuntron Inc.
 *      
 *    	 http://www.tuntron.com   QQ：1121251729
 *
 *      &待办事件类文件& By CC
 */

if (!defined('IS_RUN')) die('Forbsendidden');

class tj_Do_to extends tj_model {

    var $table = '';
	var $key = '';
	
	
    function __construct() {
        parent::__construct();
    }

    function tj_Do_to() {
        $this->__construct();
    }
	
	
	function Do_to()
	{
		
	global $_CO;
	$uid=$_CO['uid'];
	$bid=$_CO['userbid'];
	$groupid=$_CO['groupid'];
	//任务事件
	file_exists(TUNTRON_DAT.'/event_dat.php')?require TUNTRON_DAT.'/event_dat.php':Note('待办事件数据文件不存在！');;
	
    switch ($groupid){
		
		case "1":
		
			return $Do_to;
		break;
		
		
		case "2":
			
			//是否建立部门
			$is_branch = G_class('branch')->findbid($bid);
			if($is_branch[0]<1){
			$Do_to[0] = $event[0];
			}else{
			//添加人员
			$where['bid']=$bid;
			$sysgroupid = G_class('usergroup')->get_usergroupid_str($groupid,'sch');
			$is_user = G_class('user')->arrmember($sysgroupid.'5',$bid,'sch');
			if($is_user[0]<2) $Do_to[1] =$event[1];
			}
			
			//考试设置
			$is_examtype =G_class('examtype')->read_all($bid);
			if(!is_array($is_examtype)) $Do_to[2]=$event[2];
			
			
			return $Do_to;
		
		break;
		
		case "3":
			//添加人员
			$where['bid']=$bid;
			$sysgroupid = G_class('usergroup')->get_usergroupid_str($groupid,'sch');
			$is_user = G_class('user')->arrmember($sysgroupid.'5',$bid,'sch');
			if($is_user[0]<2) $Do_to[0] =$event[1];
			//编辑课程表
			$is_schedule = G_class('schedule')->read_one($bid);
			if(!is_array($is_schedule)) $Do_to[1] =$event[6];
			//添加讨论区
			$is_group_cate = G_class('group_cate')->read_all($bid);
			if(!is_array($is_group_cate)){
				 $Do_to[2] =$event[4];
			}else{
			//添加讨论组
			$is_group = G_class('group')->read_all($bid,'bid');
				if(!is_array($is_group)) {
					$event[5]['url'] =SITEURL.'?mod=group&do=group&c=addgroup&cateid='.$is_group_cate[0]['cateid'];
					$Do_to[2] =$event[5];
				}
			}
			return $Do_to;
		break;
		
		case "4":
		
			return $Do_to;
		break;

		
	}
}


}
?>