/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MovimUf::find(); $pageSize = isset($_GET['per-page']) ? $_GET['per-page'] : \Yii::$app->params['movimUf.defaultPageSize']; // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize], 'sort' => ['defaultOrder' => ['id' => SORT_DESC], 'enableMultiSort' => true]]); $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'cesion' => $this->cesion, 'migracion' => $this->migracion, 'fec_vto' => $this->fec_vto, 'manual' => $this->manual]); $query->andFilterWhere(['like', 'desc_movim_uf', $this->desc_movim_uf]); return $dataProvider; }
/** * Finds the MovimUf model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MovimUf the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MovimUf::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
// echo $this->render('_search', ['model' => $searchModel]); ?> <?php $lbl2 = ''; $pdfHeader = ['L' => ['content' => \Yii::$app->params['lblName']], 'C' => ['content' => $this->title . $lbl2, 'font-style' => 'B'], 'R' => ['content' => '']]; $pdfFooter = ['L' => ['content' => \Yii::$app->params['lblName2']], 'C' => ['content' => 'página {PAGENO} de {nb}'], 'R' => ['content' => 'Fecha:{DATE d/m/Y}']]; $columns = ['id', 'desc_movim_uf', ['attribute' => 'cesion', 'value' => function ($model) { return MovimUf::getSiNo($model->cesion); }, 'filter' => MovimUf::getSiNo()], ['attribute' => 'migracion', 'value' => function ($model) { return MovimUf::getSiNo($model->migracion); }, 'filter' => MovimUf::getSiNo()], ['attribute' => 'fec_vto', 'value' => function ($model) { return MovimUf::getSiNo($model->fec_vto); }, 'filter' => MovimUf::getSiNo()], ['attribute' => 'manual', 'value' => function ($model) { return MovimUf::getSiNo($model->manual); }, 'filter' => MovimUf::getSiNo()], ['class' => 'kartik\\grid\\ActionColumn', 'header' => Html::a('<span class="glyphicon glyphicon-plus-sign"></span>', ['create'], ['class' => 'btn-sm btn-primary', 'title' => Yii::t('app', 'Nuevo')]), 'template' => '{view} {comentario}', 'buttons' => ['comentario' => function ($url, $model) { $c = Comentarios::getComentariosByModelId($model->className(), $model->id); $text = '<span class="glyphicon glyphicon-copyright-mark"'; if (!empty($c)) { $text .= ' style="color:#FF8000"></span>'; $titl = 'Ingresar nuevo/Ver comentarios'; } else { $text .= '></span>'; $titl = 'Ingresar nuevo comentario'; } return Html::a($text, $url, ['title' => $titl, 'onclick' => '$.ajax({ type :"POST", cache : false, url : $(this).attr("href"), success : function(response) { $("#divcomentarionuevo").html(response);
/** * @return \yii\db\ActiveQuery */ public function getTipoMovim() { return $this->hasOne(MovimUf::className(), ['id' => 'tipo_movim']); }
} '); ?> <div class="uf-titularidad-view"> <h3><?php echo Html::encode($this->title); ?> </h3> <p> <?php if (\Yii::$app->user->can('altaModificarUfTit')) { if ($model->ultima) { echo Html::a('Modificar', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) . ' '; $mu = MovimUf::findOne($model->tipo_movim); if ($mu->cesion) { echo Html::a('Finalizar cesión', ['fin-cesion', 'uf' => $model->id_uf, 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Procede con la finalización de la cesión?', 'method' => 'post']]) . ' '; } else { echo Html::a('Nuevo movimiento', ['create', 'uf' => $model->id_uf], ['class' => 'btn btn-danger']) . ' '; } } } ?> </p> <?php echo DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped table-bordered table-condensed detail-view'], 'attributes' => ['tipoMovim.desc_movim_uf', 'fec_desde:date', 'fec_hasta:date']]); ?>