/**
  * Lists all ProyectoAccionEspecifica models.
  * @return mixed
  */
 public function actionIndex($proyecto)
 {
     $searchModel = new ProyectoAccionEspecificaSearch(['id_proyecto' => $proyecto]);
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $html = $this->renderAjax('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     return Json::encode($html);
     //return $html;
 }
Beispiel #2
0
/**
 * Respuesta AJAX al recargar el contenedor
 * de Acciones Especificas
 */
use common\models\ProyectoAccionEspecificaSearch;
use yii\helpers\Html;
use yii\helpers\StringHelper;
use yii\widgets\Pjax;
use yii\helpers\Url;
use yii\bootstrap\Modal;
use kartik\grid\GridView;
use kartik\date\DatePicker;
use johnitvn\ajaxcrud\CrudAsset;
use johnitvn\ajaxcrud\BulkButtonWidget;
$searchModel = new ProyectoAccionEspecificaSearch(['id_proyecto' => $model->id]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
//Iconos
$icons = ['nuevo' => '<span class="glyphicon glyphicon-file" aria-hidden="true"></span>', 'crear' => '<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>', 'editar' => '<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>', 'eliminar' => '<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>'];
echo GridView::widget(['id' => 'especifica', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['options' => ['id' => 'especifica-pjax']], 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn', 'width' => '20px'], ['class' => 'kartik\\grid\\SerialColumn', 'width' => '30px'], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'codigo_accion_especifica'], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'nombre', 'value' => function ($model) {
    //Cortar el nombre
    return StringHelper::truncateWords($model->nombre, 10);
}], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'nombreUnidadEjecutora', 'value' => function ($model) {
    //Cortar el nombre de la UE
    return StringHelper::truncateWords($model->nombreUnidadEjecutora, 6);
}], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'fecha_inicio', 'value' => function ($model) {
    return date('d/m/Y', strtotime($model->fecha_inicio));
}, 'filterType' => '\\kartik\\date\\DatePicker', 'filterWidgetOptions' => ['readonly' => true, 'pluginOptions' => ['todayHighlight' => false, 'todayBtn' => true, 'format' => 'yyyy-mm-dd', 'autoclose' => true]]], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'fecha_fin', 'value' => function ($model) {
    return date('d/m/Y', strtotime($model->fecha_fin));
}, 'filterType' => '\\kartik\\date\\DatePicker', 'filterWidgetOptions' => ['readonly' => true, 'pluginOptions' => ['todayHighlight' => false, 'todayBtn' => true, 'format' => 'yyyy-mm-dd', 'autoclose' => true]]], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'urlCreator' => function ($action, $model, $key, $index) {
    return Url::to(['proyecto-accion-especifica/' . $action, 'id' => $key]);
}, 'viewOptions' => ['role' => 'modal-remote', 'title' => 'View', 'data-toggle' => 'tooltip'], 'updateOptions' => ['role' => 'modal-remote', 'title' => 'Update', 'data-toggle' => 'tooltip'], 'deleteOptions' => ['role' => 'modal-remote', 'title' => 'Delete', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-toggle' => 'tooltip', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item', 'class' => 'text-danger'], 'template' => '{view} {update} {prg} {delete}', 'buttons' => ['prg' => function ($model, $key, $index) {