Beispiel #1
0
/* @var $form yii\widgets\ActiveForm */
?>

<div class="test-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
?>


            <div class="row">
        <div class="col-md-6">
        <?php 
$plugins = ["options" => ["accept" => "image/*"]];
if ($model->image) {
    $plugins = ["options" => ["accept" => "image/*"], "pluginOptions" => ["initialPreview" => [kartik\helpers\Html::img($model->thumbnailTrue, ["class" => "file-preview-image"])]]];
}
echo $form->field($model, "image")->widget(FileInput::classname(), $plugins);
?>
        </div>

        <div class="col-md-6">
        
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
echo $form->field($model, "description")->widget(CKEditor::className(), ["editorOptions" => ["preset" => "full", "inline" => false]]);
?>
        </div>

    </div>
Beispiel #2
0
    <?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>
    }
    if ($container->type->name == ContainerType::CONTENT_CONTAINER) {
        if ($enableUpdate) {
            ContentTools::begin(['id' => $container->id]);
        }
        if ($enableUpdate || $is_published) {
            echo '<p>';
            echo $container->contentContainer->data;
            echo '</p>';
        }
        if ($enableUpdate) {
            ContentTools::end();
        }
    }
    if ($enableUpdate) {
        echo Html::a(Yii::t('app', $is_published ? kartik\helpers\Html::icon('eye-close') : kartik\helpers\Html::icon('eye-open')), ['/' . $context . '/toggle-publish-container', 'id' => $container->id, 'sector' => $sector->id], ['class' => 'btn btn-' . ($is_published ? 'danger' : 'success'), 'data' => ['method' => 'post']]);
        echo ' ';
        echo Html::a(kartik\helpers\Html::icon('trash'), ['/' . $context . '/delete-container', 'id' => $container->id, 'sector' => $sector->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this container?'), 'data-method' => 'post']]);
    }
    echo '</li>';
}
echo '</ul>';
/*
echo Sortable::widget([
    'items' => [
    ],
    'options' => ['tag' => 'ul'],
    'itemOptions' => ['tag' => 'li'],
    'clientOptions' => ['cursor' => 'move'],
]);
*/