diff --git a/~dev_rating/application/classes/Controller/Handler/Map.php b/~dev_rating/application/classes/Controller/Handler/Map.php index d7b7387a5776e64eebc94bb6d63d3732013c1ca4..308c6ab44c5eb78eb06b9dd4723dce2b284743c2 100644 --- a/~dev_rating/application/classes/Controller/Handler/Map.php +++ b/~dev_rating/application/classes/Controller/Handler/Map.php @@ -366,7 +366,6 @@ class Controller_Handler_Map extends Controller_Handler { public function action_SearchStudents() { - $data['result'] = false; $this->post -> rule('Grade', 'digit') -> rule('GroupN', 'digit') -> rule('FacultyID', 'digit'); @@ -379,10 +378,20 @@ class Controller_Handler_Map extends Controller_Handler { $this->post->offsetGet('First'), $this->post->offsetGet('Second') ); - - var_dump($this->post->offsetGet($SeResult)); + $SearchResult = array(); + $i = 0; + foreach($SeResult as $row){ + $i++; + $SearchResult[$i]['StudentID'] = $row['StudentID']; + $SearchResult[$i]['StudentLast'] = $row['StudentLast']; + $SearchResult[$i]['StudentFirst'] = $row['StudentFirst']; + $SearchResult[$i]['StudentSecond'] = $row['StudentSecond']; + $SearchResult[$i]['GroupGrade'] = $row['GroupGrade']; + $SearchResult[$i]['GroupNum'] = $row['GroupNum']; + } + $SearchResult['Count'] = $i; } - $this->response->body(json_encode($data)); + $this->response->body(json_encode($SearchResult)); } diff --git a/~dev_rating/application/classes/Model/Teacher/Map.php b/~dev_rating/application/classes/Model/Teacher/Map.php index 5d06e178b3074dd93058afc1b9ff5e24439cd49f..1ae782c7d883763137330b8b10c3461a25d0f398 100644 --- a/~dev_rating/application/classes/Model/Teacher/Map.php +++ b/~dev_rating/application/classes/Model/Teacher/Map.php @@ -206,7 +206,7 @@ class Model_Teacher_Map extends Model return DB::query(Database::SELECT, $sql)->execute(); } - public function SearchStudents($Grade, $GroupN, $FacultyID, $Last, $First, $Second = 'NULL') + public function SearchStudents($Grade, $GroupN, $FacultyID, $Last, $First, $Second) { $sql = "CALL `SearchStudents`('$Grade', '$GroupN', '$FacultyID', '$Last', '$First', '$Second'); "; return DB::query(Database::SELECT, $sql)->execute(); diff --git a/~dev_rating/application/views/teacher/map/EditStudents.twig b/~dev_rating/application/views/teacher/map/EditStudents.twig index f5d635e603f58870eb620aebab0a6b2ffe75f082..4f4f8d96f12773cfdd7bb86b3e1ef88f5301f952 100644 --- a/~dev_rating/application/views/teacher/map/EditStudents.twig +++ b/~dev_rating/application/views/teacher/map/EditStudents.twig @@ -3,24 +3,32 @@ {% block title %}Конструктор РЈРљР”{% endblock %} {# head -> title #} {% block map_content %} - <p class="top_center_info" style="display: none">Учебная карта дисциплины РЅР° 1 семестр 2014 РіРѕРґР°</p> +<div class="StudentsList"> <input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}"> <div class="AttachedStudentsList"> - <button class="SearchStudentsButton">РџРѕРёСЃРє</button> + <h2 class="BlueTitle">Прикрепленные студенты</h2> {% set NowGroupNum = 0 %} {% for Student in Students %} {% if NowGroupNum != Student.GroupNum %} <div>РљСѓСЂСЃ {{ Student.Grade }}, Группа {{ Student.GroupNum }}</div> {% set NowGroupNum = Student.GroupNum %} {% endif %} - <div id="{{ Student.StudentID }}" class="Student {% if Student.Type == detach %}StatusBind{% else %}StatusUnbind{% endif %}"> + <div id="{{ Student.StudentID }}" class="Student {% if Student.Type == 'detach' %}StatusUnbind{% else %}StatusBind{% endif %}"> <span class="Name">{{ Student.LastName }} {{ Student.FirstName }} {{ Student.SecondName }}</span> - {% if Student.Type == detach%} - <span class="action Action_UnbindStudent">Отсоединить студента</span> - {% else %} + {% if Student.Type == 'detach' %} <span class="action Action_BindStudent">Прикрепить студента</span> + {% else %} + <span class="action Action_UnbindStudent">Отсоединить студента</span> {% endif %} </div> {% endfor %} </div> + <div class="SearchStudents"> + <h2 class="BlueTitle">РџРѕРёСЃРє студентов</h2> + <div class="SearchSettings"> + <input tupe="text" class="InputStudentName default_input_text" placeholder="Фамилия РРјСЏ Отчество" value=""> + </div> + <div class="SearchResult"></div> + </div> +</div> {% endblock %} diff --git a/~dev_rating/application/views/teacher/map/EditTeachers.twig b/~dev_rating/application/views/teacher/map/EditTeachers.twig index 7a72437d23698b413ad582fba49b0283fe538633..dfd9fd883babff6d41e199c6887e39eead200e38 100644 --- a/~dev_rating/application/views/teacher/map/EditTeachers.twig +++ b/~dev_rating/application/views/teacher/map/EditTeachers.twig @@ -5,7 +5,7 @@ {% block map_content %} <div class="TeachersList"> <div class="BindTeachersList"> - <h2>Прикрепленные преподаватели</h2> + <h2 class="BlueTitle">Прикрепленные преподаватели</h2> {% for Teacher in BindTeachersList %} <div class="Teacher" id="{{ Teacher.TeacherID }}"> <div class="Name">{{ Teacher.TeacherLast }} {{ Teacher.TeacherFirst }} {{ Teacher.TeacherSecond }}</div> @@ -13,9 +13,8 @@ </div> {% endfor %} </div> - <div style="width: 2%;"></div> <div class="SearchTeachers"> - <h2>РџРѕРёСЃРє преподавателей</h2> + <h2 class="BlueTitle">РџРѕРёСЃРє преподавателей</h2> <div class="SearchSettings"> <input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}"> <select class="SelectDepartment default_select"> diff --git a/~dev_rating/media/css/base.css b/~dev_rating/media/css/base.css index b4552a8fb0fc01523ba1659781134db61a05b49c..d6cd2142dbee8e2f3322b3544773700e502b82e9 100644 --- a/~dev_rating/media/css/base.css +++ b/~dev_rating/media/css/base.css @@ -199,6 +199,11 @@ p.notification{ text-align: center; font-size: 16px; } +h2.BlueTitle{ + font-size: 18px; + font-weight: normal; + color: #3399CC; +} diff --git a/~dev_rating/media/css/construct.css b/~dev_rating/media/css/construct.css index cbd57ed4fdccdfce733f3e487f07e91492fda0b2..710f3392dc03562bd11f1b61480e06a25791f3b0 100644 --- a/~dev_rating/media/css/construct.css +++ b/~dev_rating/media/css/construct.css @@ -214,17 +214,17 @@ color: #FF0000; } /* Прикрипление студентов */ -.AttachedStudentsList {} - .AttachedStudentsList .Student { +.StudentsList {} + .StudentsList .Student { margin: 10px 0; padding: 10px; } - .AttachedStudentsList .Student .Name { + .StudentsList .Student .Name { float: left; font-size: 14px; color: #363636; } - .AttachedStudentsList .Student .action { + .StudentsList .Student .action { float: right; font-size: 14px; cursor: pointer @@ -238,11 +238,6 @@ /* Прикрипление преподавателей */ .TeachersList { width: auto -} -.TeachersList h2{ - font-size: 18px; - font-weight: normal; - color: #3399CC; } .TeachersList .Teacher { background: #EDF1F5; diff --git a/~dev_rating/media/js/construct/edit.js b/~dev_rating/media/js/construct/edit.js index b6ad9f6e3a484341663c1ed329e632430f1e0b7a..946e4d5c8135ea5b405c115a01516f3c16bc9c63 100644 --- a/~dev_rating/media/js/construct/edit.js +++ b/~dev_rating/media/js/construct/edit.js @@ -454,10 +454,10 @@ $(function() { var FacultyID = $('.HiddenInputFacultyID').val(); // Факультет, Рє которой привязана дисциплина $('.HiddenInputFacultyID').remove(); // РўСѓС‚ даже Шерлок Холмс бессилен -function BindGroup(id){ +function BindGroup(id, StudyGroupName){ return '\ <div class="AttachedGroup" id="'+ id +'">\ - РљСѓСЂСЃ - , Группа - \ + <div class="StudyGroupInfo">'+ StudyGroupName +'</div>\ <div class="UnbindGroup">Отсоединить РіСЂСѓРїРїСѓ</div>\ </div>'; } @@ -465,6 +465,7 @@ function BindGroup(id){ // Прикрепить РіСЂСѓРїРїСѓ $('.AttachGroupButton').click(function(){ var StudyGroupID = $('.SelectStudyGroup').val(); + var StudyGroupName = $(".SelectStudyGroup option:selected").text(); $.post( '/~dev_rating/handler/map/BindGroup', { @@ -478,7 +479,7 @@ $('.AttachGroupButton').click(function(){ else EventInspector_ShowMsg('Error, BindGroup', 'error'); } ); - $('.AttachedGroupsList').append(BindGroup(StudyGroupID)); + $('.AttachedGroupsList').append(BindGroup(StudyGroupID, StudyGroupName)); }); // Отсоединить РіСЂСѓРїРїСѓ @@ -503,25 +504,44 @@ $('.AttachedGroupsList').on('click', '.UnbindGroup', function(){ }); // РџРѕРёСЃРє студентов -$('.SearchStudentsButton').click(function(){ +function AddStudent(ID, Name, From){ +return '\ + <div id="'+ ID +'" class="Student StatusUnbind">\ + <span class="Name">'+ Name +', '+ From +'</span>\ + <span class="action Action_BindStudent">Прикрепить студента</span>\ + </div>'; +} +$('.InputStudentName').focusout(function(){ + var Name = []; + Name = ($('.InputStudentName ').val()).split(' '); $.post( '/~dev_rating/handler/map/SearchStudents', { - 'Grade': '', - 'GroupN': '', - 'FacultyID': '', - 'Last': 'Рванов', - 'First': 'РРІ', - 'Second': 'h' + 'Grade': 0, //$('.SelectDepartment').val(), + 'GroupN': 0, + 'FacultyID': FacultyID, + 'Last': Name[0], + 'First': Name[1], + 'Second': Name[2] }, - function(date){ - + function(data){ + SearchResult = $.parseJSON(data); + $('.SearchResult').html(''); + if (parseInt(SearchResult.Count) > 0) + for(var i = 1; i <= parseInt(SearchResult.Count); i++) { + var ID = SearchResult[i].StudentID; + var Name = SearchResult[i].StudentLast +' '+ SearchResult[i].StudentFirst +' '+ SearchResult[i].StudentSecond; + var From = 'РљСѓСЂСЃ ' + SearchResult[i].GroupGrade + ', Группа ' + SearchResult[i].GroupNum; + $('.SearchResult').append(AddStudent(ID, Name, From)); + } + else + $('.SearchResult').html('Нет результатов'); } ); }); // Прикрепить студента -$('.AttachedStudentsList').on('click', '.Action_BindStudent', function(){ +$('.StudentsList').on('click', '.Action_BindStudent', function(){ $(this) .removeClass('Action_BindStudent') .addClass('Action_UnbindStudent') @@ -547,7 +567,7 @@ $('.AttachedStudentsList').on('click', '.Action_BindStudent', function(){ }); // Отсоединить студента -$('.AttachedStudentsList').on('click', '.Action_UnbindStudent', function(){ +$('.StudentsList').on('click', '.Action_UnbindStudent', function(){ $(this) .removeClass('Action_UnbindStudent') .addClass('Action_BindStudent')