From 9395a7222b6b5ec91188c4468f5a3a2bd667088c Mon Sep 17 00:00:00 2001 From: RomanGolienko Date: Mon, 25 Nov 2024 14:26:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D1=83=D1=80=D0=B0?= =?UTF-8?q?=20=D0=BC=D0=B0=D1=81=D1=81=D0=B8=D0=B2=D0=B0,=20=D1=83=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B0=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BF=D0=BE=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D1=8F=D0=BC=20=D0=B8=20=D0=B4=D0=BD=D1=8F?= =?UTF-8?q?=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/attendancelog.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/inc/attendancelog.php b/inc/attendancelog.php index d39cc0a..2d8176c 100644 --- a/inc/attendancelog.php +++ b/inc/attendancelog.php @@ -60,24 +60,33 @@ class attendancelog { $sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' '; return $this->DB->QUR_SEL($sql_search); } + public function getWeekByDate($ts=0) { + $url = 'https://local.mkgtu.ru/raspisnew/api.php?des=raspis_week_cur&ts=' . $ts; + $awn = json_decode(file_get_contents($url),1); + return $awn['week_cur']; + } function mainPageAction() { $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']); $current_group_classes = $this->getClassesByGroup($current_group[1]['sokr'], $current_group[1]['fo']); $currentTime = $this->currentTime(); $out = array(); foreach ($current_group_classes['raspis'] as $class) { - if ($class['week1'] == $currentTime['week1']) { - $out['info'][$class['day1']]['day_name'] = $class['day_name']; - $out['info'][$class['day1']][$class['time1']] = $class; - $out['students'] = $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']); + if(isset($_POST['date_request'])) { + $week_compare = $this->getWeekByDate(strtotime($_POST['date_request'])); + $day_compare = date('w', strtotime($_POST['date_request'])); + }else { + $week_compare = $currentTime['week1']; + $day_compare = $currentTime['day1']; + } + if ($class['week1'] == $week_compare) { + if($class['day1'] == $day_compare){ + $out['day_name'] = $class['day_name']; + $out['day_info'][$class['time1']] = $class; + $out['students'] = $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']); + } } } return $out; @@ -90,8 +99,8 @@ class attendancelog { $actionResult = $this->mainPageAction(); $currentTime = $this->currentTime(); //$html .= '
'. print_r($groups,1) . '
'; - $html .= '
'. print_r($actionResult,1) . '
'; - $html .= '
'. print_r($currentTime,1) . '
'; + //$html .= '
'. print_r($actionResult,1) . '
'; + //$html .= '
'. print_r($currentTime,1) . '
'; //$html .= '
'. print_r($_GET,1) . '
'; //$html .= '
'. print_r($_POST,1) . '
'; //$html .= '
'. print_r($_SESSION,1) . '
';