"git@gitlab.mmcs.sfedu.ru:denis_st/compilers-denis-st.git" did not exist on "010135c9ded62e214c680f7aa62dccf7a40dd4d8"
Newer
Older
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Teacher_Rating extends Controller_UserEnvi {
public function action_edit()
{
$id = $this->request->param('id');
// Шапка: модули и подмодули
$discipline = $db->GetMapForDiscipline($this->UserInfo['TeacherID'], $id);
if($discipline->count() == 0)
throw HTTP_Exception::factory (404, "Дисциплины с ID $id не существует!");
$disciplineHandled = array();
$maxRate = 0; $i = 0; $module = 0;
foreach($discipline as $row)
if($row['ModuleID'] != $module)
{
$i++;
$module = $row['ModuleID'];
}
if ($i == 1)
$disciplineHandled['SubjectName'] = $row['SubjectName'];
if(!isset($disciplineHandled[$i]['SubmodulesCount']))
{
$disciplineHandled[$i]['SubmodulesCount'] = 0;
$disciplineHandled[$i]['MaxRate'] = 0;
}
$j = $disciplineHandled[$i]['SubmodulesCount'] += 1;
$disciplineHandled[$i]['MaxRate'] += (int) $row['MaxRate'];
$disciplineHandled[$i]['ModuleTitle'] = $row['ModuleName'];
$disciplineHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID'];
$disciplineHandled[$i][$j]['Title'] = $row['SubModuleName'];
$disciplineHandled[$i][$j]['Description'] = $row['SubmoduleDescription'];
$disciplineHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate'];
$maxRate += $row['MaxRate'];
}
$disciplineHandled['ModulesCount'] = $i;
$disciplineHandled['MaxRate'] = (int) $maxRate;
$twig->headerRate = $disciplineHandled;
// Студенты и баллы
$students = $db->GetStudentsForDiscipline($this->UserInfo['TeacherID'], $id);
$studentsHandled = array();
$i = 0; $MigrantsCount = 0;
foreach($students as $row) {
if ($row['isAttached'] == '0') {
// Не Мигранты
$i++;
$studentsHandled[$i]['StudentID'] = $row['StudentID'];
$studentsHandled[$i]['LastName'] = $row['StudentLast'];
$studentsHandled[$i]['FirstName'] = $row['StudentFirst'];
$studentsHandled[$i]['SecondName'] = $row['StudentSecond'];
$studentsHandled[$i]['Grade'] = $row['Grade'];
$studentsHandled[$i]['GroupNum'] = $row['GroupNum'];
$rate = $db->getMapForStudent($row['StudentID'], $id);
$j = 0;
foreach($rate as $r) {
$j += 1;
$studentsHandled[$i][$j]['SubmoduleID'] = $r['SubmoduleID'];
$studentsHandled[$i][$j]['Rate'] = $r['Rate'];
}
$studentsHandled[$i]['RateCount'] = $j;
}
else {
// Мигранты
$MigrantsCount++;
$MigrantsHandled[$MigrantsCount]['StudentID'] = $row['StudentID'];
$MigrantsHandled[$MigrantsCount]['StudentID'] = $row['StudentID'];
$MigrantsHandled[$MigrantsCount]['LastName'] = $row['StudentLast'];
$MigrantsHandled[$MigrantsCount]['FirstName'] = $row['StudentFirst'];
$MigrantsHandled[$MigrantsCount]['SecondName'] = $row['StudentSecond'];
$MigrantsHandled[$MigrantsCount]['Grade'] = $row['Grade'];
$MigrantsHandled[$MigrantsCount]['GroupNum'] = $row['GroupNum'];
$rate = $db->getMapForStudent($row['StudentID'], $id);
$j = 0;
foreach($rate as $r) {
$j += 1;
$MigrantsHandled[$MigrantsCount][$j]['SubmoduleID'] = $r['SubmoduleID'];
$MigrantsHandled[$MigrantsCount][$j]['Rate'] = $r['Rate'];
}
$MigrantsHandled[$MigrantsCount]['RateCount'] = $j;
}
}
$twig->tableRate = $studentsHandled;
if (isset($MigrantsHandled))
$twig->migrantsRate = $MigrantsHandled;