Compare commits
30 Commits
main
...
feature/si
Author | SHA1 | Date |
---|---|---|
RomanGolienko | 19c0440622 | |
RomanGolienko | cfb09475b9 | |
RomanGolienko | 3a12559be5 | |
RomanGolienko | 564e8c6bf7 | |
RomanGolienko | b66ca40355 | |
RomanGolienko | 2b3a2083b5 | |
RomanGolienko | 0729d54148 | |
RomanGolienko | 4141009137 | |
RomanGolienko | 2badc08f97 | |
RomanGolienko | 980b761c4b | |
RomanGolienko | b4345c1e55 | |
RomanGolienko | b3ceee1515 | |
RomanGolienko | 46ef2c85fb | |
RomanGolienko | efbe2903cb | |
RomanGolienko | b9336d3ff1 | |
RomanGolienko | 6a646633e9 | |
RomanGolienko | 4c80c47f47 | |
RomanGolienko | 704a52bf9f | |
RomanGolienko | 35f3825633 | |
RomanGolienko | 2881642d7d | |
RomanGolienko | fbb88422d0 | |
RomanGolienko | 10d53cb144 | |
RomanGolienko | 9395a7222b | |
RomanGolienko | 8f011bc0ed | |
RomanGolienko | 34788f5973 | |
RomanGolienko | 1968c77a6f | |
RomanGolienko | c63df969c4 | |
RomanGolienko | 26ee706cb9 | |
RomanGolienko | 79094a385a | |
RomanGolienko | 42efa74025 |
|
@ -6,54 +6,338 @@ class attendancelog {
|
|||
$this->DB = $DB;
|
||||
$this->name = $name;
|
||||
}
|
||||
function getAllGrupps() {
|
||||
$sql_search = 'SELECT id, sokr, fo, kurs FROM acs_grupp ORDER BY `sokr` DESC';
|
||||
public function currentUserInfo(){
|
||||
$currentUserInfo = array();
|
||||
$currentUserInfo['user_id'] = $_SESSION['user']['id'];
|
||||
if(isset($_SESSION['user']['teacher'])) {
|
||||
$currentUserInfo['role'] = 'teacher';
|
||||
$currentUserInfo['teacher_id'] = $_SESSION['user']['teacher']['id'];
|
||||
if(isset($_SESSION['user']['teacher']['fakultet'])){
|
||||
$sql_search = 'SELECT id FROM acs_faculties WHERE name="'. $_SESSION['user']['teacher']['fakultet'] .'"';
|
||||
$tmp = $this->DB->QUR_SEL($sql_search);
|
||||
unset($tmp[0]);
|
||||
$currentUserInfo['facult']['facult_name'] = $_SESSION['user']['teacher']['fakultet'];
|
||||
$currentUserInfo['facult']['facult_id'] = $tmp[1]['id'];
|
||||
$sql_search = 'SELECT id, sokr, fo FROM acs_grupp WHERE id_facult="'.$tmp[1]['id'] .'" AND sokr NOT LIKE "Выпуск%"';
|
||||
$tmp = $this->DB->QUR_SEL($sql_search);
|
||||
unset($tmp[0]);
|
||||
foreach($tmp as $grupp){
|
||||
$currentUserInfo['related_grupps'][$grupp['sokr']] = $grupp ;
|
||||
}
|
||||
|
||||
}
|
||||
return $currentUserInfo;
|
||||
}else if(isset($_SESSION['user']['statuses']['25'])) {
|
||||
$currentUserInfo['role'] = 'secretary';
|
||||
return $currentUserInfo;
|
||||
}else if(isset($_SESSION['user']['student'])) {
|
||||
$currentUserInfo['role'] = 'student';
|
||||
$sql_search = 'SELECT * FROM acs_attendancelog_headmen WHERE user_id='. $currentUserInfo['user_id'] .' ';
|
||||
$rez = $this->DB->QUR_SEL($sql_search);
|
||||
return $rez;
|
||||
if(!isset($rez[1])){
|
||||
return 0;
|
||||
}
|
||||
$currentUserInfo['student_id'] = $_SESSION['user']['student']['id'];
|
||||
$currentUserInfo['grupp_id'] = $_SESSION['user']['student']['grupp']['id'];
|
||||
if(isset($_SESSION['user']['student']['grupp'])){
|
||||
$currentUserInfo['facult']['facult_id'] = $_SESSION['user']['student']['grupp']['id_facult'];
|
||||
$sql_search = 'SELECT name FROM acs_faculties WHERE id='. $currentUserInfo['facult']['facult_id'] .' ';
|
||||
$tmp = $this->DB->QUR_SEL($sql_search);
|
||||
unset($tmp[0]);
|
||||
}
|
||||
return $currentUserInfo;
|
||||
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
function getAllGrupps($facult = '') {
|
||||
if($facult != ''){
|
||||
$sql_search = 'SELECT id, sokr, fo, kurs FROM acs_grupp WHERE fo="ОФО" AND id_facult="'. $facult .'" AND sokr NOT LIKE "Выпуск%" ORDER BY `sokr` DESC';
|
||||
}else{
|
||||
$sql_search = 'SELECT id, sokr, fo, kurs FROM acs_grupp WHERE fo="ОФО" AND sokr NOT LIKE "Выпуск%" ORDER BY `sokr` DESC';
|
||||
}
|
||||
$tmp = $this->DB->QUR_SEL($sql_search);
|
||||
unset($tmp[0]);
|
||||
return $tmp;
|
||||
}
|
||||
function getStudentsByGroup($groupName,$educationForm)
|
||||
{
|
||||
$educationForm = urlencode($educationForm);
|
||||
$groupName = urlencode($groupName);
|
||||
$url = 'https://eios.mkgtu.ru/api.php?des=studentsByGrupp¶m1=' . $groupName . '¶m2=' . $educationForm;
|
||||
$url = 'https://eios.mkgtu.ru/api.php?des=studentsByGrupp¶m1=' . $groupName . '¶m2=' . $educationForm.'¶m3=1';
|
||||
return json_decode(file_get_contents($url),1);
|
||||
}
|
||||
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;
|
||||
}
|
||||
function currentTime() { //возвращает информацию о текущем моменте для пользователя
|
||||
$rez = array();
|
||||
$moment = getdate();
|
||||
$curr_minutes = $moment['hours'] * 60 + $moment['seconds'];
|
||||
$minutes = 480;
|
||||
for($i = 1; $i < 8; $i++) { //возвращает текущую пару в университете
|
||||
if ($curr_minutes >= $minutes-10 AND $curr_minutes <= $minutes + 90){
|
||||
$rez['time1'] = $i;
|
||||
}
|
||||
if ($i == 4){
|
||||
$minutes = $minutes + 110;
|
||||
}else{
|
||||
$minutes = $minutes + 100;
|
||||
}
|
||||
}
|
||||
$week = json_decode(file_get_contents('https://local.mkgtu.ru/raspisnew/api.php?des=raspis_week_cur'),1);
|
||||
$rez['day1'] = $moment['wday'];
|
||||
$rez['mday'] = $moment['mday'];
|
||||
$rez['mon'] = $moment['mon'];
|
||||
$rez['0'] = $moment['0'];
|
||||
$rez['year'] = $moment['year'];
|
||||
$rez['date'] = date("Y-m-d");
|
||||
$rez['week1'] = $week['week_cur'];
|
||||
return $rez;
|
||||
}
|
||||
function getGroupNameByID($id) {
|
||||
$sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' ';
|
||||
$tmp = $this->DB->QUR_SEL($sql_search);
|
||||
return $tmp[1];
|
||||
}
|
||||
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'];
|
||||
}
|
||||
public function predmetsAddEdit($predmet_name){
|
||||
//принимает имя предмета. Делает запись в таблицу предметов, если такой нет. В любом случае возвращает айди предмета
|
||||
$sql_search = 'SELECT id, name FROM acs_attendancelog_predmets WHERE name="'. $predmet_name .'"';
|
||||
$search = $this->DB->QUR_SEL($sql_search);
|
||||
if(isset($search[1])){
|
||||
$search = $search[1];
|
||||
}
|
||||
if(count($search) == 0){
|
||||
$sql_insert = 'INSERT INTO acs_attendancelog_predmets (id, name) VALUES (0,"'. $predmet_name .'")';
|
||||
$rez = $this->DB->QUR($sql_insert);
|
||||
$sql_search = 'SELECT id, name FROM acs_attendancelog_predmets WHERE name="'. $predmet_name .'"';
|
||||
$search = $this->DB->QUR_SEL($sql_search);
|
||||
if(isset($search[1])){
|
||||
$search = $search[1];
|
||||
}
|
||||
}
|
||||
return $search['id'];
|
||||
}
|
||||
public function gruppsSearch($request){
|
||||
if(isset($_POST['all_grupps_search'])){
|
||||
$sql_search = 'SELECT id, sokr, fo, kurs FROM acs_grupp WHERE fo="ОФО" AND sokr NOT LIKE "Выпуск%" AND sokr LIKE "%'. $this->DB->rescape($request) .'%" OR fo LIKE "%'. $this->DB->rescape($request) .'%"';
|
||||
$tmp = $this->DB->QUR_SEL($sql_search);
|
||||
unset($tmp[0]);
|
||||
return $tmp;
|
||||
}
|
||||
}
|
||||
public function AttendanceAddEdit()
|
||||
{
|
||||
if(isset($_POST['attendance_add_edit'])){
|
||||
foreach ($_POST['attendance_add_edit']['attendance'] as $user_id => $student_att){
|
||||
$sql_search = 'SELECT id, appr FROM acs_attendancelog_students_attendance WHERE user_id="'. $user_id .'" AND gruppa="'. $this->DB->rescape($_POST['attendance_add_edit']['info']['gruppa']) .'" AND date1="'. $this->DB->rescape($_POST['attendance_add_edit']['info']['date']) .'" AND time1='. $this->DB->rescape($_POST['attendance_add_edit']['info']['time1']) .' AND predmet_id="'. $this->DB->rescape($_POST['attendance_add_edit']['info']['predmet_id']) .'" ';
|
||||
$search = $this->DB->QUR_SEL($sql_search);
|
||||
if (isset($search[1])){
|
||||
if(0 == $search[1]['appr']){
|
||||
$sql_update = 'UPDATE acs_attendancelog_students_attendance SET att=' . $student_att . ', appr='. $_POST['attendance_add_edit']['info']['approval'] .' WHERE id='. $search[1]['id'] .' ';
|
||||
$rez = $this->DB->QUR($sql_update);
|
||||
}
|
||||
|
||||
}else {
|
||||
$sql_insert = 'INSERT INTO acs_attendancelog_students_attendance (id, user_id, gruppa, date1, att, appr, time1, predmet_id) VALUES (0,"'.$user_id.'", "'. $this->DB->rescape($_POST['attendance_add_edit']['info']['gruppa']) .'", "'. $this->DB->rescape($_POST['attendance_add_edit']['info']['date']) .'", '. $student_att .','. $this->DB->rescape($_POST['attendance_add_edit']['info']['approval']) .', '. $this->DB->rescape($_POST['attendance_add_edit']['info']['time1']) .',"'. $this->DB->rescape($_POST['attendance_add_edit']['info']['predmet_id']) . '")';
|
||||
$rez = $this->DB->QUR($sql_insert);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$rez['date_cur'] = $_POST['attendance_add_edit']['info']['date'];
|
||||
return $rez;
|
||||
}
|
||||
}
|
||||
public function headmanAddDelete(){
|
||||
if(isset($_POST['headman_request'])){
|
||||
$currentUserInfo = $this->currentUserInfo();
|
||||
$current_time = $this->currentTime();
|
||||
$current_group = $this->getGroupNamebyID((int)$_GET['id']);
|
||||
$students = $this->getStudentsByGroup($current_group['sokr'], $current_group['fo']);
|
||||
$sql_search = 'SELECT * FROM acs_attendancelog_headmen WHERE gruppa="'. $current_group['sokr'] .'" ';
|
||||
$rez = $this->DB->QUR_SEL($sql_search);
|
||||
if(isset($rez[1])){
|
||||
$rez = $rez[1];
|
||||
$sql_delete = 'DELETE FROM acs_attendancelog_headmen WHERE gruppa="'. $current_group['sokr'] .'" ';
|
||||
$rez = $this->DB->QUR($sql_delete);
|
||||
}
|
||||
$sql_insert = 'INSERT INTO acs_attendancelog_headmen (id, user_id, gruppa, date_add, added_by) VALUES (0, '. $this->DB->rescape($_POST['headman_request']) .', "'. $current_group['sokr'] .'", "'. $current_time['date'] .'", '. $currentUserInfo['user_id'] .' )';
|
||||
$rez = $this->DB->QUR($sql_insert);
|
||||
return $rez;
|
||||
|
||||
}
|
||||
}
|
||||
function mainPageAction()
|
||||
{
|
||||
$currentUserInfo = $this->currentUserInfo();
|
||||
$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']);
|
||||
$current_group = $this->getGroupNamebyID((int)$_GET['id']);
|
||||
$current_group_classes = $this->getClassesByGroup($current_group['sokr'], $current_group['fo']);
|
||||
$currentTime = $this->currentTime();
|
||||
$out = array();
|
||||
$tmp = $this->getStudentsByGroup($current_group['sokr'], $current_group['fo']);
|
||||
$out['students_all'] = $tmp['students'];
|
||||
if(isset($_POST['date_request'])) {
|
||||
$week_compare = $this->getWeekByDate(strtotime($_POST['date_request']));
|
||||
$day_compare = date('w', strtotime($_POST['date_request']));
|
||||
$db_date = $this->DB->rescape($_POST['date_request']);
|
||||
}else {
|
||||
$week_compare = $currentTime['week1'];
|
||||
$day_compare = $currentTime['day1'];
|
||||
$db_date = $currentTime['date'];
|
||||
}
|
||||
foreach ($current_group_classes['raspis'] as $class) {
|
||||
if ($class['week1'] == $week_compare) {
|
||||
if($class['day1'] == $day_compare){
|
||||
$out['day_name'] = $class['day_name'];
|
||||
$out['day_info'][$class['time1']] = $class;
|
||||
$out['day_info'][$class['time1']]['predmet_id'] = $this->predmetsAddEdit($class['predmet']);
|
||||
$sql_search = 'SELECT appr FROM acs_attendancelog_students_attendance WHERE gruppa="'. $current_group[1]['sokr'] .'" AND date1="'. $db_date .'" AND time1='. $class['time1'] .' AND predmet_id='. $out['day_info'][$class['time1']]['predmet_id'];
|
||||
$search = $this->DB->QUR_SEL($sql_search);
|
||||
if(isset($search[1])){
|
||||
$out['day_info'][$class['time1']]['approval'] = $search[1]['appr'];
|
||||
}
|
||||
foreach ($out['students_all'] as $student_id => $student_name){
|
||||
$out['day_info'][$class['time1']]['students'][$student_id] = '0';
|
||||
$sql_search = 'SELECT user_id, att FROM acs_attendancelog_students_attendance WHERE user_id="'. $student_id .'" AND gruppa="'. $current_group[1]['sokr'] .'" AND date1="'. $db_date .'" AND time1='. $class['time1'] .' AND predmet_id='. $out['day_info'][$class['time1']]['predmet_id'];
|
||||
$search = $this->DB->QUR_SEL($sql_search);
|
||||
if(isset($search[1])){
|
||||
$out['day_info'][$class['time1']]['students'][$student_id] = $search[1]['att'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
function headmanPageAction(){
|
||||
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
|
||||
if($des == 'add_edit'){
|
||||
$out = array();
|
||||
$current_group = $this->getGroupNamebyID((int)$_GET['id']);
|
||||
$students = $this->getStudentsByGroup($current_group['sokr'], $current_group['fo']);
|
||||
$out['current_group'] = $current_group;
|
||||
$sql_search = 'SELECT * FROM acs_attendancelog_headmen WHERE gruppa="'. $current_group['sokr'] .'" ';
|
||||
$rez = $this->DB->QUR_SEL($sql_search);
|
||||
if (isset($rez[1])){
|
||||
$rez = $rez[1];
|
||||
}
|
||||
foreach ($students['students'] as $user_id => $student_name){
|
||||
$out['students'][$user_id]['student_name'] = $student_name;
|
||||
if($rez['user_id'] == $user_id){
|
||||
$out['students'][$user_id]['headman'] = 1;
|
||||
$out['headman'] = $student_name;
|
||||
}else{
|
||||
$out['students'][$user_id]['headman'] = 0;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
function getHeadman($group){
|
||||
$sql_search = 'SELECT * FROM acs_attendancelog_headmen WHERE gruppa="'. $group .'" ';
|
||||
$tmp = $this->DB->QUR_SEL($sql_search);
|
||||
return $tmp[1];
|
||||
}
|
||||
function HTML()
|
||||
{
|
||||
$html = '';
|
||||
$groups = $this->getAllGrupps();
|
||||
$actionResult = $this->mainPageAction();
|
||||
//$html .= '<pre>'. print_r($groups,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($actionResult,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($_GET,1) . '</pre>';
|
||||
GLOBAL $smarty;
|
||||
$html = '';
|
||||
$currentUserInfo = $this->currentUserInfo();
|
||||
$currentTime = $this->currentTime();
|
||||
$AttendanceAddEdit = $this->AttendanceAddEdit();// должен вызываться перед mainPageAction
|
||||
$headmanAddDelete = $this->headmanAddDelete();
|
||||
$mainPageActionResult = $this->mainPageAction();
|
||||
$headmanPageActionResult = $this->headmanPageAction();
|
||||
$predmetsAddEdit = $this->predmetsAddEdit('Исследование операций и методы оптимизации');
|
||||
$gruppsSearch = $this->gruppsSearch($_POST['all_grupps_search']);
|
||||
|
||||
//$html .= '<pre>'. print_r($groups,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($gruppsSearch,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($currentUserInfo,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($mainPageActionResult,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($headmanPageActionResult,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($predmetsAddEdit,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($headmanAddDelete,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($currentTime,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($_SESSION,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($AttendanceAddEdit,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($_GET,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($_POST,1) . '</pre>';
|
||||
//$html .= '<pre>'. print_r($_SESSION,1) . '</pre>';
|
||||
|
||||
$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);
|
||||
$smarty->assign('currentTime', $currentTime);
|
||||
$smarty->assign('currentUserInfo', $currentUserInfo);
|
||||
if($page == 'headman') {
|
||||
$facult_groups = $this->getAllGrupps($currentUserInfo['facult']['facult_id']);
|
||||
foreach ($facult_groups as $key => $group) {
|
||||
$students = $this->getStudentsByGroup($group['sokr'], $group['fo']);
|
||||
$students = $students['students'];
|
||||
$headman = $this->getHeadman($group['sokr']);
|
||||
foreach($students as $user_id => $student_name) {
|
||||
if ($headman['user_id'] == $user_id){
|
||||
$facult_groups[$key]['headman'] = $student_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
$smarty->assign('facult_groups',$facult_groups);
|
||||
$smarty->assign('headmanPageActionResult', $headmanPageActionResult);
|
||||
$smarty->clearCache('moduls/attendancelog/tpl/headman.html');
|
||||
$html .= $smarty->fetch('moduls/attendancelog/tpl/headman.html');
|
||||
|
||||
}
|
||||
if ($page == ''){
|
||||
if($currentUserInfo['role'] == 'student'){
|
||||
$header = "Location: https://eios.mkgtu.ru/modul/attendancelog/main/show/" . $currentUserInfo['grupp_id'] . '/';
|
||||
header($header);
|
||||
}
|
||||
$groups = $this->getAllGrupps();
|
||||
if (isset($currentUserInfo['facult']['facult_id'])){
|
||||
$facult_groups = $this->getAllGrupps($currentUserInfo['facult']['facult_id']);
|
||||
}
|
||||
|
||||
if(isset($_POST['all_grupps_search'])){
|
||||
$groups = $this->gruppsSearch($_POST['all_grupps_search']);
|
||||
}
|
||||
$smarty->assign('groups',$groups);
|
||||
$smarty->assign('facult_groups',$facult_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);
|
||||
if ($des == 'show'){
|
||||
$smarty->assign('AttendanceAddEdit', $AttendanceAddEdit);
|
||||
$smarty->assign('mainPageActionResult', $mainPageActionResult);
|
||||
$groupName = $this->getGroupNameByID((int)$_GET['id']);
|
||||
$groupName = $groupName[1]['sokr'];
|
||||
$smarty->assign('groupName', $groupName);
|
||||
}
|
||||
//$smarty->assign('groups',$groups);
|
||||
$smarty->clearCache('moduls/attendancelog/tpl/main_page.html');
|
||||
$html .= $smarty->fetch('moduls/attendancelog/tpl/main_page.html');
|
||||
|
||||
|
|
6
out.php
6
out.php
|
@ -3,9 +3,13 @@
|
|||
include_once "inc/attendancelog.php";
|
||||
global $DB;
|
||||
if (isset($_SESSION['user']['fio'])){
|
||||
// $class = new attendancelog($DB, $_SESSION['user']['fio']);
|
||||
$class = new attendancelog($DB, $_SESSION['user']['fio']);
|
||||
$dostup = $class->currentUserInfo();
|
||||
if($dostup != 0){
|
||||
$OUT = $class->HTML();
|
||||
}else{
|
||||
$OUT = '<h1>У вас нет доступа к модулю!</h1>';
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
|
113
tpl/headman.html
113
tpl/headman.html
|
@ -7,15 +7,15 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $currentUserInfo.role != 'student'}
|
||||
<div class="row-fluid">
|
||||
<div class="span">
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<ul class="nav ">
|
||||
<li><a href="https://eios.mkgtu.ru/modul/attendancelog/">Главная</a></li>
|
||||
<li class="active" ><a href="https://eios.mkgtu.ru/modul/attendancelog/headman/">Старосты</a></li>
|
||||
<li><a href="/modul/attendancelog/">Главная</a></li>
|
||||
<li class="active" ><a href="/modul/attendancelog/headman/">Старосты</a></li>
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<li><a href="#">{$name}</a></li>
|
||||
|
@ -25,3 +25,110 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $des == 'add_edit'}
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<div class="widget blue">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i> Выбрать группу </h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Группа</th>
|
||||
<th>Староста</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$facult_groups key=key item=group}
|
||||
<tr {if isset($smarty.get.id) AND $group['id'] == $smarty.get.id } style="background-color: #dff0d8;"{/if}>
|
||||
<td><a href="/modul/attendancelog/headman/add_edit/{$group['id']}/"> <h5 class="text-center">{$group.sokr}</h5></a></td>
|
||||
<td> <h5 class="text-center">{if isset($group.headman)}{$group.headman} {else} <span style="color: #9d0202">не назначен !</span> {/if}</h5></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span8">
|
||||
<!-- {if isset($headmanPageActionResult.headman) }-->
|
||||
<!-- <div class="alert alert-info"> <button class="close" data-dismiss="alert">×</button> <h3>Староста уже выбран(а)! - <strong> {$headmanPageActionResult.headman}</strong></h3> </div>-->
|
||||
<!-- {/if}-->
|
||||
<div class="widget blue">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i> Назначить старосту </h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body">
|
||||
<form action="" method="post">
|
||||
<table class="table table-bordered">
|
||||
<caption><h4>{$headmanPageActionResult.current_group.sokr}</h4></caption>
|
||||
<tbody>
|
||||
{foreach from=$headmanPageActionResult.students key=user_id item=info}
|
||||
<tr {if $info.headman == 1} style="color: #48847; background-color: #dff0d8;" {/if}>
|
||||
{if $info.headman == 1}
|
||||
<td><h5><strong> {$info.student_name} - Староста </strong></h5></td>
|
||||
{else}
|
||||
<td> <h5>{$info.student_name} </h5> </td>
|
||||
{/if}
|
||||
<td style="min-width: 30%"><h5><input type="radio" name="headman_request" value="{$user_id}" {if $info.headman == 1} checked {/if}></h5></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="" style="width: 100%; text-align: center; margin-top: 1em;">
|
||||
<button type="submit" class="btn btn-success"> Сделать старостой</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<div class="widget blue">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i> Выбрать группу </h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Группа</th>
|
||||
<th>Староста</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$facult_groups key=key item=group}
|
||||
<tr {if isset($smarty.get.id) AND $group['id'] == $smarty.get.id } style="background-color: #dff0d8;"{/if}>
|
||||
<td><a href="/modul/attendancelog/headman/add_edit/{$group['id']}/"> <h5 class="text-center">{$group.sokr}</h5></a></td>
|
||||
<td> <h5 class="text-center">{if isset($group.headman)}{$group.headman} {else} <span style="color: #9d0202">не назначен !</span> {/if}</h5></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span8">
|
||||
<div class="widget blue">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i> Назначить старосту </h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body">
|
||||
<h2>Выберите группу для назначения старосты в системе! </h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{/if}
|
|
@ -1,4 +1,20 @@
|
|||
<div class="row-fluid">
|
||||
<style>
|
||||
.group_tab{
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px!important;
|
||||
background-color: #f9f9f9;
|
||||
text-align: center;
|
||||
margin: 0.5em;
|
||||
text-decoration: none!important;
|
||||
font-size: 16px;
|
||||
}
|
||||
.group_tab:hover {
|
||||
transition: 0.3s ease-in-out;
|
||||
transform: scale(1.2) ;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="row-fluid">
|
||||
<div class="span">
|
||||
<h3 class="page-title"> Посещаемость </h3>
|
||||
<ul class="breadcrumb">
|
||||
|
@ -6,16 +22,15 @@
|
|||
<li class="active"><a href="/modul/attendancelog/">Посещаемость</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span">
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<ul class="nav ">
|
||||
<li class="active" ><a href="https://eios.mkgtu.ru/modul/attendancelog/">Главная</a></li>
|
||||
<li><a href="https://eios.mkgtu.ru/modul/attendancelog/headman/">Старосты</a></li>
|
||||
<li class="active" ><a href="/modul/attendancelog/">Главная</a></li>
|
||||
{if $currentUserInfo.role != 'student'}<li><a href="/modul/attendancelog/headman/">Старосты</a></li>{/if}
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<li><a href="#">{$name}</a></li>
|
||||
|
@ -24,65 +39,174 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{if $des == 'show'}
|
||||
<a href="https://eios.mkgtu.ru/modul/attendancelog/" role="button" class="btn"> Вернуться </a>
|
||||
{if $currentUserInfo.role != 'student'}
|
||||
<a href="/modul/attendancelog/" role="button" class="btn" style="margin-bottom: 1em;"> Вернуться </a>
|
||||
{/if}
|
||||
<div class="row-fluid">
|
||||
<div class="span9">
|
||||
<div class="span12">
|
||||
<div class="widget blue">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i></h4>
|
||||
<h4><i class="icon-reorder"></i> Посещение группы {$groupName} </h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body">
|
||||
<table class="table table-striped table-bordered">
|
||||
<caption> Посещения группы </caption>
|
||||
</table>
|
||||
<form action="" method="post">
|
||||
<label for="date_request">Выберите дату</label>
|
||||
<input
|
||||
type="date"
|
||||
name="date_request"
|
||||
id="date_request"
|
||||
max="{$currentTime['date']}"
|
||||
{if isset($smarty.post.date_request)}
|
||||
value="{$smarty.post.date_request}"
|
||||
{else}
|
||||
value="{$currentTime.date}"
|
||||
{/if}
|
||||
>
|
||||
<button type="submit" class="btn btn-success"> Найти</button>
|
||||
</form>
|
||||
{if !isset($mainPageActionResult.day_info)}
|
||||
<h3> У группы нет пар в этот день!</h3>
|
||||
{else}
|
||||
<div class="accordion" id="accordion{$key}">
|
||||
<h3 style="width: 100%; text-align: center">
|
||||
({$mainPageActionResult.day_name})
|
||||
{if isset($smarty.post.date_request)}
|
||||
{$smarty.post.date_request}
|
||||
{if $smarty.post.date_request == $currentTime.date }
|
||||
<span class="label label-success"> Сегодня!</span>
|
||||
{/if}
|
||||
{else}
|
||||
{$currentTime.date}
|
||||
<span class="label label-success"> Сегодня!</span>
|
||||
{/if}
|
||||
|
||||
</h3>
|
||||
{foreach from=$mainPageActionResult.day_info key=key item=class}
|
||||
{if $key != 0}
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="vertical-align: middle; text-align: center; width: 5%"><h3 class="text-warning">{$class.time1}</h3></td>
|
||||
<td style="vertical-align: middle; text-align: center; width: 10%"> <h5>{$class.time_name.0} - {$class.time_name.1}</h5></td>
|
||||
<td><div class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
{if $key > $currentTime.time1 AND ! isset($smarty.post.date_request) } <!-- Если эта пара еще не наступила и реквест даты не задан -->
|
||||
<div class="accordion-toggle" style="pointer-events: none;"> {$class.predmet} <span style="color:#730707">- еще не наступил!</span> </div>
|
||||
{else if $key > $currentTime.time1 AND $smarty.post.date_request == $currentTime.date}
|
||||
<a class="accordion-toggle {if $key != $currentTime.time1 || $class.approval == 1 } collapsed {/if}" data-toggle="collapse" data-parent="#accordion{$day.day1}" href="#collapse_{$class.day1}-{$class.time1}">
|
||||
{$class.predmet} {if $class.approval == 1} <span style="text-decoration: unset; color:#730707" >- отмечено!</span> {/if}
|
||||
</a>
|
||||
{else}
|
||||
<a class="accordion-toggle {if $key != $currentTime.time1 || $class.approval == 1 } collapsed {/if}" data-toggle="collapse" data-parent="#accordion{$day.day1}" href="#collapse_{$class.day1}-{$class.time1}">
|
||||
{$class.predmet} {if $class.approval == 1} <span style="text-decoration: unset; color:#730707" >- отмечено!</span> {/if}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span9">
|
||||
<div class="widget blue">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i></h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body">
|
||||
<table class="table table-striped table-bordered">
|
||||
<caption> Студенты группы </caption>
|
||||
<div id="collapse_{$class.day1}-{$class.time1}" class="accordion-body collapse {if $key == $currentTime.time1 AND $class.approval != 1 } in {/if}">
|
||||
<div class="accordion-inner">
|
||||
<form action="" method="post">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Номер</th>
|
||||
<th>Имя</th>
|
||||
<th>ФИО</th>
|
||||
<th>Присутствие</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$actionResult['students'] key=key item=name}
|
||||
{foreach from=$class.students key=student_id item=att}
|
||||
<tr>
|
||||
<td>{$key +1 }</td>
|
||||
<td>{$name}</td>
|
||||
<td>{$mainPageActionResult.students_all[$student_id]}</td>
|
||||
<td>
|
||||
<input type="hidden" name="attendance_add_edit[attendance][{$student_id}]" value="0">
|
||||
|
||||
<label for="{$student|replace:' ':''}{$key}"></label>
|
||||
<input class="custom-checkbox" type="checkbox" name="attendance_add_edit[attendance][{$student_id}]" id="{$student|replace:' ':''}{$key}" value="1" {if $att == '1'} checked {/if} {if $class.approval == 1 OR $smarty.post.date_request != $currentTime.date } disabled {/if}>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="attendance_add_edit[info][time1]" value="{$class.time1}">
|
||||
<input type="hidden" name="attendance_add_edit[info][predmet_id]" value="{$class.predmet_id}">
|
||||
<input type="hidden" name="attendance_add_edit[info][gruppa]" value="{$groupName}">
|
||||
{if isset($smarty.post.date_request)}
|
||||
<input type="hidden" name="attendance_add_edit[info][date]" value="{$smarty.post.date_request}">
|
||||
{else}
|
||||
<input type="hidden" name="attendance_add_edit[info][date]" value="{$currentTime.date}">
|
||||
{/if}
|
||||
<input type="hidden" name="date_request" value="{$smarty.post.date_request}">
|
||||
<input type="hidden" name="attendance_add_edit[info][approval]" value="0">
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<button type="submit" class="btn btn-success" {if $class.approval == 1 OR $smarty.post.date_request != $currentTime.date} disabled {/if}>Сохранить</button>
|
||||
</div>
|
||||
{if $currentUserInfo.role != 'student'}
|
||||
<div class="span2">
|
||||
<button type="submit" class="btn btn-danger" id="final_button" name="attendance_add_edit[info][approval]" value="1" {if $class.approval == 1 OR $smarty.post.date_request != $currentTime.date} disabled {/if}> Закрыть </button>
|
||||
<label for="final_button" style="color:#730707; pointer-events: none;"> Проставить посещаемость и закрыть возможность для редактирования. Действие необратимо!</label>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{else}
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
<div class="span6">
|
||||
<div class="widget yellow">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i>Группы моего факультета </h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body" style="height: 40em; overflow-y:auto;">
|
||||
<div class="" style="width:100%; text-align: center"> <h4>{$currentUserInfo.facult.facult_name}</h4> </div>
|
||||
|
||||
{foreach from=$facult_groups key=key item=group}
|
||||
<a class="span2 group_tab " href="/modul/attendancelog/main/show/{$group['id']}/">{$group.sokr}</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="widget red">
|
||||
<div class="widget-title">
|
||||
<h4><i class="icon-reorder"></i> Все группы</h4>
|
||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||
</div>
|
||||
<div class="widget-body" style="height: 40em; overflow:scroll; overflow-x:hidden;">
|
||||
<div class="search-wrap">
|
||||
<form method="POST" class="hidden-phone">
|
||||
<div class="input-append search-input-area">
|
||||
<label for="appendedInputButton"> <small>поиск по названию и форме обучения</small> </label>
|
||||
<input class="" id="appendedInputButton" name="all_grupps_search" value="{$smarty.post.all_grupps_search}" type="text">
|
||||
<button class="btn" type="submit" ><i class="icon-search"></i> </button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<table class="table table-striped table-bordered">
|
||||
<caption><h4>Выберите группу для просмотра</h4> </caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
|
@ -92,18 +216,17 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$groups key=key item=group}
|
||||
{if $key != 0}
|
||||
<tr>
|
||||
<td><a href="https://eios.mkgtu.ru/modul/attendancelog/main/show/{$group['id']}/">{$group['sokr']}</a></td>
|
||||
<td><a href="/modul/attendancelog/main/show/{$group['id']}/">{$group.sokr}</a></td>
|
||||
<td>{$group['fo']}</td>
|
||||
<td>{$group['kurs']}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/if}
|
Loading…
Reference in New Issue