示例#1
0
 public function compose(View $view)
 {
     $joined_class = Auth::user()->joinedClassrooms;
     $data = [];
     $data['profile'] = Auth::user();
     $data['classrooms'] = Classroom::find($joined_class);
     $data['assignments'] = $this->classAssignment($joined_class);
     $data['online'] = User::onlineusers()->limit(8)->get();
     $view->with('lms', $data);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Classroom::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(['class_id' => $this->class_id, 'teacher_id' => $this->teacher_id, 'created_dt' => $this->created_dt]);
     $query->andFilterWhere(['like', 'course_id', $this->course_id])->andFilterWhere(['like', 'opendate', $this->opendate])->andFilterWhere(['like', 'recive', $this->recive])->andFilterWhere(['like', 'place', $this->place])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
 /**
  * Lists all Classroom models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Classroom::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }