1.1使用tbs opentbs
include_once('class/tbs/tbs_class.php'); // Load the TinyButStrong template engine
include_once('class/tbs/tbs_plugin_opentbs.php'); // Load the OpenTBS plugin
1.2 利用 pr_??? 處理$data
$data=array();
$inc = explode('.',$type);
if ($inc[0]=='list2') $inc[0]='list';
include "include/pr_{$inc[0]}.php";
1.3 載入表格
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load the OpenTBS plugin
$template = 'class/tbs/'.$type;
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8); // Also merge some [onload] automatic fields (depends of the type of document).
$TBS->MergeBlock($merge_letter, $data);
$output_file_name = str_replace('.', '_'.date('Y-m-d').'.', $type);
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
1.4 pr_??? 如何處理全部學校
//取得全部學校
$schools = rsList('school',"1 ORDER BY sch_ns, sch_dist, sch_id");
//依序處理
foreach ($schools as $school) {
$sch_id=$school['sch_id'];
$sch_ns=$ns_arr[$school['sch_ns']];
$sch_dist=$dist_arr[$school['sch_dist']];
$list=rsList('work105',"sch_id='$sch_id' AND hidden=0 ORDER BY sch_level DESC, work_kind, work_group, stud_grad, stud_class");
$i=0;
foreach($list as $var) {
$i++;
$data[]=array(
'sn'=>$i,
'kind'=> $kind_arr[$var['sch_level']][$var['work_kind']],
'group'=>$group_arr[$var['work_group']],
'title'=>$var['title'],
'grad'=>$all_grad_arr[$var['stud_grad']],
'class'=>$var['stud_class'],
'depart'=>$var['sch_depart'],
'name'=>$var['stud_name'],
'birth'=>$var['stud_birth'],
'teacher'=>$var['tea_name'],
'sch'=>$school['sch_name'],
'addr'=>$school['sch_addr'],
'tel'=>$school['sch_tel'],
'ns'=>$sch_ns,
'dist'=>$sch_dist,
'level'=>$sch_level_arr[$var['sch_level']]
);
}
}
$merge_letter='t';
1.5 如何處理只有南區的學校的晉級作品
$schools = rsList('school',"sch_ns='S' ORDER BY sch_dist, sch_id");
$works = rsList('work105',"up=1 AND sch_id in ( SELECT sch_id from school where sch_ns='S') ");
//依據新組別排序
沒有留言:
張貼留言