public function groupAction()
 {
     $group_DB = new Application_Model_DbTable_Group();
     $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) {
         $group = $group_DB->get($group_id);
         $this->view->group = $group;
         $this->view->group_id = $group_id;
         $this->view->target_id = $target_id;
         $this->view->level_id = $level_id;
         $this->view->game_id = $game_id;
     } else {
         if ($group_id) {
             $group = $group_DB->get($group_id);
             $this->view->group_id = $group_id;
             $this->view->group = $group;
         }
     }
 }
示例#2
0
 public function doneactivitiesAction()
 {
     $user = Zend_Auth::getInstance()->getStorage()->read();
     $group_DB = new Application_Model_DbTable_Group();
     if (!isset($_SESSION['Default']['field'])) {
         $this->view->field_error = true;
     } else {
         $groups = $group_DB->getAll($user->ganID, $_SESSION['Default']['field']);
         #VIEWS
         $this->view->groups = $groups;
     }
 }
 public function importgroupsAction()
 {
     $fieldID = $this->_request->getParam('f');
     if ($fieldID) {
         $user = Zend_Auth::getInstance()->getStorage()->read();
         $groups_DB = new Application_Model_DbTable_Group();
         $students_DB = new Application_Model_DbTable_StudentsInField();
         $groups = $groups_DB->getAll($user->ganID, $fieldID);
         foreach ($groups as $g) {
             $new_group = array('name' => $g['name'], 'color' => $g['color'], 'ganID' => $user->ganID, 'fieldID' => $_SESSION['Default']['field']);
             try {
                 $group_id = $groups_DB->insert($new_group);
             } catch (Exception $ex) {
                 die(json_encode(array('status' => 'danger', 'msg' => $ex->getMessage())));
             }
             $students = $students_DB->getAll($g['groupID']);
             foreach ($students as $s) {
                 $new_student = array('studentID' => $s['studentID'], 'fieldID' => $_SESSION['Default']['field'], 'groupID' => $group_id);
                 try {
                     $student_id = $students_DB->insert($new_student);
                 } catch (Exception $ex) {
                     die(json_encode(array('status' => 'danger', 'msg' => $ex->getMessage())));
                 }
             }
         }
         $this->_redirect("/managegroups");
     } else {
         $fields_DB = new Application_Model_DbTable_Field();
         $fields = $fields_DB->getAll();
         $this->view->fields = $fields;
         $this->view->fieldID = $_SESSION['Default']['field'];
     }
 }
示例#4
0
 public function reportAction()
 {
     $groupID = $this->_request->getParam('g');
     $_SESSION['Default']['report'] = true;
     $group_DB = new Application_Model_DbTable_Group();
     $groupName = $group_DB->getName($groupID);
     $this->view->group_name = $groupName;
     $plans_DB = new Application_Model_DbTable_Planing();
     $plans = $plans_DB->getByGroupReverse($groupID, $_SESSION['Default']['field']);
     $this->view->plans = $plans;
 }
 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();
     }
 }