102 lines
4.9 KiB
PHP
102 lines
4.9 KiB
PHP
<?php
|
|
//меняем ID пользователя если есть
|
|
if(isset($_SESSION['user']['oid'])) {
|
|
$_SESSION['user']['id'] = $_SESSION['user']['oid'];
|
|
unset($_SESSION['user']['oid']);
|
|
unset($_SESSION['rejteu']);
|
|
}
|
|
|
|
$otchgods=array();//выберем активный отчетный период
|
|
unset($_SESSION['otchgods'][3]);
|
|
$sql = 'SELECT * FROM '.$TB['otchgods'].' WHERE tip=3 AND status=1';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
if($rez){
|
|
$otchgods = $rez[1];
|
|
$otchgods['konec'] = 0; if(time()>$otchgods['data_s2']) $otchgods['konec'] = 1;
|
|
$_SESSION['otchgods'][$otchgods['tip']] = $otchgods;//для подсчета баллов
|
|
if($_SESSION['user']['id']==4870||$_SESSION['user']['id']==19603){ $otchgods['konec']=0; }
|
|
if($otchgods['konec']==0){
|
|
$rejtuser = rejt_get_useranketa();
|
|
$items = $rejtuser['items'];
|
|
$BALLS = $rejtuser['balls'];
|
|
}
|
|
}
|
|
//echo '<pre>'.print_r($_SESSION,1).'</pre>';
|
|
|
|
$users_kaf=array();
|
|
if(isset($_SESSION['user']['statuses'][59])) {//админ иупа
|
|
if(isset($_SESSION['rejteu'])){//есть выбор пользователя для редактирования
|
|
if(isset($_SESSION['user']['teacher'])){
|
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|
$kafedra = $_SESSION['user']['teacher']['kafedra'];
|
|
$sql = 'SELECT u.*,t.zvanie,t.dolgnost,t.stepen FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE u.id='.$_SESSION['rejteu'].' AND t.id_user=u.id';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
if($rez){//вроде наш сотрудник
|
|
//меняем ИД пользователя и отображаем
|
|
$_SESSION['user']['oid'] = $_SESSION['user']['id'];
|
|
$_SESSION['user']['id'] = $_SESSION['rejteu'];
|
|
$rejtuser = rejt_get_useranketa();
|
|
$items = $rejtuser['items'];
|
|
$BALLS = $rejtuser['balls'];
|
|
//echo '<pre>'.print_r($rejtuser,1).'</pre>';exit();
|
|
}
|
|
}
|
|
}else {
|
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|
$kafedra = $_SESSION['user']['teacher']['kafedra'];
|
|
//надо выбрать всех преподов на кафедре и отобразить список
|
|
$sql = 'SELECT u.*,t.zvanie,t.dolgnost,t.stepen FROM ' . $ST['dbpf'] . '_teachers as t,' . $ST['dbpf'] . '_users as u WHERE t.id_user=u.id';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
if ($rez) {
|
|
foreach ($rez as $key => $val) if ($key) {
|
|
$users_kaf[] = $val;
|
|
}
|
|
}
|
|
}
|
|
}else if(isset($_SESSION['user']['statuses'][30])){//зав.кафедрой
|
|
if(isset($_SESSION['rejteu'])){//есть выбор пользователя для редактирования
|
|
if(isset($_SESSION['user']['teacher'])){
|
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|
$kafedra = $_SESSION['user']['teacher']['kafedra'];
|
|
$sql = 'SELECT u.*,t.zvanie,t.dolgnost,t.stepen FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE t.kafedra="'.$kafedra.'" AND u.id='.$_SESSION['rejteu'].' AND t.id_user=u.id';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
if($rez){//вроде наш сотрудник
|
|
//меняем ИД пользователя и отображаем
|
|
$_SESSION['user']['oid'] = $_SESSION['user']['id'];
|
|
$_SESSION['user']['id'] = $_SESSION['rejteu'];
|
|
$rejtuser = rejt_get_useranketa();
|
|
$items = $rejtuser['items'];
|
|
$BALLS = $rejtuser['balls'];
|
|
//echo '<pre>'.print_r($rejtuser,1).'</pre>';exit();
|
|
}
|
|
}
|
|
}else{
|
|
//смотрим какая кафедра
|
|
if(isset($_SESSION['user']['teacher'])){
|
|
$fakultet = $_SESSION['user']['teacher']['fakultet'];
|
|
$kafedra = $_SESSION['user']['teacher']['kafedra'];
|
|
//надо выбрать всех преподов на кафедре и отобразить список
|
|
$sql = 'SELECT u.*,t.zvanie,t.dolgnost,t.stepen FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE t.kafedra="'.$kafedra.'" AND t.id_user=u.id';
|
|
$rez = $DB->QUR_SEL($sql);
|
|
if($rez){
|
|
foreach($rez as $key => $val)if($key){
|
|
$users_kaf[] = $val;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//если редактируем пользователя
|
|
if(isset($_SESSION['rejteu'])) $smarty->assign('rejteu',$_SESSION['rejteu']); else $smarty->assign('rejteu',0);
|
|
$smarty->assign('users_kaf',$users_kaf);
|
|
//echo '<pre>'.print_r($_SESSION,1).'</pre>';
|
|
//echo '<pre>'.print_r($otchgods,1).'</pre>';
|
|
|
|
$smarty->assign('otchgods',$otchgods);
|
|
$smarty->assign('BALLS',$BALLS);
|
|
$smarty->assign('items',$items);
|
|
$smarty->assign('page',$page);
|
|
$smarty->assign('des',$des);
|
|
$zkedit = 0; if(isset($_SESSION['rejteu'])&&isset($_SESSION['user']['oid'])) $zkedit=1;
|
|
$smarty->assign('zkedit',$zkedit);
|
|
$maincontent = $smarty->fetch('tpl_rejt_anketa.html'); |