%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
namespace backend\controllers;
use Yii;
use backend\models\BukuTamu;
use backend\models\search\BukuTamuSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* BukuTamuController implements the CRUD actions for BukuTamu model.
*/
class BukuTamuController extends Controller
{
/**
* @inheritDoc
*/
public function behaviors()
{
return array_merge(
parent::behaviors(),
[
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
]
);
}
/**
* Lists all BukuTamu models.
*
* @return string
*/
public function actionAdmin()
{
$searchModel = new BukuTamuSearch();
/*
$searchModel = new DaerahSearch(['id'=>\Yii::$app->user->identity->direktorat_id]);
$dataProvider->query->andWhere(['id'=>[2,3,4]]);
*/
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
public function actionIndex()
{
$this->layout = 'main-buku-tamu';
$model = new BukuTamu();
if ($this->request->isPost) {
if ($model->load($this->request->post())) {
$model->tanggal_masuk = date('Y-m-d');
if ($model->save()) {
Yii::$app->session->setFlash('success', 'Terima kasih atas kunjungan anda');
return $this->redirect(['index']);
}
} else {
$model->loadDefaultValues();
}
}
return $this->render('create', [
'model' => $model,
]);
}
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
public function actionCreate()
{
$this->layout = 'main-buku-tamu';
$model = new BukuTamu();
if ($this->request->isPost) {
if ($model->load($this->request->post()) && $model->save()) {
Yii::$app->session->setFlash('success', 'Terima kasih atas kunjungan anda');
return $this->redirect(['index']);
}
} else {
$model->loadDefaultValues();
}
return $this->render('create', [
'model' => $model,
]);
}
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
protected function findModel($id)
{
if (($model = BukuTamu::findOne(['id' => $id])) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}