From 564e8c6bf7570fc4195ddd942fc23c14d0c10e32 Mon Sep 17 00:00:00 2001 From: RomanGolienko Date: Tue, 14 Jan 2025 12:12:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0?= =?UTF-8?q?=20=D1=81=D1=82=D0=B0=D1=80=D0=BE=D1=81=D1=82=D1=8B=20=D0=B2=20?= =?UTF-8?q?=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B5=20=D0=B2=20=D0=B1=D0=BE?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=D0=BE=D0=B9=20=D0=BF=D0=B0=D0=BD=D0=B5=D0=BB?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B0=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD.=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/attendancelog.php | 22 ++++++++++++++++++++-- tpl/headman.html | 32 ++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 12 deletions(-) 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'}
-
+

Выбрать группу

- - +

+ + + + + + {foreach from=$facult_groups key=key item=group} - - + + + {/foreach} @@ -48,7 +54,7 @@ -
+
{if isset($headmanPageActionResult.headman) }

Староста уже выбран(а)! - {$headmanPageActionResult.headman}

{/if} @@ -63,7 +69,7 @@
{foreach from=$headmanPageActionResult.students key=user_id item=info} - + @@ -89,11 +95,17 @@
ГруппаСтароста

{$group.sokr}

{$group.sokr}
{if isset($group.headman)}{$group.headman} {else} не назначен ! {/if}

{$headmanPageActionResult.current_group.sokr}

{$info.student_name}
- + + + + + + {foreach from=$facult_groups key=key item=group} - - + + + {/foreach}

ГруппаСтароста

{$group.sokr}

{$group.sokr}
{if isset($group.headman)}{$group.headman} {else} не назначен ! {/if}