Exemplo n.º 1
0
    $model->parent_id = $id;
}
$parentIds = ArrayHelper::merge(['0' => Yii::t('cms', 'Top Column')], ArrayHelper::map(General::recursiveObj(Column::find()->orderBy(['order' => SORT_ASC])->all()), 'id', 'name'));
?>

<div class="row cms-class-form">
    <div class="col-md-12">
        <?php 
//广泛布局
$form = ActiveForm::begin(['layout' => 'horizontal', 'fieldConfig' => ['template' => "{label} {beginWrapper} {input} {hint} {error} {endWrapper}", 'horizontalCssClasses' => ['label' => 'col-sm-2', 'offset' => 'col-sm-offset-2', 'wrapper' => 'col-sm-8', 'error' => '', 'hint' => '']]]);
?>
        
        <?php 
if ($model->isNewRecord) {
    $model->type = Column::CMS_TYPE_PAGE;
    echo $form->field($model, 'type')->dropDownList(ArrayHelper::merge(Column::getType(), [Column::CMS_TYPE_STRUCT => Yii::t('cms', 'Struct')]));
    echo $form->field($model, 'short_code')->hint('<i class="fa fa-info-circle"></i> ' . Yii::t('cms', 'Used for the frontend call.'))->textInput(['maxlength' => true]);
}
?>
        
        <?php 
echo $form->field($model, 'parent_id')->dropDownList($parentIds);
?>
		
        <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
    
        <?php 
echo $form->field($model, 'keywords')->textInput(['maxlength' => true]);
?>
Exemplo n.º 2
0
               </li>
               <li class="active">
                   <?php 
echo Html::a(Yii::t('common', 'View'), 'javascript:;');
?>
               </li>
            </ul>
           
            <div class="tab-content clearfix">
                <div class="tab-pane active cms-class-view">
		            <p>
		                <?php 
echo Html::a(Yii::t('cms', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
		                <?php 
echo Html::a(Yii::t('cms', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('cms', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
		            </p>
		        
		            <?php 
echo DetailView::widget(['model' => $model, 'options' => ['class' => 'table table-hover table-striped table-bordered detail-view'], 'attributes' => ['id', ['attribute' => 'type', 'value' => empty(Column::getType()[$model->type]) ? 'Null' : Column::getType()[$model->type]], ['attribute' => 'parent_id', 'value' => empty($model->mySelf) ? Yii::t('cms', 'Top Column') : $model->mySelf->name], 'name', 'description', 'link_url:url', 'pic_url:url', 'pic_width', 'pic_height', 'seo_title', 'keywords', 'order', ['attribute' => 'status', 'value' => $model->status ? Yii::t('common', 'Yes') : Yii::t('common', 'No')]]]);
?>
                </div>
            </div>
            
        </div>
    </div>
</div>


Exemplo n.º 3
0
            <div class="tab-content clearfix">
                <div class="tab-pane active cms-class-index">
                
                    <!-- 
                        <p>
                            <?php 
echo Html::a(Yii::t('cms', 'Create Column'), ['create'], ['class' => 'btn btn-success']);
?>
                        </p>
                     -->
            		<?php 
//Pjax::begin()
?>
					<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'options' => ['class' => 'grid-view box-body table-responsive no-padding'], 'tableOptions' => ['class' => 'table table-hover table-striped table-bordered'], 'headerRowOptions' => [], 'footerRowOptions' => [], 'showHeader' => true, 'showFooter' => false, 'layout' => "{summary}\n{errors}\n{items}\n{pager}", 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'name', 'format' => 'html', 'value' => function ($model) {
    $type = !empty(Column::getType()[$model->type]) ? Column::getType()[$model->type] : Yii::t('cms', 'Null');
    $className = empty(Column::getRelativeClass()[$model->type]) ? '' : Column::getRelativeClass()[$model->type];
    $name = $model->name;
    if ($className) {
        $name = Html::a($name, ['/cms/' . strtolower(str_replace('Cms', 'cms-', $className)) . '/index', $className . 'Search[column_id]' => $model->id], ['data-pjax' => '0']);
    }
    return $name . '<i class="type">[' . $type . ']</i>';
}], ['attribute' => 'order', 'format' => 'raw', 'value' => function ($model) {
    return Html::activeTextInput($model, 'order', ['style' => 'width:50px', 'data-id' => $model->id, 'id' => '', 'class' => 'cms-order']);
}], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    $on = Html::a('<small class="label bg-green">' . Yii::t('common', 'Yes') . '</small>', ['switch-status', 'id' => $model->id], ['title' => Yii::t('cms', 'Update Status'), 'data-pjax' => '0']);
    $off = Html::a('<small class="label bg-red">' . Yii::t('common', 'No') . '</small>', ['switch-status', 'id' => $model->id], ['title' => Yii::t('cms', 'Update Status'), 'data-pjax' => '0']);
    return $model->status ? $on : $off;
}], 'created_at:datetime', ['class' => 'yii\\grid\\ActionColumn', 'header' => Yii::t('common', 'Opration'), 'template' => '{add} {update} {delete}', 'buttons' => ['add' => function ($url, $model, $key) {
    $url = ['create', 'id' => $model->id];
    $options = ['title' => Yii::t('cms', 'Add Column'), 'aria-label' => Yii::t('cms', 'Add New Column'), 'data-pjax' => '0'];