Skip to content
Snippets Groups Projects
Commit e7483549 authored by RomanSteinberg's avatar RomanSteinberg
Browse files

ADD: download exam final form in dean office

parent 6d1cbe47
Branches
Tags
No related merge requests found
......@@ -4089,27 +4089,30 @@ END //
-- WHERE students.StudyGroupID = StudyGroupID;
-- END //
DROP PROCEDURE IF EXISTS GetDisciplinesForGroup//
CREATE PROCEDURE `GetDisciplinesForGroup` ( IN `GroupID` INT
)
NO SQL
BEGIN
SELECT disciplines_groups.DisciplineID
SELECT disciplines_groups.DisciplineID As DisciplineID,
subjects.Name As SubjectName,
disciplines.ExamType As ExamType
FROM `disciplines_groups`
INNER JOIN `disciplines` ON disciplines.ID = disciplines_groups.DisciplineID
INNER JOIN `subjects` ON subjects.ID = disciplines.SubjectID
WHERE disciplines_groups.StudyGroupID = GroupID
UNION DISTINCT
SELECT disciplines_students.DisciplineID
SELECT disciplines_students.DisciplineID As DisciplineID,
subjects.Name As SubjectName,
disciplines.ExamType As ExamType
FROM `disciplines_students`
INNER JOIN `students` ON disciplines_students.StudentID = students.ID
INNER JOIN `disciplines` ON disciplines.ID = disciplines_students.DisciplineID
INNER JOIN `subjects` ON subjects.ID = disciplines.SubjectID
WHERE students.StudyGroupID = GroupID;
END //
DROP PROCEDURE IF EXISTS GetRatesForStudentsGroup//
CREATE PROCEDURE `GetRatesForStudentsGroup` ( IN `TeacherID` INT,
IN `DisciplineID` INT,
......
......@@ -24,4 +24,19 @@ class Controller_Handler_GetData extends Controller_Handler
$this->response->body(json_encode($data));
}
// Получить список групп по ID курса
public function action_GetDisciplinesForGroup()
{
$data['success'] = false;
$this->post -> rule('GroupID', 'not_empty')
-> rule('GroupID', 'digit');
if($this->post->check()) {
$data['data'] = DataArray::factory('Disciplines')->forGroup(
$this->post->offsetGet('GroupID'))->asArray();
$data['success'] = true;
}
$this->response->body(json_encode($data));
}
}
\ No newline at end of file
......@@ -6,6 +6,23 @@ class DataArr_Disciplines {
public function __construct() {
$this->model = new Model_DataArr_Disciplines;
}
public function forGroup($GroupID) {
$teacherModel = new Model_Teacher_Rating;
$Disciplines = $teacherModel->getDisciplinesForGroup($GroupID);
$DisciplinesHandled = array();
$i = 0;
foreach($Disciplines as $row) {
$i++;
$DisciplinesHandled[$i]['DisciplineID'] = $row['DisciplineID'];
$DisciplinesHandled[$i]['SubjectName'] = $row['SubjectName'];
$DisciplinesHandled[$i]['ExamType'] = $row['ExamType'];
}
return new DataArray_Result($DisciplinesHandled);
}
// TODO: Методы для получения списка дисциплин
}
\ No newline at end of file
......@@ -11,17 +11,17 @@
{% block main_top_title %}Деканат > Ведомости{% endblock %}
{% block main_content %}
<div style="text-align: center">
<div data-role="page" id="dean_office" style="text-align: center">
<p><b>Шаг 1. Выберите форму аттестации</b></p>
<div class="LayerSection">
<div class="itemBlock">
<div class="title">Форма контроля:</div>
<div class="field">
<div class="ExamTypeDiv">
<input id="ExamType" name="ExamType" type="radio" value="exam"> Экзамен
<input id="ExamChoice" name="DisciplineType" type="radio" value="exam"> Экзамен
</div>
<div class="ExamTypeDiv">
<input id="ExamType" name="ExamType" type="radio" value="credit" checked> Зачет
<input id="CreditChoice" name="DisciplineType" type="radio" value="credit" checked> Зачет
</div>
</div>
</div>
......@@ -55,18 +55,13 @@
<button class="default_BlueButton" id="DownloadStatement" disabled>Скачать</button>
</div>
<p><b>Шаг 4. Дисциплина</b></p>
<div class="LayerSection">
<div class="LayerSection" id="DisciplineSelect" >
<p><b>Шаг 4. Дисциплина</b></p>
<div class="itemBlock">
<div class="title">Курс:</div>
<div class="title">Дисциплина:</div>
<div class="field">
<select class="SelectDiscipline default_select" id="SelectDiscipline">
<option>-Не выбран-</option>
{#
{% for Discipline in DisciplinesList %}
<option value="{{ Discipline.ID }}" >{{ Discipline.SubjectName }}</option>
{% endfor %}
#}
<select class="SelectDiscipline default_select" id="SelectDiscipline" disabled>
<option>-Не выбрана-</option>
</select>
</div>
</div>
......
var $ = jQuery;
function controlVisualization() {
var disciplineType = $("input[name=DisciplineType]:checked").val();
if (disciplineType === 'exam') {
$("#DisciplineSelect").show();
$("#DownloadStatement").hide();
} else if (disciplineType === 'credit') {
$("#DisciplineSelect").hide();
$("#DownloadStatement").show();
}
}
$(function() {
// on page loaded
controlVisualization();
var jDownloadStatement = $("#DownloadStatement");
var jDownloadExamDocument = $("#DownloadExamDocument");
$("#ExamChoice").change(controlVisualization);
$("#CreditChoice").change(controlVisualization);
//Получить список групп по ID курса
$("#SelectGrade").change(function() {
var gradeID = parseInt($(this).val()) || 0;
var jSelectGroup = $("#SelectGroup");
if (gradeID > 0)
{
if (gradeID > 0) {
$.post(
g_URLdir + "handler/GetData/GetGroups",
{
......@@ -42,19 +60,52 @@ $(function() {
$("#SelectGroup").change(function() {
var groupID = parseInt($(this).val()) || 0;
if (groupID > 0)
jDownloadStatement.removeAttr("disabled");
if (groupID > 0) {
jDownloadStatement.removeAttr("disabled");
// Заполнить список дисциплин
var jSelectDiscipline = $("#SelectDiscipline");
$.post(
g_URLdir + "handler/GetData/GetDisciplinesForGroup",
{
"GroupID": groupID
},
function (d) {
d = $.parseJSON(d);
if (d.success === true) {
console.log(d.data);
var i = 0;
jSelectDiscipline.html("<option>-Не выбрана-</option>");
for (i in d.data) {
discipline = d.data[i];
if (discipline.ExamType !== 'exam')
continue;
jSelectDiscipline.append("<option value='" + discipline.DisciplineID + "'>" + discipline.SubjectName + "</option>");
}
if (i > 0)
jSelectDiscipline.removeAttr("disabled");
}
}
);
}
else jDownloadStatement.attr("disabled", "disabled");
});
$("#SelectDiscipline").change(function() {
var disciplineID = parseInt($(this).val()) || 0;
if (disciplineID > 0)
jDownloadExamDocument.removeAttr("disabled");
else jDownloadExamDocument.attr("disabled", "disabled");
});
// Скачать ведомость
$('body').on('click', '#DownloadStatement', function(){
$.fileDownload( g_URLdir + 'handler/FileCreator/GenerateFinalFormsForGroup', {
httpMethod: "POST",
data:
{
"GroupID": parseInt($("#SelectGroup").val()),
"ExamType": $("#ExamType:checked").val()
"GroupID": parseInt($("#SelectGroup").val())//,
//"ExamType": $("input[name=DisciplineType]:checked").val()
},
successCallback: function () {
......@@ -71,8 +122,8 @@ $(function() {
httpMethod: "POST",
data:
{
"GroupID": parseInt($("#SelectGroup").val()),
"ExamType": $("#ExamType:checked").val()
"disciplineID": parseInt($("#SelectDiscipline").val()),
"studyGroupID": parseInt($("#SelectGroup").val())
},
successCallback: function () {
......@@ -87,4 +138,5 @@ $(function() {
// Печать ведомости и блокирование дисциплины
});
\ No newline at end of file
});
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