/** * 学校列表 * @method GET_indexAction * @author NewFuture */ public function GET_indexAction() { $fileds = 'id,name,abbr,verify,verifyurl'; if (Input::get('key', $key)) { $key = '%' . strtr($key, ' ', '%') . '%'; $schools = SchoolModel::where('name', 'LIKE', $key)->select($fileds); $this->response(1, $schools); } elseif ($schools = SchoolModel::all($fileds)) { $this->response(1, $schools); } else { $this->response(0, '无法查看学校信息'); } }
/** * [_getList description] * @method _getList * @return [type] [description] * @access private * @author NewFuture */ private static function _getList() { if (!($list = Cache::get('v_school_list'))) { $schools = SchoolModel::where('id', '>', 0)->select('id,abbr'); foreach ($schools as $school) { $list[$school['id']] = strtolower($school['abbr']); } Cache::set('v_school_list', $list, 864000); } return $list; }
public function deleteschool() { $school = new SchoolModel(); $id = $_GET['id']; if ($school->where("school_id='{$id}'")->delete()) { $this->assign("jumpUrl", "__APP__/Manager/index"); $this->success("delete school success"); } else { $this->assign("jumpUrl", "__APP__/Manager/index"); $this->error("delete school failed!"); } }
public function forschool() { $id = $_GET['id']; $schoolcourse = new SchoolcourseModel(); $course = new CourseModel(); $school = new SchoolModel(); $list = array(); $schoollist = $school->select(); $thisschool = $school->where("school_id='{$id}'")->find(); $schoolcourselist = $schoolcourse->where("school_id='{$id}'")->select(); foreach ($schoolcourselist as $key) { $course_id = $key['course_id']; $result = $course->where("course_id='{$course_id}'")->find(); if ($result) { $list[] = $result; } } $this->assign('schoollist', $schoollist); $this->assign('school_name', $thisschool['school_name']); $this->assign('list', $list); $this->display(); }