Exemplo n.º 1
0
 /**
  * 显示当前课程列表
  * @author FuRongxin
  * @date    2016-03-12
  * @version 2.0
  * @return  \Illuminate\Http\Response 学生成绩列表
  */
 public function index()
 {
     $tasks = Task::with(['course' => function ($query) {
         $query->select('kch', 'kcmc', 'xs');
     }])->whereJsgh(Auth::user()->jsgh)->whereNd(session('year'))->whereXq(session('term'))->orderBy('kcxh')->get();
     $title = session('year') . '年度' . Term::find(session('term'))->mc . '学期';
     return view('score.index')->withTitle($title . '课程列表')->withTasks($tasks);
 }
Exemplo n.º 2
0
 /**
  * 显示系统消息列表
  * @author FuRongxin
  * @date    2016-01-12
  * @version 2.0
  * @return  \Illuminate\Http\Response 系统消息列表
  */
 public function index()
 {
     $is_open = config('constants.status.enable') == Setting::find('XK_KG')->value ? '开放' : '关闭';
     $message = '现在' . $is_open . session('year') . '年度' . Term::find(session('term'))->mc . '学期选课';
     $broadcasts = Broadcast::whereId('xt_web')->get();
     $title = '综合管理系统';
     return view('home.index', compact('title', 'broadcasts', 'message'));
 }
Exemplo n.º 3
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot(Guard $auth)
 {
     view()->composer('app', function ($view) use($auth) {
         $periods = Pfjg::groupBy('nd', 'xq')->get(['nd', 'xq']);
         foreach ($periods as &$period) {
             $period['xqmc'] = Term::find($period['xq'])->mc;
         }
         $view->with('user', $auth->user())->with('periods', $periods);
     });
 }
Exemplo n.º 4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Term::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'keyword', $this->keyword]);
     return $dataProvider;
 }
 /**
  * 网站首页
  * 无限加载
  * @return string
  */
 public function actionIndex()
 {
     //翻页 分类  标签(暂时不做标签)
     $params = \Yii::$app->request->queryParams;
     //分类
     $condition = array();
     if (isset($params['term'])) {
         $term = Term::findOne(['slug' => $params['term']]);
         $term ? $params['PostSearch']['term_id'] = $term->id : '';
     }
     $postSearch = new PostSearch();
     $dataProvider = $postSearch->search($params, $condition);
     return $this->render('index', ['postSearch' => $postSearch, 'dataProvider' => $dataProvider]);
 }
Exemplo n.º 6
0
 /**
  * 显示评教结果
  * @author FuRongxin
  * @date    2016-03-30
  * @version 2.0
  * @param   \Illuminate\Http\Request  $request 评教结果请求
  * @param   string $kcxh 12位课程序号
  * @return  \Illuminate\Http\Response 评教结果
  */
 public function show(Request $request, $kcxh)
 {
     $inputs = $request->all();
     $table = $inputs['year'] . $inputs['term'] . 't';
     $mark = $inputs['year'] . $inputs['term'] . 'Mark';
     // 获取评教分值
     $data = DB::connection('pgset')->selectOne('SELECT AVG(s_jxtd) AS jxtd, AVG(s_jxnr) AS jxnr, AVG(s_jxff) AS jxff, AVG(s_jxxg) AS jxxg, AVG(s_zhpf) As zhpf FROM "' . $table . '" WHERE c_kcxh = ? and c_jsgh = ? GROUP BY c_kcbh, c_jsgh', [$kcxh, Auth::user()->jsgh]);
     $scores = [];
     if (count($data)) {
         $scores = ['1' => sprintf('%.2f', $data->jxtd), '2' => sprintf('%.2f', $data->jxnr), '3' => sprintf('%.2f', $data->jxff), '4' => sprintf('%.2f', $data->jxxg), 'zhpf' => sprintf('%.2f', $data->zhpf)];
         $categories = DB::connection('pgset')->select('SELECT a.zb_id, a.zb_mc, COUNT(*) AS total FROM t_zb_yjzb a, t_zb_ejzb b WHERE a.zb_id = b.zb_id GROUP BY a.zb_id, a.zb_mc ORDER BY a.zb_id');
         foreach ($categories as $category) {
             $items = DB::connection('pgset')->select('SELECT ejzb_id, ejzb_mc, AVG(s_mark) AS mark FROM "' . $mark . '", t_zb_ejzb WHERE c_xm = CAST(ejzb_id AS TEXT) AND zb_id = ? AND c_kcxh = ? AND c_jsgh = ? GROUP BY ejzb_id, ejzb_mc, c_kcbh, c_jsgh, c_xm ORDER BY ejzb_id', [$category->zb_id, $kcxh, Auth::user()->jsgh]);
             $scores['zb'][$category->zb_id] = ['zb_mc' => $category->zb_mc, 'total' => $category->total];
             foreach ($items as $item) {
                 $scores['zb'][$category->zb_id]['ejzb'][] = ['ejzb_id' => $item->ejzb_id, 'ejzb_mc' => $item->ejzb_mc, 'score' => sprintf('%.2f', $item->mark)];
             }
         }
     }
     // 获取评教评语
     $comments = DB::connection('pgset')->select('SELECT c_yd, c_qd, c_one, c_xh FROM t_zl_xspy a INNER JOIN "' . $table . '" b ON a.c_kcxh = b.c_kcxh WHERE a.c_nd = ? AND a.c_xq = ? AND b.c_jsgh = ? AND b.c_kcxh = ?', [$inputs['year'], $inputs['term'], Auth::user()->jsgh, $kcxh]);
     $title = $inputs['year'] . '年度' . Term::find($inputs['term'])->mc . '学期' . $kcxh . Course::find(Helper::getCno($kcxh))->kcmc . '课程';
     return view('set.show')->withTitle($title . '评教结果')->withScores($scores)->withComments($comments);
 }
Exemplo n.º 7
0
 /**
  * 显示系统消息列表
  * @author FuRongxin
  * @date    2016-03-12
  * @version 2.0
  * @return  \Illuminate\Http\Response 系统消息列表
  */
 public function index()
 {
     $term = Term::find(session('term'));
     return view('home.index')->withTitle('综合管理系统')->withYear(session('year'))->withTerm($term->mc);
 }
Exemplo n.º 8
0
 public function getExportStatisticsByMajor($year, $term)
 {
     $results = $this->retrieveStatisticsResultsByMajor($year, $term);
     $sheetName = $year . '~' . ($year + 1) . '学年度' . Term::find($term)->mc . '学期教师评学分专业统计表';
     $datas[0] = ['专业', '年级', '总分', '等级'];
     foreach ($results as $result) {
         $row = array();
         $row[] = $result->zymc;
         $row[] = $result->nj;
         $row[] = number_format($result->total, 2);
         if (!is_null($result->total)) {
             $row[] = Pfdj::where('zdfz', '<=', floor($result->total))->where('zgfz', '>=', floor($result->total))->first()->mc;
         } else {
             $row[] = null;
         }
         $datas[] = $row;
     }
     Excel::create('export', function ($excel) use($sheetName, $datas) {
         $excel->setTitle('Guangxi Normal University Teacher Evaludate Students Statistics Report');
         $excel->setCreator('Dean')->setCompany('Guangxi Normal University');
         $excel->sheet($sheetName, function ($sheet) use($datas) {
             $sheet->setOrientation('landscape');
             $sheet->fromArray($datas, null, 'A1', false, false);
         });
     })->export('xls');
 }
 /**
  * Finds the Term model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Term the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Term::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 10
0
 function getTerms()
 {
     $terms = Term::all()->sortBy('name');
     return $terms;
 }
Exemplo n.º 11
0
 function searchTerms($query)
 {
     return Term::where('name', 'LIKE', '%' . $query . '%')->get();
 }
 /**
  * test for deleting notes
  *
  * @return void
  */
 public function testDelete()
 {
     Term::where('name', 'test1.com')->delete();
     Term::where('name', 'test2.com')->delete();
     Term::where('name', 'test3.com')->delete();
 }
Exemplo n.º 13
0
 /**
  * 显示录入评学界面
  * @author FuRongxin
  * @date    2016-03-30
  * @version 2.0
  * @param   string $kcxh 12位课程序号
  * @return  \Illuminate\Http\Response 评学录入界面
  */
 public function edit($kcxh)
 {
     $items = Tesitem::with(['results' => function ($query) use($kcxh) {
         $query->whereNd(session('year'))->whereXq(session('term'))->whereKcxh($kcxh)->whereJsgh(Auth::user()->jsgh);
     }, 'category'])->whereZt(config('constants.status.enable'))->orderBy('px')->get();
     if (count($items->first()->results)) {
         return redirect()->route('tes.show', ['kcxh' => $kcxh, 'year' => session('year'), 'term' => session('term')])->withStatus($kcxh . '课程评学数据已录入');
     } else {
         $title = session('year') . '年度' . Term::find(session('term'))->mc . '学期' . $kcxh . Course::find(Helper::getCno($kcxh))->kcmc . '课程';
         return view('tes.edit')->withTitle($title . '评学录入')->withItems($items)->withKcxh($kcxh);
     }
 }
Exemplo n.º 14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTerm()
 {
     return $this->hasOne(Term::className(), ['id' => 'term_id']);
 }
Exemplo n.º 15
0
    <div class="form-container">

        <?php 
$form = ActiveForm::begin(['class' => 'j-form']);
?>

        <?php 
echo $form->field($model, 'title')->textInput();
?>

        <?php 
// $isAdmin?$form->field($model, 'user_id')->dropDownList(User::getAuthors()) : ''
?>

        <?php 
echo $form->field($model, 'term_id')->dropDownList(Term::allTermsArray());
?>

        <?php 
echo $form->field($model, 'excerpt')->textarea(['rows' => 2]);
?>

        <?php 
echo $form->field($model, 'keyword')->textInput(['maxlength' => true]);
?>

        <?php 
echo $form->field($model, 'content')->textarea(['rows' => 3]);
?>

        <?php 
Exemplo n.º 16
0
 /**
  * 查询听课列表
  * @author FuRongxin
  * @date    2016-05-17
  * @version 2.1
  * @param   \Illuminate\Http\Request $request 听课查询请求
  * @return  \Illuminate\Http\Response 听课列表
  */
 public function search(Request $request)
 {
     $departments = Department::where('dw', '<>', '')->whereLx('1')->whereZt(config('constants.status.enable'))->orderBy('dw')->get();
     $title = session('year') . '年度' . Term::find(session('term'))->mc . '学期' . '听课查询';
     $courses = [];
     if ($request->isMethod('post')) {
         $this->validate($request, ['department' => 'required', 'week' => 'required', 'class' => 'required']);
         $input = $request->all();
         $query = Timetable::with(['classroom' => function ($query) {
             $query->select('jsh', 'mc');
         }, 'user' => function ($query) {
             $query->select('jsgh', 'xm', 'zc');
         }, 'user.position', 'campus'])->whereNd(session('year'))->whereXq(session('term'))->whereZc($input['week'])->where('ksj', '<=', $input['class'])->where('jsj', '>=', $input['class']);
         $kcxhs = Mjcourse::whereNd(session('year'))->whereXq(session('term'))->whereKkxy($input['department'])->select('kcxh')->distinct()->get()->pluck('kcxh');
         $query = $query->whereIn('kcxh', $kcxhs);
         $results = $query->get();
         foreach ($results as $result) {
             $courses[] = ['kcmc' => Course::find(Helper::getCno($result->kcxh))->kcmc, 'xqh' => $result->campus->mc, 'jsmc' => count($result->classroom) ? $result->classroom->mc : '', 'kkxy' => count($result->mjcourse) ? $result->mjcourse->college->mc : '', 'xy' => count($result->mjcourse) ? $result->mjcourse->major->college->mc : '', 'zy' => count($result->mjcourse) ? $result->mjcourse->major->mc : '', 'nj' => count($result->mjcourse) ? $result->mjcourse->nj : '', 'rs' => Selcourse::whereNd(session('year'))->whereXq(session('term'))->whereKcxh($result->kcxh)->count(), 'jsxm' => $result->user->xm, 'jszc' => $result->user->position->mc];
         }
         $department_name = 'all' == $input['department'] ? '所有学院' : Department::find($input['department'])->mc;
         $week_name = 'all' == $input['week'] ? '所有周次' : '星期' . config('constants.week.' . $input['week']);
         $class_name = '第 ' . $input['class'] . ' 节课';
         $subtitle = '查询条件:' . $department_name . $week_name . $class_name;
     }
     return view('timetable.search', compact('title', 'departments', 'courses', 'subtitle'));
 }