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'];
     }
 }