/** * Creates a new City model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (CityAccess::allowCreate() == FALSE) { throw CityAccess::exception('create'); } $model = new CityForm(); 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]); }
<?php // echo $this->render('_search', ['model' =>$searchModel]); ?> <div class="clearfix"> <p class="pull-left"> <?php echo CityAccess::button('create'); ?> </p> <div class="pull-right"> <?php echo CityAccess::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;
<?php $this->beginBlock('Cities'); ?> <div style='position: relative'> <div style='position:absolute; right: 0px; top: 0px;'> <?php echo CityAccess::button('index', ['label' => 'All Cities', 'buttonOptions' => ['class' => 'btn btn-success btn-xs']]); ?> <?php echo CityAccess::button('create', ['label' => 'New City', 'urlOptions' => ['CityForm' => ['country_id' => $model->country_id, 'province_id' => $model->id]], 'buttonOptions' => ['class' => 'btn btn-success btn-xs']]); ?> </div> </div> <?php Pjax::begin(['id' => 'pjax-Cities', 'enableReplaceState' => false, 'linkSelector' => '#pjax-Cities 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->getCities(), 'pagination' => ['pageSize' => 50, 'pageParam' => 'page-cities']]), '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; }], 'abbreviation']]) . '</div>'; ?> <?php Pjax::end();
<?php // echo $this->render('_search', ['model' =>$searchModel]); ?> <div class="clearfix"> <p class="pull-left"> <?php echo CityAccess::button('create'); ?> </p> <div class="pull-right"> <?php echo CityAccess::button('index'); ?> </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;