Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Coursemodule::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, 'Course_id' => $this->Course_id, 'Module_id' => $this->Module_id]);
     return $dataProvider;
 }
 public function actionModulesList($id)
 {
     $modules = \app\models\Coursemodule::find()->where(['Course_id' => $id])->all();
     foreach ($modules as $module) {
         echo "<option value='" . $module->id . "'>" . $module->module->moduleName . "</option>";
     }
 }
Exemplo n.º 3
0
 public function actionList_module($id)
 {
     // Count
     $countmodule = Coursemodule::find()->where(['id' => $id])->count();
     $module = Coursemodule::find()->where(['id' => $id])->orderBy('id DESC')->all();
     if ($countmodule > 0) {
         foreach ($module as $result) {
             echo "<option value='" . $result->id . "'>" . $result->Module_id . "</option>";
         }
     } else {
         echo "<option>-</option>";
     }
 }