Silent 6 年 前
コミット
1ba0ddb024

+ 108 - 0
app/Http/Controllers/Admin/CourseController.php

xqd
@@ -0,0 +1,108 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\Course;
+use Illuminate\Http\Request;
+
+class CourseController extends Controller
+{
+    protected $redirect_index = '/admin/Course/index';
+
+    protected $view_path = 'admin.courses.';
+
+    protected $pre_uri = '/admin/Course/';
+
+    protected $model_name = '课程';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new Course();
+    }
+
+    public function index(Request $request)
+    {
+        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc');
+
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = '%' . trim($request->input('keyword')) . '%';
+            $list = $list->where('name', 'like', $keyword);
+        }
+
+        $list = $list->paginate()->withPath($this->getPaginateUrl());
+
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model_name'));
+    }
+
+    public function create(Request $request)
+    {
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+        return view($this->view_path . 'create', compact('pre_uri', 'model_name', 'model'));
+    }
+
+    public function store(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+
+        $res = $this->model->create($request->input('data'));
+
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+        return $this->showMessage('操作成功', $this->redirect_index);
+    }
+
+    public function edit(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('数据错误!');
+        }
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+
+        return view($this->view_path . 'edit', compact('item','pre_uri', 'model_name', 'model'));
+    }
+
+    public function update(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('id')) || empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+
+        $res = $this->model->where('id', $request->input('id'))->update($request->input('data'));
+
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+        return $this->showMessage('操作成功', $this->redirect_index);
+    }
+
+    public function delete(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('访问错误');
+        }
+
+        $res = $item->delete();
+        if(!$res) {
+            return $this->showWarning('数据库删除失败');
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 108 - 0
app/Http/Controllers/Admin/RemarkTitleController.php

xqd
@@ -0,0 +1,108 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\RemarkTitle;
+use Illuminate\Http\Request;
+
+class RemarkTitleController extends Controller
+{
+    protected $redirect_index = '/admin/RemarkTitle/index';
+
+    protected $view_path = 'admin.remark-titles.';
+
+    protected $pre_uri = '/admin/RemarkTitle/';
+
+    protected $model_name = '评价题目';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new RemarkTitle();
+    }
+
+    public function index(Request $request)
+    {
+        $list = $this->model->where('id', '>', 0)->orderBy('updated_at', 'desc');
+
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = '%' . trim($request->input('keyword')) . '%';
+            $list = $list->where('name', 'like', $keyword);
+        }
+
+        $list = $list->paginate()->withPath($this->getPaginateUrl());
+
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model_name'));
+    }
+
+    public function create(Request $request)
+    {
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+        return view($this->view_path . 'create', compact('pre_uri', 'model_name', 'model'));
+    }
+
+    public function store(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+
+        $res = $this->model->create($request->input('data'));
+
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+        return $this->showMessage('操作成功', $this->redirect_index);
+    }
+
+    public function edit(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('数据错误!');
+        }
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+
+        return view($this->view_path . 'edit', compact('item','pre_uri', 'model_name', 'model'));
+    }
+
+    public function update(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('id')) || empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+
+        $res = $this->model->where('id', $request->input('id'))->update($request->input('data'));
+
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+        return $this->showMessage('操作成功', $this->redirect_index);
+    }
+
+    public function delete(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('访问错误');
+        }
+
+        $res = $item->delete();
+        if(!$res) {
+            return $this->showWarning('数据库删除失败');
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 5 - 1
app/Http/Controllers/Teacher/CheckCardController.php

xqd xqd
@@ -3,8 +3,10 @@
 namespace App\Http\Controllers\Teacher;
 
 use App\Models\CheckCard;
+use App\Models\StudentCourseTeacher;
 use Carbon\Carbon;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
 
 class CheckCardController extends Controller
 {
@@ -26,7 +28,9 @@ class CheckCardController extends Controller
 
     public function index(Request $request)
     {
-        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc')->get();
+        $teacher = Auth::guard('teacher')->user();
+        $ids = StudentCourseTeacher::where('teacher_id', $teacher->id)->orWhere('teacher_id', 0)->pluck('student_course_id');
+        $list = $this->model->whereIn('student_course_id', $ids)->orderBy('created_at', 'desc')->get();
 
         if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
             $keyword = trim($request->input('keyword'));

+ 5 - 1
app/Http/Controllers/Teacher/LeaveController.php

xqd xqd
@@ -3,8 +3,10 @@
 namespace App\Http\Controllers\Teacher;
 
 use App\Models\Leave;
+use App\Models\StudentCourseTeacher;
 use Carbon\Carbon;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
 
 class LeaveController extends Controller
 {
@@ -26,7 +28,9 @@ class LeaveController extends Controller
 
     public function index(Request $request)
     {
-        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc')->get();
+        $teacher = Auth::guard('teacher')->user();
+        $ids = StudentCourseTeacher::where('teacher_id', $teacher->id)->orWhere('teacher_id', 0)->pluck('student_course_id');
+        $list = $this->model->where('student_course_id', '>', 0)->orderBy('created_at', 'desc')->get();
 
         if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
             $keyword = trim($request->input('keyword'));

+ 146 - 0
app/Http/Controllers/Teacher/Student/CourseController.php

xqd
@@ -0,0 +1,146 @@
+<?php
+
+namespace App\Http\Controllers\Teacher\Student;
+
+use App\Http\Controllers\Admin\Controller;
+use App\Models\Course;
+use App\Models\Student;
+use App\Models\StudentCourse;
+use App\Models\StudentCourseTeacher;
+use App\Models\Teacher;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+
+class CourseController extends Controller
+{
+    protected $redirect_index = '/teacher/Student/Course/index';
+
+    protected $view_path = 'teacher.students.courses.';
+
+    protected $pre_uri = '/teacher/Student/Course/';
+
+    protected $model_name = '课程';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new StudentCourse();
+    }
+
+    public function index(Request $request)
+    {
+        if(empty($request->input('student_id')) || empty($student = Student::find($request->input('student_id')))) {
+            return $this->showWarning('找不到学员');
+        }
+        $list = $this->model->where('student_id', $student->id)->orderBy('created_at', 'desc');
+
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = '%' . trim($request->input('keyword')) . '%';
+            $list = $list->where('name', 'like', $keyword);
+        }
+
+        $list = $list->paginate();
+
+        foreach($list as $item) {
+            $item->end_date = Carbon::createFromTimestamp(strtotime($item->apply_date))->addDays($item->duration)->toDateString();
+            $now = Carbon::now()->toDateString();
+            if($now > $item->end_date) {
+                $item->remain_days = 0;
+            } else {
+                $item->remain_days = Carbon::now()->diffInDays($item->end_date) + 1;
+            }
+        }
+
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model_name', 'student'));
+    }
+
+    public function create(Request $request)
+    {
+        if(empty($request->input('student_id')) || empty($student = Student::find($request->input('student_id')))) {
+            return $this->showWarning('找不到学员');
+        }
+        $courses = Course::orderBy('created_at', 'desc')->get();
+        $teachers = Teacher::orderBy('created_at', 'desc')->get();
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+        return view($this->view_path . 'create', compact('pre_uri', 'model_name', 'model', 'courses', 'teachers', 'courses', 'student'));
+    }
+
+    public function store(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+
+        $data = $request->input('data');
+        $data['assign_teacher'] = $request->input('assign_teacher') == 1 ? 1 : 2;
+        $res = $this->model->create($data);
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+
+        $res->updateStudentCourseTeachers($request->input('teachers'));
+
+        return $this->showMessage('操作成功', $this->redirect_index . '?student_id=' . $res->student_id);
+    }
+
+    public function edit(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('数据错误!');
+        }
+
+        $courses = Course::orderBy('created_at', 'desc')->get();
+        $teachers = Teacher::orderBy('created_at', 'desc')->get();
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+        return view($this->view_path . 'edit', compact('item','pre_uri', 'model_name', 'model', 'courses', 'teachers'));
+    }
+
+    public function update(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('id')) || empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('找不到合同');
+        }
+
+        $data = $request->input('data');
+        $data['assign_teacher'] = $request->input('assign_teacher') == 1 ? 1 : 2;
+        $res = $this->model->where('id', $item->id)->update($data);
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+        if(!empty($item)) {
+            $item->updateStudentCourseTeachers($request->input('teachers'));
+        }
+
+        return $this->showMessage('操作成功', $this->redirect_index . '?student_id=' . $item->student_id);
+    }
+
+    public function delete(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('访问错误');
+        }
+        StudentCourseTeacher::where('student_course_id', $item->id)->delete();
+        $res = $item->delete();
+        if(!$res) {
+            return $this->showWarning('数据库删除失败');
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 4 - 1
app/Http/Controllers/Teacher/StudentController.php

xqd xqd
@@ -9,6 +9,7 @@ use App\Models\StudentCourseTeacher;
 use App\Models\Teacher;
 use App\Models\TeacherStudent;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
 
 class StudentController extends Controller
 {
@@ -30,7 +31,9 @@ class StudentController extends Controller
 
     public function index(Request $request)
     {
-        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc');
+        $teacher = Auth::guard('teacher')->user();
+        $ids = StudentCourseTeacher::where('teacher_id', $teacher->id)->orWhere('teacher_id', 0)->pluck('student_id');
+        $list = $this->model->whereIn('id', $ids)->orderBy('created_at', 'desc');
 
         if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
             $keyword = '%' . trim($request->input('keyword')) . '%';

+ 20 - 0
app/Models/RemarkTitle.php

xqd
@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class RemarkTitle extends Model
+{
+    protected $table = 'remark_titles';
+
+    protected $guarded = [];
+
+    public function getStatusLabel()
+    {
+        if($this['status'] == 2) {
+            return '<span class="label label-success">启用</span>';
+        }
+        return '<span class="label label-danger">禁用</span>';
+    }
+}

+ 7 - 1
app/Models/StudentCourse.php

xqd xqd
@@ -40,9 +40,9 @@ class StudentCourse extends Model
 
     public function updateStudentCourseTeachers($teachers)
     {
+        StudentCourseTeacher::where('student_course_id', $this['id'])->delete();
         if($this['assign_teacher'] == 2) {
             if(!empty($teachers) && is_array($teachers)) {
-                StudentCourseTeacher::where('student_course_id', $this['id'])->delete();
                 foreach($teachers as $teacher) {
                     StudentCourseTeacher::create([
                         'student_course_id' => $this['id'],
@@ -51,6 +51,12 @@ class StudentCourse extends Model
                     ]);
                 }
             }
+        } else {
+            StudentCourseTeacher::create([
+                'student_course_id' => $this['id'],
+                'teacher_id' => 0,
+                'student_id' => $this['student_id']
+            ]);
         }
     }
 }

+ 33 - 0
database/migrations/2018_07_08_102809_create_remark_titles_table.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateRemarkTitlesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('remark_titles', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('name', 200)->nullable();
+            $table->tinyInteger('status')->nullable()->default(1)->comment('状态:1禁用;2启用');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('remark_titles');
+    }
+}

+ 1 - 1
resources/views/admin/base/index/index.blade.php

xqd
@@ -56,7 +56,7 @@
                     @if(isset($menus))
                      @foreach($menus as $key => $val)  
                         <li> 
-                            <a href="<?php if($val['path']=='#'){echo"#";}else{echo U("{$val['path']}");}?>">
+                            <a href="<?php if($val['path']=='#'){echo"#";}else{echo U("{$val['path']}");}?>" @if($val['path'] == '/Course/index') class="J_menuItem" @endif>
                                 <i class="fa {{$val['ico']}}"></i>
                                 <span class="nav-label">{{$val['name']}}</span> </a>
                                 @if(isset($val['_child']))

+ 61 - 0
resources/views/admin/courses/create.blade.php

xqd
@@ -0,0 +1,61 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '添加' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}">
+                            {{ csrf_field() }}
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">课程名</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[name]" class="form-control" placeholder="请输入课程名" value="{{ isset(old('data')['name']) ? old('data')['name'] : '' }}" required>
+                                </div>
+                                @if($errors->has('name'))
+                                    <span class="help-block">{{ $errors->first('name') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 62 - 0
resources/views/admin/courses/edit.blade.php

xqd
@@ -0,0 +1,62 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '编辑' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'update' }}">
+                            {{ csrf_field() }}
+
+                            <input type="hidden" name="id" value="{{ $item->id }}">
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">课程名</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[name]" class="form-control" placeholder="请输入课程名" value="{{ $item->name }}" required>
+                                </div>
+                                @if($errors->has('name'))
+                                    <span class="help-block">{{ $errors->first('name') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 106 - 0
resources/views/admin/courses/index.blade.php

xqd
@@ -0,0 +1,106 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name . '列表' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-4">
+                                <form>
+                                    <div class="input-group">
+                                        <input type="text" value="{{ request('keyword') }}"	placeholder="请输入课程名" name="keyword" class="input-sm form-control">
+                                        <span class="input-group-btn">
+									        <button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								        </span>
+                                    </div>
+                                </form>
+                            </div>
+                            <div class="col-sm-8 pull-right">
+                                <a href="{{ $pre_uri . 'create' }}" class="btn btn-sm btn-primary pull-right">添加{{ $model_name }}</a>
+                            </div>
+                        </div>
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>课程名</th>
+                                    <th>添加时间</th>
+                                    <th>操作</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="3" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td>{{ $item->name }}</td>
+                                            <td>{{ $item->created_at }}</td>
+                                            <td>
+                                                <div class="btn-group">
+                                                    <a class="btn btn-sm btn-info btn-edit" href="{{ $pre_uri . 'edit?id=' . $item->id }}">编辑</a>
+                                                    <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 73 - 0
resources/views/admin/remark-titles/create.blade.php

xqd
@@ -0,0 +1,73 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '添加' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}">
+                            {{ csrf_field() }}
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">课程名</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[name]" class="form-control" placeholder="请输入课程名" value="{{ isset(old('data')['name']) ? old('data')['name'] : '' }}" required>
+                                </div>
+                                @if($errors->has('name'))
+                                    <span class="help-block">{{ $errors->first('name') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">是否启用</label>
+                                <div class="col-sm-8">
+                                    <label class="radio-inline">
+                                        <input type="radio" name="data[status]" value="2" checked>是
+                                    </label>
+                                    <label class="radio-inline">
+                                        <input type="radio" name="data[status]" value="1">否
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 74 - 0
resources/views/admin/remark-titles/edit.blade.php

xqd
@@ -0,0 +1,74 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '编辑' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'update' }}">
+                            {{ csrf_field() }}
+
+                            <input type="hidden" name="id" value="{{ $item->id }}">
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">评价题目</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[name]" class="form-control" placeholder="请输入评价题目" value="{{ $item->name }}" required>
+                                </div>
+                                @if($errors->has('name'))
+                                    <span class="help-block">{{ $errors->first('name') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">是否启用</label>
+                                <div class="col-sm-8">
+                                    <label class="radio-inline">
+                                        <input type="radio" name="data[status]" value="2" {{ $item->status == 2 ? 'checked' : '' }}>是
+                                    </label>
+                                    <label class="radio-inline">
+                                        <input type="radio" name="data[status]" value="1" {{ $item->status != 2 ? 'checked' : '' }}>否
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 106 - 0
resources/views/admin/remark-titles/index.blade.php

xqd
@@ -0,0 +1,106 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name . '列表' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-4">
+                                <form>
+                                    <div class="input-group">
+                                        <input type="text" value="{{ request('keyword') }}"	placeholder="请输入课程名" name="keyword" class="input-sm form-control">
+                                        <span class="input-group-btn">
+									        <button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								        </span>
+                                    </div>
+                                </form>
+                            </div>
+                            <div class="col-sm-8 pull-right">
+                                <a href="{{ $pre_uri . 'create' }}" class="btn btn-sm btn-primary pull-right">添加{{ $model_name }}</a>
+                            </div>
+                        </div>
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>评价题目</th>
+                                    <th>是否启用</th>
+                                    <th>操作</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="3" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td>{{ $item->name }}</td>
+                                            <td>{!! $item->getStatusLabel() !!}</td>
+                                            <td>
+                                                <div class="btn-group">
+                                                    <a class="btn btn-sm btn-info btn-edit" href="{{ $pre_uri . 'edit?id=' . $item->id }}">编辑</a>
+                                                    <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 1 - 1
resources/views/admin/students/courses/create.blade.php

xqd
@@ -22,7 +22,7 @@
                     <div class="ibox-content">
                         <div class="row">
                             <div class="col-sm-12 pull-right">
-                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                                <a href="{{ $pre_uri . 'index?student_id=' . $student->id }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
                             </div>
                         </div>
                         <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}">

+ 1 - 1
resources/views/teacher/students/courses/create.blade.php

xqd
@@ -22,7 +22,7 @@
                     <div class="ibox-content">
                         <div class="row">
                             <div class="col-sm-12 pull-right">
-                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                                <a href="{{ $pre_uri . 'index?student_id=' . $student->id }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
                             </div>
                         </div>
                         <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}">