EIOS/inc/statuses.php

1442 lines
63 KiB
PHP
Raw 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
session_start();
header('Content-Type: text/html; charset=utf-8');
if(isset($_POST['ajdes'])){
include '_db.php';
include '../config.php';
include 'functions.php';
$out=array();
if($_POST['ajdes']=='save_students'){//Изменение студентов группы и емаил
$out['gid'] = $_POST['gid']; $er_kol=0; $su_kol=0; $out['html'] = '';
foreach($_POST['podgrupp'] as $key => $val){
if($val=='') $val=1;
$sql = 'UPDATE '.$ST['dbpf'].'_students SET num_grupp="'.$val.'" WHERE id='.$key.'';
$rez = $DB->QUR($sql);
if(!$rez['err'])$su_kol++; else $er_kol++;
}
$out['html'] .= 'Номера групп: успех:'.$su_kol.'; ошибок: '.$er_kol.'';
$er_kol=0; $su_kol=0;
foreach($_POST['email'] as $key => $val){
$sql = 'UPDATE '.$ST['dbpf'].'_users SET email="'.$val.'" WHERE id='.$key.'';
$rez = $DB->QUR($sql);
if(!$rez['err'])$su_kol++; else $er_kol++;
}
$out['html'] .= ' | Email: успех:'.$su_kol.'; ошибок: '.$er_kol.'';
}
if($_POST['ajdes']=='send_email'){//получение инфы о преподе
$user_id = (int)$_POST['user_id'];
//$user_id = 1;
$email = $_POST['email'];
//$email = 'alneo.ru@yandex.ru';
$message = nl2br($_POST['message']);
$message .= "\n<br>---<br>\nВас проверял: ".$_SESSION['user']['fio'].' '.date('H:i d.m.Y');
$html='';
if($email!=''){
//$e = send_email('EIOS.MKGTU.RU Результаты проверки',$message,$email);
//if($e) $html .= 'Письмо пользователю отправлено!<br>';
//else $html .= 'Письмо пользователю не отправлено!<br>';
$params['eml']['email']=$email;
$params['eml']['title']='EIOS.MKGTU.RU Результаты проверки';
$params['eml']['message']=$message;
}
//$sql = 'INSERT INTO '.$ST['dbpf'].'_pm VALUES (0,'.mktime().','.$_SESSION['user']['id'].','.$user_id.',"'.$message.'",2,1,"")';
//$rez = $DB->QUR($sql);
//if(!$rez['err']) $html .= 'Личное сообщение на сайте отправлено!<br>';
//else $html .= 'Личное сообщение на сайте не отправлено!<br>';
include_once 'inc/pm_route.php';
$params['pm']['otkogo_user_id'] = $_SESSION['user']['id'];
$params['pm']['komu_user_id'] = $user_id;
$params['pm']['message_text'] = $message;
$params['pm']['from_status'] = 2;
$params['pm']['to_status'] = 1;
$params['pm']['file'] = '';
$pm_rez = PM_SEND($params);
if($pm_rez['eml']['send']==1) $html .= 'Письмо пользователю отправлено!<br>'; else $html .= 'Письмо пользователю не отправлено!<br>';
if($pm_rez['pm']['send']==1) $html .= 'Личное сообщение на сайте отправлено!<br>'; else $html .= 'Личное сообщение на сайте не отправлено!<br>';
//$out['html'] = '<pre>'.print_r($_POST,1).'</pre>';
$out['html'] = $html;
}
if($_POST['ajdes']=='get_info_prepod'){//получение инфы о преподе
$id = (int)$_POST['id'];
$what=$_POST['what'];
$fio='';
$sql = 'SELECT u.id,u.fio,t.id as tid FROM '.$ST['dbpf'].'_users as u,'.$ST['dbpf'].'_teachers as t WHERE u.id='.$id.' AND t.id_user=u.id LIMIT 1';
$rez = $DB->QUR_SEL($sql);
if($rez){
$id = $rez[1]['id'];
$fio = $rez[1]['fio'];
$tid = $rez[1]['tid'];
$file = '../tmp/get_info_prepod/'.translit($fio).'_'.$id.'.json';
//if(!file_exists($file)){ //нужно связаться с расчетом часов и узнать
if(!file_exists($file)){ //нужно связаться с расчетом часов и узнать
$url = 'http://local.mkgtu.ru/calchour_2023/get_json.php?json=get_info_prepod&fio='.urlencode($fio).'';
$json = file_get_contents($url);
file_put_contents($file,$json);
}else{
$json = file_get_contents($file);
}
$html = prepod_check_status($json,$tid,$what);
}
$out['html'] = $html;
}
echo json_encode($out);
exit();
}
//echo '<pre>'.print_r($_GET,1).'</pre>';
function get_kafedra_disciplin($kafedra,$sem='9'){//получение дисциплин из учебного плана
$file = 'tmp/statuses/json_get_disciplins_'.md5($kafedra.$sem).'.json';
//if((time()-$ft)>(60*60*24*30)) unlink($file);//файл обновляется 1 раз в 30 дней
if((time()-$ft)>(60*60*24*30)) unlink($file);//файл обновляется 1 раз в 30 дней
if(!file_exists($file)){
//if(true){
$url = 'http://local.mkgtu.ru/calchour_2023/get_json.php?json=get_disciplins&kafedra='.urlencode($kafedra).'&sem='.urlencode($sem).'';
$json = file_get_contents($url);
file_put_contents($file,$json);
}else{
$json = file_get_contents($file);
}
//$json1 = array_unique(json_decode($json,1));
$json1 = json_decode($json,1);
return $json1;
}
/**
* Функция для получения уникального ассоциативного массива по ключу
* @var $key - ключ, по которому будет выборка
* @var $array - исходный массив
*
* @return - Вернет уникальный массив
*/
/*function getUniqueArray($key, $array){
$arrayKeys = array(); // массив для хранения ключей
$resultArray = array(); // выходной массив
foreach($array as $one){ // проходим циклом по всему исходному массиву
if(!in_array($one[$key], $arrayKeys)){ // если такого значения еще не встречаласть, то
$arrayKeys[] = $one[$key]; // пишем значение ключа в массив, для дальнейшей проверки
$resultArray[] = $one; // записываем уникальное значение в выходной массив
}
}
return $resultArray; // возвращаем массив
}*/
if(isset($_GET['page'])){
if ($_GET['page'] == 'st39_8'){ //активность преподавателЯ
$st_view='st39_8';
$logs = array();
//proverka активности преподавателя
if (isset($_POST['search_active'])){
$fio = $_POST["fio"];
$sql='SELECT * FROM '.$ST['dbpf'].'_logs WHERE message LIKE "%'.$fio.'%" ORDER BY data_c DESC';
$rez=$DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
//проверяем является ли он преподавателем
$part = explode("id:", $val['message']);
$part = explode("-", $part[1]);
$sql2 = 'SELECT * FROM '.$ST['dbpf'].'_teachers WHERE id_user = "'.$part[0].'" ';
$rez2 = $DB->QUR_SEL($sql2);
/***/
if ($rez2) if ($rez2[0] > 0){
$val['data_c'] = date('H:i:s d.m.Y',$val['data_c']);
$val['message'] = stripslashes($val['message']);
$logs[] = $val;
}
}
}
}
//активные преподаватели
$teachers = array();
$sql = 'SELECT teach.*, us.* FROM '.$ST['dbpf'].'_teachers as teach, '.$ST['dbpf'].'_users as us WHERE NOT (teach.status = "-1") AND us.id = teach.id_user ';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$teachers[] = $val;
}
}
/*************/
$smarty->assign('teachers',$teachers);
$smarty->assign('logs',$logs);
$smarty->assign('st_view',$st_view);
}
if($_GET['page']=='st39_7'){//активность преподавателей
$kafedra = urldecode($_GET['des']);
$st_view='st39_7';
$teachers = array();
//выводим список преподавателей
$sql = 'SELECT us.*, teach.* FROM '.$ST['dbpf'].'_users as us, '.$ST['dbpf'].'_teachers as teach WHERE teach.id_user = us.id AND teach.kafedra = "Физического воспитания" ';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$teachers[] = $val;
}
}
//выводим список всех кафедр
$kafedres = array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_kafedres ORDER BY code';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
$kafedres[] = $val;
}
}
$smarty->assign('kafedres',$kafedres);
$smarty->assign('teacher',$teachers);
$smarty->assign('st_view',$st_view);
}
if($_GET['page']=='st39_6'){//активность студентов группы
$kafedra = urldecode($_GET['des']);
$st_view='st39_6'; $grupp=array();
//выбираем список групп
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs';
$rez=$DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$grupp[] = $val;
//if($id==$val['id']) $out[$key]['active']=1;
}
}
$smarty->assign('grupp',$grupp);
$smarty->assign('st_view',$st_view);
}
if($_GET['page']=='st39_5'){//незарегистрирвоанные кафедры
$st_view='st39_5'; $smarty->assign('st_view',$st_view);
$prkaf = iup_check_kafedras();
$kafs = array();
foreach($prkaf as $key => $val){
foreach($val['kafs'] as $key1 => $val1){
if(!in_array($val['fio'],$kafs[$val1])){
$tmp['fio']=$val['fio'];
$tmp['check_learn']=check_fio_inlearn($val['fio']);
$kafs[$val1][] = $tmp;
}
}
}
//echo '<pre>'.print_r($kafs,1).'</pre>';
$smarty->assign('kafs',$kafs);
}
if($_GET['page']=='st39_4'){//активность кафедры
$kafedra = urldecode($_GET['des']);
$st_view='st39_4'; $users=array();
$m1=array('Вошел пользователь');
$m2=array('Вход');
$sql = 'SELECT u.id as uid,u.fio,u.email,u.foto,t.* FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE t.id_user=u.id AND t.kafedra="'.$kafedra.'" AND u.status>-1 AND t.status>-1 AND NOT (u.fio = "") ORDER BY u.fio ';
if ($kafedra == "Политехнический колледж МГТУ") $sql = 'SELECT u.id as uid,u.fio,u.email,u.foto,t.* FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE t.id_user=u.id AND t.kafedra="'.$kafedra.'" AND u.status>-1 AND t.status>-1 AND NOT (u.fio = "") ORDER BY u.fio LIMIT 15';
//по умолчанию выводим логи за последние день
//$date_start = date("U")-2*24*60*60;
$date_start = mktime(0,0,0,date('m'),date('d')-2,date('Y'));
$date_end = mktime(0,0,0,date('m'),date('d')+1,date('Y'));
if ($kafedra == "Политехнический колледж МГТУ") {
//$date_start = date("U")-1*24*60*60;
$date_start = mktime(0,0,0,date('m'),date('d')-1,date('Y'));
}
//echo date('H:i:s d.m.Y',$date_start);//23:03:38 24.04.2020
//echo $sql;
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
//$sql1 = 'SELECT * FROM '.$ST['dbpf'].'_logs WHERE message LIKE "%'.$val['fio'].'%" ORDER BY data_c DESC';
//$sql1 = 'SELECT * FROM '.$ST['dbpf'].'_logs WHERE message LIKE "%'.$val['fio'].'%" AND NOT (message LIKE "%Вход%") AND data_c >= '.$date_start.' ORDER BY data_c DESC';
$sql1 = 'SELECT * FROM '.$ST['dbpf'].'_logs WHERE message LIKE "%'.$val['fio'].'%" AND data_c >= '.$date_start.' AND data_c <= '.$date_end.' ORDER BY data_c DESC';
$rez1 = $DB->QUR_SEL($sql1);
//echo $sql1.'<pre>'.print_r($rez1,1).'</pre>';
if($rez1){
foreach($rez1 as $key1 => $val1)if($key1){
$val1['data_c'] = date('H:i <b>d.m.Y</b>',$val1['data_c']);
$val1['message'] = str_replace($m1,$m2,$val1['message']);
$val1['message'] = str_replace($val['fio'],'',$val1['message']);
$val1['message'] = str_replace($val['uid'],'',$val1['message']);
$val1['message'] = str_replace('id:','',$val1['message']);
$val1['message'] = str_replace('-: ','',$val1['message']);
$val1['message'] = str_replace(' :','',$val1['message']);
$val['logs'][] = $val1;
}
}
$users[] = $val;
}
}
//echo '<pre>'.print_r($users,1).'</pre>';
$smarty->assign('date_end',$date_end);
$smarty->assign('date_start',$date_start);
$smarty->assign('kafedra',$kafedra);
$smarty->assign('users',$users);
$smarty->assign('st_view',$st_view);
}
if($_GET['page']=='st39_3'){//список дисциплин по кафедрам
$st_view='39_3';
if(!in_array(39,$_SESSION['user']['statuses'])) {header('Location: https://eios.mkgtu.ru/'); exit();}
$sem=1; if(isset($_GET['des'])) $sem=$_GET['des'];
$kafedras=array();
$sql = 'SELECT kafedra FROM '.$ST['dbpf'].'_teachers GROUP BY kafedra ORDER BY kafedra ';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
//echo $val['kafedra'].' = '.count($val['kafedra']).'<br>';
if(strlen($val['kafedra'])>1){
$val['url'] = urlencode($val['kafedra']);
//echo 'http://local.mkgtu.ru/calchour_2017/get_json.php?json=get_disciplins&kafedra='.$val['kafedra'].'&sem='.urlencode('7,8').'<br>';
$val['disciplins'] = get_kafedra_disciplin($val['kafedra'],$sem);
$kafedras[]=$val;
}
}
}
//делаем значения элементов массива уникальным
//$kafedras = array_unique($kafedras);
//echo '<pre>'.print_r($kafedras,1).'</pre>';
$smarty->assign('sem',$sem);
$smarty->assign('kafedras',$kafedras);
$smarty->assign('st_view',$st_view);
}
if($_GET['page']=='st39_2'){//список студентов
$st_view='39_2';
$m1=array('(м)','(М)','(ИУП)','(я)');
$m2=array('','','','');
$g0=array(); $ngrupps=array(); $users=array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs,fo';
if(isset($_GET['des'])){
if($_GET['des']=='print'){//печатаем группу
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id='.(int)$_GET['id'].' ORDER BY sokr,kurs,fo';
}
}
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$ng = str_replace($m1,$m2,$val['sokr']);
$tng = explode('(',$ng);
$val['og']=trim($tng[0]);
$g0[$val['id']]=$val;
}
}
//TO DO: при печати тоже надо выбрать только нужных
$sql = 'SELECT u.id as uid,u.fio,u.email,u.pass,u.data_u,s.id,s.id_grupp,s.num_zach,s.num_grupp FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE u.id=s.id_user AND NOT(u.status = -1) ORDER BY s.num_grupp,u.fio';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$val['data_u'] = date('H:i d.m.Y',$val['data_u']);
if(isset($g0[$val['id_grupp']])){
$g0[$val['id_grupp']]['students'][] = $val;
}else{//нет такой группы
$ngrupps[] = $val;
}
}
}
$print=0; $print0=0; $print1=0;
if(isset($_GET['des'])){
if($_GET['des']=='print') $print=1;
if($_GET['des']=='print0') $print0=1;
if($_GET['des']=='print1') $print1=1;
}
$grupps=array();
foreach($CF['fak_kaf'] as $fak => $v){
foreach($v as $grup => $kaf){
foreach($g0 as $k1 => $v1){
if($v1['og']==trim($grup)){
$add=true;
if($print1){
if($_GET['dop']==$kaf) $add=true; else $add=false;
}
if($print0){
if($_GET['dop']==$fak) $add=true; else $add=false;
}
if($add) $grupps[$fak][$kaf][]=$v1;
unset($g0[$k1]);
}
}
}
}
if($print){ $smarty->assign('print',1); }else $smarty->assign('print',0);
if($print0){ $smarty->assign('print0',1); }else $smarty->assign('print0',0);
if($print1){ $smarty->assign('print1',1); }else $smarty->assign('print1',0);
/*$g0 = '';
$ngrupps = '';*/
$smarty->assign('st_view',$st_view);
$smarty->assign('grupps',$grupps);//группы по факультетам и кафедрам
$smarty->assign('g0',$g0);//группы не совпадающие по факультетам и кафедрам
$smarty->assign('ngrupps',$ngrupps);//группы не совпадающие по группам
$smarty->assign('fak_kaf',$CF['fak_kaf']);
//echo '<pre>'.print_r($grupps,1).'</pre>'.$_GET['dop'];
/*echo '<pre>'.print_r($grupps,1).'</pre>';
echo '<pre>'.print_r($g0,1).'</pre>';*/
if($print||$print0||$print1){//печатаем группу
$smarty->assign('time',date('H:i d.m.Y'));
$smarty->display('tpl_statuses_grupp_print.html');
exit();
}
}
if($_GET['page']=='st39_1'){
if(isset($_POST['link_kafs'])){
//echo '<prE>'.print_r($_POST,1).'</pre>';
foreach($_POST['kafs'] as $fio => $kaf)if($kaf!=''){
$sql = 'SELECT t.id FROM '.$ST['dbpf'].'_users as u,'.$ST['dbpf'].'_teachers as t WHERE u.fio="'.$fio.'" AND t.id_user=u.id LIMIT 1';
$rez = $DB->QUR_SEL($sql);
if($rez){
$sql = 'UPDATE '.$ST['dbpf'].'_teachers SET kafedra="'.$kaf.'" WHERE id='.$rez[1]['id'].' LIMIT 1';
$rez = $DB->QUR($sql);
}
}
}
$kafs = iup_check_kafedras(); //echo '<prE>'.print_r($kafs,1).'</pre>';
if(!in_array(39,$_SESSION['user']['statuses'])) {header('Location: http://learn-mkgtu.ru/'); exit();}
$st_view='39_1'; $smarty->assign('st_view',$st_view);
$sql = 'SELECT u.id as uid,u.fio,u.foto,t.* FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE t.id_user=u.id ORDER BY u.fio';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$val['data_u'] = date('H:i d.m.Y',$val['data_u']);
$users[]=$val;
}
}
$smarty->assign('kafs',$kafs);
$smarty->assign('users',$users);
}
if($_GET['page']=='st39'){//отображение кафедр
$check=false; $whatshow=1;
if(in_array(39,$_SESSION['user']['statuses'])) $check=true;//группа проверки
if(in_array(21,$_SESSION['user']['statuses'])) $check=true;//зем. декана (добавлено по просьбе Кучинской)
else{
if(in_array(30,$_SESSION['user']['statuses'])) {//зав.кафедрой
$check=true;
if(!isset($_SESSION['user']['teacher']['kafedra'])||$_SESSION['user']['teacher']['kafedra']=='') $check=false;
else {
$whatshow=2;
$_GET['des'] = $_SESSION['user']['teacher']['kafedra'];
}
}
}
if(!$check){header('Location: https://eios.mkgtu.ru/'); exit();}
if(isset($_GET['des'])){//выберем всех преподавателей кафедры
$kafedra = urldecode($_GET['des']);
$st_view='st39_01'; $users=array();
$sql = 'SELECT u.id as uid,u.fio,u.email,u.foto,t.*,t.id as id_teacher, u.data_u as date_active FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE t.id_user=u.id AND t.kafedra="'.$kafedra.'" AND u.status>-1 ORDER BY u.fio';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$val['data_u'] = date('H:i d.m.Y',$val['date_active']);
$file = 'tmp/get_info_prepod/_y2023__'.translit($val['fio']).'_'.$val['id'].'.json';
if(!file_exists($file)){ //нужно связаться с расчетом часов и узнать
//if(true){ //нужно связаться с расчетом часов и узнать
//echo 'Файла: '.$file.' нет<br>';
$url = 'http://local.mkgtu.ru/calchour_2023/get_json.php?json=get_info_prepod&fio='.urlencode($val['fio']).'';
//echo $url.'<br>';
$json = file_get_contents($url);
//echo $json;
file_put_contents($file,$json);
}else{
//echo 'Файла: '.$file.' есть<br>';
$json = file_get_contents($file);
}
$json = json_decode($json,1);
$val['predmets']=array(); $val['issemestr']=array();
//значения дублировались повторно - данная функция позволяет сделать массив уникальным по значениям определенного ключа
$json['db'] = getUniqueArray('id_ucheb_plan', $json['db']);
foreach($json['db'] as $k => $v){
$show=true;
foreach($nopredm as $k1 => $v1) if(strpos($v['name_disp'],$v1)!==false) $show=false;
if($show){
$z=array();
$z['name_disp']=$v['name_disp'];
$z['name_disp'] = trim(preg_replace('/[\t\n\r\s]+/', ' ', $z['name_disp']));
$z['lekcii']=$v['lekcii'];
$z['prakt_sem_zan']=$v['prakt_sem_zan'];
$z['lab_zan']=$v['lab_zan'];
$z['kr']=$v['kr'];
$z['kur']=$v['kur'];
$z['kup']=$v['kup'];
$z['uch_pr']=$v['uch_pr'];
$z['uch_pr_p']=$v['uch_pr_p'];
$z['proizv_pr']=$v['proizv_pr'];
$z['preddip_pr']=$v['preddip_pr'];
$z['spec']=$v['spec'];
$z['kurs']=$v['kurs'];
$z['semestr']=$v['semestr'];
$z['fo']=$v['fo'];
//if($val['uid']==7102) { echo $val['uid'].'='.$val['id'].'<br>'; }
//$z['statuses'] = check_material_rc($val['uid'],$val['id'],$z); //ДЛЯ СТАРЫХ ПРОВЕРОК ТОЛЬКО
//--------------------------------------------------
$z['id'] = $v['id'];
$z['id_ucheb_plan'] = $v['id_ucheb_plan'];
$id_u_p = $v['id_ucheb_plan'];
//находим айдишник предмета, с которым нужно работать
$name_disp = $v['name_disp'];
$name_disp = trim(preg_replace('/[\t\n\r\s]+/', ' ', $name_disp));
$kurs_pr = $v['kurs'];
$semestr_pr = $v['semestr'];
$sql3 = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE `name` = "'.$name_disp.'" AND `kurs` = '.$kurs_pr.' AND `semestr` = '.$semestr_pr.' ORDER BY `id` DESC';
//$sql3 = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE `name` = "'.$name_disp.'" ';
$rez3 = $DB->QUR_SEL($sql3);
if ($rez3) $id_what = $rez3[1]['id'];
else $id_what = 0;
$z['id_what'] = $id_what;
//*********
//echo $v['name_disp'];
//ТАКЖЕ ПОДГРУЖАЕМ ВЕСЬ УЧЕБНЫЙ МАТЕРИАЛ ДАННОГО ПРЕПОДАВАТЕЛЯ - ЧТОБЫ СРАВНИВАТЬ
$z['myLection'] = get_lection_teacher($val['id_teacher'], $name_disp, $v['kurs'], $v['semestr']);
//$z['myLection'] = get_lection_teacher($val['id_teacher'], $v['name_disp'], $v['kurs'], $v['semestr']);
$z['rabProgram'] = get_lection_teacher($val['id_teacher'], $name_disp, $v['kurs'], $v['semestr'], 1);
//$z['rabProgram'] = get_lection_teacher($val['id_teacher'], $v['name_disp'], $v['kurs'], $v['semestr'], 1);
//echo '<pre>'; print_r($z['myLection']); echo '</pre>'; //exit;
//*****/
$val['predmets'][]=$z;
if(!in_array($v['semestr'],$val['issemestr'])) $val['issemestr'][]=$v['semestr'];
}
}
sort($val['issemestr']);
//if($val['uid']==7102) { echo '<pre>'.print_r($json['db'],1).'</pre>'; echo '<pre>'.print_r($val,1).'</pre>'; exit(); }
$users[]=$val;
}
//echo '<pre>'.print_r($users,1).'</pre>';
}
$smarty->assign('users',$users);
$smarty->assign('whatshow',$whatshow);
$smarty->assign('kafedra',$kafedra);
}
else{//выберем все кафедры
$st_view='st39'; $kafedras=array();
$sql = 'SELECT kafedra FROM '.$ST['dbpf'].'_teachers GROUP BY kafedra ORDER BY kafedra';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
//echo $val['kafedra'].' = '.count($val['kafedra']).'<br>';
if(strlen($val['kafedra'])>1){
$val['url'] = urlencode($val['kafedra']);
$kafedras[]=$val;
}
}
}
$smarty->assign('kafedras',$kafedras);
}
$smarty->assign('st_view',$st_view);
}
if($_GET['page']=='st39_0'){//отображение всех преподавателей
if(!in_array(39,$_SESSION['user']['statuses'])) {header('Location: http://learn-mkgtu.ru/'); exit();}
$st_view='st39_0'; $users=array();
// здесь лучше добавить выбор кафедры!
$nopredm=array('РВКР','РИМ ','ЗДН ','ОЛ','РИН','ГЭЗ','ЗВКР','РАД ','ЗДВ ','ЗДО');
//выберем всех преподавателей
$sql = 'SELECT u.id as uid,u.fio,u.foto,t.* FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE t.id_user=u.id ORDER BY u.fio';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$val['data_u'] = date('H:i d.m.Y',$val['data_u']);
$users[]=$val;
}
}
$smarty->assign('st_view',$st_view);
$smarty->assign('users',$users);
}
$smarty->assign('user',$_SESSION['user']);
$maincontent = $smarty->fetch('tpl_statuses.html');
}
function check_fio_inlearn($fio){
GLOBAL $ST,$DB; $out=array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_users WHERE fio="'.$fio.'"';
$rez = $DB->QUR_SEL($sql);
if($rez){
$out['msg']='';
foreach($rez as $key => $val)if($key){
$tmp['id'] = $val['id'];
$tmp['email'] = $val['email'];
//$rez1 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_teachers WHERE id_user='.$val['id'].'');
$rez1 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_teachers WHERE id_user='.$val['id'].' AND `status` = -1 ');
if($rez1) $tmp['teacher'] = $rez1[1]; else $tmp['teacher'] = array();
$out['users'][]=$tmp;
}
}else{
$out['msg']='Точного совпадения нет! Выберем Фамилию и имя';
$t=explode(' ',$fio); unset($t[count($t)-1]);
$sql = 'SELECT * FROM '.$ST['dbpf'].'_users WHERE fio LIKE "%'.implode(' ',$t).'%"';
//$out['msg'].=$sql;
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$tmp['id'] = $val['id'];
$tmp['email'] = $val['email'];
//$rez1 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_teachers WHERE id_user='.$val['id'].'');
$rez1 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_teachers WHERE id_user='.$val['id'].' AND `status` = -1');
if($rez1) $tmp['teacher'] = $rez1[1]; else $tmp['teacher'] = array();
$out['users'][]=$tmp;
}
}else{
$out['msg']='Совпадения по Фамилии и имени нет!';
}
}
return $out;
}
function check_material($t,$mat,$grups,$jarr){//проверка что загрузил в расчете часов
$out = array(); $out['html']='';//'<pre>'.print_r($mat,1).''.print_r($grups,1).''.print_r($jarr['db'],1).'</pre>';
//$mat['kurs'] $mat['semestr'] $mat['name']
//$grups[]=array('sokr'=>$rez[1]['sokr'],'kurs'=>$rez[1]['kurs'],'fo'=>$rez[1]['fo']);
$txt=''; $all=count($grups); $proc=0;
foreach($jarr['db'] as $key => $val){
if($t=='lection'){
if($val['lekcii']!=0){
if($val['name_disp']==$mat['name']){
$g=0; $gn=''; //$proc+=100/$all;
foreach($grups as $k => $v){
if($val['spec']==$v['sokr']&&$val['kurs']==$v['kurs']&&$val['fo']==$v['fo']){
$g=1;
$gn=$v['sokr'].'-'.$val['kurs'].' '.$val['fo'];
$proc+=(100/$all)/$all;
}
}
if($g) $txt.='Дисциплина '.$gn.' OK; '."\n";
}
}
}
if($t=='practich'){
if($val['prakt_sem_zan']!=0){
if($val['name_disp']==$mat['name']){
$g=0; $gn=''; //$proc+=100/$all;
foreach($grups as $k => $v){
if($val['spec']==$v['sokr']&&$val['kurs']==$v['kurs']&&$val['fo']==$v['fo']){
$g=1;
$gn=$v['sokr'].'-'.$val['kurs'].' '.$val['fo'];
$proc+=(100/$all)/$all;
}
}
if($g) $txt.='Дисциплина '.$gn.' OK; '."\n";
}
}
}
if($t=='controln'){
if($val['kr']!=0){
if($val['name_disp']==$mat['name']){
$g=0; $gn=''; //$proc+=100/$all;
foreach($grups as $k => $v){
if($val['spec']==$v['sokr']&&$val['kurs']==$v['kurs']&&$val['fo']==$v['fo']){
$g=1;
$gn=$v['sokr'].'-'.$val['kurs'].' '.$val['fo'];
$proc+=(100/$all)/$all;
}
}
if($g) $txt.='Дисциплина '.$gn.' OK; '."\n";
}
}
}
if($t=='kursov'){
if($val['kur']!=0||$val['kup']!=0){
if($val['name_disp']==$mat['name']){
$g=0; $gn=''; //$proc+=100/$all;
foreach($grups as $k => $v){
if($val['spec']==$v['sokr']&&$val['kurs']==$v['kurs']&&$val['fo']==$v['fo']){
$g=1;
$gn=$v['sokr'].'-'.$val['kurs'].' '.$val['fo'];
$proc+=(100/$all)/$all;
}
}
if($g) $txt.='Дисциплина '.$gn.' OK; '."\n";
}
}
}
if($t=='praktika'){
if($val['uch_pr']!=0||$val['uch_pr_p']!=0||$val['proizv_pr']!=0||$val['preddip_pr']!=0){
if($val['name_disp']==$mat['name']){
$g=0; $gn=''; //$proc+=100/$all;
foreach($grups as $k => $v){
if($val['spec']==$v['sokr']&&$val['kurs']==$v['kurs']&&$val['fo']==$v['fo']){
$g=1;
$gn=$v['sokr'].'-'.$val['kurs'].' '.$val['fo'];
$proc+=(100/$all)/$all;
}
}
if($g) $txt.='Дисциплина '.$gn.' OK; '."\n";
}
}
}
}
$out['all'] =$all;
$out['proc']=$proc;
if($proc==0) $out['color']='#b94a48';
if($proc>0&&$proc<50) $out['color']='#c48a62';
if($proc==50) $out['color']='#c4bb62';
if($proc>50&&$proc<100) $out['color']='#9fc462';
if($proc==100) $out['color']='#62c462';
if($proc>100) $out['color']='#00a900';
$out['html'].=''.$txt.'';
$out['div']='<div class="tooltips" data-trigger="hover" data-placement="bottom" data-original-title="'.$out['html'].'" style="position: absolute;right: 0px;top: 0px;background-color:'.$out['color'].';padding:2px;">'.$out['proc'].'</div>';//.'<pre>'.print_r($mat,1).''.print_r($grups,1).''.print_r($jarr['db'],1).'</pre>';
return $out;
}
//здесь добавлял еще семестр но пришлось убрать(((
function check_material_rc($id_user,$id_teacher,$z){//проверка по расчете часов планам выбираем то что загруид в леарн
GLOBAL $ST,$DB; $out=array();
if ($z['fo'] == 'оч') $z['fo'] = 'ОФО';
elseif ($z['fo'] == 'заоч') $z['fo'] = 'ЗФО';
else $z['fo'] = 'ОЗФО';
//if ($id_teacher == 304) { echo '<pre>'; print_r ($z); echo '</pre>';}
$out['lection']=0; $out['controln']=0; $out['kursov']=0; $out['praktika']=0;
$out['practich']=0; //0 - нет практических и групп, 1 - нет практических, 2 - есть все
if($z['lekcii']!=0){//lection
$out['lection']=0;
//$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$id_teacher.' AND name="'.$z['name_disp'].'" AND kurs='.$z['kurs'];//.' AND semestr='.$z['semestr'].''
$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$id_teacher.' AND name="'.$z['name_disp'].'" AND type="лек" AND kurs='.$z['kurs'];//.' AND semestr='.$z['semestr'].''
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$out['lection']=1;
$sql1 = 'SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND lg.id_grupp=g.id AND g.sokr="'.$z['spec'].'" AND g.kurs="'.$z['kurs'].'" AND g.fo="'.$z['fo'].'"';
$rez1 = $DB->QUR_SEL($sql1);
//echo $sql1.':<pre>'.print_r($rez1,1).'</pre>';
//$out['lection_rez'][]=$rez1;
//$out['lection_kol']++;
if($rez1!=''){
foreach($rez1 as $key1 => $val1)if($key1){
$out['lection']=2;
}
}
}
}
}
if($z['prakt_sem_zan']!=0||$z['lab_zan']!=0){//practich
//NEW SPOSOB
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE sokr LIKE "%'.$z['spec'].'-'.$z['kurs'].'%" AND fo = "'.$z['fo'].'"';
//if ($id_teacher == 304) echo $sql.';<br />';
$rez = $DB->QUR_SEL($sql);
if ($rez){
foreach ($rez as $key => $val) if ($key){
//$out['practich'] = 1;
$sql1 = 'SELECT lec.*,lg.* FROM '.$ST['dbpf'].'_lections as lec, '.$ST['dbpf'].'_lections_grupp as lg WHERE lec.id = lg.id_lections AND lg.id_grupp = "'.$val['id'].'" AND lec.name="'.$z['name_disp'].'" AND lec.type="лаб" AND lec.kurs="'.$z['kurs'].'" AND lec.semestr="'.$z['semestr'].'" ';
//$sql1 = 'SELECT lec.* FROM '.$ST['dbpf'].'_lections as lec, '.$ST['dbpf'].'_lections_grupp as lg WHERE lec.id_teacher='.$id_teacher.' AND lec.id = lg.id_lections AND lg.id_grupp = "'.$val['id'].'" AND lec.name="'.$z['name_disp'].'" AND lec.type = "лаб" AND lec.kurs="'.$z['kurs'].'" AND lec.semestr="'.$z['semestr'].'"';
//$sql1 = 'SELECT lec.* FROM '.$ST['dbpf'].'_lections as lec, '.$ST['dbpf'].'_lections_grupp as lg WHERE lec.id_teacher='.$id_teacher.' AND lec.id = lg.id_lections AND lg.id_grupp = "'.$val['id'].'" AND lec.name="'.$z['name_disp'].'" AND lec.type = "лаб" ';
//if ($id_teacher == 304) echo $sql1.';<br />';
$rez1 = $DB->QUR_SEL($sql1);
//print_r($rez1);
foreach ($rez1 as $key1 => $val1) if ($key1) {
$out['practich'] = 2; break;
}
//if ($id_teacher == 304) echo $out['practich'].'<br />';
//if ($out['practich'] == 2) break; //если все отлично в одном случае, то дальше можно не проверять
}
}
//if ($id_teacher == 304) echo $out['practich'];
//СТАРЫЙ СПОСОБ
//$sql = 'SELECT l.id FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_practich as p WHERE l.id_teacher='.$id_teacher.' AND l.name="'.$z['name_disp'].'" AND l.kurs='.$z['kurs'].' AND p.id_lection=l.id';// AND l.semestr='.$z['semestr'].'
/*$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$id_teacher.' AND name="'.$z['name_disp'].'" AND type="лаб" AND kurs='.$z['kurs'].' AND semestr = '.$z['semestr'].' GROUP BY id';
if ($id_teacher == 297) echo $sql.';<br />';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$out['practich']=1;
//$sql1 = 'SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND lg.id_grupp=g.id AND g.sokr="'.$z['spec'].'" AND g.kurs="'.$z['kurs'].'" AND g.fo="'.$z['fo'].'"';
//$sql1 = 'SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND lg.id_grupp=g.id AND g.sokr LIKE "'.$z['spec'].'-'.$z['kurs'].'%" AND g.fo="'.$z['fo'].'" ';
$sql1 = 'SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND lg.id_grupp=g.id AND g.sokr LIKE "'.$z['spec'].'-'.$z['kurs'].'%" AND g.fo="'.$z['fo'].'" ';
if ($id_teacher == 297) echo $sql1.';<br />';
$rez1 = $DB->QUR_SEL($sql1);
if($rez1){
foreach($rez1 as $key1 => $val1)if($key1){
$out['practich']=2;
}
}
}
}*/
}
if($z['kr']!=0){//controln
$out['controln']=0;
//$sql = 'SELECT l.id FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_controln as p WHERE l.id_teacher='.$id_teacher.' AND l.name="'.$z['name_disp'].'" AND l.kurs='.$z['kurs'].' AND p.id_lection=l.id';// AND l.semestr='.$z['semestr'].'
$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$id_teacher.' AND name="'.$z['name_disp'].'" AND type="контр" AND kurs='.$z['kurs'];
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$out['controln']=1;
$sql1 = 'SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND lg.id_grupp=g.id AND g.sokr="'.$z['spec'].'" AND g.kurs="'.$z['kurs'].'" AND g.fo="'.$z['fo'].'"';
$rez1 = $DB->QUR_SEL($sql1);
if($rez1){
foreach($rez1 as $key1 => $val1)if($key1){
$out['controln']=2;
}
}
}
}
}
if($z['kur']!=0||$z['kup']!=0){//kursov
$out['kursov']=0;
//$sql = 'SELECT l.id FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_kursov as p WHERE l.id_teacher='.$id_teacher.' AND l.name="'.$z['name_disp'].'" AND l.kurs='.$z['kurs'].' AND p.id_lection=l.id';// AND l.semestr='.$z['semestr'].'
$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$id_teacher.' AND name="'.$z['name_disp'].'" AND type="курс" AND kurs='.$z['kurs'];
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$out['kursov']=1;
$sql1 = 'SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND lg.id_grupp=g.id AND g.sokr="'.$z['spec'].'" AND g.kurs="'.$z['kurs'].'" AND g.fo="'.$z['fo'].'"';
$rez1 = $DB->QUR_SEL($sql1);
if($rez1){
foreach($rez1 as $key1 => $val1)if($key1){
$out['kursov']=2;
}
}
}
}
}
if($z['uch_pr']!=0||$z['uch_pr_p']!=0||$z['proizv_pr']!=0||$z['preddip_pr']!=0){//praktika
$out['praktika']=0;
//$sql = 'SELECT l.id FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_praktika as p WHERE l.id_teacher='.$id_teacher.' AND l.name="'.$z['name_disp'].'" AND l.kurs='.$z['kurs'].' AND p.id_lection=l.id';// AND l.semestr='.$z['semestr'].'
$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$id_teacher.' AND name="'.$z['name_disp'].'" AND type="практика" AND kurs='.$z['kurs'];
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $key => $val)if($key){
$out['praktika']=1;
$sql1 = 'SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND lg.id_grupp=g.id AND g.sokr="'.$z['spec'].'" AND g.kurs="'.$z['kurs'].'" AND g.fo="'.$z['fo'].'"';
$rez1 = $DB->QUR_SEL($sql1);
if($rez1){
foreach($rez1 as $key1 => $val1)if($key1){
$out['praktika']=2;
}
}
}
}
}
return $out;
}
function prepod_check_status($json,$tid,$what=''){//получение аякс данных по разделам
GLOBAL $ST,$DB;
$out='';//'<pre>'.print_r(json_decode($json,1),1).'</pre>';
$jarr = json_decode($json,1);
if($what=='workprogram'){
//выберем у препода все рабочие программы
$sql = 'SELECT * FROM '.$ST['dbpf'].'_workprogram WHERE id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);//$out.=$sql.'<pre>'.print_r($rez,1).'</pre>';
if($rez){
$out .= '<table class="table">';
$out .= '<thead><tr>
<th width="40%">Рабочая программа</th>
<th width="10%">Обновлена</th>
<th width="30%">Специальность</th>
<th width="10%">Семестры</th>
<th width="10%">Файл</th>
</tr></thead><tbody>';
foreach($rez as $key => $val)if($key){
$ksf='';$ksfa=array(); $ksfa['och']=''; $ksfa['zao']='';
/*$kursy=explode('|',$val['kurs']);
$semey=explode('|',$val['semestr']);
$foy=explode('|',$val['fo']);
$t=explode(',',$kursy[0]); foreach($t[0] as $k => $v){ if ($v!=0) $ksfa['och'][($k+1)]=1; }
$t=explode(',',$kursy[1]); foreach($t[1] as $k => $v){ if ($v!=0) $ksfa['zao'][($k+1)]=1; }
$t=explode(',',$semey[0]); foreach($t[0] as $k => $v){ if ($v!=0) $ksfa['och'][($k+1)]=1; }
$t=explode(',',$semey[1]); foreach($t[1] as $k => $v){ if ($v!=0) $ksfa['zao'][($k+1)]=1; }*/
$semey=explode('|',$val['semestr']);
$t=explode(',',$semey[0]); foreach($t as $k => $v){ if ($v!=0) $ksfa['och'].=($k+1).','; }
if(isset($semey[1])){
$t=explode(',',$semey[1]); foreach($t as $k => $v){ if ($v!=0) $ksfa['zao'].=($k+1).','; }
}
if($ksfa['och']!='') $ksf .= 'ОФО: '.$ksfa['och'];
if($ksfa['zao']!='') { if($ksfa['och']!='') $ksf.='<br>'; $ksf .= 'ЗФО: '.$ksfa['zao']; }
$out .= '<tr>';
$out .= '<td><span class="tooltips" data-trigger="hover" data-placement="bottom" data-original-title="'.$val['descrip'].'">'.$val['name'].'</span></td>';
$out .= '<td>'.date('d.m.Y',$val['data_u']).'</td>';
$out .= '<td>'.$val['specialnost'].'</td>';
$out .= '<td>'.$ksf.'</td>';
$out .= '<td><a href="/upload/workprogram/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
$out .= '</tr>';
}
$out .= '</tbody></table>';
}
}
if($what=='lections'){
//выберем у препода все лекции
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$tid.''; //СТАРЫЙ ФОРМАТ
$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$tid.' AND type="лек"';
$rez = $DB->QUR_SEL($sql);//$out.=$sql.'<pre>'.print_r($rez,1).'</pre>';
if($rez){
$out .= '<table class="table">';
$out .= '<thead><tr>
<th width="40%">Лекция</th>
<th width="10%">Обновлена</th>
<th width="30%">Специальность</th>
<th width="10%">Семестры</th>
<th width="10%">Файл</th>
</tr></thead><tbody>';
foreach($rez as $key => $val)if($key){
//также смотрим, есть ли выставленные оценки ЗА МОДУЛИ
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod="'.$tid.'" AND id_what = "'.$val['id'].'" AND what="лек" LIMIT 3';
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_what = "'.$val['id'].'" AND type=1 LIMIT 3';
$rez_mark = $DB->QUR_SEL($sql_mark);
if ($rez_mark[0] > 0) $isMark = '<i class="icon-plus" style="color: green;"> </i>'; else $isMark = '<i class="icon-minus" style="color: red;"> </i>';
/****/
$ksf= ' к.'.$val['kurs'].' c.'.$val['semestr'];
$gmg = get_mat_grupps($val['id'],1);
$status = check_material('lection',$val,$gmg['masi'],$jarr);
$out .= '<tr>';
$out .= '<td style="position: relative;">
<span class="tooltips" data-trigger="hover" data-placement="bottom" data-original-title="'.$val['descrip'].'">'.$val['name'].' '.$isMark.'</span>';
$out .= $status['div'];
$out .= '<br>'.$gmg['html'].'
</td>';
$out .= '<td>'.date('d.m.Y',$val['data_u']).'</td>';
$out .= '<td>'.$val['specialnost'].'</td>';
$out .= '<td>'.$ksf.'</td>';
$df=explode('|',$val['file']);
$out .= '<td>';
foreach($df as $k => $v) $out .= ($k+1).'. <a href="/upload/lections/'.$v.'" target="_blank">Скачать</a>; ';
/*foreach($df as $k => $v) if (strpos($v, "https://eios.mkgtu.ru/") !== false) $out .= ($k+1).'. <a href="/upload/lections/'.$v.'" target="_blank">Скачать</a>; '; else $out .= ($k+1).'. <a href="'.$v.'" target="_blank">Скачать</a>; ';*/
$out .= '</td>';
$out .= '</tr>';
}
$out .= '</tbody></table>';
}
}
if($what=='practich'){
//выберем у препода все практические
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_practich WHERE id_teacher='.$tid.'';
$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$tid.' AND type="лаб"';
$rez = $DB->QUR_SEL($sql);
if($rez){
$out .= '<table class="table">';
$out .= '<thead><tr>
<th width="40%">Практическая</th>
<th width="10%">Обновлена</th>
<th width="30%">Семестры</th>
<th width="20%">Файл</th>
</tr></thead><tbody>';
foreach($rez as $key => $val)if($key){
//также смотрим, есть ли выставленные оценки ЗА МОДУЛИ
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod="'.$tid.'" AND id_what = "'.$val['id'].'" AND what="лек" LIMIT 3';
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_what = "'.$val['id'].'" AND type=1 LIMIT 3';
$rez_mark = $DB->QUR_SEL($sql_mark);
if ($rez_mark[0] > 0) $isMark = '<i class="icon-plus" style="color: green;"> </i>'; else $isMark = '<i class="icon-minus" style="color: red;"> </i>';
/***/
$ksf= ' к.'.$val['kurs'].' c.'.$val['semestr'];
//$gmg = get_mat_grupps($val['id_lection']);
$gmg = get_mat_grupps($val['id'],1);
$status = check_material('practich',$val,$gmg['masi'],$jarr);
$out .= '<tr>';
$out .= '<td style="position: relative;"><span class="tooltips" data-trigger="hover" data-placement="bottom" data-original-title="'.$val['descrip'].'">'.$val['name'].' '.$isMark.'</span>';
$out .= $status['div'];
$out .= '<br>'.$gmg['html'].'</td>';
$out .= '<td>'.date('d.m.Y',$val['data_u']).'</td>';
$out .= '<td>'.$ksf.'</td>';
if (strpos($val['file'], "https://eios.mkgtu.ru/") !== false) $out .= '<td><a href="'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>'; else $out .= '<td><a href="/upload/lections/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
$out .= '</tr>';
}
$out .= '</tbody></table>';
}
}
if($what=='controln'){
//выберем у препода все контрольные
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_controln WHERE id_teacher='.$tid.'';
$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$tid.' AND type="контр"';
$rez = $DB->QUR_SEL($sql);
if($rez){
$out .= '<table class="table">';
$out .= '<thead><tr>
<th width="40%">Контрольная</th>
<th width="10%">Обновлена</th>
<th width="50%">Файл</th>
</tr></thead><tbody>';
foreach($rez as $key => $val)if($key){
//также смотрим, есть ли выставленные оценки ЗА МОДУЛИ
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod="'.$tid.'" AND id_what = "'.$val['id'].'" AND what="лек" LIMIT 3';
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_what = "'.$val['id'].'" AND type=1 LIMIT 3';
$rez_mark = $DB->QUR_SEL($sql_mark);
if ($rez_mark[0] > 0) $isMark = '<i class="icon-plus" style="color: green;"> </i>'; else $isMark = '<i class="icon-minus" style="color: red;"> </i>';
/***/
//$gmg = get_mat_grupps($val['id_lection']);
$gmg = get_mat_grupps($val['id'],1);
$status = check_material('controln',$val,$gmg['masi'],$jarr);
$out .= '<tr>';
$out .= '<td style="position: relative;"><span class="tooltips" data-trigger="hover" data-placement="bottom" data-original-title="'.$val['descrip'].'">'.$val['name'].' '.$isMark.'</span>';
$out .= $status['div'];
$out .= '<br>'.$gmg['html'].'</td>';
$out .= '<td>'.date('d.m.Y',$val['data_u']).'</td>';
//$out .= '<td><a href="/upload/controln/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
if (strpos($val['file'], "https://eios.mkgtu.ru/") !== false) $out .= '<td><a href="'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>'; else $out .= '<td><a href="/upload/lections/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
$out .= '</tr>';
}
$out .= '</tbody></table>';
}
}
if($what=='kursov'){
//выберем у препода все курсовые
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_kursov WHERE id_teacher='.$tid.'';
$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$tid.' AND type="курс"';
$rez = $DB->QUR_SEL($sql);
if($rez){
$out .= '<table class="table">';
$out .= '<thead><tr>
<th width="40%">Курсовая</th>
<th width="10%">Обновлена</th>
<th width="50%">Файл</th>
</tr></thead><tbody>';
foreach($rez as $key => $val)if($key){
//также смотрим, есть ли выставленные оценки ЗА МОДУЛИ
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod="'.$tid.'" AND id_what = "'.$val['id'].'" AND what="лек" LIMIT 3';
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_what = "'.$val['id'].'" AND type=1 LIMIT 3';
$rez_mark = $DB->QUR_SEL($sql_mark);
if ($rez_mark[0] > 0) $isMark = '<i class="icon-plus" style="color: green;"> </i>'; else $isMark = '<i class="icon-minus" style="color: red;"> </i>';
//$gmg = get_mat_grupps($val['id_lection']);
$gmg = get_mat_grupps($val['id'],1);
$status = check_material('kursov',$val,$gmg['masi'],$jarr);
$out .= '<tr>';
$out .= '<td style="position: relative;"><span class="tooltips" data-trigger="hover" data-placement="bottom" data-original-title="'.$val['descrip'].'">'.$val['name'].' '.$isMark.'</span>';
$out .= $status['div'];
$out .= '<br>'.$gmg['html'].'</td>';
$out .= '<td>'.date('d.m.Y',$val['data_u']).'</td>';
//$out .= '<td><a href="/upload/kursov/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
if (strpos($val['file'], "https://eios.mkgtu.ru/") !== false) $out .= '<td><a href="'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>'; else $out .= '<td><a href="/upload/lections/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
$out .= '</tr>';
}
$out .= '</tbody></table>';
}
}
if($what=='praktika'){
//выберем у препода все Пркатики
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE id_teacher='.$tid.'';
$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$tid.' AND type="практика"';
$rez = $DB->QUR_SEL($sql);
if($rez){
$out .= '<table class="table">';
$out .= '<thead><tr>
<th width="40%">Практика</th>
<th width="10%">Обновлена</th>
<th width="50%">Файл</th>
</tr></thead><tbody>';
foreach($rez as $key => $val)if($key){
//$gmg = get_mat_grupps($val['id_lection']);
$gmg = get_mat_grupps($val['id'],1);
$status = check_material('praktika',$val,$gmg['masi'],$jarr);
$out .= '<tr>';
$out .= '<td style="position: relative;"><span class="tooltips" data-trigger="hover" data-placement="bottom" data-original-title="'.$val['descrip'].'">'.$val['name'].'</span>';
$out .= $status['div'];
$out .= '<br>'.$gmg['html'].'</td>';
$out .= '<td>'.date('d.m.Y',$val['data_u']).'</td>';
//$out .= '<td><a href="/upload/praktika/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
if (strpos($val['file'], "https://eios.mkgtu.ru/") !== false) $out .= '<td><a href="'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>'; else $out .= '<td><a href="/upload/lections/'.$val['file'].'" target="_blank">'.$val['file'].'</a></td>';
$out .= '</tr>';
}
$out .= '</tbody></table>';
}
}
$out .= '<script>$(document).ready(function(){
$(".tooltips").tooltip();
});</script>';
/*
$predmets=array();
$arr = json_decode($json,1);
$nopredm=array('РВКР','РИМ ','ЗДН ','ОЛ','РИН','ГЭЗ','ЗВКР','РАД ','ЗДВ ','ЗДО');
foreach($arr['db'] as $k => $v){
$show=true;
foreach($nopredm as $k1 => $v1) if(strpos($v['name_disp'],$v1)!==false) $show=false;
if($show){
$z=array();
$z['lekcii']=$v['lekcii'];
$z['prakt_sem_zan']=$v['prakt_sem_zan'];
$z['lab_zan']=$v['lab_zan'];
$z['kr']=$v['kr'];
$z['kur']=$v['kur'];
$z['kup']=$v['kup'];
$z['uch_pr']=$v['uch_pr'];
$z['uch_pr_p']=$v['uch_pr_p'];
$z['proizv_pr']=$v['proizv_pr'];
$z['preddip_pr']=$v['preddip_pr'];
$predmets[$v['name_disp']]['rc']=$z;
}
}
*/
/*
foreach($predmets as $predmet => $v){//надо проверить материалы у препода
if($v['rc']['lekcii']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['lection'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['lection'] = 2;
}
}
if($v['rc']['prakt_sem_zan']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_practich WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['practic'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['practic'] = 2;
}
}
if($v['rc']['lab_zan']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_practich WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['practic'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['practic'] = 2;
}
}
if($v['rc']['kr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_controln WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['controln'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['controln'] = 2;
}
}
if($v['rc']['kur']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_kursov WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['kursov'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['kursov'] = 2;
}
}
if($v['rc']['kup']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_kursov WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['kursov'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['kursov'] = 2;
}
}
if($v['rc']['uch_pr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
if($v['rc']['uch_pr_p']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
if($v['rc']['proizv_pr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
if($v['rc']['preddip_pr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
}
//формируем таблицу данных препода
$out .= '<table class="table table-striped table-bordered table-advance table-hover">';
$out .= '<thead><tr>';
$out .= '<th>Предмет</th>';
$out .= '<th>Лекции</th>';
$out .= '<th>Практ.</th>';
$out .= '<th>Контр.</th>';
$out .= '<th>Курсо.</th>';
$out .= '<th>Практ.</th>';
$out .= '</tr></thead><tbody>';
foreach($predmets as $k => $v){
$out .= '<tr>';
$out .= '<td>'.$k.'</td>';
$c=''; $t='-'; if($v['rc']['lekcii']!=0){ $c='label-important'; $t='0%'; if(isset($v['lekcii'])){
if($v['lekcii']==1) { $c='label-warning'; $t='50%'; }
if($v['lekcii']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['prakt_sem_zan']!=0||$v['rc']['lab_zan']!=0){$c='label-important'; $t='0%'; if(isset($v['practic'])){
if($v['practic']==1) { $c='label-warning'; $t='50%'; }
if($v['practic']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['kr']!=0){$c='label-important'; $t='0%'; if(isset($v['controln'])){
if($v['controln']==1) { $c='label-warning'; $t='50%'; }
if($v['controln']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['kur']!=0||$v['rc']['kup']!=0){$c='label-important'; $t='0%'; if(isset($v['kursov'])){
if($v['kursov']==1) { $c='label-warning'; $t='50%'; }
if($v['kursov']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['uch_pr']!=0||$v['rc']['uch_pr_p']!=0||$v['rc']['proizv_pr']!=0||$v['rc']['preddip_pr']!=0){$c='label-important'; $t='0%'; if(isset($v['praktika'])){
if($v['praktika']==1) { $c='label-warning'; $t='50%'; }
if($v['praktika']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$out .= '</tr>';
}
$out .= '<tr><td colspan="6" style="font-size:11px;"><span class="label">-</span> нет часов,<span class="label label-important">0%</span>-есть часы, но нет материала, <span class="label label-warning">50%</span>-есть часы и есть материал, но нет файла, <span class="label label-success">100%</span>-есть часы и есть материал и файл</td></tr>';
$out .= '</tbody></table>';
//$out .= '<pre>'.print_r($predmets,1).'</pre>';
*/
return $out;
}
function get_mat_grupps($id_lection,$l=0){//получаем привязанные группы по лекциям
GLOBAL $ST,$DB; $out1 = array(); $out=' '; $m=array();
$sql = 'SELECT id,name FROM '.$ST['dbpf'].'_lections WHERE id='.$id_lection.'';
$rez = $DB->QUR_SEL($sql);
if($rez&&$rez[0]>0){
if($l==0) $out .= 'к лекции: '.$rez[1]['name'].' ';
$sql = 'SELECT g.sokr,g.fo,g.kurs FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$id_lection.' AND lg.id_grupp=g.id';
$rez = $DB->QUR_SEL($sql);
if($rez&&$rez[0]>0){
foreach($rez as $k => $v)if($k){
$m[]=array('sokr'=>$rez[1]['sokr'],'kurs'=>$rez[1]['kurs'],'fo'=>$rez[1]['fo']);
$out .= '<b>'.$v['sokr'].'-'.$v['kurs'].'</b> '.$v['fo'].'; ';
}
}
}
$out1['masi'] = $m;
$out1['html'] = $out;
return $out1;
}
function prepod_check_status_old($json,$tid){
GLOBAL $ST,$DB;
$out=''; $predmets=array();
$arr = json_decode($json,1);
$nopredm=array('РВКР','РИМ ','ЗДН ','ОЛ','РИН','ГЭЗ','ЗВКР','РАД ','ЗДВ ','ЗДО');
foreach($arr['db'] as $k => $v){
$show=true;
foreach($nopredm as $k1 => $v1) if(strpos($v['name_disp'],$v1)!==false) $show=false;
if($show){
$z=array();
$z['lekcii']=$v['lekcii'];
$z['prakt_sem_zan']=$v['prakt_sem_zan'];
$z['lab_zan']=$v['lab_zan'];
$z['kr']=$v['kr'];
$z['kur']=$v['kur'];
$z['kup']=$v['kup'];
$z['uch_pr']=$v['uch_pr'];
$z['uch_pr_p']=$v['uch_pr_p'];
$z['proizv_pr']=$v['proizv_pr'];
$z['preddip_pr']=$v['preddip_pr'];
$predmets[$v['name_disp']]['rc']=$z;
}
}
foreach($predmets as $predmet => $v){//надо проверить материалы у препода
if($v['rc']['lekcii']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['lection'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['lection'] = 2;
}
}
if($v['rc']['prakt_sem_zan']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_practich WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['practic'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['practic'] = 2;
}
}
if($v['rc']['lab_zan']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_practich WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['practic'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['practic'] = 2;
}
}
if($v['rc']['kr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_controln WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['controln'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['controln'] = 2;
}
}
if($v['rc']['kur']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_kursov WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['kursov'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['kursov'] = 2;
}
}
if($v['rc']['kup']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_kursov WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['kursov'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['kursov'] = 2;
}
}
if($v['rc']['uch_pr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
if($v['rc']['uch_pr_p']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
if($v['rc']['proizv_pr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
if($v['rc']['preddip_pr']!=0){
$sql = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE name LIKE "%'.$predmet.'%" AND id_teacher='.$tid.'';
$rez = $DB->QUR_SEL($sql);
if($rez){
$predmets[$predmet]['praktika'] = 1;
if($rez[1]['file']!='') $predmets[$predmet]['praktika'] = 2;
}
}
}
//формируем таблицу данных препода
$out .= '<table class="table table-striped table-bordered table-advance table-hover">';
$out .= '<thead><tr>';
$out .= '<th>Предмет</th>';
$out .= '<th>Лекции</th>';
$out .= '<th>Практ.</th>';
$out .= '<th>Контр.</th>';
$out .= '<th>Курсо.</th>';
$out .= '<th>Практ.</th>';
$out .= '</tr></thead><tbody>';
foreach($predmets as $k => $v){
$out .= '<tr>';
$out .= '<td>'.$k.'</td>';
$c=''; $t='-'; if($v['rc']['lekcii']!=0){ $c='label-important'; $t='0%'; if(isset($v['lekcii'])){
if($v['lekcii']==1) { $c='label-warning'; $t='50%'; }
if($v['lekcii']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['prakt_sem_zan']!=0||$v['rc']['lab_zan']!=0){$c='label-important'; $t='0%'; if(isset($v['practic'])){
if($v['practic']==1) { $c='label-warning'; $t='50%'; }
if($v['practic']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['kr']!=0){$c='label-important'; $t='0%'; if(isset($v['controln'])){
if($v['controln']==1) { $c='label-warning'; $t='50%'; }
if($v['controln']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['kur']!=0||$v['rc']['kup']!=0){$c='label-important'; $t='0%'; if(isset($v['kursov'])){
if($v['kursov']==1) { $c='label-warning'; $t='50%'; }
if($v['kursov']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$c=''; $t='-'; if($v['rc']['uch_pr']!=0||$v['rc']['uch_pr_p']!=0||$v['rc']['proizv_pr']!=0||$v['rc']['preddip_pr']!=0){$c='label-important'; $t='0%'; if(isset($v['praktika'])){
if($v['praktika']==1) { $c='label-warning'; $t='50%'; }
if($v['praktika']==2) { $c='label-success'; $t='100%'; }
}}
$out .= '<td><span class="label '.$c.'">'.$t.'</span></td>';
$out .= '</tr>';
}
$out .= '<tr><td colspan="6" style="font-size:11px;"><span class="label">-</span> нет часов,<span class="label label-important">0%</span>-есть часы, но нет материала, <span class="label label-warning">50%</span>-есть часы и есть материал, но нет файла, <span class="label label-success">100%</span>-есть часы и есть материал и файл</td></tr>';
$out .= '</tbody></table>';
//$out .= '<pre>'.print_r($predmets,1).'</pre>';
return $out;
}
function iup_check_kafedras(){//проверяем для преподов кафедру
$file = 'tmp/json_kafedras_prepod.json';
$ft = filemtime($file);
if((time()-$ft)>(60*60*24*3)) unlink($file);//файл обновляется 1 раз в 3 дня
if(!file_exists($file)){
$url = 'http://local.mkgtu.ru/calchour_2023/get_json.php?json=kafedras_prepod';
$json = file_get_contents($url);
file_put_contents($file,$json);
}else{
$json = file_get_contents($file);
}
$json1 = json_decode($json,1);
//$url = 'http://local.mkgtu.ru/calchour_2017/get_json.php?json=kafedras_prepod';
//$json = json_decode(file_get_contents($url),1);
$out=array();$out1=array();
foreach($json1 as $k => $v){
$out[$v['fio']][] = $v['name'];
}
foreach($out as $k => $v){
$z['fio'] = $k;
$z['kafs'] = $v;
$out1[] = $z;
}
return $out1;
}