Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Courses::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(['credit_hours' => $this->credit_hours, 'level' => $this->level, 'dept_ID' => $this->dept_ID]);
     $query->andFilterWhere(['like', 'course_ID', $this->course_ID])->andFilterWhere(['like', 'course_name', $this->course_name]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCourses()
 {
     return $this->hasMany(Courses::className(), ['updated_by' => 'user_id']);
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCourses()
 {
     return $this->hasMany(Courses::className(), ['dept_ID' => 'ID']);
 }
Пример #4
0
 public function getCourses()
 {
     return $this->hasMany(Courses::className(), ['id' => 'course_id'])->viaTable(StudentsCourses::tableName(), ['student_id' => 'id'])->all();
 }
Пример #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCourse()
 {
     return $this->hasOne(Courses::className(), ['id' => 'course_id']);
 }
Пример #6
0
/* @var $model app\models\Content */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="content-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'text')->widget(CKEditor::className(), ['editorOptions' => ['preset' => 'full', 'inline' => false]]);
?>

    <?php 
echo $form->field($model, 'courses_id')->dropDownList(Courses::getAll(), ['prompt' => 'Select Course']);
?>

    <div class="form-group">
    	<div>
        	<?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        </div>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Пример #7
0
 public function getAll()
 {
     return ArrayHelper::map(Courses::find()->all(), 'id', 'courses');
 }
Пример #8
0
 /**
  * Finds the Courses model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Courses the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Courses::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #9
0
 public function actionVideo()
 {
     $courses = Courses::find()->orderBy(['id' => SORT_DESC])->all();
     return $this->render('video', ['courses' => $courses]);
 }