From d77e319a24472b200265d4191385716eaf9ebae7 Mon Sep 17 00:00:00 2001
From: xamgore <xamgore@ya.ru>
Date: Tue, 23 Jun 2015 19:11:24 +0300
Subject: [PATCH] Simplified method Model_Rating::getFinalFormInfo()

---
 .../classes/Controller/Handler/FileCreator.php     | 14 +++++++-------
 .../classes/Controller/Handler/XMLCreator.php      |  2 +-
 ~dev_rating/application/classes/Model/Rating.php   |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/~dev_rating/application/classes/Controller/Handler/FileCreator.php b/~dev_rating/application/classes/Controller/Handler/FileCreator.php
index 296b1e5fc..7b4541be3 100644
--- a/~dev_rating/application/classes/Controller/Handler/FileCreator.php
+++ b/~dev_rating/application/classes/Controller/Handler/FileCreator.php
@@ -201,7 +201,7 @@ class Controller_Handler_FileCreator extends Controller_Handler
         $stage = $this->post['stage'];
 
         // make form from template
-        $info = Model_Rating::getFinalFormInfo($disciplineID, $groupID)[0];
+        $info = Model_Rating::getFinalFormInfo($disciplineID, $groupID);
         $info['DisciplineID'] = $disciplineID;
         $this->printDisciplineToExcelFile($objPHPExcel, $disciplineID, $groupID, $info, $stage);
 
@@ -602,7 +602,7 @@ class Controller_Handler_FileCreator extends Controller_Handler
 
         foreach ($listDisciplines as $discipline) {
                 $info = Model_Rating::getFinalFormInfo($discipline->ID, $groupID);
-                $type = $info[0]['ExamType'];
+                $type = $info['ExamType'];
                 if ($type == 'exam') {
                     continue;
                 }
@@ -616,7 +616,7 @@ class Controller_Handler_FileCreator extends Controller_Handler
                         //make clone from page copy and include it in workbook
                         $C = clone $sheetTemplate;
                         try {
-                            $C->setTitle($this->getSheetName($info[0]));
+                            $C->setTitle($this->getSheetName($info));
                         } catch (Exception $ex) {
                             $C->setTitle("Без_имени_".$index);
                         }
@@ -633,15 +633,15 @@ class Controller_Handler_FileCreator extends Controller_Handler
                 else
                 {
                     try {
-                        $objPHPExcel->setActiveSheetIndex($index)->setTitle($this->getSheetName($info[0]));
+                        $objPHPExcel->setActiveSheetIndex($index)->setTitle($this->getSheetName($info));
                     } catch (Exception $ex) {
                         $objPHPExcel->setActiveSheetIndex($index)->setTitle("Без_имени_".$index);
                     }
-                    $gradeNum = $info[0]['GradeNum'];
-                    $groupNum = $info[0]['GroupNum'];
+                    $gradeNum = $info['GradeNum'];
+                    $groupNum = $info['GroupNum'];
                 }
 
-                $this->printDisciplineToExcelFile($objPHPExcel, $discipline->ID, $groupID, $info[0]);
+                $this->printDisciplineToExcelFile($objPHPExcel, $discipline->ID, $groupID, $info);
                 $index++;
         }
 
diff --git a/~dev_rating/application/classes/Controller/Handler/XMLCreator.php b/~dev_rating/application/classes/Controller/Handler/XMLCreator.php
index 3f0e5fcdd..215d8b760 100644
--- a/~dev_rating/application/classes/Controller/Handler/XMLCreator.php
+++ b/~dev_rating/application/classes/Controller/Handler/XMLCreator.php
@@ -9,7 +9,7 @@ class Controller_Handler_XMLCreator extends Controller_Handler
         $groupID = $this->post['studyGroupID'];
 
         // make form from template
-        $info = Model_Rating::getFinalFormInfo($disciplineID, $groupID)[0];
+        $info = Model_Rating::getFinalFormInfo($disciplineID, $groupID);
         $info['DisciplineID'] = $disciplineID;
 
         // prepare filename
diff --git a/~dev_rating/application/classes/Model/Rating.php b/~dev_rating/application/classes/Model/Rating.php
index 9d2707a1c..5fb3c9f7a 100644
--- a/~dev_rating/application/classes/Model/Rating.php
+++ b/~dev_rating/application/classes/Model/Rating.php
@@ -106,7 +106,7 @@ class Model_Rating extends Model
             ->parameters([
                 ':discipline' => $discipline,
                 ':group'      => $group,
-            ])->execute();
+            ])->execute()[0];
     }
 
     /**
-- 
GitLab