コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = InfracUnidades::find();
     $pageSize = isset($_GET['per-page']) ? $_GET['per-page'] : \Yii::$app->params['infracUnidades.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]);
     $query->andFilterWhere(['like', 'unidad', $this->unidad]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the InfracUnidades model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return InfracUnidades the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = InfracUnidades::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: index.php プロジェクト: ibergonzi/country
    <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', 'concepto', ['attribute' => 'es_multa', 'value' => function ($model) {
    return InfracConceptos::getSiNo($model->es_multa);
}, 'filter' => InfracConceptos::getSiNo()], ['attribute' => 'dias_verif', 'hAlign' => 'right'], ['attribute' => 'multa_unidad', 'value' => 'multaUnidad.unidad', 'filter' => InfracUnidades::getLista()], ['attribute' => 'multa_precio', 'format' => ['decimal', 2], 'hAlign' => 'right'], ['attribute' => 'multa_reincidencia', 'value' => function ($model) {
    return InfracConceptos::getSiNo($model->multa_reincidencia);
}, 'filter' => InfracConceptos::getSiNo()], ['attribute' => 'multa_reinc_porc', 'format' => ['decimal', 2], 'hAlign' => 'right'], ['attribute' => 'multa_reinc_dias', 'hAlign' => 'right'], ['attribute' => 'multa_personas', 'value' => function ($model) {
    return InfracConceptos::getSiNo($model->multa_personas);
}, 'filter' => InfracConceptos::getSiNo()], ['attribute' => 'multa_personas_precio', 'format' => ['decimal', 2], 'hAlign' => 'right'], ['attribute' => 'estado', 'value' => function ($model) {
    return InfracConceptos::getEstados($model->estado);
}, 'filter' => InfracConceptos::getEstados()], ['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 concepto')]), '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';
    }
コード例 #4
0
ファイル: index.php プロジェクト: ibergonzi/country
}
echo Collapse::widget(['encodeLabels' => false, 'items' => [['label' => $lbl, 'content' => $this->render('_searchfec', ['model' => $searchModel])]]]);
if (\Yii::$app->session->get('infracFecDesde')) {
    $lbl2 = ' (' . Yii::$app->formatter->asDate(\Yii::$app->session->get('infracFecDesde')) . '-' . Yii::$app->formatter->asDate(\Yii::$app->session->get('infracFecHasta')) . ')';
} else {
    $lbl2 = '';
}
$pdfHeader = ['L' => ['content' => Html::img(Yii::$app->homeUrl . 'images/logoreportes.png')], 'C' => ['content' => $this->title . $lbl2, 'font-style' => 'B'], 'R' => ['content' => \Yii::$app->params['lblName']]];
$pdfFooter = ['L' => ['content' => \Yii::$app->params['lblName2']], 'C' => ['content' => 'página {PAGENO} de {nb}'], 'R' => ['content' => 'Fecha:{DATE d/m/Y}']];
$columns = ['id', ['attribute' => 'id_uf', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    return Html::a($model->id_uf, Yii::$app->urlManager->createUrl(['uf/view', 'id' => $model->id_uf]), ['title' => 'Ver detalle de la unidad funcional', 'target' => '_blank', 'data-pjax' => '0']);
}], ['attribute' => 'fecha', 'format' => 'date'], ['attribute' => 'hora', 'format' => 'time'], 'nro_acta', 'lugar', ['attribute' => 'rConcepto', 'value' => 'concepto.concepto', 'filter' => InfracConceptos::getLista()], 'descripcion', ['attribute' => 'notificado', 'value' => function ($model) {
    return Infracciones::getSiNo($model->notificado);
}, 'filter' => Infracciones::getSiNo()], ['attribute' => 'fecha_verif', 'format' => 'date'], ['attribute' => 'verificado', 'value' => function ($model) {
    return Infracciones::getSiNo($model->verificado);
}, 'filter' => Infracciones::getSiNo()], ['attribute' => 'rUnidad', 'value' => 'multaUnidad.unidad', 'filter' => InfracUnidades::getLista()], 'multa_total', ['attribute' => 'estado', 'value' => function ($model) {
    return Infracciones::getEstados($model->estado);
}, 'filter' => Infracciones::getEstados()], ['class' => 'kartik\\grid\\ActionColumn', 'header' => Html::a('<span class="glyphicon glyphicon-plus-sign"></span>', ['create'], ['class' => 'btn-sm btn-primary', 'title' => Yii::t('app', 'Alta de infracción/multa')]), '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"),
コード例 #5
0
ファイル: Infracciones.php プロジェクト: ibergonzi/country
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMultaUnidad()
 {
     return $this->hasOne(InfracUnidades::className(), ['id' => 'multa_unidad']);
 }