From 3e9585db234edaf98ada20ef489b8d1c5a67f154 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D1=83=D0=B4?=
 =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D1=86?= <andrey.rudenets@gmail.com>
Date: Wed, 17 Sep 2014 15:52:07 +0400
Subject: [PATCH] =?UTF-8?q?FIX:=20=D0=BA=D0=B0=D1=84=D0=B5=D0=B4=D1=80?=
 =?UTF-8?q?=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../classes/Controller/Handler/Settings.php        | 14 +-------------
 .../classes/Controller/Teacher/Profile.php         |  2 +-
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/~dev_rating/application/classes/Controller/Handler/Settings.php b/~dev_rating/application/classes/Controller/Handler/Settings.php
index 2413000c7..22c567957 100644
--- a/~dev_rating/application/classes/Controller/Handler/Settings.php
+++ b/~dev_rating/application/classes/Controller/Handler/Settings.php
@@ -79,19 +79,7 @@ class Controller_Handler_Settings extends Controller_Handler {
         public function action_getDepartmentsList()
         {
             $facultyID = $this->post->offsetGet('facultyID');
-            if($facultyID != 0)
-            {
-                $model = new Model_Admin_Teachers;
-                $departaments = $model->getDepartmentsByFaculty($facultyID);
-                $departamentsHandled = array(); $i = 0;
-                foreach($departaments as $row)
-                {
-                    $i++;
-                    $departamentsHandled[$i]['ID'] = $row['DepID'];
-                    $departamentsHandled[$i]['Name'] = $row['DepName'];
-                }
-                $this->response->body(json_encode($departamentsHandled));
-            }
+            DataArray::factory('Departments')->byFaculty($facultyID)->asArray();
         }
         
         public function action_changeEMail()
diff --git a/~dev_rating/application/classes/Controller/Teacher/Profile.php b/~dev_rating/application/classes/Controller/Teacher/Profile.php
index ebbed6967..c55ac8b73 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Profile.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Profile.php
@@ -6,7 +6,7 @@ class Controller_Teacher_Profile extends Controller_UserEnvi {
         $twig = Twig::factory('profile/settings');
         $twig->JobPositions = $this->getJobPositions();
         $twig->Faculties = $this->getFaculties();
-        $twig->Departments = DataArray::factory('Departments')->byFaculty($this->UserInfo['FacultyID']);
+        $twig->Departments = DataArray::factory('Departments')->byFaculty($this->UserInfo['FacultyID'])->asArray();
         $twig->User = $this->UserInfo;
         $this->response->body($twig);
     }
-- 
GitLab