コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Comentarios::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, 'model_id' => $this->model_id, 'created_by' => $this->created_by, 'created_at' => $this->created_at, 'updated_by' => $this->updated_by, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'comentario', $this->comentario])->andFilterWhere(['like', 'model', $this->model]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: _formajax.php プロジェクト: ibergonzi/country
    <?php 
echo $form->field($model, 'comentario')->textArea(['maxlength' => true]);
?>


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

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

    <?php 
$models = Comentarios::find()->where(['model' => $modelNameOrigen, 'model_id' => $modelIDOrigen])->orderBy(['created_at' => SORT_DESC])->all();
$primeraVez = true;
foreach ($models as $m) {
    if ($primeraVez) {
        echo '<hr/>';
        echo '<p>Cantidad de comentarios ' . kartik\helpers\Html::badge(count($models)) . '</p>';
        $primeraVez = false;
    }
    echo DetailView::widget(['model' => $m, 'options' => ['class' => 'table table-striped table-bordered table-condensed detail-view'], 'attributes' => ['comentario', 'userCreatedBy.username', 'created_at:datetime']]);
    echo '<hr/>';
}
?>

</div>
コード例 #3
0
ファイル: view.php プロジェクト: ibergonzi/country
    <?php 
echo DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-striped table-bordered table-condensed detail-view'], 'attributes' => ['id', 'ing_fecha:date', 'ing_hora:time', ['attribute' => 'id_persona', 'format' => 'raw', 'value' => Html::a($model->id_persona, Yii::$app->urlManager->createUrl(['personas/view', 'id' => $model->id_persona]), ['title' => 'Ver detalle de persona', 'target' => '_blank', 'data-pjax' => '0'])], 'persona.apellido', 'persona.nombre', 'persona.nombre2', 'persona.tipoDoc.desc_tipo_doc_abr', 'persona.nro_doc', ['attribute' => 'ing_id_vehiculo', 'format' => 'raw', 'value' => Html::a($model->ing_id_vehiculo, Yii::$app->urlManager->createUrl(['vehiculos/view', 'id' => $model->ing_id_vehiculo]), ['title' => 'Ver detalle del vehiculo', 'target' => '_blank', 'data-pjax' => '0'])], 'ingVehiculo.patente', 'ingVehiculo.marca', 'ingVehiculo.modelo', 'ingVehiculo.color', 'ing_id_porton', 'userIngreso.username', 'accesosConcepto.concepto', 'motivo', 'egr_fecha:date', 'egr_hora:time', ['attribute' => 'egr_id_vehiculo', 'format' => 'raw', 'value' => Html::a($model->egr_id_vehiculo, Yii::$app->urlManager->createUrl(['vehiculos/view', 'id' => $model->egr_id_vehiculo]), ['title' => 'Ver detalle del vehiculo', 'target' => '_blank', 'data-pjax' => '0'])], 'egrVehiculo.patente', 'egrVehiculo.marca', 'egrVehiculo.modelo', 'egrVehiculo.color', 'egr_id_porton', 'userEgreso.username', 'control', 'userCreatedBy.username', 'created_at:datetime', 'userUpdatedBy.username', 'updated_at:datetime', ['label' => 'Estado', 'value' => Accesos::getEstados($model->estado)], 'motivo_baja']]);
?>

    <?php 
$aut = AccesosAutorizantes::findAll(['id_acceso' => $model->id]);
$primeraVez = true;
foreach ($aut as $a) {
    if ($primeraVez) {
        //echo '<hr/>';
        echo '<p>Cantidad de autorizantes/unidades ' . kartik\helpers\Html::badge(count($aut)) . '</p>';
        $primeraVez = false;
    }
    echo DetailView::widget(['model' => $a, 'options' => ['class' => 'table table-striped table-bordered table-condensed detail-view'], 'attributes' => [['attribute' => 'id_persona', 'format' => 'raw', 'value' => Html::a($a->id_persona, Yii::$app->urlManager->createUrl(['personas/view', 'id' => $a->id_persona]), ['title' => 'Ver detalle de persona', 'target' => '_blank', 'data-pjax' => '0'])], 'persona.apellido', 'persona.nombre', 'persona.nombre2', 'id_uf']]);
}
?>
    <?php 
$models = Comentarios::find()->where(['model' => 'frontend\\models\\Accesos', 'model_id' => $model->id])->orderBy(['created_at' => SORT_DESC])->all();
$primeraVez = true;
foreach ($models as $m) {
    if ($primeraVez) {
        //echo '<hr/>';
        echo '<p>Cantidad de comentarios ' . kartik\helpers\Html::badge(count($models)) . '</p>';
        $primeraVez = false;
    }
    echo DetailView::widget(['model' => $m, 'options' => ['class' => 'table table-striped table-bordered table-condensed detail-view'], 'attributes' => ['comentario', 'userCreatedBy.username', 'created_at:datetime']]);
    echo '<hr/>';
}
?>
</div>