/**
  * Creates a new Subdistrict model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (SubdistrictAccess::allowCreate() == FALSE) {
         throw SubdistrictAccess::exception('create');
     }
     $model = new SubdistrictForm();
     try {
         if ($model->load($_POST) && $model->save()) {
             return $this->redirect(ReturnUrl::getUrl(Url::previous()));
         } elseif (!\Yii::$app->request->isPost) {
             $model->load($_GET);
         }
     } catch (\Exception $e) {
         $msg = isset($e->errorInfo[2]) ? $e->errorInfo[2] : $e->getMessage();
         $model->addError('_exception', $msg);
     }
     return $this->render('create', ['model' => $model]);
 }
Exemplo n.º 2
0
$this->params['breadcrumbs'][] = 'View';
?>
<div class="giiant-crud subdistrict-view">

    <!-- menu buttons -->
    <p class='pull-left'>
		<?php 
echo $model->operation->button('update');
?>
		<?php 
echo SubdistrictAccess::button('create');
?>
    </p>
    <p class="pull-right">
		<?php 
echo SubdistrictAccess::button('index');
?>
    </p>

    <div class="clearfix"></div>

    <!-- flash message -->
	<?php 
if (\Yii::$app->session->getFlash('deleteError') !== null) {
    ?>
		<span class="alert alert-info alert-dismissible" role="alert">
			<button type="button" class="close" data-dismiss="alert" aria-label="Close">
				<span aria-hidden="true">&times;</span></button>
			<?php 
    echo \Yii::$app->session->getFlash('deleteError');
    ?>
Exemplo n.º 3
0


			<?php 
$this->beginBlock('Subdistricts');
?>

			<div style='position: relative'>
				<div style='position:absolute; right: 0px; top: 0px;'>

					<?php 
echo SubdistrictAccess::button('index', ['label' => 'All Subdistricts', 'buttonOptions' => ['class' => 'btn btn-success btn-xs']]);
?>

					<?php 
echo SubdistrictAccess::button('create', ['label' => 'New Subdistrict', 'urlOptions' => ['SubdistrictForm' => ['country_id' => $model->country_id, 'province_id' => $model->province_id, 'city_id' => $model->city_id, 'district_id' => $model->id]], 'buttonOptions' => ['class' => 'btn btn-success btn-xs']]);
?>

				</div>
			</div>

			<?php 
Pjax::begin(['id' => 'pjax-Subdistricts', 'enableReplaceState' => false, 'linkSelector' => '#pjax-Subdistricts ul.pagination a, th a', 'clientOptions' => ['pjax:success' => 'function(){alert("yo")}']]);
?>
			<?php 
echo '<div class="table-responsive">' . \yii\grid\GridView::widget(['layout' => '{summary}{pager}<br/>{items}{pager}', 'dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getSubdistricts(), 'pagination' => ['pageSize' => 20, 'pageParam' => 'page-subdistricts']]), 'pager' => ['class' => yii\widgets\LinkPager::className(), 'firstPageLabel' => 'First', 'lastPageLabel' => 'Last'], 'columns' => [['class' => 'yii\\grid\\SerialColumn', "options" => ["width" => "50px"]], 'number', ["attribute" => "name", "format" => "raw", "options" => [], "value" => function ($model) {
    return $model->linkTo;
}]]]) . '</div>';
?>
			<?php 
Pjax::end();
Exemplo n.º 4
0
	<?php 
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">

        <p class="pull-left">
			<?php 
echo SubdistrictAccess::button('create');
?>
		</p>

        <div class="pull-right">
			<?php 
echo SubdistrictAccess::button('deleted');
?>
		</div>

    </div>

	<?php 
\yii\widgets\Pjax::begin(['id' => 'pjax-main', 'enableReplaceState' => false, 'linkSelector' => '#pjax-main ul.pagination a, th a', 'clientOptions' => ['pjax:success' => 'function(){alert("yo")}']]);
?>

	<div class="panel panel-default">
		<div class="panel-heading">
			<h2>
				<i><?php 
echo $this->title;
?>