From 6d1cbe47000edd0f3c511262aed6e0f5cb005204 Mon Sep 17 00:00:00 2001 From: RomanSteinberg <romanofficial@yandex.ru> Date: Fri, 9 Jan 2015 14:34:28 +0300 Subject: [PATCH] Refactoring; ADD: dean office exam operations; --- .../Controller/Handler/FileCreator.php | 44 ++++++++++++------- .../application/views/dean_office/index.twig | 27 +++++++++++- .../dean_office.js} | 34 +++++++++++--- ~dev_rating/media/js/rating.js | 2 +- 4 files changed, 82 insertions(+), 25 deletions(-) rename ~dev_rating/media/js/{getFinalForms.js => dean_office/dean_office.js} (65%) diff --git a/~dev_rating/application/classes/Controller/Handler/FileCreator.php b/~dev_rating/application/classes/Controller/Handler/FileCreator.php index 97ba532fc..b8967c537 100644 --- a/~dev_rating/application/classes/Controller/Handler/FileCreator.php +++ b/~dev_rating/application/classes/Controller/Handler/FileCreator.php @@ -170,7 +170,7 @@ class Controller_Handler_FileCreator extends Controller_Handler } // Ведомость - public function action_GenerateExcelStatement() + public function action_GenerateFinalForm() { // TODO CHECK!!! // TODO // parameters @@ -354,21 +354,7 @@ class Controller_Handler_FileCreator extends Controller_Handler if ($totalRateValue > 100) $totalRateValue = 100; - $totalRate = ''; - $rateOfFive = ''; - $examRate = ''; - if ($rate < 38) { - $totalRate = ' '; - $rateOfFive = 'неуд'; - $examRate ='0'; - } elseif (($rate >= 38) and ($examRateValue >= 22)) { - $totalRate = $totalRateValue; - $rateOfFive = 'СѓРґРѕРІР»'; - if (($totalRateValue >= 75) and ($totalRateValue < 85)) - $rateOfFive = 'С…РѕСЂ'; - elseif ($totalRateValue >= 85) - $rateOfFive = 'отл'; - } + list($totalRate, $rateOfFive, $examRate) = $this->formRateOfFive($rate, $examRateValue, $totalRateValue); $sheet ->setCellValue($indPosition.$row, $index) ->setCellValue($namePosition.$row, $fullName) @@ -475,4 +461,30 @@ class Controller_Handler_FileCreator extends Controller_Handler $this->response->headers("Content-Disposition", "attachment; filename=".$filename.".xls" ); } + /** + * @param $rate + * @param $examRateValue + * @param $totalRateValue + * @return array + */ + protected function formRateOfFive($rate, $examRateValue, $totalRateValue) + { + $totalRate = ''; + $rateOfFive = ''; + $examRate = ''; + if ($rate < 38) { + $totalRate = ' '; + $rateOfFive = 'неуд'; + $examRate = '0'; + } elseif (($rate >= 38) and ($examRateValue >= 22)) { + $totalRate = $totalRateValue; + $rateOfFive = 'СѓРґРѕРІР»'; + if (($totalRateValue >= 75) and ($totalRateValue < 85)) + $rateOfFive = 'С…РѕСЂ'; + elseif ($totalRateValue >= 85) + $rateOfFive = 'отл'; + } + return array($totalRate, $rateOfFive, $examRate); + } + } \ No newline at end of file diff --git a/~dev_rating/application/views/dean_office/index.twig b/~dev_rating/application/views/dean_office/index.twig index bcf655449..0e640b162 100644 --- a/~dev_rating/application/views/dean_office/index.twig +++ b/~dev_rating/application/views/dean_office/index.twig @@ -5,7 +5,7 @@ {{ HTML.script('media/js/jquery.fileDownload.js')|raw }} {{ HTML.style('media/css/discipline.css')|raw }} - {{ HTML.script('media/js/getFinalForms.js')|raw }} + {{ HTML.script('media/js/dean_office/dean_office.js')|raw }} {% endblock %} {% block main_top_title %}Деканат > Ведомости{% endblock %} @@ -18,7 +18,7 @@ <div class="title">Форма контроля:</div> <div class="field"> <div class="ExamTypeDiv"> - <input id="ExamType" name="ExamType" type="radio" value="exam" disabled> Ркзамен + <input id="ExamType" name="ExamType" type="radio" value="exam"> Ркзамен </div> <div class="ExamTypeDiv"> <input id="ExamType" name="ExamType" type="radio" value="credit" checked> Зачет @@ -55,6 +55,29 @@ <button class="default_BlueButton" id="DownloadStatement" disabled>Скачать</button> </div> + <p><b>Шаг 4. Дисциплина</b></p> + <div class="LayerSection"> + <div class="itemBlock"> + <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> + </div> + </div> + <button class="default_BlueButton" id="DownloadExamDocument" disabled>Скачать</button> + <button class="default_BlueButton" id="BlockExamDiscipline" disabled>Блокировать</button> + <button class="default_BlueButton" id="BlockAndPrintExam" disabled>Блокировать Рё Скачать</button> + </div> + + + </div> + {% endblock %} diff --git a/~dev_rating/media/js/getFinalForms.js b/~dev_rating/media/js/dean_office/dean_office.js similarity index 65% rename from ~dev_rating/media/js/getFinalForms.js rename to ~dev_rating/media/js/dean_office/dean_office.js index e0d63139d..945a52aec 100644 --- a/~dev_rating/media/js/getFinalForms.js +++ b/~dev_rating/media/js/dean_office/dean_office.js @@ -1,9 +1,9 @@ var $ = jQuery; $(function() { - var jDownloadStatement = $("#DownloadStatement"); + var jDownloadStatement = $("#DownloadStatement"); - //Получить СЃРїРёСЃРѕРє РіСЂСѓРїРї РїРѕ ID РєСѓСЂСЃР° + //Получить СЃРїРёСЃРѕРє РіСЂСѓРїРї РїРѕ ID РєСѓСЂСЃР° $("#SelectGrade").change(function() { var gradeID = parseInt($(this).val()) || 0; var jSelectGroup = $("#SelectGroup"); @@ -40,15 +40,15 @@ $(function() { } }); - $("#SelectGroup").change(function() { - var groupID = parseInt($(this).val()) || 0; + $("#SelectGroup").change(function() { + var groupID = parseInt($(this).val()) || 0; if (groupID > 0) jDownloadStatement.removeAttr("disabled"); else jDownloadStatement.attr("disabled", "disabled"); - }); + }); // Скачать ведомость - $('body').on('click', '#DownloadStatement', function(){ + $('body').on('click', '#DownloadStatement', function(){ $.fileDownload( g_URLdir + 'handler/FileCreator/GenerateFinalFormsForGroup', { httpMethod: "POST", data: @@ -65,4 +65,26 @@ $(function() { }); }); + // Печать ведомости + $('body').on('click', '#DownloadExamDocument', function(){ + $.fileDownload( g_URLdir + 'handler/FileCreator/GenerateFinalForm', { + httpMethod: "POST", + data: + { + "GroupID": parseInt($("#SelectGroup").val()), + "ExamType": $("#ExamType:checked").val() + }, + successCallback: function () { + + }, + failCallback: function () { + EventInspector_ShowMsg('РќРµ удалось напечатать ведомость!', 'error'); + } + }); + }); + + // Блокирование дисциплины + + // Печать ведомости Рё блокирование дисциплины + }); \ No newline at end of file diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js index c85ab1fde..171119ff1 100644 --- a/~dev_rating/media/js/rating.js +++ b/~dev_rating/media/js/rating.js @@ -338,7 +338,7 @@ $(function() { // Ведомость РІ формате excel $('body').on('click', '.downloadExcelStatement', function(){ - $.fileDownload(URLdir + 'handler/FileCreator/GenerateExcelStatement', { + $.fileDownload(URLdir + 'handler/FileCreator/GenerateFinalForm', { httpMethod: "POST", data: { -- GitLab