EIOS/rabprog/inc/class_StatUMU.php

136 lines
5.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class class_StatUMU{
private $DB;
function __construct(){
GLOBAL $DB;
$this->DB = $DB;
}
public function HTML(){
$smartyC = new class_smarty();
$smarty = $smartyC->config(__DIR__.'\..\tpl');
//echo __DIR__.'\tpl';
$out = array('name'=>'Статистика УМУ','body'=>'');
$smarty->assign('facultets',$this->get_facultets());
$out['body'] = $smarty->fetch('page_statumu.html');
return $out;
}
function get_facultets(){
$out = array();
$sql = 'SELECT
school.name as school_name,
facultie.id as facultie_id,
facultie.name as facultie_name
FROM
acs_schools as school,
acs_faculties as facultie
WHERE
school.id=facultie.id_school
ORDER BY school.name,facultie.name';
$rez = $this->DB->QUR_SEL($sql);
//print_r($rez);
if(!$rez['err']&&$rez['kol']){
foreach($rez['rez'] as $key => $val){
$val['kafedras'] = $this->get_kafedras($val['facultie_id']);
$out[$val['school_name']][] = $val;
}
}
return $out;
}
function get_kafedras($id_fakultet){
$out = array();
$sql = 'SELECT id,name,code FROM acs_kafedres WHERE id_facult = '.$id_fakultet.' ORDER BY code,name';
$rez = $this->DB->QUR_SEL($sql);
if(!$rez['err']&&$rez['kol']){
foreach($rez['rez'] as $key => $val){
$tmp['id'] = $val['id'];
$tmp['name'] = $val['name'];
$tmp['code'] = $val['code'];
$tmp['up'] = $this->get_statUchebPlan($tmp['name']);
$out[] = $tmp;
}
}
return $out;
}
function get_statUchebPlan($kafedra){
$out = array();
$sql = 'SELECT id,data_c,id_file,program,shifr,naprav,profil,kvalif,god_nach_podgot,fo,srok_poluch_obr FROM acs_fshp_file WHERE kafedra = "'.$kafedra.'" ORDER BY naprav';
$rez = $this->DB->QUR_SEL($sql);
if(!$rez['err']&&$rez['kol']){
foreach($rez['rez'] as $key => $val){
$val['discips'] = $this->get_statUchebPlanDiscips($val['id']);
$out[] = $val;
}
}
return $out;
}
function get_statUchebPlanDiscips($id_file){
$out = array();
$sql = 'SELECT id,index1,name FROM acs_fshp_uchebplans WHERE id_file = '.$id_file.' ORDER BY index1';
$rez = $this->DB->QUR_SEL($sql);
if(!$rez['err']&&$rez['kol']){
foreach($rez['rez'] as $key => $val){
$val['prepods'] = $this->get_statUchebPlanDiscipsPrepod($val['id']);
$out[] = $val;
}
}
return $out;
}
function get_statUchebPlanDiscipsPrepod($id_uchebplan){
$out = array();
$sql = 'SELECT u.id,u.fio FROM acs_fshp_disciplin_prepod as fdp, acs_users as u WHERE id_uchebplans = '.$id_uchebplan.' AND u.id=fdp.id_prepod';
$rez = $this->DB->QUR_SEL($sql);
if(!$rez['err']&&$rez['kol']){
foreach($rez['rez'] as $key => $val){
$val['saves'] = $this->get_statUchebPlanDiscipsSaves($id_uchebplan,$val['id']);
$out[] = $val;
}
}
return $out;
}
function get_statUchebPlanDiscipsSaves($id_discip,$id_prepod){
$out = array();
$sql = 'SELECT * FROM acs_fshp_rpd_save WHERE id_discip = '.$id_discip.' AND id_prepod = '.$id_prepod.' ORDER BY data_c';
//echo $sql.'<br>';
$rez = $this->DB->QUR_SEL($sql);
$out = array('all'=>$all_save,'kol_save'=>0,'proc'=>0);
if(!$rez['err']&&$rez['kol']){
$all_save = 16;
foreach($rez['rez'] as $key => $val){
$kol_save = 0;
if(trim($val['razdel1'])!=='') $kol_save++;
if(trim($val['razdel2'])!=='') $kol_save++;
if(trim($val['razdel3'])!=='') $kol_save++;
if(trim($val['razdel4'])!=='') $kol_save++;
if(trim($val['razdel5'])!=='') $kol_save++;
if(trim($val['razdel5_4'])!=='') $kol_save++;
if(trim($val['razdel5_5'])!=='') $kol_save++;
if(trim($val['razdel5_6'])!=='') $kol_save++;
if(trim($val['razdel5_7'])!=='') $kol_save++;
if(trim($val['razdel5_8'])!=='') $kol_save++;
if(trim($val['razdel5_9'])!=='') $kol_save++;
if(trim($val['razdel6_1'])!=='') $kol_save++;
if(trim($val['razdel6_2'])!=='') $kol_save++;
if(trim($val['razdel7'])!=='') $kol_save++;
if(trim($val['razdel7_2'])!=='') $kol_save++;
if(trim($val['razdel7_3'])!=='') $kol_save++;
$out = array('all'=>$all_save,'kol_save'=>$kol_save,'proc'=>round((($kol_save/$all_save)*100),2));
}
}
return $out;
}
function prepods_get($fakultet,$kafedra){
$out = array();
//$sql = 'SELECT id,data_c,data_u,id_user,zvanie,dolgnost,stepen FROM acs_teachers WHERE fakultet="'.$fakultet.'" AND kafedra="'.$kafedra.'"';
$sql = 'SELECT t.id,t.id_user,t.zvanie,t.dolgnost,t.stepen,u.data_c,u.data_u,u.fio FROM acs_teachers as t, acs_users as u WHERE t.fakultet="'.$fakultet.'" AND t.kafedra="'.$kafedra.'" AND t.id_user=u.id ORDER BY u.fio';
$rez = $this->DB->QUR_SEL($sql);
if(!$rez['err']&&$rez['kol']){
$out = $rez['rez'];
}
return $out;
}
}