Skip to content
Snippets Groups Projects
Commit 69ce0dda authored by Andrew Rudenets's avatar Andrew Rudenets
Browse files

fixed, see issue #29

parent b3c7fc44
Branches
Tags
No related merge requests found
......@@ -6,6 +6,9 @@ function GroupFunction(type) {
var jItemContainer = $('.TransferListItem');
var jList = $("#" + type + "ItemsList");
jGrades.find('option[value=-1]').attr('selected', 'selected');
jGroupSelect.find('option[value=-1]').attr('selected', 'selected');
jSemesters.change(function () {
var sem_id = jSemesters.find('option:selected').val();
if (sem_id != 0) {
......
......@@ -26,6 +26,7 @@ function Controller() {
var onTransfer = function (groupID, semesterID) {
if (groupID != -1) {
$.post(URLdir + 'handler/Students/transfer/',
{
studyGroupID: groupID,
......
......@@ -78,16 +78,36 @@ class Controller_Handler_Students extends Controller_Handler
}
}
private function groupByID($array)
{
$result = [];
foreach($array as $key => $value)
$result[] = $value['ID'];
return $result;
}
public function action_transfer() {
$this->user->checkAccess(User::RIGHTS_ADMIN | User::RIGHTS_DEAN);
$semesterID = (int) $this->post['semesterID'];
$groupID = (int) $this->post['studyGroupID'];
$transferList = json_decode($this->post['transferList']);
// Отметаем всех студентов, которые уже есть в группе
$group = $this->groupByID(Model_Students::ofGroup($groupID, $semesterID));
$transferList = array_diff($transferList, $group);
foreach($transferList as $ID)
{
// TODO: review the name of this method
Model_Student::load($ID)->returnFromAcademicLeave($groupID, $semesterID);
}
$this->action_getByGroup();
}
public function action_debug()
{
echo Debug::vars($group);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment