Новая логика группировки данных для отображения.

This commit is contained in:
RomanGolienko 2024-11-22 13:11:58 +03:00
parent 8f011bc0ed
commit 576b4672ac
1 changed files with 35 additions and 2 deletions

View File

@ -55,7 +55,36 @@ class attendancelog {
$rez['week1'] = $week['week_cur']; $rez['week1'] = $week['week_cur'];
return $rez; return $rez;
} }
function timeGroup() {
$raspis = $this->mainPageAction();
$out = array();
$currentTime = $this->currentTime();
$first_weekday_of_year = $currentTime['year'] .'-01-01';
$first_weekday_of_year= date('w', strtotime($first_weekday_of_year));
$weekday = $first_weekday_of_year;
for ($month = 1; $month <= 12; $month++){
$day_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $currentTime['year']);
$day = 1;
$week = 1;
for ($day; $day <= $day_in_month; $day++){
if($weekday > 7){
$weekday = 1;
$week++;
}
$tmp1 = $currentTime['year'] . '-' . $month . '-' . '01';
$month_name = date('M',strtotime($tmp1));
$out[$currentTime['year']][$month_name][$week . ' неделя'][$day] = $raspis['info'][$weekday];
$weekday++;
}
}
return $out;
}
function getGroupNameByID($id) { function getGroupNameByID($id) {
$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);
@ -81,6 +110,8 @@ class attendancelog {
} }
} }
return $out; return $out;
}elseif($des == 'calendar_show'){
} }
} }
function HTML() function HTML()
@ -89,9 +120,11 @@ class attendancelog {
$groups = $this->getAllGrupps(); $groups = $this->getAllGrupps();
$actionResult = $this->mainPageAction(); $actionResult = $this->mainPageAction();
$currentTime = $this->currentTime(); $currentTime = $this->currentTime();
$timeGroup = $this->timeGroup();
//$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($timeGroup,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>';