Добавлена возможность закрытия преподавателем редактирования посещаемости
This commit is contained in:
parent
3a12559be5
commit
cfb09475b9
|
@ -145,13 +145,16 @@ class attendancelog {
|
|||
{
|
||||
if(isset($_POST['attendance_add_edit'])){
|
||||
foreach ($_POST['attendance_add_edit']['attendance'] as $user_id => $student_att){
|
||||
$sql_search = 'SELECT id 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']) .'" ';
|
||||
$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])){
|
||||
$sql_update = 'UPDATE acs_attendancelog_students_attendance SET att=' . $student_att . ' WHERE id='. $search[1]['id'] .' ';
|
||||
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, 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']['time1']) .',"'. $this->DB->rescape($_POST['attendance_add_edit']['info']['predmet_id']) . '")';
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@ -206,10 +209,14 @@ class attendancelog {
|
|||
$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'];
|
||||
//$out['day_info'][$class['time1']]['search'] = $sql_search;
|
||||
$search = $this->DB->QUR_SEL($sql_search);
|
||||
if(isset($search[1])){
|
||||
$out['day_info'][$class['time1']]['students'][$student_id] = $search[1]['att'];
|
||||
|
|
|
@ -93,11 +93,11 @@
|
|||
<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">
|
||||
<a class="accordion-toggle {if $key != $currentTime.time1 } collapsed {/if}" data-toggle="collapse" data-parent="#accordion{$day.day1}" href="#collapse_{$class.day1}-{$class.time1}">
|
||||
{$class.predmet}
|
||||
<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>
|
||||
</div>
|
||||
<div id="collapse_{$class.day1}-{$class.time1}" class="accordion-body collapse {if $key == $currentTime.time1 } in {/if}">
|
||||
<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">
|
||||
|
@ -115,7 +115,7 @@
|
|||
<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}>
|
||||
<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} disabled {/if}>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -131,13 +131,25 @@
|
|||
<input type="hidden" name="attendance_add_edit[info][date]" value="{$currentTime.date}">
|
||||
{/if}
|
||||
<input type="hidden" name="date_request" value="{$smarty.post.date_request}">
|
||||
<button type="submit" class="btn btn-success">Сохранить</button>
|
||||
<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} 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} disabled {/if}> Закрыть </button>
|
||||
<label for="final_button" style="color:#730707; pointer-events: none;"> Проставить посещаемость и закрыть возможность для редактирования. Действие необратимо!</label>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div></td>
|
||||
<!-- <td style="width: 20%"> <h5> - {$class.fio}</h5></td>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
|
|
Loading…
Reference in New Issue