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

FIX: complex report (10 from #49)

parent 165f2a9d
Branches
Tags
No related merge requests found
......@@ -19,7 +19,7 @@ $(function () {
var gr_id = jGradeSelect.find('option:selected').val();
if (gr_id) {
jGroupSelect.prop('disabled', false);
$.post(URLdir + 'handler/Transfer/getGroups',
$.post(URLdir + 'handler/Transfer/getGroups', // todo: handler students
{'gradeID': jGradeSelect.find('option:selected').val()},
function (data) {
jGroupSelect.html(data);
......@@ -30,11 +30,15 @@ $(function () {
});
jGroupSelect.change(function () {
var sem_id = jSemesterSelect.find('option:selected').val();
var gr_id = jGroupSelect.find('option:selected').val();
if (gr_id) {
jContent.css('display', 'none');
jSpinner.css('display', 'block');
$.post(URLdir + 'office/bill/group/' + gr_id,
{
'semesterID': sem_id
},
function (data) {
jSpinner.css('display', 'none');
jContent.html(data);
......
......@@ -6,16 +6,9 @@ class Controller_Handler_Transfer extends Controller_Handler
}
public function action_getGroups() {
$GradeId = $this->post['gradeID'];
$groups = $this->user->Faculty->getGroups($GradeId);
$grList = '<option value="-1">-- Выберите группу --</option>';
foreach($groups as $gr){
$grList .= '<option value = ' . $gr['ID'] . '> Группа №'
. $gr['GroupNum'] . ' ' .
$gr['SpecAbbr'] . '</option>';
}
$this->response->body($grList);
$gradeId = $this->post['gradeID'];
$twig = Twig::factory('handler/listGroups');
$twig->Groups = $this->user->Faculty->getGroups($gradeId);
$this->response->body($twig->render());
}
}
......@@ -7,8 +7,8 @@ class Controller_Office_Bill extends Controller_Environment_Office
Cookie::set('fD', 'true');
}
public static function makeTable($groupID, &$disciplines) {
$students = Model_Students::ofGroup($groupID);
public static function makeTable($groupID, &$disciplines, $semesterID) {
$students = Model_Students::ofGroup($groupID, $semesterID); // TODO: refactor after new groups implemented
$table = [];
foreach ($students as $stud) {
......@@ -18,7 +18,6 @@ class Controller_Office_Bill extends Controller_Environment_Office
];
}
foreach ($disciplines as &$dis) {
$rates = Model_Rating::getRatesForStudentsGroupByStage2($dis['ID'], $groupID, 3);
foreach ($rates as $record) {
......@@ -74,12 +73,13 @@ class Controller_Office_Bill extends Controller_Environment_Office
}
public function action_group() {
$id = $this->request->param('id');
$disciplines = Model_Group::with($id)->getDisciplines();
$groupID = $this->request->param('id');
$semesterID = $this->post['semesterID'];
$disciplines = Model_Group::with($groupID)->getDisciplines(false, $semesterID); // TODO: refactor after new groups implemented
$this->twig->set_filename(static::OFFICE . 'bill')
->set([
'Disciplines' => self::formHead($disciplines),
'Table' => self::makeTable($id, $disciplines)
'Table' => self::makeTable($groupID, $disciplines, $semesterID)
]);
}
}
{# Генерация списка групп #}
<option value="-1">-- Выберите группу --</option>
{% for Group in Groups %}
<option value = {{ Group.ID }}>
Группа {{ Group.GroupNum }} - {{ Group.SpecAbbr }}
</option>
{% endfor %}
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