Пример #1
0
 public function actionIndex($id = null, $action = null)
 {
     $model = new Slider();
     if ($model->load($_POST)) {
         $sess = array();
         $sess['langs'] = $_POST['Slider']['langs'];
         $sess['cid'] = $_POST['Slider']['cid'];
         Yii::$app->session->set('sessSlider', $sess);
     }
     $sess = Yii::$app->session->get('sessSlider');
     $model->langs = $sess['langs'];
     if (!$model->langs) {
         $model->langs = 'thai';
     }
     if (!$model->cid) {
         $model->cid = 1;
     } else {
         $model->cid = $sess['cid'];
     }
     $type = new \app\models\TblSlidertype();
     if ($type->load(Yii::$app->request->post())) {
         if (!$type->save()) {
             throw new \ErrorException($model->getErrors());
         }
     }
     switch ($action) {
         case 'published':
             $this->actionPublished($id);
             break;
         case 'order':
             $this->actionOrder($id, $_REQUEST['ordering'], $_REQUEST['direction']);
             break;
         case 'typedelete':
             $this->typedelete($id);
             break;
     }
     return $this->render('index', ['model' => $model, 'type' => $type]);
 }
Пример #2
0
            <div class="form-group pull-right">
                <?php 
echo Html::submitButton('<i class="glyphicon glyphicon-ok"></i> บันทึก', ['class' => 'btn btn-danger']);
?>
                <?php 
echo Html::resetButton('<i class="glyphicon glyphicon-remove"></i> ยกเลิก', ['class' => 'btn']);
?>
            </div>
        </div>
    </div>
    <br/>
    <div class="dashboard_box" style="padding-top: 15px;">
        <div class="row">
            <div class="col-sm-8">
                <?php 
echo $form->field($model, 'cid')->dropDownList(app\models\TblSlidertype::makeDropDown(), ['style' => 'width:200px; max-width: 400px;']);
?>

                <?php 
echo $form->field($model, 'upload_files')->widget(FileInput::classname(), ['options' => ['multiple' => false], 'pluginOptions' => ['showUpload' => false, 'showPreview' => true, 'showCaption' => false, 'uploadClass' => 'btn btn-info', 'removeClass' => 'btn btn-danger', 'elCaptionText' => '#customCaption', 'initialPreview' => [Html::img("{$model->slider_Url}", ['class' => 'file-preview-image', 'alt' => '', 'title' => ''])]]]);
echo "ขนาดภาพ Slide: 1,263*520 px<br/>ขนาดภาพ Event: 800*600px<br/><br/>";
//echo $form->field($model, 'target')->input('checkbox', ['style' => 'width: 400px;']);
echo $form->field($model, 'id', ['options' => ['class' => 'sr-only']])->hiddenInput();
echo $form->field($model, 'langs', ['options' => ['class' => 'sr-only']])->hiddenInput();
?>
            </div>
            <div class="col-sm-4">
                <?php 
echo $form->field($model, 'title')->input('text');
?>
                <?php 
Пример #3
0
" data-dismiss="modal" class="btn btn-default">ปิด</a>
                        </div>

                        <?php 
ActiveForm::end();
Pjax::end();
Modal::end();
?>
                        <?php 
$form = ActiveForm::begin(['id' => 'menus-form', 'options' => ['class' => 'form-inline pull-right'], 'fieldConfig' => ['template' => "{label}{input}&nbsp;", 'labelOptions' => ['class' => 'sr-only']]]);
?>

                        <?php 
echo $form->field($model, 'langs')->dropDownList(\app\models\tblLangs::makeDropDown(), ['style' => 'width: 150px;', 'onchange' => 'form.submit();']);
echo "&nbsp;";
echo $form->field($model, 'cid')->dropDownList(app\models\TblSlidertype::makeDropDown(), ['onchange' => 'form.submit();']);
?>

                        <?php 
ActiveForm::end();
?>
                    </div>
                </div><br/>
                <?php 
Pjax::begin();
echo GridView::widget(['dataProvider' => $model->search(), 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'headerOptions' => ['width' => '5%']], ['headerOptions' => ['width' => '60%'], 'header' => '', 'format' => 'raw', 'value' => function ($model) {
    return '<img src="' . $model->slider_Url . '" width="100%"/>';
}], ['headerOptions' => ['width' => '16%'], 'header' => 'การเชื่อมโยง', 'attribute' => 'link_Url'], ['headerOptions' => ['width' => '5%', 'style' => 'text-align:center;'], 'contentOptions' => ['align' => 'center'], 'class' => 'yii\\grid\\CMSColumn', 'template' => '{published}', 'header' => 'แสดง'], ['headerOptions' => ['width' => '7%', 'style' => 'text-align:center;'], 'contentOptions' => ['align' => 'center'], 'class' => 'yii\\grid\\CMSColumn', 'template' => '{up} {down}', 'header' => 'เรียง'], ['headerOptions' => ['width' => '7%', 'style' => 'text-align:center;'], 'contentOptions' => ['align' => 'center'], 'class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'header' => 'แก้ไข']]]);
Pjax::end();
?>