EIOS/inc/byPass.php

209 lines
7.5 KiB
PHP
Raw Normal View History

2023-12-28 15:39:22 +03:00
<?
if(isset($_GET['page'])){
$page = $_GET['page'];
$info = array();
$sql = 'SELECT ob.*, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.id = "'.$page.'" AND ob.id_user = us.id';
$rez = $DB->QUR_SEL($sql);
if ($rez){
$info['obhod'] = $rez[1];
switch ($info['obhod']['dekanat']){
case 2: $info['obhod']['dekanat'] = 'Факультета информационных систем в экономике и юриспруденции'; break;
case 5: $info['obhod']['dekanat'] = 'Инженерного факультета'; break;
case 6: $info['obhod']['dekanat'] = 'Лечебного факультета'; break;
case 7: $info['obhod']['dekanat'] = 'Факультета международного образования'; break;
case 8: $info['obhod']['dekanat'] = 'Стоматологического факультета'; break;
case 9: $info['obhod']['dekanat'] = 'Технологического факультета'; break;
case 10: $info['obhod']['dekanat'] = 'Факультета управления'; break;
case 11: $info['obhod']['dekanat'] = 'Факультета аграрных технологий'; break;
case 12: $info['obhod']['dekanat'] = 'Факультета экономики и сервиса'; break;
case 13: $info['obhod']['dekanat'] = 'Фармацевтического факультета'; break;
case 14: $info['obhod']['dekanat'] = 'Экологического факультета'; break;
case 15: $info['obhod']['dekanat'] = 'Факультета послевузовского профессионального образования'; break;
}
$info['stud'] = get_student($rez[1]['id_user']);
}
$smarty->assign('page',$page);
$smarty->assign('info',$info);
$smarty->display('tpl_byPass_print.html');
exit;
} else{
//ГРУППЫ
$grupp = array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs';
$rez=$DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val){
$grupp[] = $val;
}
}
//факультеты
$faculties = array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_faculties';
$rez = $DB->QUR_SEL($sql);
if ($rez){
$i = 0;
foreach ($rez as $key => $val) if ($key){
$faculties[] = $val;
}
}
//кафедры
$kafedres = array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_kafedres';
$rez = $DB->QUR_SEL($sql);
if ($rez){
$i = 0;
foreach ($rez as $key => $val) if ($key){
$kafedres[] = $val;
}
}
//ДЛЯ ПРОВЕРКИ
//КАДРЫ
$kadres = array();
$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.id_user = us.id';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$val['stud'] = get_student($val['id_user']);
$kadres[] = $val;
}
}
$fakultet = $_SESSION['user']['teacher']['fakultet'];
$sql_f = 'SELECT * FROM '.$ST['dbpf'].'_faculties WHERE name = "'.$fakultet.'"';
$rez_f = $DB->QUR_SEL($sql_f);
if ($rez_f){
$faks = array();
//$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.pl_fakult <= 0 AND ob.id_user = us.id AND ob.dekanat = "'.$rez_f[1]['id'].'" ORDER BY ob.pl_fakult DESC';
$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.id_user = us.id AND ob.dekanat = "'.$rez_f[1]['id'].'" ORDER BY ob.pl_fakult DESC';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$val['stud'] = get_student($val['id_user']);
$faks[] = $val;
}
}
}
$objs = array();
$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.pl_obj <= 0 AND ob.id_user = us.id ORDER BY ob.pl_obj DESC';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$val['stud'] = get_student($val['id_user']);
$objs[] = $val;
}
}
$libs = array();
$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.pl_lib <= 0 AND ob.id_user = us.id ORDER BY ob.pl_lib DESC';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$val['stud'] = get_student($val['id_user']);
$libs[] = $val;
}
}
//КАФЕДРА
$kaf = $_SESSION['user']['teacher']['kafedra'];
$sql_k = 'SELECT * FROM '.$ST['dbpf'].'_kafedres WHERE name = "'.$kaf.'"';
$rez_k = $DB->QUR_SEL($sql_k);
//echo '<pre>'.print_r($rez_k,1).'</pre>';exit();
//Array(
// [0]=>2
// [1]=>Array( [id]=>9 [id_facult]=>10 [name] => Конституционного строительства [code]=>33)
// [2]=>Array( [id]=>52 [id_facult]=>21 [name] => Конституционного строительства [code]=>33)
//)
if ($rez_k){
$kafs = array();
foreach($rez_k as $k => $v)if($k!=0) {
$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM ' . $ST['dbpf'] . '_obhods as ob, ' . $ST['dbpf'] . '_users as us WHERE ob.pl_kaf <= 0 AND ob.id_user = us.id AND ob.kafedra = "' . $v['id'] . '" ORDER BY ob.pl_kaf DESC';
$rez = $DB->QUR_SEL($sql);
if ($rez) {
foreach ($rez as $key => $val) if ($key) {
$val['stud'] = get_student($val['id_user']);
$kafs[] = $val;
}
}
}
// $sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.pl_kaf <= 0 AND ob.id_user = us.id AND ob.kafedra = "'.$rez_k[1]['id'].'" ORDER BY ob.pl_kaf DESC';
// $rez = $DB->QUR_SEL($sql);
// if ($rez){
// foreach ($rez as $key => $val) if ($key){
// $val['stud'] = get_student($val['id_user']);
// $kafs[] = $val;
// }
// }
//echo '<pre>'.print_r($kafs,1).'</pre>';exit();
}
$bfus = array();
$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.pl_bfu <= 0 AND ob.id_user = us.id ORDER BY ob.pl_bfu DESC';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$val['stud'] = get_student($val['id_user']);
$bfus[] = $val;
}
}
$truds = array();
$sql = 'SELECT ob.*, ob.id as id_ob, us.* FROM '.$ST['dbpf'].'_obhods as ob, '.$ST['dbpf'].'_users as us WHERE ob.pl_trud <= 0 AND ob.id_user = us.id ORDER BY ob.pl_trud DESC';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$val['stud'] = get_student($val['id_user']);
$truds[] = $val;
}
}
//ОБХОДНОЙ СТУДЕНТА, ЕСЛИ ЕСТЬ
$id_user = $_SESSION['user']['id'];
$obhod_stud = array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_obhods WHERE id_user = "'.$id_user.'" ';
$rez = $DB->QUR_SEL($sql);
if ($rez){
$obhod_stud['comm'] = $rez[1]['comments'];
$obhod_stud['info'] = $rez[1];
}
/*****************************/
$smarty->assign('obhod_stud',$obhod_stud);
$smarty->assign('kadres',$kadres);
$smarty->assign('objs',$objs);
$smarty->assign('truds',$truds);
$smarty->assign('bfus',$bfus);
$smarty->assign('kafs',$kafs);
$smarty->assign('faks',$faks);
$smarty->assign('libs',$libs);
$smarty->assign('kafedres',$kafedres);
$smarty->assign('faculties',$faculties);
$smarty->assign('grupps',$grupp);
$maincontent = $smarty->fetch('tpl_byPass.html');
}
?>