Пример #1
0
 public function actionStudbatch($id)
 {
     $rows = \app\modules\course\models\Batches::find()->where(['batch_course_id' => $id, 'is_status' => 0])->all();
     echo "<option value=''>---Select Batch---</option>";
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             echo "<option value='{$row->batch_id}'>{$row->batch_name}</option>";
         }
     } else {
         echo "";
     }
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Batches::find()->where(['<>', 'is_status', 2]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['batch_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(['batch_id' => $this->batch_id, 'batch_course_id' => $this->batch_course_id, 'start_date' => $this->dbDateSearch($this->start_date), 'end_date' => $this->dbDateSearch($this->end_date), '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', 'batch_name', $this->batch_name])->andFilterWhere(['like', 'batch_alias', $this->batch_alias]);
     unset($_SESSION['exportData']);
     $_SESSION['exportData'] = $dataProvider;
     return $dataProvider;
 }
Пример #3
0
 /**
  * @return all batches
  */
 public static function getStuBatches()
 {
     $dataTmp = Batches::find()->where(['is_status' => 0])->orderBy('batch_name')->all();
     $result = yii\helpers\ArrayHelper::map($dataTmp, 'batch_id', 'batch_name');
     return $result;
 }
Пример #4
0
?>
</span>
		        </div><!-- /.info-box-content -->
		      </div><!-- /.info-box -->
		</div>

		<div class="col-md-4 col-sm-6 col-xs-12">
		      <div class="edusec-link-box">
		        <span class="edusec-link-box-icon bg-teal"><i class="fa fa-users"></i></span>
		        <div class="edusec-link-box-content">
		          <span class="edusec-link-box-text"><?php 
echo Html::a(Yii::t('course', 'Manage Batches'), ['/course/batches']);
?>
</span>
		          <span class="edusec-link-box-number"><?php 
echo app\modules\course\models\Batches::find()->where(['is_status' => 0])->count();
?>
</span>
			 <span class="edusec-link-box-desc"></span>
			  <span class="edusec-link-box-bottom"><?php 
echo Html::a('<i class="fa fa-plus-square"></i> ' . Yii::t('course', 'Create New'), ['/course/batches/create']);
?>
</span>
		        </div><!-- /.info-box-content -->
		      </div><!-- /.info-box -->
		</div>

		<div class="col-md-4 col-sm-6 col-xs-12">
		      <div class="edusec-link-box">
		        <span class="edusec-link-box-icon bg-green"><i class="fa fa-sitemap"></i></span>
		        <div class="edusec-link-box-content">
Пример #5
0
 /**
  * Deletes an existing Courses model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $batch = Batches::find()->where('batch_course_id=' . $id . ' AND is_status!=2')->exists();
     if ($batch) {
         $err_msg = 'Batch';
     } 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 = Courses::findOne($id);
         $model->is_status = 2;
         $model->update();
     }
     return $this->redirect(['index']);
 }