From 67909ac59832fe6bd839d897481d64c3bab39f00 Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.Silence@gmail.com> Date: Wed, 22 Oct 2014 23:06:48 +0400 Subject: [PATCH] ... --- db/StoredProcedures.sql | 50 +++++++------- .../teacher/discipline/EditStudents.twig | 32 --------- .../media/js/discipline/EditStudents.js | 68 ++++++++----------- 3 files changed, 53 insertions(+), 97 deletions(-) diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index 4f7deefbb..d2b47bd8a 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -1591,31 +1591,31 @@ END // -- DROP PROCEDURE IF EXISTS SearchStudents// --- CREATE PROCEDURE `SearchStudents` ( IN `GradeID` INT, --- IN `GroupN` INT, --- IN `FacultyID` INT, --- IN `Name` VARCHAR(100) CHARSET utf8 --- ) --- NO SQL --- BEGIN --- SELECT students.ID AS 'ID', --- students.LastName AS 'Last', --- students.FirstName AS 'First', --- students.SecondName AS 'Second', --- grades.ID AS 'GradeID', --- grades.Num AS 'GradeNum', --- grades.Degree AS 'Degree', --- study_groups.ID AS 'GroupID', --- study_groups.GroupNum AS 'GroupNum' --- FROM `students` --- INNER JOIN `study_groups` ON students.StudyGroupID = study_groups.ID AND --- GradeID = study_groups.GradeID AND --- ( GroupN = 0 OR GroupN = study_groups.GroupNum ) --- INNER JOIN `specializations` ON study_groups.SpecializationID = specializations.ID --- INNER JOIN `grades` ON study_groups.GradeID = grades.ID --- WHERE FacultyID = specializations.FacultyID AND --- CONCAT(students.LastName, students.FirstName, students.SecondName) LIKE CONCAT("%",Name,"%") --- ORDER BY grades.ID ASC, study_groups.GroupNum ASC; + -- CREATE PROCEDURE `SearchStudents` ( IN `GradeID` INT, + -- IN `GroupN` INT, + -- IN `FacultyID` INT, + -- IN `Name` VARCHAR(100) CHARSET utf8 + -- ) + -- NO SQL + -- BEGIN + -- SELECT students.ID AS 'ID', + -- students.LastName AS 'Last', + -- students.FirstName AS 'First', + -- students.SecondName AS 'Second', + -- grades.ID AS 'GradeID', + -- grades.Num AS 'GradeNum', + -- grades.Degree AS 'Degree', + -- study_groups.ID AS 'GroupID', + -- study_groups.GroupNum AS 'GroupNum' + -- FROM `students` + -- INNER JOIN `study_groups` ON students.StudyGroupID = study_groups.ID AND + -- GradeID = study_groups.GradeID AND + -- ( GroupN = 0 OR GroupN = study_groups.GroupNum ) + -- INNER JOIN `specializations` ON study_groups.SpecializationID = specializations.ID + -- INNER JOIN `grades` ON study_groups.GradeID = grades.ID + -- WHERE FacultyID = specializations.FacultyID AND + -- CONCAT(students.LastName, students.FirstName, students.SecondName) LIKE CONCAT("%",Name,"%") + -- ORDER BY grades.ID ASC, study_groups.GroupNum ASC; -- END // diff --git a/~dev_rating/application/views/teacher/discipline/EditStudents.twig b/~dev_rating/application/views/teacher/discipline/EditStudents.twig index dc80c3a6e..59805dc70 100644 --- a/~dev_rating/application/views/teacher/discipline/EditStudents.twig +++ b/~dev_rating/application/views/teacher/discipline/EditStudents.twig @@ -17,38 +17,6 @@ </div> {% endmacro %} -{% macro outputGroups(Groups) %} - - {% import _self as me %} - - {% for group in Groups %} - <div> - <div class="GradeAndGroupTitle ActionShowHideGroupContainer" id="{{ group.GroupID }}"> - <span class="info">{{ group.Degree }}, курс {{ group.GradeNum }} группа {{ group.GroupNum }}</span> - <span class="Action">Открыть список ▼</span> - </div> - - <div class="GroupContainer"> - <div class="hideListAction"></div> - {% for student in group.students %} - {{ me.outputStudent(student) }} - - {# - <div id="{{ student.ID }}" class="Student {% if student.Type == 'detach' %}StatusUnbind{% else %}StatusBind{% endif %}"> - <span class="Name">{{ student.LastName }} {{ student.FirstName }} {{ student.SecondName }}</span> - {% if student.Type == 'detach' %} - <button class="action Action_BindStudent">Прикрепить студента</button> - {% else %} - <button class="action Action_UnbindStudent">Отсоединить студента</button> - {% endif %} - </div> - #} - {% endfor %} - </div> - </div> - {% endfor %} -{% endmacro %} - {% import 'teacher/discipline/EditStudents' as idx %} diff --git a/~dev_rating/media/js/discipline/EditStudents.js b/~dev_rating/media/js/discipline/EditStudents.js index 40eb913df..583641ac6 100644 --- a/~dev_rating/media/js/discipline/EditStudents.js +++ b/~dev_rating/media/js/discipline/EditStudents.js @@ -1,6 +1,11 @@ var $ = jQuery; $(function() { + $("div.GroupContainerAttached").show().each(function() { + $(this).css("height", $(this).height()); + }); + + var jStudentInput = $(".InputStudentName").first(); var jGradeSelect = $(".SelectGrade").first(); var jSGSelect = $(".SelectStudyGroup").first(); @@ -12,18 +17,24 @@ $(function() { <button class='action'></button> \ </div>")); - var jGroupWrapPrototype = $($.parseHTML( "<select class='SelectStudyGroup default_select'> + var jGroupWrapPrototype = $($.parseHTML( "<select class='SelectStudyGroup default_select'>\ <option value='0'>Выберите группу:</option>")); - - $("div.GroupContainerAttached").show().each(function() { - $(this).css("height", $(this).height()); - }); + var jGroupPrototype = $($.parseHTML("<option value='0'></option>")); + function ConstructGroup(groupID, groupNum, specName) { + var jClone = jGroupPrototype.clone(); + var str = "группа "+groupNum + if (specName != null) { + str += " - "+specName; + } + jClone.html(str); + jClone.val(groupID); + return jClone; + } - // Поиск студентов function ConstructStudent(ID, name, from, groupID, bind) { var jStudent = jStudentPrototype.clone(); var jStudentSib = jStudent.children(); @@ -48,7 +59,8 @@ $(function() { } - // Поиск студентов + + function SearchStudents() { var name = []; @@ -107,8 +119,7 @@ $(function() { - function GetStudyGroups() - { + function GetStudyGroups() { $.post( g_URLdir + "handler/map/GetStudyGroups", { @@ -124,52 +135,25 @@ $(function() { var jClone = jGroupWrapPrototype.clone(); for (i in data) { - jClone.append("<option value='"+ data[i].GroupID +"'>группа "+ data[i].GroupNum +" - "+ data[i].SpecName +"</option>"); + var temp = data[i]; + jClone.append(ConstructGroup(temp.GroupID, temp.GroupNum, temp.SpecName)); } jSGSelect.replaceWith(jClone); jSGSelect = jClone; } - CallSearchStudents(); - } + SearchStudents(); + } //!callback ); //!post } - $(".SelectGrade").change(function(){ GetStudyGroups(); - // $.post( - // g_URLdir + "handler/map/GetStudyGroups", - // { - // "FacultyID": g_facultyID, - // "GradeID": $(this).val() - // }, - // function(data){ - // data = $.parseJSON(data); - // var i = 0; - // if (data != null && data != undefined) { - // $(".SelectStudyGroup").html("<option value='0'>Выберите группу:</option>"); - // for (i in data) { - // $(".SelectStudyGroup").append("<option value='"+ data[i].GroupID +"'>группа "+ data[i].GroupNum +" - "+ data[i].SpecName +"</option>"); - // } - // } - // if (i <= 0) - // $(".SelectStudyGroup").html("<option value='0'>групп</option>"); - // CallSearchStudents(); - // } - // ); }); - // $(".SelectGrade").focusout(function(){ - // $(this).trigger("change"); - // }); - // $(".SelectStudyGroup").focusout(function(){ - // $(this).trigger("change"); - // }); - // Если студент из поиска function BindStudentFromSearch(jThis) { @@ -202,6 +186,10 @@ $(function() { .addClass("StatusBind"); } + + + + // Прикрепить студента $(".StudentsList").on("click", "button.Action_BindStudent", function(){ var jThis = $(this); -- GitLab