diff --git a/~dev_rating/application/classes/Controller/Teacher/Discipline.php b/~dev_rating/application/classes/Controller/Teacher/Discipline.php index c0c22e85d268f62b4cc71cc5b3d01129bc146c6d..c9f6ee4c1ad3525b7f2254cc6b992cc67e0eec02 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Discipline.php +++ b/~dev_rating/application/classes/Controller/Teacher/Discipline.php @@ -21,7 +21,7 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { $twig = Twig::factory('teacher/discipline/EditSettings'); $twig->User = $this->UserInfo; - + $twig->FacultiesList = DataArray::factory('Faculties')->common()->asArray(); $twig->Discipline = $this->GetDisciplineInfo($db, $id); $twig->SubjectsList = DataArray::factory('Subjects')->byFaculty($this->UserInfo['FacultyID'])->asArray(); @@ -84,7 +84,6 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { $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(); - //$twig->TeachersList = $this->GetTeachersByDepartment($db, $twig->Discipline['DepID']); $this->response->body($twig); } diff --git a/~dev_rating/application/classes/DataArr/Students.php b/~dev_rating/application/classes/DataArr/Students.php index 4ee82dd2362efde3788f7a2205df28893427d505..24cb97bc978bb00234143ee840353e2bfc3f2b91 100644 --- a/~dev_rating/application/classes/DataArr/Students.php +++ b/~dev_rating/application/classes/DataArr/Students.php @@ -47,20 +47,23 @@ class DataArr_Students { protected function generateArray($students) { + // AddCount - РЅРµ всегда требуется возвращать РєРѕР»-РІРѕ $studentsHandled = array(); $i = 0; foreach($students as $row) { $i++; $studentsHandled[$i]['ID'] = $row['StudentID']; $studentsHandled[$i]['AccountID'] = $row['StudentAccID']; - $studentsHandled[$i]['LastName'] = $row['StudentLast']; - $studentsHandled[$i]['FirstName'] = $row['StudentFirst']; - $studentsHandled[$i]['SecondName'] = $row['StudentSecond']; + $studentsHandled[$i]['LastName'] = $row['LastName']; + $studentsHandled[$i]['FirstName'] = $row['FirstName']; + $studentsHandled[$i]['SecondName'] = $row['SecondName']; $studentsHandled[$i]['GroupID'] = $row['GroupID']; - $studentsHandled[$i]['GradeID'] = $row['GradeID']; + $studentsHandled[$i]['GroupNum'] = $row['GroupNum']; + $studentsHandled[$i]['GradeID'] = $row['GradeID']; // ID РєСѓСЂСЃР° + $studentsHandled[$i]['Grade'] = $row['Grade']; // НОМЕРкурса, Р° РЅРµ ID... ID почти всегда <> НОМЕРУ РєСѓСЂСЃР° $studentsHandled[$i]['GradeNum'] = $row['GroupGrade']; $studentsHandled[$i]['Degree'] = $this->getDegreeTitle($row['GroupDegree']); - $studentsHandled[$i]['GroupNum'] = $row['GroupNum']; + $studentsHandled[$i]['Type'] = $row['Type']; } return $studentsHandled; } @@ -68,40 +71,12 @@ class DataArr_Students { public function forDiscipline($TeacherID, $DisciplineID) { $students = $this->model->getStudentsForDiscipline($TeacherID, $DisciplineID); - $studentsHandled = array(); - $i = 0; - - foreach($students as $row) { - $i++; - $studentsHandled[$i]['StudentID'] = $row['StudentID']; - $studentsHandled[$i]['LastName'] = $row['LastName']; - $studentsHandled[$i]['FirstName'] = $row['FirstName']; - $studentsHandled[$i]['SecondName'] = $row['SecondName']; - $studentsHandled[$i]['Grade'] = $row['Grade']; - $studentsHandled[$i]['GroupNum'] = $row['GroupNum']; - $studentsHandled[$i]['Type'] = $row['Type']; - $studentsHandled[$i]['GroupID'] = $row['GroupID']; - } - return new DataArray_Result($studentsHandled); + return new DataArray_Result($this->generateArray($students)); } public function NotAttendingDiscipline($GradeID, $GroupN, $FacultyID, $Last, $First, $Second, $DisciplineID) { $students = $this->model->getStudentsForDiscipline($GradeID, $GroupN, $FacultyID, $Last, $First, $Second, $DisciplineID); - $studentsHandled = array(); - $i = 0; - - foreach($students as $row) { - $i++; - $studentsHandled[$i]['StudentID'] = $row['StudentID']; - $studentsHandled[$i]['StudentLast'] = $row['StudentLast']; - $studentsHandled[$i]['StudentFirst'] = $row['StudentFirst']; - $studentsHandled[$i]['StudentSecond'] = $row['StudentSecond']; - $studentsHandled[$i]['GroupGrade'] = $row['GroupGrade']; - $studentsHandled[$i]['GroupNum'] = $row['GroupNum']; - $studentsHandled[$i]['GroupID'] = $row['GroupID']; - } - $studentsHandled['count'] = $i; - return new DataArray_Result($studentsHandled); + return new DataArray_Result($this->generateArray($students)); } } diff --git a/~dev_rating/application/classes/DataArr/StudyGroups.php b/~dev_rating/application/classes/DataArr/StudyGroups.php index f7b4831d2f13315fb3ca050d2802a5aece7d0511..72c4aaf2ecaf441a23734214bbea04dffb017339 100644 --- a/~dev_rating/application/classes/DataArr/StudyGroups.php +++ b/~dev_rating/application/classes/DataArr/StudyGroups.php @@ -22,7 +22,6 @@ class DataArr_StudyGroups { $GroupsHandled[$i]['SpecName'] = $row['SpecName']; $GroupsHandled[$i]['SpecAbbr'] = $row['SpecAbbr']; } - $GroupsHandled['count'] = $i; return new DataArray_Result($GroupsHandled); } @@ -40,7 +39,6 @@ class DataArr_StudyGroups { $GroupsHandled[$i]['SpecName'] = $row['SpecName']; $GroupsHandled[$i]['SpecAbbr'] = $row['SpecAbbr']; } - $GroupsHandled['count'] = $i; return new DataArray_Result($GroupsHandled); } diff --git a/~dev_rating/application/classes/DataArr/Subjects.php b/~dev_rating/application/classes/DataArr/Subjects.php index c497ff8e02dc31ef19172b621ad1bb7effbc9bc8..86f7d417e77d1ede300b81c0b84f39d118ec7253 100644 --- a/~dev_rating/application/classes/DataArr/Subjects.php +++ b/~dev_rating/application/classes/DataArr/Subjects.php @@ -19,7 +19,6 @@ class DataArr_Subjects { $SubjectsList[$i]['Title'] = $row['SubjectName']; $SubjectsList[$i]['Abbr'] = $row['SubjectAbbr']; } - $SubjectsList['Count'] = $i; return new DataArray_Result($SubjectsList); } diff --git a/~dev_rating/application/classes/DataArr/Teachers.php b/~dev_rating/application/classes/DataArr/Teachers.php index a1286fed0c8223bf3f7d341cca5d2fb681f31ce7..37ad7bd820d510dcf9861eacb7e9f19e01812f2b 100644 --- a/~dev_rating/application/classes/DataArr/Teachers.php +++ b/~dev_rating/application/classes/DataArr/Teachers.php @@ -55,6 +55,8 @@ class DataArr_Teachers { foreach ($teachers as $teacher) { $i++; $tchr = array(); + $tchr['isAuthor'] = $teacher['isAuthor']; + $tchr['TeacherID'] = $teacher['TeacherID']; $tchr['LastName'] = $teacher['TeacherLast']; $tchr['FirstName'] = $asInitials ? UTF8::substr($teacher['TeacherFirst'], 0, 1).'. ' : $teacher['TeacherFirst']; diff --git a/~dev_rating/application/views/teacher/discipline/EditStudents.twig b/~dev_rating/application/views/teacher/discipline/EditStudents.twig index 1b9e26ec15837b465a200839961888c8dccfe94c..846169951add1b52999e98b460e40561d18009f3 100644 --- a/~dev_rating/application/views/teacher/discipline/EditStudents.twig +++ b/~dev_rating/application/views/teacher/discipline/EditStudents.twig @@ -24,7 +24,7 @@ <div class="GroupContainer GroupID_{{ Student.GroupID }}"> {% set NowGroupNum = Student.GroupNum %} {% endif %} - <div id="{{ Student.StudentID }}" class="Student {% if Student.Type == 'detach' %}StatusUnbind{% else %}StatusBind{% endif %}"> + <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> diff --git a/~dev_rating/application/views/teacher/discipline/EditTeachers.twig b/~dev_rating/application/views/teacher/discipline/EditTeachers.twig index 4576dc0fd838175bbd57e51b2a4d86cc79e1cc27..ba9cddb7aa5df57c405971deb06158c96a112af1 100644 --- a/~dev_rating/application/views/teacher/discipline/EditTeachers.twig +++ b/~dev_rating/application/views/teacher/discipline/EditTeachers.twig @@ -12,7 +12,7 @@ <h2 class="BlueTitle">Прикрепленные преподаватели</h2> {% for Teacher in BindTeachersList %} <div class="Teacher" id="{{ Teacher.TeacherID }}"> - <div class="Name">{{ Teacher.TeacherLast }} {{ Teacher.TeacherFirst }} {{ Teacher.TeacherSecond }}</div> + <div class="Name">{{ Teacher.LastName }} {{ Teacher.FirstName }} {{ Teacher.SecondName }}</div> {% if Teacher.isAuthor == 0 %} <button class="Action_UnbindTeacher Action">Отсоединить</button> <button class="Action_ChangeOwner Action">Передать дисциплину</button> @@ -34,18 +34,12 @@ <select class="SelectDepartment default_select"> <option value="0">Выберите кафедру (РЅРµ обязательно)</option> {% for Dep in Departments %} - <option value="{{ Dep.DepID }}">{{ Dep.DepName }}</option> + <option value="{{ Dep.ID }}">{{ Dep.Name }}</option> {% endfor %} </select> <input tupe="text" class="InputTeacherName default_input_text" placeholder="Фамилия РРјСЏ Отчество" value=""> </div> <div class="SearchResult"> - {% for Teacher in TeachersList %} - <div class="Teacher" id="{{ Teacher.TeacherID }}"> - <div class="Name">{{ Teacher.TeacherLast }} {{ Teacher.TeacherFirst }} {{ Teacher.TeacherSecond }}</div> - <button class="Action_BindTeacher Action">Присоединить</button> - </div> - {% endfor %} </div> </div> </div> diff --git a/~dev_rating/media/js/discipline/general.js b/~dev_rating/media/js/discipline/general.js index 29a1c35fe5ef5253e6de4613db480cc4a3521d40..179c0b727fb2b5ddacfc042a075bbd589ee10b16 100644 --- a/~dev_rating/media/js/discipline/general.js +++ b/~dev_rating/media/js/discipline/general.js @@ -25,7 +25,7 @@ $(function() { function(data) { SubjectsGlobal = $.parseJSON(data); - //console.log(SubjectsGlobal); // * + console.log(SubjectsGlobal); // * } ); } @@ -37,7 +37,18 @@ $(function() { var NameFilter = NameFilter.toLowerCase(); var SortSubjects = {}; var j = 0; - var SubjectCount = SubjectsGlobal.Count; + for (var i in SubjectsGlobal) { + src = SubjectsGlobal[i]; + if ((src.Title).toLowerCase().indexOf(NameFilter) == 0) + { + // 0 - успех, -1 - ничего РЅРµ нашел + var dest = SortSubjects[j] = {}; + dest['ID'] = src.ID; + dest['Title'] = src.Title; + j++; + } + } + /* for (var i = SubjectCount - 1; i >= 0; --i) { src = SubjectsGlobal[i]; @@ -50,6 +61,7 @@ $(function() { j++; } } + */ SortSubjects.Count = j; //console.log(SortSubjects); // *