From 29bb8f045b152ba6b6c6badfdf1748473f613b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A8=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D0=B2?= <solidovic@gmail.com> Date: Wed, 15 Oct 2014 21:12:32 +0400 Subject: [PATCH] =?UTF-8?q?1.=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=86=D0=B5=D0=BD=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20(=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=20=D0=BE=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D1=8C=20=D1=82=D1=89=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=BF=D1=80=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C)=202.=20fix=20edit=20discipline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/Controller/Teacher/Rating.php | 5 +- .../application/views/teacher/rating.twig | 49 +++---------------- ~dev_rating/media/css/discipline.css | 4 +- .../media/js/discipline/EditStructure.js | 47 +++--------------- ~dev_rating/media/js/rating.js | 7 +-- 5 files changed, 25 insertions(+), 87 deletions(-) diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php index 6e0a33deb..ff57ac8da 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Rating.php +++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php @@ -11,7 +11,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { // Шапка: модули Рё подмодули $discipline = $db->GetMapForDiscipline($this->UserInfo['TeacherID'], $id); - + if($discipline->count() == 0) throw HTTP_Exception::factory (404, "Для дисциплины СЃ ID $id РЅРµ создана РЈРљР” или такой дисциплины РЅРµ существует!"); @@ -35,6 +35,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $j = $disciplineHandled[$i]['SubmodulesCount'] += 1; $disciplineHandled[$i]['MaxRate'] += (int) $row['MaxRate']; $disciplineHandled[$i]['ModuleTitle'] = $row['ModuleName']; + $disciplineHandled[$i]['ModuleType'] = $row['ModuleType']; $disciplineHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID']; $disciplineHandled[$i][$j]['Title'] = $row['SubModuleName']; $disciplineHandled[$i][$j]['Description'] = $row['SubmoduleDescription']; @@ -44,6 +45,8 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $disciplineHandled['ModulesCount'] = $i; $disciplineHandled['MaxRate'] = (int) $maxRate; + //echo debug::vars($disciplineHandled); + $twig->headerRate = $disciplineHandled; // Студенты Рё баллы diff --git a/~dev_rating/application/views/teacher/rating.twig b/~dev_rating/application/views/teacher/rating.twig index ead8a394a..beaeb57d3 100644 --- a/~dev_rating/application/views/teacher/rating.twig +++ b/~dev_rating/application/views/teacher/rating.twig @@ -13,46 +13,11 @@ <h2 style="margin-left: 2.5%; font-weight: normal; color: #3399CC;">{{ headerRate.SubjectName }}</h2> <p class="notification">Обратить внимание, что пустая клетка эквивалентна нулю</p> - <div class="HideStudentsRateHeadTableWrapper"> - <table class="HideStudentsRateHeadTable" border="0" cellspacing="0" cellpadding="0"> - <tr class="RatingTableModulesHead"> - <td class="title" width="150px">Модуль</td> - {% for i in 1..headerRate.ModulesCount %} - <td class="subject" colspan="{{headerRate[i].SubmodulesCount}}">{{ headerRate[i].ModuleTitle }}</td> - {% endfor %} - <td></td> - </tr> - <tr class="RatingTableSubmodulesHead"> - {% set CellCount = 0 %} - <td class="title">Мероприятие</td> - {% for i in 1..headerRate.ModulesCount %} - {% set CellCount = CellCount + headerRate[i].SubmodulesCount %} - {% for j in 1..headerRate[i].SubmodulesCount %} - <td class="subject">{{ headerRate[i][j].Title }}</td> - {% endfor %} - {% endfor %} - <td class="subject">Ртог</td> - </tr> - <tr class="RatingTableSubmodulesHeadMaxRate"> - {% set CellCount = 0 %} {% set col = 0 %} - <td class="title">Макс. балл</td> - {% for i in 1..headerRate.ModulesCount %} - {% set CellCount = CellCount + headerRate[i].SubmodulesCount %} - {% for j in 1..headerRate[i].SubmodulesCount %} - {% set col = col + 1 %} - <td class="subject col_{{ col }}">{{ headerRate[i][j].MaxRate }}</td> - {% endfor %} - {% endfor %} - <td class="subject col_{{ col + 1}}"></td> - </tr> - </table> - </div> - <table class="studentsRate" border="0" cellspacing="0" cellpadding="0"> <tr class="RatingTableModulesHead"> <td class="title" width="150px">Модуль</td> {% for i in 1..headerRate.ModulesCount %} - <td class="subject" colspan="{{headerRate[i].SubmodulesCount}}">{{ headerRate[i].ModuleTitle }}</td> + <td class="subject" colspan="{{headerRate[i].SubmodulesCount}}" {% if headerRate[i].ModuleType == 'exam' or headerRate[i].ModuleType == 'bonus' %} rowspan="2" {% endif %}>{{ headerRate[i].ModuleTitle }}</td> {% endfor %} <td></td> </tr> @@ -61,10 +26,12 @@ <td class="title">Мероприятие</td> {% for i in 1..headerRate.ModulesCount %} {% set CellCount = CellCount + headerRate[i].SubmodulesCount %} - {% for j in 1..headerRate[i].SubmodulesCount %} - {% set col = col + 1 %} - <td class="subject col_{{ col }}" id="{{ headerRate[i][j].SubmoduleID }}">{{ headerRate[i][j].Title }} <input type="hidden" class="MaxRate" value="{{ headerRate[i][j].MaxRate }}"></td> - {% endfor %} + {% if headerRate[i]['ModuleType'] == 'regular' %} + {% for j in 1..headerRate[i].SubmodulesCount %} + {% set col = col + 1 %} + <td class="subject col_{{ col }}">{{ headerRate[i][j].Title }}</td> + {% endfor %} + {% endif %} {% endfor %} <td class="subject col_{{ col + 1}}">Ртог</td> </tr> @@ -75,7 +42,7 @@ {% set CellCount = CellCount + headerRate[i].SubmodulesCount %} {% for j in 1..headerRate[i].SubmodulesCount %} {% set col = col + 1 %} - <td class="subject col_{{ col }}">{{ headerRate[i][j].MaxRate }}</td> + <td class="subject col_{{ col }}" id="{{ headerRate[i][j].SubmoduleID }}">{{ headerRate[i][j].MaxRate }} <input type="hidden" class="MaxRate" value="{{ headerRate[i][j].MaxRate }}"></td> {% endfor %} {% endfor %} <td class="subject col_{{ col + 1}}"></td> diff --git a/~dev_rating/media/css/discipline.css b/~dev_rating/media/css/discipline.css index 4f021dcd8..fe6dabc79 100644 --- a/~dev_rating/media/css/discipline.css +++ b/~dev_rating/media/css/discipline.css @@ -305,7 +305,9 @@ padding: 8px 20px 8px 40px; margin: 0 8px; cursor: pointer; - font-size: 14px; + color: #009933; + font-weight: bold; + font-size: 13px; } /* Прикрипление РіСЂСѓРїРї */ diff --git a/~dev_rating/media/js/discipline/EditStructure.js b/~dev_rating/media/js/discipline/EditStructure.js index f89de8627..a11ff2beb 100644 --- a/~dev_rating/media/js/discipline/EditStructure.js +++ b/~dev_rating/media/js/discipline/EditStructure.js @@ -87,42 +87,6 @@ var jConfirmPrototype = $($.parseHTML( } ); } - - - // Рзменение типа подмодуля - // function ChangeSubmoduleControlType(ID, ControlType){ //deprecated - // $.post( - // URLdir + 'handler/map/ChangeSubmoduleControlType', - // { - // 'SubmoduleID': ID, - // 'ControlType': ControlType - // }, - // function(data){ - // data = $.parseJSON(data); - // //if(data.success === true) - // // EventInspector_ShowMsg('Форма контроля изменена', 'success'); - // //else EventInspector_ShowMsg('Ошибка РїСЂРё изменение формы контроля', 'error'); - // } - // ); - // } - - // Рзменение макс. балла подмодуля - // function ChangeSubmoduleMaxRate(thisObj, ID, NewMaxRate) { //deprecated - // $.post( - // URLdir + 'handler/map/ChangeSubmoduleMaxRate', - // { - // 'SubmoduleID': ID, - // 'MaxRate': NewMaxRate - // }, - // function(data){ - // data = $.parseJSON(data); - // if(data.success === true) - // EventInspector_ShowMsg('Max балл мероприятия изменен', 'success'); - // else EventInspector_ShowMsg('Ошибка РїСЂРё изменении max балла', 'error'); - // thisObj.removeAttr('disabled'); - // } - // ); - // } // Установить новый max балл function SetNewRateAndControl(thisObj, OldMaxRate) { @@ -301,8 +265,7 @@ var jConfirmPrototype = $($.parseHTML( } ); - if ($('.empty').css('display') == 'block') - $('.empty').css('display', 'none'); + $('.empty').remove(); }); @@ -337,15 +300,13 @@ var jConfirmPrototype = $($.parseHTML( $('.moduleList').on('click', '.deleteModule', function(){ $(this).parent().css('display', 'none'); $(this).parent().parent().append(jConfirmPrototype.clone()); + }); // Подтверждение РїСЂРё удаление модуля $('.moduleList').on('click', '.confirmDeleteModule', function(){ var thisObj = $(this); - - - // $.post( URLdir + 'handler/map/DeleteModule', { @@ -376,12 +337,16 @@ var jConfirmPrototype = $($.parseHTML( if ($('div.ExamModule').length > 0) e = 40; $('span.RateIndicator').html(c + l + e); + + if ($('div.moduleGroup').length == 0) + $('.moduleList').prepend('<div class="empty"><p class="notification">Модули отсутствуют</p></div>'); // Показываем 'Модули отсутствуют' EventInspector_ShowMsg('Модуль удален', 'success'); } else EventInspector_ShowMsg('Ошибка РїСЂРё удаление модуля', 'error'); } ); + }); // Удалить мероприятие diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js index d4eee2562..34efcf845 100644 --- a/~dev_rating/media/js/rating.js +++ b/~dev_rating/media/js/rating.js @@ -33,8 +33,9 @@ $(function() { // Получаем подмодуль var reg = /col_\d+/; var col = ''+reg.exec(thisObj.attr('class')); - SubmoduleID = $('.RatingTableSubmodulesHead .'+col+':first').attr('id'); - + //SubmoduleID = $('.RatingTableSubmodulesHead .'+col+':first').attr('id'); + SubmoduleID = $('.RatingTableSubmodulesHeadMaxRate .'+col+':first').attr('id'); + // Получаем студента var reg = /row_\d+/; var row = ''+reg.exec(thisObj.attr('class')); @@ -43,7 +44,7 @@ $(function() { if (thisObj.children('input').val() != '') var NewRate = thisObj.children('input').val(); else var NewRate = 0; - var MaxRate = $('.RatingTableSubmodulesHead .'+col+':first').children('input').val(); + var MaxRate = $('.RatingTableSubmodulesHeadMaxRate .'+col+':first').children('input').val(); if (parseInt(NewRate) <= parseInt(MaxRate)) { -- GitLab