<?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_flies = G_class('files');
 $c= _get('c','index');

 $Modname = '文件下载 - 学校管理';
 
switch ($c){
		
		case "index":
			
 			$all_bid = $M_user->B->FindAllBid($_CO['userbid']);
  			$arr_all_bid=explode("/",'1/'.$all_bid);
			$folders = $M_flies->F->read_all($arr_all_bid);
			
			foreach ($folders as $key=>$item){
			$folders[$key]['Branch']=$M_user->B->findbranch($item['bid']);
		}
			
			//获取参数验证代码
 			$folders=fields_code($folders,'fid');
			
		
		break;
		
		case "content":
		
		$fid= _get('fid');
		
		$folder = $M_flies->F->read_one($fid);
		
		$arrfiles = $M_flies->read_all($fid);
		
		foreach ($arrfiles as $key=>$item){
			$arrfiles[$key]['filesize']=size_unit($item['filesize']);
			$arrfiles[$key]['fileurl']=urlencode($item['fileurl']);
		}
		
		$arrfiles = fields_code($arrfiles,'fileid');
		
		$Modname = $folder['name'].' - '.$Modname;

		$no_temp =1;
		require_once Template($do.'_content');
		
		break;
	}

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

?>