121 lines
5.0 KiB
PHP
121 lines
5.0 KiB
PHP
|
<?php
|
|||
|
//$zamdeknaprav = iup_get_zamdeknaprav($_SESSION['user']['teacher']['fakultet']);
|
|||
|
if(isset($_POST['sekdek_zaversh'])||isset($_POST['sekdek_gotovo'])){//сохраняем заявку
|
|||
|
$id_zayavka = (int)$_POST['id_zayavka'];
|
|||
|
if(isset($_POST['sekdek_gotovo'])){//меняем статус у заявки
|
|||
|
$sql = 'UPDATE '.$TB['iup_studentzayavks'].' SET status=6 WHERE id='.$id_zayavka.'';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){
|
|||
|
send_email_iup($id_zayavka);
|
|||
|
$sql = 'INSERT INTO '.$TB['iup_statuses'].' VALUES(0,'.time().','.$id_zayavka.','.$_SESSION['user']['id'].',5,6,"")';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
if($rez){ $msg['msg'][]='Время изменения статуса сохранено!';}
|
|||
|
else{ $msg['err'][]='Время изменения статуса не сохранено!'; }
|
|||
|
}
|
|||
|
}elseif(isset($_POST['sekdek_vernutkaf'])){
|
|||
|
$sql = 'UPDATE '.$TB['iup_studentzayavks'].' SET status=4 WHERE id='.$id_zayavka.'';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){
|
|||
|
send_email_iup($id_zayavka);
|
|||
|
$sql = 'INSERT INTO '.$TB['iup_statuses'].' VALUES(0,'.time().','.$id_zayavka.','.$_SESSION['user']['id'].',5,4,"")';
|
|||
|
$rez = $DB->QUR($sql);
|
|||
|
if($rez){ $msg['msg'][]='Время изменения статуса сохранено!';}
|
|||
|
else{ $msg['err'][]='Время изменения статуса не сохранено!'; }
|
|||
|
}
|
|||
|
}
|
|||
|
$des = 'show';
|
|||
|
}
|
|||
|
|
|||
|
if($des == 'edit'){
|
|||
|
$id = (int)$_GET['id'];
|
|||
|
$sql = 'SELECT * FROM '.$TB['iup_studentzayavks'].' WHERE id='.$id.' AND (status=5 OR status=6)';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){
|
|||
|
$val = $rez[1]; $id_zayavka=$val['id'];
|
|||
|
$val['data_c'] = date('H:i:s d.m.Y',$val['data_c']);
|
|||
|
$val['diplom_data'] = date('d.m.Y',$val['diplom_data']);
|
|||
|
$sql = 'SELECT * FROM '.$TB['iup_studentzayavks_files'].' WHERE id_studentzayavks='.$id_zayavka.' ORDER BY data_c';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){foreach($rez as $k => $v)if($k){
|
|||
|
$v['data_c'] = date('H:i:s d.m.Y',$v['data_c']);
|
|||
|
$val['files'][]=$v;
|
|||
|
}}
|
|||
|
//получим предметы по привязке ЗАЯВКИ к УЧ.ПЛАНУ
|
|||
|
$predmets = iup_get_predmets_BYzp($id_zayavka);
|
|||
|
if(!count($predmets)) {
|
|||
|
$val['predmets'] = iup_get_predmets($_SESSION['user']['teacher']['fakultet'], $val['pret_naprav'], $val['pret_kurs'], $val['pret_fo']);
|
|||
|
}else{
|
|||
|
$val['predmets'] = $predmets;
|
|||
|
}
|
|||
|
foreach($val['predmets'] as $k => $v){
|
|||
|
$id_predmet = $v['id'];
|
|||
|
//оценки от аттком
|
|||
|
$sql1 = 'SELECT * FROM '.$TB['iup_attkom'].' WHERE id_user='.$_SESSION['user']['id'].' AND id_studentzayavks='.$id_zayavka.' AND id_predmet='.$id_predmet.'';
|
|||
|
$rez1 = $DB->QUR_SEL($sql1);
|
|||
|
if($rez1){
|
|||
|
$val['predmets'][$k]['ocenka1'] = $rez1[1]['ocenka'];
|
|||
|
$val['day'] = date('d.m.Y',$rez1[1]['data_time']);
|
|||
|
$val['time'] = date('H:i',$rez1[1]['data_time']);
|
|||
|
}
|
|||
|
//оценки от преподов
|
|||
|
$sql1 = 'SELECT * FROM '.$TB['iup_ocenki'].' WHERE id_user='.$_SESSION['user']['id'].' AND id_studentzayavks='.$id_zayavka.' AND id_predmet='.$id_predmet.'';
|
|||
|
$rez1 = $DB->QUR_SEL($sql1);
|
|||
|
if($rez1){
|
|||
|
$val['predmets'][$k]['ocenka0'] = $rez1[1]['ocenka'];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
$sql = 'SELECT * FROM '.$TB['iup_kafedrs_files'].' WHERE id_studentzayavks='.$val['id'].' ORDER BY data_c';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){foreach($rez as $k => $v)if($k){
|
|||
|
$v['data_c'] = date('H:i:s d.m.Y',$v['data_c']);
|
|||
|
$namefile=''; $t=explode('/',$v['file']); $namefile=$t[count($t)-1];
|
|||
|
$v['namefile'] = $namefile;
|
|||
|
$val['filesk'][]=$v;
|
|||
|
}}
|
|||
|
$sql = 'SELECT * FROM '.$TB['iup_kafumu_chat'].' WHERE id_studentzayavks='.$val['id'].' ORDER BY data_c';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){foreach($rez as $k => $v)if($k){
|
|||
|
$v['data_c'] = date('H:i:s d.m.Y',$v['data_c']);
|
|||
|
$v['text'] = stripslashes($v['text']);
|
|||
|
$val['chat_umu'][]=$v;
|
|||
|
}}
|
|||
|
|
|||
|
//echo '<pre>'.print_r($val['predmets'],1).'</pre>';
|
|||
|
$zayavka = $val;
|
|||
|
$smarty->assign('zayavka',$zayavka);
|
|||
|
}else{
|
|||
|
$des = 'show';
|
|||
|
}
|
|||
|
}
|
|||
|
if($des == 'show'){
|
|||
|
$zayavks=array();
|
|||
|
$sql = 'SELECT * FROM '.$TB['iup_studentzayavks'].' WHERE (status=3 OR status=4 OR status=5 OR status=6) AND perevod=1 ORDER BY data_c DESC';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){
|
|||
|
foreach($rez as $key => $val)if($key){
|
|||
|
$id_zayavka = $val['id'];
|
|||
|
$val['data_c'] = date('H:i:s d.m.Y',$val['data_c']);
|
|||
|
$val['ppp'] = explode(':',$val['pret_naprav']);
|
|||
|
|
|||
|
$sql = 'SELECT nomer,data FROM '.$ST['dbpf'].'_iup_studkadr WHERE id_studentzayavks='.$val['id'].' LIMIT 1';
|
|||
|
$rez = $DB->QUR_SEL($sql);
|
|||
|
if($rez){
|
|||
|
$val['znomer'] = $rez[1]['nomer'];
|
|||
|
$val['zdata'] = $rez[1]['data'];
|
|||
|
}else{
|
|||
|
$val['znomer'] = '';
|
|||
|
$val['zdata'] = '';
|
|||
|
}
|
|||
|
|
|||
|
$zayavks[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
$smarty->assign('zayavks',$zayavks);
|
|||
|
}
|
|||
|
|
|||
|
$smarty->assign('zamdeknaprav',$zamdeknaprav);
|
|||
|
$smarty->assign('page',$page);
|
|||
|
$smarty->assign('des',$des);
|
|||
|
$smarty->assign('msg',$msg);
|
|||
|
$maincontent = $smarty->fetch('tpl_iup_main.html');
|