/**
  * Creates a new RgnCity model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (RgnCityAccess::allowCreate() == FALSE) {
         throw RgnCityAccess::exception('create');
     }
     $model = new RgnCityForm();
     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


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

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

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

					<?php 
echo RgnCityAccess::button('create', ['label' => 'New City', 'urlOptions' => ['RgnCityForm' => ['country_id' => $model->country_id, 'province_id' => $model->id]], 'buttonOptions' => ['class' => 'btn btn-success btn-xs']]);
?>

				</div>
			</div>

			<?php 
Pjax::begin(['id' => 'pjax-RgnCities', 'enableReplaceState' => false, 'linkSelector' => '#pjax-RgnCities 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->getRgnCities(), 'pagination' => ['pageSize' => 50, 'pageParam' => 'page-rgncities']]), '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();
Exemplo n.º 3
0
	<?php 
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">

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

        <div class="pull-right">
			<?php 
echo RgnCityAccess::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;
Exemplo n.º 4
0
	<?php 
//     echo $this->render('_search', ['model' =>$searchModel]);
?>

    <div class="clearfix">

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

        <div class="pull-right">
			<?php 
echo RgnCityAccess::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;