예제 #1
0
 public static function findAllForDropDownList()
 {
     $models = Paises::find()->orderBy('nombre_pais')->all();
     $listData = [];
     foreach ($models as $model) {
         if (intval($model->id)) {
             $listData[$model->id] = $model->nombre_pais;
         }
     }
     return $listData;
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Paises::find();
     $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;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'nombre_pais', $this->nombre_pais]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPais()
 {
     return $this->hasOne(Paises::className(), ['id' => 'id_pais']);
 }
예제 #4
0
 public function actionIndex()
 {
     $pais = Paises::obtenerPaisPorId(1);
     return $pais->nombre;
 }
예제 #5
0
use app\models\Paises;
/* @var $this yii\web\View */
/* @var $searchModel app\models\AutoresBusqueda */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Autores';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="autores-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Create Autores', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'idpais', 'filter' => ArrayHelper::map(Paises::find()->asArray()->all(), 'id', 'nombre'), 'label' => 'País', 'content' => function ($model, $key, $index, $column) {
    return Html::a($model->idpais0->nombre, ['autores/por-pais', 'idPais' => $model->idpais0->id], ['data-pjax' => 0]);
}], 'nombre', 'apellidos', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
예제 #6
0
 public function getPais()
 {
     return Paises::findOne(['id' => $this->id_pais])->nombre_pais;
 }
예제 #7
0
 public function getRegister()
 {
     $countries = Paises::all();
     return view('site.register', array('countries' => $countries));
 }
예제 #8
0
 /**
  * Finds the Paises model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Paises the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Paises::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #9
0
?>
	
	    <?php 
echo $form->field($model, 'ciudad')->textInput(['maxlength' => true]);
?>
	
    	<?php 
echo $form->field($model, 'id_provincia')->dropdownList(Provincias::findAllForDropDownList(), ['prompt' => '--- Otras ---']);
?>
	    
	    <?php 
echo $form->field($model, 'provincia')->textInput(['maxlength' => true]);
?>
	    
    	<?php 
echo $form->field($model, 'id_pais')->dropdownList(Paises::findAllForDropDownList(), ['prompt' => '--- Select Status ---']);
?>
	
	    <?php 
echo $form->field($model, 'codigo_postal')->textInput(['maxlength' => true]);
?>
	
	    <?php 
echo $form->field($model, 'numero_casa')->textInput(['maxlength' => true]);
?>
	    
	    <?php 
echo $form->field($model, 'numero_movil')->textInput(['maxlength' => true]);
?>
	
	    <?php