Изменена структура массива, убрана группировка по неделям и дням

This commit is contained in:
RomanGolienko 2024-11-25 14:26:19 +03:00
parent 8f011bc0ed
commit 9395a7222b
1 changed files with 20 additions and 11 deletions

View File

@ -60,24 +60,33 @@ class attendancelog {
$sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' '; $sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' ';
return $this->DB->QUR_SEL($sql_search); 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() function mainPageAction()
{ {
$des = ''; if(isset($_GET['des'])) $des = $_GET['des']; $des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
if ($des == 'show'){ 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 = $this->getGroupNamebyID($_GET['id']);
$current_group_classes = $this->getClassesByGroup($current_group[1]['sokr'], $current_group[1]['fo']); $current_group_classes = $this->getClassesByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
$currentTime = $this->currentTime(); $currentTime = $this->currentTime();
$out = array(); $out = array();
foreach ($current_group_classes['raspis'] as $class) { foreach ($current_group_classes['raspis'] as $class) {
if ($class['week1'] == $currentTime['week1']) { if(isset($_POST['date_request'])) {
$out['info'][$class['day1']]['day_name'] = $class['day_name']; $week_compare = $this->getWeekByDate(strtotime($_POST['date_request']));
$out['info'][$class['day1']][$class['time1']] = $class; $day_compare = date('w', strtotime($_POST['date_request']));
$out['students'] = $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']); }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; return $out;
@ -90,8 +99,8 @@ class attendancelog {
$actionResult = $this->mainPageAction(); $actionResult = $this->mainPageAction();
$currentTime = $this->currentTime(); $currentTime = $this->currentTime();
//$html .= '<pre>'. print_r($groups,1) . '</pre>'; //$html .= '<pre>'. print_r($groups,1) . '</pre>';
$html .= '<pre>'. print_r($actionResult,1) . '</pre>'; //$html .= '<pre>'. print_r($actionResult,1) . '</pre>';
$html .= '<pre>'. print_r($currentTime,1) . '</pre>'; //$html .= '<pre>'. print_r($currentTime,1) . '</pre>';
//$html .= '<pre>'. print_r($_GET,1) . '</pre>'; //$html .= '<pre>'. print_r($_GET,1) . '</pre>';
//$html .= '<pre>'. print_r($_POST,1) . '</pre>'; //$html .= '<pre>'. print_r($_POST,1) . '</pre>';
//$html .= '<pre>'. print_r($_SESSION,1) . '</pre>'; //$html .= '<pre>'. print_r($_SESSION,1) . '</pre>';