网上选课系统的设计与实现(6)

2019-04-14 12:15

测试结果:正常,通过。

②检查查看信息功能:是否可查看选课信息,以及公告信息。 测试结果:正常,通过。

本章介绍了系统功能的具体实现,以各子系统为单位进行了功能阐述;最后对系统进行测试,经测试,系统运行正常。

6 系统关键代码部分

该系统涉及的关键代码就是对数据库的增删改查,下面的代码是关于课程表操作的。

if (!defined('BASEPATH'))

exit('No direct script access allowed');

class Coursec extends CI_Controller {

function __construct() { parent::__construct();

$this->load->helper(array('form', 'url')); $this->load->model('course'); $this->load->model('teacher'); $this->load->database(); }

public function index() {

$this->load->view('course_man'); }

public function del() {

$id = $this->input->post('id');

$this->course->delete_course($id); }

public function tojson() {

$num = $this->course->count_table();

$query = $this->course->get_sql_list(\c.name as room_name,a.namc.name as room_name,a.ne as teacher_name,b.* FROM tb_teacher as a,tb_course as b,tb_room as c WHERE a.id=b.teacher AND c.id=b.room\ $arr = array(

\ \ );

echo json_encode($arr); }

public function tojsonselect() {

$query = $this->course->get_sql_list(\ echo json_encode($query); }

23

public function save() {

$uid = $this->input->post('uid'); $name = $this->input->post('name'); $des = $this->input->post('des');

$isopen = $this->input->post('isopen'); $ismust = $this->input->post('ismust'); // $period = $this->input->post('period'); // $time = $this->input->post('time'); $long = $this->input->post('longs'); // $room = $this->input->post('room'); $teacher = $this->input->post('teacher');

$data = array( 'uid' => $uid, 'name' => $name, 'des' => $des,

'isopen' => $isopen, 'ismust' => $ismust, // 'period' => $period, // 'time' => $time, 'longs' => $long, // 'room' => $room, 'teacher' => $teacher );

$flag = $this->course->add($data); $tip = \添加成功!\ if (!$flag) {

$tip = \对不起,添加课程失败,请更换信息!\ }

echo $tip; }

public function ops() {

$id = $this->input->post('id');

$room = $this->input->post('room'); $period = $this->input->post('period'); $time = $this->input->post('time'); $data = array( 'id' => $id, 'isopen' => 1,

'period' => $period, 'time' => $time, 'room' => $room, );

$flag = $this->course->update($data);

$tip = \开课成功!\ if (!$flag) {

$tip = \开课排课失败!\ }

24

echo $tip; }

public function cls() {

$id = $this->input->post('id'); $data = array( 'id' => $id, 'isopen' => 0,

'period' => NULL, 'time' => NULL, 'room' => 0, );

$flag = $this->course->update($data);

$tip = \课程已关闭!\ if (!$flag) {

$tip = \课程关闭失败!\ }

echo $tip; }

public function update() { $id = $this->input->post('id'); // $uid = $this->input->post('uid'); $name = $this->input->post('name'); $des = $this->input->post('des');

$isopen = $this->input->post('isopen'); $ismust = $this->input->post('ismust'); $period = $this->input->post('period'); // $time = $this->input->post('time'); $long = $this->input->post('longs'); // $room = $this->input->post('room'); $teacher = $this->input->post('teacher');

$data = array( 'id' => $id,

'name' => $name, 'des' => $des,

'isopen' => $isopen, 'ismust' => $ismust, // 'period' => $period, // 'time' => $time, 'longs' => $long, // 'room' => $room, 'teacher' => $teacher );

$flag = $this->course->update($data);

$tip = \修改成功!\

25

if (!$flag) {

$tip = \对不起,修改失败,请查看输入的数据是否正确!\ }

echo $tip;

//echo json_encode($data2); }

public function tc() {

$tid = $this->input->get('id');

$data['me'] = $this->teacher->get_teacher_detail2($tid); $this->load->view('course_t', $data); }

public function serach() {

$keyword = $this->input->get('keyword');

$query = $this->course->get_sql_list(\c.name as room_name,a.name as teacher_name,b.* FROM tb_teacher as a,tb_course as b,tb_room as c WHERE (b.uid LIKE '%$keyword%' OR b.time LIKE '%$keyword%' OR b.name LIKE '%$keyword%' OR a.name LIKE '%$keyword%' OR c.name LIKE '%$keyword%') AND a.id=b.teacher AND c.id=b.room \

$num = count($query); if ($num >= 1) { $arr = array( \ \ ); } else {

$arr = array( \ \ ); }

echo json_encode($arr); }

public function seracht() {

$keyword = $this->input->get('keyword'); $id = $this->input->get('id');

$query = $this->course->get_sql_list(\c.name as room_name,a.name as teacher_name,b.* FROM tb_teacher as a,tb_course as b,tb_room as c WHERE a.id=b.teacher AND c.id=b.room AND b.teacher = '$id' AND (b.uid LIKE '%$keyword%' OR b.time LIKE '%$keyword%' OR b.name LIKE '%$keyword%' OR a.name LIKE '%$keyword%' OR c.name LIKE '%$keyword%')\ $num = count($query); if ($num >= 1) { $arr = array( \ \ ); } else {

$arr = array(

26

\ \ ); }

echo json_encode($arr); }

public function tcjson() { $id = $this->input->get('id');

$query = $this->course->get_sql_list(\c.name as room_name,a.name as teacher_name,b.* FROM tb_teacher as a,tb_course as b,tb_room as c WHERE a.id=b.teacher AND c.id=b.room AND b.teacher = '$id'\ $num = count($query); $arr = array(

\ \ );

echo json_encode($arr); } }

关于系统其它数据的增删改查代码与上述代码类似,这里不再赘述。

7 总结

通过三个月的努力,在老师与同学们的指导帮助下,网上选课系统顺利完成了,本系统分为管理员、教师和学生三大模块。管理员模块主要实现老师、学生和课程信息的管理功能;教师模块主要修改个人信息,进行课程的管理;学生模块可以修改个人信息,自主选课和查看选课信息。本系统界面清晰,操作简单,用户可以很方便的使用本系统。本系统与教育管理中的实际问题结合起来,总结说来起到三个作用,一是可以使专业结构优化,使学生可以根据兴趣跨专业选课,多了解掌握感兴趣的学科知识。二是打破教学刻板化,教师可提供一些基础课程,既与现下热门的职业技能证书有关,又不太涉及太艰深专业背景知识,指导跨专业的学生熟悉了解。三是选课公平合理,采用集中学生上网选课的方式,尽可能地使学生在同样的时间内,查看同样的选课内容,选出自己喜欢的可能,保证学生在选课过程中公平性、合理性。

由于时间有限,本人水平不是很高,本系统在教师模块中对于教师开课申请列表不是很清晰,教师操作也不是很方便,同时也没有加入学生评价这一功能,我会在今后的实践中继续慢慢总结和调整。本系统仍存在思路不够简单的问题,在设计上亦有缺陷和不得当之处,欢迎各位老师批评指正!

27

致谢

首先,感谢我的指导老师王华,她帮助我解决了我设计中所出现的困难和疑惑,耐心指出我的不足,并多次热心的帮我查找相关的资料和书籍,我的毕业设计顺利完成与我的指导老师分不开的。其次要感谢我的同学顾琪琪,他在我的毕业设计上给了我很大的帮助,耐心的给我讲解有关知识,真诚的为我提意见。最后,感谢各位评委老师在百忙中评审我的论文。 参考文献

[1] 《国家人力资源和社会保障部、国家工业和信息化部信息专业技术人才知识更新工程(“653”工

程)指定教材》编委会编著.PHP + MySQL开发实例教程[M].北京:中国电力出版社.2008. [2] 张海藩.软件工程导论(第五版)[M].北京:清华大学出版社.2008.

[3] 秦宝军、马靖善、李燕等.基于PH P/M ySQL的体育俱乐部选课系统的设计与实现[J].计算机与

信息技术.2007(13):10-43.

[4] 郑刚.基于B/S 模式的网上教学系统研究与设计[J]. 计算机工程与应用.2001(05).

[5] (澳)威利,(澳)汤姆森著,武欣等译.PHP 和 MySQL Web开发[M]. 北京:机械工业出版社,2004. [6] 王珊.萨师煊.数据库系统概论(4版)[M].北京:高等教育出版社,2006:198-234. [7] 韩诗琳.学生网上选课系统的设计与实现[D].长春:吉林大学.2012.

28


网上选课系统的设计与实现(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:不知不觉也是牛仔元老了,转一篇日牛知识贴

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: