| Current Path : /var/www/html/akm-ipw/backend/modules/firstTimeSetup/controllers/ |
| Current File : /var/www/html/akm-ipw/backend/modules/firstTimeSetup/controllers/SetupController.php |
<?php
namespace backend\modules\firstTimeSetup\controllers;
use Yii;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\UploadedFile;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
/**
* ContentTagController implements the CRUD actions for ContentTag model.
*/
class SetupController extends Controller {
/**
* {@inheritdoc}
*/
public function behaviors() {
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all ContentTag models.
* @return mixed
*/
public function actionIndex() {
$this->layout = false;
return $this->render('index');
// $searchModel = new ContentTagSearch();
// $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
// return $this->render('index', [
// 'searchModel' => $searchModel,
// 'dataProvider' => $dataProvider,
// ]);
}
/**
* Displays a single ContentTag model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id) {
$model = $this->findModel($id);
return $this->render('view', [
'model' => $model
]);
}
/**
* Creates a new ContentTag model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate() {
$model = new ContentTag();
if ($model->load(Yii::$app->request->post())) {
if ($model->save()) {
return $this->redirect(['index']);
}
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing ContentTag model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id) {
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post())) {
if ($model->save()) {
return $this->redirect(['index']);
}
}
return $this->render('update', ['model' => $model,]);
}
/**
* Deletes an existing ContentTag model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id) {
ContentTagTranslation::deleteAll(['tag_translation_parent_id' => $id]);
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the ContentTag model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return ContentTag the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id) {
if (($model = ContentTag::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));
}
}