echo $form->labelEx($model, 'alamat_pegawai'); ?> <?php echo $form->textArea($model, 'alamat_pegawai', array('rows' => 6, 'cols' => 50, 'class' => 'form-control')); ?> <?php echo $form->error($model, 'alamat_pegawai'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_provinsi'); ?> <?php echo $form->dropDownList($model, 'id_provinsi', CHtml::listData(Provinsi::model()->findAll(), 'id_provinsi', 'nama_provinsi'), array('empty' => '--Pilih Provinsi--', 'class' => 'form-control')); ?> <?php echo $form->error($model, 'id_provinsi'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_kabupaten'); ?> <?php echo $form->dropDownList($model, 'id_kabupaten', array(), array('class' => 'form-control')); ?> <?php echo $form->error($model, 'id_kabupaten');
public function getKabupaten($id) { $pro = \Provinsi::remember(60)->find($id)->kabupaten; return \Response::json($pro); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Provinsi the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Provinsi::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function getProvinsi($id) { $data = Provinsi::model()->findByPk($id); return empty($data) ? null : $data->nama_provinsi; }
public function getSetting() { $country = country::all(); $provs = Provinsi::all(); return view('settings')->with(compact('country'))->with(compact('provs')); }
<div class="row-fluid" id="wrapper" style="position: relative;"> <div class="span3" id="sidebar" style="height:100%; position:relative;"> <ul class="nav-list"> <li class="nav-header">1. Data Wilayah</li> <?php $provinsi = new Provinsi(); $no_prov = 1; foreach ($provinsi->findAll() as $prov) { ?> <li><a href="<?php echo Yii::app()->baseUrl; ?> /kanal_prov/<?php echo $prov->id_provinsi; ?> "><span class="number"></span><?php echo $no_prov; ?> <span class="text"><?php echo $prov->provinsi; ?> </span></a> <ul> <?php $criteria_kab = new CDbCriteria(); $criteria_kab->condition = 'id_provinsi = "' . $prov->id_provinsi . '" '; $kabupaten = Kabupaten::model()->findAll($criteria_kab); foreach ($kabupaten as $kab) { ?> <li><a href="<?php echo Yii::app()->baseUrl;
echo $form->labelEx($model, 'nama_kota'); ?> <?php echo $form->textField($model, 'nama_kota', array('size' => 50, 'maxlength' => 50)); ?> <?php echo $form->error($model, 'nama_kota'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'propinsi_id'); ?> <?php echo $form->dropDownList($model, 'propinsi_id', CHtml::listData(Provinsi::model()->findAll(), 'id', 'propinsi'), array('prompt' => ' = Pilihan = ', 'style' => 'widht:200px;')); ?> <?php echo $form->error($model, 'propinsi_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?>
?> <div class="row"> <?php echo $form->labelEx($model, 'provinsi_id'); ?> <?php echo $form->textField($model, 'provinsi_id', array('size' => 4, 'value' => $_GET['provinsi_id'])); ?> <?php echo $form->error($model, 'provinsi_id'); ?> <?php echo $form->textField($model, 'nama_provinsi', array('size' => 20, 'value' => Provinsi::model()->findByPk($_GET['provinsi_id'])->provinsi)); ?> <?php echo $form->labelEx($model, 'Nama Kota'); ?> <?php echo $form->textField($model, 'nm_kota', array('size' => 50, 'maxlength' => 50)); ?> <?php echo $form->error($model, 'nm_kota'); ?> </div>
<!-- <p> You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done. </p> --> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $prop = Provinsi::model()->findByPk($idProp); $this->renderPartial('_propinsi', array('prop' => $prop)); ?> <div class="row-buttons-2" align="right"> <?php echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl . '/images/cari.png'), '#', array('class' => 'search-button', 'title' => 'Pencarian Data')); ?> <?php echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl . '/images/petunjuk.png'), '#', array('title' => 'Petunjuk', 'onclick' => "\$('#helpdialog').dialog('open')")); ?> <?php echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl . '/images/tambah.png'), array('create', 'propinsi_id' => $idProp), array('title' => 'Menambah Data')); ?> </div>
<?php Route::get('api/dropdown', function () { $input = Input::get('option'); $prov = Provinsi::find($input); $kab = $prov->kabupatens(); return Response::make($kab->get(array('id', 'nama'))); }); /** * Frontend Routes * Namespaces indicate folder structure */ Route::group(['namespace' => 'Frontend'], function () { require __DIR__ . "/Routes/Frontend/Frontend.php"; require __DIR__ . "/Routes/Frontend/Access.php"; }); /** * Backend Routes * Namespaces indicate folder structure */ Route::group(['namespace' => 'Backend'], function () { Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function () { /** * These routes need the Administrator Role * or the view-backend permission (good if you want to allow more than one group in the backend, then limit the backend features by different roles or permissions) * * If you wanted to do this in the controller it would be: * $this->middleware('access.routeNeedsRoleOrPermission:{role:Administrator,permission:view_backend,redirect:/,with:flash_danger|You do not have access to do that.}'); * * You could also do the above in the Route::group below and remove the other parameters, but I think this is easier to read here. * Note: If you have both, the controller will take precedence.
public function destroy($id) { /* memanggil class model Provinsi * lalu melakukan query untuk mengambil data dari DB * dan menghapus datanya */ $provinsi = Provinsi::find($id); $provinsi->delete(); // redirect ke route yang lain return Redirect::to('provinsi')->with('message', 'PROVINSI BERHASIL DIHAPUS'); }
$this->params['breadcrumbs'][] = $this->title; /* belum di gunakan karena sudah ada list sidemenu, on plan next*/ $form = ActiveForm::begin(); echo "<h2><b>Origin</b></h2>"; ?> <?php echo $form->field($provinsi, 'PROVINCE')->dropDownList(ArrayHelper::map(Provinsi::find()->asArray()->all(), 'PROVINCE_ID', 'PROVINCE'), ['id' => 'cat-id']); echo $form->field($kota, 'CITY_NAME')->widget(\kartik\depdrop\DepDrop::classname(), ['options' => ['id' => 'subcat-id'], 'pluginOptions' => ['depends' => ['cat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/send/get-kota'])]]); ?> <?php echo "<h2><b>Destination</b></h2>"; ?> <?php $Expired = Provinsi::find()->all(); $listData = ArrayHelper::map($Expired, 'PROVINCE_ID', 'PROVINCE'); // echo $form->field($model, 'province')->dropDownList($listData, ['id'=>'id-province']); // echo $form->field($model, 'provinsi')->dropDownList($listData); echo $form->field($provinsi, 'PROVINCE')->dropDownList($listData, ['prompt' => '-Choose a provinsi-', 'onchange' => ' $.post( "index.php?r=send/lists&id=' . '"+$(this).val(), function( data ) { $( "select#kota-city_name" ).html( data ); }); ']); ?> <?php $dataPost = ArrayHelper::map(Kota::find()->all(), 'CITY_ID', 'CITY_NAME'); echo $form->field($kota, 'CITY_NAME')->dropDownList($dataPost); ?> <?php ActiveForm::end();