From a05d7e198e8c554334a3d7b025bffcfc24a227d9 Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.Silence@gmail.com> Date: Wed, 11 Feb 2015 23:50:20 +0300 Subject: [PATCH] FIX: --- db/StoredProcedures.sql | 18 +++++++++--------- db/Views.sql | 6 ++++-- .../classes/Controller/Handler/Map.php | 6 +++--- .../classes/Controller/Teacher/Discipline.php | 6 +++--- .../application/classes/DataArr/Students.php | 5 ++--- .../views/teacher/discipline/EditStudents.twig | 2 +- .../modules/account/classes/Kohana/User.php | 2 ++ .../account/classes/Model/Kohana/Account.php | 12 ++++++------ 8 files changed, 30 insertions(+), 27 deletions(-) diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index d2f0dc8a5..d31ac441c 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -833,7 +833,7 @@ BEGIN # type 1: student # 2: teacher - IF vAccountType = 'student' THEN + IF vAccountType = 1 THEN SELECT view_students.LastName, view_students.FirstName, view_students.SecondName, @@ -1404,11 +1404,11 @@ NO SQL view_students.LastName, view_students.FirstName, view_students.SecondName, - view_students.GradeID, - view_students.GradeNum, - view_students.Degree, - view_students.GroupID, - view_students.GroupNum + view_students.GradeID, + view_students.GradeNum, + view_students.Degree, + view_students.GroupID, + view_students.GroupNum FROM `view_students` LEFT JOIN `disciplines_students` ON disciplines_students.StudentID = view_students.StudentID AND disciplines_students.DisciplineID = pDisciplineID @@ -2180,7 +2180,7 @@ BEGIN INTO vChecker FROM `disciplines_groups` WHERE disciplines_groups.GroupID = pGroupID AND - disciplines_groups.DisciplineID = pGroupID + disciplines_groups.DisciplineID = pDisciplineID LIMIT 1; IF vChecker > 0 THEN RETURN 1; @@ -2664,7 +2664,7 @@ BEGIN INSERT INTO `modules` (Name, OrderNum, DisciplineID ) - VALUES (Name , vChecker , DisciplineID ); + VALUES (Name , vChecker , pDisciplineID ); RETURN (SELECT modules.ID @@ -2701,7 +2701,7 @@ BEGIN INSERT INTO `modules` ( Name, OrderNum, DisciplineID, Type ) - VALUES ( 'Ркзамен' , 3141692 , DisciplineID, 2 ); + VALUES ( 'Ркзамен' , 3141692 , pDisciplineID, 2 ); SELECT modules.ID INTO vModule diff --git a/db/Views.sql b/db/Views.sql index f99c041fc..037093a55 100644 --- a/db/Views.sql +++ b/db/Views.sql @@ -140,8 +140,10 @@ CREATE OR REPLACE VIEW `view_rating` AS rating_table.Date, rating_table.TeacherID FROM `view_roadmap` - LEFT JOIN `rating_table` ON rating_table.SubmoduleID = view_roadmap.SubmoduleID - INNER JOIN `view_students` ON rating_table.StudentID = view_students.StudentID; + LEFT JOIN `view_disciplines_students` ON view_disciplines_students.DisciplineID = view_roadmap.DisciplineID + LEFT JOIN `rating_table` ON rating_table.SubmoduleID = view_roadmap.SubmoduleID AND + rating_table.StudentID = view_disciplines_students.StudentID + LEFT JOIN `view_students` ON rating_table.StudentID = view_students.StudentID; diff --git a/~dev_rating/application/classes/Controller/Handler/Map.php b/~dev_rating/application/classes/Controller/Handler/Map.php index 96ba7e674..89ba45892 100644 --- a/~dev_rating/application/classes/Controller/Handler/Map.php +++ b/~dev_rating/application/classes/Controller/Handler/Map.php @@ -538,9 +538,9 @@ class Controller_Handler_Map extends Controller_Handler { foreach($SeResult as $row){ $i++; $SearchResult[$i]['TeacherID'] = $row['ID']; - $SearchResult[$i]['TeacherLast'] = $row['Last']; - $SearchResult[$i]['TeacherFirst'] = $row['First']; - $SearchResult[$i]['TeacherSecond'] = $row['Second']; + $SearchResult[$i]['TeacherLast'] = $row['LastName']; + $SearchResult[$i]['TeacherFirst'] = $row['FirstName']; + $SearchResult[$i]['TeacherSecond'] = $row['SecondName']; $SearchResult[$i]['JobPositionName'] = $row['JobPositionName']; $SearchResult[$i]['DepID'] = $row['DepID']; } diff --git a/~dev_rating/application/classes/Controller/Teacher/Discipline.php b/~dev_rating/application/classes/Controller/Teacher/Discipline.php index a7d2929c1..29dc6b821 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Discipline.php +++ b/~dev_rating/application/classes/Controller/Teacher/Discipline.php @@ -76,7 +76,7 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { $i = 0; $k = 0; foreach($students as $row) { - if ($row['Type'] == 'attach'){ + if ($row['AttachType'] == 'attach'){ if ($row['GroupID'] != $groupID) { $groupID = $row['GroupID']; $k++; @@ -92,7 +92,7 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { $attachStdHandled[$k]['students'][$n]['LastName'] = $row['LastName']; $attachStdHandled[$k]['students'][$n]['FirstName'] = $row['FirstName']; $attachStdHandled[$k]['students'][$n]['SecondName'] = $row['SecondName']; - $attachStdHandled[$k]['students'][$n]['Type'] = $row['Type']; + $attachStdHandled[$k]['students'][$n]['AttachType'] = $row['AttachType']; // $k++; // $attachStdHandled['StdCount'] += 1; @@ -124,7 +124,7 @@ class Controller_Teacher_Discipline extends Controller_UserEnvi { $stdHandled[$i]['students'][$j]['LastName'] = $row['LastName']; $stdHandled[$i]['students'][$j]['FirstName'] = $row['FirstName']; $stdHandled[$i]['students'][$j]['SecondName'] = $row['SecondName']; - $stdHandled[$i]['students'][$j]['Type'] = $row['Type']; + $stdHandled[$i]['students'][$j]['AttachType'] = $row['AttachType']; } } diff --git a/~dev_rating/application/classes/DataArr/Students.php b/~dev_rating/application/classes/DataArr/Students.php index 4b507cb9b..8156ae7b6 100644 --- a/~dev_rating/application/classes/DataArr/Students.php +++ b/~dev_rating/application/classes/DataArr/Students.php @@ -58,16 +58,14 @@ class DataArr_Students { { $i++; $studentsHandled[$i]['ID'] = $row['ID']; - $studentsHandled[$i]['AccountID'] = $row['AccountID']; $studentsHandled[$i]['LastName'] = $row['LastName']; $studentsHandled[$i]['FirstName'] = $row['FirstName']; - $studentsHandled[$i]['SecondName'] = $row['Second']; + $studentsHandled[$i]['SecondName'] = $row['SecondName']; $studentsHandled[$i]['GroupID'] = $row['GroupID']; $studentsHandled[$i]['GroupNum'] = $row['GroupNum']; $studentsHandled[$i]['GradeID'] = $row['GradeID']; // ID РєСѓСЂСЃР° $studentsHandled[$i]['GradeNum'] = $row['GradeNum']; // НОМЕРкурса, Р° РЅРµ ID... ID почти всегда <> НОМЕРУ РєСѓСЂСЃР° $studentsHandled[$i]['Degree'] = $this->getDegreeTitle($row['Degree']); - $studentsHandled[$i]['Type'] = $row['Type']; } return $studentsHandled; } @@ -75,6 +73,7 @@ class DataArr_Students { public function NotAttendingDiscipline($GradeID, $GroupID, $FacultyID, $Name, $DisciplineID) { $students = $this->model->SearchStudents($GradeID, $GroupID, $FacultyID, $Name, $DisciplineID); + //echo Debug::vars($students); return new DataArray_Result($this->generateArray($students)); } } diff --git a/~dev_rating/application/views/teacher/discipline/EditStudents.twig b/~dev_rating/application/views/teacher/discipline/EditStudents.twig index 89083d9a8..2a026fac7 100644 --- a/~dev_rating/application/views/teacher/discipline/EditStudents.twig +++ b/~dev_rating/application/views/teacher/discipline/EditStudents.twig @@ -10,7 +10,7 @@ {% macro outputStudent(Student) %} <div id="{{ Student.ID }}" class="Student {% if Student.Type == 'detach' %}StatusUnbind{% else %}StatusBind{% endif %}"> <span class="Name">{{ Student.LastName }} {{ Student.FirstName }} {{ Student.SecondName }}</span> - {% if Student.Type == 'detach' %} + {% if Student.AttachType == 'detach' %} <button class="action Action_BindStudent">Прикрепить студента</button> {% else %} <button class="action Action_UnbindStudent">Отсоединить студента</button> diff --git a/~dev_rating/modules/account/classes/Kohana/User.php b/~dev_rating/modules/account/classes/Kohana/User.php index 4bbb05f51..5336e6bb2 100644 --- a/~dev_rating/modules/account/classes/Kohana/User.php +++ b/~dev_rating/modules/account/classes/Kohana/User.php @@ -253,6 +253,8 @@ class Kohana_User implements ArrayAccess { { if($this->isSignedIn()) return $this->_userInfo + $this->_session->as_array(); + else + return array(); } protected function _getInfoFromDB($id) diff --git a/~dev_rating/modules/account/classes/Model/Kohana/Account.php b/~dev_rating/modules/account/classes/Model/Kohana/Account.php index 1ac848c06..76326a0df 100644 --- a/~dev_rating/modules/account/classes/Model/Kohana/Account.php +++ b/~dev_rating/modules/account/classes/Model/Kohana/Account.php @@ -22,23 +22,23 @@ class Model_Kohana_Account extends Model return $res->get('ID'); } - public function ChangeTeacherInfo($id, $lastName, $firstName, $secondName, $degreeID, $departamentID) + public function ChangeTeacherInfo($id, $lastName, $firstName, $secondName, $degreeID, $departmentID) { - $sql = "SELECT `ChangeTeacherInfo`('$id', '$lastName', '$firstName', '$secondName', '$degreeID', '$departamentID') AS `UserID`;"; + $sql = "SELECT `ChangeTeacherInfo`('$id', '$lastName', '$firstName', '$secondName', '$degreeID', '$departmentID') AS `UserID`;"; $key = DB::query(Database::SELECT, $sql)->execute(); return $key->get('UserID'); } - public function createTeacher($lastName, $firstName, $secondName, $degreeID, $departamentID, $activationCode) + public function createTeacher($lastName, $firstName, $secondName, $degreeID, $departmentID, $activationCode) { - $sql = "SELECT `CreateTeacher`('$lastName', '$firstName', '$secondName', '$degreeID', '$departamentID', '$activationCode') AS `UserID`;"; + $sql = "SELECT `CreateTeacher`('$lastName', '$firstName', '$secondName', '$degreeID', '$departmentID', '$activationCode') AS `UserID`;"; $key = DB::query(Database::SELECT, $sql)->execute(); return $key->get('UserID'); } - public function createTeacherByDepName($lastName, $firstName, $secondName, $departamentName, $activationCode) + public function createTeacherByDepName($lastName, $firstName, $secondName, $departmentName, $activationCode) { - $sql = "SELECT `CreateTeacherByDepName`('$lastName', '$firstName', '$secondName', '$departamentName', '$activationCode') AS `UserID`;"; + $sql = "SELECT `CreateTeacherByDepName`('$lastName', '$firstName', '$secondName', '$departmentName', '$activationCode') AS `UserID`;"; $key = DB::query(Database::SELECT, $sql)->execute(); return $key->get('UserID'); } -- GitLab