From 26ee706cb93328bf17a6b8acab50b2072871a049 Mon Sep 17 00:00:00 2001 From: RomanGolienko Date: Wed, 13 Nov 2024 16:26:13 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B0=D1=81=D1=81=D0=B8?= =?UTF-8?q?=D0=B2=D0=B0=20=D1=81=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=BC?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B0?= =?UTF-8?q?=D0=BC,=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20=D0=B3=D1=80?= =?UTF-8?q?=D1=83=D0=BF=D0=BF=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/attendancelog.php | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/inc/attendancelog.php b/inc/attendancelog.php index fec3da6..444c424 100644 --- a/inc/attendancelog.php +++ b/inc/attendancelog.php @@ -18,6 +18,19 @@ class attendancelog { $url = 'https://eios.mkgtu.ru/api.php?des=studentsByGrupp¶m1=' . $groupName . '¶m2=' . $educationForm; return json_decode(file_get_contents($url),1); } + function getClassesByGroup($groupName,$educationForm) + { + $tmp = explode('-', $groupName); + $groupName = trim($tmp[0]); + $groupNumber = substr($tmp[1],0,2); + $educationForm = urlencode($educationForm); + $groupName = urlencode($groupName); + $groupNumber = urlencode($groupNumber); + $url = 'https://local.mkgtu.ru/raspisnew/api.php?des=raspis_grupp&name='. $groupName .'&number='. $groupNumber .'&fo=' . $educationForm; + return json_decode(file_get_contents($url),1); + //return $url; + } + function getGroupNameByID($id) { $sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' '; return $this->DB->QUR_SEL($sql_search); @@ -26,9 +39,19 @@ class attendancelog { { $des = ''; if(isset($_GET['des'])) $des = $_GET['des']; if ($des == 'show'){ - //получаем список студентов по группе + //получаем список пар по имени группы +// $current_group = $this->getGroupNamebyID($_GET['id']); +// return $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']); + + $current_group = $this->getGroupNamebyID($_GET['id']); - return $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']); + $current_group_classes = $this->getClassesByGroup($current_group[1]['sokr'], $current_group[1]['fo']); + $out = array(); + foreach ($current_group_classes['raspis'] as $class) { + $out['info'][$class['week_name']][$class['day_name']][$class['time1']] = $class; + $out['students'] = $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']); + } + return $out; } } function HTML() @@ -38,8 +61,8 @@ class attendancelog { $actionResult = $this->mainPageAction(); //$html .= '
'. print_r($groups,1) . '
'; //$html .= '
'. print_r($actionResult,1) . '
'; - $html .= '
'. print_r($_GET,1) . '
'; -// $html .= '
'. print_r($_SESSION,1) . '
'; + //$html .= '
'. print_r($_GET,1) . '
'; + //$html .= '
'. print_r($_SESSION,1) . '
'; GLOBAL $smarty; $page = ''; if(isset($_GET['page'])) $page = $_GET['page']; $des = ''; if(isset($_GET['des'])) $des = $_GET['des'];