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