From 4d4c5abd23b585d07f5ea4d398010da0742787e6 Mon Sep 17 00:00:00 2001
From: Shalimov Anton <solidovic@yandex.ru>
Date: Thu, 28 Aug 2014 01:30:13 +0400
Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?=
 =?UTF-8?q?=D1=83=D0=B5=D1=82=D1=81=D1=8F=20GetStudyGroupsOrdByGroups,=20?=
 =?UTF-8?q?=D0=B0=20=D0=BD=D0=B5=20GetStudyGroups?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../classes/Controller/Handler/Map.php           | 16 ++++++++--------
 .../classes/Controller/Teacher/Map.php           |  6 +++---
 .../application/classes/Model/Teacher/Map.php    |  6 ++++++
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/~dev_rating/application/classes/Controller/Handler/Map.php b/~dev_rating/application/classes/Controller/Handler/Map.php
index c91471871..d7b7387a5 100644
--- a/~dev_rating/application/classes/Controller/Handler/Map.php
+++ b/~dev_rating/application/classes/Controller/Handler/Map.php
@@ -364,7 +364,7 @@ class Controller_Handler_Map extends Controller_Handler {
 			$this->response->body(json_encode($data));
 		}
 		
-		/*
+		
 		public function action_SearchStudents() {
 			$data['result'] = false;
 			$this->post -> rule('Grade', 'digit')
@@ -372,19 +372,19 @@ class Controller_Handler_Map extends Controller_Handler {
 						-> rule('FacultyID', 'digit');
 			if($this->post->check()) {	
 				$SeResult = $this->model->SearchStudents(
-					$this->post->offsetGet('Grade', 'null'),
-					$this->post->offsetGet('GroupN', 'null'),
-					$this->post->offsetGet('FacultyID', 'null'),
-					$this->post->offsetGet('Last', 'null'),
-					$this->post->offsetGet('First', 'null'),
-					$this->post->offsetGet('Second', 'null')
+					$this->post->offsetGet('Grade'),
+					$this->post->offsetGet('GroupN'),
+					$this->post->offsetGet('FacultyID'),
+					$this->post->offsetGet('Last'),
+					$this->post->offsetGet('First'),
+					$this->post->offsetGet('Second')
 				); 
 					
 				var_dump($this->post->offsetGet($SeResult));
 			}
 			$this->response->body(json_encode($data));
 		}
-		*/
+		
 		
 		// Прикрепить преподавателя 
 		public function action_BindTeacher() {
diff --git a/~dev_rating/application/classes/Controller/Teacher/Map.php b/~dev_rating/application/classes/Controller/Teacher/Map.php
index c4970febe..71e839f40 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Map.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Map.php
@@ -97,7 +97,7 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
 		$twig->User = $this->UserInfo;
 		$twig->Discipline = $this->getDisciplineInfo($db, $id);
 		$twig->GroupsForDiscipline = $this->GetGroupsForDiscipline($db, $id);
-		$twig->StudyGroups = $this->GetStudyGroups($db, $this->GradeID, $this->UserInfo['FacultyID']);
+		$twig->StudyGroups = $this->GetStudyGroupsOrdByGroups($db, $this->GradeID, $twig->Discipline['FacultyID']);
 		
 		$this->response->body($twig);
 	}
@@ -272,8 +272,8 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
         return $studentsHandled;
 	}
 	
-	private function GetStudyGroups($db, $Grade, $FacultyID) {
-		$Groups = $db->GetStudyGroups($Grade, $FacultyID);
+	private function GetStudyGroupsOrdByGroups($db, $Grade, $FacultyID) {
+		$Groups = $db->GetStudyGroupsOrdByGroups($Grade, $FacultyID);
 		$GroupsHandled = array();
 		$i = 0;
 		
diff --git a/~dev_rating/application/classes/Model/Teacher/Map.php b/~dev_rating/application/classes/Model/Teacher/Map.php
index db47747a6..5d06e178b 100644
--- a/~dev_rating/application/classes/Model/Teacher/Map.php
+++ b/~dev_rating/application/classes/Model/Teacher/Map.php
@@ -134,6 +134,12 @@ class Model_Teacher_Map extends Model
         return DB::query(Database::SELECT, $sql)->execute();
     }
 	
+    public function GetStudyGroupsOrdByGroups($Grade, $FacultyID)
+    {
+        $sql = "CALL `GetStudyGroupsOrdByGroups`('$Grade', '$FacultyID'); ";
+        return DB::query(Database::SELECT, $sql)->execute();
+    }
+	
     public function ChangeModuleOrder($teacherID, $moduleID, $OrderNum)
     {
 		$sql = "SELECT `ChangeModuleOrder`('$teacherID', '$moduleID', '$OrderNum') AS `Num`;";
-- 
GitLab