示例#1
0
 public function history()
 {
     $this->login_check(1);
     $user = public_user_id();
     $this->assign('user', $user);
     $ttype = public_user_ttype();
     $this->assign("ttype", $ttype);
     $this->display();
 }
示例#2
0
 public function index()
 {
     //获取学生信息
     $user = public_user_id();
     $model_user = M('user_student');
     $rs_user = $model_user->field('name,pic')->where("user='******'")->select();
     $this->assign('user', $rs_user[0]);
     $this->display();
 }
示例#3
0
 public function index()
 {
     $this->login_check(1);
     $user = public_user_id();
     $model_user = M('user_teacher');
     $rs_user = $model_user->field('pic,name')->where("user='******'")->select();
     $this->assign('user', $rs_user[0]);
     $ttype = public_user_ttype();
     $this->assign("ttype", $ttype);
     $this->display();
 }
示例#4
0
 public function edit_pwd()
 {
     $this->login_check(2);
     $user = public_user_id();
     $pwd = I('post.pwd');
     $pwd2 = I('post.pwd2');
     if ($pwd && $pwd2) {
         $model_user = D('Info');
         if ($model_user->checkpwd($user, $pwd)) {
             if ($model_user->updatepwd($user, $pwd2)) {
                 $msg = array('status' => 0, 'msg' => '修改成功!');
             } else {
                 $msg = array('status' => 1, 'msg' => '修改失败!');
             }
         } else {
             $msg = array('status' => 0, 'msg' => '密码不正确!');
         }
     } else {
         $msg = array('status' => 0, 'msg' => '');
     }
     $this->ajaxReturn($msg);
 }
示例#5
0
 public function admin()
 {
     $this->login_check(1);
     $user = public_user_id();
     $this->assign('user', $user);
     $this->display();
 }
示例#6
0
 public function modify_log()
 {
     $this->login_check(1);
     $user = public_user_id();
     $model_log = D('log');
     $id = -1;
     if (I('post.id') != null) {
         $id = I('post.id');
         if (strlen(trim(I('post.ct'))) < 5) {
             $msg = '修改失败!报告字数必须大于5!';
         } else {
             $ct = I('post.ct');
             if ($model_log->modifyLog($user, $id, $ct)) {
                 $msg = '修改成功!';
             } else {
                 $msg = '修改失败!';
             }
         }
         //var_dump($msg);
         $this->assign('msg', $msg);
     }
     if (I('get.id')) {
         $id = I('get.id');
     }
     $log = $model_log->getSingleLog($user, (int) $id);
     $this->assign('log', $log);
     $this->display();
 }
示例#7
0
 public function file()
 {
     //获取登录用户信息
     $user_type = public_user_type();
     $user = array('login' => 0, 'name' => '', 'pic' => '', 'home' => '');
     if ($user_type) {
         $user_id = public_user_id();
         $model_user = D('User');
         $rs_user = $model_user->getInfo($user_type, $user_id);
         $user = array('login' => 1, 'name' => $rs_user['name'], 'pic' => $rs_user['pic'], 'home' => $rs_user['home']);
     }
     $model_file = D('Index');
     $file = $model_file->getFiles();
     $this->assign('total', count($file));
     $this->assign('file', $file);
     $this->assign('user', $user);
     $this->display();
 }
示例#8
0
 public function xt()
 {
     $this->login_check(1);
     $user = public_user_id();
     $model_user = M('user_teacher');
     $rs_user = $model_user->field('pic,name')->where("user='******'")->select();
     $this->assign('user', $rs_user[0]);
     $Model = new \Think\Model();
     $sql = "select bs_xt.time,bs_kt.id as bid,bs_kt.name,user_student.name as sname,user_student.user,bs_kt.status from bs_xt right join bs_kt on bs_kt.id=bs_xt.bid left join user_student on user_student.user=bs_xt.sid where bs_kt.teacher='{$user}'";
     $rs_xt = $Model->query($sql);
     $this->assign('xt', $rs_xt);
     $ttype = public_user_ttype();
     $this->assign("ttype", $ttype);
     $this->display('xt');
 }
示例#9
0
 public function doc_handler()
 {
     $this->login_check(2);
     $user = public_user_id();
     $this->assign('user', $user);
     //仍旧是分为3类
     $type = I('post.type');
     //添加或者编辑
     if ($type == 'upload') {
         if (count($_FILES) > 0) {
             $f = $_FILES['upload'];
             $uploadDir = 'bs/upload/doc/';
             $filename = I('post.filename');
             $ext = pathinfo($f['name'])['extension'];
             $saveFileName = $uploadDir . date('Ymd') . '_' . md5(uniqid(rand())) . '.' . $ext;
             if (move_uploaded_file($f['tmp_name'], $saveFileName)) {
                 //存储到数据库记录中去
                 $data = array('id' => null, 'title' => $filename, 'type' => $ext, 'fileurl' => $saveFileName, 'publishtime' => date('Y-m-d'));
                 $model = M('home_doc');
                 $model->add($data);
                 $msg = array('status' => 1, 'msg' => '上传成功!');
             } else {
                 $msg = array('status' => 0, 'msg' => '上传失败!');
             }
         }
     } else {
         if ($type == 'del') {
             $id = I('post.id');
             //文件以及数据库删除
             $success = array('status' => 1, 'msg' => '删除成功!');
             $error = array('status' => 0, 'msg' => '删除失败!');
             $model = M('home_doc');
             $rs_file = $model->where("id={$id}")->select();
             $fileurl = $rs_file[0]['fileurl'];
             $rs_file_del = $model->where("id={$id}")->delete();
             if (file_exists($fileurl)) {
                 @unlink($fileurl);
             }
             if ($rs_file_del) {
                 $msg = $success;
             } else {
                 $msg = $error;
             }
         } else {
             $msg = array('status' => 0, 'msg' => '上传失败!请重试!');
         }
     }
     echo json_encode($msg);
 }
示例#10
0
 public function time_handler()
 {
     $this->login_check(2);
     $model_time = D('Sys');
     if (I('post.type') == 'save') {
         //var_dump(I('post.data'));
         $rs_time = $model_time->saveTime(I('post.data'), I('post.f'), public_user_id());
         if ($rs_time) {
             $msg = array('status' => 1, 'msg' => '操作成功!');
         } else {
             $msg = array('status' => 0, 'msg' => '操作失败!');
         }
     }
     $this->ajaxReturn($msg);
 }