diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index 16c39a0c0b8b2c434a69086590cc54e11aa801cd..215971f8f94ea017b527f479cb987938acd82052 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -4126,7 +4126,8 @@ BEGIN students.FirstName AS 'First', students.SecondName AS 'Second', GetRateForDiscSemester(students.ID, DisciplineID) AS 'intermediate', - GetRateForDiscBonus(students.ID, DisciplineID) AS 'bonus' + GetRateForDiscBonus(students.ID, DisciplineID) AS 'bonus', + GetRateForDiscExam(students.ID, DisciplineID) AS 'exam' FROM `students` INNER JOIN `study_groups` ON study_groups.ID = students.StudyGroupID -- LEFT JOIN `modules` ON modules.DisciplineID = DisciplineID AND diff --git a/~dev_rating/application/classes/Controller/Handler.php b/~dev_rating/application/classes/Controller/Handler.php index 5fb6b4461ca77e6e91d33d3089a7855bc2753ecf..d36405de53cac067afc766ba687fe10ac083344d 100644 --- a/~dev_rating/application/classes/Controller/Handler.php +++ b/~dev_rating/application/classes/Controller/Handler.php @@ -16,7 +16,7 @@ class Controller_Handler extends Controller { if(!$this->request->is_ajax() && !$isDownload) { // Перенаправляем РЅР° ошибку доступа - throw HTTP_Exception::factory (403); + throw HTTP_Exception::factory (403, "РЈ Вас нет разрешения скачивать файлы!"); } // Обработка POST-данных diff --git a/~dev_rating/application/classes/Controller/Handler/FileCreator.php b/~dev_rating/application/classes/Controller/Handler/FileCreator.php index 10c703f184906ced4a65e1401015399e0dd819b3..1db8ad75ed602ee552a2ce7b52e03d46b053ed1e 100644 --- a/~dev_rating/application/classes/Controller/Handler/FileCreator.php +++ b/~dev_rating/application/classes/Controller/Handler/FileCreator.php @@ -215,12 +215,14 @@ class Controller_Handler_FileCreator extends Controller_Handler $startRow = 12; $rowNumber = $startRow; $index = 1; + + $examHold = $this->checkExamIsHold($result); foreach($result as $studentInfo){ - $this->addStudentToSheet($objPHPExcel, $type, $studentInfo, $rowNumber, $index, $type); + $this->addStudentToSheet($objPHPExcel, $type, $studentInfo, $rowNumber, $index, $examHold); $rowNumber++; $index++; - } + } } protected function prepareSheetHeader(&$objPHPExcel, $disciplineType, $data) { @@ -263,13 +265,13 @@ class Controller_Handler_FileCreator extends Controller_Handler $sheet->setCellValue("$range", $controlDate); } - protected function addStudentToSheet(&$objPHPExcel, $disciplineType, $data, $row, $index) + protected function addStudentToSheet(&$objPHPExcel, $disciplineType, $data, $row, $index, $examHold1) { $sheet = $objPHPExcel->getActiveSheet(); if ($disciplineType == 'credit') { $this->addStudentInfoForCreditToSheet($sheet, $data, $row, $index); } elseif ($disciplineType == 'exam') { - $this->addStudentInfoForExamToSheet($sheet, $data, $row, $index); + $this->addStudentInfoForExamToSheet($sheet, $data, $row, $index, $examHold1); } } @@ -316,7 +318,7 @@ class Controller_Handler_FileCreator extends Controller_Handler ->setCellValue("J".$row, $tempStr); } - protected function addStudentInfoForExamToSheet(&$sheet, $data, $row, $index) + protected function addStudentInfoForExamToSheet(&$sheet, $data, $row, $index, $examHold) { $indPosition = 'A'; // Номер $namePosition = 'B'; // Р¤РРћ @@ -351,14 +353,16 @@ class Controller_Handler_FileCreator extends Controller_Handler $secondName = $data['Second']; $rate = (int)$data['intermediate']; $bonus = (int)$data['bonus']; - $examRateValue = 0; // TODO: get it from DB + $examRateValue = (int)$data['exam']; + if ($examRateValue < 0) + $examRateValue = 0; $fullName = $lastName." ".$firstName." ".$secondName; $totalRateValue = $rate + $examRateValue + $bonus; if ($totalRateValue > 100) $totalRateValue = 100; - list($totalRate, $rateOfFive, $examRate) = $this->formRateOfFive($rate, $examRateValue, $totalRateValue); + list($totalRate, $rateOfFive, $examRate) = $this->formRateOfFive($rate, $examRateValue, $totalRateValue, $examHold); $sheet ->setCellValue($indPosition.$row, $index) ->setCellValue($namePosition.$row, $fullName) @@ -464,26 +468,34 @@ class Controller_Handler_FileCreator extends Controller_Handler $this->response->headers("Content-type", " application/vnd.ms-excel" ); $this->response->headers("Content-Disposition", "attachment; filename=".$filename.".xls" ); } - - /** - * @param $rate - * @param $examRateValue - * @param $totalRateValue - * @return array - */ - protected function formRateOfFive($rate, $examRateValue, $totalRateValue) + + protected function checkExamIsHold(&$studentsRates) + { + foreach($studentsRates as $studentInfo){ + if ($studentInfo['exam'] >= 0) + return 1; + } + return 0; + } + + // Определяет оценку РїРѕ пятибальной системе + protected function formRateOfFive($rate, $examRateValue, $totalRateValue, $examHold) { $totalRate = ''; $rateOfFive = ''; - $examRate = ''; + $examRate = ''; + if ($examHold != 0) + $examRate = $examRateValue; + if ($rate < 38) { $totalRate = ' '; $rateOfFive = 'неуд'; - $examRate = '0'; + if ($examHold == 0) + $examRate = '0'; } elseif (($rate >= 38) and ($examRateValue >= 22)) { $totalRate = $totalRateValue; $rateOfFive = 'СѓРґРѕРІР»'; - if (($totalRateValue >= 75) and ($totalRateValue < 85)) + if (($totalRateValue >= 71) and ($totalRateValue < 85)) $rateOfFive = 'С…РѕСЂ'; elseif ($totalRateValue >= 85) $rateOfFive = 'отл'; diff --git a/~dev_rating/application/views/teacher/exam.twig b/~dev_rating/application/views/teacher/exam.twig index 53ead1503f78a24785c5e0f35716ac6f7560bfd0..ee45f1d58b86e9b6b83a18f26e542cb8719486e7 100644 --- a/~dev_rating/application/views/teacher/exam.twig +++ b/~dev_rating/application/views/teacher/exam.twig @@ -81,7 +81,7 @@ <span class="downloadExcelStatement" id="group_{{ group.GroupID }}">Скачать ведомость</span> </td> </tr> -{# + {% for student in group.Students %} {% set row = row + 1 %} {% set col = 0 %} @@ -114,7 +114,7 @@ <td class="rateResultCell staticCell">{{ student.RateResult }}</td> </tr> {% endfor %} - #} + {% endfor %} </table> diff --git a/~dev_rating/application/views/teacher/rating.twig b/~dev_rating/application/views/teacher/rating.twig index 88ec4e30ab665242e994e82b8b5ae580641842f4..08b19cd6c5fe39dcd1f422d86c2d6e1ece24b34a 100644 --- a/~dev_rating/application/views/teacher/rating.twig +++ b/~dev_rating/application/views/teacher/rating.twig @@ -16,7 +16,12 @@ <p class="canNotEdit"> Семестр завершен. Выставление баллов <u>запрещено</u>. </p> - {% endif %} + {% endif %} + {% if disciplineInfo.ExamType == 'exam' %} + <p class="canNotEdit"> + Выставление баллов Р·Р° экзамен возможно только РЅР° странице "Сессия". + </p> + {% endif %} <h2 class="h2_titleSubject">{{ SubjectName }}</h2> <button class="downloadExcel" style="display: none">Скачать РІ excel формате [dev version]</button>