コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ubicacion::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', $this->nombre]);
     return $dataProvider;
 }
コード例 #2
0
 public function getUbicacionTexto()
 {
     $ubicacion = Ubicacion::findOne($this->ubicacion_id);
     if (!isset($ubicacion)) {
         return "";
     }
     return $ubicacion->nombre;
 }
コード例 #3
0
 /**
  * Finds the Ubicacion model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Ubicacion the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Ubicacion::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #4
0
        </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]]);
?>
        </div>
    </div>
コード例 #5
0
 public function deleteUbicacion($id)
 {
     $cat = Ubicacion::find($id);
     $cat->delete();
 }