Newer
Older
<?php defined('SYSPATH') || die('No direct script access.');
class Controller_Handler_FileCreator extends Controller_Handler
{
// Массив указания позиций (имен колонок) для разных ведомостей.
// Параметризация ведется по типу аттестации и по этапу сдачи
private $ColumnsPositions = [
"exam" => [
0 => [
'Index' => 'A',
'Name' => 'B',
'Total' => 'G',
'Semester' => 'H',
'Bonus' => 'I',
'Extra' => 0,
'Exam' => 'J',
'RateString' => 'K',
],
2 => [
'Index' => 'A',
'Name' => 'B',
'Total' => 'G',
'Semester' => 'H',
'Bonus' => 'I',
'Extra' => 'J',
'Exam' => 'K',
'RateString' => 'L',
'RightestColumn' => 'M'
],
],
"credit" => [
0 => [
'Index' => 'A',
'Name' => 'B',
'Total' => 'H',
'Semester' => 'I',
'Bonus' => 'J',
'Extra' => 0,
'Exam' => 0,
'RateString' => 'K',
],
2 => [
'Index' => 'A',
'Name' => 'B',
'Total' => 'H',
'Semester' => 'I',
'Bonus' => 'J',
'Extra' => 'K',
'Exam' => 0,
'RateString' => 'L',
'RightestColumn' => 'M'
],
],
]; // остальные данные о позициях копируются в функции before()
// копирование настроек полей для других типов аттестации и этапов
$this->ColumnsPositions['exam'][1] = $this->ColumnsPositions['exam'][0];
$this->ColumnsPositions['exam'][3] = $this->ColumnsPositions['exam'][2];
$this->ColumnsPositions['credit'][1] = $this->ColumnsPositions['credit'][0];
$this->ColumnsPositions['credit'][3] = $this->ColumnsPositions['credit'][2];
$this->ColumnsPositions['grading_credit'][$i] = $this->ColumnsPositions['credit'][$i];
// Таблица баллов (со страницы оценивания) [dev version]
$this->user->checkAccess(User::RIGHTS_TEACHER | User::RIGHTS_DEAN);
// Устанавливаем индекс активного листа
$xls->setActiveSheetIndex(0);
$structure = Model_Map::getRoadmap($this->post['disciplineID'], 'rate');
foreach ($structure as $row) {
if ($row['ModuleID'] != $id) {
$id = $row['ModuleID'];
$module =& $structureHandled[$count++];
'MaxRate' => 0,
'SubmodulesCount' => 0,
'ModuleTitle' => $row['ModuleName'],
'ModuleType' => $row['ModuleType'],
'SubmoduleID' => $row['SubmoduleID'],
'Title' => $row['SubModuleName'],
$sheet->setCellValueByColumnAndRow(0, 1, 'Модуль');
$sheet->setCellValueByColumnAndRow(0, 2, 'Мероприятие');
$sheet->setCellValueByColumnAndRow(0, 3, 'Макс. балл');
PavelBegunkov
committed
PavelBegunkov
committed
// Модули
for ($k = 0, $pointer = 1; $k <= $structureHandled['ModulesCount']; $k++) {
$sheet->mergeCellsByColumnAndRow($pointer, 1, $pointer + $structureHandled[$k]['SubmodulesCount'] - 1, 1);
$sheet->setCellValueByColumnAndRow($pointer, 1, $structureHandled[$k]['ModuleTitle']);
// Мероприятия
for ($l = 0; $l <= $structureHandled[$k]['SubmodulesCount']; $l++) {
$sheet->setCellValueByColumnAndRow($pointer + $l, 2, $structureHandled[$k][$l]['Title']);
$sheet->setCellValueByColumnAndRow($pointer + $l, 3, $structureHandled[$k][$l]['MaxRate']);
$submodulesCount++;
}
$pointer = $structureHandled[$k]['SubmodulesCount'] + 1;
}
$sheet->setCellValueByColumnAndRow($submodulesCount + 1, 1, 'Итог');
$sheet->mergeCellsByColumnAndRow($submodulesCount + 1, 1, $submodulesCount + 1, 3);
// Студенты и их баллы
$students = Model_Rating::GetStudentsForRating($this->post['disciplineID']);
$i = 0;
$curGroup = 0;
$rateSum = 0;
foreach ($students as $row) {
if ($curGroup !== $row['GroupID']) {
$curGroup = $row['GroupID'];
$i++;
$sheet->mergeCellsByColumnAndRow(0, 3 + $i, $submodulesCount + 1, 3 + $i);
$sheet->setCellValueByColumnAndRow(0, 3 + $i, $row['GroupNum'] . ' группа');
}
// Студенты
$i++;
$rateSum += $row['Rate'];
$sheet->setCellValueByColumnAndRow(0, 3 + $i, $row['Last'] . ' ' . $row['First'] . ' ' . $row['Second']);
// Баллы студента
$rate = Model_Rating::getMapForStudent($row['ID'], $this->post['disciplineID']);
$i_r = 0;
foreach ($rate as $r) {
$i_r++;
$sheet->setCellValueByColumnAndRow($i_r, 3 + $i, $r['Rate']);
$sheet->setCellValueByColumnAndRow($submodulesCount + 1, 3 + $i, $rateSum);
}
$this->GetHeaders();
// Выводим содержимое файла
$objWriter = new PHPExcel_Writer_Excel5($xls);
$objWriter->save('php://output');
$this->user->checkAccess(User::RIGHTS_TEACHER | User::RIGHTS_DEAN);
$this->post
->rule('disciplineID', 'not_empty')
->rule('disciplineID', 'digit')
->rule('groupID', 'not_empty')
->rule('groupID', 'digit')
->rule('stage', 'not_empty')
->rule('stage', 'digit', [0, 1, 2, 3]);
if (!$this->post->check())
throw HTTP_Exception::factory(417, "Некорректные параметры запроса!");
PavelBegunkov
committed
// parameters
$disciplineID = $this->post['disciplineID'];
$groupID = $this->post['groupID'];
$stage = $this->post['stage'];
PavelBegunkov
committed
// make form from template
$info = Model_Rating::getFinalFormInfo($disciplineID, $groupID);
$info['DisciplineID'] = $disciplineID;
$this->printDisciplineToExcelFile($objPHPExcel, $disciplineID, $groupID, $info, $stage);
// prepare filename
$grade = $info["GradeNum"];
$group = $info["GroupNum"];
$subjName = $info["SubjectName"];
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
PavelBegunkov
committed
public function printDisciplineToExcelFile(&$objPHPExcel, $disciplineID, $groupID, $headerData, $stage) {
$useNewForms = true;
$useNewForms = false;
$type = $headerData['ExamType'];
if ($type === 'grading_credit')
$type = 'credit';
if ($useNewForms) {
$stageSuffix = $stage < 2 ? "0 1" : "2 3";
$templateFile = DOCROOT . "docs/template $type $stageSuffix.xls";
}
if (!file_exists($templateFile)) {
exit("template wasn't found" . PHP_EOL);
}
$objPHPExcel = PHPExcel_IOFactory::load($templateFile);
$objPHPExcel->setActiveSheetIndex(0);
if ($useNewForms)
$this->printNewForm($objPHPExcel, $disciplineID, $groupID, $headerData, $stage);
else
$this->printOldForm($objPHPExcel, $disciplineID, $groupID, $headerData);
/**
* @param PHPExcel $objPHPExcel
* @param int $disciplineID
* @param int $groupID
* @param array
* @param int $stage
*/
protected function printNewForm(&$objPHPExcel, $disciplineID, $groupID, $headerData, $stage) {
// preparation
$type = $headerData['ExamType'];
$rates = Model_Rating::getRatesForStudentsGroupByStage($disciplineID, $groupID, $stage);
// fill header
$this->prepareSheetHeader($objPHPExcel, $type, $headerData);
// fill students rows
$startRow = 12;
$rowNumber = $startRow;
$index = 1;
$sheet = $objPHPExcel->getActiveSheet();
// проверяем дошел ли студент до этапа $stage или уже сдал
if ($type == 'exam') {
if (($stage >= 2) &&
(((int)$studentRates['PreviousExam'] >= 22) || ((int)$studentRates['AutoPassed'] == 1))
)
continue; // на предыдущем этапе уже сдал
} else {
$prevStageAttempt = (int)$studentRates['PreviousExtra'] + (int)$studentRates['Semester'];
if (($stage >= 2) && ($prevStageAttempt >= 60))
continue; // на предыдущем этапе уже сдал
}
$this->addStudentToSheetNew($sheet, $type, $studentRates, $rowNumber++, $index++, $stage);
}
}
protected function addStudentToSheetNew(PHPExcel_Worksheet &$sheet,
$type, $studentRates, $rowIndex, $studentIndex, $stage) {
$indPosition = $this->ColumnsPositions[$type][$stage]['Index']; // Номер
$namePosition = $this->ColumnsPositions[$type][$stage]['Name']; // ФИО
$totalRatePosition = $this->ColumnsPositions[$type][$stage]['Total']; // Итоговый рейтинг
$semesterRatePosition = $this->ColumnsPositions[$type][$stage]['Semester']; // Сумма баллов семестра
$bonusRatePosition = $this->ColumnsPositions[$type][$stage]['Bonus']; // Бонусные баллы
$extraRatePosition = $this->ColumnsPositions[$type][$stage]['Extra']; // Добор, если есть
$examRatePosition = $this->ColumnsPositions[$type][$stage]['Exam']; // Экзамен, если есть
$stringRatePosition = $this->ColumnsPositions[$type][$stage]['RateString']; // Оценка в виде строки (зачтено/не зачтено или отл/хор/...)
$rightestColumn = $this->ColumnsPositions[$type][$stage]['RightestColumn'];
// $datePosition = 'N'; // Дата
$sheet->getStyle("A" . $rowIndex . ":" . $rightestColumn . $rowIndex)
->getBorders()->getAllBorders()
->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$sheet->getStyle($totalRatePosition . $rowIndex . ":" . $rightestColumn . $rowIndex)
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$rightestColumnOfName = chr(ord($totalRatePosition) - 1);
$sheet->mergeCells("B" . $rowIndex . ":" . $rightestColumnOfName . $rowIndex);
$lastName = $studentRates['LastName'];
$firstName = $studentRates['FirstName'];
$secondName = $studentRates['SecondName'];
$fullName = $lastName . " " . $firstName . " " . $secondName;
$ratesSet['Semester'] = (int) $studentRates['Semester'];
$ratesSet['Bonus'] = (int) $studentRates['Bonus'];
$ratesSet['Extra'] = (int) $studentRates['Extra'];
$ratesSet['Exam'] = (int) $studentRates['Exam'];
$ratesSet['Option'] = $studentRates['Option'];
list($totalRateStr, $stringRate, $examRateStr) =
$this->formStringsForRates($ratesSet, $type, $stage > 0);
$sheet->setCellValue($indPosition . $rowIndex, $studentIndex)
->setCellValue($namePosition . $rowIndex, $fullName)
->setCellValue($totalRatePosition . $rowIndex, $totalRateStr)
->setCellValue($semesterRatePosition . $rowIndex, $ratesSet['Semester'])
->setCellValue($bonusRatePosition . $rowIndex, $ratesSet['Bonus'])
->setCellValue($stringRatePosition . $rowIndex, $stringRate);
$sheet->setCellValue($extraRatePosition . $rowIndex, $ratesSet['Extra']);
}
public function printOldForm(&$objPHPExcel, $disciplineID, $groupID, $headerData) {
PavelBegunkov
committed
PavelBegunkov
committed
$result = Model_Rating::getRatesForStudentsGroup($disciplineID, $groupID);
$rates = Model_Rating::getAttestationData($disciplineID, $groupID);
$this->prepareSheetHeader($objPHPExcel, $type, $headerData);
PavelBegunkov
committed
$examHold = $this->checkExamIsHold($result);
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'];
$timestamp = strtotime($rates[$i]['Date']);
if ($timestamp == false)
$date = '';
else
$date = date("d.m.y", $timestamp);
$studentInfo['Attempt'][$orderNum]['ExamDate'] = $date;
$i++;
}
PavelBegunkov
committed
$this->addStudentToSheet($objPHPExcel, $type, $studentInfo, $rowNumber, $index, $examHold);
PavelBegunkov
committed
$index++;
PavelBegunkov
committed
protected function prepareSheetHeader(PHPExcel &$objPHPExcel, $disciplineType, $data) {
$range = $objPHPExcel->getNamedRange("Discipline")->getRange();
$sheet->setCellValue($range, $data['SubjectName']);
$range = $objPHPExcel->getNamedRange("Group")->getRange();
$sheet->setCellValue($range, $data['GroupNum']);
$range = $objPHPExcel->getNamedRange("Subdivision")->getRange();
$range = $objPHPExcel->getNamedRange("Major")->getRange();
$sheet->setCellValue($range, "Специальность: " . $data['SpecName'] . " " . $data['SpecCode']);
$teachers = Model_Discipline::load($data['DisciplineID'])->getTeachers()->as_array();
$teachersStr = '';
$i = 0;
for (; $i < count($teachers) - 1; ++$i) {
$teachersStr .= Text::abbreviateName($teachers[$i]) . ', ';
if ($numOfTeachersInRow * ceil(($i + 1) / $numOfTeachersInRow) == $i + 1) {
$teachersStr .= Text::abbreviateName($teachers[$i]);
} else
$teachersStr = $data['LastName'] . " " . $data['FirstName'] . " " . $data['SecondName'];
$range = $objPHPExcel->getNamedRange("Teacher")->getRange();
$rowPosition = preg_replace('/[^0-9]/', '', $range);
$sheet->getRowDimension($rowPosition)
->setRowHeight($rowHeight);
$sheet->setCellValue($range, $teachersStr);
$range = $objPHPExcel->getNamedRange("Grade")->getRange();
$degree = $data['Degree'];
$gradeNum = $data['GradeNum'];
$gradeName = $gradeNum;
if ($degree == 'master')
$gradeName = $gradeName . "м";
$sheet->setCellValue($range, $gradeName);
$range = $objPHPExcel->getNamedRange("Semester")->getRange();
$range = $objPHPExcel->getNamedRange("Year")->getRange();
$range = $objPHPExcel->getNamedRange("CreationDate")->getRange();
PavelBegunkov
committed
$range = $objPHPExcel->getNamedRange("Date")->getRange();
$controlDate = "Дата зачета\n" . $this->figureOutCreditDate($data['SemesterNum'], $startYear);
$sheet->setCellValue("$range", $controlDate);
protected function addStudentToSheet(PHPExcel &$objPHPExcel, $disciplineType, $data, $row, $index, $examHold1) {
if ($disciplineType == 'exam') {
$this->addStudentInfoForExamToSheet($sheet, $data, $row, $index, $examHold1);
} else {
$this->addStudentInfoForCreditToSheet($sheet, $data, $row, $index);
protected function addStudentInfoForCreditToSheet(PHPExcel_Worksheet &$sheet, $data, $row, $index) {
$indPosition = 'A'; // Номер
$namePosition = 'B'; // ФИО
$totalRatePosition = 'G'; // Итоговый рейтинг
$bonusRatePosition = 'I'; // Бонусные баллы
$datePosition = ['*', 'N', 'R']; // Добор
$extraRatePosition = ['*', 'L', 'P']; // Добор
$stringRatePosition = ['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);
PavelBegunkov
committed
$lastName = $data['LastName'];
$firstName = $data['FirstName'];
$secondName = $data['SecondName'];
$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);
if ($i > 0) {
if (is_null($data['Attempt'][$i]['ExtraRate']))
continue;
$extra = $data['Attempt'][$i]['ExtraRate'];
$sheet->setCellValue($datePosition[$i] . $row, $data['Attempt'][$i]['ExamDate'])
->setCellValue($extraRatePosition[$i] . $row, $extra);
}
$rateForCredit += $extra;
$totalRate = $rateForCredit + $bonus;
if ($rateForCredit < 60) {
$rateToShow = "";
$tempStr = "не зачтено";
$rateToShow = $totalRate;
$tempStr = "зачтено";
if ($rateToShow)
break;
} while (++$i < 3);
$sheet->setCellValue($totalRatePosition . $row, $rateToShow);
protected function addStudentInfoForExamToSheet(PHPExcel_Worksheet &$sheet, $data, $row, $index, $examHold) {
$indPosition = 'A'; // Номер
$namePosition = 'B'; // ФИО
$extraRatePosition = 'N'; // Добор
$examRatePosition = ['K', 'O', 'S']; // Баллы за экзамен
$rateOfFivePosition = ['L', 'P', 'T']; // Оценка за экзамен по пятибальной системе
$datePosition = ['*', 'Q', 'U']; // Дата экзамена
->getBorders()->getAllBorders()
->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
PavelBegunkov
committed
$lastName = $data['LastName'];
$firstName = $data['FirstName'];
$secondName = $data['SecondName'];
$semesterRate = (int) $data['intermediate'];
$bonus = (int) $data['bonus'];
$fullName = $lastName . " " . $firstName . " " . $secondName;
$examAdmission = $semesterRate;
$sheet->setCellValue($indPosition . $row, $index)
->setCellValue($namePosition . $row, $fullName)
->setCellValue($semesterRatePosition . $row, $semesterRate)
->setCellValue($bonusRatePosition . $row, $bonus);
PavelBegunkov
committed
if ($i != 0) {
$extra = $data['Attempt'][1]['ExtraRate'];
$sheet->setCellValue($datePosition[$i] . $row, $data['Attempt'][$i + 1]['ExamDate'])
->setCellValue($extraRatePosition . $row, $extra);
PavelBegunkov
committed
$examAdmission += $extra;
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);
$str = $disciplineInfo['SubjectAbbr'];
if (empty($str)) {
$str = $disciplineInfo['SubjectName'];
//$str = preg_replace('/[^A-Za-z0-9\-]/', '', $str);
return substr($str, 0, 10);
$this->user->checkAccess(User::RIGHTS_DEAN);
//$gradeID = $this->post['gradeID'];
$groupID = $this->post['GroupID'];
$listDisciplines = Model_Group::with($groupID)->getDisciplines();
}
$objPHPExcel = PHPExcel_IOFactory::load($templateFile);
// Make copy of sheet
$sheetTemplate = $objPHPExcel->getActiveSheet()->copy();
// Make copy of named ranges
PavelBegunkov
committed
$gradeNum = 0;
$groupNum = 0;
$info = Model_Rating::getFinalFormInfo($discipline->ID, $groupID);
$type = $info['ExamType'];
if ($type == 'exam') {
continue;
}
// remove name ranges from active page
foreach ($objPHPExcel->getNamedRanges() as $name => $r) {
$objPHPExcel->removeNamedRange($r->getName(), null);
//make clone from page copy and include it in workbook
$C = clone $sheetTemplate;
try {
$C->setTitle($this->getSheetName($info));
} catch (Exception $ex) {
$C->setTitle("Без_имени_" . $index);
}
$objPHPExcel->addSheet($C, $index);
$objPHPExcel->setActiveSheetIndex($index);
// create name ranges at new sheet
foreach ($nmRange as $namedRange) {
$name = $namedRange->getName();
$rg = $namedRange->getRange();
$objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $objPHPExcel->getActiveSheet(), $rg));
}
} else {
try {
$objPHPExcel->setActiveSheetIndex($index)->setTitle($this->getSheetName($info));
} catch (Exception $ex) {
$objPHPExcel->setActiveSheetIndex($index)->setTitle("Без_имени_" . $index);
$gradeNum = $info['GradeNum'];
$groupNum = $info['GroupNum'];
}
# fixme: $stage param is missing
$this->printDisciplineToExcelFile($objPHPExcel, $discipline->ID, $groupID, $info);
$index++;
if ($index === 0) {
throw HTTP_Exception::factory(400);
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
public function GetHeaders($filename = 'excel') {
$this->response->headers("Last-Modified", gmdate("D,d M YH:i:s") . " GMT");
$this->response->headers("Cache-Control", " no-cache, must-revalidate");
$this->response->headers("Pragma", " no-cache");
$this->response->headers("Content-type", " application/vnd.ms-excel");
$this->response->headers("Content-Disposition", "attachment; filename=" . $filename . ".xls");
protected function checkExamIsHold(&$studentsRates) {
foreach ($studentsRates as $studentInfo) {
protected function formStringsForRates($ratesSet, $type, $examHold) {
$attestationAdmission = $ratesSet['Semester'] + $ratesSet['Extra'];
$total = $attestationAdmission + $ratesSet['Bonus'] + $ratesSet['Exam'];
return $this->formRateOfFive($attestationAdmission, $ratesSet['Exam'], $total, $examHold, $ratesSet['Option']);
// emulate exam to call formRateOfFive
$ratesSet['Exam'] = 22;
$ratesSet['Semester'] -= 22;
$res = $this->formRateOfFive($attestationAdmission, $ratesSet['Exam'], $total, $examHold);
case 'неуд':
$res[1] = 'не зачтено';
break;
$res[1] = 'зачтено (3)';
break;
case 'хор':
$res[1] = 'зачтено (4)';
break;
case 'отл':
$res[1] = 'зачтено (5)';
break;
}
return $res;
}
case 'credit': {
$totalStr = $total;
$totalStr = ($total < 60) ? '' : $totalStr;
$totalStr = ($total > 100) ? '100' : $totalStr;
$attestationStr = 'не зачтено';
if ($attestationAdmission >= 60)
$attestationStr = 'зачтено';
}
}
}
// Определяет оценку по пятибальной системе для экзамена
protected function formRateOfFive($examAdmission, $examRateValue, $totalRateValue, $examHold, $option = null) {
// особые случаи: неявка и автомат
if ($option == 'absence')
if ($option == 'pass') {
if ($examAdmission == 60)
}
// стандартная ситуация с оцениванием
if ($totalRateValue > 100)
$totalRateValue = 100;
$totalRateStr = '';
$examRateStr = '';
if ($examHold != 0) {
$examRateStr = $examRateValue;
if ($examAdmission < 38) {
$rateOfFive = 'н/д';
} elseif ($examRateValue < 22) {
$rateOfFive = 'неуд';
} else {
$totalRateStr = $totalRateValue;
$rateOfFive = 'удовл';
if (($totalRateValue >= 71) && ($totalRateValue < 85))
$rateOfFive = 'хор';
elseif ($totalRateValue >= 85)
$rateOfFive = 'отл';
}
} else {
if ($examAdmission < 38) { // задолженник
//$totalRateStr = ' ';
$rateOfFive = 'н/д';
$examRateStr = '';
}
}
return [$totalRateStr, $rateOfFive, $examRateStr];
protected function figureOutCreditDate($semesterNum, $year) {
$yearInt = (int) $year;
$result = "";
if ($semesterNum == 1)
else if ($semesterNum == 2) {
$result = "30.05.";