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); } function mainPageAction() { $des = ''; if(isset($_GET['des'])) $des = $_GET['des']; if ($des == 'show'){ //получаем список студентов по группе $sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $_GET['id'] .' '; $current_group = $this->DB->QUR_SEL($sql_search); return $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']); } } function HTML() { $html = ''; $groups = $this->getAllGrupps(); $actionResult = $this->mainPageAction(); //$html .= '
'. print_r($groups,1) . '
'; //$html .= '
'. print_r($actionResult,1) . '
'; //$html .= '
'. print_r($_GET,1) . '
'; 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'){ $smarty->assign('actionResult', $actionResult); $smarty->assign('groups',$groups); $smarty->clearCache('moduls/attendancelog/tpl/main_page.html'); $html .= $smarty->fetch('moduls/attendancelog/tpl/main_page.html'); } return $html; } }