diff --git a/~dev_rating/application/classes/Controller/Teacher/Discipline.php b/~dev_rating/application/classes/Controller/Teacher/Discipline.php index 5935a5db5eeda0327a545729c26f081a13071a19..3b350ba0828bc61ba8b5a3a210d82b50e4746d52 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Discipline.php +++ b/~dev_rating/application/classes/Controller/Teacher/Discipline.php @@ -1,73 +1,73 @@ <?php defined('SYSPATH') or die('No direct script access.'); class Controller_Teacher_Discipline extends Controller_UserEnvi { - + public function action_CreateDiscipline() { $twig = Twig::factory('teacher/discipline/CreateDiscipline'); $db = new Model_Teacher_Map; $twig->User = $this->UserInfo; - $twig->FacultiesList = DataArray::factory('Faculties')->common()->asArray(); - $twig->SubjectsList = DataArray::factory('Subjects')->byFaculty($this->UserInfo['FacultyID'])->asArray(); + $twig->FacultiesList = DataArray::factory('Faculties')->common()->asArray(); + $twig->SubjectsList = DataArray::factory('Subjects')->byFaculty($this->UserInfo['FacultyID'])->asArray(); $twig->GradesList = DataArray::factory('Grades')->common()->asArray(); $this->response->body($twig); - + } - - public function action_EditSettings() + + public function action_EditSettings() { $id = $this->request->param('id'); $db = new Model_Teacher_Map; $twig = Twig::factory('teacher/discipline/EditSettings'); - - $twig->User = $this->UserInfo; + + $twig->User = $this->UserInfo; - $twig->FacultiesList = DataArray::factory('Faculties')->common()->asArray(); + $twig->FacultiesList = DataArray::factory('Faculties')->common()->asArray(); $twig->Discipline = $this->GetDisciplineInfo($db, $id); $twig->SubjectsList = DataArray::factory('Subjects')->byFaculty($this->UserInfo['FacultyID'])->asArray(); $twig->GradesList = DataArray::factory('Grades')->common()->asArray(); - - $this->response->body($twig); - } + + $this->response->body($twig); + } - public function action_EditStructure() + public function action_EditStructure() { $id = $this->request->param('id'); $db = new Model_Teacher_Map; $twig = Twig::factory('teacher/discipline/EditStructure'); - + $twig->User = $this->UserInfo; - $twig->Discipline = $this->GetDisciplineInfo($db, $id); + $twig->Discipline = $this->GetDisciplineInfo($db, $id); $twig->Map = $this->GetMapInfo($db->getMapForDiscipline($this->UserInfo['TeacherID'], $id)); - - $this->response->body($twig); - } - - public function action_EditGroups() + + $this->response->body($twig); + } + + public function action_EditGroups() { $id = $this->request->param('id'); $db = new Model_Teacher_Map; $twig = Twig::factory('teacher/discipline/EditGroups'); - - $twig->User = $this->UserInfo; - $twig->Discipline = $this->GetDisciplineInfo($db, $id); + + $twig->User = $this->UserInfo; + $twig->Discipline = $this->GetDisciplineInfo($db, $id); - $twig->GroupsForDiscipline = DataArray::factory('StudyGroups')->forDiscipline($id)->asArray(); - $twig->StudyGroups = DataArray::factory('StudyGroups')->ordByGroups($twig->Discipline['GradeID'], $twig->Discipline['FacultyID'])->asArray(); - - $this->response->body($twig); - } - + $twig->GroupsForDiscipline = DataArray::factory('StudyGroups')->forDiscipline($id)->asArray(); + $twig->StudyGroups = DataArray::factory('StudyGroups')->ordByGroups($twig->Discipline['GradeID'], $twig->Discipline['FacultyID'])->asArray(); + + $this->response->body($twig); + } + public function action_EditStudents() { $id = $this->request->param('id'); $db = new Model_Teacher_Map; $twig = Twig::factory('teacher/discipline/EditStudents'); - - $twig->User = $this->UserInfo; - $twig->Discipline = $this->GetDisciplineInfo($db, $id); - $twig->GradesList = DataArray::factory('Grades')->common()->asArray(); - $twig->StudyGroups = DataArray::factory('StudyGroups')->ordByGroups($twig->Discipline['GradeID'], $twig->Discipline['FacultyID'])->asArray(); + + $twig->User = $this->UserInfo; + $twig->Discipline = $this->GetDisciplineInfo($db, $id); + $twig->GradesList = DataArray::factory('Grades')->common()->asArray(); + $twig->StudyGroups = DataArray::factory('StudyGroups')->ordByGroups($twig->Discipline['GradeID'], $twig->Discipline['FacultyID'])->asArray(); $students = $db->getStudentsForDiscipline($this->UserInfo['TeacherID'], $id); $stdHandled = array(); @@ -128,68 +128,68 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { } } - $twig->Students = $stdHandled; - $twig->AttachStudents = $attachStdHandled; + $twig->Groups = $stdHandled; + $twig->GroupsAttached = $attachStdHandled; - $this->response->body($twig); - } - + $this->response->body($twig); + } + public function action_EditTeachers() { $id = $this->request->param('id'); $db = new Model_Teacher_Map; $twig = Twig::factory('teacher/discipline/EditTeachers'); - - $twig->User = $this->UserInfo; - $twig->Discipline = $this->getDisciplineInfo($db, $id); - $twig->BindTeachersList = DataArray::factory('Teachers')->forDiscipline($id)->asArray(); - $twig->FacultiesList = DataArray::factory('Faculties')->common()->asArray(); - $twig->Departments = DataArray::factory('Departments')->byFaculty($this->UserInfo['FacultyID'])->asArray(); - - $this->response->body($twig); - } - + + $twig->User = $this->UserInfo; + $twig->Discipline = $this->getDisciplineInfo($db, $id); + $twig->BindTeachersList = DataArray::factory('Teachers')->forDiscipline($id)->asArray(); + $twig->FacultiesList = DataArray::factory('Faculties')->common()->asArray(); + $twig->Departments = DataArray::factory('Departments')->byFaculty($this->UserInfo['FacultyID'])->asArray(); + + $this->response->body($twig); + } + private function GetMapInfo($map) { $mapHandled = array(); $maxRate = 0; $i = 0; $module = 0; foreach($map as $row) { - if($row['ModuleID'] != $module) - { - $i++; - $module = $row['ModuleID']; - $mapHandled[$i]['ModuleID'] = $row['ModuleID']; - $mapHandled[$i]['ModuleType'] = $row['ModuleType']; - if ($row['ModuleType'] == 'bonus') - $mapHandled['isSetBonus'] = true; - $mapHandled[$i]['CurrentControl'] = 0; - $mapHandled[$i]['LandmarkControl'] = 0; - } - if(!isset($mapHandled[$i]['SubmodulesCount'])) - { - $mapHandled[$i]['SubmodulesCount'] = 0; - $mapHandled[$i]['MaxRate'] = 0; - } - $mapHandled[$i]['isExam'] = $row['isExam']; - $j = $mapHandled[$i]['SubmodulesCount'] += 1; - $mapHandled[$i]['MaxRate'] += (int) $row['MaxRate']; - $mapHandled[$i]['ModuleTitle'] = $row['ModuleName']; - $mapHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID']; - $mapHandled[$i][$j]['Title'] = $row['SubModuleName']; - $mapHandled[$i][$j]['Description'] = $row['SubmoduleDescription']; - $mapHandled[$i][$j]['SubmoduleControl'] = $row['SubmoduleControl']; - $mapHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate']; - $maxRate += $row['MaxRate']; - if ($row['SubmoduleControl'] == 'CurrentControl') - $mapHandled[$i]['CurrentControl'] += (int) $row['MaxRate']; - if ($row['SubmoduleControl'] == 'LandmarkControl') - $mapHandled[$i]['LandmarkControl'] += (int) $row['MaxRate']; + if($row['ModuleID'] != $module) + { + $i++; + $module = $row['ModuleID']; + $mapHandled[$i]['ModuleID'] = $row['ModuleID']; + $mapHandled[$i]['ModuleType'] = $row['ModuleType']; + if ($row['ModuleType'] == 'bonus') + $mapHandled['isSetBonus'] = true; + $mapHandled[$i]['CurrentControl'] = 0; + $mapHandled[$i]['LandmarkControl'] = 0; + } + if(!isset($mapHandled[$i]['SubmodulesCount'])) + { + $mapHandled[$i]['SubmodulesCount'] = 0; + $mapHandled[$i]['MaxRate'] = 0; + } + $mapHandled[$i]['isExam'] = $row['isExam']; + $j = $mapHandled[$i]['SubmodulesCount'] += 1; + $mapHandled[$i]['MaxRate'] += (int) $row['MaxRate']; + $mapHandled[$i]['ModuleTitle'] = $row['ModuleName']; + $mapHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID']; + $mapHandled[$i][$j]['Title'] = $row['SubModuleName']; + $mapHandled[$i][$j]['Description'] = $row['SubmoduleDescription']; + $mapHandled[$i][$j]['SubmoduleControl'] = $row['SubmoduleControl']; + $mapHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate']; + $maxRate += $row['MaxRate']; + if ($row['SubmoduleControl'] == 'CurrentControl') + $mapHandled[$i]['CurrentControl'] += (int) $row['MaxRate']; + if ($row['SubmoduleControl'] == 'LandmarkControl') + $mapHandled[$i]['LandmarkControl'] += (int) $row['MaxRate']; } - $mapHandled['ModulesCount'] = $i; - $mapHandled['MaxRate'] = (int) $maxRate; - if ($mapHandled['isSetBonus'] == true) - $mapHandled['MaxRate'] = $mapHandled['MaxRate'] - 10; + $mapHandled['ModulesCount'] = $i; + $mapHandled['MaxRate'] = (int) $maxRate; + if ($mapHandled['isSetBonus'] == true) + $mapHandled['MaxRate'] = $mapHandled['MaxRate'] - 10; return $mapHandled; } @@ -200,35 +200,35 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { if($info->count() == 0) throw HTTP_Exception::factory(404, "Учебная карта дисциплины СЃ ID $id РЅРµ найдена!"); - else - $info = $info->offsetGet(0); - - $subject['AuthorID'] = $info['AuthorID']; + else + $info = $info->offsetGet(0); + + $subject['AuthorID'] = $info['AuthorID']; if($this->UserInfo['TeacherID'] != $subject['AuthorID']) throw HTTP_Exception::factory(403, "Недостаточно прав для редактирования."); - - $subject['DisciplineID'] = $id; - $subject['DepID'] = $info['DepID']; - $subject['FacultyID'] = $info['FacultyID']; - $subject['isLocked'] = $info['isLocked']; - $subject['isBonus'] = $info['isBonus']; - - $subject['SemesterID'] = $info['SemesterID']; + + $subject['DisciplineID'] = $id; + $subject['DepID'] = $info['DepID']; + $subject['FacultyID'] = $info['FacultyID']; + $subject['isLocked'] = $info['isLocked']; + $subject['isBonus'] = $info['isBonus']; + + $subject['SemesterID'] = $info['SemesterID']; $semester = DataArray::factory('Semesters')->bySemester($subject['SemesterID'])->asArray(); $subject['SemesterNum'] = $semester['SemesterNum'] == 1 ? 'Осенний' : 'Весенний'; $subject['SemesterYear'] = $semester['SemesterYear']; - - $teachers = DataArray::factory('Teachers')->forDiscipline($id)->asArray(); - + + $teachers = DataArray::factory('Teachers')->forDiscipline($id)->asArray(); + $subject['SubjectName'] = $info['SubjectName']; - $subject['SubjectID'] = $info['SubjectID']; - $subject['ExamType'] = $info['ExamType']; + $subject['SubjectID'] = $info['SubjectID']; + $subject['ExamType'] = $info['ExamType']; $subject['LectureHours'] = $info['LectionCount']; $subject['PracticeHours'] = $info['PracticeCount']; - $subject['LabHours'] = $info['LabCount']; - $subject['GradeID'] = $info['GradeID']; - + $subject['LabHours'] = $info['LabCount']; + $subject['GradeID'] = $info['GradeID']; + $teachersHandled = array(); $i = 0; foreach ($teachers as $row) { @@ -240,9 +240,9 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { $i++; } $subject['Teachers'] = implode(', ', $teachersHandled); - - return $subject; + + return $subject; } - + } \ No newline at end of file diff --git a/~dev_rating/application/views/teacher/discipline/EditStudents.twig b/~dev_rating/application/views/teacher/discipline/EditStudents.twig index 1b453b0b3bd1cae84681aa562b5dcc6e45fba230..29ed9d5511b27677371b869f5fab105b014b43d3 100644 --- a/~dev_rating/application/views/teacher/discipline/EditStudents.twig +++ b/~dev_rating/application/views/teacher/discipline/EditStudents.twig @@ -3,50 +3,50 @@ {% set step_5 = 'active' %} {% block discipline_media %} - {{ HTML.script('media/js/discipline/EditStudents.js')|raw }} + {{ HTML.script('media/js/discipline/EditStudents.js')|raw }} {% endblock %} {% macro 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> + <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> {% 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 %} + {% 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 %} @@ -55,72 +55,66 @@ {% block map_content %} <div class="StudentsList"> - <input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}"> -{# <div class="AttachedStudentsList"> - <h2 class="BlueTitle">Прикрепленные студенты</h2> - {% set NowGroupNum = -1 %} - {% for Student in Students %} - - {% if NowGroupNum != Student.GroupNum %} - {% if not loop.first %} - </div> - {% endif %} - <div class="GradeAndGroupTitle ActionShowHideGroupContainer" id="{{ Student.GroupID }}"> - <span class="info">{{ Student.Degree }}, РєСѓСЂСЃ {{ Student.GradeNum }} РіСЂСѓРїРїР° {{ Student.GroupNum }}</span> - <span class="Action">Открыть СЃРїРёСЃРѕРє в–ј</span> - </div> - <div class="GroupContainer GroupID_{{ Student.GroupID }}"> - <div class="hideListAction"></div> - {% set NowGroupNum = Student.GroupNum %} - {% endif %} - - {{ idx.outputStudent(Student, HTML) }} - - {% if loop.last %} - </div> - {% endif %} - - {% endfor %} - </div> #} - - - - <input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}"> - <div class="GeneralStudentsList"> - <h2 class="BlueTitle">Прикрепленные студенты</h2> - {{ idx.outputGroups(Students) }} - </div> - <br> - <div class="AttachedStudentsList"> - <h2 class="BlueTitle">Еще студенты</h2> - {{ idx.outputGroups(AttachStudents) }} - </div> - - - - - - - <div class="SearchStudents"> - <h2 class="BlueTitle">РџРѕРёСЃРє студентов</h2> - <div class="SearchSettings"> - <select class="SelectGrade default_select"> - <option value="0">Выберите РєСѓСЂСЃ:</option> - {% for Grade in GradesList %} - <option value="{{ Grade.GradeID }}" {% if Grade.GradeID == Discipline.GradeID %}selected{% endif %}>{{ Grade.Title }}</option> - {% endfor %} - </select> - <select class="SelectStudyGroup default_select"> - <option value="0">Выберите РіСЂСѓРїРїСѓ:</option> - {% for Group in StudyGroups %} - <option value="{{ Group.GroupID }}">Группа {{ Group.GroupNum }} - {{ Group.SpecName }}</option> - {% endfor %} - </select> - <input tupe="text" class="InputStudentName default_input_text" placeholder="Фамилия РРјСЏ Отчество" value=""> - </div> - <div class="SearchResult"> - - </div> - </div> + <input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}"> + + <div class="GeneralStudentsList"> + <h2 class="BlueTitle">Прикрепленные студенты</h2> + {% 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 %} + {{ idx.outputStudent(student) }} + {% endfor %} + </div> + </div> + {% endfor %} + </div> + + + + <div class="AttachedStudentsList"> + <h2 class="BlueTitle">Еще студенты</h2> + {% for group in GroupsAttached %} + <div> + <div class="GroupContainerAttached"> + <div class="groupInfo">Рє. {{ group.GradeNum }}<br>Рі. {{ group.GroupNum }}</div> + {% for student in group.students %} + {{ idx.outputStudent(student) }} + {% endfor %} + </div> + </div> + {% endfor %} + </div> + + + + + + + <div class="SearchStudents"> + <h2 class="BlueTitle">РџРѕРёСЃРє студентов</h2> + <div class="SearchSettings"> + <select class="SelectGrade default_select"> + <option value="0">Выберите РєСѓСЂСЃ:</option> + {% for Grade in GradesList %} + <option value="{{ Grade.GradeID }}" {% if Grade.GradeID == Discipline.GradeID %}selected{% endif %}>{{ Grade.Title }}</option> + {% endfor %} + </select> + <select class="SelectStudyGroup default_select"> + <option value="0">Выберите РіСЂСѓРїРїСѓ:</option> + {% for Group in StudyGroups %} + <option value="{{ Group.GroupID }}">Группа {{ Group.GroupNum }} - {{ Group.SpecName }}</option> + {% endfor %} + </select> + <input tupe="text" class="InputStudentName default_input_text" placeholder="Фамилия РРјСЏ Отчество" value=""> + </div> + <div class="SearchResult"></div> + </div> </div> {% endblock %} diff --git a/~dev_rating/media/css/discipline.css b/~dev_rating/media/css/discipline.css index b04fef3f6853a465432408a0f1bdd9854ba5434f..796885e060378b1ca41119a36d51bfa97bd1fcae 100644 --- a/~dev_rating/media/css/discipline.css +++ b/~dev_rating/media/css/discipline.css @@ -372,21 +372,41 @@ display: none; } .StudentsList .GroupContainer .hideListAction{ - float: left; + float: right; background: url(icons/triangle_up.png) no-repeat center center #f9f9f9; width: 40px; height: 100%; margin-top: 10px; } .StudentsList .GroupContainer .hideListAction:hover{ + background-color: #e1e1e1; + } + + .StudentsList .GroupContainerAttached .groupInfo{ + float: right; + background: #f9f9f9; + width: 40px; + height: 100%; + margin-top: 10px; + } + .StudentsList .GroupContainerAttached .groupInfo:hover{ background-color: #e1e1e1;; } + .StudentsList .Student { - float: right; + float: left; width: 880px; margin-top: 10px; padding: 7px 10px; } + + .StudentsList .GroupContainerAttached .Student { + float: left; + width: 880px; + margin-top: 10px; + padding: 7px 10px; + } + .StudentsList .Student .Name { float: left; font-size: 14px; diff --git a/~dev_rating/media/js/discipline/EditStudents.js b/~dev_rating/media/js/discipline/EditStudents.js index a404b2aaf6902d37de1d58f1bd2abfc4ee7940ad..4cb0cbe481730d093dc0d66acb27ff0bb10fb17e 100644 --- a/~dev_rating/media/js/discipline/EditStudents.js +++ b/~dev_rating/media/js/discipline/EditStudents.js @@ -1,6 +1,10 @@ var $ = jQuery; $(function() { + var jStudentInput = $(".InputStudentName").first(); + var jGradeSelect = $(".SelectGrade").first(); + var jSGSelect = $(".SelectStudyGroup").first(); + var jSearchResult = $(".SearchResult").first(); var jStudentPrototype = $($.parseHTML( "<div id='0' class='Student'>\ @@ -10,6 +14,12 @@ $(function() { </div>" )); + $("div.GroupContainerAttached").show().each(function() { + $(this).css("height", $(this).height()); + }); + + + // РџРѕРёСЃРє студентов function ConstructStudent(ID, name, from, groupID, bind){ var jStudent = jStudentPrototype.clone(); @@ -39,13 +49,15 @@ $(function() { function CallSearchStudents() { var name = []; - if ($(".InputStudentName").val().length > 0) - name = ($(".InputStudentName").val()).split(" "); + var temp = $(".InputStudentName").val(); + if ( temp.length > 0) + name = temp.split(" "); + $.post( g_URLdir + "handler/map/SearchStudents", { - "GradeID": $(".SelectGrade").val(), - "GroupN": $(".SelectStudyGroup").val(), + "GradeID": jGradeSelect.val(), + "GroupN": jSGSelect.val(), "FacultyID": g_facultyID, "Last": name[0], "First": name[1], @@ -54,50 +66,28 @@ $(function() { }, function(searchResult){ var searchResult = $.parseJSON(searchResult); - var jSearch = $(".SearchResult").first(); var i = 0; - jSearch.html(); - var data = jSearch.clone(); - $(".SearchResult").html(""); - for(i in searchResult) - { + jSearchResult.html(""); + var jClone = jSearchResult.clone(); + + for(i in searchResult) { var ID = searchResult[i].ID; var name = searchResult[i].LastName +" "+ searchResult[i].FirstName +" "+ searchResult[i].SecondName; var from = "РєСѓСЂСЃ " + searchResult[i].GradeNum + ", РіСЂСѓРїРїР° " + searchResult[i].GroupNum; var groupID = searchResult[i].GroupID; - data.html(); - data.append(ConstructStudent(ID, name, from, groupID, false)); + jClone.append(ConstructStudent(ID, name, from, groupID, false)); } - if (i <= 0) - jSearch.html("<p class='notification'>Нет результатов... Возможно, студенты, соответствующие критериям РїРѕРёСЃРєР°, уже прикреплены.</p>"); - else jSearch.replaceWith(data); + if (i <= 0) { + jSearchResult.html("<p class='notification'>Нет результатов... Возможно, студенты, соответствующие критериям РїРѕРёСЃРєР°, уже прикреплены.</p>"); + } else { + jSearchResult.replaceWith(jClone); + jSearchResult = jClone; + } } - ); + ); //!post } - $(".SelectGrade").change(function(){ - $.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(); - } - ); - }); $(".SelectStudyGroup").change(function(){ CallSearchStudents(); }); @@ -106,20 +96,78 @@ $(function() { }); $(".InputStudentName").keydown(function(e){ if(e.keyCode==13){ - $(this).focusout("focusout"); + CallSearchStudents(); $(this).blur(); } }); - $(".SelectGrade").focusout(function(){ - $(this).trigger("change"); - }); - $(".SelectStudyGroup").focusout(function(){ - $(this).trigger("change"); + + function GetStudyGroups() + { + $.post( + g_URLdir + "handler/map/GetStudyGroups", + { + "FacultyID": g_facultyID, + "GradeID": jGradeSelect.val() + }, + function(data) { + var i = 0; + data = $.parseJSON(data); + jSGSelect.html(""); + + if (data != null && data != undefined) { + var jClone = jSGSelect.clone(); + jClone.html("<option value='0'>Выберите РіСЂСѓРїРїСѓ:</option>"); + + for (i in data) { + jClone.append("<option value='"+ data[i].GroupID +"'>РіСЂСѓРїРїР° "+ data[i].GroupNum +" - "+ data[i].SpecName +"</option>"); + } + + jSGSelect.replaceWith(jClone); + jSGSelect = jClone; + } + CallSearchStudents(); + } + ); //!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) { @@ -241,7 +289,7 @@ $(function() { } }); - $(".StudentsList").on("click", ".hideListAction", function(){ + $(".StudentsList").on("click", "div.hideListAction", function(){ $(this).parent() .hide("normal"); diff --git a/~dev_rating/media/js/discipline/general.js b/~dev_rating/media/js/discipline/general.js index 0fbb764d45c89818b37d3c9aa16a45af60557b19..80af042f2b30b951080fb8d28ab69330ec6a1841 100644 --- a/~dev_rating/media/js/discipline/general.js +++ b/~dev_rating/media/js/discipline/general.js @@ -105,7 +105,7 @@ $(function() { }); - var jTemp = $(".HiddenInputg_FacultyID").first(); + var jTemp = $(".HiddenInputFacultyID"); if (jTemp.length > 0) { g_facultyID = jTemp.val(); // Факультет, Рє которой привязана дисциплина jTemp.remove(); // РўСѓС‚ даже Шерлок Холмс бессилен