コード例 #1
0
 public function listarPorEstado($estadoId)
 {
     $estado = Estado::find($estadoId);
     if (is_null($estado)) {
         App::abort(404);
     }
     $municipios = Municipio::orderBy('nombre')->where('estado_id', '=', $estadoId)->get();
     return $municipios;
 }
コード例 #2
0
ファイル: EstadoSearch.php プロジェクト: edgasanc/es-crm
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Estado::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(['idEstado' => $this->idEstado]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre]);
     return $dataProvider;
 }
コード例 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Estado::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, 'usuariocrea' => $this->usuariocrea, 'fechacrea' => $this->fechacrea, 'usuariomodifica' => $this->usuariomodifica, 'fechamodifica' => $this->fechamodifica]);
     $query->andFilterWhere(['like', 'estado', $this->estado]);
     return $dataProvider;
 }
コード例 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEstado()
 {
     return $this->hasOne(Estado::className(), ['id' => 'estado_id']);
 }
コード例 #5
0
 public function ubicacion()
 {
     $estados = Estado::all();
     $data = RepositorieLocal::datosUbicacion();
     return view('admin.ubicacion', compact('estados', 'data'));
 }
コード例 #6
0
 /**
  * Finds the Estado model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Estado the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Estado::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #7
0
ファイル: Municipio.php プロジェクト: railton/divus-php
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEstado()
 {
     return $this->hasOne(Estado::className(), ['esta_codigo' => 'esta_codigo']);
 }
コード例 #8
0
ファイル: _form.php プロジェクト: railton/divus-php
    
    <?php 
echo $form->field($model, 'alun_data_nascimento')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Selecione uma data ...'], 'pluginOptions' => ['autoclose' => true, 'format' => 'dd/mm/yyyy']]);
?>

    <?php 
echo $form->field($model, 'alun_habilitado')->checkbox();
?>

    <?php 
echo $form->field($model, 'alun_observacao')->textarea(['rows' => 6]);
?>
    
    <?php 
$rows = \app\models\Estado::find()->all();
$estado = \yii\helpers\ArrayHelper::map($rows, 'esta_codigo', 'esta_nome');
echo $form->field($model, 'esta_codigo')->dropDownList($estado, ['prompt' => 'Selecione um estado', 'onchange' => '
                    $.get( "' . Url::toRoute('/aluno/municipio') . '", { id: $(this).val() } )
                        .done(function( data ) {
                            $( "#' . Html::getInputId($model, 'muni_codigo') . '" ).html( data );
                        }
                    );
                ']);
?>

    <?php 
echo $form->field($model, 'muni_codigo')->dropDownList(['prompt' => 'Selecione um estado']);
?>

    <div class="form-group">
コード例 #9
0
        <?php 
echo $form->field($model, 'publicar_id')->widget(SwitchInput::classname(), ['pluginOptions' => ['onText' => 'Si', 'offText' => 'No'], 'inlineLabel' => false]);
?>
        </div>
  

    </div>
   
    
    <?php 
echo Html::hiddenInput('fechaIngreso', $model->fechaIngreso);
echo Html::hiddenInput('ingreso_id', $model->ingreso_id);
$dataForma = ArrayHelper::map(\app\models\FormaIngreso::find()->asArray()->all(), 'id', 'nombre');
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 6, 'attributes' => ['nroA' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Número A..', 'addon' => ['append' => ['content' => '.00']]]], 'nroB' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Número B..']], 'nroC' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Número C..']], 'nroD' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Número D..']], 'descEpoca' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Epoca...']], 'codformaing' => ['type' => Form::INPUT_WIDGET, 'label' => 'Tipo de Ingreso', 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => $dataForma]]]]);
$dataCopia = ArrayHelper::map(\app\models\Copia::find()->asArray()->all(), 'id', 'nombre');
$dataEstado = ArrayHelper::map(\app\models\Estado::find()->asArray()->all(), 'id', 'nombre');
$dataTipo = ArrayHelper::map(\app\models\TipoAcervo::find()->asArray()->all(), 'id', 'descripcion');
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 6, 'attributes' => ['tipoAcervo_id' => ['type' => Form::INPUT_WIDGET, 'label' => 'Tipo de Acervo', 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => $dataTipo]], 'copia_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => $dataCopia]], 'estado_id' => ['type' => Form::INPUT_WIDGET, 'label' => 'Estado', 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => $dataEstado]], 'material' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Material...']], 'forma' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Forma...']], 'color' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Color...']]]]);
$dataUbicacion = ArrayHelper::map(\app\models\Ubicacion::find()->asArray()->all(), 'id', 'nombre');
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 3, 'attributes' => ['ubicacion_id' => ['type' => Form::INPUT_WIDGET, 'label' => 'Ubicación', 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => $dataUbicacion]], 'descUbicacion' => ['type' => Form::INPUT_TEXT, 'label' => 'Más detalles ubicación', 'options' => ['placeholder' => 'Más detalles...']], 'lugarprocac' => ['type' => Form::INPUT_TEXT, 'label' => 'Lugar de Procedencia', 'options' => ['placeholder' => 'Lugar de procedencia...']]]]);
?>
    
    <div class="row">
        <div class="col-sm-6"> 
            <?php 
echo $form->field($model, 'TemaIds')->widget(Select2::classname(), ['data' => $model->dropTema, 'options' => ['multiple' => true]]);
?>
        </div>
        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'ColeccionIds')->widget(Select2::classname(), ['data' => $model->dropColeccion, 'options' => ['multiple' => true]]);
コード例 #10
0
ファイル: _form.php プロジェクト: 6758144/divus-php
/* @var $form yii\widgets\ActiveForm */
?>

<div class="municipio-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'muni_nome')->textInput(['maxlength' => true]);
?>

    <?php 
// DropdownList
$rows = Estado::find()->all();
$data = ArrayHelper::map($rows, 'esta_codigo', 'esta_nome');
echo $form->field($model, 'esta_codigo')->dropDownList($data, ['prompt' => 'Selecione um estado']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
コード例 #11
0
ファイル: index.php プロジェクト: railton/divus-php
    <p>
        <?php 
echo Html::a('Create Aluno', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'alun_codigo', 'alun_nome', 'alun_matricula', 'alun_data_nascimento', 'alun_habilitado:boolean', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>


<?php 
use app\models\Aluno;
use app\models\Estado;
//$model = new Aluno();
//$model->alun_nome = "Francisco";
//$model->alun_matricula = "23423";
//$model->alun_data_nascimento = "09/09/1999";
//$model->muni_codigo = 1;
//$model->esta_codigo = 1;
//$model->save();
//
//print_r($model->errors);
$estado = Estado::findOne(1);
echo $estado->esta_nome . "<br>";
foreach ($estado->municipios as $municipio) {
    echo $municipio->muni_nome . "<br>";
}
コード例 #12
0
ファイル: ApiController.php プロジェクト: railton/divus-php
 public function actionEstado($id)
 {
     $estado = \app\models\Estado::findOne($id);
     return $estado;
 }