public function studentsAction() { $group_id = $this->_request->getParam('g'); $target_id = $this->_request->getParam('t'); $level_id = $this->_request->getParam('l'); $game_id = $this->_request->getParam('gm'); //Return After Planining if ($group_id && $target_id && $level_id) { $student_DB = new Application_Model_DbTable_Student(); $grade_DB = new Application_Model_DbTable_Grade(); $students = $student_DB->getAll($group_id); $grades = $grade_DB->getAll($target_id, $level_id); $_students = array(); foreach ($students as $s) { $s['grades'] = $grades; $_students[] = $s; } $this->view->students = $_students; $this->view->group_id = $group_id; $this->view->target_id = $target_id; $this->view->level_id = $level_id; $this->view->game_id = $game_id; } }
public function studentsAction() { $group_id = $this->_request->getParam('g'); $target_id = $this->_request->getParam('t'); $game_id = $this->_request->getParam('gm'); $is_recommend = $this->_request->getParam('recommend'); //Return After Planining if ($group_id && $target_id) { $student_DB = new Application_Model_DbTable_StudentsInField(); $grade_DB = new Application_Model_DbTable_Grade(); $students = $student_DB->getAll($group_id); $grades = $grade_DB->getAll($target_id); $_students = array(); foreach ($students as $s) { $s['grades'] = $grades; $_students[] = $s; } $this->view->students = $_students; $this->view->group_id = $group_id; $this->view->target_id = $target_id; $this->view->game_id = $game_id; $groups_DB = new Application_Model_DbTable_Group(); $this->view->groupName = $groups_DB->getName($group_id); } else { $plans_DB = new Application_Model_DbTable_Planing(); $last_plan = $plans_DB->getLastPlan($group_id, $_SESSION['Default']['field']); if ($last_plan) { $group_id = $last_plan['groupID']; $target_id = $last_plan['goal_id']; $game_id = $last_plan['game_id']; $student_DB = new Application_Model_DbTable_StudentsInField(); $grade_DB = new Application_Model_DbTable_Grade(); $students = $student_DB->getAll($group_id); $grades = $grade_DB->getAll($target_id); $_students = array(); foreach ($students as $s) { $s['grades'] = $grades; $_students[] = $s; } $this->view->students = $_students; $this->view->group_id = $group_id; $this->view->target_id = $target_id; $this->view->game_id = $game_id; $groups_DB = new Application_Model_DbTable_Group(); $this->view->groupName = $groups_DB->getName($group_id); } else { $this->view->group_id = $group_id; $groups_DB = new Application_Model_DbTable_Group(); $this->view->groupName = $groups_DB->getName($group_id); } } $games_DB = new Application_Model_DbTable_Game(); $this->view->gameName = $games_DB->getGameName($game_id); $notes = $this->getRequest()->getPost('notes'); if ($notes) { $comments_DB = new Application_Model_DbTable_Comments(); $new_comment = array('groupID' => $group_id, 'gameID' => $game_id, 'date' => date('Y-m-d H:i:s'), 'text' => $notes, 'fieldID' => $_SESSION['Default']['field']); try { $comment_id = $comments_DB->insert($new_comment); } catch (Exception $ex) { die(json_encode(array('status' => 'danger', 'msg' => $this->lang->_('FAILED_DOC')))); } } if ($is_recommend) { $this->recommend(); } }