diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index 8c84f3db06af4ba133dc2d11401f91967a12f876..3ebe064c2e6362398e970d8d6ade43424c13fd00 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -4240,20 +4240,45 @@ BEGIN students.LastName AS 'Last', students.FirstName AS 'First', students.SecondName AS 'Second', + CONCAT(students.LastName, " ", students.FirstName, " ", students.SecondName) AS 'FullName', GetRateForDiscSemester(students.ID, DisciplineID) AS 'intermediate', GetRateForDiscBonus(students.ID, DisciplineID) AS 'bonus', - GetRateForDiscExam(students.ID, DisciplineID) AS 'exam' + GetRateForDiscExam(students.ID, DisciplineID) AS 'exam', + GetRateForDisc(students.ID, DisciplineID) AS 'total' FROM `students` - INNER JOIN `study_groups` ON study_groups.ID = students.StudyGroupID + -- INNER JOIN `study_groups` ON study_groups.ID = students.StudyGroupID -- LEFT JOIN `modules` ON modules.DisciplineID = DisciplineID AND -- (modules.Type = 'exam' OR modules.Type = 'extra') -- LEFT JOIN `submodules` ON submodules.ModuleID = modules.ID - WHERE study_groups.ID = StudyGroupID AND + WHERE students.StudyGroupID = StudyGroupID AND InternalIsStudentAttached(students.ID, DisciplineID) - ORDER BY Last ASC; + ORDER BY FullName ASC, ID ASC; END // +DROP PROCEDURE IF EXISTS GetAttestationData// +CREATE PROCEDURE `GetAttestationData` ( IN `DisciplineID` INT, + IN `StudyGroupID` INT +) +NO SQL +BEGIN + SELECT students.ID AS 'StudentID', + rating_table.Rate As 'Rate', + rating_table.Date As 'Date', + submodules.OrderNum As 'OrderNum', + modules.Type As 'Type' + FROM `students` + LEFT JOIN `modules` ON modules.DisciplineID = DisciplineID AND + (modules.Type = 'exam' OR modules.Type = 'extra') + LEFT JOIN `submodules` ON submodules.ModuleID = modules.ID + LEFT JOIN `rating_table` ON rating_table.SubmoduleID = submodules.ID AND + rating_table.StudentID = students.ID + WHERE students.StudyGroupID = StudyGroupID AND + InternalIsStudentAttached(students.ID, DisciplineID) + ORDER BY CONCAT(students.LastName, " ", students.FirstName, " ", students.SecondName) ASC, + students.ID ASC, modules.Type = 'exam' ASC, submodules.OrderNum ASC; + +END // DROP PROCEDURE IF EXISTS GetFinalFormInfo// diff --git a/~dev_rating/application/classes/Controller/Handler/FileCreator.php b/~dev_rating/application/classes/Controller/Handler/FileCreator.php index 6e1ad25aeedb7d10e6429a630d619ae3657f74ea..0be59a2b8769f726e0fae50f5bfebb62a568156f 100644 --- a/~dev_rating/application/classes/Controller/Handler/FileCreator.php +++ b/~dev_rating/application/classes/Controller/Handler/FileCreator.php @@ -192,7 +192,6 @@ class Controller_Handler_FileCreator extends Controller_Handler // $specName = ''; <------- TODO $this->printDisciplineToExcelFile($objPHPExcel, $disciplineID, $groupID, $info[0]); - $grade = $info[0]["GradeNum"]; $group = $info[0]["GroupNum"]; //$this->GetHeaders("FinalForm".$disciplineID."_".$groupID); @@ -207,7 +206,8 @@ class Controller_Handler_FileCreator extends Controller_Handler $type = $headerData['ExamType']; $db = $this->model; $result = $db->getRatesForStudentsGroup($this->user['TeacherID'], $disciplineID, $groupID); - + $rates = $db->getAttestationData($disciplineID, $groupID); + // fill header $this->prepareSheetHeader($objPHPExcel, $type, $headerData); @@ -218,7 +218,23 @@ class Controller_Handler_FileCreator extends Controller_Handler $examHold = $this->checkExamIsHold($result); + $i=0; foreach($result as $studentInfo){ + while ($rates[$i]['Type'] == 'extra' && $rates[$i]['StudentID'] == $studentInfo['ID']) { + $orderNum = $rates[$i]['OrderNum']; + $studentInfo['Attempt'][$orderNum]['ExtraRate'] = (int)$rates[$i]['Rate']; + $i++; + } + while ($rates[$i]['Type'] == 'exam' && $rates[$i]['StudentID'] == $studentInfo['ID']) { + $orderNum = $rates[$i]['OrderNum']; + $studentInfo['Attempt'][$orderNum]['ExamRate'] = (int)$rates[$i]['Rate']; + if (($timestamp = strtotime($rates[$i]['Date'])) == false) + $date = ''; + else + $date = date("d.m.y", $timestamp); + $studentInfo['Attempt'][$orderNum]['ExamDate'] = $date; + $i++; + } $this->addStudentToSheet($objPHPExcel, $type, $studentInfo, $rowNumber, $index, $examHold); $rowNumber++; $index++; @@ -277,45 +293,67 @@ class Controller_Handler_FileCreator extends Controller_Handler protected function addStudentInfoForCreditToSheet(&$sheet, $data, $row, $index) { - $indPosition = 'A'; // Номер - $namePosition = 'B'; // Р¤РРћ - $totalRatePosition = 'G'; // Ртоговый рейтинг - $semesterRatePosition = 'H'; // РЎСѓРјРјР° баллов - $bonusRatePosition = 'I'; // Бонусные баллы - - $sheet ->getStyle("A".$row.":S".$row) - ->getBorders()->getAllBorders() - ->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN); - $sheet ->getStyle("G".$row.":S".$row) - ->getAlignment() - ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); - $sheet->mergeCells("B".$row.":F".$row); - - $lastName = $data['Last']; - $firstName = $data['First']; - $secondName = $data['Second']; - $rate = (int)$data['intermediate']; - $bonus = (int)$data['bonus']; - $fullName = $lastName." ".$firstName." ".$secondName; - $totalRate = $rate + $bonus; - + $indPosition = 'A'; // Номер + $namePosition = 'B'; // Р¤РРћ + $totalRatePosition = 'G'; // Ртоговый рейтинг + $semesterRatePosition = 'H'; // РЎСѓРјРјР° баллов + $bonusRatePosition = 'I'; // Бонусные баллы + $datePosition = array('*', 'N', 'R'); // Добор + $extraRatePosition = array('*', 'L', 'P'); // Добор + $stringRatePosition = array('J', 'M', 'Q'); // Оценка РІРёРґР° зачтено/РЅРµ зачтено + + $sheet ->getStyle("A".$row.":S".$row) + ->getBorders()->getAllBorders() + ->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN); + $sheet ->getStyle("G".$row.":S".$row) + ->getAlignment() + ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); + $sheet->mergeCells("B".$row.":F".$row); + + $lastName = $data['Last']; + $firstName = $data['First']; + $secondName = $data['Second']; + $semesterRate = (int)$data['intermediate']; + $bonus = (int)$data['bonus']; + $fullName = $lastName." ".$firstName." ".$secondName; + $rateForCredit = $semesterRate; + + $sheet ->setCellValue($indPosition.$row, $index) + ->setCellValue($namePosition.$row, $fullName) + ->setCellValue($semesterRatePosition.$row, $semesterRate) + ->setCellValue($bonusRatePosition.$row, $bonus); + + $i=0; + $rateToShow = 0; + do { + if ($i == 0) + $extra = 0; + else { + $extra = $data['Attempt'][$i]['ExtraRate']; + $sheet->setCellValue($datePosition[$i].$row, $data['Attempt'][$i]['Date']) + ->setCellValue($extraRatePosition[$i].$row, $extra); + } + + $rateForCredit += $extra; + $totalRate = $rateForCredit + $bonus; if ($totalRate > 100) $totalRate = 100; - if($totalRate < 60) { - $tempRate = " "; + if($rateForCredit < 60) { + $rateToShow = ""; $tempStr = "РЅРµ зачтено"; } else { - $tempRate = $totalRate; + $rateToShow = $totalRate; $tempStr = "зачтено"; } - - $sheet ->setCellValue($indPosition.$row, $index) - ->setCellValue($namePosition.$row, $fullName) - ->setCellValue($totalRatePosition.$row, $tempRate) - ->setCellValue($semesterRatePosition.$row, $rate) - ->setCellValue($bonusRatePosition.$row, $bonus) - ->setCellValue("J".$row, $tempStr); + + $sheet->setCellValue($stringRatePosition[$i].$row, $tempStr); + if ($rateToShow) + break; + + } while(++$i<3); + $sheet->setCellValue($totalRatePosition.$row, $rateToShow); + } protected function addStudentInfoForExamToSheet(&$sheet, $data, $row, $index, $examHold) @@ -325,8 +363,10 @@ class Controller_Handler_FileCreator extends Controller_Handler $totalRatePosition = 'H'; // Ртоговый рейтинг $semesterRatePosition = 'I'; // РЎСѓРјРјР° баллов $bonusRatePosition = 'J'; // Бонусные баллы - $examRatePosition = 'K'; // Баллы Р·Р° экзамен - $rateOfFivePosition = 'L'; // Оценка Р·Р° экзамен РїРѕ пятибальной системе + $extraRatePosition = 'N'; // Добор + $examRatePosition = array('K', 'O', 'S') ; // Баллы Р·Р° экзамен + $rateOfFivePosition = array ('L', 'P', 'T'); // Оценка Р·Р° экзамен РїРѕ пятибальной системе + $datePosition = array ('*', 'Q', 'U'); // Дата экзамена $sheet ->getStyle("A".$row.":V".$row) ->getBorders()->getAllBorders() @@ -351,26 +391,42 @@ class Controller_Handler_FileCreator extends Controller_Handler $lastName = $data['Last']; $firstName = $data['First']; $secondName = $data['Second']; - $rate = (int)$data['intermediate']; + $semesterRate = (int)$data['intermediate']; $bonus = (int)$data['bonus']; - $examRateValue = (int)$data['exam']; - if ($examRateValue < 0) - $examRateValue = 0; $fullName = $lastName." ".$firstName." ".$secondName; - $totalRateValue = $rate + $examRateValue + $bonus; - - if ($totalRateValue > 100) - $totalRateValue = 100; - - list($totalRate, $rateOfFive, $examRate) = $this->formRateOfFive($rate, $examRateValue, $totalRateValue, $examHold); + $examAdmission = $semesterRate; $sheet ->setCellValue($indPosition.$row, $index) ->setCellValue($namePosition.$row, $fullName) - ->setCellValue($totalRatePosition.$row, $totalRate) - ->setCellValue($semesterRatePosition.$row, $rate) - ->setCellValue($bonusRatePosition.$row, $bonus) - ->setCellValue($examRatePosition.$row, $examRate) - ->setCellValue($rateOfFivePosition.$row, $rateOfFive); + ->setCellValue($semesterRatePosition.$row, $semesterRate) + ->setCellValue($bonusRatePosition.$row, $bonus); + + $i=0; + do { + if (!$data['Attempt'][$i+1]['ExamDate']) + break; + + $examRateValue = $data['Attempt'][$i+1]['ExamRate']; + if ($i == 0) + $extra = 0; + else { + $extra = $data['Attempt'][1]['ExtraRate']; + $sheet->setCellValue($datePosition[$i].$row, $data['Attempt'][$i+1]['ExamDate']) + ->setCellValue($extraRatePosition.$row, $extra); + } + + $examAdmission += $extra; + $total = $examAdmission+$examRateValue+$bonus; + list($totalRateStr, $rateOfFive, $examRateStr) = + $this->formRateOfFive($examAdmission, $examRateValue, $total, $examHold); + + $sheet->setCellValue($examRatePosition[$i].$row, $examRateStr) + ->setCellValue($rateOfFivePosition[$i].$row, $rateOfFive); + if ($totalRateStr) + break; + + } while(++$i<3); + $sheet->setCellValue($totalRatePosition.$row, $totalRateStr); } protected function getSheetName(&$disciplineInfo) { @@ -479,18 +535,20 @@ class Controller_Handler_FileCreator extends Controller_Handler } // Определяет оценку РїРѕ пятибальной системе - protected function formRateOfFive($semesterRate, $examRateValue, $totalRateValue, $examHold) + protected function formRateOfFive($examAdmission, $examRateValue, $totalRateValue, $examHold) { - $totalRate = ''; + if ($totalRateValue > 100) + $totalRateValue = 100; + $totalRateStr = ''; $rateOfFive = ''; - $examRate = ''; + $examRateStr = ''; if ($examHold != 0) { - $examRate = $examRateValue; - if (($semesterRate < 38) or ($examRateValue < 22)) { + $examRateStr = $examRateValue; + if (($examAdmission < 38) or ($examRateValue < 22)) { $rateOfFive = 'неуд'; } else { - $totalRate = $totalRateValue; + $totalRateStr = $totalRateValue; $rateOfFive = 'СѓРґРѕРІР»'; if (($totalRateValue >= 71) and ($totalRateValue < 85)) $rateOfFive = 'С…РѕСЂ'; @@ -500,14 +558,14 @@ class Controller_Handler_FileCreator extends Controller_Handler } else { - if ($semesterRate < 38) { // задолженник - $totalRate = ' '; + if ($examAdmission < 38) { // задолженник + //$totalRateStr = ' '; $rateOfFive = 'неуд'; - $examRate = '0'; + $examRateStr = '0'; } } - return array($totalRate, $rateOfFive, $examRate); + return array($totalRateStr, $rateOfFive, $examRateStr); } } \ No newline at end of file diff --git a/~dev_rating/application/classes/Model/Teacher/Rating.php b/~dev_rating/application/classes/Model/Teacher/Rating.php index 02c4c36b2db40b96dc9b1b300a8bb7cda53510eb..57936a707c488037566bab4e61bd2ba8dd88e5c6 100644 --- a/~dev_rating/application/classes/Model/Teacher/Rating.php +++ b/~dev_rating/application/classes/Model/Teacher/Rating.php @@ -52,12 +52,19 @@ class Model_Teacher_Rating extends Model public function getRatesForStudentsGroup($teacherID, $disciplineID, $groupID) { - $sql = "CALL `getRatesForStudentsGroup`($teacherID, $disciplineID, $groupID)"; + $sql = "CALL `GetRatesForStudentsGroup`($teacherID, $disciplineID, $groupID)"; return DB::query(Database::SELECT, $sql)->execute(); } + + public function getAttestationData($disciplineID, $groupID) + { + $sql = "CALL `GetAttestationData`($disciplineID, $groupID)"; + return DB::query(Database::SELECT, $sql)->execute(); + } + public function getFinalFormInfo($disciplineID, $groupID) { - $sql = "CALL `getFinalFormInfo`($disciplineID, $groupID)"; + $sql = "CALL `GetFinalFormInfo`($disciplineID, $groupID)"; return DB::query(Database::SELECT, $sql)->execute(); } diff --git a/~dev_rating/media/js/discipline/EditStudents.js b/~dev_rating/media/js/discipline/EditStudents.js index 551845e1c3428a33e25064619f0db8d0b0a950e9..1aeb00c521de99923f673b45ff3c44cad667b9db 100644 --- a/~dev_rating/media/js/discipline/EditStudents.js +++ b/~dev_rating/media/js/discipline/EditStudents.js @@ -337,7 +337,7 @@ $(function() { if (GroupContainer.css("display") == "none") { $(this).children(".Action").text("Скрыть СЃРїРёСЃРѕРє в–І"); GroupContainer.show(); - GroupContainer.css("height", GroupContainer.height()); + GroupContainer.css("height", GroupContainer.height() + 3); } else { $(this).children(".Action").text("Открыть СЃРїРёСЃРѕРє в–ј"); diff --git a/~dev_rating/media/less/teacher/discipline/EditStudents.css b/~dev_rating/media/less/teacher/discipline/EditStudents.css index 751d3d1eec1aed294a106cb7c0f515bfdde37339..c62250e302591917c5ee8174b7d5d0da81dc565c 100644 --- a/~dev_rating/media/less/teacher/discipline/EditStudents.css +++ b/~dev_rating/media/less/teacher/discipline/EditStudents.css @@ -29,8 +29,8 @@ } .StudentsList .GroupContainer .hideListAction { float: left; - background: url("../imgicons/triangle_up.png") no-repeat center center #f9f9f9; - width: 40px; + background: url("../../../img/icons/triangle_up.png") no-repeat center center #f9f9f9; + width: 5%; height: 100%; margin-top: 10px; } @@ -60,7 +60,7 @@ } .StudentsList .Student { float: right; - width: 880px; + width: 90%; margin-top: 10px; padding: 7px 10px; box-shadow: 2px 2px 2px #DDE8F0; diff --git a/~dev_rating/media/less/teacher/discipline/EditStudents.less b/~dev_rating/media/less/teacher/discipline/EditStudents.less index c36409e3afe44aaf69ffaee4513edde777ea19ce..74bbb484a03a930b2efe1e5c8d2c1a871ece1b6b 100644 --- a/~dev_rating/media/less/teacher/discipline/EditStudents.less +++ b/~dev_rating/media/less/teacher/discipline/EditStudents.less @@ -1,4 +1,5 @@ @import (reference) "../../common.less"; +@ImagePath: '../../../img/'; /* Прикрипление студентов */ .StudentsList { @@ -34,7 +35,7 @@ .StudentsList .GroupContainer .hideListAction{ float: left; background: url(@IconTriangleUp) no-repeat center center #f9f9f9; - width: 40px; + width: 5%; height: 100%; margin-top: 10px; } @@ -67,7 +68,7 @@ .StudentsList .Student { float: right; - width: 880px; + width: 90%; margin-top: 10px; padding: 7px 10px; box-shadow: 2px 2px 2px #DDE8F0;