Skip to content
Snippets Groups Projects
Commit 1a01ba21 authored by xamgore's avatar xamgore
Browse files

Removed `create` method from Semesters model

parent 0467a6d3
Branches
Tags
No related merge requests found
...@@ -20,7 +20,7 @@ class Controller_Student_Index extends Controller_UserEnvi { ...@@ -20,7 +20,7 @@ class Controller_Student_Index extends Controller_UserEnvi {
$twig->disciplines = $list; $twig->disciplines = $list;
$twig->User = $this->UserInfo; $twig->User = $this->UserInfo;
$twig->Semester = $this->SemesterInfo; $twig->Semester = $this->SemesterInfo;
$twig->SemesterList = Model_Semesters::create()->getList(); $twig->SemesterList = Model_Semesters::toArray();
$this->response->body($twig); $this->response->body($twig);
} }
......
...@@ -41,7 +41,7 @@ class Controller_Teacher_Index extends Controller_UserEnvi { ...@@ -41,7 +41,7 @@ class Controller_Teacher_Index extends Controller_UserEnvi {
$disciplinesHandled[$i]['Disciplines'][$j]['Groups'] = implode(', ', $groupsInDiscipline); $disciplinesHandled[$i]['Disciplines'][$j]['Groups'] = implode(', ', $groupsInDiscipline);
} //!for_each } //!for_each
$twig->Subjects = $disciplinesHandled; $twig->Subjects = $disciplinesHandled;
$twig->SemesterList = Model_Semesters::create()->getList(); $twig->SemesterList = Model_Semesters::toArray();
$twig->Semester = $this->SemesterInfo; $twig->Semester = $this->SemesterInfo;
$twig->User = $this->UserInfo; $twig->User = $this->UserInfo;
$this->response->body($twig); $this->response->body($twig);
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
class Model_Semesters extends Model class Model_Semesters extends Model
{ {
public static function create() {
return new self();
}
/** /**
* @param $id int semester id * @param $id int semester id
* @return array data from <tt>semesters</tt> table * @return array data from <tt>semesters</tt> table
...@@ -15,13 +11,13 @@ class Model_Semesters extends Model ...@@ -15,13 +11,13 @@ class Model_Semesters extends Model
return DB::query(Database::SELECT, $sql)->execute()->offsetGet(0); return DB::query(Database::SELECT, $sql)->execute()->offsetGet(0);
} }
public function getSemesters() { public static function getSemesters() {
$sql = "CALL `GetSemesters`()"; $sql = "CALL `GetSemesters`()";
return DB::query(Database::SELECT, $sql)->execute(); return DB::query(Database::SELECT, $sql)->execute();
} }
public function getList() { public static function toArray() {
$semesters = $this->getSemesters(); $semesters = self::getSemesters();
$list = array(); $list = array();
foreach ($semesters as $row) { foreach ($semesters as $row) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment