2024-11-12 13:08:43 +03:00
|
|
|
<?php
|
|
|
|
class attendancelog {
|
|
|
|
private string $name;
|
|
|
|
private $DB;
|
|
|
|
public function __construct($DB, $name){
|
|
|
|
$this->DB = $DB;
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
|
|
|
function getAllGrupps() {
|
|
|
|
$sql_search = 'SELECT id, sokr, fo, kurs FROM acs_grupp ORDER BY `sokr` DESC';
|
|
|
|
$rez = $this->DB->QUR_SEL($sql_search);
|
|
|
|
return $rez;
|
|
|
|
}
|
|
|
|
function getStudentsByGroup($groupName,$educationForm)
|
|
|
|
{
|
|
|
|
$educationForm = urlencode($educationForm);
|
|
|
|
$groupName = urlencode($groupName);
|
|
|
|
$url = 'https://eios.mkgtu.ru/api.php?des=studentsByGrupp¶m1=' . $groupName . '¶m2=' . $educationForm;
|
|
|
|
return json_decode(file_get_contents($url),1);
|
|
|
|
}
|
2024-11-13 16:26:13 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2024-11-12 14:57:17 +03:00
|
|
|
function getGroupNameByID($id) {
|
|
|
|
$sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' ';
|
|
|
|
return $this->DB->QUR_SEL($sql_search);
|
|
|
|
}
|
2024-11-12 13:08:43 +03:00
|
|
|
function mainPageAction()
|
|
|
|
{
|
|
|
|
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
|
|
|
|
if ($des == 'show'){
|
2024-11-13 16:26:13 +03:00
|
|
|
//получаем список пар по имени группы
|
|
|
|
// $current_group = $this->getGroupNamebyID($_GET['id']);
|
|
|
|
// return $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
|
|
|
|
|
|
|
|
|
2024-11-12 14:57:17 +03:00
|
|
|
$current_group = $this->getGroupNamebyID($_GET['id']);
|
2024-11-13 16:26:13 +03:00
|
|
|
$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;
|
2024-11-12 13:08:43 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function HTML()
|
|
|
|
{
|
|
|
|
$html = '';
|
|
|
|
$groups = $this->getAllGrupps();
|
|
|
|
$actionResult = $this->mainPageAction();
|
|
|
|
//$html .= '<pre>'. print_r($groups,1) . '</pre>';
|
|
|
|
//$html .= '<pre>'. print_r($actionResult,1) . '</pre>';
|
2024-11-13 16:26:13 +03:00
|
|
|
//$html .= '<pre>'. print_r($_GET,1) . '</pre>';
|
|
|
|
//$html .= '<pre>'. print_r($_SESSION,1) . '</pre>';
|
2024-11-12 13:08:43 +03:00
|
|
|
GLOBAL $smarty;
|
|
|
|
$page = ''; if(isset($_GET['page'])) $page = $_GET['page'];
|
|
|
|
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
|
|
|
|
$smarty->assign('des', $des);
|
|
|
|
$smarty->assign('name', $this->name);
|
|
|
|
if($page == 'headman') {
|
|
|
|
$smarty->clearCache('moduls/attendancelog/tpl/headman.html');
|
|
|
|
$html .= $smarty->fetch('moduls/attendancelog/tpl/headman.html');
|
|
|
|
}
|
|
|
|
if ($page == ''){
|
|
|
|
$smarty->assign('groups',$groups);
|
|
|
|
$smarty->clearCache('moduls/attendancelog/tpl/main_page.html');
|
|
|
|
$html .= $smarty->fetch('moduls/attendancelog/tpl/main_page.html');
|
|
|
|
|
|
|
|
}
|
|
|
|
if ($page == 'main'){
|
2024-11-12 14:57:17 +03:00
|
|
|
if ($des == 'show'){
|
|
|
|
$smarty->assign('actionResult', $actionResult);
|
|
|
|
$groupName = $this->getGroupNameByID($_GET['id']);
|
|
|
|
$groupName = $groupName[1]['sokr'];
|
|
|
|
$smarty->assign('groupName', $groupName);
|
|
|
|
}
|
2024-11-12 13:08:43 +03:00
|
|
|
$smarty->assign('groups',$groups);
|
|
|
|
$smarty->clearCache('moduls/attendancelog/tpl/main_page.html');
|
|
|
|
$html .= $smarty->fetch('moduls/attendancelog/tpl/main_page.html');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
}
|