Commit c58e00fc by Edward Simarmata

the last

parents 10450155 42888afe
......@@ -51,51 +51,30 @@ class RbacController extends Controller
public function actionCreate_role(){
$auth = Yii::$app->authManager;
$index = $auth->createPermission('sekolah/index');
$create = $auth->createPermission('sekolah/create');
$view = $auth->createPermission('sekolah/view');
$update = $auth->createPermission('sekolah/update');
$delete = $auth->createPermission('sekolah/delete');
$index_user = $auth->createPermission('users/index');
$create_user = $auth->createPermission('users/create');
$view_user = $auth->createPermission('users/view');
$update_user = $auth->createPermission('users/update');
$delete_user = $auth->createPermission('users/delete');
$indexsekolah = $auth->createPermission('sekolah/indexsekolah');
// add "admin" role give this role the index create view update delete
$admin = $auth->createRole('admin');
$auth->add($admin);
$auth->addChild($admin, $index_user);
$auth->addChild($admin, $create_user);
$auth->addChild($admin, $view_user);
$auth->addChild($admin, $update_user);
$auth->addChild($admin, $delete_user);
$auth->addChild($admin, $indexsekolah);
$sekpentk = $auth->createRole('sekpenTK');
$auth->add($sekpentk);
$auth->addChild($sekpentk, $index);
$auth->addChild($sekpentk, $create);
$auth->addChild($sekpentk, $view);
$auth->addChild($sekpentk, $update);
$auth->addChild($sekpentk, $delete);
$auth->addChild($sekpentk, $indexsekolah);
$sekpensd = $auth->createRole('sekpenSD');
$auth->add($sekpensd);
$auth->addChild($sekpensd, $index);
$auth->addChild($sekpensd, $create);
$auth->addChild($sekpensd, $view);
$auth->addChild($sekpensd, $update);
$auth->addChild($sekpensd, $delete);
$auth->addChild($sekpensd, $indexsekolah);
$sekpensmp = $auth->createRole('sekpenSMP');
$auth->add($sekpensmp);
$auth->addChild($sekpensmp, $index);
$auth->addChild($sekpensmp, $create);
$auth->addChild($sekpensmp, $view);
$auth->addChild($sekpensmp, $update);
$auth->addChild($sekpensmp, $delete);
$auth->addChild($sekpensmp, $indexsekolah);
}
......@@ -104,49 +83,25 @@ class RbacController extends Controller
$auth = Yii::$app->authManager;
$index = $auth->createPermission('sekolah/index');
$index->description = ' Create a sekolah';
$auth->add($index);
$daftartk = $auth->createPermission('site/daftartk');
$daftartk->description = 'view daftartk';
$auth->add($daftartk);
$create = $auth->createPermission('sekolah/create');
$create->description = ' create a sekolah';
$auth->add($create);
$daftarsd = $auth->createPermission('site/daftarsd');
$daftarsd->description = 'view daftarsd';
$auth->add($daftarsd);
$view = $auth->createPermission('sekolah/view');
$view->description = ' View a sekolah';
$auth->add($view);
$daftarsmp = $auth->createPermission('site/daftarsmp');
$daftartk->description = 'view daftarsmp';
$auth->add($daftarsmp);
$update = $auth->createPermission('sekolah/update');
$update->description = ' Update a sekolah';
$auth->add($update);
$delete = $auth->createPermission('sekolah/delete');
$delete->description = ' Delete a sekolah';
$auth->add($delete);
/**
* Users
*/
$index_user = $auth->createPermission('users/index');
$index_user->description = ' Create a User';
$auth->add($index_user);
$create_user = $auth->createPermission('users/create');
$create_user->description = ' create a User';
$auth->add($create_user);
$view_user = $auth->createPermission('users/view');
$view_user->description = ' View a User';
$auth->add($view_user);
$update_user = $auth->createPermission('users/update');
$update_user->description = ' Update a User';
$auth->add($update_user);
$delete_user = $auth->createPermission('users/delete');
$delete_user->description = ' Delete a User';
$auth->add($delete_user);
}
/**
* Lists all AuthItem models.
......
......@@ -9,6 +9,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\web\UploadedFile;
/**
* SekolahController implements the CRUD actions for Sekolah model.
......@@ -52,9 +53,12 @@ class SekolahController extends Controller
$searchModel = new SekolahSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$model = new Sekolah();
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'model' => $model,
]);
}
......@@ -79,8 +83,17 @@ class SekolahController extends Controller
{
$model = new Sekolah();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
if ($model->load(Yii::$app->request->post())) {
$sekolah = $model->nama_sekolah;
$foto_sekolah = UploadedFile::getInstance($model, 'foto_sekolah');
$model->foto_sekolah = $foto_sekolah->baseName. '.'.$foto_sekolah->extension;
if($model->save()){
$foto_sekolah->saveAs('gambarsekolah/'.$model->foto_sekolah);
return $this->redirect(['view','id' =>$model->id]);
}
} else {
return $this->render('create', [
'model' => $model,
......@@ -88,6 +101,7 @@ class SekolahController extends Controller
}
}
/**
* Updates an existing Sekolah model.
* If update is successful, the browser will be redirected to the 'view' page.
......@@ -135,4 +149,22 @@ class SekolahController extends Controller
throw new NotFoundHttpException('The requested page does not exist.');
}
}
public function actionIndexsekolah($id)
{
return $this->render('indexsekolah',[
'model' => $this->findModelSekolah($id),
]);
}
protected function findModelSekolah($id)
{
if(($model = Sekolah::find()->where('id = :id',[':id' => $id])->one()) !== null){
return $model;
}
else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\Siswa;
use app\models\SiswaSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* SiswaController implements the CRUD actions for Siswa model.
*/
class SiswaController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Siswa models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new SiswaSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Siswa model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Siswa model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Siswa();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Siswa model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Siswa model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Siswa model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Siswa the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Siswa::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
......@@ -6,6 +6,11 @@ use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\LoginForm;
use app\models\Sekolah;
use app\models\SekolahSearch;
use app\controller\SiswaController;
use yii\data\SqlDataProvider;
/**
* Site controller
......@@ -87,7 +92,7 @@ class SiteController extends Controller
*/
public function actionLogin()
{
if (!Yii::$app->user->isGuest) {
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}
......@@ -114,23 +119,34 @@ class SiteController extends Controller
}
public function actionAbout() {
$searchModel = new SekolahSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProviderTK = $searchModel->searchs('TK');
$dataProviderSD = $searchModel->searchs('SD');
$dataProviderSMP = $searchModel->searchs('SMP');
return $this->render('about',
[
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'dataProviderTK' => $dataProviderTK,
'dataProviderSD' => $dataProviderSD,
'dataProviderSMP' => $dataProviderSMP,
]
);
}
public function actionDaftar_SMP() {
return $this->render('daftar_SMP',
public function actionDaftarTk() {
return $this->render('daftar_TK',
[
]
);
}
public function actionTest()
{
return $this->render('test');
......
......@@ -8,8 +8,11 @@ use app\models\UsersSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use app\modules\administrator\models\AuthAssignment;
use app\modules\administrator\models\Role;
use yii\web\ForbiddenHttpException;
use yii\filters\AccessControl;
use yii\helpers\ArrayHelper;
/**
* UsersController implements the CRUD actions for Users model.
*/
......@@ -65,9 +68,53 @@ class UsersController extends Controller
*/
public function actionView($id)
{
$model = $this->findModel($id);
$authAssignments = AuthAssignment::find()->where([
'user_id' => $model->id,
])->column();
$authItems = ArrayHelper::map(
Role::find()->where([
'type' => 1,
])->asArray()->all(),
'name', 'name');
$authAssignment = new AuthAssignment([
'user_id' => $model->id,
]);
if (Yii::$app->request->post()) {
$authAssignment->load(Yii::$app->request->post());
// delete all role
AuthAssignment::deleteAll(['user_id' => $model->id]);
if (is_array($authAssignment->item_name)) {
foreach ($authAssignment->item_name as $item) {
if (!in_array($item, $authAssignments)) {
$authAssignment2 = new AuthAssignment([
'user_id' => $model->id,
]);
$authAssignment2->item_name = $item;
$authAssignment2->created_at = time();
$authAssignment2->save();
$authAssignments = AuthAssignment::find()->where([
'user_id' => $model->id,
])->column();
}
}
}
Yii::$app->session->setFlash('success', 'Data tersimpan');
}
$authAssignment->item_name = $authAssignments;
return $this->render('view', [
'model' => $this->findModel($id),
'model' => $model,
'authAssignment' => $authAssignment,
'authItems' => $authItems,
]);
// return $this->render('view', [
// 'model' => $this->findModel($id),
// ]);
}
/**
......@@ -77,17 +124,35 @@ class UsersController extends Controller
*/
public function actionCreate()
{
$model = new Users();
if ($model->load(Yii::$app->request->post()) && $model->save() ) {
return $this->redirect(['view', 'id' => $model->id]);
if ($model->load(Yii::$app->request->post())) {
$model->setPassword('123456');
$model->status = $model->status==1?10:0;
if ($model->save()) {
Yii::$app->session->setFlash('success', 'User berhasil dibuat dengan password 123456');
} else {
Yii::$app->session->setFlash('error', 'User gagal dibuat');
}
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
// $model = new Users();
// if ($model->load(Yii::$app->request->post()) && $model->save() ) {
// return $this->redirect(['view', 'id' => $model->id]);
// } else {
// return $this->render('create', [
// 'model' => $model,
// ]);
// }
}
......@@ -103,12 +168,33 @@ class UsersController extends Controller
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if (!empty($model->new_password)) {
//if ($model->validatePassword($model->new_password)) {
$model->setPassword($model->new_password);
//}
}
$model->status = $model->status==1?10:0;
if ($model->save()) {
Yii::$app->session->setFlash('success', 'User berhasil diupdate');
} else {
Yii::$app->session->setFlash('error', 'User gagal diupdate');
}
return $this->redirect(['view', 'id' => $model->id]);
} else {
$model->status = $model->status==10?1:0;
return $this->render('update', [
'model' => $model,
]);
}
// $model = $this->findModel($id);
// if ($model->load(Yii::$app->request->post()) && $model->save()) {
// return $this->redirect(['view', 'id' => $model->id]);
// } else {
// return $this->render('update', [
// 'model' => $model,
// ]);
// }
}
/**
......@@ -119,9 +205,21 @@ class UsersController extends Controller
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
$model = $this->findModel($id);
$authAssignments = AuthAssignment::find()->where([
'user_id' => $model->id,
])->all();
foreach ($authAssignments as $authAssignment) {
$authAssignment->delete();
}
Yii::$app->session->setFlash('success', 'Delete success');
$model->delete();
return $this->redirect(['index']);
// $this->findModel($id)->delete();
// return $this->redirect(['index']);
}
/**
......
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "jenjang".
*
* @property integer $id
* @property string $jenjang
* @property string $created_at
* @property string $updated_at
* @property string $deleted_at
* @property integer $deleted
* @property string $created_by
* @property string $updated_by
* @property string $deleted_by
*/
class Jenjang extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'jenjang';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'jenjang', 'created_at', 'updated_at', 'deleted_at', 'deleted', 'created_by', 'updated_by', 'deleted_by'], 'required'],
[['id', 'deleted'], 'integer'],
[['created_at', 'updated_at', 'deleted_at'], 'safe'],
[['jenjang'], 'string', 'max' => 100],
[['created_by', 'updated_by', 'deleted_by'], 'string', 'max' => 32],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'jenjang' => 'Jenjang',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'deleted_at' => 'Deleted At',
'deleted' => 'Deleted',
'created_by' => 'Created By',
'updated_by' => 'Updated By',
'deleted_by' => 'Deleted By',
];
}
}
......@@ -37,11 +37,13 @@ class Sekolah extends \yii\db\ActiveRecord
public function rules()
{
return [
[['nama_sekolah', 'alamat_sekolah','jenjang' ,'foto_sekolah', 'visi', 'misi', 'created_at', 'updated_at', 'deleted_at', 'deleted', 'created_by', 'updated_by', 'deleted_by'], 'required'],
[['nama_sekolah', 'alamat_sekolah','jenjang' ,'foto_sekolah', 'visi', 'misi'], 'required'],
[['created_at', 'updated_at', 'deleted_at'], 'safe'],
[['deleted'], 'integer'],
[['nama_sekolah', 'alamat_sekolah', 'foto_sekolah', 'visi', 'misi'], 'string', 'max' => 100],
[['nama_sekolah', 'alamat_sekolah'], 'string'],
[[ 'visi', 'misi'], 'string', 'max' => 100],
[['created_by', 'updated_by', 'deleted_by'], 'string', 'max' => 32],
[['foto_sekolah'], 'file', 'extensions' => 'png, jpg, gif'],
];
}
......
......@@ -19,7 +19,7 @@ class SekolahSearch extends Sekolah
{
return [
[['id', 'deleted'], 'integer'],
[['nama_sekolah', 'alamat_sekolah', 'foto_sekolah', 'visi', 'misi', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'deleted_by'], 'safe'],
[['nama_sekolah', 'alamat_sekolah', 'foto_sekolah', 'visi', 'misi', 'jenjang', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'deleted_by'], 'safe'],
];
}
......@@ -71,10 +71,44 @@ class SekolahSearch extends Sekolah
->andFilterWhere(['like', 'foto_sekolah', $this->foto_sekolah])
->andFilterWhere(['like', 'visi', $this->visi])
->andFilterWhere(['like', 'misi', $this->misi])
->andFilterWhere(['like', 'jenjang', $this->jenjang])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'updated_by', $this->updated_by])
->andFilterWhere(['like', 'deleted_by', $this->deleted_by]);
return $dataProvider;
}
public function searchs($params){
$query = Sekolah::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if(!$this->validate()){
return $dataProvider;
}
$query->andFilterWhere([
'id' => $this->id,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'deleted_at' => $this->deleted_at,
'deleted' => $this->deleted,
]);
$query->andFilterWhere(['like', 'nama_sekolah', $this->nama_sekolah])
->andFilterWhere(['like', 'alamat_sekolah', $this->alamat_sekolah])
->andFilterWhere(['like', 'foto_sekolah', $this->foto_sekolah])
->andFilterWhere(['like', 'visi', $this->visi])
->andFilterWhere(['like', 'misi', $this->misi])
->andFilterWhere(['like', 'jenjang', $this->jenjang])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'updated_by', $this->updated_by])
->andFilterWhere(['like', 'deleted_by', $this->deleted_by]);
return $dataProvider;
}
}
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "siswa".
*
* @property integer $id
* @property string $nama
* @property string $nis
* @property string $nisn
* @property string $alamat
* @property string $foto
* @property string $nama_ayah
* @property string $nama_ibu
* @property string $pekerjaan_ayah
* @property string $pekerjaan_ibu
* @property string $penghasilan_ortu
* @property string $nama_wali
* @property string $pekerjaan_wali
* @property string $penghasilan_wali
* @property string $created_at
* @property string $updated_at
* @property string $deleted_at
* @property integer $deleted
* @property string $created_by
* @property string $updated_by
* @property string $deleted_by
*/
class Siswa extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'siswa';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['nama', 'nis', 'nisn', 'alamat', 'foto', 'nama_ayah', 'nama_ibu', 'pekerjaan_ayah', 'pekerjaan_ibu', 'penghasilan_ortu', 'nama_wali', 'pekerjaan_wali', 'penghasilan_wali'], 'required'],
[['created_at', 'updated_at', 'deleted_at'], 'safe'],
[['deleted'], 'integer'],
[['nama', 'nis', 'nisn', 'alamat', 'foto', 'nama_ayah', 'nama_ibu', 'pekerjaan_ayah', 'pekerjaan_ibu', 'penghasilan_ortu', 'nama_wali', 'pekerjaan_wali', 'penghasilan_wali'], 'string', 'max' => 100],
[['created_by', 'updated_by', 'deleted_by'], 'string', 'max' => 32],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'nama' => 'Nama',
'nis' => 'Nis',
'nisn' => 'Nisn',
'alamat' => 'Alamat',
'foto' => 'Foto',
'nama_ayah' => 'Nama Ayah',
'nama_ibu' => 'Nama Ibu',
'pekerjaan_ayah' => 'Pekerjaan Ayah',
'pekerjaan_ibu' => 'Pekerjaan Ibu',
'penghasilan_ortu' => 'Penghasilan Ortu',
'nama_wali' => 'Nama Wali',
'pekerjaan_wali' => 'Pekerjaan Wali',
'penghasilan_wali' => 'Penghasilan Wali',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'deleted_at' => 'Deleted At',
'deleted' => 'Deleted',
'created_by' => 'Created By',
'updated_by' => 'Updated By',
'deleted_by' => 'Deleted By',
];
}
}
<?php
namespace app\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\Siswa;
/**
* SiswaSearch represents the model behind the search form about `app\models\Siswa`.
*/
class SiswaSearch extends Siswa
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'deleted'], 'integer'],
[['nama', 'nis', 'nisn', 'alamat', 'foto', 'nama_ayah', 'nama_ibu', 'pekerjaan_ayah', 'pekerjaan_ibu', 'penghasilan_ortu', 'nama_wali', 'pekerjaan_wali', 'penghasilan_wali', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'deleted_by'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Siswa::find();
// add conditions that should always apply here
$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;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'deleted_at' => $this->deleted_at,
'deleted' => $this->deleted,
]);
$query->andFilterWhere(['like', 'nama', $this->nama])
->andFilterWhere(['like', 'nis', $this->nis])
->andFilterWhere(['like', 'nisn', $this->nisn])
->andFilterWhere(['like', 'alamat', $this->alamat])
->andFilterWhere(['like', 'foto', $this->foto])
->andFilterWhere(['like', 'nama_ayah', $this->nama_ayah])
->andFilterWhere(['like', 'nama_ibu', $this->nama_ibu])
->andFilterWhere(['like', 'pekerjaan_ayah', $this->pekerjaan_ayah])
->andFilterWhere(['like', 'pekerjaan_ibu', $this->pekerjaan_ibu])
->andFilterWhere(['like', 'penghasilan_ortu', $this->penghasilan_ortu])
->andFilterWhere(['like', 'nama_wali', $this->nama_wali])
->andFilterWhere(['like', 'pekerjaan_wali', $this->pekerjaan_wali])
->andFilterWhere(['like', 'penghasilan_wali', $this->penghasilan_wali])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'updated_by', $this->updated_by])
->andFilterWhere(['like', 'deleted_by', $this->deleted_by]);
return $dataProvider;
}
}
......@@ -25,6 +25,8 @@ use Yii;
*/
class Users extends \yii\db\ActiveRecord
{
public $new_password, $old_password, $repeat_password;
/**
* @inheritdoc
*/
......@@ -39,18 +41,71 @@ class Users extends \yii\db\ActiveRecord
public function rules()
{
return [
[['username', 'password', 'email'], 'required'],
[['username', 'email'], 'required'],
[['status', 'deleted'], 'integer'],
[['created_at', 'updated_at', 'deleted_at'], 'safe'],
[['username', 'password', 'email'], 'string', 'max' => 100],
[['username', 'password', 'email','sekolah'], 'string', 'max' => 100],
[['auth_key', 'created_by', 'updated_by', 'deleted_by'], 'string', 'max' => 32],
[['password_hash', 'password_reset_token'], 'string', 'max' => 255],
[['new_password', 'repeat_password'], 'string', 'min' => 6],
[['repeat_password'], 'compare', 'compareAttribute' => 'new_password'],
[['new_password', 'repeat_password'], 'required', 'when' => function ($model) {
return (!empty($model->new_password));
}, 'whenClient' => "function (attribute, value) {
return ($('#user-new_password').val().length>0);
}"],
];
}
/**
* @inheritdoc
*/
public function scenarios() {
$scenarios = parent::scenarios();
$scenarios['password'] = ['new_password', 'repeat_password'];
return $scenarios;
}
public function validatePassword($password) {
return Yii::$app->security->validatePassword($password, $this->password_hash);
}
/**
* Generates password hash from password and sets it to the model
*
* @param string $password
*/
public function setPassword($password) {
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getRoles() {
return $this->hasMany(AuthAssignment::className(), [
'user_id' => 'id',
]);
}
public function beforeSave($insert) {
if (parent::beforeSave($insert)) {
if ($this->isNewRecord) {
$this->auth_key = \Yii::$app->security->generateRandomString();
}
return true;
}
return false;
}
/**
* @inheritdoc
*/
public function getAuthKey() {
return $this->auth_key;
}
public function attributeLabels()
{
return [
......@@ -58,6 +113,7 @@ class Users extends \yii\db\ActiveRecord
'username' => 'Username',
'password' => 'Password',
'email' => 'Email',
'sekolah' => 'Sekolah',
'auth_key' => 'Auth Key',
'password_hash' => 'Password Hash',
'password_reset_token' => 'Password Reset Token',
......
......@@ -19,7 +19,7 @@ class UsersSearch extends Users
{
return [
[['id', 'status', 'deleted'], 'integer'],
[['username', 'password', 'email', 'auth_key', 'password_hash', 'password_reset_token', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'deleted_by'], 'safe'],
[['username', 'password', 'email','sekolah', 'auth_key', 'password_hash', 'password_reset_token', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'deleted_by'], 'safe'],
];
}
......@@ -70,6 +70,7 @@ class UsersSearch extends Users
$query->andFilterWhere(['like', 'username', $this->username])
->andFilterWhere(['like', 'password', $this->password])
->andFilterWhere(['like', 'email', $this->email])
->andFilterWhere(['like', 'sekolah', $this->sekolah])
->andFilterWhere(['like', 'auth_key', $this->auth_key])
->andFilterWhere(['like', 'password_hash', $this->password_hash])
->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])
......
<?php
namespace app\modules\administrator;
/**
* administrator module definition class
*/
class Module extends \yii\base\Module
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'app\modules\administrator\controllers';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\Role;
use app\models\RoleSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
/**
* RoleController implements the CRUD actions for Role model.
*/
class RoleController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Role models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new RoleSearch([
'type' => 1
]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Role model.
* @param string $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Role model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Role();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$auth = Yii::$app->authManager;
$admin = $auth->createRole($model->name);
$auth->add($admin);
$model->save();
return $this->redirect(['view', 'id' => $model->name]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Role model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param string $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$auth = Yii::$app->authManager;
$admin = $auth->createRole($model->name);
$auth->add($admin);
$model->save();
return $this->redirect(['view', 'id' => $model->name]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
public function actionUpdateizin($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post())) {
$auth = Yii::$app->authManager;
$admin = $auth->createRole($model->name);
$auth->update($model->name, $admin);
$model->save();
Yii::$app->session->setFlash('success', 'Hak Akses berhasil diubah');
}
return $this->redirect(['view', 'id' => $model->name]);
}
/**
* Deletes an existing Role model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param string $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Role model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param string $id
* @return Role the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Role::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\Route;
use app\models\RouteSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use app\controllers\RouteController;
/**
* RouteController implements the CRUD actions for Route model.
*/
class RouteController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Route models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new RouteSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Route model.
* @param string $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Route model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Route();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->name]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Route model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param string $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->name]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Route model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param string $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Route model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param string $id
* @return Route the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Route::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
<?php
namespace app\modules\administrator\models;
use Yii;
/**
* This is the model class for table "auth_assignment".
*
* @property string $item_name
* @property string $user_id
* @property integer $created_at
*
* @property AuthItem $itemName
*/
class AuthAssignment extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'auth_assignment';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['item_name', 'user_id'], 'required'],
[['created_at'], 'integer'],
[['item_name', 'user_id'], 'string', 'max' => 64],
[['item_name'], 'exist', 'skipOnError' => true, 'targetClass' => AuthItem::className(), 'targetAttribute' => ['item_name' => 'name']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'item_name' => 'Item Name',
'user_id' => 'User ID',
'created_at' => 'Created At',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getItemName()
{
return $this->hasOne(AuthItem::className(), ['name' => 'item_name']);
}
}
<?php
namespace app\modules\administrator\models;
use Yii;
/**
* This is the model class for table "auth_item".
*
* @property string $name
* @property integer $type
* @property string $description
* @property string $rule_name
* @property string $data
* @property integer $created_at
* @property integer $updated_at
*
* @property AuthAssignment[] $authAssignments
* @property AuthRule $ruleName
* @property AuthItemChild[] $authItemChildren
* @property AuthItemChild[] $authItemChildren0
* @property Role[] $children
* @property Role[] $parents
*/
class Role extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'auth_item';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'type'], 'required'],
[['type', 'created_at', 'updated_at'], 'integer'],
[['description', 'data'], 'string'],
[['name', 'rule_name'], 'string', 'max' => 64],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'name' => 'Name',
'type' => 'Type',
'description' => 'Description',
'rule_name' => 'Rule Name',
'data' => 'Data',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthAssignments()
{
return $this->hasMany(AuthAssignment::className(), ['item_name' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getRuleName()
{
return $this->hasOne(AuthRule::className(), ['name' => 'rule_name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthItemChildren()
{
return $this->hasMany(AuthItemChild::className(), ['parent' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthItemChildren0()
{
return $this->hasMany(AuthItemChild::className(), ['child' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getChildren()
{
return $this->hasMany(Role::className(), ['name' => 'child'])->viaTable('auth_item_child', ['parent' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getParents()
{
return $this->hasMany(Role::className(), ['name' => 'parent'])->viaTable('auth_item_child', ['child' => 'name']);
}
}
<?php
namespace app\modules\administrator\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\modules\administrator\models\Role;
/**
* RoleSearch represents the model behind the search form about `app\modules\administrator\models\Role`.
*/
class RoleSearch extends Role
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'description', 'rule_name', 'data'], 'safe'],
[['type', 'created_at', 'updated_at'], 'integer'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Role::find();
// add conditions that should always apply here
$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;
}
// grid filtering conditions
$query->andFilterWhere([
'type' => $this->type,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'description', $this->description])
->andFilterWhere(['like', 'rule_name', $this->rule_name])
->andFilterWhere(['like', 'data', $this->data]);
return $dataProvider;
}
}
<?php
namespace app\modules\administrator\models;
use Yii;
/**
* This is the model class for table "auth_item".
*
* @property string $name
* @property integer $type
* @property string $description
* @property string $rule_name
* @property string $data
* @property integer $created_at
* @property integer $updated_at
*
* @property AuthAssignment[] $authAssignments
* @property AuthRule $ruleName
* @property AuthItemChild[] $authItemChildren
* @property AuthItemChild[] $authItemChildren0
* @property Route[] $children
* @property Route[] $parents
*/
class Route extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'auth_item';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'type'], 'required'],
[['type', 'created_at', 'updated_at'], 'integer'],
[['description', 'data'], 'string'],
[['name', 'rule_name'], 'string', 'max' => 64],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'name' => 'Name',
'type' => 'Type',
'description' => 'Description',
'rule_name' => 'Rule Name',
'data' => 'Data',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthAssignments()
{
return $this->hasMany(AuthAssignment::className(), ['item_name' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getRuleName()
{
return $this->hasOne(AuthRule::className(), ['name' => 'rule_name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthItemChildren()
{
return $this->hasMany(AuthItemChild::className(), ['parent' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthItemChildren0()
{
return $this->hasMany(AuthItemChild::className(), ['child' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getChildren()
{
return $this->hasMany(Route::className(), ['name' => 'child'])->viaTable('auth_item_child', ['parent' => 'name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getParents()
{
return $this->hasMany(Route::className(), ['name' => 'parent'])->viaTable('auth_item_child', ['child' => 'name']);
}
}
<?php
namespace app\modules\administrator\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\modules\administrator\models\Route;
/**
* RouteSearch represents the model behind the search form about `app\modules\administrator\models\Route`.
*/
class RouteSearch extends Route
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'description', 'rule_name', 'data'], 'safe'],
[['type', 'created_at', 'updated_at'], 'integer'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Route::find();
// add conditions that should always apply here
$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;
}
// grid filtering conditions
$query->andFilterWhere([
'type' => $this->type,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'description', $this->description])
->andFilterWhere(['like', 'rule_name', $this->rule_name])
->andFilterWhere(['like', 'data', $this->data]);
return $dataProvider;
}
}
......@@ -18,7 +18,7 @@ $this->registerJs($script, \yii\web\View::POS_END);
<?php
if(
Yii::$app->controller->id === 'site' && Yii::$app->controller->action->id === 'index'||
Yii::$app->controller->id === 'site' && Yii::$app->controller->action->id === 'daftar_TK'||
Yii::$app->controller->id === 'site' && Yii::$app->controller->action->id === 'daftartk'||
Yii::$app->controller->id === 'site' && Yii::$app->controller->action->id === 'daftar_SD'||
Yii::$app->controller->id === 'site' && Yii::$app->controller->action->id === 'daftar_SMP'
){
......@@ -50,7 +50,7 @@ if(
],
],
['label' => 'Daftar TK/PAUD', 'url' => ['/site/daftar_TK']],
['label' => 'Daftar TK/PAUD', 'url' => ['/site/daftartk']],
['label' => 'Daftar SD', 'url' => ['/site/daftar_SD']],
['label' => 'Daftar SMP', 'url' => ['/site/daftar_SMP']],
['label' => 'LOGIN', 'url' => ['/site/about']],
......
<?php
use app\components\Mimin;
?>
<aside class="main-sidebar">
<section class="sidebar">
......@@ -35,6 +39,25 @@
['label' => 'Home', 'icon' => 'dashboard', 'url' =>['/site/about'] ],
['label' => 'User', 'icon' => 'fa fa-user', 'url' => ['/users/index']],
['label' => 'Sekolah', 'icon' => 'fa fa-book', 'url' => ['/sekolah/index']],
[ 'label' => 'Akses',
'options' => ['class' => 'manajemen_user'],
'icon' => 'fa fa-folder',
'items' => [
['label' => 'Route', 'icon' => 'fa fa-cutlery', 'url' => ['administator/route/index'],],
['label' => 'Role', 'icon' => 'fa fa-institution', 'url' => ['administator /role/index'],],
]
],
// [
// 'label' => 'Sekolah',
// 'options' => ['class' => 'administrasi'],
// 'icon' => 'fa fa-folder',
// 'items' => [
// ['label' => 'TK', 'icon' => 'fa fa-asterisk', 'url' => ['/sekolah/index'],'visible'=> Mimin::checkRoute('/sekolah/index',true),'options' => ['class' => 'index']],
// ['label' => 'TK', 'icon' => 'fa fa-asterisk', 'url' => ['/sekolah/index'],'visible'=>Mimin::checkRoute('/sekolah/index',true),'options' => ['class' => 'index']],
// ['label' => 'TK', 'icon' => 'fa fa-asterisk', 'url' => ['/sekolah/index'],'visible'=>Mimin::checkRoute('/sekolah/index',true),'options' => ['class' => 'index']],
// ],
// ],
// ['label' => 'Siswa', 'icon' => 'fa fa-user' , 'url' => ['/siswa/index']],
['label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest],
// [
// 'label' => 'Same tsools',
......
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Role */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="role-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'type')->textInput() ?>
<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'rule_name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'data')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\RoleSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="role-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'type') ?>
<?= $form->field($model, 'description') ?>
<?= $form->field($model, 'rule_name') ?>
<?= $form->field($model, 'data') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Role */
$this->title = 'Create Role';
$this->params['breadcrumbs'][] = ['label' => 'Roles', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="role-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\administrator\models\RoleSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Roles';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="role-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Role', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'name',
'type',
'description:ntext',
'rule_name',
'data:ntext',
// 'created_at',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Role */
$this->title = 'Update Role: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Roles', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->name]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="role-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Role */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Roles', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="role-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->name], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->name], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'name',
'type',
'description:ntext',
'rule_name',
'data:ntext',
'created_at',
'updated_at',
],
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Route */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="route-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'type')->textInput() ?>
<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'rule_name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'data')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\RouteSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="route-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'type') ?>
<?= $form->field($model, 'description') ?>
<?= $form->field($model, 'rule_name') ?>
<?= $form->field($model, 'data') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Route */
$this->title = 'Create Route';
$this->params['breadcrumbs'][] = ['label' => 'Routes', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="route-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\administrator\models\RouteSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Routes';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="route-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Route', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'name',
'type',
'description:ntext',
'rule_name',
'data:ntext',
// 'created_at',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Route */
$this->title = 'Update Route: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Routes', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->name]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="route-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\modules\administrator\models\Route */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Routes', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="route-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->name], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->name], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'name',
'type',
'description:ntext',
'rule_name',
'data:ntext',
'created_at',
'updated_at',
],
]) ?>
</div>
......@@ -2,10 +2,12 @@
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\Jenjang;
/* @var $this yii\web\View */
/* @var $model app\models\Sekolah */
/* @var $form yii\widgets\ActiveForm */
/* @var $form yii\widgets\ActiveForm
<!-- -->*/
?>
<div class="sekolah-form">
......@@ -15,12 +17,13 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'nama_sekolah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'alamat_sekolah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'jenjang')->dropDownList(ArrayHelper::map(Jenjang::find()->all(), 'jenjang', 'jenjang'), ['prompt' => 'Pilih Jenjang']) ?>
<?= $form->field($model, 'foto_sekolah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'visi')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'foto_sekolah')->fileInput() ?>
<?= $form->field($model, 'visi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'misi')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'misi')->textarea(['rows' => 3]) ?>
<!-- <?= $form->field($model, 'created_at')->textInput() ?>
......
......@@ -2,6 +2,9 @@
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
use app\models\Sekolah;
use app\controllers\SekolahController;
/* @var $this yii\web\View */
/* @var $searchModel app\models\SekolahSearch */
......@@ -24,11 +27,19 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'nama_sekolah',
'alamat_sekolah',
'foto_sekolah',
'visi',
'jenjang',
// [
// 'attribute' => 'Foto Sekolah',
// 'format' => 'raw',
// 'value' => function ($model) {
// if ($model->foto_sekolah!='')
// return '<img src="'.Yii::getAlias('@web'). '/gambarsekolah/'.$model->foto_sekolah.'" width="100px" height="auto">'; else return 'no image';
// },
// ],
// 'misi',
// 'created_at',
// 'updated_at',
......@@ -37,8 +48,8 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_by',
// 'updated_by',
// 'deleted_by',
['class' => 'yii\grid\ActionColumn'],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
]);
?>
</div>
<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\Sekolah;
use app\models\SekolahSearch;
use app\controller\SekolahController;
$this->title = '';
?>
<div class="site-index">
<!-- <div class="jumbotron" style="background-image: url('/gambarsekolah/'.<?=$model->foto_sekolah?>); background-size: cover;
background-position: center top; padding: 8em 6em 6em 6em; background-repeat: no-repeat;">
<h1><?=
$model->nama_sekolah;
?></h1>
<h3><?=
$model->alamat_sekolah;
?></h3>
</div> -->
<div class="col-sm-8">
<div class="box box-danger">
<img src="<?php echo Yii::getAlias('@web').'/'.$dataProvider->models->foto_sekolah; ?>">
</div>
</div>
<br>
<div class="col-sm-4">
<h1><?=
$model->nama_sekolah;
?></h1>
<h3><?=
$model->alamat_sekolah;
?></h3>
</div>
<div class="col-sm-12" >
<div class="box box-danger">
<div class="box-header with-border">
<h2>VISI DAN MISI <?= $model->nama_sekolah?></h2>
</div>
<div class="box-body with-border">
<h3>Visi</h3>
<?php
echo $model->visi;
?>
</div>
<div class="box-body with-border">
<h3>Misi </h3>
<?php
echo $model->misi;
?>
</div>
</div>
</div>
</br>
<!--siswa -->
<div class="body-content">
<div class="col-lg-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-red">
<div class="inner">
<h3>&nbsp;</h3>
<p><b><h4>SISWA</h4></b></p>
<p><h5>JUMLAH SISWA</h5></p>
</div>
<div class="icon">
<i class="fa fa-user-circle-o"></i>
</div>
<!-- <a href="#" class="small-box-footer">View Detail <i class="fa fa-arrow-circle-right"></i></a> -->
<?= Html::a('<p style="font-size:15px;color:white"><b>'.'Lihat Daftar Siswa'.'</b></p>'.'<i class="fa fa-arrow-circle-right"></i>', ['site/list-izin'], ['class' => 'small-box-footer']) ?>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-blue">
<div class="inner">
<h3>&nbsp;</h3>
<p><b><h4>GURU</h4></b></p>
<p><h5>JUMLAH GURU</h5></p>
</div>
<div class="icon">
<i class="fa fa-tasks"></i>
</div>
<!-- <a href="#" class="small-box-footer">View Detail <i class="fa fa-arrow-circle-right"></i></a> -->
<?= Html::a('<p style="font-size:15px;color:white"><b>'.'Lihat Daftar Guru'.'</b></p>'.'<i class="fa fa-arrow-circle-right"></i>', ['site/list-izin'], ['class' => 'small-box-footer']) ?>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-green">
<div class="inner">
<h3>&nbsp;</h3>
<p><b><h4>EKSTRAKULIKULER</h4></b></p>
<p><h5>JUMLAH EKSTRAKULIKULER</h5></p>
</div>
<div class="icon">
<i class="fa fa-thumbs-o-up"></i>
</div>
<!-- <a href="#" class="small-box-footer">View Detail <i class="fa fa-arrow-circle-right"></i></a> -->
<?= Html::a('<p style="font-size:15px;color:white"><b>'.'Lihat Daftar Ekstrakulikuler'.'</b></p>'.'<i class="fa fa-arrow-circle-right"></i>', ['site/list-izin'], ['class' => 'small-box-footer']) ?>
</div>
</div>
<div class="row">
</div>
</div>
</div>
......@@ -31,16 +31,23 @@ $this->params['breadcrumbs'][] = $this->title;
'id',
'nama_sekolah',
'alamat_sekolah',
'foto_sekolah',
[
'attribute' => 'Foto',
'format' => 'raw',
'value' => function ($model) {
if ($model->foto_sekolah!='')
return '<img src="'.Yii::getAlias('@web'). '/gambarsekolah/'.$model->foto_sekolah.'" width="100px" height="auto">'; else return 'no image';
},
],
'visi',
'misi',
'created_at',
'updated_at',
'deleted_at',
'deleted',
'created_by',
'updated_by',
'deleted_by',
// 'created_at',
// 'updated_at',
// 'deleted_at',
// 'deleted',
// 'created_by',
// 'updated_by',
// 'deleted_by',
],
]) ?>
......
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Siswa */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="siswa-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'nama')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nis')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nisn')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'alamat')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'foto')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nama_ayah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nama_ibu')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'pekerjaan_ayah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'pekerjaan_ibu')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'penghasilan_ortu')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nama_wali')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'pekerjaan_wali')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'penghasilan_wali')->textInput(['maxlength' => true]) ?>
<!-- <?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<?= $form->field($model, 'deleted_at')->textInput() ?>
<?= $form->field($model, 'deleted')->textInput() ?>
<?= $form->field($model, 'created_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'updated_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'deleted_by')->textInput(['maxlength' => true]) ?> -->
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\SiswaSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="siswa-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'nama') ?>
<?= $form->field($model, 'nis') ?>
<?= $form->field($model, 'nisn') ?>
<?= $form->field($model, 'alamat') ?>
<?php // echo $form->field($model, 'foto') ?>
<?php // echo $form->field($model, 'nama_ayah') ?>
<?php // echo $form->field($model, 'nama_ibu') ?>
<?php // echo $form->field($model, 'pekerjaan_ayah') ?>
<?php // echo $form->field($model, 'pekerjaan_ibu') ?>
<?php // echo $form->field($model, 'penghasilan_ortu') ?>
<?php // echo $form->field($model, 'nama_wali') ?>
<?php // echo $form->field($model, 'pekerjaan_wali') ?>
<?php // echo $form->field($model, 'penghasilan_wali') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'deleted_at') ?>
<?php // echo $form->field($model, 'deleted') ?>
<?php // echo $form->field($model, 'created_by') ?>
<?php // echo $form->field($model, 'updated_by') ?>
<?php // echo $form->field($model, 'deleted_by') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Siswa */
$this->title = 'Create Siswa';
$this->params['breadcrumbs'][] = ['label' => 'Siswas', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="siswa-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\SiswaSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Siswas';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="siswa-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Siswa', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'nama',
'nis',
'nisn',
'alamat',
// 'foto',
// 'nama_ayah',
// 'nama_ibu',
// 'pekerjaan_ayah',
// 'pekerjaan_ibu',
// 'penghasilan_ortu',
// 'nama_wali',
// 'pekerjaan_wali',
// 'penghasilan_wali',
// 'created_at',
// 'updated_at',
// 'deleted_at',
// 'deleted',
// 'created_by',
// 'updated_by',
// 'deleted_by',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Siswa */
$this->title = 'Update Siswa: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Siswas', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="siswa-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Siswa */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Siswas', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="siswa-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'nama',
'nis',
'nisn',
'alamat',
'foto',
'nama_ayah',
'nama_ibu',
'pekerjaan_ayah',
'pekerjaan_ibu',
'penghasilan_ortu',
'nama_wali',
'pekerjaan_wali',
'penghasilan_wali',
// 'created_at',
// 'updated_at',
// 'deleted_at',
// 'deleted',
// 'created_by',
// 'updated_by',
// 'deleted_by',
],
]) ?>
</div>
<?php
/* @var $this yii\web\View */
<?php
use yii\widgets\DetailView;
use app\models\Sekolah;
use app\models\SekolahSearch;
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
use yii\helpers\Html;
use yii\bootstrap\Carousel;
use app\models\DefaultBlog;
//use miloschuman\highcharts\Highcharts;
//use pollext\poll\Poll;
use yii\helpers\Url;
//use kartik\widgets\StarRating;
use yii\web\JsExpression;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
use app\models\IboMasterSurveyKepuasan;
use app\models\IboMasterBerita;
use app\models\IboMasterSlider;
use app\models\IboMasterKategoriBerita;
$this->title = 'E - Pendidikan';
?>
$this->title = '';
?>
<?php
$script = <<< JS
$(document).ready(function(){
......@@ -94,7 +97,7 @@ $this->registerJs($script, \yii\web\View::POS_END);
<div class="inner">
<h3>&nbsp;</h3>
<p><b><h4></h4>Data</h4></b></p>
<p><b><h4></h4>Data 1</h4></b></p>
</div>
<div class="icon">
<i class="fa fa-credit-card"></i>
......@@ -105,7 +108,8 @@ $this->registerJs($script, \yii\web\View::POS_END);
</div>
</div>
<!--Daftar Jenjang Sekolah -->
<div class="container">
<div class="row">
<div class="col-lg-12">
......@@ -118,29 +122,167 @@ $this->registerJs($script, \yii\web\View::POS_END);
<div class="col-md-4">
<div class="panel panel-info">
<div class="panel-heading">
<h4><i class="fa fa-fw fa-check"></i>Data 1</h4>
<h4><i class="fa fa-fw fa-compass"></i>TK</h4>
</div>
<div class="panel-body">
<?php
echo GridView::widget([
'dataProvider' => $dataProviderTK,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// [
// 'attribute' => 'Nama Sekolah',
// 'format'=>'raw',
// 'value' => 'nama_sekolah'
// // 'value' => function ($data) {
// // if($data->jenjang=='TK'){
// // return $data->nama_sekolah;
// // }else{
// // return "";
// // }}
// ],
'nama_sekolah',
'jenjang',
[
'class' => 'yii\grid\ActionColumn',
'template' =>'{view}',
'buttons' =>[
'view' => function ($url, $model){
return Html::a('<span class="btn btn-success btn-xs"><i class="fa fa-eye"></i></span>', $url, [
'title' => Yii::t('app', 'Lihat'),
]);
},
],
'urlCreator' => function ($action, $model, $key, $index){
if($action === 'view'){
return Url::toRoute(['sekolah/indexsekolah','id' =>$model->id]);
}
}
],
],
]);
?>
</div>
<div class="panel-body"></div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-success">
<div class="panel-heading">
<h4><i class="fa fa-fw fa-gift"></i>Data 2</h4>
<h4><i class="fa fa-fw fa-compass"></i>SD</h4>
</div>
<div class="panel-body">
<?php
echo GridView::widget([
'dataProvider' => $dataProviderTK,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'Nama Sekolah',
'format'=>'raw',
'value' => function ($data) {
if($data->jenjang=='SD'){
return $data->nama_sekolah;
}else{
return "";
}}
],
[
'class' => 'yii\grid\ActionColumn',
'template' =>'{view}',
'buttons' =>[
'view' => function ($url, $model){
return Html::a('<span class="btn btn-success btn-xs"><i class="fa fa-eye"></i></span>', $url, [
'title' => Yii::t('app', 'Lihat'),
]);
},
],
'urlCreator' => function ($action, $model, $key, $index){
if($action === 'view'){
return Url::toRoute(['sekolah/indexsekolah','id' =>$model->id]);
}
}
],
],
]);
?>
</div>
<div class="panel-body"></div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-danger">
<div class="panel panel-success">
<div class="panel-heading">
<h4><i class="fa fa-fw fa-compass"></i>Data 3</h4>
<h4><i class="fa fa-fw fa-compass"></i>SMP</h4>
</div>
<div class="panel-body">
<?php
echo GridView::widget([
'dataProvider' => $dataProviderSMP,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'Nama Sekolah',
'format'=>'raw',
'value' => function ($data) {
if($data->jenjang=='SMP'){
return $data->nama_sekolah;
}else{
return "";
}}
],
[
'class' => 'yii\grid\ActionColumn',
'template' =>'{view}',
'buttons' =>[
'view' => function ($url, $model){
return Html::a('<span class="btn btn-success btn-xs"><i class="fa fa-eye"></i></span>', $url, [
'title' => Yii::t('app', 'Lihat'),
]);
},
],
'urlCreator' => function ($action, $model, $key, $index){
if($action === 'view'){
return Url::toRoute(['sekolah/indexsekolah','id' =>$model->id]);
}
}
],
],
]);
?>
</div>
<div class="panel-body"></div>
</div>
</div>
</div>
</div>
<!-- akkhir jenjang-->
<hr>
......
......@@ -21,11 +21,11 @@ $fieldOptions2 = [
<div class="login-box">
<div class="login-logo">
<a href="#"><b>SI</b>Pendidikan</a>
<a href="#"><b>Aplikasi E-Pendidikan</b></a>
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">Sign in to start your session</p>
<p class="login-box-msg">Login</p>
<?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>
......@@ -40,11 +40,11 @@ $fieldOptions2 = [
->passwordInput(['placeholder' => $model->getAttributeLabel('password')]) ?>
<div class="row">
<div class="col-xs-8">
<?= $form->field($model, 'rememberMe')->checkbox() ?>
<div class="col-xs-3">
</div>
<!-- /.col -->
<div class="col-xs-4">
<div class="col-xs-6">
<?= Html::submitButton('Sign in', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']) ?>
</div>
<!-- /.col -->
......
<html>
<h1>
Lappet
</h1>
<h1> Hello World </h1>
</html>
\ No newline at end of file
......@@ -2,6 +2,7 @@
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\SwitchInput;
/* @var $this yii\web\View */
/* @var $model app\models\Users */
......@@ -14,34 +15,35 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
<!-- <?= $form->field($model, 'auth_key')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'password_hash')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'password_reset_token')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<?= $form->field($model, 'deleted_at')->textInput() ?>
<?= $form->field($model, 'deleted')->textInput() ?>
<?= $form->field($model, 'created_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'updated_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'deleted_by')->textInput(['maxlength' => true]) ?> -->
<?php
if(Yii::$app->user->isGuest){
}
else{
?>
<?= $form->field($model, 'status')->widget(SwitchInput::classname(), [
'pluginOptions' => [
'onText' => 'Active',
'offText' => 'Banned',
]
]) ?>
<?php
}
?>
<?php if (!$model->isNewRecord) { ?>
<strong> Leave blank if not change password</strong>
<div class="ui divider"></div>
<?= $form->field($model, 'new_password')->passwordInput() ?>
<?= $form->field($model, 'repeat_password')->passwordInput() ?>
<?php } ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<?= Html::a('Batal', ['index'], ['class' => 'btn btn-danger']) ?>
</div>
<?php ActiveForm::end(); ?>
......
......@@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Users', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Tambah Pengguna', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment