53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
<?php
|
|
if($des == 'view'){
|
|
$id=(int)$_GET['id'];
|
|
$dzayavka=array();
|
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_studentzayavks WHERE id='.$id.'';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
if($rez){
|
|
$dzayavka=$rez[1];
|
|
}
|
|
|
|
$zayavka=array();
|
|
/*id data_c id_studentzayavks id_user status_old status_new descrip */
|
|
$sql = 'SELECT st.data_c,st.status_old,st.status_new,st.descrip,u.fio FROM '.$ST['dbpf'].'_iup_statuses as st, '.$ST['dbpf'].'_users as u WHERE u.id=st.id_user AND st.id_studentzayavks='.$id.' ORDER BY st.data_c ASC';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
if($rez){
|
|
foreach($rez as $key => $val)if($key){
|
|
$zayavka[] = $val;
|
|
}
|
|
}
|
|
|
|
$smarty->assign('statuses',$statuses);
|
|
$smarty->assign('dzayavka',$dzayavka);
|
|
$smarty->assign('zayavka',$zayavka);
|
|
}
|
|
if($des == 'show'){
|
|
$sel_status = 0; if(isset($_POST['sel_status'])) $sel_status = (int)$_POST['sel_status'];
|
|
$zayavks=array();
|
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_studentzayavks WHERE status='.$sel_status.' ORDER BY pret_naprav,data_c';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
//echo $sql.'<pre>'.print_r($rez,1).'</pre>';
|
|
if($rez){
|
|
foreach($rez as $key => $val)if($key){
|
|
$sql1 = 'SELECT count(id) as kol FROM '.$ST['dbpf'].'_iup_statuses WHERE id_studentzayavks='.$val['id'].';';
|
|
$rez1 = $DB->QUR_SEL($sql1);
|
|
if($rez1){
|
|
$val['kolst'] = $rez1[1]['kol'];
|
|
}
|
|
$val['ppp'] = explode(':',$val['pret_naprav']);
|
|
//узнать надо время
|
|
|
|
$val['razd'] = DateDiff ('d',$val['data_c'],time());
|
|
$zayavks[] = $val;
|
|
}
|
|
}
|
|
$smarty->assign('zayavks',$zayavks);
|
|
$smarty->assign('sel_status',$sel_status);
|
|
}
|
|
|
|
$smarty->assign('statuses',$statuses);
|
|
$smarty->assign('page',$page);
|
|
$smarty->assign('des',$des);
|
|
|
|
$maincontent = $smarty->fetch('tpl_iup_logs.html'); |