diff --git a/inc/attendancelog.php b/inc/attendancelog.php index 9812d97..a8c90b3 100644 --- a/inc/attendancelog.php +++ b/inc/attendancelog.php @@ -247,6 +247,11 @@ class attendancelog { return $out; } } + function getHeadman($group){ + $sql_search = 'SELECT * FROM acs_attendancelog_headmen WHERE gruppa="'. $group .'" '; + $tmp = $this->DB->QUR_SEL($sql_search); + return $tmp[1]; + } function HTML() { GLOBAL $smarty; @@ -260,7 +265,6 @@ class attendancelog { $predmetsAddEdit = $this->predmetsAddEdit('Исследование операций и методы оптимизации'); $gruppsSearch = $this->gruppsSearch($_POST['all_grupps_search']); - //$html .= '
'. print_r($groups,1) . ''; //$html .= '
'. print_r($gruppsSearch,1) . ''; //$html .= '
'. print_r($currentUserInfo,1) . ''; @@ -283,10 +287,21 @@ class attendancelog { $smarty->assign('currentUserInfo', $currentUserInfo); if($page == 'headman') { $facult_groups = $this->getAllGrupps($currentUserInfo['facult']['facult_id']); + foreach ($facult_groups as $key => $group) { + $students = $this->getStudentsByGroup($group['sokr'], $group['fo']); + $students = $students['students']; + $headman = $this->getHeadman($group['sokr']); + foreach($students as $user_id => $student_name) { + if ($headman['user_id'] == $user_id){ + $facult_groups[$key]['headman'] = $student_name; + } + } + } $smarty->assign('facult_groups',$facult_groups); $smarty->assign('headmanPageActionResult', $headmanPageActionResult); $smarty->clearCache('moduls/attendancelog/tpl/headman.html'); $html .= $smarty->fetch('moduls/attendancelog/tpl/headman.html'); + } if ($page == ''){ if($currentUserInfo['role'] == 'student'){ @@ -294,7 +309,10 @@ class attendancelog { header($header); } $groups = $this->getAllGrupps(); - $facult_groups = $this->getAllGrupps($currentUserInfo['facult']['facult_id']); + if (isset($currentUserInfo['facult']['facult_id'])){ + $facult_groups = $this->getAllGrupps($currentUserInfo['facult']['facult_id']); + } + if(isset($_POST['all_grupps_search'])){ $groups = $this->gruppsSearch($_POST['all_grupps_search']); } diff --git a/tpl/headman.html b/tpl/headman.html index 537c37c..854b4b6 100644 --- a/tpl/headman.html +++ b/tpl/headman.html @@ -28,19 +28,25 @@ {if $des == 'add_edit'}