diff --git a/inc/attendancelog.php b/inc/attendancelog.php index 4db344e..910f39a 100644 --- a/inc/attendancelog.php +++ b/inc/attendancelog.php @@ -55,11 +55,25 @@ class attendancelog { $rez['week1'] = $week['week_cur']; return $rez; } - function timeGroup() { - - $raspis = $this->mainPageAction(); + function getGroupNameByID($id) { + $sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' '; + return $this->DB->QUR_SEL($sql_search); + } + function mainPageAction() + { + $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']); + } + } + $currentTime = $this->currentTime(); $first_weekday_of_year = $currentTime['year'] .'-01-01'; $first_weekday_of_year= date('w', strtotime($first_weekday_of_year)); @@ -69,49 +83,20 @@ class attendancelog { $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) { - $sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' '; - return $this->DB->QUR_SEL($sql_search); - } - 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']); + $result[$currentTime['year']][$month_name][$week][$day] = $out['info'][$weekday]; + if($weekday > 6){ + $weekday = 1; + $week++; + }else{ + $weekday++; } } - return $out; - }elseif($des == 'calendar_show'){ - + } + $des = ''; if(isset($_GET['des'])) $des = $_GET['des']; + if ($des == 'show'){ + return $result; } } function HTML() @@ -120,12 +105,10 @@ class attendancelog { $groups = $this->getAllGrupps(); $actionResult = $this->mainPageAction(); $currentTime = $this->currentTime(); - $timeGroup = $this->timeGroup(); //$html .= '
'. print_r($groups,1) . ''; - //$html .= '
'. print_r($actionResult,1) . ''; - $html .= '
'. print_r($timeGroup,1) . ''; + $html .= '
'. print_r($actionResult,1) . ''; //$html .= '
'. print_r($currentTime,1) . ''; - //$html .= '
'. print_r($_GET,1) . ''; + $html .= '
'. print_r($_GET,1) . ''; //$html .= '
'. print_r($_POST,1) . ''; //$html .= '
'. print_r($_SESSION,1) . ''; GLOBAL $smarty; diff --git a/tpl/main_page.html b/tpl/main_page.html index 240b987..dbc2df4 100644 --- a/tpl/main_page.html +++ b/tpl/main_page.html @@ -32,84 +32,127 @@