Exemplo n.º 1
0
 /**
  * 学校班级列表
  */
 public function classlist($schcls_schid = 0)
 {
     Fn::ajax_call($this, 'removeClass');
     if (!Validate::isInt($schcls_schid) || $schcls_schid <= 0) {
         return;
     }
     $param['schcls_schid'] = $schcls_schid;
     $param['schcls_name'] = Fn::getParam('schcls_name');
     $total = SchoolModel::schoolClassListCount($param);
     $size = 15;
     $page = 1;
     if (isset($_GET['page']) && intval($_GET['page']) > 1) {
         $page = intval($_GET['page']);
     }
     $offset = ($page - 1) * $size;
     $schclass_list = SchoolModel::schoolClassList('*', $param, $page, $size);
     $get = $_GET;
     unset($get['page']);
     $url = site_url('admin/school/classlist/' . $schcls_schid) . '?' . http_build_query($get);
     $data['pagination'] = multipage($total, $size, $page, $url);
     $data['list'] = $schclass_list;
     $data['param'] = $param;
     // 模版
     $this->load->view('school/classlist', $data);
 }
Exemplo n.º 2
0
 /**
  * 编辑考场信息
  *
  * @return  void
  */
 public function edit($id = 0)
 {
     if (!$this->check_power('exam_manage')) {
         return;
     }
     $id = intval($id);
     $id && ($place = ExamPlaceModel::get_place($id));
     if (empty($place)) {
         message('考场不存在');
         return;
     }
     $parent = ExamModel::get_exam($place['exam_pid'], 'exam_id,exam_name,exam_pid,grade_id,creator_id,managers,exam_isfree');
     if (empty($parent) or $parent['exam_pid'] > 0) {
         message('考试期次不存在', 'admin/exam/index');
         return;
     }
     $managers = $parent['managers'] ? json_decode($parent['managers'], true) : array();
     $this->check_exam_manager_power($parent['creator_id'], $managers);
     $place['start_time'] = date('Y-m-d H:i', $place['start_time']);
     $place['end_time'] = date('Y-m-d H:i', $place['end_time']);
     $place['exam_time_custom'] = json_decode($place['exam_time_custom'], true);
     $grade_period = get_grade_period($parent['grade_id']);
     $query = $this->db->select('s.school_id,s.school_name,count(u.uid) nums')->from('school s')->join('student u', 's.school_id=u.school_id')->like('s.grade_period', $grade_period)->where(array('u.is_delete' => 0))->group_by('s.school_id')->get();
     $schools = $query->result_array();
     if ($schools) {
         $school_ids = array();
         foreach ($schools as $item) {
             $school_ids[] = $item['school_id'];
         }
         $param['schcls_schid'] = implode(',', $school_ids);
         $data['class'] = SchoolModel::schoolClassList("*", $param, 1, time());
     }
     $data['act'] = 'edit';
     $data['place'] =& $place;
     $data['parent'] =& $parent;
     $data['schools'] =& $schools;
     // 模版
     $this->load->view('exam_place/edit', $data);
 }