public function actionStudsection($id) { $rows = \app\modules\course\models\Section::find()->where(['section_batch_id' => $id, 'is_status' => 0])->all(); echo "<option value=''>---Select Section---</option>"; if (count($rows) > 0) { foreach ($rows as $row) { echo "<option value='{$row->section_id}'>{$row->section_name}</option>"; } } else { echo ""; } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Section::find()->where('is_status != 2'); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['section_id' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['section_id' => $this->section_id, 'section_batch_id' => $this->section_batch_id, 'intake' => $this->intake, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]); $query->andFilterWhere(['like', 'section_name', $this->section_name]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
/** * @return all Section */ public static function getStuSection() { $dataTmp = Section::find()->where(['is_status' => 0])->orderBy('section_name')->all(); $result = yii\helpers\ArrayHelper::map($dataTmp, 'section_id', 'section_name'); return $result; }
echo Yii::t('course', 'Active'); ?> </span> <?php } else { ?> <span class="label label-danger"><?php echo Yii::t('course', 'Inactive'); ?> </span> <?php } ?> </div> <?php $secData = \app\modules\course\models\Section::find()->where('is_status!=2 AND section_batch_id = ' . $bv['batch_id'])->asArray()->all(); ?> <ol> <?php foreach ($secData as $sk => $sv) { ?> <li> <?php echo $sv['section_name']; ?> <?php echo Html::a('<i class="fa fa-eye"></i>', ['section/view', 'id' => $sv['section_id']], ['class' => 'btn-xs btn btn-default', 'title' => Yii::t('course', 'View Section Details')]); ?> <?php echo Html::a('<i class="fa fa-pencil-square-o"></i>', ['section/update', 'id' => $sv['section_id']], ['class' => 'btn-xs btn btn-default', 'title' => Yii::t('course', 'Edit Section Details')]); ?>
/** * Deletes an existing Batches model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $section = Section::find()->where(['section_batch_id' => $id, 'is_status' => 0])->exists(); if ($section) { $err_msg = 'Section'; } else { $err_msg = ''; } if (!empty($err_msg)) { throw new HttpException(400, 'You can not delete this record because it is used in ' . $err_msg . ' table.'); } else { $model = Batches::findOne($id); $model->is_status = 2; $model->update(); } return $this->redirect(['index']); }
echo Yii::t('course', 'Active'); ?> </span> <?php } else { ?> <span class="label label-danger"><?php echo Yii::t('course', 'Inactive'); ?> </span> <?php } ?> </div> <?php $secData = \app\modules\course\models\Section::find()->where(['<>', 'is_status', 2])->andWhere(['section_batch_id' => $bv['batch_id']])->asArray()->all(); ?> <ol> <?php foreach ($secData as $sk => $sv) { ?> <li> <?php echo $sv['section_name']; ?> <?php echo Html::a('<i class="fa fa-eye"></i>', ['section/view', 'id' => $sv['section_id']], ['class' => 'btn-xs btn btn-default', 'title' => Yii::t('course', 'View Section Details')]); ?> <?php echo Html::a('<i class="fa fa-pencil-square-o"></i>', ['section/update', 'id' => $sv['section_id']], ['class' => 'btn-xs btn btn-default', 'title' => Yii::t('course', 'Edit Section Details')]); ?>