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']); $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; }} //$val['predmets'] = iup_get_predmets($_SESSION['user']['teacher']['fakultet'],$val['pret_kurs'],$val['pret_fo']); //получим предметы по привязке ЗАЯВКИ к УЧ.ПЛАНУ $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 '
'.print_r($val['predmets'],1).''; $zayavka = $val; $smarty->assign('zayavka',$zayavka); } $smarty->display('tpl_iup_otchets.html'); } exit(); ?>