Skip to content
Snippets Groups Projects
Commit d7174f79 authored by Anton's avatar Anton
Browse files

bag fix in change discipline

parent da2b5e93
No related merge requests found
......@@ -13,34 +13,6 @@ class Controller_Handler_Map extends Controller_Handler {
return $result[0]['Num'];
}
// Добавление преподавателем дисциплины
public function action_AddDiscipline() {
$data['success'] = false;
$this->post -> rule('Grade', 'not_empty')
-> rule('Grade', 'digit')
-> rule('SubjectID', 'not_empty')
-> rule('SubjectID', 'digit')
-> rule('ExamType', 'not_empty')
-> rule('LectionCount', 'not_empty')
-> rule('LectionCount', 'digit')
-> rule('PracticeCount', 'not_empty')
-> rule('PracticeCount', 'digit');
if($this->post->check()) {
$result = $this->model->AddDiscipline(
$this->user['TeacherID'],
$this->post->offsetGet('Grade'),
$this->post->offsetGet('SubjectID'),
$this->post->offsetGet('ExamType'),
$this->post->offsetGet('LectionCount'),
$this->post->offsetGet('PracticeCount')
);
$data['DisciplineID'] = $result[0]['Num'];
if ($data['DisciplineID'] > 0)
$data['success'] = true;
}
$this->response->body(json_encode($data));
}
// Изменения базовых параметров дисциплины
public function action_ChangeDiscipline() {
$data['success'] = false;
......@@ -71,35 +43,6 @@ class Controller_Handler_Map extends Controller_Handler {
$this->response->body(json_encode($data));
}
public function action_AddMap() {
$json = $this->post->offsetGet('data');
$json = json_decode($json, true);
for ($i = 0; $i < $json['modulesCount']; $i++) {
$query = $this->model->addModule(
$this->user['TeacherID'],
$json['DisciplineID'],
$i + 1,
$json[$i]['moduleName']
);
$ModuleID = $query[0]['Num'];
for ($j = 0; $j < $json[$i]['subModules']['subModulesCount']; $j++) {
$this->model->addSubmodule(
$this->user['TeacherID'],
$ModuleID,
$json[$i]['subModules'][$j]['maxRate'],
$j + 1,
$json[$i]['subModules'][$j]['subModuleName'],
'description',
$json[$i]['subModules'][$j]['typeControl']
);
}
}
}
// Добавить модуль и к модулю 1 мероприятие
public function action_AddModule(){
$data['success'] = false;
......
......@@ -87,7 +87,7 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
$this->response->body($twig);
}
private function getMapInfo($map) {
$mapHandled = array();
......@@ -123,7 +123,7 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
}
$mapHandled['ModulesCount'] = $i;
$mapHandled['MaxRate'] = (int) $maxRate;
return $mapHandled;
}
......@@ -148,7 +148,7 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
//{
// $subject['Control'] = 'Зачет';
//}
$subject['Control'] = $info['ExamType'];
$subject['ExamType'] = $info['ExamType'];
$subject['LectureHours'] = $info['LectionCount'];
$subject['PracticeHours'] = $info['PracticeCount'];
......
......@@ -31,14 +31,14 @@
</div>
<div class="section">
Контроль:
<input name="ExamType" type="radio" value="exam"> Экзамен
<input name="ExamType" type="radio" value="credit"> Зачет
<input name="ExamType" type="radio" value="exam" {% if Discipline.ExamType == 'exam' %}checked{% endif %}> Экзамен
<input name="ExamType" type="radio" value="credit" {% if Discipline.ExamType == 'credit' %}checked{% endif %}> Зачет
</div>
<div class="section">
<div class="item title">Лекционных часов:</div>
<div class="item"><input class="inputLectionCount" style="width: 50px;" value="{{ Subject.LectureHours }}"></div>
<div class="item"><input class="inputLectionCount" style="width: 50px;" value="{{ Discipline.LectureHours }}"></div>
<div class="item title">Практических часов:</div>
<div class="item"><input class="inputPracticeCount" style="width: 50px;" value="{{ Subject.PracticeHours }}"></div>
<div class="item"><input class="inputPracticeCount" style="width: 50px;" value="{{ Discipline.PracticeHours }}"></div>
</div>
<button class="ChangeDiscipline">Сохранить</button>
</div>
......
......@@ -103,7 +103,7 @@ $(function() {
}
// Установить новый max балл
function SetNewRate(thisObj, OldMaxRate) {
function SetNewRateAndControl(thisObj, OldMaxRate) {
// DIV с мероприятиями для данного модуля
var subModulesDiv = thisObj.parent().parent().parent();
// ID мероприятия
......@@ -168,15 +168,22 @@ $(function() {
);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
// Изменения базовых параметров дисциплины
$(".ChangeDiscipline").click(function(){
//alert(DisciplineID);
//alert($('.Grade').val());
//alert($('input:radio[name=ExamType]:checked').val());
//alert($('.inputLectionCount').val());
//alert($('.inputPracticeCount').val());
$.post(
'/~dev_rating/handler/map/ChangeDiscipline',
{
'DisciplineID': DisciplineID,
'Grade': $('.Grade').val(),
'SubjectID': $('.subject').val(),
'ExamType': $('.ExamType').val(),
'SubjectID': $('.SelectSubject').val(),
'ExamType': $('input:radio[name=ExamType]:checked').val(),
'LectionCount': $('.inputLectionCount').val(),
'PracticeCount': $('.inputPracticeCount').val()
},
......@@ -389,7 +396,7 @@ $(function() {
});
// При потери фокуса
$('.moduleList').on('focusout', '.inputCurrentControl', function(){
SetNewRate($(this), OldMaxRate);
SetNewRateAndControl($(this), OldMaxRate);
});
// При записи в input рубежный контроль
......@@ -400,7 +407,7 @@ $(function() {
});
// При потери фокуса
$('.moduleList').on('focusout', '.inputLandmarkControl', function(){
SetNewRate($(this), OldMaxRate);
SetNewRateAndControl($(this), OldMaxRate);
});
// В inputCredit (где баллы вводить) разрешаем вводить только цифры
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment