<?php

/**
 *      【橙创家校通v4.0】 (C)2010-2012 Tuntron Inc.
 *      
 *    	 http://www.tuntron.com   QQ：1121251729
 *
 *      &校务管理模块&
 */
 
 if (!defined('IS_RUN')) die('Forbidden');
 
 $M_user       = G_class('user');
 $M_ann        = G_class('ann');
 $M_schedule   = G_class('schedule');
 $c= _get('c','index');
 
 $T=$c=='index'?$do:$do.'_'.$c;
 
  //左侧菜单开始 --后面考虑转到模块入口文件
  $left_menu_html = G_class('menu') ->get_left_menu_html($arrgroup['menuid'],$do,$c);
 
 $Modname = '校务管理 - 学校管理';
 
switch ($c){
		
		case "index":
		
		$Modname = '课程表设置 - '.$Modname;
		
		$schedule = $M_schedule->read_one($_CO['userbid']);
		
		$arr_schedule = base64_unserialize($schedule['arraystr']);
		
		break;
		
		case "ann":
			//分页每页显示数据量
			$listnum = '10';
			//当前页
			$pid=$_GET['p'];
			if(is_numeric($pid)&&$pid>0){
				$pid=(int)$pid;
			}else{
				$pid='1';
			}
			//链接地址
			$url = SITEURL . '?mod=school&do=class_affairs&c=ann';
		
			$all_bid = $M_user->B->FindAllBid($_CO['userbid']);
			$arr_all_bid=explode("/",'1/'.$all_bid);
			$arrann=$M_ann->read_all($arr_all_bid);
			
			$sum = count($arrann);
			$pidf = $pid-1;
			$start = $pidf*$listnum;
			$end = $listnum;
			foreach($arrann as $key=>$value){
				$array[] = $value;
			}
			$arrann = array();
			$arrann = array_slice($array, $start, $end);
			$pageinfo = grtpageno($url, $sum, $listnum, $pid);
			
			//获取参数验证代码
			$arrann=fields_code($arrann,'id');
			
			$Modname = '公告管理 - '.$Modname;
			
			
			

		break;
		
		case "ann_content":
		
		$Modname = '查看公告 - '.$Modname;
		$id = _get('id');
		
		$content = $M_ann->read_one($id);
		
		break;
		
		case "addann":
		
		$Modname = '发布公告 - '.$Modname;
		$gBranch = $M_user->B->findbranch($_CO['userbid']);
		
		if($_POST){
		$post = $M_ann->get_post($_POST);
		$post['bid'] = $_CO['userbid'];
		$M_ann-> save($post);
		Note('公告添加成功！','>>点击返回<<',SITEURL.'?mod=school&do=class_affairs&c=ann');
		}
		
		break;
		
	}
	

 if($no_temp<0) require_once Template($T);

?>