コード例 #1
0
ファイル: index.php プロジェクト: ibergonzi/country
$this->registerCss('
.kv-grid-loading {
    opacity: 0.5;
    background: #ffffff url("../images/loading.gif") top center no-repeat !important;
}
');
?>
<div class="cortes-energia-gen-index">

    <h3><?php 
echo Html::encode($this->title . ' ' . Yii::$app->formatter->asDatetime($parent->hora_desde) . ' - ' . Yii::$app->formatter->asTime($parent->hora_hasta));
?>
    </h3>
    <?php 
$columns = [['attribute' => 'descripcion', 'value' => 'generador.descripcion'], ['attribute' => 'hora_desde', 'format' => ['datetime']], ['attribute' => 'hora_hasta', 'format' => ['datetime']], ['attribute' => 'estado', 'value' => function ($data) {
    return CortesEnergiaGen::getEstados($data->estado);
}], 'motivo_baja', ['class' => 'kartik\\grid\\ActionColumn', 'header' => Html::a('<span class="glyphicon glyphicon-plus-sign"></span>', ['create', 'idParent' => $parent->id], ['class' => 'btn-sm btn-primary', 'title' => 'Alta de novedad']), '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) {
コード例 #2
0
ファイル: view.php プロジェクト: ibergonzi/country
$this->title = 'Novedad de generador';
$this->params['breadcrumbs'][] = ['label' => 'Cortes de energía', 'url' => ['cortes-energia/index']];
$this->params['breadcrumbs'][] = ['label' => 'Novedades de generadores', 'url' => ['cortes-energia-gen/index', 'idParent' => $parent->id]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="cortes-energia-gen-view">

    <h3><?php 
echo Html::encode($this->title . ' ' . Yii::$app->formatter->asDatetime($parent->hora_desde) . ' - ' . Yii::$app->formatter->asTime($parent->hora_hasta));
?>
</h3>

	<?php 
if ($model->estado == CortesEnergiaGen::ESTADO_ACTIVO) {
    echo '<p>';
    if (\Yii::$app->user->can('modificarCorte')) {
        echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
    }
    if (\Yii::$app->user->can('borrarCorte')) {
        echo ' ' . Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger']);
    }
    echo '</p>';
}
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['generador.descripcion', 'hora_desde:datetime', 'hora_hasta:datetime', 'userCreatedBy.username', 'created_at:datetime', 'userUpdatedBy.username', 'updated_at:datetime', ['label' => 'Estado', 'value' => CortesEnergiaGen::getEstados($model->estado)], 'motivo_baja']]);
?>

</div>