diff --git a/~dev_rating/application/classes/Controller/Teacher/Discipline.php b/~dev_rating/application/classes/Controller/Teacher/Discipline.php
index c9f6ee4c1ad3525b7f2254cc6b992cc67e0eec02..cb6ca4a51b3f08cb2cc47b54f5f455f37847d44f 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Discipline.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Discipline.php
@@ -66,10 +66,53 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi {
 		
 		$twig->User = $this->UserInfo;
 		$twig->Discipline = $this->GetDisciplineInfo($db, $id);
-		$twig->Students = DataArray::factory('Students')->forDiscipline($this->UserInfo['TeacherID'], $id)->asArray();
 		$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();
+        $attachStdHandled = array();
+        $groupID = 0; $i = 0; $k = 0;
+        foreach($students as $row) {
+            if ($row['Type'] == 'attach'){
+                $k++;
+                $attachStdHandled['StdCount'] += 1;
+                $attachStdHandled[$k]['StudentID'] = $row['StudentID'];
+                $attachStdHandled[$k]['LastName'] = $row['LastName'];
+                $attachStdHandled[$k]['FirstName'] = $row['FirstName'];
+                $attachStdHandled[$k]['SecondName'] = $row['SecondName'];
+                $attachStdHandled[$k]['StudentID'] = $row['StudentID'];
+                $attachStdHandled[$k]['GroupID'] = $row['GroupID'];
+                $attachStdHandled[$k]['GradeID'] = $row['GradeID'];
+                $attachStdHandled[$k]['GradeNum'] = $row['GradeNum'];
+                $attachStdHandled[$k]['GroupNum'] = $row['GroupNum'];
+                $attachStdHandled[$k]['Degree'] = $row['Degree'];
+            }
+            else
+            {
+                if ($row['GroupID'] != $groupID) {
+                    $groupID = $row['GroupID'];
+                    $i++;
+                    $j = 0;
+                    $stdHandled[$i]['GroupID'] = $row['GroupID'];
+                    $stdHandled[$i]['GradeID'] = $row['GradeID'];
+                    $stdHandled[$i]['GradeNum'] = $row['GradeNum'];
+                    $stdHandled[$i]['GroupNum'] = $row['GroupNum'];
+                    $stdHandled[$i]['Degree'] = DataArray::factory('Students')->getDegreeTitle($row['Degree']);
+                    $stdHandled[$i]['StdCount'];
+                }
+                $j = $stdHandled[$i]['StdCount'] += 1;
+                $stdHandled[$i][$j]['StudentID'] = $row['StudentID'];
+                $stdHandled[$i][$j]['LastName'] = $row['LastName'];
+                $stdHandled[$i][$j]['FirstName'] = $row['FirstName'];
+                $stdHandled[$i][$j]['SecondName'] = $row['SecondName'];
+                $stdHandled[$i][$j]['Type'] = $row['Type'];
+            }
+
+        }
+        $twig->Students = $stdHandled;
+        $twig->AttachStudents = $attachStdHandled;
+
 		$this->response->body($twig);
 	}
 	
diff --git a/~dev_rating/application/classes/DataArr/Students.php b/~dev_rating/application/classes/DataArr/Students.php
index 364fd9323b904df380cdf63d1d849cdc6696e7ac..c7af5bbddb831984d03fcb4a1b9435e7a312e460 100644
--- a/~dev_rating/application/classes/DataArr/Students.php
+++ b/~dev_rating/application/classes/DataArr/Students.php
@@ -31,7 +31,7 @@ class DataArr_Students {
         return new DataArray_Result($this->generateArray($students));
     }
     
-    protected function getDegreeTitle($degree)
+    public function getDegreeTitle($degree)
     {
         switch($degree)
         {
@@ -72,52 +72,6 @@ class DataArr_Students {
         return $studentsHandled;
     }
 
-    public function forDiscipline($TeacherID, $DisciplineID)
-    {
-        $students = $this->model->getStudentsForDiscipline($TeacherID, $DisciplineID);
-        $stdHandled = array();
-        $detachStdHandled = array();
-        $groupID = 0; $i = 0; $k = 0;
-        foreach($students as $row) {
-            if ($row['Type'] == 'detach'){
-                $k++;
-                $detachStdHandled['StdCount'] += 1;
-                $detachStdHandled[$k]['StudentID'] = $row['StudentID'];
-                $detachStdHandled[$k]['LastName'] = $row['LastName'];
-                $detachStdHandled[$k]['FirstName'] = $row['FirstName'];
-                $detachStdHandled[$k]['SecondName'] = $row['SecondName'];
-                $detachStdHandled[$k]['StudentID'] = $row['StudentID'];
-                $detachStdHandled[$k]['GroupID'] = $row['GroupID'];
-                $detachStdHandled[$k]['GradeID'] = $row['GradeID'];
-                $detachStdHandled[$k]['GradeNum'] = $row['GradeNum'];
-                $detachStdHandled[$k]['GroupNum'] = $row['GroupNum'];
-                $detachStdHandled[$k]['Degree'] = $row['Degree'];
-            }
-            else
-            {
-                if ($row['GroupID'] != $groupID) {
-                    $groupID = $row['GroupID'];
-                    $i++;
-                    $j = 0;
-                    $stdHandled[$i]['GroupID'] = $row['GroupID'];
-                    $stdHandled[$i]['GradeID'] = $row['GradeID'];
-                    $stdHandled[$i]['GradeNum'] = $row['GradeNum'];
-                    $stdHandled[$i]['GroupNum'] = $row['GroupNum'];
-                    $stdHandled[$i]['Degree'] = $this->getDegreeTitle($row['Degree']);
-                    $stdHandled[$i]['StdCount'];
-                }
-                $j = $stdHandled[$i]['StdCount'] += 1;
-                $stdHandled[$i][$j]['StudentID'] = $row['StudentID'];
-                $stdHandled[$i][$j]['LastName'] = $row['LastName'];
-                $stdHandled[$i][$j]['FirstName'] = $row['FirstName'];
-                $stdHandled[$i][$j]['SecondName'] = $row['SecondName'];
-                $stdHandled[$i][$j]['Type'] = $row['Type'];
-            }
-
-        }
-        return new DataArray_Result($this->generateArray($students));
-    }
-
     public function NotAttendingDiscipline($GradeID, $GroupN, $FacultyID, $Last, $First, $Second, $DisciplineID)
     {
         $students = $this->model->getStudentsNotAttendingDiscipline($GradeID, $GroupN, $FacultyID, $Last, $First, $Second, $DisciplineID);
diff --git a/~dev_rating/application/classes/Model/Teacher/Map.php b/~dev_rating/application/classes/Model/Teacher/Map.php
index 67cd3dfc6117f4f4924e85c21163162cbb4c18df..44b7fd8c9d6752509c81fb051b886e2f3a53e932 100644
--- a/~dev_rating/application/classes/Model/Teacher/Map.php
+++ b/~dev_rating/application/classes/Model/Teacher/Map.php
@@ -4,6 +4,13 @@ class Model_Teacher_Map extends Model
 {
 
 
+    public function getStudentsForDiscipline($teacherID, $disciplineID)
+    {
+        $sql = "CALL `getStudentsForDiscipline`('$teacherID', '$disciplineID'); ";
+        return DB::query(Database::SELECT, $sql)->execute();
+    }
+
+
     public function addModuleBonus($teacherID, $disciplineID)
     {
         $sql = "SELECT `AddModuleBonus`('$teacherID', '$disciplineID') AS `Num`;";
diff --git a/~dev_rating/application/views/teacher/discipline/EditStudents.twig b/~dev_rating/application/views/teacher/discipline/EditStudents.twig
index 26a6f580a2e71d07f33c74d1f3063973c33c779b..e65d575b6fb4340beb44100966232aa33ef27df1 100644
--- a/~dev_rating/application/views/teacher/discipline/EditStudents.twig
+++ b/~dev_rating/application/views/teacher/discipline/EditStudents.twig
@@ -20,6 +20,7 @@
 {% import 'teacher/discipline/EditStudents' as idx %}
 
 {% block map_content %}
+
 <div class="StudentsList">
 	<input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}">
 	<div class="AttachedStudentsList">