diff --git a/~dev_rating/application/classes/Controller/Student/Subject.php b/~dev_rating/application/classes/Controller/Student/Subject.php index 394c09e014d4fd98e32be0fab573848fc9d4b3f1..2f6b8510a356fecdc0ca9766f01159ba274a5d5d 100644 --- a/~dev_rating/application/classes/Controller/Student/Subject.php +++ b/~dev_rating/application/classes/Controller/Student/Subject.php @@ -28,7 +28,7 @@ class Controller_Student_Subject extends Controller_UserEnvi { $subject['LabCount'] = $info['LabCount']; $subject['DepName'] = $info['DepName']; $subject['Teachers'] = $this->getTeachersForDiscipline($id); - $semester = $db->getSemesterInfo($info['SemesterID']); + $semester = Model_Semesters::getInfo($info['SemesterID']); $semester['Num'] = $semester['Num'] == 1 ? 'Осенний' : 'Весенний'; $subject['Num'] = $semester['Num']; $subject['Year'] = $semester['Year']; diff --git a/~dev_rating/application/classes/Controller/Teacher/Discipline.php b/~dev_rating/application/classes/Controller/Teacher/Discipline.php index dc084a72738f2f7cd0b4eeda5e32a8a9a2cb779f..2e3b8355126badec721698779feb0137f8e007a6 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Discipline.php +++ b/~dev_rating/application/classes/Controller/Teacher/Discipline.php @@ -219,7 +219,7 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { $subject['IsBonus'] = $info['IsBonus']; $subject['SemesterID'] = $info['SemesterID']; - $semester = Model_Semesters::create()->bySemester($subject['SemesterID'])->asArray(); + $semester = Model_Semesters::getInfo($subject['SemesterID']); $subject['SemesterNum'] = $semester['SemesterNum'] == 1 ? 'Осенний' : 'Весенний'; $subject['SemesterYear'] = $semester['SemesterYear']; diff --git a/~dev_rating/application/classes/Controller/UserEnvi.php b/~dev_rating/application/classes/Controller/UserEnvi.php index d90bfd4a0deb84a04337c947b48e793960762ef1..ce27dc64032c8fee139fc5175dbaa727995d38d4 100644 --- a/~dev_rating/application/classes/Controller/UserEnvi.php +++ b/~dev_rating/application/classes/Controller/UserEnvi.php @@ -13,8 +13,7 @@ class Controller_UserEnvi extends Controller { } $this->UserInfo = $user->getInfoAsArray(); - $db = new Model_Student; - $semester = $db->getSemesterInfo($this->UserInfo['SemesterID']); + $semester = Model_Semesters::getInfo($this->UserInfo['SemesterID']); // $semester['Num'] = $semester['Num'] == 1 ? 'Осень' : 'Весна'; if($semester['Num'] == 1) { diff --git a/~dev_rating/application/classes/Model/Semesters.php b/~dev_rating/application/classes/Model/Semesters.php index ffd8ac102a591dd0f0746b6b67bed30322811193..3180f1afb0c3af3ca44b9855539fa8302b17d847 100644 --- a/~dev_rating/application/classes/Model/Semesters.php +++ b/~dev_rating/application/classes/Model/Semesters.php @@ -6,7 +6,11 @@ class Model_Semesters extends Model return new self(); } - public function getSemesterInfo($id) { + /** + * @param $id int semester id + * @return array data from <tt>semesters</tt> table + */ + public static function getInfo($id) { $sql = "CALL `GetSemesterInfo`('$id'); "; return DB::query(Database::SELECT, $sql)->execute()->offsetGet(0); } @@ -16,11 +20,6 @@ class Model_Semesters extends Model return DB::query(Database::SELECT, $sql)->execute(); } - public function bySemester($SemesterID) { - $departments = $this->getSemesterInfo($SemesterID); - return new DataArray_Result($departments); - } - public function getList() { $semesters = $this->getSemesters(); $list = array(); diff --git a/~dev_rating/application/classes/Model/Student.php b/~dev_rating/application/classes/Model/Student.php index 5298123b7d1327b748e4d11d7935e0f88d904f0c..e269a417bdb00a9f416366ddd60ee927483087d9 100644 --- a/~dev_rating/application/classes/Model/Student.php +++ b/~dev_rating/application/classes/Model/Student.php @@ -7,10 +7,4 @@ class Model_Student extends Model $sql = "CALL `GetRates`('$student_id', '$subject_id'); "; return DB::query(Database::SELECT, $sql)->execute(); } - - public function getSemesterInfo($id) // TODO: перенести в common.php - { - $sql = "CALL `GetSemesterInfo`('$id'); "; - return DB::query(Database::SELECT, $sql)->execute()->offsetGet(0); - } }