Skip to content
Snippets Groups Projects
Commit 2b4bef2d authored by PavelBegunkov's avatar PavelBegunkov
Browse files

FIX: exam page

parent bf944590
Branches
Tags
No related merge requests found
<?php defined('SYSPATH') or die('No direct script access.'); <?php defined('SYSPATH') or die('No direct script access.');
class Controller_Teacher_Rating extends Controller_UserEnvi { class Controller_Teacher_Rating extends Controller_UserEnvi {
protected $model_rating;
public function before() { public function before() {
Cookie::set('fD', 'true'); // Ставим кук fD, чтоб иметь возможность скачать отчет TODO Cookie::set('fD', 'true'); // Ставим кук fD, чтоб иметь возможность скачать отчет TODO
...@@ -112,7 +113,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -112,7 +113,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
return $out; return $out;
} }
private function getRatesForRatingPage($info) private function getRatesForRatingPage($info)
{ {
$rates = array(); $rates = array();
...@@ -219,15 +220,15 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -219,15 +220,15 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$rowIndex++; $rowIndex++;
} }
$total = $this->model_rating->GetStudentRate($curStudent['ID'], $disciplineID); // $total = $this->model_rating->GetStudentRate($curStudent['ID'], $disciplineID);
$total = ($total[0])?$total[0]['Num']:0; // $total = ($total[0])?$total[0]['Num']:0;
if ($total) // if ($total)
$total = 0; // $total = 0;
$curStudent['RateResult'] = $curStudent['RateSemesterResult'] + $rateExtra;
if ($lastExam >= 0) { if ($lastExam >= 0) {
$curStudent['RateResult'] += $curStudent['Rates'][$lastExam]['Rate']; $curStudent['RateResult'] += $curStudent['Rates'][$lastExam]['Rate'];
} }
$curStudent['RateResult'] = $total;
$this->correctExtra($curStudent, $examType, $lastExtraIndex, $firstEmptyExtra, $rateExtra); $this->correctExtra($curStudent, $examType, $lastExtraIndex, $firstEmptyExtra, $rateExtra);
} }
...@@ -283,7 +284,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -283,7 +284,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$i_s++; $i_s++;
} }
$editRights=$this->get_edit_rights_for_teacher($this->UserInfo['TeacherID']=id, $disciplineInfo['ID']); $editRights=$this->get_edit_rights_for_teacher($this->UserInfo['TeacherID'], $disciplineInfo['ID']);
if($editRights == 1) if($editRights == 1)
$twig->editRights=$editRights; $twig->editRights=$editRights;
else else
...@@ -297,7 +298,6 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -297,7 +298,6 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$twig->disciplineInfo = $disciplineInfo; $twig->disciplineInfo = $disciplineInfo;
$twig->disciplineInfo_JSON = json_encode($twig->disciplineInfo); $twig->disciplineInfo_JSON = json_encode($twig->disciplineInfo);
$this->response->body($twig); $this->response->body($twig);
} }
......
...@@ -47,8 +47,9 @@ ...@@ -47,8 +47,9 @@
{{ headerRate[i].ModuleTitle }} {{ headerRate[i].ModuleTitle }}
</td> </td>
{% endfor %} {% endfor %}
{% if disciplineInfo.isBonus == false %}
<td class="subject" rowspan="3">Бонус</td> <td class="subject" rowspan="3">Бонус</td>
{% endif %}
<td class="subject" rowspan="3">Итог</td> <td class="subject" rowspan="3">Итог</td>
</tr> </tr>
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
{% for j in 1..headerRate[i].SubmodulesCount if headerRate[i].ModuleType != 'extra' %} {% for j in 1..headerRate[i].SubmodulesCount if headerRate[i].ModuleType != 'extra' %}
{% set col = col + 1 %} {% set col = col + 1 %}
{% set colSpan = colSpanGeneral %} {% set colSpan = colSpanGeneral %}
{% if j == 1 %}{% set colSpan = colSpan+1 %}{% endif %} {% if j == 1 and i==1 %}{% set colSpan = colSpan+1 %}{% endif %}
<td class="subject col_{{ col }}" colspan="{{colSpan}}"> {{ headerRate[i][j].Title }} </td> <td class="subject col_{{ col }}" colspan="{{colSpan}}"> {{ headerRate[i][j].Title }} </td>
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
<tr class="RatingTableSubmodulesHeadMaxRate"> <tr class="RatingTableSubmodulesHeadMaxRate">
{% set columnsCount = 4 %} {# студенты, итог за семестр, бонусы, итог #} {% set columnsCount = 4 %} {# студенты, итог за семестр, бонусы, итог #}
{% set col = 1 %} {% set col = 0 %}
<td class="title">Макс. балл</td> <td class="title">Макс. балл</td>
{% for i in 1..headerRate.ModulesCount %} {% for i in 1..headerRate.ModulesCount %}
{% set columnsCount = columnsCount + headerRate[i].SubmodulesCount %} {% set columnsCount = columnsCount + headerRate[i].SubmodulesCount %}
...@@ -87,7 +88,7 @@ ...@@ -87,7 +88,7 @@
Неявка Неявка
</td> </td>
{% if j == 1 %} {% if j == 1 and i == 1 %}
{% set columnsCount = columnsCount + 1 %} {% set columnsCount = columnsCount + 1 %}
<td class="subject col_autopass_{{ col }}"> <td class="subject col_autopass_{{ col }}">
Автомат Автомат
...@@ -99,8 +100,8 @@ ...@@ -99,8 +100,8 @@
</tr> </tr>
<tr class="RatingTableSubmodulesInfo"> <tr class="RatingTableSubmodulesInfo">
<td class="info"/> <td class="info"></td>
<td class="info"/> <td class="info"></td>
{% set col = 0 %} {% set col = 0 %}
{% for i in 1..headerRate.ModulesCount %} {% for i in 1..headerRate.ModulesCount %}
...@@ -108,18 +109,18 @@ ...@@ -108,18 +109,18 @@
{% if headerRate[i].ModuleType == 'exam' %}{% set examModule = true %}{% endif %} {% if headerRate[i].ModuleType == 'exam' %}{% set examModule = true %}{% endif %}
{% for j in 1..headerRate[i].SubmodulesCount %} {% for j in 1..headerRate[i].SubmodulesCount %}
{% set col = col + 1 %} {% set col = col + 1 %}
<td class="info col_{{ col }}" id="{{ headerRate[i][j].SubmoduleID }}"/> <td class="info col_{{ col }}" id="{{ headerRate[i][j].SubmoduleID }}"></td>
{% if examModule %} {% if examModule %}
<td class="info col_absence_{{ col }}" id="absence_{{ headerRate[i][j].SubmoduleID }}"/> <td class="info col_absence_{{ col }}" id="absence_{{ headerRate[i][j].SubmoduleID }}"></td>
{% if j == 1 %} {% if j == 1 %}
<td class="info col_autopass_{{ col }}" id="autopass_{{ headerRate[i][j].SubmoduleID }}"/> <td class="info col_autopass_{{ col }}" id="autopass_{{ headerRate[i][j].SubmoduleID }}"></td>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
<td class="info"/> <td class="info"></td>
<td class="info"/> <td class="info"></td>
</tr> </tr>
{% set row = 0 %} {% set row = 0 %}
...@@ -133,14 +134,14 @@ ...@@ -133,14 +134,14 @@
{% for student in group.Students %} {% for student in group.Students %}
{% set row = row + 1 %} {% set row = row + 1 %}
{% set col = 0 %} {% set col = 1 %}
<tr id="row_{{ row }}" class="group_{{ group.GroupID }}"> <tr id="row_{{ row }}" class="group_{{ group.GroupID }}">
<td id="student_{{ student.ID }}" class="studentCell staticCell">{{ student.Last }} {{ student.First }}</td> <td id="student_{{ student.ID }}" class="studentCell staticCell">{{ student.Last }} {{ student.First }}</td>
<td class="semesterRateResultCell staticCell">{{ student.RateSemesterResult }}</td> <td class="semesterRateResultCell staticCell">{{ student.RateSemesterResult }}</td>
{% set autoPassNotAdded = true %} {% set autoPassNotAdded = true %}
{% for r in student.Rates %} {% for r in student.Rates %}
{% set col = col + 1 %}
{% if r.ModuleType == 'exam' %} {% if r.ModuleType == 'exam' %}
{% set td_class = 'attemptCell' %} {% set td_class = 'attemptCell' %}
...@@ -169,6 +170,7 @@ ...@@ -169,6 +170,7 @@
{% endif %} {% endif %}
{% if r.ModuleType == 'exam' %} {% if r.ModuleType == 'exam' %}
{% set col = col + 1 %}
<td class="absenceCell {{ td_class }}" id="absence_{{col}}_{{row}}"> <td class="absenceCell {{ td_class }}" id="absence_{{col}}_{{row}}">
<input type="checkbox" class="absenceCheck"> <input type="checkbox" class="absenceCheck">
</td> </td>
...@@ -183,7 +185,7 @@ ...@@ -183,7 +185,7 @@
{% endfor %} {% endfor %}
<td class="bonus staticCell">{{ student.Bonus }}</td> <td class="bonus staticCell" colspan="2">{% if student.Bonus is null %}0{% else %}{{ student.Bonus }}{% endif %} </td>
<td class="rateResultCell staticCell">{% if student.RateResult > 100 %} 100+ {% else %} {{ student.RateResult }} {% endif %}</td> <td class="rateResultCell staticCell">{% if student.RateResult > 100 %} 100+ {% else %} {{ student.RateResult }} {% endif %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
......
...@@ -134,17 +134,19 @@ $(function() { ...@@ -134,17 +134,19 @@ $(function() {
function TdInfo(jThis) { function TdInfo(jThis) {
var disciplineType = json_settings.ExamType; var disciplineType = json_settings.ExamType;
var disciplinePassRate = 60; // credit pass rate var disciplinePassRate = 60; // credit pass rate
if (disciplineType == "exam") if (disciplineType === "exam")
disciplinePassRate = 38; disciplinePassRate = 38;
// Получаем подмодуль // Получаем подмодуль
g_submoduleID = parseInt($(".RatingTableSubmodulesInfo .col_"+g_col+":first").attr("id")); var jCurSubmoduleInfo = $(".RatingTableSubmodulesInfo .col_"+g_col+":first");
g_submoduleTitle = $(".RatingTableSubmodulesHead .col_"+g_col+":first").text(); var jCurSubmoduleHead = $(".RatingTableSubmodulesHead .col_"+g_col+":first");
if ($(".RatingTableSubmodulesHead .col_"+g_col+":first").length < 1 && $(".RatingTableModulesHead .bonus").length > 0 )
g_submoduleID = parseInt(jCurSubmoduleInfo.attr("id"));
g_submoduleTitle = jCurSubmoduleHead.text();
if (jCurSubmoduleHead.length < 1 && $(".RatingTableModulesHead .bonus").length > 0 )
g_submoduleTitle = 'Бонусные баллы'; g_submoduleTitle = 'Бонусные баллы';
g_submoduleMaxRate = parseInt($(".RatingTableSubmodulesHeadMaxRate .col_"+g_col).text()); g_submoduleMaxRate = parseInt($(".RatingTableSubmodulesHeadMaxRate .col_"+g_col).text());
//console.log(g_col.toString() + " " + g_submoduleMaxRate.toString() + " " + g_submoduleID.toString());
// Проверяем допустимое значение (только для добора) // Проверяем допустимое значение (только для добора)
if (jThis.attr("class").indexOf("additionalCell") >= 0) if (jThis.attr("class").indexOf("additionalCell") >= 0)
...@@ -190,7 +192,7 @@ $(function() { ...@@ -190,7 +192,7 @@ $(function() {
var rateResult = newRate; var rateResult = newRate;
// считаем баллы по строке // считаем баллы по строке
if ($("#pageType").val() == "exam") //(jThis.attr("class").indexOf("attemptCell") >= 0) if ($("#pageType").val() === "exam") //(jThis.attr("class").indexOf("attemptCell") >= 0)
{ {
// страница сессии // страница сессии
rateResult += parseInt(jThis.siblings(".semesterRateResultCell").text()); rateResult += parseInt(jThis.siblings(".semesterRateResultCell").text());
...@@ -200,7 +202,7 @@ $(function() { ...@@ -200,7 +202,7 @@ $(function() {
rateResult += parseInt($(this).children("input").val()); rateResult += parseInt($(this).children("input").val());
}); });
} }
else if ($("#pageType").val() == "rating") else if ($("#pageType").val() === "rating")
{ {
// страница оценивания // страница оценивания
jThis.siblings(".commonCell").each(function(){ // добавим сумму баллов в соседних ячейках jThis.siblings(".commonCell").each(function(){ // добавим сумму баллов в соседних ячейках
...@@ -323,7 +325,7 @@ $(function() { ...@@ -323,7 +325,7 @@ $(function() {
$(this).select(); $(this).select();
}); });
// При нажатие на элемент commonCell дочерный input получает фокус // При нажатии на элемент commonCell дочерный input получает фокус
$(".commonCell ").click(function(){ $(".commonCell ").click(function(){
$(this).children("input").focus(); $(this).children("input").focus();
} ); } );
......
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