2111 lines
99 KiB
PHP
2111 lines
99 KiB
PHP
|
<?php
|
|||
|
if(isset($_POST['ajdes'])){
|
|||
|
session_start();
|
|||
|
header('Content-Type: text/html; charset=utf-8');
|
|||
|
date_default_timezone_set('Europe/Moscow');
|
|||
|
include '_db.php';
|
|||
|
include_once '../config.php';
|
|||
|
include 'functions.php';
|
|||
|
$out=array();
|
|||
|
//Создание ведомостей для группы
|
|||
|
if($_POST['ajdes']=='elektivs_create_vedomosti'){
|
|||
|
$data['id_grupp'] = (int)$_POST['idgrupp'];
|
|||
|
$data['iddiscip'] = (int)$_POST['iddiscip'];
|
|||
|
$sql = 'SELECT discip,kurs,sem,ekz,zach FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE id='.$data['iddiscip'];
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez&&$rez[0]>0) {
|
|||
|
$data['discip'] = $rez[1];
|
|||
|
$out = elekt_vedomosti_create($data);
|
|||
|
}else{
|
|||
|
$out['err'] = 1;
|
|||
|
$out['msg'] = 'Не выбрали дисциплину!';
|
|||
|
}
|
|||
|
}
|
|||
|
//сохраняем студента в эллективную дисциплину
|
|||
|
if($_POST['ajdes']=='elektivs_select_save'){
|
|||
|
$idelkt=$_POST['idelkt'];
|
|||
|
$studid=$_POST['studid'];
|
|||
|
$sql = 'SELECT id FROM acs_fk_order WHERE id_student='.$studid.' LIMIT 1';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez&&$rez[0]>0){
|
|||
|
$out['html'] = 'Студент уже выбрал элективную дисциплину!';
|
|||
|
}else {
|
|||
|
$sql = 'INSERT INTO acs_fk_order VALUES(0,' . $idelkt . ',' . $studid . ',' . time() . ')';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
if(!$rez['err']) {
|
|||
|
$out['html'] = 'Сохранили студента!';
|
|||
|
}else{
|
|||
|
$out['html'] = 'Ошибка сохранения студента!';
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
//показываем выбор элективных дисциплин
|
|||
|
if($_POST['ajdes']=='elektivs_select'){
|
|||
|
$kurs=$_POST['kurs'];
|
|||
|
$studid=$_POST['studid'];
|
|||
|
$iskurs=false;
|
|||
|
$select = elekt_get_sections();
|
|||
|
//$out['electives'] = $select;
|
|||
|
$out['html'] = '<div style="float:left;width:80%;">';
|
|||
|
$out['html'] .= '<select id="idstud_'.$studid.'" style="width:95%;"><option value="0">Выбрать</option>';
|
|||
|
//foreach($select as $k => $v){
|
|||
|
// if($v['course']==$kurs) {
|
|||
|
// $out['html'] .= '<option value="' . $v['ftid'] . '">' . $v['name'] . ' ' . $v['fio'] . ' Всего мест:' . $v['count'] . ' Свободных мест:' . $v['ostatok'] . ' курс:' . $v['course'] . ' День:' . $v['day'] . ' Пара:' . $v['couple'] . ' </option>';
|
|||
|
// $iskurs=true;
|
|||
|
// }
|
|||
|
//}
|
|||
|
foreach($select as $kurs_cur => $prepods)foreach($prepods as $prepod => $zanyatiya)if($kurs_cur!=''){
|
|||
|
if ($kurs == $kurs_cur) {
|
|||
|
foreach ($zanyatiya as $name_dis => $v){
|
|||
|
if($v['ostatok']>0) {
|
|||
|
$out['html'] .= '<option value="' . $v['ftid'] . '">' . $v['name'] . ' ' . $v['fio'] . ' Всего мест:' . $v['count'] . ' Свободных мест:' . $v['ostatok'] . '</option>';
|
|||
|
// курс:' . $v['course'] . ' День:' . $v['day'] . ' Пара:' . $v['couple'] . '
|
|||
|
}
|
|||
|
}
|
|||
|
$iskurs = true;
|
|||
|
}
|
|||
|
}
|
|||
|
$out['html'] .= '</select>';
|
|||
|
$out['html'] .= '</div>';
|
|||
|
$out['html'] .= '<div style="float:left;width:18%;"><a href="#" class="btn btn-danger stud_sel_elective_save" data-idstud="'.$studid.'">Записать студента</a></div>';
|
|||
|
if(!$iskurs) $out['html'] = '';
|
|||
|
}
|
|||
|
echo json_encode($out);
|
|||
|
exit();
|
|||
|
}
|
|||
|
|
|||
|
//Создание ведомостей для группы
|
|||
|
function elekt_vedomosti_create($data){
|
|||
|
GLOBAL $ST,$DB; $out = array();
|
|||
|
//$data['discip'] = discip,kurs,sem,ekz,zach
|
|||
|
//Получим список студентов
|
|||
|
$err='';
|
|||
|
$students = array();
|
|||
|
$sql = 'SELECT id as id_student,id_user FROM acs_students WHERE id_grupp='.$data['id_grupp'].' AND status=1';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez&&$rez[0]>0){
|
|||
|
foreach($rez as $k => $student)if($k){
|
|||
|
//Выберем учителя для студента из эллективных
|
|||
|
$sql1 = 'SELECT t.id_teacher,tc.id_user FROM acs_fk_order as o,acs_fk_timetable as t,acs_teachers as tc WHERE o.id_student='.$student['id_user'].' AND o.id_timetable=t.id AND t.id_teacher=tc.id';
|
|||
|
$rez1 = $DB->QUR_SEL($sql1);
|
|||
|
if($rez1&&$rez1[0]>0){
|
|||
|
$student['id_teacher'] = $rez1[1]['id_teacher'];
|
|||
|
$student['id_teacher_user'] = $rez1[1]['id_user'];
|
|||
|
}else{
|
|||
|
$student['id_teacher'] = 0;
|
|||
|
$err='Не у всех студентов есть элективные дисциплины';
|
|||
|
}
|
|||
|
$students[] = $student;
|
|||
|
}
|
|||
|
}
|
|||
|
if($err!='') return array('err'=>1,'msg'=>$err);
|
|||
|
if(count($students)){
|
|||
|
//Создадим саму ведомость
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
//Таблица: acs_statement: id, date_create, fakultet, print_st, id_grupp
|
|||
|
$rez = $DB->QUR('INSERT INTO '.$ST['dbpf'].'_statement (`date_create`, `fakultet`, `id_grupp`) VALUES ("'.time().'", "'.$fakultet.'", "'.$data['id_grupp'].'") ');
|
|||
|
if(!$rez['err']) {
|
|||
|
$id_statement = $rez['id'];
|
|||
|
$out['statement_rez'] = $rez;
|
|||
|
$out['statement_id'] = $id_statement;
|
|||
|
foreach($students as $k => $student){
|
|||
|
//Таблица: acs_liquidation: id, id_student, id_teacher, fakultet, type, iup, name, control, date_create, date_end, semestr, mark, date_mark, id_stat, print, id_user
|
|||
|
$type = 2; //type:1=Досрочная 2=Первичная 3=Повторная 4=С комиссией
|
|||
|
$iup = 1; //iup: 0 / 1
|
|||
|
if($data['discip']['ekz']==1) $control = 1; //control:1=Экзамен 2=Зачет 3=Зачет с оценкой
|
|||
|
if($data['discip']['zach']==1) $control = 2; //control:1=Экзамен 2=Зачет 3=Зачет с оценкой
|
|||
|
$date_create = time();
|
|||
|
$date_end = $date_create + (60*60*24*7);
|
|||
|
$semestr = $data['discip']['sem'];
|
|||
|
$name = $data['discip']['discip'];
|
|||
|
$id_teacher = $student['id_teacher_user'];
|
|||
|
$sql = 'INSERT INTO '.$ST['dbpf'].'_liquidation (`id_student`, `id_teacher`, `fakultet`, `type`, `iup`, `name`, `control`, `date_create`, `date_end`, `semestr`, `id_stat`, `id_user`) VALUES ("'.$student['id_student'].'", "'.$id_teacher.'", "'.$fakultet.'", "'.$type.'", "'.$iup.'", "'.$name.'", "'.$control.'", "'.$date_create.'", "'.$date_end.'", "'.$semestr.'", "'.$id_statement.'", "'.$student['id_user'].'") ';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
$out['sql'][] = $sql;
|
|||
|
}
|
|||
|
$out['err']=0;
|
|||
|
$out['msg']='Ведомость создана';
|
|||
|
$out['id']=$id_statement;
|
|||
|
}else{
|
|||
|
$out['err']=1;
|
|||
|
$out['msg']='Ошибка создания ведомости';
|
|||
|
$out['id']=0;
|
|||
|
}
|
|||
|
}else{
|
|||
|
$out['err']=1;
|
|||
|
$out['msg']='Нет студентов в группе';
|
|||
|
$out['id']=0;
|
|||
|
}
|
|||
|
return $out;
|
|||
|
}
|
|||
|
|
|||
|
function elekt_get_sections(){
|
|||
|
GLOBAL $ST,$DB; $out = array();
|
|||
|
//Нужно ограничить факультетами!
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
//echo '<pre>'.print_r($_SESSION['user'],1).'</pre>';exit();
|
|||
|
$sql = 'SELECT id FROM acs_faculties WHERE name="'.$fakultet.'"';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$id_fakultet = 0;
|
|||
|
if($rez&&$rez[0]>0) {
|
|||
|
$id_fakultet = $rez[1]['id'];
|
|||
|
}
|
|||
|
|
|||
|
//$sql = 'SELECT fs.name,ft.id as ftid,ft.course,ft.count,u.fio FROM acs_fk_timetable as ft,acs_fk_section as fs,acs_teachers as t,acs_users as u WHERE ft.id_section=fs.id AND ft.id_teacher=t.id AND t.id_user=u.id';
|
|||
|
$sql = 'SELECT fs.name,ft.id as ftid,ft.course,ft.count,u.fio,dt.day,dt.couple FROM acs_fk_timetable as ft,acs_fk_section as fs,acs_fk_details as dt,acs_teachers as t,acs_users as u WHERE ft.id_section=fs.id AND ft.id_teacher=t.id AND t.id_user=u.id AND (ft.fakultets LIKE "'.$id_fakultet.',%" OR ft.fakultets LIKE "%,'.$id_fakultet.',%" OR ft.fakultets LIKE "%,'.$id_fakultet.'") AND dt.id_timetable=ft.id';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
//echo $sql.'<pre>'.print_r($rez,1).'</pre>';exit();
|
|||
|
if($rez&&$rez[0]>0){
|
|||
|
foreach($rez as $k => $v){
|
|||
|
$rez1 = $DB->QUR_SEL('SELECT COUNT(id) as kol FROM acs_fk_order WHERE id_timetable='.$v['ftid']);
|
|||
|
$v['stud'] = 0; if($rez1&&$rez1[0]>0) $v['stud']=$rez1[1]['kol'];
|
|||
|
$v['ostatok'] = $v['count']-$v['stud'];
|
|||
|
//if($v['ostatok']>0) {
|
|||
|
//$out[] = $v;
|
|||
|
//объеденим по крусу и по знаятиям запись
|
|||
|
if(!isset($out[$v['course']][$v['fio']][$v['name']])){
|
|||
|
$out[$v['course']][$v['fio']][$v['name']] = $v;
|
|||
|
}else {
|
|||
|
if ($out[$v['course']][$v['fio']][$v['name']]['ostatok'] > $v['ostatok'])
|
|||
|
$out[$v['course']][$v['fio']][$v['name']] = $v;
|
|||
|
}
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|
|||
|
//echo '<pre>'.print_r($out,1).'</pre>';exit();
|
|||
|
|
|||
|
return $out;
|
|||
|
}
|
|||
|
function elekt_get_disciplin(){
|
|||
|
GLOBAL $ST,$DB; $out = array();
|
|||
|
$gr = grupp_get_by_fak('',array('ОФО','ОЗФО'));
|
|||
|
//echo '<prE>'.print_r($gr,1).'</prE>';exit();
|
|||
|
$grupps = $gr['grupps'];
|
|||
|
foreach($grupps as $k => $grupp){
|
|||
|
foreach ($grupp['students'] as $k1 => $student){
|
|||
|
//получим информацию об эллективных дисциплинах!
|
|||
|
$sql = 'SELECT fs.name,u.id,u.fio FROM acs_fk_order as fo,acs_fk_timetable as ft,acs_fk_section as fs,acs_teachers as t,acs_users as u WHERE fo.id_student='.$student['id'].' AND fo.id_timetable=ft.id AND ft.id_section=fs.id AND ft.id_teacher=t.id AND t.id_user=u.id';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez&&$rez[0]>0){
|
|||
|
$grupps[$k]['students'][$k1]['elektive'] = $rez[1];
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return $grupps;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Получаем группы факультета
|
|||
|
* @param $fakultet
|
|||
|
* @param $fo
|
|||
|
* @return array
|
|||
|
*/
|
|||
|
function grupp_get_by_fak($fakultet='',$fo=array()){
|
|||
|
GLOBAL $ST,$DB;
|
|||
|
$out = array();
|
|||
|
//Получить группы факультета
|
|||
|
if($fakultet=='') $fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
|
|||
|
//определяем айдишник факультета
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_faculties WHERE name = "'.$fakultet.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$id_fak = $rez[1]['id'];
|
|||
|
|
|||
|
//список групп
|
|||
|
$out['grupps'] = array();
|
|||
|
//if(isset($_SESSION['liquidation_ved_filter_yearnab'])) {
|
|||
|
// $lll = ' AND year_start=' . (int)$_SESSION['liquidation_ved_filter_yearnab'];
|
|||
|
//}else{
|
|||
|
// $lll = ' AND year_start=' . date('Y');
|
|||
|
//}
|
|||
|
$lll = ' AND year_start>' . (date('Y')-5);
|
|||
|
$lll .= ' AND sokr NOT LIKE "%Выпуск%"';
|
|||
|
$lll .= ' AND (sokr LIKE "%-1%" OR sokr LIKE "%-2%" OR sokr LIKE "%-3%")';
|
|||
|
if(count($fo)){
|
|||
|
$WH=array();
|
|||
|
foreach ($fo as $k => $v) $WH[] = 'fo="'.$v.'"';
|
|||
|
if(count($WH)) $lll .= ' AND ('.implode(' OR ',$WH).')';
|
|||
|
}
|
|||
|
//SELECT fo.* FROM `acs_students` as st,acs_fk_order as fo WHERE (st.id_grupp=2805 OR st.id_grupp=2738 OR st.id_grupp=2787 OR st.id_grupp=2804) AND st.id_user=fo.id_student
|
|||
|
|
|||
|
$sql = 'SELECT id,specialnost,sokr,fo,year_start FROM '.$ST['dbpf'].'_grupp WHERE id_facult = "'.$id_fak.'"'.$lll.' ORDER BY year_start,fo DESC';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
//echo $sql.'<prE>'.print_r($rez,1).'</prE>';exit();
|
|||
|
if ($rez){
|
|||
|
unset($_SESSION['elective_eror']['up']);
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$elekt_discip_is = elekt_check_up($val);
|
|||
|
if(count($elekt_discip_is)) {//выбираем только те группы у кого по планам есть элективные дисциплины
|
|||
|
//echo $val['sokr'].'<pre>'.print_r($elekt_discip_is,1).'</pre>';
|
|||
|
$tmp = explode('-', $val['sokr']);
|
|||
|
$val['kurs'] = mb_substr($tmp[1], 0, 1);
|
|||
|
$val['students'] = array();
|
|||
|
$sql_stud = 'SELECT *, status as status_st FROM ' . $ST['dbpf'] . '_students WHERE id_grupp = "' . $val['id'] . '" AND status=1';
|
|||
|
$rez_stud = $DB->QUR_SEL($sql_stud);
|
|||
|
if ($rez_stud) foreach ($rez_stud as $key_st => $val_st) if ($key_st) {
|
|||
|
$info_user = get_user($val_st['id_user'], array('id', 'fio', 'status'));
|
|||
|
//echo '<pre>'.print_r($info_user,1).'</pre>';
|
|||
|
if($info_user['status']>-1) $val['students'][] = $info_user;
|
|||
|
}
|
|||
|
foreach($elekt_discip_is as $k3 => $v3) $val['discip'][] = array('id'=>$v3,'name'=>$k3);
|
|||
|
$out['grupps'][] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return $out;
|
|||
|
}
|
|||
|
//Проверим есть ли у группы элективные дисциплины
|
|||
|
function elekt_check_up($grupp){
|
|||
|
GLOBAL $ST,$DB;
|
|||
|
$out = array();
|
|||
|
//$grupp = get_grupp($id); //информация о группе
|
|||
|
if ($grupp['fo'] == 'ОФО') $fo = 'очная'; elseif ($grupp['fo'] == 'ЗФО') $fo = 'заочная'; else $fo = 'очно-заочная';
|
|||
|
$sql = 'SELECT id FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE shifr1 = "'.$grupp['specialnost'].'" AND godnap="'.$grupp['year_start'].'" AND forobu = "'.$fo.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
//echo $sql.'<prE>'.print_r($rez,1).'</prE>';
|
|||
|
//$gr=array(2805,2738,2787,2804);//СТ-14 ОФО, СТ-13 ОФО, СТ-12 ОФО, СТ-11 ОФО
|
|||
|
//if(in_array($grupp['id'],$gr)){
|
|||
|
// echo $grupp['id'].'<pre>'.print_r($rez,1).'</pre>';
|
|||
|
//}
|
|||
|
//SELECT fo.* FROM `acs_students` as st,acs_fk_order as fo WHERE (st.id_grupp=2805 OR st.id_grupp=2738 OR st.id_grupp=2787 OR st.id_grupp=2804) AND st.id_user=fo.id_student
|
|||
|
|
|||
|
$id_plans = array();
|
|||
|
if ($rez) foreach ($rez as $key => $val) if ($key) $id_plans[] = $val['id'];
|
|||
|
if(count($id_plans)){
|
|||
|
//теперь обходим дисциплины плана или планов, если их было несколько
|
|||
|
$sql_str = 'SELECT id,discip FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE id_plans IN ('.implode(',',$id_plans).') AND discip LIKE "%Элективные дисциплины%" GROUP BY discip ORDER BY discip LIMIT 500 ';
|
|||
|
$rez_str = $DB->QUR_SEL($sql_str);
|
|||
|
//if(in_array($grupp['id'],$gr)){
|
|||
|
// echo $grupp['id'].'<pre>'.print_r($rez_str,1).'</pre>';
|
|||
|
//}
|
|||
|
if ($rez_str){
|
|||
|
foreach ($rez_str as $key => $val) if ($key){
|
|||
|
$out[$val['discip']] = $val['id'];
|
|||
|
}
|
|||
|
}
|
|||
|
}else{
|
|||
|
$_SESSION['elective_eror']['up'][] = 'Ошибка: '.$grupp['sokr'].': Не нашли плана в системе ИУП для '.$grupp['specialnost'].' '.$grupp['year_start'].' года '.$fo.' формы обучения ';
|
|||
|
}
|
|||
|
return $out;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* Получить элективные дисциплины - не верно
|
|||
|
* @return array
|
|||
|
*/
|
|||
|
function elekt_get_disciplin_old(){
|
|||
|
GLOBAL $ST,$DB;
|
|||
|
$out = array();
|
|||
|
$out['items']=array();
|
|||
|
//$out['user']=$_SESSION['user'];
|
|||
|
//Array(
|
|||
|
// [user] => Array(
|
|||
|
// [id] => 3060 [status] => 0 [fio] => Галичева Мария Сергеевна [high_school] => 1
|
|||
|
// [statuses] => Array( [21]=>21 [22]=>22 [23]=>23 [25]=>25 [50]=>50 [59]=>59 [78]=>78 )
|
|||
|
// [teacher] => Array(
|
|||
|
// [id] => 264
|
|||
|
// [zvanie] => Доцент
|
|||
|
// [fakultet] => Факультет аграрных технологий
|
|||
|
// [kafedra] => Технологии производства сельскохозяйственной продукции
|
|||
|
// )
|
|||
|
// )
|
|||
|
//)
|
|||
|
$fak['name'] = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
$fak['kaf'] = $_SESSION['user']['teacher']['kafedra'];
|
|||
|
$sql = 'SELECT id FROM acs_faculties WHERE name="'.$DB->rescape($fak['name']).'"';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
//$out['sql1'] = $sql; $out['rez1'] = $rez;
|
|||
|
if($rez&&$rez[0]>0){
|
|||
|
$fak['fak_id'] = $rez[1]['id'];
|
|||
|
//Получим записи на элективку
|
|||
|
$sql = 'SELECT id,id_section,id_teacher,course FROM acs_fk_timetable WHERE fakultets LIKE "'.$fak['fak_id'].',%" OR fakultets LIKE "%,'.$fak['fak_id'].',%" OR fakultets LIKE "%,'.$fak['fak_id'].'"';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
//$out['sql2'] = $sql; $out['rez2'] = $rez;
|
|||
|
if($rez&&$rez[0]>0){
|
|||
|
foreach($rez as $k => $v)if($k){
|
|||
|
//для каждого узнаем студента
|
|||
|
$tmp = array();
|
|||
|
$rez1 = $DB->QUR_SEL('SELECT name FROM acs_fk_section WHERE id='.$v['id_section']);
|
|||
|
$section = ''; if($rez1&&$rez1[0]>0) $section = $rez1[1]['name'];
|
|||
|
$rez1 = $DB->QUR_SEL('SELECT t.id as id_teacher,u.id,u.fio FROM acs_teachers as t,acs_users as u WHERE t.id='.$v['id_teacher'].' AND t.id_user=u.id');
|
|||
|
$teacher = ''; if($rez1&&$rez1[0]>0) $teacher = $rez1[1];
|
|||
|
$teacher_id = $teacher['id_teacher'];
|
|||
|
$out[$teacher_id]['teacher'] = $teacher;
|
|||
|
|
|||
|
if(!isset($out[$teacher_id]['items'])) $out[$teacher_id]['items'] = array();
|
|||
|
//$sql1 = 'SELECT u.id,u.fio,st.id_grupp FROM acs_fk_order as fo,acs_students as st,acs_users as u WHERE fo.id_timetable='.$v['id'].' AND fo.id_student=st.id AND st.id_user=u.id';
|
|||
|
$sql1 = 'SELECT
|
|||
|
u.id,u.fio,st.id_grupp
|
|||
|
FROM
|
|||
|
acs_fk_order as fo,
|
|||
|
acs_students as st,
|
|||
|
acs_users as u
|
|||
|
WHERE
|
|||
|
fo.id_timetable='.$v['id'].' AND
|
|||
|
fo.id_student=u.id AND
|
|||
|
st.id_user=u.id';
|
|||
|
$rez1 = $DB->QUR_SEL($sql1);
|
|||
|
if($rez1&&$rez1[0]>0)foreach($rez1 as $k1 => $v1)if($k1){
|
|||
|
//$teacher_id = $teacher['id_teacher'];
|
|||
|
//if(!isset($tmp['teacher'])) {
|
|||
|
// $tmp['teacher'] = $teacher;
|
|||
|
//}
|
|||
|
if(!isset($out[$teacher_id]['items'][$v1['id_grupp']]['grupp'])) {
|
|||
|
$out[$teacher_id]['items'][$v1['id_grupp']]['grupp'] = array();
|
|||
|
$rez2 = $DB->QUR_SEL('SELECT id,sokr,fo FROM acs_grupp WHERE id='.$v1['id_grupp']);
|
|||
|
if($rez2&&$rez2[0]>0) $out[$teacher_id]['items'][$v1['id_grupp']]['grupp'] = $rez2[1];
|
|||
|
}
|
|||
|
if(!isset($out[$teacher_id]['items'][$v1['id_grupp']]['section'])) {
|
|||
|
$out[$teacher_id]['items'][$v1['id_grupp']]['section'] = $section;
|
|||
|
}
|
|||
|
$out[$teacher_id]['items'][$v1['id_grupp']]['students'][] = $v1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
return $out;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//ВЕДОМОСТИ
|
|||
|
if ($_GET['page'] == 'liquidation_ved'){
|
|||
|
$mgs = 0;
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//echo 'Ведутся работы, зайдите позже!'; exit();
|
|||
|
//echo '<prE>'.print_r($_GET,1).'</prE>';
|
|||
|
//https://eios.mkgtu.ru/dekanat/liquidation_ved/page2/
|
|||
|
// $_GET=Array([dekanat] => [page] => liquidation_ved [des] => page2)
|
|||
|
//Сделаем навигацию по страницам
|
|||
|
$NAV_PAGE=0; if(isset($_GET['des'])&&strpos($_GET['des'],'page')!==false){
|
|||
|
$NAV_PAGE=((int)str_replace('page','',$_GET['des'])-1);
|
|||
|
unset($_GET['des']);
|
|||
|
}
|
|||
|
|
|||
|
//сформировать ведомость
|
|||
|
if (isset($_POST['add_ved'])){
|
|||
|
$students = $_POST['students'];
|
|||
|
if(empty($students)){
|
|||
|
//echo("Вы не выбрали.");
|
|||
|
} else{
|
|||
|
$N = count($students);
|
|||
|
$grupp_v = $_POST['grupp_v'];
|
|||
|
$teacher = $_POST['teacher'];
|
|||
|
$fakultet = $_POST['fakultet'];
|
|||
|
$type = $_POST['type'];
|
|||
|
$iup = $_POST['iup'];
|
|||
|
$name = $_POST['name'];
|
|||
|
if($name=='') $name = $DB->rescape($_POST['name_manual']);
|
|||
|
$control = $_POST['control'];
|
|||
|
$date_end = strtotime($_POST['date_end']);
|
|||
|
$semestr = $_POST['semestr'];
|
|||
|
$date_create = date("U");
|
|||
|
$rez = $DB->QUR_SEL('INSERT INTO '.$ST['dbpf'].'_statement (`date_create`, `fakultet`, `id_grupp`) VALUES ("'.$date_create.'", "'.$fakultet.'", "'.$grupp_v.'") ');
|
|||
|
$id = mysql_insert_id();
|
|||
|
write_message($teacher, '[ОПОВЕЩЕНИЕ]<br /> У Вас появилась новая ведомость по дисциплине '.$name);
|
|||
|
save_logs('Создана зачетно-экзаменационная ведомость №'.$id);
|
|||
|
$msg = 2;
|
|||
|
for($i=0; $i < $N; $i++){
|
|||
|
$info_student = get_new_student($students[$i]);
|
|||
|
$rez = $DB->QUR('INSERT INTO '.$ST['dbpf'].'_liquidation (`id_student`, `id_teacher`, `fakultet`, `type`, `iup`, `name`, `control`, `date_create`, `date_end`, `semestr`, `id_stat`, `id_user`) VALUES ("'.$students[$i].'", "'.$teacher.'", "'.$fakultet.'", "'.$type.'", "'.$iup.'", "'.$name.'", "'.$control.'", "'.$date_create.'", "'.$date_end.'", "'.$semestr.'", "'.$id.'", "'.$info_student['id_user'].'") ');
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//редактировать ведомость
|
|||
|
if (isset($_POST['edt_ved'])){
|
|||
|
$students = $_POST['students'];
|
|||
|
if(empty($students)){
|
|||
|
//echo("Вы не выбрали.");
|
|||
|
} else{
|
|||
|
$N = count($students);
|
|||
|
$grupp_v = $_POST['grupp_v'];
|
|||
|
$teacher = $_POST['teacher'];
|
|||
|
$fakultet = $_POST['fakultet'];
|
|||
|
$type = $_POST['type'];
|
|||
|
$iup = $_POST['iup'];
|
|||
|
$name = $_POST['name'];
|
|||
|
$control = $_POST['control'];
|
|||
|
$date_end = strtotime($_POST['date_end']);
|
|||
|
$semestr = $_POST['semestr'];
|
|||
|
$date_create = date("U");
|
|||
|
//echo '<pre>'.print_r($_POST,1).'</pre>'; exit();
|
|||
|
//Array(
|
|||
|
// [fakultet] => Лечебный факультет [grupp_v] => 2270 [numgrupp] => 1
|
|||
|
// [students] => Array( [0] => 24544 [1] => 19338 [2] => 24381 [3] => 29502 )
|
|||
|
// [teacher] => 3018 [type] => 3 [iup] => 0 [name] => Информационные технологии в медицине
|
|||
|
// [control] => 2 [date_end] => 2023-09-11 [semestr] => 4
|
|||
|
// [edt_ved] => Отредактировать ведомость
|
|||
|
// [statement_id] => 55737 [liquidation_id] => 748240;748241;748239;748242;
|
|||
|
//)
|
|||
|
$statement_id = (int)$_POST['statement_id'];
|
|||
|
$sql = 'UPDATE '.$ST['dbpf'].'_statement SET `fakultet`="'.$DB->rescape($fakultet).'",`grupp_v`='.$grupp_v.' WHERE id='.$statement_id;
|
|||
|
//$rez = $DB->QUR($sql);
|
|||
|
save_logs('Отредактирована зачетно-экзаменационная ведомость №'.$statement_id);
|
|||
|
$msg = 3;
|
|||
|
//выбираем студентов которые ранее были ведомости
|
|||
|
$liquidation_old=array();
|
|||
|
$liquidation_oldteach=array();
|
|||
|
$sql = 'SELECT id,id_student,id_teacher FROM `'.$ST['dbpf'].'_liquidation` WHERE `id_stat`='.$statement_id;
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){ foreach($rez as $k => $v)if($k){
|
|||
|
$liquidation_old[$v['id_student']] = $v['id'];
|
|||
|
$liquidation_oldteach[$v['id_student']] = $v['id_teacher'];
|
|||
|
} }
|
|||
|
$liquidation_cmp=array();
|
|||
|
foreach($students as $k => $id_student){
|
|||
|
if(isset($liquidation_old[$id_student])){//новый студент есть в старой выборке, обновляем
|
|||
|
$id_st = $liquidation_old[$id_student];
|
|||
|
$id_teacher = $liquidation_oldteach[$id_student];
|
|||
|
$rez = $DB->QUR('UPDATE '.$ST['dbpf'].'_liquidation SET `id_teacher`="'.$id_teacher.'",`fakultet`="'.$fakultet.'",`type`="'.$type.'",`iup`="'.$iup.'",`name`="'.$name.'",`control`="'.$control.'",`date_end`="'.$date_end.'",`semestr`="'.$semestr.'" WHERE id='.$id_st);
|
|||
|
unset($liquidation_old[$id_student]);
|
|||
|
}else{//студента нет в старой выборке, добавляем
|
|||
|
$info_student = get_new_student($id_student);
|
|||
|
$rez = $DB->QUR('INSERT INTO '.$ST['dbpf'].'_liquidation (`id_student`, `id_teacher`, `fakultet`, `type`, `iup`, `name`, `control`, `date_create`, `date_end`, `semestr`, `id_stat`, `id_user`) VALUES ("'.$id_student.'", "'.$teacher.'", "'.$fakultet.'", "'.$type.'", "'.$iup.'", "'.$name.'", "'.$control.'", "'.$date_create.'", "'.$date_end.'", "'.$semestr.'", "'.$statement_id.'", "'.$info_student['id_user'].'") ');
|
|||
|
}
|
|||
|
}
|
|||
|
//21.12.2023 убрал т.к. удаляются ведомости
|
|||
|
//if(count($liquidation_old)){//удалим направления которые ошибочные были и остались после редактирования
|
|||
|
// foreach($liquidation_old as $id_stud => $id_liq){
|
|||
|
// $rez = $DB->QUR('DELETE FROM '.$ST['dbpf'].'_liquidation WHERE id='.$id_liq.' LIMIT 1');
|
|||
|
// }
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//ВСЕ ФАКУЛЬТЕТЫ
|
|||
|
$faculties = array();
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_faculties ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val){
|
|||
|
$faculties[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//ГРУППЫ
|
|||
|
$grupp = array();
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE NOT (sokr LIKE "%Выпуск%") ORDER BY sokr,kurs';
|
|||
|
//если поиск по группе
|
|||
|
if (isset($_POST['search_grupp'])) $sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE sokr = "'.$_POST['search_grupp'].'" ORDER BY sokr,kurs';
|
|||
|
$rez=$DB->QUR_SEL($sql);
|
|||
|
if($rez){
|
|||
|
foreach($rez as $key => $val){
|
|||
|
$grupp[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//активные преподаватели
|
|||
|
$teachers = array();
|
|||
|
if(!isset($_SESSION['dek_liq_ved']['cache']['teachers'])) {
|
|||
|
$sql = 'SELECT teach.*, us.* FROM ' . $ST['dbpf'] . '_teachers as teach, ' . $ST['dbpf'] . '_users as us WHERE NOT (teach.status = "-1") AND NOT (us.status = "-1") AND us.id = teach.id_user ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez) {
|
|||
|
foreach ($rez as $key => $val) if ($key) {
|
|||
|
$teachers[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
$_SESSION['dek_liq_ved']['cache']['teachers'] = $teachers;
|
|||
|
}else{
|
|||
|
$teachers = $_SESSION['dek_liq_ved']['cache']['teachers'];
|
|||
|
}
|
|||
|
|
|||
|
//ВСЕ ГРУППЫ
|
|||
|
$all_group = array();
|
|||
|
if(!isset($_SESSION['dek_liq_ved']['cache']['grupp'])) {
|
|||
|
$sql = 'SELECT * FROM ' . $ST['dbpf'] . '_grupp ORDER BY sokr, kurs, fo ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez) foreach ($rez as $key => $val) {
|
|||
|
$all_group[] = $val;
|
|||
|
}
|
|||
|
$_SESSION['dek_liq_ved']['cache']['grupp'] = $all_group;
|
|||
|
}else{
|
|||
|
$all_group = $_SESSION['dek_liq_ved']['cache']['grupp'];
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//ведомости факультета на этот семестра
|
|||
|
$statements = array();
|
|||
|
|
|||
|
$NAV_LIM = 100;
|
|||
|
$NAV_START = $NAV_PAGE*$NAV_LIM;
|
|||
|
$NAV_SQL = ' LIMIT '.$NAV_START.','.$NAV_LIM;
|
|||
|
//нажали сбросить поиск
|
|||
|
if(isset($_POST['clear_search'])) unset($_SESSION['dek_liq_ved']);
|
|||
|
//запомним поиск для страничной навигации
|
|||
|
if (!empty($_POST['search_predmet'])) $_SESSION['dek_liq_ved']['search_predmet'] = $_POST['search_predmet'];
|
|||
|
if (!empty($_POST['search_semestr'])) $_SESSION['dek_liq_ved']['search_semestr'] = $_POST['search_semestr'];
|
|||
|
if (!empty($_POST['search_group'])) $_SESSION['dek_liq_ved']['search_group'] = $_POST['search_group'];
|
|||
|
|
|||
|
//если эти два значения совпадают, то отображаем, что ведомость заполнена полностью, если второе значение отлично от нуля -неполностью заполнена, если второе значение = 0, ничего не выводим
|
|||
|
$lll = ' AND liq.date_end>='.(time()-(3600*24*100));
|
|||
|
$sql = 'SELECT st.*, st.print_st as print_st, liq.* FROM '.$ST['dbpf'].'_statement as st, '.$ST['dbpf'].'_liquidation as liq WHERE st.fakultet = "'.$fakultet.'" AND liq.id_stat = st.id AND print_st = 0 '.$lll.' GROUP BY liq.id_stat ORDER BY st.date_create DESC';//' LIMIT 100'; liq.id_student
|
|||
|
//$sql = 'SELECT st.*, st.print_st as print_st, liq.* FROM '.$ST['dbpf'].'_statement as st, '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as stu, '.$ST['dbpf'].'_users as u WHERE liq.id_student=stu.id AND u.id=stu.id_user AND st.fakultet = "'.$fakultet.'" AND liq.id_stat = st.id AND print_st = 0 '.$lll.' GROUP BY liq.id_stat ORDER BY u.fio,st.date_create DESC';//' LIMIT 100'; liq.id_student
|
|||
|
//если поиск по названию дисциплины
|
|||
|
if (isset($_SESSION['dek_liq_ved']['search_predmet'])) {
|
|||
|
$sql = 'SELECT st.*, st.print_st as print_st, liq.* FROM '.$ST['dbpf'].'_statement as st, '.$ST['dbpf'].'_liquidation as liq WHERE st.fakultet = "'.$fakultet.'" AND liq.id_stat = st.id AND liq.name LIKE "%'.$_SESSION['dek_liq_ved']['search_predmet'].'%" GROUP BY liq.id_stat ORDER BY st.date_create DESC';//' LIMIT 150';
|
|||
|
}
|
|||
|
if (isset($_SESSION['dek_liq_ved']['search_semestr'])) {
|
|||
|
$sql = 'SELECT st.*, st.print_st as print_st, liq.* FROM '.$ST['dbpf'].'_statement as st, '.$ST['dbpf'].'_liquidation as liq WHERE st.fakultet = "'.$fakultet.'" AND liq.id_stat = st.id AND liq.semestr = "'.$_SESSION['dek_liq_ved']['search_semestr'].'" GROUP BY liq.id_stat ORDER BY st.date_create DESC';//' LIMIT 150';
|
|||
|
}
|
|||
|
if (isset($_SESSION['dek_liq_ved']['search_group'])) {
|
|||
|
$sql = 'SELECT st.*, st.print_st as print_st, liq.* FROM '.$ST['dbpf'].'_statement as st, '.$ST['dbpf'].'_liquidation as liq WHERE st.fakultet = "'.$fakultet.'" AND liq.id_stat = st.id AND st.id_grupp = "'.$_SESSION['dek_liq_ved']['search_group'].'" GROUP BY liq.id_stat ORDER BY st.date_create DESC';//' LIMIT 150';
|
|||
|
//$sql = 'SELECT st.*, st.print_st as print_st, liq.* FROM '.$ST['dbpf'].'_statement as st, '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as stu, '.$ST['dbpf'].'_users as u WHERE liq.id_student=stu.id AND u.id=stu.id_user AND st.fakultet = "'.$fakultet.'" AND liq.id_stat = st.id AND st.id_grupp = "'.$_SESSION['dek_liq_ved']['search_group'].'" GROUP BY liq.id_stat ORDER BY u.fio,st.date_create DESC';//' LIMIT 150';
|
|||
|
}
|
|||
|
//Узнаем сколько в выборке записей!
|
|||
|
$nav_sql = str_replace('st.*, st.print_st as print_st, liq.*','COUNT(st.id) as kol',$sql);
|
|||
|
$rez_sql = $DB->QUR_SEL($nav_sql);
|
|||
|
$NAV_ALL= 0; if ($rez_sql){ $NAV_ALL= $rez_sql[0]; }
|
|||
|
$sql .= $NAV_SQL;//прикрутим ЛИМИТЫ
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
//echo $sql.'<pre>'.print_r($rez,1).'</pre>';exit();
|
|||
|
//[1] => Array( [id] => 689598 [date_create] => 1685348421 [fakultet] => Факультет информационных систем в экономике и юриспруденции
|
|||
|
// [print_st] => 0 [id_grupp] => 2387 [id_student] => 4667 [id_teacher] => 2090 [type] => 2 [iup] => 0 [name] => Ознакомительная практика
|
|||
|
// [control] => 2 [date_end] => 1693170000 [semestr] => 2 [mark] => удовлетворительно [date_mark] => 1693912151
|
|||
|
// [id_stat] => 51149 [print] => 0 [id_user] => 5639
|
|||
|
// )
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$val['date_create'] = date('d.m.Y', $val['date_create']);
|
|||
|
$val['date_end'] = date('d.m.Y', $val['date_end']);
|
|||
|
//$val['print_st'] = $val['print_st'];
|
|||
|
$id = $val['id_stat'];
|
|||
|
$val['students'] = array();
|
|||
|
|
|||
|
switch ($val['control']){
|
|||
|
case 1: $val['control'] = 'экзамен'; break;
|
|||
|
case 2: $val['control'] = 'зачет'; break;
|
|||
|
case 3: $val['control'] = 'курсовая работа'; break;
|
|||
|
case 4: $val['control'] = 'курсовой проект'; break;
|
|||
|
case 5: $val['control'] = 'отчет по практике'; break;
|
|||
|
case 6: $val['control'] = 'зачет с оценкой'; break;
|
|||
|
}
|
|||
|
|
|||
|
$val['teacher'] = get_user($val['id_teacher']);
|
|||
|
$val['all'] = 0; //общее количество студентов, подлежающих оцениванию на экзамене/зачете
|
|||
|
$val['marked'] = 0; //количество оценененных студентов
|
|||
|
|
|||
|
$sql_liq = 'SELECT liq.*, st.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st WHERE liq.id_stat = "'.$id.'" AND liq.id_student = st.id';
|
|||
|
$rez_liq = $DB->QUR_SEL($sql_liq);
|
|||
|
if ($rez_liq){
|
|||
|
$sem = 0;
|
|||
|
foreach ($rez_liq as $kk => $val_liq) if ($kk){
|
|||
|
$val['all'] += 1; //увеличиваем общее количество студентов, присутствующих на экзамене/зачете
|
|||
|
if ($val_liq['mark'] != NULL) $val['marked'] += 1; //увеличиваем количество оцененных студентов на данном экзамене/зачете
|
|||
|
|
|||
|
$student = get_user($val_liq['id_user']);
|
|||
|
$val['students'][]['fio'] = $student['fio'];
|
|||
|
$sem = $val_liq['semestr'];
|
|||
|
}
|
|||
|
$info_group = get_student($val_liq['id_user']);
|
|||
|
//$val['gruppa'] = $info_group['sokr'].'-'.$info_group['kurs'].$info_group['num_grupp'];
|
|||
|
//$val['gruppa'] = $info_group['sokr'].'-'.round($sem/2).$info_group['num_grupp'];
|
|||
|
$val['gruppa'] = $info_group['sokr'];
|
|||
|
$val['fo'] = $info_group['fo'];
|
|||
|
}
|
|||
|
if(isset($_SESSION['liquidation_ved_filter_fo'])){
|
|||
|
if($_SESSION['liquidation_ved_filter_fo']=='ofo'&&$val['fo'] == "ОФО") $statements[] = $val;
|
|||
|
if($_SESSION['liquidation_ved_filter_fo']=='zfo'&&$val['fo'] == "ЗФО") $statements[] = $val;
|
|||
|
if($_SESSION['liquidation_ved_filter_fo']=='ozfo'&&$val['fo'] == "ОЗФО") $statements[] = $val;
|
|||
|
$smarty->assign('filter_fo', $_SESSION['liquidation_ved_filter_fo']);
|
|||
|
}else {
|
|||
|
//если зам декана по ОФО
|
|||
|
if (isset($_SESSION['user']['statuses'][31])) { if ($val['fo'] == "ОФО") $statements[] = $val; }
|
|||
|
//если зам декана по ЗФО
|
|||
|
elseif (isset($_SESSION['user']['statuses'][32])) { if ($val['fo'] == "ЗФО") $statements[] = $val; }
|
|||
|
//если зам декана по ОЗФО
|
|||
|
elseif (isset($_SESSION['user']['statuses'][33])) { if ($val['fo'] == "ОЗФО") $statements[] = $val; }
|
|||
|
//если зам декана просто без разделения на формы обучения
|
|||
|
else $statements[] = $val;
|
|||
|
$smarty->assign('filter_fo', 'all');
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$smarty->assign('elektivs',elekt_get_disciplin());
|
|||
|
$smarty->assign('elektivs_errors',$_SESSION['elective_eror']);
|
|||
|
//$smarty->assign('elektivs_sections',elekt_get_sections());
|
|||
|
|
|||
|
$smarty->assign('nav_all', $NAV_ALL);
|
|||
|
$smarty->assign('nav_cur', ($NAV_PAGE+1));
|
|||
|
$smarty->assign('nav_lim', $NAV_LIM);
|
|||
|
|
|||
|
|
|||
|
if (isset($_GET['des'])){
|
|||
|
|
|||
|
$id = $_GET['des'];
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE `id` = "'.$id.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
switch ($rez[1]['control']){
|
|||
|
case 1: $control = 'экзамена'; break;
|
|||
|
case 2: $control = 'зачета'; break;
|
|||
|
case 3: $control = 'курсовой работы'; break;
|
|||
|
case 4: $control = 'курсового проекта'; break;
|
|||
|
case 5: $control = 'отчета по практике'; break;
|
|||
|
case 6: $control = 'зачета с оценкой'; break;
|
|||
|
}
|
|||
|
|
|||
|
switch ($rez[1]['type']){
|
|||
|
case 1: $type = 'досрочную'; break;
|
|||
|
case 2: $type = 'первичную'; break;
|
|||
|
case 3: $type = 'повторную'; break;
|
|||
|
case 4: $type = 'с комиссией'; break;
|
|||
|
}
|
|||
|
|
|||
|
switch ($rez[1]['iup']){
|
|||
|
case 0: $iup = 'УП'; break;
|
|||
|
case 1: $iup = 'ИУП'; break;
|
|||
|
}
|
|||
|
|
|||
|
/*$val['date_create'] = date('d.m.Y', $val['date_create']);
|
|||
|
$val['date_end'] = date('d.m.Y', $val['date_end']);
|
|||
|
$val['date_mark'] = date('d.m.Y', $val['date_mark']);*/
|
|||
|
|
|||
|
//инфа о студенте
|
|||
|
$id_student = $rez[1]['id_student'];
|
|||
|
$sql_stud = 'SELECT us.*, stud.* FROM '.$ST['dbpf'].'_students as stud, '.$ST['dbpf'].'_users as us WHERE stud.id = "'.$id_student.'" AND us.id = stud.id_user ';
|
|||
|
$rez_stud = $DB->QUR_SEL($sql_stud);
|
|||
|
|
|||
|
$teacher = get_user($rez[1]['id_teacher']);
|
|||
|
|
|||
|
$grupp0 = get_grupp($rez_stud[1]['id_grupp']);
|
|||
|
|
|||
|
if ($grupp0['fo'] == "ОФО") $grupp['fo'] = 'очная'; elseif ($grupp0['fo'] == "ЗФО") $grupp['fo'] = "заочная"; else $grupp['fo'] = "очно-заочная";
|
|||
|
|
|||
|
|
|||
|
$smarty->assign('day_create', date('d', $rez[1]['date_create']));
|
|||
|
$smarty->assign('month_create', numberToMonth(date('m', $rez[1]['date_create'])));
|
|||
|
$smarty->assign('year_create', date('Y', $rez[1]['date_create']));
|
|||
|
$smarty->assign('student_fio', $rez_stud[1]['fio']);
|
|||
|
$smarty->assign('student_gr', $rez_stud[1]['num_grupp']);
|
|||
|
//$smarty->assign('student_grupp', $rez_stud[1]['fio']);
|
|||
|
|
|||
|
$smarty->assign('day_end', date('d', $rez[1]['date_end']));
|
|||
|
$smarty->assign('month_end', numberToMonth(date('m', $rez[1]['date_end'])));
|
|||
|
$smarty->assign('year_end', date('Y', $rez[1]['date_end']));
|
|||
|
|
|||
|
$smarty->assign('day_mark', date('d', $rez[1]['date_mark']));
|
|||
|
$smarty->assign('month_mark', numberToMonth(date('m', $rez[1]['date_mark'])));
|
|||
|
$smarty->assign('year_mark', date('Y', $rez[1]['date_mark']));
|
|||
|
|
|||
|
$smarty->assign('teacher', $teacher['fio']);
|
|||
|
|
|||
|
$smarty->assign('mark', $rez[1]['mark']);
|
|||
|
$smarty->assign('name', $rez[1]['name']);
|
|||
|
$smarty->assign('sem', $rez[1]['semestr']);
|
|||
|
$smarty->assign('print', $rez[1]['print']);
|
|||
|
$smarty->assign('type', $type);
|
|||
|
$smarty->assign('iup', $iup);
|
|||
|
$smarty->assign('grupp', $grupp);
|
|||
|
$smarty->assign('fakultet', $fakultet);
|
|||
|
$smarty->assign('stat', $rez[1]['id_stat']);
|
|||
|
if ($rez[1]['id_stat'] == 0) { //направление
|
|||
|
//Распечатали
|
|||
|
$sql = 'UPDATE '.$ST['dbpf'].'_liquidation SET print = "1" WHERE id = "'.$id.'" ';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
|
|||
|
//на вывод
|
|||
|
$smarty->assign('control', $control);
|
|||
|
$smarty->display('tpl_teacher_liquidation_print_nap.html');
|
|||
|
}
|
|||
|
else { //ведомость
|
|||
|
switch ($rez[1]['control']){
|
|||
|
case 1: $control = 'экзамен'; break;
|
|||
|
case 2: $control = 'зачет'; break;
|
|||
|
case 3: $control = 'курсовая работа'; break;
|
|||
|
case 4: $control = 'курсовой проект'; break;
|
|||
|
case 5: $control = 'отчет по практике'; break;
|
|||
|
case 6: $control = 'зачет с оценкой'; break;
|
|||
|
}
|
|||
|
|
|||
|
$sql_list = 'SELECT liq.*, st.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st WHERE liq.id_stat = "'.$rez[1]['id_stat'].'" AND st.id = liq.id_student ';
|
|||
|
//$sql_list = 'SELECT liq.*, st.*, stat.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_statement as stat WHERE liq.id_stat = "'.$rez[1]['id_stat'].'" AND st.id = liq.id_student AND liq.id_stat = stat.id AND stat.id_grupp = "'.$rez_stud[1]['id_grupp'].'" ';
|
|||
|
$rez_list = $DB->QUR_SEL($sql_list);
|
|||
|
$list_student = array();
|
|||
|
|
|||
|
$count_otl = 0;
|
|||
|
$count_hor = 0;
|
|||
|
$count_udov = 0;
|
|||
|
$count_neud = 0;
|
|||
|
$count_neyvka = 0;
|
|||
|
|
|||
|
$id_stat = 0;
|
|||
|
if ($rez_list){
|
|||
|
$i = 0;
|
|||
|
foreach ($rez_list as $key => $val) if ($key){
|
|||
|
$i++;
|
|||
|
$id_stat = $val['id_stat'];
|
|||
|
$val['i'] = $i;
|
|||
|
$student = get_user($val['id_user']);
|
|||
|
$val['fio'] = $student['fio'];
|
|||
|
|
|||
|
if (($val['mark'] == 'отлично')||($val['mark'] == 'зачтено')) $count_otl++;
|
|||
|
if (($val['mark'] == 'хорошо')) $count_hor++;
|
|||
|
if (($val['mark'] == 'удовлетворительно')) $count_udov++;
|
|||
|
if (($val['mark'] == 'неудовлетворительно')||($val['mark'] == 'не зачтено')) $count_neud++;
|
|||
|
if (($val['mark'] == 'не явился')) $count_neyvka++;
|
|||
|
|
|||
|
$list_student[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//Распечатали
|
|||
|
$sql = 'UPDATE '.$ST['dbpf'].'_statement SET print_st = "1" WHERE id = "'.$id_stat.'" ';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
|
|||
|
//ВАЖНО сортировка списка студентов
|
|||
|
|
|||
|
|
|||
|
/***********/
|
|||
|
$smarty->assign('count', $i);
|
|||
|
$smarty->assign('count_otl', $count_otl);
|
|||
|
$smarty->assign('count_hor', $count_hor);
|
|||
|
$smarty->assign('count_udov', $count_udov);
|
|||
|
$smarty->assign('count_neud', $count_neud);
|
|||
|
$smarty->assign('count_neyvka', $count_neyvka);
|
|||
|
$smarty->assign('list_student', $list_student);
|
|||
|
$smarty->assign('control', $control);
|
|||
|
$smarty->display('tpl_teacher_liquidation_print_ved.html');
|
|||
|
}
|
|||
|
exit;
|
|||
|
} else{
|
|||
|
$smarty->assign('all_group', $all_group);
|
|||
|
$smarty->assign('fakultet', $fakultet);
|
|||
|
$smarty->assign('faculties', $faculties);
|
|||
|
$smarty->assign('naprs', $napr);
|
|||
|
$smarty->assign('statements', $statements);
|
|||
|
$smarty->assign('teachers', $teachers);
|
|||
|
$smarty->assign('grupps', $grupp);
|
|||
|
$smarty->assign('msg', $msg);
|
|||
|
$smarty->assign('status', $_SESSION['user']['status']);
|
|||
|
$maincontent = $smarty->fetch('tpl_teacher_liquidation_ved.html');
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//НАПРАВЛЕНИЯ
|
|||
|
if (($_GET['page'] == 'liquidation')||($_GET['page'] == 'liquidationView')){
|
|||
|
$mgs = 0;
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
|
|||
|
//сформировать направление
|
|||
|
if (isset($_POST['add_liq'])){
|
|||
|
$student = $_POST['student'];
|
|||
|
$teacher = $_POST['teacher'];
|
|||
|
$fakultet = $_POST['fakultet'];
|
|||
|
$type = $_POST['type'];
|
|||
|
$iup = $_POST['iup'];
|
|||
|
$name = $_POST['name'];
|
|||
|
$control = $_POST['control'];
|
|||
|
//echo '<pre>'.print_r($_POST,1).'</pre>';exit();
|
|||
|
//Array(
|
|||
|
// [grupp] => 159 [student] => 28792 [teacher] => 0
|
|||
|
// [fakultet] => Факультет информационных систем в экономике и юриспруденции
|
|||
|
// [type] => 1 [iup] => 1 [name] => 12323 [control] => 1
|
|||
|
// [date_create] => 2023-09-07 [date_end] =>
|
|||
|
// [semestr] => 1
|
|||
|
// [add_liq] => Сформировать направление
|
|||
|
//)
|
|||
|
if($_POST['date_create']!='') {
|
|||
|
$tmp = explode('-',$_POST['date_create']);
|
|||
|
if(count($tmp)==3)
|
|||
|
$date_create = strtotime($_POST['date_create']);
|
|||
|
else
|
|||
|
$date_create = time();
|
|||
|
}else
|
|||
|
$date_create = time();
|
|||
|
$date_end = strtotime($_POST['date_end']);
|
|||
|
$semestr = $_POST['semestr'];
|
|||
|
|
|||
|
$info_student = get_new_student($student);
|
|||
|
|
|||
|
//$date_create = date("U");
|
|||
|
|
|||
|
//проверяем есть ли такое направление в системе уже
|
|||
|
$rez_is = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student = "'.$student.'" AND id_teacher = "'.$teacher.'" AND type = "'.$type.'" AND iup = "'.$iup.'" AND name = "'.$name.'" AND control = "'.$control.'" AND semestr = "'.$semestr.'" AND date_end = "'.$date_end.'" AND id_stat = 0 LIMIT 1');
|
|||
|
|
|||
|
if ($rez_is[0] > 0) $msg = -1; //ошибка при создании направление
|
|||
|
else{
|
|||
|
//$rez = $DB->QUR('INSERT INTO '.$ST['dbpf'].'_liquidation (`id_student`, `id_teacher`, `fakultet`, `type`, `iup`, `name`, `control`, `date_create`, `date_end`, `semestr`) VALUES ("'.$student.'", "'.$teacher.'", "'.$fakultet.'", "'.$type.'", "'.$iup.'", "'.$name.'", "'.$control.'", "'.$date_create.'", "'.$date_end.'", "'.$semestr.'") ');
|
|||
|
$rez = $DB->QUR('INSERT INTO '.$ST['dbpf'].'_liquidation (`id_student`, `id_teacher`, `fakultet`, `type`, `iup`, `name`, `control`, `date_create`, `date_end`, `semestr`, `id_user`) VALUES ("'.$student.'", "'.$teacher.'", "'.$fakultet.'", "'.$type.'", "'.$iup.'", "'.$name.'", "'.$control.'", "'.$date_create.'", "'.$date_end.'", "'.$semestr.'", "'.$info_student['id_user'].'") ');
|
|||
|
|
|||
|
$date_end = date('d.m.Y', $date_end);
|
|||
|
write_message($teacher, '[ОПОВЕЩЕНИЕ]<br /> У Вас появилось новое направление по дисциплине '.$name.'. Срок действия направления до '.$date_end);
|
|||
|
save_logs('Создано новое направление для студента '.$student.' и преподавателя '.$teacher.' по дисциплине '.$name);
|
|||
|
|
|||
|
$msg = 1;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//ГРУППЫ
|
|||
|
$grupp = array();
|
|||
|
if(!isset($_SESSION['dek_liq_ved']['cache']['grupp'])) {
|
|||
|
$sql = 'SELECT * FROM ' . $ST['dbpf'] . '_grupp ORDER BY sokr,kurs';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez) {
|
|||
|
foreach ($rez as $key => $val) {
|
|||
|
$grupp[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
$_SESSION['dek_liq_ved']['cache']['grupp'] = $grupp;
|
|||
|
}else{
|
|||
|
$grupp = $_SESSION['dek_liq_ved']['cache']['grupp'];
|
|||
|
}
|
|||
|
|
|||
|
//активные преподаватели
|
|||
|
$teachers = array();
|
|||
|
if(!isset($_SESSION['dek_liq_ved']['cache']['teachers'])) {
|
|||
|
$sql = 'SELECT teach.*, us.* FROM ' . $ST['dbpf'] . '_teachers as teach, ' . $ST['dbpf'] . '_users as us WHERE NOT (teach.status = "-1") AND NOT (us.status = "-1") AND us.id = teach.id_user ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez) {
|
|||
|
foreach ($rez as $key => $val) if ($key) {
|
|||
|
$teachers[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
$_SESSION['dek_liq_ved']['cache']['teachers'] = $teachers;
|
|||
|
}else{
|
|||
|
$teachers = $_SESSION['dek_liq_ved']['cache']['teachers'];
|
|||
|
}
|
|||
|
|
|||
|
//направления факультета
|
|||
|
$napr = array();
|
|||
|
|
|||
|
if(isset($_SESSION['liquidation_ved_filter_year'])) {
|
|||
|
$year_start = mktime(0,0,0,1,1,$_SESSION['liquidation_ved_filter_year']);
|
|||
|
$year_end = mktime(23,59,59,12,31,$_SESSION['liquidation_ved_filter_year']);
|
|||
|
$lll = ' AND (liq.date_create>=' . $year_start . ' AND liq.date_create<=' . $year_end . ')';
|
|||
|
$smarty->assign('filter_year', $_SESSION['liquidation_ved_filter_year']);
|
|||
|
}else{
|
|||
|
$_SESSION['liquidation_ved_filter_year'] = date('Y');
|
|||
|
$year_start = mktime(0,0,0,1,1,date('Y'));
|
|||
|
$year_end = mktime(23,59,59,12,31,date('Y'));
|
|||
|
$lll = ' AND (liq.date_create>=' . $year_start . ' AND liq.date_create<=' . $year_end . ')';
|
|||
|
$smarty->assign('filter_year', $_SESSION['liquidation_ved_filter_year']);
|
|||
|
}
|
|||
|
|
|||
|
if($fakultet=='Технологический факультет') {
|
|||
|
$sql = 'SELECT liq.*, liq.id as id_liq, us.*
|
|||
|
FROM ' . $ST['dbpf'] . '_liquidation as liq, ' . $ST['dbpf'] . '_users as us
|
|||
|
WHERE liq.fakultet = "' . $fakultet . '" AND liq.id_teacher = us.id AND liq.id_stat = 0 ' . $lll . ' ORDER BY id_liq DESC ';
|
|||
|
}else {
|
|||
|
$sql = 'SELECT liq.*, liq.id as id_liq, us.*
|
|||
|
FROM ' . $ST['dbpf'] . '_liquidation as liq, ' . $ST['dbpf'] . '_users as us
|
|||
|
WHERE liq.fakultet = "' . $fakultet . '" AND liq.id_teacher = us.id AND liq.id_stat = 0 ORDER BY id_liq DESC ';
|
|||
|
}
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
$i = 0;
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$i++;
|
|||
|
$val['i'] = $i;
|
|||
|
$val['date_create'] = date('d.m.Y', $val['date_create']);
|
|||
|
$val['date_end'] = date('d.m.Y', $val['date_end']);
|
|||
|
$val['date_mark'] = date('d.m.Y', $val['date_mark']);
|
|||
|
switch ($val['control']){
|
|||
|
case 1: $val['control'] = 'экзамен'; break;
|
|||
|
case 2: $val['control'] = 'зачет'; break;
|
|||
|
case 3: $val['control'] = 'курсовая работа'; break;
|
|||
|
case 4: $val['control'] = 'курсовой проект'; break;
|
|||
|
case 5: $val['control'] = 'отчет по практике'; break;
|
|||
|
case 6: $val['control'] = 'зачет с оценкой'; break;
|
|||
|
}
|
|||
|
$id_student = $val['id_student'];
|
|||
|
//$sql_user = 'SELECT st.*, us.* FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE st.id = "'.$id_student.'" AND us.id = st.id_user';
|
|||
|
$sql_user = 'SELECT us.id, us.fio FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE st.id = "'.$id_student.'" AND us.id = st.id_user';// AND us.status>-1'; //26122023 добавил статус пользователя
|
|||
|
$rez_user = $DB->QUR_SEL($sql_user);
|
|||
|
$val['id_student'] = $rez_user[1]['fio'];
|
|||
|
|
|||
|
$info_group = get_student($rez_user[1]['id']);
|
|||
|
//$val['gruppa'] = $info_group['sokr'];
|
|||
|
$val['fo'] = $info_group['fo'];
|
|||
|
$val['grupp'] = $info_group;
|
|||
|
if(isset($_SESSION['liquidation_ved_filter_fo'])) {
|
|||
|
if ($_SESSION['liquidation_ved_filter_fo'] == 'ofo' && $val['fo'] == "ОФО") $napr[] = $val;
|
|||
|
if ($_SESSION['liquidation_ved_filter_fo'] == 'zfo' && $val['fo'] == "ЗФО") $napr[] = $val;
|
|||
|
if ($_SESSION['liquidation_ved_filter_fo'] == 'ozfo' && $val['fo'] == "ОЗФО") $napr[] = $val;
|
|||
|
$smarty->assign('filter_fo', $_SESSION['liquidation_ved_filter_fo']);
|
|||
|
}else {
|
|||
|
$napr[] = $val;
|
|||
|
$smarty->assign('filter_fo', 'all');
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$napr_null=array();
|
|||
|
if($fakultet=='Технологический факультет') {
|
|||
|
$sql = 'SELECT liq.*, liq.id as id_liq, us.*
|
|||
|
FROM ' . $ST['dbpf'] . '_liquidation as liq, ' . $ST['dbpf'] . '_users as us
|
|||
|
WHERE liq.fakultet = "' . $fakultet . '" AND liq.id_teacher = us.id AND liq.id_stat = 0 AND liq.date_create="" ORDER BY id_liq DESC ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
$i = 0;
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$i++;
|
|||
|
$val['i'] = $i;
|
|||
|
$val['date_create'] = date('d.m.Y', $val['date_create']);
|
|||
|
$val['date_end'] = date('d.m.Y', $val['date_end']);
|
|||
|
$val['date_mark'] = date('d.m.Y', $val['date_mark']);
|
|||
|
switch ($val['control']){
|
|||
|
case 1: $val['control'] = 'экзамен'; break;
|
|||
|
case 2: $val['control'] = 'зачет'; break;
|
|||
|
case 3: $val['control'] = 'курсовая работа'; break;
|
|||
|
case 4: $val['control'] = 'курсовой проект'; break;
|
|||
|
case 5: $val['control'] = 'отчет по практике'; break;
|
|||
|
case 6: $val['control'] = 'зачет с оценкой'; break;
|
|||
|
}
|
|||
|
$id_student = $val['id_student'];
|
|||
|
//$sql_user = 'SELECT st.*, us.* FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE st.id = "'.$id_student.'" AND us.id = st.id_user';
|
|||
|
$sql_user = 'SELECT us.id, us.fio FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE st.id = "'.$id_student.'" AND us.id = st.id_user';
|
|||
|
$rez_user = $DB->QUR_SEL($sql_user);
|
|||
|
$val['id_student'] = $rez_user[1]['fio'];
|
|||
|
|
|||
|
$info_group = get_student($rez_user[1]['id']);
|
|||
|
//$val['gruppa'] = $info_group['sokr'];
|
|||
|
$val['fo'] = $info_group['fo'];
|
|||
|
$val['grupp'] = $info_group;
|
|||
|
if(isset($_SESSION['liquidation_ved_filter_fo'])) {
|
|||
|
if ($_SESSION['liquidation_ved_filter_fo'] == 'ofo' && $val['fo'] == "ОФО") $napr_null[] = $val;
|
|||
|
if ($_SESSION['liquidation_ved_filter_fo'] == 'zfo' && $val['fo'] == "ЗФО") $napr_null[] = $val;
|
|||
|
if ($_SESSION['liquidation_ved_filter_fo'] == 'ozfo' && $val['fo'] == "ОЗФО") $napr_null[] = $val;
|
|||
|
$smarty->assign('filter_fo', $_SESSION['liquidation_ved_filter_fo']);
|
|||
|
}else {
|
|||
|
$napr_null[] = $val;
|
|||
|
$smarty->assign('filter_fo', 'all');
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
$smarty->assign('napr_null', $napr_null);
|
|||
|
|
|||
|
|
|||
|
if (isset($_GET['des'])){
|
|||
|
|
|||
|
$id = $_GET['des'];
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE `id` = "'.$id.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
switch ($rez[1]['control']){
|
|||
|
case 1: $control = 'экзамена'; break;
|
|||
|
case 2: $control = 'зачета'; break;
|
|||
|
case 3: $control = 'курсовой работы'; break;
|
|||
|
case 4: $control = 'курсового проекта'; break;
|
|||
|
case 5: $control = 'отчета по практике'; break;
|
|||
|
case 6: $control = 'зачета с оценкой'; break;
|
|||
|
}
|
|||
|
|
|||
|
switch ($rez[1]['type']){
|
|||
|
case 1: $type = 'досрочную'; break;
|
|||
|
case 2: $type = 'первичную'; break;
|
|||
|
case 3: $type = 'повторную'; break;
|
|||
|
case 4: $type = 'с комиссией'; break;
|
|||
|
}
|
|||
|
|
|||
|
switch ($rez[1]['iup']){
|
|||
|
case 0: $iup = 'УП'; break;
|
|||
|
case 1: $iup = 'ИУП'; break;
|
|||
|
}
|
|||
|
|
|||
|
/*$val['date_create'] = date('d.m.Y', $val['date_create']);
|
|||
|
$val['date_end'] = date('d.m.Y', $val['date_end']);
|
|||
|
$val['date_mark'] = date('d.m.Y', $val['date_mark']);*/
|
|||
|
|
|||
|
//инфа о студенте
|
|||
|
$id_student = $rez[1]['id_student'];
|
|||
|
$sql_stud = 'SELECT us.*, stud.* FROM '.$ST['dbpf'].'_students as stud, '.$ST['dbpf'].'_users as us WHERE stud.id = "'.$id_student.'" AND us.id = stud.id_user ';
|
|||
|
$rez_stud = $DB->QUR_SEL($sql_stud);
|
|||
|
|
|||
|
$teacher = get_user($rez[1]['id_teacher']);
|
|||
|
|
|||
|
$grupp = get_grupp($rez_stud[1]['id_grupp']);
|
|||
|
|
|||
|
|
|||
|
//if ($grupp['fo'] == 'оч') $grupp['fo'] = 'очная'; elseif ($grupp['fo'] == 'заоч') $grupp['fo'] = "заочная"; else $grupp['fo'] = "очно-заочная";
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$smarty->assign('day_create', date('d', $rez[1]['date_create']));
|
|||
|
$smarty->assign('month_create', numberToMonth(date('m', $rez[1]['date_create'])));
|
|||
|
$smarty->assign('year_create', date('Y', $rez[1]['date_create']));
|
|||
|
$smarty->assign('student_fio', $rez_stud[1]['fio']);
|
|||
|
$smarty->assign('student_gr', $rez_stud[1]['num_grupp']);
|
|||
|
//$smarty->assign('student_grupp', $rez_stud[1]['fio']);
|
|||
|
|
|||
|
$smarty->assign('day_end', date('d', $rez[1]['date_end']));
|
|||
|
$smarty->assign('month_end', numberToMonth(date('m', $rez[1]['date_end'])));
|
|||
|
$smarty->assign('year_end', date('Y', $rez[1]['date_end']));
|
|||
|
|
|||
|
$smarty->assign('day_mark', date('d', $rez[1]['date_mark']));
|
|||
|
$smarty->assign('month_mark', numberToMonth(date('m', $rez[1]['date_mark'])));
|
|||
|
$smarty->assign('year_mark', date('Y', $rez[1]['date_mark']));
|
|||
|
|
|||
|
$smarty->assign('teacher', $teacher['fio']);
|
|||
|
|
|||
|
$smarty->assign('mark', $rez[1]['mark']);
|
|||
|
$smarty->assign('name', $rez[1]['name']);
|
|||
|
$smarty->assign('sem', $rez[1]['semestr']);
|
|||
|
$smarty->assign('print', $rez[1]['print']);
|
|||
|
$smarty->assign('type', $type);
|
|||
|
$smarty->assign('iup', $iup);
|
|||
|
$smarty->assign('grupp', $grupp);
|
|||
|
$smarty->assign('fakultet', $fakultet);
|
|||
|
$smarty->assign('id', $id);
|
|||
|
$smarty->assign('stat', $rez[1]['id_stat']);
|
|||
|
if ($rez[1]['id_stat'] == 0) { //направление
|
|||
|
//Распечатали
|
|||
|
$sql = 'UPDATE '.$ST['dbpf'].'_liquidation SET print = "1" WHERE id = "'.$id.'" ';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
|
|||
|
//на вывод
|
|||
|
$smarty->assign('control', $control);
|
|||
|
$smarty->display('tpl_teacher_liquidation_print_nap.html');
|
|||
|
}
|
|||
|
else { //ведомость
|
|||
|
switch ($rez[1]['control']){
|
|||
|
case 1: $control = 'экзамен'; break;
|
|||
|
case 2: $control = 'зачет'; break;
|
|||
|
case 3: $control = 'курсовая работа'; break;
|
|||
|
case 4: $control = 'курсовой проект'; break;
|
|||
|
case 5: $control = 'отчет по практике'; break;
|
|||
|
case 6: $control = 'зачет с оценкой'; break;
|
|||
|
}
|
|||
|
|
|||
|
//echo($grupp);
|
|||
|
|
|||
|
//$sql_list = 'SELECT liq.*, st.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st WHERE liq.id_stat = "'.$rez[1]['id_stat'].'" AND st.id = liq.id_student ';
|
|||
|
$sql_list = 'SELECT liq.*, st.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE liq.id_stat = "'.$rez[1]['id_stat'].'" AND st.id = liq.id_student AND st.id_user=us.id AND us.status>-1';
|
|||
|
$rez_list = $DB->QUR_SEL($sql_list);
|
|||
|
//echo $sql_list.'<pre>'.print_r($rez_list,1).'</pre>';
|
|||
|
$list_student = array();
|
|||
|
|
|||
|
$count_otl = 0;
|
|||
|
$count_hor = 0;
|
|||
|
$count_udov = 0;
|
|||
|
$count_neud = 0;
|
|||
|
$count_neyvka = 0;
|
|||
|
|
|||
|
$teachersList=array();
|
|||
|
$id_stat = 0;
|
|||
|
if ($rez_list){
|
|||
|
$i = 0;
|
|||
|
foreach ($rez_list as $key => $val) if ($key){
|
|||
|
$i++;
|
|||
|
$id_stat = $val['id_stat'];
|
|||
|
$val['i'] = $i;
|
|||
|
$student = get_user($val['id_user']);
|
|||
|
$val['fio'] = $student['fio'];
|
|||
|
|
|||
|
if (($val['mark'] == 'отлично')||($val['mark'] == 'зачтено')) $count_otl++;
|
|||
|
if (($val['mark'] == 'хорошо')) $count_hor++;
|
|||
|
if (($val['mark'] == 'удовлетворительно')) $count_udov++;
|
|||
|
if (($val['mark'] == 'неудовлетворительно')||($val['mark'] == 'не зачтено')) $count_neud++;
|
|||
|
if (($val['mark'] == 'не явился')) $count_neyvka++;
|
|||
|
|
|||
|
//Получим преподавателей для студента
|
|||
|
$sqlteach = 'SELECT id,fio FROM '.$ST['dbpf'].'_users WHERE id='.$val['id_teacher'].' LIMIT 1';
|
|||
|
$rezteach = $DB->QUR_SEL($sqlteach);
|
|||
|
if($rezteach&&$rezteach[0]>0){
|
|||
|
$teachersList[$rezteach[1]['id']] = $rezteach[1]['fio'];
|
|||
|
$val['teacher'] = $rezteach[1]['fio'];
|
|||
|
}
|
|||
|
|
|||
|
//$list_student[] = $val;//без сортировки по фио
|
|||
|
$list_student[$val['fio']] = $val;//с сортировкой по фио
|
|||
|
}
|
|||
|
}
|
|||
|
ksort($list_student);
|
|||
|
//echo '<pre>'.print_r($teachersList,1).print_r($list_student,1).'</pre>';exit();
|
|||
|
//Распечатали
|
|||
|
if ($_GET['page'] == 'liquidation') {
|
|||
|
$sql = 'UPDATE '.$ST['dbpf'].'_statement SET print_st = "1" WHERE id = "'.$id_stat.'" ';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
}
|
|||
|
|
|||
|
/***********/
|
|||
|
$smarty->assign('teachersList', $teachersList);
|
|||
|
$smarty->assign('id_stat', $id_stat);
|
|||
|
$smarty->assign('count', $i);
|
|||
|
$smarty->assign('count_otl', $count_otl);
|
|||
|
$smarty->assign('count_hor', $count_hor);
|
|||
|
$smarty->assign('count_udov', $count_udov);
|
|||
|
$smarty->assign('count_neud', $count_neud);
|
|||
|
$smarty->assign('count_neyvka', $count_neyvka);
|
|||
|
$smarty->assign('list_student', $list_student);
|
|||
|
$smarty->assign('control', $control);
|
|||
|
$smarty->display('tpl_teacher_liquidation_print_ved.html');
|
|||
|
}
|
|||
|
exit;
|
|||
|
} else{
|
|||
|
$smarty->assign('fakultet', $fakultet);
|
|||
|
$smarty->assign('naprs', $napr);
|
|||
|
$smarty->assign('statements', $statements);
|
|||
|
$smarty->assign('teachers', $teachers);
|
|||
|
$smarty->assign('grupps', $grupp);
|
|||
|
$smarty->assign('msg', $msg);
|
|||
|
$smarty->assign('status', $_SESSION['user']['status']);
|
|||
|
$maincontent = $smarty->fetch('tpl_teacher_liquidation.html');
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//СВОДНЫЕ ВЕДОМОСТИ ПО НОВОМУ ВИДУ - с использованием учебных планов
|
|||
|
if ($_GET['page'] == 'summarySheet'){
|
|||
|
$time_start = microtime(true);
|
|||
|
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
//формируем список групп факультета
|
|||
|
$grupps = array();
|
|||
|
//$sql = 'SELECT gr.* FROM '.$ST['dbpf'].'_grupp as gr WHERE gr.kurs < 7 AND NOT (gr.name LIKE "%выпуск%") ORDER BY gr.sokr, gr.kurs ';
|
|||
|
$sql = 'SELECT gr.*, gr.id as id_grupp, fac.* FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_faculties as fac WHERE fac.name="'.$fakultet.'" AND gr.id_facult=fac.id AND gr.kurs < 7 AND NOT (gr.sokr LIKE "%выпуск%") ORDER BY gr.sokr, gr.kurs ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$grupps[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//если указана конкретная группа, номер группы в потоке, а также семестр, по которому нужно формировать сводную ведомость
|
|||
|
if ((isset($_GET['grupp']))&&(isset($_GET['num']))&&(isset($_GET['sem']))){
|
|||
|
$id_grupp = $_GET['grupp']; //группа
|
|||
|
$num = $_GET['num']; //номер группы в потоке - УЖЕ НЕ НУЖЕН, т.к. роли не играет
|
|||
|
$sem = $_GET['sem']; //семестр
|
|||
|
|
|||
|
//берем название текущей группы
|
|||
|
$sql_grupp = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id = "'.$id_grupp.'" ';
|
|||
|
$rez_grupp = $DB->QUR_SEL($sql_grupp);
|
|||
|
|
|||
|
//echo $rez_grupp[1][sokr];
|
|||
|
$raz = explode('-', $rez_grupp[1]['sokr']);
|
|||
|
$dop_nom = $raz[1][1];
|
|||
|
//echo $rez_grupp[1][fo];
|
|||
|
|
|||
|
|
|||
|
//форма обучения для учебного плана
|
|||
|
switch($rez_grupp[1]['fo']){
|
|||
|
case 'ОФО': $fo_pl = 'очная'; break;
|
|||
|
case 'ЗФО': $fo_pl = 'заочная'; break;
|
|||
|
case 'ОЗФО': $fo_pl = 'очно-заочная'; break;
|
|||
|
}
|
|||
|
|
|||
|
//ДОСТАЕМ СПИСОК ДИСЦИПЛИН ИЗ УЧЕБНОГО ПЛАНА
|
|||
|
$disc = array();
|
|||
|
$sql = 'SELECT str.*, pl.* FROM '.$ST['dbpf'].'_iup_shahtplans_stroki as str, '.$ST['dbpf'].'_iup_shahtplans_plans as pl WHERE pl.id = str.id_plans AND pl.shifr1 = "'.$rez_grupp[1]['specialnost'].'" AND str.sem="'.$sem.'" AND pl.godnap = "'.$rez_grupp[1]['year_start'].'" AND NOT str.discip LIKE "%по выбору%" AND pl.forobu = "'.$fo_pl.'" ';
|
|||
|
if ($sem == 0) $sql = 'SELECT str.*, pl.* FROM '.$ST['dbpf'].'_iup_shahtplans_stroki as str, '.$ST['dbpf'].'_iup_shahtplans_plans as pl WHERE pl.id = str.id_plans AND pl.shifr1 = "'.$rez_grupp[1]['specialnost'].'" AND pl.godnap = "'.$rez_grupp[1]['year_start'].'" AND pl.forobu = "'.$fo_pl.'" AND NOT str.discip LIKE "%по выбору%" ORDER BY str.sem LIMIT 100';
|
|||
|
//echo $sql;
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$disc[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//теперь пытаемся найти название и айдновой, по семестру
|
|||
|
$new_grupp = $raz[0].'-'.ceil($sem/2).$dop_nom; //echo $new_grupp;
|
|||
|
$sql_grupp_new = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE fo = "'.$rez_grupp[1]['fo'].'" AND sokr = "'.$new_grupp.'" ';
|
|||
|
$rez_grupp_new = $DB->QUR_SEL($sql_grupp_new);
|
|||
|
$id_new_grupp = $rez_grupp_new[1]['id'];
|
|||
|
|
|||
|
|
|||
|
//достаем список студентов группы
|
|||
|
$students = array();
|
|||
|
//$sql = 'SELECT gr.*, st.*, us.*, st.id as id_stud FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE us.id = st.id_user AND st.id_grupp = gr.id AND gr.id = "'.$id_grupp.'" AND st.num_grupp = "'.$num.'" AND NOT(us.status = "-1") ORDER BY us.fio';
|
|||
|
$sql = 'SELECT gr.*, st.*, us.*, st.id as id_stud FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE us.id = st.id_user AND st.id_grupp = "'.$id_grupp.'" AND gr.id=st.id_grupp AND NOT(us.status = "-1") GROUP BY us.fio ORDER BY us.fio ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
|
|||
|
///все оценки студента
|
|||
|
$val['mark'] = array();
|
|||
|
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_user = "'.$val['id_user'].'" ';
|
|||
|
$rez_mark = $DB->QUR_SEL($sql_mark);
|
|||
|
foreach ($rez_mark as $key_mark => $val_mark) if ($key_mark){
|
|||
|
$val['mark'][$val_mark['semestr']][$val_mark['name']] = $val_mark['mark'];
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$gruppa = $val['sokr'];
|
|||
|
$fo = $val['fo'];
|
|||
|
$students[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*echo '<pre>';
|
|||
|
print_r($students);
|
|||
|
echo '</pre>';*/
|
|||
|
|
|||
|
/*$time_end = microtime(true);
|
|||
|
$time = $time_end - $time_start;
|
|||
|
echo "Время генерации $time секунд\n";*/
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*********************************/
|
|||
|
$smarty->assign('fakultet', $fakultet);
|
|||
|
$smarty->assign('disc', $disc);
|
|||
|
$smarty->assign('gruppa', $gruppa);
|
|||
|
$smarty->assign('fo', $fo);
|
|||
|
$smarty->assign('num', $num);
|
|||
|
$smarty->assign('sem', $sem);
|
|||
|
$smarty->assign('students', $students);
|
|||
|
$smarty->display('tpl_dekanat_summary_sheet_print.html');
|
|||
|
exit;
|
|||
|
} else{ //просто выводим список всех групп, где будем выбирать, какую конкретно группу необходимо вывести
|
|||
|
$smarty->assign('grupps', $grupps);
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_summary_sheet.html');
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//СВОДНАЯ ВЕДОМОСТЬ ПО ГРУППАМ И СЕМЕСТРАМ
|
|||
|
if ($_GET['page'] == 'consolidated'){
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
|
|||
|
//формируем список групп факультета
|
|||
|
$grupps = array();
|
|||
|
//$sql = 'SELECT gr.* FROM '.$ST['dbpf'].'_grupp as gr WHERE gr.kurs < 7 AND NOT (gr.name LIKE "%выпуск%") ORDER BY gr.sokr, gr.kurs ';
|
|||
|
$sql = 'SELECT gr.*, gr.id as id_grupp, fac.* FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_faculties as fac WHERE fac.name="'.$fakultet.'" AND gr.id_facult=fac.id AND gr.kurs < 7 AND NOT (gr.sokr LIKE "%выпуск%") ORDER BY gr.sokr, gr.kurs ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$grupps[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//если указана конкретная группа, номер группы в потоке, а также семестр, по которому нужно формировать сводную ведомость
|
|||
|
if ((isset($_GET['grupp']))&&(isset($_GET['num']))&&(isset($_GET['sem']))){
|
|||
|
$id_grupp = $_GET['grupp']; //группа
|
|||
|
$num = $_GET['num']; //номер группы в потоке
|
|||
|
$sem = $_GET['sem']; //семестр
|
|||
|
|
|||
|
//берем название текущей группы
|
|||
|
$sql_grupp = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id = "'.$id_grupp.'" ';
|
|||
|
$rez_grupp = $DB->QUR_SEL($sql_grupp);
|
|||
|
|
|||
|
//echo $rez_grupp[1][sokr];
|
|||
|
$raz = explode('-', $rez_grupp[1][sokr]);
|
|||
|
$dop_nom = $raz[1][1];
|
|||
|
//echo $rez_grupp[1][fo];
|
|||
|
|
|||
|
|
|||
|
//теперь пытаемся найти название и айдновой, по семестру
|
|||
|
$new_grupp = $raz[0].'-'.ceil($sem/2).$dop_nom; //echo $new_grupp;
|
|||
|
$sql_grupp_new = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE fo = "'.$rez_grupp[1]['fo'].'" AND sokr = "'.$new_grupp.'" ';
|
|||
|
$rez_grupp_new = $DB->QUR_SEL($sql_grupp_new);
|
|||
|
$id_new_grupp = $rez_grupp_new[1]['id'];
|
|||
|
|
|||
|
//достаем список студентов группы
|
|||
|
$students = array();
|
|||
|
//$sql = 'SELECT gr.*, st.*, us.*, st.id as id_stud FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE us.id = st.id_user AND st.id_grupp = gr.id AND gr.id = "'.$id_grupp.'" AND st.num_grupp = "'.$num.'" AND NOT(us.status = "-1") ORDER BY us.fio';
|
|||
|
$sql = 'SELECT gr.*, st.*, us.*, st.id as id_stud FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE us.id = st.id_user AND st.id_grupp = "'.$id_grupp.'" AND gr.id=st.id_grupp AND NOT(us.status = "-1") GROUP BY us.fio ORDER BY us.fio ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){ $i = 0;
|
|||
|
|
|||
|
$ind_max = 1; //индекс студента, у которого максимальное количество дисциплин (по умолчанию первый)
|
|||
|
$max = 1; //максимальное количество предметов
|
|||
|
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
|
|||
|
$i++;
|
|||
|
|
|||
|
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student="'.$val['id_stud'].'" AND semestr = "'.$sem.'" AND iup = 0 ';
|
|||
|
$rez_mark = $DB->QUR_SEL($sql_mark);
|
|||
|
if ($rez_mark[0] > $max){
|
|||
|
$max = $rez_mark[0];
|
|||
|
$ind_max = $val['id_stud'];
|
|||
|
}
|
|||
|
//echo $i.' = '.$rez_mark[0].'; ';
|
|||
|
/*foreach ($rez_mark as $key_mark => $val_mark){
|
|||
|
$val['mark'] = $val_mark;
|
|||
|
}*/
|
|||
|
|
|||
|
$id_student = $ind_max;
|
|||
|
|
|||
|
//if ($i == 4) $id_student = $val['id_stud'];
|
|||
|
$gruppa = $val['sokr'];
|
|||
|
$fo = $val['fo'];
|
|||
|
$students[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//достаем уникальный список направлений/ведомостей для данной группы для указанного семестра
|
|||
|
$disc = array();
|
|||
|
//$date_create;
|
|||
|
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student = "'.$id_student.'" AND semestr = "'.$sem.'" AND type > 1 AND iup = 0 ORDER BY control DESC, name';
|
|||
|
|
|||
|
|
|||
|
//$sql = 'SELECT liq.*, st.*, st.id AS id_st FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_statement as st WHERE liq.id_student = "'.$id_student.'" AND st.id_grupp = "'.$id_new_grupp.'" AND liq.semestr = "'.$sem.'" AND liq.iup = 0 AND liq.id_stat = st.id';
|
|||
|
$sql = 'SELECT liq.*, st.*, st.id AS id_st FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_statement as st WHERE liq.id_student = "'.$id_student.'" AND st.id_grupp = "'.$id_grupp.'" AND liq.semestr = "'.$sem.'" AND liq.iup = 0 AND liq.id_stat = st.id';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$fakultet = $val['fakultet'];
|
|||
|
|
|||
|
$date_create = $val['date_create'];
|
|||
|
$name = $val['name'];
|
|||
|
|
|||
|
//первая цифра
|
|||
|
$val['marked'][0] = 5;
|
|||
|
$val['marked'];
|
|||
|
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE name = "'.$name.'" AND semestr = "'.$sem.'" AND type = "2" ';
|
|||
|
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE name = "'.$name.'" AND semestr = "'.$sem.'" AND control = "'.$val['control'].'" AND type = "'.$val['type'].'" ORDER BY FIELD(mark, "зачтено","отлично","хорошо","удовлетворительно") ASC, date_create DESC ';
|
|||
|
|
|||
|
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE semestr = "'.$sem.'" ORDER BY FIELD(mark, "отлично","зачтено","хорошо","удовлетворительно","незачтено") ';
|
|||
|
$rez_mark = $DB->QUR_SEL($sql_mark);
|
|||
|
if ($rez_mark){
|
|||
|
foreach ($rez_mark as $key_mark => $val_mark){
|
|||
|
$val['marked'][$val_mark['id_student']] = $val_mark['mark'];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id = "''" ';
|
|||
|
|
|||
|
$disc[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//отметки
|
|||
|
|
|||
|
|
|||
|
/*********************************/
|
|||
|
$smarty->assign('fakultet', $fakultet);
|
|||
|
$smarty->assign('disc', $disc);
|
|||
|
$smarty->assign('gruppa', $gruppa);
|
|||
|
$smarty->assign('fo', $fo);
|
|||
|
$smarty->assign('num', $num);
|
|||
|
$smarty->assign('sem', $sem);
|
|||
|
$smarty->assign('students', $students);
|
|||
|
$smarty->display('tpl_teach_consolidated_print.html');
|
|||
|
exit;
|
|||
|
} else{ //просто выводим список всех групп, где будем выбирать, какую конкретно группу необходимо вывести
|
|||
|
$smarty->assign('grupps', $grupps);
|
|||
|
$maincontent = $smarty->fetch('tpl_teacher_consolidated.html');
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//СВОДНЫЕ ВЕДОМОСТИ ПО СТУДЕНТАМ НА ИУПЕ
|
|||
|
if ($_GET['page'] == 'consolidated_iup'){
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
|
|||
|
//если указана конкретная группа, номер группы в потоке, а также семестр, по которому нужно формировать сводную ведомость
|
|||
|
if ((isset($_GET['id_student']))&&(isset($_GET['sem']))){
|
|||
|
$id_student = $_GET['id_student']; //student
|
|||
|
$sem = $_GET['sem']; //семестр
|
|||
|
|
|||
|
$user = get_new_student($id_student);
|
|||
|
$student = get_student($user['id_user']);
|
|||
|
|
|||
|
//достаем оценки студента за этот семестр
|
|||
|
$liquidation_mark = array();
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student = "'.$id_student.'" AND semestr = "'.$sem.'"';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
|
|||
|
$liquidation_mark[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//достаем список студентов группы
|
|||
|
$students = array();
|
|||
|
$sql = 'SELECT gr.*, st.*, us.*, st.id as id_stud FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE us.id = st.id_user AND st.id_grupp = gr.id AND gr.id = "'.$id_grupp.'" AND st.num_grupp = "'.$num.'" AND NOT(us.status = "-1") ORDER BY us.fio';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
|
|||
|
/*$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student="'.$val['id_stud'].'" AND semestr = "'.$sem.'" ';
|
|||
|
$rez_mark = $DB->QUR_SEL($sql_mark);
|
|||
|
foreach ($rez_mark as $key_mark => $val_mark){
|
|||
|
$val['mark'] = $val_mark;
|
|||
|
}*/
|
|||
|
|
|||
|
$id_student = $val['id_stud'];
|
|||
|
$gruppa = $val['sokr'];
|
|||
|
$fo = $val['fo'];
|
|||
|
$students[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//достаем уникальный список направлений/ведомостей для данной группы для указанного семестра
|
|||
|
$disc = array();
|
|||
|
//$date_create;
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student = "'.$id_student.'" AND semestr = "'.$sem.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$fakultet = $val['fakultet'];
|
|||
|
|
|||
|
$date_create = $val['date_create'];
|
|||
|
|
|||
|
//первая цифра
|
|||
|
$val['marked'][0] = 5;
|
|||
|
$val['marked'];
|
|||
|
$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE date_create = "'.$date_create.'" AND semestr = "'.$sem.'" ';
|
|||
|
$rez_mark = $DB->QUR_SEL($sql_mark);
|
|||
|
if ($rez_mark){
|
|||
|
|
|||
|
foreach ($rez_mark as $key_mark => $val_mark){
|
|||
|
|
|||
|
$val['marked'][$val_mark['id_student']] = $val_mark['mark'];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id = "''" ';
|
|||
|
|
|||
|
$disc[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//отметки
|
|||
|
|
|||
|
|
|||
|
/*********************************/
|
|||
|
$smarty->assign('fakultet', $fakultet);
|
|||
|
$smarty->assign('disc', $disc);
|
|||
|
$smarty->assign('gruppa', $gruppa);
|
|||
|
$smarty->assign('fo', $fo);
|
|||
|
$smarty->assign('num', $num);
|
|||
|
$smarty->assign('sem', $sem);
|
|||
|
$smarty->assign('students', $students);
|
|||
|
|
|||
|
/**********/
|
|||
|
|
|||
|
$smarty->assign('student', $student);
|
|||
|
$smarty->assign('user', $user);
|
|||
|
$smarty->assign('liquidation_mark', $liquidation_mark);
|
|||
|
$smarty->display('tpl_dekanat_consolidated_iup_print.html');
|
|||
|
exit;
|
|||
|
} else{ //просто выводим список всех групп, где будем выбирать, какую конкретно группу необходимо вывести
|
|||
|
//студенты факультета, которые на ИУП
|
|||
|
$iup_students = array();
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE fakultet = "'.$fakultet.'" AND iup = "1" GROUP BY id_student ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$val['user'] = get_new_student($val['id_student']);
|
|||
|
$iup_students[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//передача значений
|
|||
|
$smarty->assign('iup_students', $iup_students);
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_consolidated_iup.html');
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//СПИСОК СТУДЕНТОВ ФАКУЛЬТЕТА
|
|||
|
if ($_GET['page'] == 'list_students'){
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
$msg = 0; //нужно ли выводить сообщение
|
|||
|
|
|||
|
//редактируем инфу о студенте
|
|||
|
if (isset($_POST['edit_student'])){
|
|||
|
$fio = addslashes($_POST['fio']);
|
|||
|
$num_zach = addslashes($_POST['num_zach']);
|
|||
|
$id_grupp = addslashes($_POST['id_grupp']);
|
|||
|
$kod_podgotovki = addslashes($_POST['kod_podgotovki']);
|
|||
|
$status = addslashes($_POST['status']);
|
|||
|
$id_user = $_POST['id_user'];
|
|||
|
|
|||
|
$DB->QUR('UPDATE '.$ST['dbpf'].'_users SET fio = "'.$fio.'" WHERE id = "'.$id_user.'" ');
|
|||
|
$DB->QUR('UPDATE '.$ST['dbpf'].'_students SET num_zach = "'.$num_zach.'", id_grupp = "'.$id_grupp.'", kod_podgotovki = "'.$kod_podgotovki.'", status = "'.$status.'" WHERE id_user = "'.$id_user.'" ');
|
|||
|
|
|||
|
$msg = 1;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//сбрасываем пароль
|
|||
|
if (isset($_POST['edit_password'])){
|
|||
|
$password = addslashes($_POST['password']);
|
|||
|
$id_user = $_POST['id_user'];
|
|||
|
|
|||
|
$rez=$DB->QUR('UPDATE '.$ST['dbpf'].'_users SET pass="'.passw_generate($password).'" WHERE id='.$id_user.' LIMIT 1');
|
|||
|
$rez=$DB->QUR('INSERT INTO '.$ST['dbpf'].'_users_pass VALUES(0,'.time().','.$id_user.')');
|
|||
|
save_logs('Обновлены учетные данные пользователя '.$id_user);
|
|||
|
$msg = 1;
|
|||
|
}
|
|||
|
|
|||
|
//определяем айдишник факультета
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_faculties WHERE name = "'.$fakultet.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$id_fak = $rez[1]['id'];
|
|||
|
|
|||
|
//указываем группы
|
|||
|
if(isset($_POST['grupps_nofak_btn'])){
|
|||
|
foreach($_POST['grupp_nofak'] as $idgg => $v){
|
|||
|
$sql = 'UPDATE '.$ST['dbpf'].'_grupp SET id_facult ='.$id_fak.' WHERE id='.$idgg;
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
}
|
|||
|
}
|
|||
|
//список групп
|
|||
|
$grupps = array();
|
|||
|
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_newgrupp WHERE id_facult = "'.$id_fak.'" ';
|
|||
|
|
|||
|
if(isset($_SESSION['liquidation_ved_filter_yearnab'])) {
|
|||
|
$lll = ' AND year_start=' . (int)$_SESSION['liquidation_ved_filter_yearnab'];
|
|||
|
$smarty->assign('filter_yearnab', $_SESSION['liquidation_ved_filter_yearnab']);
|
|||
|
}else{
|
|||
|
$lll = ' AND year_start=' . date('Y');
|
|||
|
$smarty->assign('filter_yearnab', date('Y'));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id_facult = "'.$id_fak.'"'.$lll.' ORDER BY year_start,fo DESC';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
//echo $sql.'<pre>'.print_r($rez,1).'</pre>'; exit();
|
|||
|
//SELECT * FROM acs_grupp WHERE id_facult = "9" AND year_start=2023 ORDER BY year_start,fo DESC
|
|||
|
//Array(
|
|||
|
// [1] => Array([id] => 2589 [data_c] => 1692182774 [data_u] => 1692182774
|
|||
|
// [specialnost] => 35.03.06 [kurs] => 0 [sokr] => АИ-11 [fo] => ОФО
|
|||
|
// [id_teacher] => 0 [id_facult] => 9 [year_start] => 2023
|
|||
|
// )
|
|||
|
//)
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$val['students'] = array();
|
|||
|
$sql_stud = 'SELECT *, status as status_st FROM '.$ST['dbpf'].'_students WHERE id_grupp = "'.$val['id'].'" ';
|
|||
|
|
|||
|
$rez_stud = $DB->QUR_SEL($sql_stud);
|
|||
|
if ($rez_stud) foreach ($rez_stud as $key_st => $val_st) if ($key_st){
|
|||
|
$info_user = get_user($val_st['id_user']); //берем информацию о пользователе/студенте
|
|||
|
//$val_st['info'] = get_user($val_st['id_user']);
|
|||
|
$val_st['fio'] = $info_user['fio'];
|
|||
|
$val_st['email'] = $info_user['email'];
|
|||
|
$val_st['status'] = $info_user['status']; //статус пользователя
|
|||
|
|
|||
|
//$val['students'][] = get_user($val_st['id_user']);
|
|||
|
$val['students'][] = $val_st;
|
|||
|
}
|
|||
|
$grupps[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$grupps_nofak=array();
|
|||
|
$sql = 'SELECT id,specialnost,sokr,fo,year_start FROM '.$ST['dbpf'].'_grupp WHERE id_facult =0 ORDER BY year_start DESC,sokr,fo DESC';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez) {
|
|||
|
foreach ($rez as $key => $val) if ($key) {
|
|||
|
$grupps_nofak[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//print_r($grupps);
|
|||
|
|
|||
|
$student = 'no';
|
|||
|
//если выбран конкретный студент, то мы можем его отредактировать
|
|||
|
if (isset($_GET['des'])) {
|
|||
|
$sql = 'SELECT us.*, st.* FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE us.id = st.id_user AND us.id = "'.$_GET['des'].'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$student = $rez[1];
|
|||
|
//echo $student;
|
|||
|
}
|
|||
|
|
|||
|
//направления подготовки
|
|||
|
$areas = array();
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_areas ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$areas[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$smarty->assign('grupps_nofak', $grupps_nofak);
|
|||
|
$smarty->assign('grupps', $grupps);
|
|||
|
$smarty->assign('student', $student);
|
|||
|
$smarty->assign('areas', $areas);
|
|||
|
$smarty->assign('password', gen_password()); //генерируем пароль
|
|||
|
$smarty->assign('msg', $msg);
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_list_students.html');
|
|||
|
}
|
|||
|
|
|||
|
//ПЕРЕВОД ГРУППЫ НА СЛЕДУЮЩИЙ КУРС
|
|||
|
if ($_GET['page'] == 'perevod_grupp'){
|
|||
|
$grupp = (int) $_GET['grupp'];
|
|||
|
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id = "'.$grupp.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$info = $rez[1]; //берем информацию о группе
|
|||
|
|
|||
|
$chast = explode("-", $info['sokr']);
|
|||
|
$name = $chast[0].'-'.($chast[1][0]+1).substr($chast[1], 1); //новое название группы
|
|||
|
|
|||
|
//переименовываем группу
|
|||
|
$rez=$DB->QUR('UPDATE '.$ST['dbpf'].'_grupp SET sokr="'.$name.'" WHERE id='.$grupp.' LIMIT 1');
|
|||
|
//$rez=$DB->QUR('INSERT INTO '.$ST['dbpf'].'_users_pass VALUES(0,'.time().','.$id_user.')');
|
|||
|
save_logs('Группа переведена на следующий курс (переименование) '.$grupp);
|
|||
|
|
|||
|
//echo $name;
|
|||
|
|
|||
|
$smarty->assign('message', "Группа переименована. Курс изменен на следующий"); //сообщение
|
|||
|
$smarty->assign('link', "/dekanat/list_students/"); //сслыка для редиректа
|
|||
|
$maincontent = $smarty->fetch('tpl_refresh.html');
|
|||
|
}
|
|||
|
|
|||
|
//ВЫПУСКАЕМ ГРУППУ
|
|||
|
if ($_GET['page'] == 'vipusk'){
|
|||
|
$grupp = (int) $_GET['grupp'];
|
|||
|
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id = "'.$grupp.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$info = $rez[1]; //берем информацию о группе
|
|||
|
|
|||
|
$name= "Выпуск ".date("Y")." ".$info['sokr'];
|
|||
|
|
|||
|
//переименовываем группу
|
|||
|
$rez=$DB->QUR('UPDATE '.$ST['dbpf'].'_grupp SET sokr="'.$name.'" WHERE id='.$grupp.' LIMIT 1');
|
|||
|
//$rez=$DB->QUR('INSERT INTO '.$ST['dbpf'].'_users_pass VALUES(0,'.time().','.$id_user.')');
|
|||
|
save_logs('Группа выпущена '.$grupp);
|
|||
|
|
|||
|
//echo $name;
|
|||
|
|
|||
|
$smarty->assign('message', "Группа выпущена"); //сообщение
|
|||
|
$smarty->assign('link', "/dekanat/list_students/"); //сслыка для редиректа
|
|||
|
$maincontent = $smarty->fetch('tpl_refresh.html');
|
|||
|
}
|
|||
|
|
|||
|
//ДИСЦИПЛИНЫ ПО ВЫБОРУ
|
|||
|
if ($_GET['page'] == 'elective'){
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
$message = '';
|
|||
|
|
|||
|
//деканат выбрал предметы
|
|||
|
if (isset($_POST['save_change'])){
|
|||
|
//print_r($_POST);
|
|||
|
|
|||
|
$up = (int)$_POST['up']; //учебный план - айдишник
|
|||
|
|
|||
|
//перед этим мы должны все удалить
|
|||
|
$sql = 'DELETE FROM '.$ST['dbpf'].'_fakultet_elective WHERE id_plan = "'.$up.'" ';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
|
|||
|
|
|||
|
foreach ($_POST['disc'] as $key => $val) if ($key){
|
|||
|
|
|||
|
$sql = 'INSERT INTO '.$ST['dbpf'].'_fakultet_elective (id_stroka, sel, id_plan) VALUES ("'.$key.'", "1", "'.$up.'") ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
$message .= 'Дисциплины успешно выбраны';
|
|||
|
save_logs('Деканат указал перечень дисциплин по выбору, доступных студентам');
|
|||
|
}
|
|||
|
|
|||
|
if (!isset($_GET['des'])){ //НЕ ВЫБРАН КОНКРЕТНЫЙ УЧЕЮНЫЙ ПЛАН
|
|||
|
|
|||
|
//берем список специальностей
|
|||
|
$areas = listAreaOfFakultet($fakultet);
|
|||
|
//берем учебные планы
|
|||
|
$plans = array();
|
|||
|
foreach ($areas as $key => $val){
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE shifr1 = "'.$val['code'].'" ORDER BY nappodgo DESC ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key2 => $val2) if ($key2){
|
|||
|
|
|||
|
$plans[] = $val2;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else{ //ВЫБРАН КОНКРЕТНЫЙ УЧЕБНЫЙ ПЛАН
|
|||
|
$up = $_GET['des'];
|
|||
|
|
|||
|
//возьмем информацию о данной дисциплине
|
|||
|
$info_plan = '';
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE id = "'.$up.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$info_plan = $rez[1];
|
|||
|
|
|||
|
|
|||
|
//подгружаем дисциплины учебного плана
|
|||
|
$predmets = array();
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE id_plans = "'.$up.'" AND discip LIKE "%по выбору%" ORDER BY sem';
|
|||
|
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE id_plans = "'.$up.'" ORDER BY sem';
|
|||
|
|
|||
|
//echo $sql;
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
|
|||
|
|
|||
|
//теперь определяем, что входит в блок этих дисциплин
|
|||
|
$val['block'] = array();
|
|||
|
$sql_in = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE id_plans = "'.$up.'" AND discid LIKE "%'.$val['discid'].'.%" '; //точка в конце обязательна - перед процентами, это означает, это значит что "спускаемся" в подраздел модуля
|
|||
|
$rez_in = $DB->QUR_SEL($sql_in);
|
|||
|
if ($rez_in){
|
|||
|
foreach ($rez_in as $key_in => $val_in) if ($key_in){
|
|||
|
|
|||
|
//также смотрим выбрана ли уже данная дисциплина
|
|||
|
$val_in['sel'] = 0;
|
|||
|
$sql_sel = 'SELECT * FROM '.$ST['dbpf'].'_fakultet_elective WHERE id_stroka = "'.$val_in['id'].'" ';
|
|||
|
$rez_sel = $DB->QUR_SEL($sql_sel);
|
|||
|
if ($rez_sel[0] > 0) $val_in['sel'] = 1;
|
|||
|
|
|||
|
$val['block'][] = $val_in;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$predmets[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*echo '<pre>';
|
|||
|
print_r($predmets);
|
|||
|
echo '</pre>';*/
|
|||
|
|
|||
|
|
|||
|
$smarty->assign('predmets', $predmets);
|
|||
|
$smarty->assign('info_plan', $info_plan);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/***/
|
|||
|
$smarty->assign('areas', $areas);
|
|||
|
$smarty->assign('plans', $plans);
|
|||
|
$smarty->assign('up', $up);
|
|||
|
$smarty->assign('message', $message);
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_elective.html');
|
|||
|
}
|
|||
|
|
|||
|
//ГЕНЕРАЦИЯ ЗАЯВЛЕНИЯ НА ВЫБОР ПРЕДМЕТОВ
|
|||
|
if ($_GET['page'] == 'electiveApplication'){
|
|||
|
|
|||
|
//если не указан номер, значит отображаем просто список заявлений факультета
|
|||
|
if (!isset($_GET['des'])){
|
|||
|
|
|||
|
//список заявлений факультета
|
|||
|
$list_zayav = array();
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_elective GROUP BY date_create, id_student '; //обязательная группировка
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
|
|||
|
$val['user'] = get_user($val['id_user']);
|
|||
|
$val['student'] = get_student($val['id_user']);
|
|||
|
$list_zayav[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$smarty->assign('list_zayav', $list_zayav);
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_elective_zayav.html');
|
|||
|
}
|
|||
|
else{ //ФОРМИРУЕМ ПЕЧАТНУЮ ФОРМУ
|
|||
|
|
|||
|
$id = $_GET['des'];
|
|||
|
|
|||
|
//берем инфу о заявлении
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_elective WHERE id = "'.$id.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
$info = $rez[1];
|
|||
|
$info['user'] = get_user($info['id_user']);
|
|||
|
$info['student'] = get_student($info['id_user']);
|
|||
|
$info['kurs'] = courseOfGruppa($info['student']['id_grupp']);
|
|||
|
|
|||
|
//берем информацию о направлении подготовки
|
|||
|
$sql_area = 'SELECT * FROM '.$ST['dbpf'].'_areas WHERE code = "'.$info['student']['specialnost'].'" ';
|
|||
|
$rez_area = $DB->QUR_SEL($sql_area);
|
|||
|
if ($rez_area){
|
|||
|
$info['area'] = $rez_area[1];
|
|||
|
}
|
|||
|
|
|||
|
//определяем профиль обучения, который выбрал студент (если не выбран никакой, то формируем заявление опираясь на то, что профиль у направления подготовки один-единственный)
|
|||
|
$sql_napr = 'SELECT ns.*, pr.* FROM '.$ST['dbpf'].'_napr_sel as ns, '.$ST['dbpf'].'_profile as pr WHERE ns.id_stud = "'.$info['id_user'].'" AND pr.id_areas = ns.id_napr ';
|
|||
|
//echo $sql_napr;
|
|||
|
$rez_napr = $DB->QUR_SEL($sql_napr);
|
|||
|
if ($rez_napr[0] > 0){
|
|||
|
$info['profile'] = $rez_napr[1];
|
|||
|
} else{ //профиль студент не выбирал - из этого делаем вывод, что профиль у направления подготовки только один, просто ищем его
|
|||
|
$sql_profile = 'SELECT * FROM '.$ST['dbpf'].'_profile WHERE id_areas = "'.$info['area']['id'].'" ';
|
|||
|
//echo $sql_profile;
|
|||
|
$rez_profile = $DB->QUR_SEL($sql_profile);
|
|||
|
if ($rez_profile){
|
|||
|
$info['profile'] = $rez_profile[1];
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//определяем список выбранных дисциплин (СМОТРИМ ПО ДАТЕ!)
|
|||
|
$info['predmets'] = array();
|
|||
|
$sql_predmet = 'SELECT el.*, iupstr.* FROM '.$ST['dbpf'].'_elective as el, '.$ST['dbpf'].'_iup_shahtplans_stroki as iupstr WHERE el.id_user = "'.$rez[1]['id_user'].'" AND el.date_create = "'.$rez[1]['date_create'].'" AND iupstr.id = el.id_predmet';
|
|||
|
$rez_predmet = $DB->QUR_SEL($sql_predmet);
|
|||
|
if ($rez_predmet){
|
|||
|
foreach ($rez_predmet as $key => $val) if ($key){
|
|||
|
$info['predmets'][] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$smarty->assign('info', $info);
|
|||
|
$maincontent = $smarty->display('tpl_dekanat_elective_zayav_print.html');
|
|||
|
exit();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//РАСПИСАНИЕ ФАКУЛЬТЕТА
|
|||
|
if ($_GET['page'] == 'timetable'){
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
$msg = 0; //нужно ли выводить сообщение
|
|||
|
|
|||
|
|
|||
|
//определяем айдишник факультета
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_faculties WHERE name = "'.$fakultet.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$id_fak = $rez[1]['id'];
|
|||
|
|
|||
|
//список групп
|
|||
|
$grupps = array();
|
|||
|
//$sql = 'SELECT * FROM '.$ST['dbpf'].'_newgrupp WHERE id_facult = "'.$id_fak.'" ';
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id_facult = "'.$id_fak.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$val['students'] = array();
|
|||
|
$sql_stud = 'SELECT *, status as status_st FROM '.$ST['dbpf'].'_students WHERE id_grupp = "'.$val['id'].'" ';
|
|||
|
$rez_stud = $DB->QUR_SEL($sql_stud);
|
|||
|
if ($rez_stud) foreach ($rez_stud as $key_st => $val_st) if ($key_st){
|
|||
|
$val_st['info'] = get_user($val_st['id_user']);
|
|||
|
|
|||
|
//$val['students'][] = get_user($val_st['id_user']);
|
|||
|
$val['students'][] = $val_st;
|
|||
|
}
|
|||
|
|
|||
|
$grupps[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (isset($_GET['grupp'])){ //выбрана конкретная группа
|
|||
|
$id_grupp = $_GET['grupp'];
|
|||
|
|
|||
|
if (isset($_GET['toweek'])) $toweek = $_GET['toweek']; else $toweek=date("YW");//годнеделя
|
|||
|
$year = floor($toweek/100);
|
|||
|
$week = $toweek % 100;
|
|||
|
|
|||
|
$seconds = strtotime('01.01.'.$year);
|
|||
|
//echo $seconds;
|
|||
|
|
|||
|
|
|||
|
echo date("W", strtotime("2023-05-30"));
|
|||
|
|
|||
|
$smarty->assign('toweek', $year);
|
|||
|
$smarty->assign('id_grupp', $id_grupp);
|
|||
|
//echo $id_grupp;
|
|||
|
} else{
|
|||
|
|
|||
|
//СПИСОК ВСЕХ ГРУПП
|
|||
|
/****/
|
|||
|
$smarty->assign('grupps', $grupps);
|
|||
|
}
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_timetable.html');
|
|||
|
}
|
|||
|
|
|||
|
//ЗАЯВЛЕНИЯ НА ВЫБОР НАПРАВЛЕННОСТИ ОБУЧЕНИЯ
|
|||
|
if ($_GET['page'] == 'zayv_napr'){
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|||
|
|
|||
|
//ЗАЯВЛЕНИЯ НА ФАКУЛЬТЕТЕ
|
|||
|
$zayavs = array();
|
|||
|
$sql = 'SELECT ns.*, ns.id as id_ns, pr.*, pr.name as name_profile, ar.*, kaf.*, fac.*, fac.name as name_f FROM '.$ST['dbpf'].'_napr_sel as ns, '.$ST['dbpf'].'_profile as pr, '.$ST['dbpf'].'_areas as ar, '.$ST['dbpf'].'_kafedres as kaf, '.$ST['dbpf'].'_faculties as fac WHERE ns.id_napr = pr.id AND pr.id_areas = ar.id AND ar.id_kafedra = kaf.id AND kaf.id_facult = fac.id AND fac.name = "'.$fakultet.'"';
|
|||
|
//$sql = 'SELECT ns.*, pr.* FROM '.$ST['dbpf'].'_napr_sel as ns, '.$ST['dbpf'].'_profile as pr WHERE ns.id_napr = pr.id';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$val['student'] = get_user($val['id_stud']);
|
|||
|
$zayavs[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/******/
|
|||
|
if (isset($_GET['des'])){ //ЗАЯВЛЕНИЕ
|
|||
|
$id = $_GET['des'];
|
|||
|
$sql = 'SELECT ns.*, ns.id as id_ns, pr.*, pr.name as name_profile, ar.*, kaf.*, fac.*, fac.name as name_f FROM '.$ST['dbpf'].'_napr_sel as ns, '.$ST['dbpf'].'_profile as pr, '.$ST['dbpf'].'_areas as ar, '.$ST['dbpf'].'_kafedres as kaf, '.$ST['dbpf'].'_faculties as fac WHERE ns.id_napr = pr.id AND pr.id_areas = ar.id AND ar.id_kafedra = kaf.id AND kaf.id_facult = fac.id AND fac.name = "'.$fakultet.'" AND ns.id = "'.$id.'"';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$rez[1]['student'] = get_user($rez[1]['id_stud']);
|
|||
|
|
|||
|
//echo $val['id_stud'];
|
|||
|
$rez[1]['date_order'] = date('d.m.Y', $rez[1]['date_order']);
|
|||
|
|
|||
|
$dekan = '';
|
|||
|
switch($rez[1]['name_f']){
|
|||
|
case 'Факультет информационных систем в экономике и юриспруденции':
|
|||
|
$rez[1]['name_f'] = 'Факультета информационных систем в экономике и юриспруденции';
|
|||
|
$dekan = 'Доргушаовой А.К.';
|
|||
|
break;
|
|||
|
case 'Технологический факультет':
|
|||
|
$rez[1]['name_f'] = 'Технологического факультета';
|
|||
|
$dekan = 'Схаляхову А.А.';
|
|||
|
break;
|
|||
|
case 'Инженерный факультет':
|
|||
|
$rez[1]['name_f'] = 'Инженерного факультета';
|
|||
|
$dekan = 'Беданокову М.К.';
|
|||
|
break;
|
|||
|
case 'Факультет экономики и сервиса':
|
|||
|
$rez[1]['name_f'] = 'Факультета экономики и сервиса';
|
|||
|
$dekan = 'Ешуговой С.К.';
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$smarty->assign('zayav', $rez[1]);
|
|||
|
$smarty->assign('student', get_student($rez[1]['id_stud']));
|
|||
|
$smarty->assign('dekan', $dekan);
|
|||
|
$smarty->display('tpl_dekanat_zayv_napr_print.html');
|
|||
|
exit;
|
|||
|
}
|
|||
|
|
|||
|
else{ //Просто деканат
|
|||
|
$smarty->assign('zayavs', $zayavs);
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_zayv_napr.html');
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//УДАЛЕНИЕ ЗАЯВЛЕНИЕ
|
|||
|
if ($_GET['page'] == 'zayv_napr_delete'){
|
|||
|
|
|||
|
$id = (int) $_GET['des'];
|
|||
|
|
|||
|
$sql = 'DELETE FROM '.$ST['dbpf'].'_napr_sel WHERE id = "'.$id.'"';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
|
|||
|
save_logs('Удаление заявления на выбор специализации обучения');
|
|||
|
|
|||
|
header("Location: /dekanat/zayv_napr/");
|
|||
|
exit;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//РЕДАКТИРОВАНИЕ ВЕДОМОСТИ
|
|||
|
if ($_GET['page'] == 'editStat'){
|
|||
|
$id = $_GET['des'];
|
|||
|
|
|||
|
//краткая инфа о ведомостим
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_statement WHERE id = "'.$id.'"';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$rez[1]['date_create'] = date('d.m.Y', $rez[1]['date_create']);
|
|||
|
$statement = $rez[1];
|
|||
|
|
|||
|
//инфа о группе
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id = "'.$statement['id_grupp'].'"';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$grupp = $rez[1];
|
|||
|
|
|||
|
//теперь берем более детальную информацию о дисциплине
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_stat = "'.$id.'" LIMIT 1 ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$info = $rez[1];
|
|||
|
|
|||
|
/*peredaem*/
|
|||
|
$smarty->assign('id_ved', $id); //номер ведомости
|
|||
|
$smarty->assign('statement', $statement); //краткая инфа о ведомости
|
|||
|
$smarty->assign('grupp', $grupp); //информация о группе
|
|||
|
$smarty->assign('info', $info); //более детальная инфа
|
|||
|
$maincontent = $smarty->fetch('tpl_dekanat_edit_ved.html');
|
|||
|
}
|
|||
|
|
|||
|
//ОБЩАЯ ТАБЛИЦА СО ВСЕМИ ОЦЕНКАМИ
|
|||
|
if ($_GET['page'] == 'general'){
|
|||
|
require_once './inc/PHPExcel.php';
|
|||
|
require_once './inc/PHPExcel/Writer/Excel2007.php';
|
|||
|
require_once './inc/PHPExcel/IOFactory.php';
|
|||
|
|
|||
|
|
|||
|
//берем за основу образец Excel таблицы
|
|||
|
$xls = PHPExcel_IOFactory::load('./ftp/excel_example/example_general.xlsx');
|
|||
|
|
|||
|
|
|||
|
//айдишник группы
|
|||
|
$id_grupp = $_GET['des'];
|
|||
|
|
|||
|
//берем учебный план группы
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id = "'.$id_grupp.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
$grupp = $rez[1]; //информация о группе
|
|||
|
|
|||
|
//подписываем лист группой
|
|||
|
$xls->setActiveSheetIndex(0);
|
|||
|
$sheet = $xls->getActiveSheet();
|
|||
|
$sheet->setTitle($grupp['sokr'].' '.$grupp['fo']);
|
|||
|
|
|||
|
|
|||
|
//смотрим список студентов и выводим
|
|||
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE id_grupp = "'.$id_grupp.'" ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if ($rez){ $i = 5; //начинаем после 5 строчки вставлять ФИО
|
|||
|
foreach ($rez as $key => $val) if ($key){
|
|||
|
$i++;
|
|||
|
$user = get_user($val['id_user']);
|
|||
|
|
|||
|
$sheet->setCellValue('A'.$i, $user['fio']);
|
|||
|
$sheet->setCellValue('B'.$i, $val['num_zach']);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//смотрим список дисциплин из учебного плана
|
|||
|
$sql = 'SELECT pl.*, str.* FROM '.$ST['dbpf'].'_iup_shahtplans_plans as pl, '.$ST['dbpf'].'_iup_shahtplans_stroki as str WHERE pl.nappodgo = "'.$grupp['specialnost'].'" AND pl.forobu = "очная" AND godnap = 2021 AND shifr1="09.04.03" AND pl.id = str.id_plans ORDER BY str.sem ';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
|
|||
|
|
|||
|
if ($rez){
|
|||
|
/*echo $sql.'<br /><pre>';
|
|||
|
print_r($rez); echo '</pre>';
|
|||
|
exit(); */
|
|||
|
|
|||
|
$i = 1;
|
|||
|
foreach ($rez as $key => $val) if ($key){ $i++;
|
|||
|
$colString = PHPExcel_Cell::stringFromColumnIndex($i);
|
|||
|
$sheet->setCellValue($colString."1", $val['sem']); //указываем семестр в первой строчке
|
|||
|
$sheet->setCellValue($colString."2", $val['discip']); //указываем семестр в первой строчке
|
|||
|
if ($val['ekz'] == 1) $sheet->setCellValue($colString."3", "Экзамен"); //указываем форму контроля
|
|||
|
else $sheet->setCellValue($colString."3", "Зачет");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*
|
|||
|
Если вы используете распространённый компонент PHPExcel, который не требует инициализации COM, то там есть для этого специальная функция:
|
|||
|
$colString = PHPExcel_Cell::stringFromColumnIndex($colNumber);
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
|
|||
|
header("Expires: Mon, 1 Apr 1974 05:00:00 GMT");
|
|||
|
header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
|
|||
|
header("Cache-Control: no-cache, must-revalidate");
|
|||
|
header("Pragma: no-cache");
|
|||
|
header("Content-type: application/vnd.ms-excel");
|
|||
|
header("Content-Disposition: attachment; filename=file.xls");
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$objWriter = new PHPExcel_Writer_Excel5($xls);
|
|||
|
$objWriter->save('php://output');
|
|||
|
exit();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
?>
|