/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Tiposdoc::find(); $pageSize = isset($_GET['per-page']) ? $_GET['per-page'] : \Yii::$app->params['tiposdoc.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, 'persona_fisica' => $this->persona_fisica]); $query->andFilterWhere(['like', 'desc_tipo_doc', $this->desc_tipo_doc])->andFilterWhere(['like', 'desc_tipo_doc_abr', $this->desc_tipo_doc_abr]); return $dataProvider; }
<h3><?php echo Html::encode($this->title); ?> </h3> <?php // 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_tipo_doc', 'desc_tipo_doc_abr', ['attribute' => 'persona_fisica', 'value' => function ($model) { return Tiposdoc::getSiNo($model->persona_fisica); }, 'filter' => Tiposdoc::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);
/** * Finds the Tiposdoc model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Tiposdoc the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Tiposdoc::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getTipoDoc() { return $this->hasOne(Tiposdoc::className(), ['id' => 'id_tipo_doc']); }