diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index bfe8da4440f9c38c61af2213c7104194067e7b06..9a43f31a01e48da0b7e0dea32a93d06ae804e378 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -1187,6 +1187,30 @@ BEGIN view_roadmap.SubmoduleOrderNum ASC; END // +DROP PROCEDURE IF EXISTS mmcs_rating.GetRatesHistory// +CREATE PROCEDURE `GetRatesHistory` ( + IN `pDisciplineID` INT +) NO SQL +BEGIN + SELECT logs_rating.ID, + logs_rating.Date, + logs_rating.Rate, + students.LastName AS 'StudentLast', + students.FirstName AS 'StudentFirst', + students.SecondName AS 'StudentSecond', + teachers.LastName AS 'TeacherLast', + teachers.FirstName AS 'TeacherFirst', + teachers.SecondName AS 'TeacherSecond', + submodules.Name AS 'SubmoduleName', + modules.Name AS 'ModuleName' + FROM `logs_rating` + INNER JOIN `students` ON students.ID = logs_rating.StudentID + INNER JOIN `teachers` ON teachers.ID = logs_rating.TeacherID + INNER JOIN `submodules` ON submodules.ID = logs_rating.SubmoduleID + INNER JOIN `modules` ON modules.ID = submodules.ModuleID + WHERE modules.DisciplineID = pDisciplineID; +END // + DROP PROCEDURE IF EXISTS GetAttestationData// CREATE PROCEDURE `GetAttestationData` ( IN `pDisciplineID` INT, @@ -1396,4 +1420,4 @@ BEGIN LIMIT 1; END // -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/~dev_rating/application/bootstrap.php b/~dev_rating/application/bootstrap.php index f4552773a8f75b434235f006c6c0038b474474f6..a5ca469c961061a114d694aed5c703669a19c2ef 100644 --- a/~dev_rating/application/bootstrap.php +++ b/~dev_rating/application/bootstrap.php @@ -259,12 +259,12 @@ Route::set('discipline:edit', 'discipline/<id>((/)<section>)', ['id' => '\d+']) ]); # discipline rate table -Route::set('teacher:rating', '<type>/<id>', ['type' => '(rate|exam)', 'id' => '[0-9]+']) - ->defaults(array( - 'directory' => 'teacher', +Route::set('teacher:rating', '<type>/<id>', ['type' => '(rate|exam|history)', 'id' => '[0-9]+']) + ->defaults([ + 'directory' => 'teacher', 'controller' => 'rating', - 'action' => 'rate' - )); + 'action' => 'rate' + ]); // --------------- Администрирование ---------------- Route::set('admin:common', 'admin(/<controller>(/<action>(/<param1>(:<param2>))))') diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php index d59698fcecd6703a41be91fa9115661e110cb0ae..c4c2e1bfd048f5bebe453aa15ee8d2b3ece6092a 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Rating.php +++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php @@ -19,8 +19,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher } - private static function getTitle($pageType, $try, &$module) - { + private static function getTitle($pageType, $try, &$module) { if ($pageType == 'rate') { $title = $module['SubmoduleName']; } else if ($module['ModuleType'] == 'extra') { @@ -142,7 +141,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher foreach ($rateList as $curRate) { $moduleType = $curRate['ModuleType']; - if ( $moduleType == 'exam' || $moduleType == 'extra' ) { + if ($moduleType == 'exam' || $moduleType == 'extra') { $curStudent['Rates'][$rowIndex] = [ 'SubmoduleID' => $curRate['SubmoduleID'], 'Rate' => $curRate['Rate'], @@ -153,7 +152,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher $points = $curRate['Rate']; - switch ( $moduleType ) { + switch ($moduleType) { case 'regular': $curStudent['RateSemesterResult'] += $points; break; @@ -208,13 +207,24 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher $this->correctExtra($curStudent, $examType, $lastExtraIndex, $firstEmptyExtra, $rateExtra); } + private function showRatingHistory($disciplineID) { + $this->twig->set([ + 'log' => Model_Rating::getHistory($disciplineID), + ])->set_filename('teacher/history'); + } + /** - * @param $page_type : rating, exam * @throws HTTP_Exception */ protected function action_rate() { $id = $this->request->param('id'); - $pageType = $this->request->param('type'); // 'rate', 'exam' + $pageType = $this->request->param('type'); // 'rate', 'exam', 'history' + + if ($pageType == 'history') { + $this->showRatingHistory($id); + return; + } + $discipline = Model_Discipline::load($id); $discipline['GroupID_Filter'] = $this->getFilterGroupID($id); @@ -261,6 +271,4 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher ])->set_filename("teacher/" . $twigType); } - } - \ No newline at end of file diff --git a/~dev_rating/application/classes/Model/Rating.php b/~dev_rating/application/classes/Model/Rating.php index 93ad758912649bc57be7299aa0024b87c247c748..5a042dd4d4535af48c848531949227008c4d14bd 100644 --- a/~dev_rating/application/classes/Model/Rating.php +++ b/~dev_rating/application/classes/Model/Rating.php @@ -105,6 +105,13 @@ class Model_Rating extends Model return (int) $res->get('res'); } + public static function getHistory($discipline) { + $sql = "CALL `GetRatesHistory`(:discipline)"; + return DB::query(Database::SELECT, $sql) + ->param(':discipline', $discipline) + ->execute(); + } + public static function setExamPeriodOption($student, $submodule, $option) { // option is absence or pass or null $sql = "SELECT `SetExamPeriodOption`(:student, :submodule, :option) As `ErrorCode`"; diff --git a/~dev_rating/application/views/teacher/history.twig b/~dev_rating/application/views/teacher/history.twig new file mode 100644 index 0000000000000000000000000000000000000000..3bdf0832de14b824d0ab833049ee83087fcf08e8 --- /dev/null +++ b/~dev_rating/application/views/teacher/history.twig @@ -0,0 +1,9 @@ +{# TODO: user interface #} + +<html> +<body> + <pre> + {{ Text.dump(logs) }} + </pre> +</body> +</html>