Skip to content
Snippets Groups Projects
Commit a9c56216 authored by Антон Шалимов's avatar Антон Шалимов
Browse files

промежуточный коммит

parent 72cb6690
Branches
No related merge requests found
......@@ -2,18 +2,17 @@
class Controller_Teacher_Rating extends Controller_UserEnvi {
// Получить из кука SGID выбранную ранее группу
private function GetSGID($id)
{
# $id = disciplineID
$SG_json = json_decode(Cookie::get('SGID', null), true);
if ($SG_json !== null)
$SG_ar = json_decode(Cookie::get('SGID', null), true);
if ($SG_ar !== null)
{
//var_dump($SG_json);
if (array_key_exists($id, $SG_json))
return $SG_json[$id];
else return 0;
} else return 0;
if (array_key_exists($id, $SG_ar))
return $SG_ar[$id];
}
return 0;
}
public function action_edit()
......@@ -23,16 +22,16 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$id = $this->request->param('id');
$db = new Model_Teacher_Rating;
// Шапка: модули и подмодули
$discipline = $db->GetMapForDiscipline($this->UserInfo['TeacherID'], $id);
// Шапка таблицы: структура УКД (модули и мероприятия)
$structure = $db->GetMapForDiscipline($this->UserInfo['TeacherID'], $id);
if($discipline->count() == 0)
if($structure->count() == 0)
throw HTTP_Exception::factory (404, "Для дисциплины с ID $id не создана УКД или такой дисциплины не существует!");
$disciplineHandled = array();
$structureHandled = array();
$maxRate = 0; $i = 0; $module = 0;
foreach($discipline as $row)
foreach($structure as $row)
{
if($row['ModuleID'] != $module)
{
......@@ -40,40 +39,37 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$module = $row['ModuleID'];
}
if ($i == 1)
$disciplineHandled['SubjectName'] = $row['SubjectName'];
if(!isset($disciplineHandled[$i]['SubmodulesCount']))
$structureHandled['SubjectName'] = $row['SubjectName'];
if(!isset($structureHandled[$i]['SubmodulesCount']))
{
$disciplineHandled[$i]['SubmodulesCount'] = 0;
$disciplineHandled[$i]['MaxRate'] = 0;
$structureHandled[$i]['SubmodulesCount'] = 0;
$structureHandled[$i]['MaxRate'] = 0;
}
$j = $disciplineHandled[$i]['SubmodulesCount'] += 1;
$disciplineHandled[$i]['MaxRate'] += (int) $row['MaxRate'];
$disciplineHandled[$i]['ModuleTitle'] = $row['ModuleName'];
$disciplineHandled[$i]['ModuleType'] = $row['ModuleType'];
$j = $structureHandled[$i]['SubmodulesCount'] += 1;
$structureHandled[$i]['MaxRate'] += (int) $row['MaxRate'];
$structureHandled[$i]['ModuleTitle'] = $row['ModuleName'];
$structureHandled[$i]['ModuleType'] = $row['ModuleType'];
if ($row['ModuleType'] == "exam")
$twig->examSubmoduleID = $row['SubmoduleID'];
$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'];
$structureHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID'];
$structureHandled[$i][$j]['Title'] = $row['SubModuleName'];
$structureHandled[$i][$j]['Description'] = $row['SubmoduleDescription'];
$structureHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate'];
$maxRate += $row['MaxRate'];
}
$disciplineHandled['ModulesCount'] = $i;
$disciplineHandled['MaxRate'] = (int) $maxRate;
//echo debug::vars($disciplineHandled);
$structureHandled['ModulesCount'] = $i;
$structureHandled['MaxRate'] = (int) $maxRate;
$twig->headerRate = $disciplineHandled;
// Студенты и баллы
$twig->headerRate = $structureHandled;
// end Шапка таблицы
// Студенты и их баллы
$students = $db->GetStudentsForRating($this->UserInfo['TeacherID'], $id);
$studentsHandled = array();
$i = 0;
$curGroup = 0;
$groups = array();
$studentsHandled = array();
$i = 0; $curGroup = 0; $groups = array();
foreach($students as $row) {
$i++;
......@@ -107,6 +103,9 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
}
$studentsHandled[$i]['RateCount'] = $j;
}
echo Debug::vars($studentsHandled);
$twig->tableRate = $studentsHandled;
$twig->groups = $groups;
......
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