request->getQuery('cid')); if(!$get_id){ Yii::app()->jump->error('参数错误!'); } $data=array(); $data['teamData']=$this->schoolManager->getTeamByClass($get_id); //读取所有分组 //debug($data); $data['cid']=$get_id; $this->render('index',$data); } //添加小组 public function actionAdd_team(){ $team_name = safe_replace(Req::post('team_name')); $cid = safe_replace(Req::post('cid')); $team_id = safe_replace(Req::post('team_id')); $result['status']=0; if(!$team_name){ $result['msg']='添加失败,参数不正确'; exit(json_encode($result)); } $TeamModel=new STeam(); if($team_id){ $checkData=$TeamModel->fetchById($team_id); if(!$checkData){ $result['msg']='编辑失败,分组不存在'; exit(json_encode($result)); } $checkRepeat=$TeamModel->getByName($team_name,$cid); if($checkRepeat && $checkRepeat['team_id']!=$team_id){ $result['msg']='编辑失败,分组名称已存在'; exit(json_encode($result)); } if($TeamModel->updateTeam($team_name,$team_id)){ $result['status']=1; exit(json_encode($result)); }else{ $result['msg']='编辑失败'; exit(json_encode($result)); } }else{ $checkRepeat=$TeamModel->getByName($team_name,$cid); if($checkRepeat){ $result['msg']='添加失败,分组已经存在'; exit(json_encode($result)); } if($team_id=$TeamModel->addTeam($team_name,$cid)){ $result['status']=1; $result['team_id']=$team_id; exit(json_encode($result)); }else{ $result['msg']='添加失败'; exit(json_encode($result)); } } } //编辑小组 public function actionEdit_team(){ $team_name=$getName = safe_replace(Yii::app()->request->getQuery('Name')); $cid=$getName = safe_replace(Yii::app()->request->getQuery('cid')); $team_id=safe_replace(Yii::app()->request->getQuery('tid')); } //删除整组 public function actionDel_team(){ $team_id=safe_replace(Req::post('team_id')); $result['status']=0; if(!$team_id){ $result['msg']='操作失败,参数不正确'; exit(json_encode($result)); } $TeamModel=new STeam(); //判断小组是否有学生 $team_student=$TeamModel->getStudentByTeamId($team_id); if($team_student){ if($TeamModel->delTeam($team_id)){ $result['status']=1; exit(json_encode($result)); } }else{ if($TeamModel->delRealTeam($team_id)){ $result['status']=1; exit(json_encode($result)); } } $result['msg']='操作失败'; exit(json_encode($result)); } //学生列表 public function actionGetStudent(){ $cid=safe_replace(Req::post('cid')); $student_list=$this->schoolManager->getStudentByClassId($cid); //所有学生列表 //已分组学生列表 $team_student=$this->schoolManager->getTeamByClass($cid,'student'); //所有学生列表 $html=''; $html.="