Skip to content
Snippets Groups Projects
Commit 41428738 authored by RomanSteinberg's avatar RomanSteinberg
Browse files

FIX: final form filling

parent 05ea37aa
Branches
Tags
No related merge requests found
...@@ -818,19 +818,17 @@ BEGIN ...@@ -818,19 +818,17 @@ BEGIN
INNER JOIN `students_groups` ON students_groups.StudentID = students.ID AND INNER JOIN `students_groups` ON students_groups.StudentID = students.ID AND
students_groups.SemesterID = @CurrentSemesterID students_groups.SemesterID = @CurrentSemesterID
LEFT JOIN `disciplines_groups` ON disciplines_groups.DisciplineID = pDisciplineID AND LEFT JOIN `disciplines_groups` ON disciplines_groups.DisciplineID = pDisciplineID AND
disciplines_groups.GroupID = students_groups.ID disciplines_groups.GroupID = students_groups.GroupID
LEFT JOIN `disciplines_students` ON disciplines_students.DisciplineID = pDisciplineID AND LEFT JOIN `disciplines_students` ON disciplines_students.DisciplineID = pDisciplineID AND
disciplines_students.StudentID = students.ID disciplines_students.StudentID = students.ID
LEFT JOIN `modules` ON modules.DisciplineID = pDisciplineID AND LEFT JOIN `modules` ON modules.DisciplineID = pDisciplineID AND
(modules.Type = 'exam' OR modules.Type = 'extra') (modules.Type = 'exam' OR modules.Type = 'extra')
LEFT JOIN `submodules` ON submodules.ModuleID = modules.ID LEFT JOIN `submodules` ON submodules.ModuleID = modules.ID
LEFT JOIN `rating_table` ON rating_table.SubmoduleID = submodules.ID AND LEFT JOIN `rating_table` ON rating_table.SubmoduleID = submodules.ID AND
rating_table.StudentID = students.ID rating_table.StudentID = students.ID
WHERE students_groups.GroupID = pGroupID AND WHERE students_groups.GroupID = pGroupID AND rating_table.Rate IS NOT NULL AND
((disciplines_students.StudentID IS NOT NULL AND disciplines_students.Type = 'attach') ((disciplines_students.StudentID IS NOT NULL AND disciplines_students.Type = 'attach')
OR (disciplines_groups.DisciplineID IS NOT NULL AND disciplines_students.Type IS NULL) OR (disciplines_groups.DisciplineID IS NOT NULL AND disciplines_students.Type IS NULL)
) )
......
...@@ -141,8 +141,12 @@ class Controller_Handler_FileCreator extends Controller_Handler ...@@ -141,8 +141,12 @@ class Controller_Handler_FileCreator extends Controller_Handler
$this->printDisciplineToExcelFile($objPHPExcel, $disciplineID, $groupID, $info[0]); $this->printDisciplineToExcelFile($objPHPExcel, $disciplineID, $groupID, $info[0]);
$grade = $info[0]["GradeNum"]; $grade = $info[0]["GradeNum"];
$group = $info[0]["GroupNum"]; $group = $info[0]["GroupNum"];
$this->GetHeaders("FinalForm".$disciplineID."_".$groupID); $subjName = $info[0]["SubjectName"];
$this->GetHeaders("FinalForm_".$grade."_".$group); $subjName = UTF8::substr($subjName,0, 10);
$subjName = str_replace(' ', '_', $subjName);
$filename = $subjName."_".$grade."_".$group;
//$this->GetHeaders("FinalForm".$disciplineID."_".$groupID);
$this->GetHeaders($filename);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output'); $objWriter->save('php://output');
} }
...@@ -174,7 +178,8 @@ class Controller_Handler_FileCreator extends Controller_Handler ...@@ -174,7 +178,8 @@ class Controller_Handler_FileCreator extends Controller_Handler
while ($rates[$i]['Type'] == 'exam' && $rates[$i]['StudentID'] == $studentInfo['ID']) { while ($rates[$i]['Type'] == 'exam' && $rates[$i]['StudentID'] == $studentInfo['ID']) {
$orderNum = $rates[$i]['OrderNum']; $orderNum = $rates[$i]['OrderNum'];
$studentInfo['Attempt'][$orderNum]['ExamRate'] = (int)$rates[$i]['Rate']; $studentInfo['Attempt'][$orderNum]['ExamRate'] = (int)$rates[$i]['Rate'];
if (($timestamp = strtotime($rates[$i]['Date'])) == false) $timestamp = strtotime($rates[$i]['Date']);
if ($timestamp == false)
$date = ''; $date = '';
else else
$date = date("d.m.y", $timestamp); $date = date("d.m.y", $timestamp);
...@@ -271,16 +276,14 @@ class Controller_Handler_FileCreator extends Controller_Handler ...@@ -271,16 +276,14 @@ class Controller_Handler_FileCreator extends Controller_Handler
->setCellValue($bonusRatePosition.$row, $bonus); ->setCellValue($bonusRatePosition.$row, $bonus);
$i=0; $i=0;
$extra = 0;
do { do {
if (!$data['Attempt'][$i+1]['ExamDate']) if ($i > 0) {
continue; // TODO: нужно учесть все варанты сдач-несдач. Например, ни разу не пришел на экзамен. if (is_null($data['Attempt'][$i]['ExtraRate']))
continue;
if ($i == 0)
$extra = 0;
else {
$extra = $data['Attempt'][$i]['ExtraRate']; $extra = $data['Attempt'][$i]['ExtraRate'];
$sheet->setCellValue($datePosition[$i].$row, $data['Attempt'][$i]['Date']) $sheet->setCellValue($datePosition[$i].$row, $data['Attempt'][$i]['ExamDate'])
->setCellValue($extraRatePosition[$i].$row, $extra); ->setCellValue($extraRatePosition[$i].$row, $extra);
} }
...@@ -289,12 +292,12 @@ class Controller_Handler_FileCreator extends Controller_Handler ...@@ -289,12 +292,12 @@ class Controller_Handler_FileCreator extends Controller_Handler
if ($totalRate > 100) if ($totalRate > 100)
$totalRate = 100; $totalRate = 100;
if($rateForCredit < 60) { if ($rateForCredit < 60) {
$rateToShow = ""; $rateToShow = "";
$tempStr = "не зачтено"; $tempStr = "не зачтено";
} else { } else {
$rateToShow = $totalRate; $rateToShow = $totalRate;
$tempStr = "зачтено"; $tempStr = "зачтено";
} }
$sheet->setCellValue($stringRatePosition[$i].$row, $tempStr); $sheet->setCellValue($stringRatePosition[$i].$row, $tempStr);
...@@ -303,7 +306,6 @@ class Controller_Handler_FileCreator extends Controller_Handler ...@@ -303,7 +306,6 @@ class Controller_Handler_FileCreator extends Controller_Handler
} while(++$i<3); } while(++$i<3);
$sheet->setCellValue($totalRatePosition.$row, $rateToShow); $sheet->setCellValue($totalRatePosition.$row, $rateToShow);
} }
protected function addStudentInfoForExamToSheet(PHPExcel_Worksheet &$sheet, $data, $row, $index, $examHold) protected function addStudentInfoForExamToSheet(PHPExcel_Worksheet &$sheet, $data, $row, $index, $examHold)
...@@ -354,7 +356,7 @@ class Controller_Handler_FileCreator extends Controller_Handler ...@@ -354,7 +356,7 @@ class Controller_Handler_FileCreator extends Controller_Handler
$i=0; $i=0;
do { do {
if (!$data['Attempt'][$i+1]['ExamDate']) if (!$data['Attempt'][$i+1]['ExamDate'])
continue; // TODO: нужно учесть все варанты сдач-несдач. Например, ни разу не пришел на экзамен. continue;
$examRateValue = $data['Attempt'][$i+1]['ExamRate']; $examRateValue = $data['Attempt'][$i+1]['ExamRate'];
if ($i != 0) { if ($i != 0) {
......
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