Exemple #1
0
 /**
  * 学校教师列表
  */
 public function teacherlist($sch_id)
 {
     Fn::ajax_call($this, 'removeSchoolTeacher');
     if (!Validate::isInt($sch_id) || $sch_id <= 0) {
         return;
     }
     $school = SchoolModel::schoolInfo($sch_id);
     if (!$school) {
         return;
     }
     $param = array();
     if (isset($_GET['page'])) {
         $page = intval($_GET['page']);
         if ($page < 1) {
             $page = 1;
         }
     } else {
         $page = 1;
     }
     $param['scht_schid'] = $sch_id;
     $param['ct_name'] = trim($this->input->get('ct_name'));
     $param['grade_id_str'] = $this->input->get('grade_id_str');
     $param['subject_id_str'] = $this->input->get('subject_id_str');
     $data = array();
     $data['school'] = $school;
     $data['param'] = $param;
     $total = SchoolModel::schoolTeacherListCount($param);
     if ($total) {
         $data['list'] = SchoolModel::schoolTeacherList('*', $param, $page);
         $ct_id_str = implode(',', array_keys($data['list']));
         if ($ct_id_str) {
             $data['cteacher_gradeid'] = CTeacherModel::CTeacherGradeIDPairs($ct_id_str);
             $data['cteacher_subjectid'] = CTeacherModel::CTeacherSubjectIDPairs($ct_id_str);
         } else {
             $data['cteacher_gradeid'] = array();
             $data['cteacher_subjectid'] = array();
         }
         $get = $_GET;
         unset($get['page']);
         $url = site_url('admin/school/teacherlist/' . $sch_id) . '?' . http_build_query($get);
         $data['pagination'] = multipage($total, C('default_perpage_num'), $page, $url);
     }
     $data['subject_map'] = C('subject');
     $data['grade_map'] = C('grades');
     // 模版
     $this->load->view('school/teacherlist', $data);
 }