예제 #1
2
//index view
$viewId = Yii::$app->request->get('view_id');
if (!isset($viewId)) {
    ?>
    <button type="button" class="btn btn-primary btn-lg" onclick="javascript: $('#address').toggle()">新建收货地址</button>
<?php 
}
?>


<div id="address"  style="display: <?php 
echo isset($viewId) ? 'block' : 'none';
?>
">
    <?php 
$form = \kartik\form\ActiveForm::begin();
/* @var \yincart\customer\models\CustomerAddress $model */
echo $form->field($model, 'province')->dropDownList($catList, ['id' => 'cat-id']);
// Child # 1
echo $form->field($model, 'city')->widget(DepDrop::classname(), ['data' => [$model->city => isset($model->cityArea) ? $model->cityArea->name : ''], 'options' => ['id' => 'subcat-id'], 'pluginOptions' => ['depends' => ['cat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/customer/get-cities'])]]);
// Child # 2
echo $form->field($model, 'district')->widget(DepDrop::classname(), ['data' => [$model->district => isset($model->districtArea) ? $model->districtArea->name : ''], 'pluginOptions' => ['depends' => ['cat-id', 'subcat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/customer/get-district'])]]);
?>

    <?php 
echo $form->field($model, 'address')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'zip_code')->textInput(['maxlength' => 255]);
?>
예제 #2
1
<?
/**
 * @var $model Registration
 * @var $invoice Invoice
 */

use common\models\Registration;
use common\models\Invoice;
use kartik\form\ActiveForm;
use vova07\imperavi\Widget;
use kartik\helpers\Html;

?>

<?php 
$form = ActiveForm::begin(['id' => 'credit-note-form', 'action' => Yii::$app->urlManager->createUrl(['/registration/create-credit-note/', 'code' => $model->code]), 'options' => ['target' => '_blank']]);
?>

    <div class="row">
        <div class="col-md-12">
            <?php 
echo $form->field($invoice, 'newAmount')->textInput();
?>

            <?php 
echo Html::label('Subject', 'Invoice[subject]');
?>
            <?php 
echo Widget::widget(['name' => 'Invoice[subject]', 'value' => $invoice->subject, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]);
?>
예제 #3
0
 /**
  * @inheritdoc
  * */
 public function actionUpdate($id = null)
 {
     if ($id) {
         $modelObject = $this->findRecordModel($id);
     } else {
         $modelObject = Yii::createObject($this->model);
     }
     /** @var \nagser\gallery\models\GalleryRecord $modelObject * */
     if (\Yii::$app->request->isAjax) {
         if ($modelObject->load(\Yii::$app->request->post())) {
             \Yii::$app->response->format = Response::FORMAT_JSON;
             return ActiveForm::validate($modelObject);
         } else {
             return $this->renderAjax('update', ['model' => $modelObject]);
         }
     } else {
         if (Yii::$app->request->isPost) {
             $modelObject->file = Yii::$app->gallery->upload($modelObject);
             if ($modelObject->upload() and $modelObject->scenario = 'save' and $modelObject->load(\Yii::$app->request->post()) and $modelObject->save()) {
                 $this->redirect(Url::to(['view', 'id' => $modelObject->id]));
             }
         }
         return $this->render('update', ['model' => $modelObject]);
     }
 }
예제 #4
0
 public function actionCopy($id)
 {
     $model = \Yii::createObject($this->model);
     /** @var ThemesRecord $model **/
     $model = $model->findRecordModel($id);
     if (\Yii::$app->request->isAjax) {
         if ($model->load(\Yii::$app->request->post())) {
             \Yii::$app->response->format = Response::FORMAT_JSON;
             return ActiveForm::validate($model);
         } else {
             return $this->renderAjax('copy', ['model' => $model]);
         }
     } else {
         if ($model->load(\Yii::$app->request->post())) {
             $model->copy($id);
             $this->redirect(Url::to(['view', 'id' => $model->dir]));
         }
     }
 }
예제 #5
0
?>
</h1>
<div class="cart">
<?php 
if (!is_null($model) && $model->items_count > 0) {
    ?>
    <?php 
    echo $this->render('items', ['model' => $model, 'items' => $model->items]);
    ?>
    <div class="pull-right">
        <div class="discount-code">
        <?php 
    if ($orderCode->isNewRecord) {
        ?>
            <?php 
        $form = \kartik\form\ActiveForm::begin(['type' => \kartik\form\ActiveForm::TYPE_INLINE]);
        ?>
            <?php 
        echo $form->errorSummary($orderCode);
        ?>
            <?php 
        echo $form->field($orderCode, 'code');
        ?>
            <?php 
        echo \kartik\helpers\Html::submitButton(Yii::t('app', 'Apply code'), ['class' => 'btn btn-success']);
        ?>
            <?php 
        echo \kartik\helpers\Html::endForm();
        ?>
        <?php 
    } else {
예제 #6
0
/* @var $this yii\web\View */
/* @var $model backend\modules\aitk\models\AitkRequest */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="aitk-request-form">
    <style>
        #dataMahasiswa {
            display: none;
            position: relative;
        }
    </style>


    <?php 
$form = ActiveForm::begin(['id' => 'form-request']);
?>
    <!--
        <script>
            function handleMatakuliah(nama) {
    
                var name = nama.split(" ")[0];
    
                $('#ck' + name).click(function () {
                    $("." + name).remove();
                    $('.detailMatakuliah:first').clone().insertAfter(".detailMatakuliah").prop({class: name, id: name, style: "display:block"});
                    $(".control-label").prop("id", "lbl"+name);
                    if ($("#ck" + name).is(":checked")) {
                        $(".detailMatakuliah").hide();
                        
                        $("." + name).show();
예제 #7
0
    /**
     * @inheritdoc
     */
    public function run()
    {
        if (empty($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }
        if (!isset($this->formOptions['type'])) {
            $this->formOptions['type'] = ActiveForm::TYPE_VERTICAL;
        }
        if (!isset($this->formOptions['fieldConfig'])) {
            $this->formOptions['fieldConfig'] = ['autoPlaceholder' => true];
        }
        if (!isset($this->template)) {
            $this->template = "<legend>{$this->title}</legend>\n{fields}\n{footer}";
        }
        if (!isset($this->footerTemplate)) {
            $this->footerTemplate = <<<HTML
<div class="row">
    <div class="col-sm-6 text-left">
        {left}
    </div>
    <div class="col-sm-6 text-right">
        {right}
    </div>
</div>
HTML;
        }
        $this->_form = ActiveForm::begin($this->formOptions);
        $options = ['model' => $this->model, 'form' => $this->_form, 'attributes' => $this->attributes] + $this->options;
        echo strtr($this->template, ['{fields}' => Form::widget($options), '{footer}' => $this->renderFooter()]);
        ActiveForm::end();
    }
예제 #8
0
<?php

use backend\models\Category;
use backend\models\News;
use kartik\select2\Select2;
use yii\bootstrap\Html;
use yii\helpers\ArrayHelper;
use yii\web\JsExpression;
$form = \kartik\form\ActiveForm::begin(['type' => \kartik\form\ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-rss-form', 'action' => empty($action) ? $model->isNew ? '/rss/add-feed' : '/rss/edit-feed/' . $model->id : $action, 'options' => ['data-pjax' => true, 'class' => 'editRssForm']]);
?>
    <div class="modal-body">
        <?php 
if (\Yii::$app->session->getFlash('saved', false)) {
    echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]);
} else {
    if (\Yii::$app->session->getFlash('error', false)) {
        echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]);
    }
}
echo $form->field($model, 'name'), $form->field($model, 'description')->textarea(), $form->field($model, 'categories')->widget(Select2::className(), ['options' => ['multiple' => true], 'data' => !$model->isNew ? ArrayHelper::map(Category::find()->select('id, title')->where(['deleted' => 0])->andWhere(['in', 'id', $model->categories])->asArray()->all(), 'id', 'title') : [], 'pluginOptions' => ['ajax' => ['url' => '/categories/get-list', 'data-type' => 'json', 'data' => new JsExpression("function(params){ return {q:params.term} }")]]]), $form->field($model, 'articles')->widget(Select2::className(), ['options' => ['multiple' => true], 'data' => !$model->isNew ? ArrayHelper::map(News::find()->select('id, title')->where(['deleted' => 0])->andWhere(['in', 'id', $model->articles])->asArray()->all(), 'id', 'title') : [], 'pluginOptions' => ['ajax' => ['url' => '/news/get-list', 'data-type' => 'json', 'data' => new JsExpression('function(params){ var data = {q:params.term}, categories = $("#newsfeedform-categories").val(); if(categories !== null && categories.length > 0){ data.excludedCategories = categories;} return data; }')]]]), $form->field($model, 'published')->checkbox([], false), $form->field($model, 'id', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false);
?>
    </div>
    <div class="modal-footer">
        <?php 
if (\Yii::$app->request->isAjax) {
    ?>
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Закрыть</button><?php 
}
?>
        <?php 
echo Html::tag('div', Html::button($model->isNew ? 'Добавить ленту' : 'Сохранить изменения', ['class' => 'btn btn-success', 'type' => 'submit']), ['class' => 'text-center']);
예제 #9
0
/* @var $this yii\web\View */
/* @var $model backend\modules\aitk\models\AitkRequest */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="aitk-request-form">
    <style>
        #dataMahasiswa {
            display: none;
            position: relative;
        }
    </style>


    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data'], 'id' => 'form-request']);
?>
    <!--
        <script>
            function handleMatakuliah(nama) {
    
                var name = nama.split(" ")[0];
    
                $('#ck' + name).click(function () {
                    $("." + name).remove();
                    $('.detailMatakuliah:first').clone().insertAfter(".detailMatakuliah").prop({class: name, id: name, style: "display:block"});
                    $(".control-label").prop("id", "lbl"+name);
                    if ($("#ck" + name).is(":checked")) {
                        $(".detailMatakuliah").hide();
                        
                        $("." + name).show();
예제 #10
0
<?php

/** @var \backend\modules\quiz\models\QuizForm $model */
use kartik\form\ActiveForm;
use rmrevin\yii\fontawesome\FA;
use yii\bootstrap\Html;
$js = <<<'JS'
$('#quizAnswersList').addInputArea();

$("body").on('inputArea.added inputArea.removed', "#quizAnswersList", function(){
    $("#quizAnswersList .quizAnswersList_del")
});
JS;
$this->registerJsFile('/js/addInputArea.js', ['depends' => 'yii\\web\\JqueryAsset']);
$this->registerJs($js);
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-quiz-form', 'options' => ['data-pjax' => true, 'class' => 'editQuizForm']]);
echo $form->field($model, 'name');
?>
    <div id="quizAnswersList">
        <?php 
foreach ($model->answers as $key => $answer) {
    echo \yii\helpers\Html::tag('div', $form->field($answer, 'text', ['inputOptions' => ['name_format' => 'QuizAnswerForm[%d][text]'], 'addon' => ['append' => ['content' => Html::button(FA::icon('times'), ['class' => 'quizAnswersList_del btn btn-danger btn-sm', 'style' => 'height: 34px; width: 34px;']), 'asButton' => true]]]) . (!empty($answer->id) ? $form->field($answer, 'id', ['inputOptions' => ['name' => "QuizAnswerForm[{$key}][id]", 'name_format' => 'QuizAnswerForm[%d][id]']])->hiddenInput()->label(false) : ''), ['class' => 'quizAnswersList_var']);
}
?>
    </div>
<?php 
echo Html::button(FA::icon('plus') . ' Добавить', ['class' => 'quizAnswersList_add btn btn-success btn-sm', 'style' => 'margin: 0px auto; display: block;']) . Html::tag('br'), $form->field($model, 'dateStart')->widget(\kartik\datetime\DateTimePicker::className(), ['pluginOptions' => []]), $form->field($model, 'dateEnd')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'published')->checkbox([], false), $form->field($model, 'deleted')->checkbox([], false), Html::tag('div', Html::button('Сохранить', ['class' => 'btn btn-success btn-lg', 'type' => 'submit']), ['class' => 'text-center']);
$form->end();
예제 #11
0
            <?php 
echo Html::submitButton(Yii::t('setup', 'Test connection'), ['class' => 'btn btn-default pull-left', 'name' => 'test']);
?>
            <?php 
if ($connectionOk) {
    ?>
                <?php 
    echo Html::submitButton(Yii::t('setup', 'Save and continue'), ['class' => 'btn btn-primary pull-right', 'name' => 'save']);
    ?>
            <?php 
}
?>
        </div>

        <?php 
ActiveForm::end();
?>
    </div>
</div>

<?php 
$advancedOptions = Yii::t('setup', 'Advanced options');
$js = <<<JS
    \$(document).ready(function(){

        \$("#advancedOptions").hide();
        \$('#toogleAdvancedOptions').click(function( e ){
            e.preventDefault(); // If you use anchors
            var SH = this.SH^=1; // "Simple toggler"
            \$(this).html(SH?'&#9660; {$advancedOptions}':'&#9654; {$advancedOptions}')
                   .css({backgroundPosition:'0 '+ (SH?-18:0) +'px'})
예제 #12
0
.condition-contain,.condition-key,.condition-val{
    width: 200px;
}
.condition-val{
    height: 28px;
}
.form-group{
    margin-top: 10px;
}

CSS;
$this->registerCss($css);
?>

<?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_INLINE, 'id' => 'sms_config_set']);
?>
<div class="sms-config-form">
    <div class="panel panel-default">
        <div class="panel-heading">接收用户</div>
        <div class="panel-body">
            <?php 
echo $form->field($model, "receiverSelect")->widget(Select2::className(), ["data" => $users, 'options' => ['placeholder' => '选择接收用户'], 'pluginOptions' => ['allowClear' => true, 'multiple' => true]]);
?>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">消息模版</div>
        <div class="panel-body">
            <?php 
echo $form->field($model, "smsTemplate_id")->widget(Select2::className(), ["data" => $templates, 'options' => ['placeholder' => '选择消息模版'], 'pluginOptions' => ['allowClear' => true]]);
예제 #13
0
<?php

/* @var $this yii\web\View */
/* @var $form yii\widgets\ActiveForm */
/* @var $generator \infinitydevphp\gii\crud\Generator */
use infinitydevphp\gii\assets\CrudGeneratorAssets;
use kartik\form\ActiveForm;
use infinitydevphp\gii\models\WidgetsCrud;
use infinitydevphp\MultipleModelValidator\widgets\MultipleInput;
use kartik\widgets\Select2;
CrudGeneratorAssets::register($this);
$form = ActiveForm::begin();
echo $form->field($generator, 'modelClass')->textInput(['id' => 'model-class']);
echo $form->field($generator, 'searchModelClass');
echo $form->field($generator, 'controllerClass');
echo $form->field($generator, 'baseControllerFrontendClass');
echo $form->field($generator, 'baseControllerBackendClass');
//echo $form->field($generator, 'moduleID');
echo $form->field($generator, 'indexWidgetType')->dropDownList(['grid' => 'GridView', 'list' => 'ListView']);
echo $form->field($generator, 'columns')->widget(MultipleInput::className(), ['attributeOptions' => ['enableAjaxValidation' => false, 'enableClientValidation' => true, 'validateOnChange' => true, 'validateOnSubmit' => true, 'validateOnBlur' => true], 'data' => $generator->columns, 'baseModel' => WidgetsCrud::className(), 'columns' => [['name' => 'fieldName', 'enableError' => true, 'title' => 'Length'], ['name' => 'widgetType', 'type' => Select2::className(), 'options' => ['data' => $generator->getWidgets()], 'title' => 'Widget Type']]]);
echo $form->field($generator, 'enableI18N')->checkbox();
echo $form->field($generator, 'messageCategory');
$form->end();
예제 #14
0
파일: arrivals.php 프로젝트: bth2008/rferu
    <?php 
if (!Yii::$app->user->isGuest && Yii::$app->user->identity->isadmin) {
    ?>
    <div class="row">
        <?php 
    $form = \kartik\form\ActiveForm::begin(['type' => 'inline']);
    echo $form->field($model, 'airline')->textInput(['style' => 'width: 100px;']);
    echo $form->field($model, 'flightnumber')->textInput(['style' => 'width: 100px;']);
    echo $form->field($model, 'gate')->textInput(['style' => 'width: 100px;']);
    echo $form->field($model, 'aircraft')->textInput(['style' => 'width: 100px;']);
    echo $form->field($model, 'icaofrom')->textInput(['style' => 'width: 100px;', 'readonly' => !$model->isarrival]);
    echo $form->field($model, 'icaoto')->textInput(['style' => 'width: 100px;', 'readonly' => $model->isarrival == 1]);
    echo $form->field($model, 'timefrom')->widget(\kartik\widgets\TimePicker::className(), ['pluginOptions' => ['showMeridian' => false], 'options' => ['style' => 'width: 100px;']]);
    echo $form->field($model, 'timeto')->widget(\kartik\widgets\TimePicker::className(), ['pluginOptions' => ['showMeridian' => false], 'options' => ['style' => 'width: 100px;']]);
    echo \yii\bootstrap\Html::submitButton('<i class="fa fa-check"></i>Add', ['class' => 'btn btn-success btn-sm']);
    \kartik\form\ActiveForm::end();
    ?>
        <hr />
        <form method="post" class="form-horizontal" enctype="multipart/form-data">
            <div class="form-group field-batch-loading">
                <input id="form-token" type="hidden" name="<?php 
    echo Yii::$app->request->csrfParam;
    ?>
"
                       value="<?php 
    echo Yii::$app->request->csrfToken;
    ?>
"/>
                <label class="control-label" for="batch-loading">Batch loading(<?php 
    echo \yii\helpers\Html::a("XLSX", \yii\helpers\Url::to(['/booking/export-' . strtolower($act), 'id' => $model->airport_id]));
    ?>
예제 #15
0
<?php

use kartik\form\ActiveForm;
use kartik\icons\Icon;
use kartik\widgets\Select2;
use yii\helpers\Html;
?>
<div class="well">
    <?php 
echo $this->render('alert');
?>
    <?php 
$form = ActiveForm::begin(['id' => 'Administrator', 'action' => \yii\helpers\Url::to(['']), 'type' => ActiveForm::TYPE_HORIZONTAL, 'enableClientScript' => false, 'enableClientValidation' => true, 'encodeErrorSummary' => false, 'formConfig' => ['labelSpan' => 3], 'options' => ['onkeypress' => "return event.keyCode != 13;"]]);
echo $form->errorSummary($admin, ['class' => 'alert alert-danger']);
?>
    <?php 
echo $form->field($admin, 'name')->textInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('name')]);
?>
    <?php 
echo $form->field($admin, 'password')->passwordInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('password')]);
?>
    <?php 
echo $form->field($admin, 'email')->textInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('email')]);
?>
    <?php 
echo \yii\bootstrap\Button::widget(['id' => 'backButton', 'label' => Icon::show('arrow-circle-left') . Yii::t('install', 'Back'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-info', 'onClick' => new \yii\web\JsExpression("\n            \$('#stepsMenu a:eq({$previousStep})').click();\n            return false;")]]);
echo Html::a(Icon::show('arrow-circle-right') . Yii::t('install', 'Continue'), '', ['class' => 'btn btn-info', 'style' => 'margin-left: 10px;', 'onClick' => new \yii\web\JsExpression("\n        \$('#Administrator').submit();\n        return false;")]);
?>
</div>
예제 #16
0
<?php

use kartik\form\ActiveForm;
/** @var \backend\modules\ads\models\BannerForm $model */
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-ad-form', 'options' => ['data-pjax' => true]]);
echo $form->field($model, 'name'), $form->field($model, 'position')->dropDownList($model->possiblePositions), $form->field($model, 'enableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'disableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'code')->textarea(['style' => 'height: 30vh']), $form->field($model, 'state')->checkbox([], false), \yii\bootstrap\Html::tag('div', \yii\helpers\Html::button('Сохранить', ['class' => 'btn btn-success', 'type' => 'submit']), ['class' => 'text-center']);
$form->end();
예제 #17
0
 /**
  * Renders raw active input based on the attribute settings
  *
  * @param \kartik\form\ActiveForm              $form the form instance
  * @param \yii\db\ActiveRecord|\yii\base\Model $model
  * @param string                               $attribute the name of the attribute
  * @param array                                $settings the attribute settings
  *
  * @return \kartik\form\ActiveField
  * @throws \yii\base\InvalidConfigException
  *
  */
 protected static function renderRawActiveInput($form, $model, $attribute, $settings)
 {
     $type = ArrayHelper::getValue($settings, 'type', self::INPUT_TEXT);
     $i = strpos($attribute, ']');
     $attribName = $i > 0 ? substr($attribute, $i + 1) : $attribute;
     if (!in_array($type, static::$_validInputs)) {
         throw new InvalidConfigException("Invalid input type '{$type}' configured for the attribute '{$attribName}'.'");
     }
     $fieldConfig = ArrayHelper::getValue($settings, 'fieldConfig', []);
     $options = ArrayHelper::getValue($settings, 'options', []);
     $label = ArrayHelper::getValue($settings, 'label', null);
     $hint = ArrayHelper::getValue($settings, 'hint', null);
     $field = $form->field($model, $attribute, $fieldConfig);
     if ($type === self::INPUT_TEXT || $type === self::INPUT_PASSWORD || $type === self::INPUT_TEXTAREA || $type === self::INPUT_FILE || $type === self::INPUT_HIDDEN || $type === self::INPUT_STATIC) {
         return static::getInput($field->{$type}($options), $label, $hint);
     }
     if ($type === self::INPUT_DROPDOWN_LIST || $type === self::INPUT_LIST_BOX || $type === self::INPUT_CHECKBOX_LIST || $type === self::INPUT_RADIO_LIST || $type === self::INPUT_MULTISELECT) {
         if (!isset($settings['items'])) {
             throw new InvalidConfigException("You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'.");
         }
         return static::getInput($field->{$type}($settings['items'], $options), $label, $hint);
     }
     if ($type === self::INPUT_CHECKBOX || $type === self::INPUT_RADIO) {
         $enclosedByLabel = ArrayHelper::getValue($settings, 'enclosedByLabel', true);
         if ($label !== null) {
             $options['label'] = $label;
         }
         return static::getInput($field->{$type}($options, $enclosedByLabel), null, $hint);
     }
     if ($type === self::INPUT_HTML5) {
         $html5type = ArrayHelper::getValue($settings, 'html5type', 'text');
         return static::getInput($field->{$type}($html5type, $options), $label, $hint);
     }
     if ($type === self::INPUT_WIDGET) {
         $widgetClass = ArrayHelper::getValue($settings, 'widgetClass', []);
         if (empty($widgetClass) && !$widgetClass instanceof yii\widgets\InputWidget) {
             throw new InvalidConfigException("A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'.");
         }
         return static::getInput($field->{$type}($widgetClass, $options), $label, $hint);
     }
     if ($type === self::INPUT_RAW) {
         return ArrayHelper::getValue($settings, 'value', '');
     }
 }
}
?>
            <?php 
echo Html::a(Icon::show('arrow-circle-left') . Yii::t('app', 'Back'), Yii::$app->request->get('returnUrl', ['/review/backend/index']), ['class' => 'btn btn-default']);
?>
            <?php 
echo Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'name' => 'action', 'value' => 'save']);
?>
        </div>
    </div>
<?php 
$this->endBlock('submit');
?>

<?php 
$form = ActiveForm::begin(['id' => 'product-form', 'type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
?>
    <div class="review-show">
        <?php 
if (false === $review->isNewRecord) {
    ?>
            <div class="row">
                <article class="col-xs-12 col-sm-6 col-md-6 col-lg-6"></article>
                <article class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
                    <?php 
    echo \app\properties\PropertiesWidget::widget(['model' => $submission, 'form' => $form]);
    ?>
                </article>
            </div>
        <?php 
}
예제 #19
0
 /**
  * Create a new User model. If creation is successful, the browser will
  * be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     /** @var \amnah\yii2\user\models\User $user */
     /** @var \amnah\yii2\user\models\Profile $profile */
     /** @var \amnah\yii2\user\models\Role $role */
     // AuthAssigment
     $permissoes = AuthItem::getListToDropDownList();
     $permissoesUser = null;
     // set up new user/profile objects
     $user = $this->module->model("User", ["scenario" => "register"]);
     $profile = $this->module->model("Profile");
     $mensagem = "";
     //Informa ao usuário mensagens de erro na view
     //Permissão do usuário
     $authAssignment = new AuthAssignment();
     $user->status = 1;
     // load post data
     $post = Yii::$app->request->post();
     if ($user->load($post)) {
         // ensure profile data gets loaded
         $profile->load($post);
         //Inicia a transação:
         $transaction = \Yii::$app->db->beginTransaction();
         try {
             // validate for ajax request
             if (Yii::$app->request->isAjax) {
                 Yii::$app->response->format = Response::FORMAT_JSON;
                 return ActiveForm::validate($user, $profile);
             }
             // validate for normal request
             if ($user->validate() && $profile->validate()) {
                 $itensInseridos = true;
                 // perform registration
                 $role = $this->module->model("Role");
                 if (!$user->setRegisterAttributes($role::ROLE_USER, $user::STATUS_ACTIVE)->save()) {
                     $mensagem = "Não foi possível salvar os dados";
                     $transaction->rollBack();
                     //desfaz alterações no BD
                     $itensInseridos = false;
                 }
                 if (!$profile->setUser($user->id)->save()) {
                     $mensagem = "Não foi possível salvar os dados";
                     $transaction->rollBack();
                     //desfaz alterações no BD
                     $itensInseridos = false;
                 }
                 $idUser = $user->id;
                 if (isset($post['AuthAssignment']['item_name']) && !empty($post['AuthAssignment']['item_name'])) {
                     //Guarda as permissões escolhidas
                     $roles = $post['AuthAssignment']['item_name'];
                     foreach ($roles as $role) {
                         $user->setPermissoes($role, $idUser);
                     }
                 }
                 if ($itensInseridos) {
                     $transaction->commit();
                     return $this->redirect(['view', 'id' => $user->id]);
                 }
             }
         } catch (\Exception $exception) {
             $transaction->rollBack();
             $mensagem = "Ocorreu uma falha inesperada ao tentar salvar";
         }
     }
     return $this->render("create", compact("user", "profile", "permissoes", "permissoesUser", "mensagem", "authAssignment"));
 }
예제 #20
0
            <li class="list-group-item list-group-item-current"><?php 
echo Yii::t('setup', 'Create admin account');
?>
</li>
            <li class="list-group-item"><?php 
echo Yii::t('setup', 'Finished');
?>
</li>
        </ul>
    </div>
    <div class="col-sm-8 form-wrapper">
        <?php 
echo Html::tag('h4', Yii::t('setup', 'Create administrator account'), ['class' => 'step-title']);
?>
        <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]);
?>
        <?php 
echo $form->field($model, 'email');
?>
        <?php 
echo $form->field($model, 'username');
?>
        <?php 
echo $form->field($model, 'password')->passwordInput();
?>
        <?php 
echo $form->field($model, 'timezone')->dropDownList($timezones, ['prompt' => Yii::t('setup', '-Select-')]);
?>
        <div class="form-action">
        <?php 
예제 #21
0
$this->registerJs($js);
/** @var \backend\modules\comments\models\CommentForm $model */
echo \Yii::$app->request->isAjax ? '' : Html::beginTag('div', ['class' => 'modal', 'id' => 'allInOneModal']);
?>
    <div class="modal-dialog">
        <div class="modal-content">
            <?php 
Pjax::begin(['id' => 'edit_comment', 'enablePushState' => false, 'enableReplaceState' => false, 'timeout' => 10000, 'clientOptions' => ['url' => \yii\helpers\Url::to(['/comments'])]]);
?>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span></button>
                <h4 class="modal-title">Редактирование комментария</h4>
            </div>
            <?php 
$form = \kartik\form\ActiveForm::begin(['type' => \kartik\form\ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-comment-form', 'action' => '/comments', 'options' => ['data-pjax' => true]]);
?>
            <div class="modal-body">
                <?php 
if (\Yii::$app->session->getFlash('saved', false)) {
    echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]);
} else {
    if (\Yii::$app->session->getFlash('error', false)) {
        echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]);
    }
}
echo $form->field($model, 'author'), $form->field($model, 'text')->textarea(), $form->field($model, 'email'), $form->field($model, 'published')->checkbox([], false), $form->field($model, 'deleted')->checkbox([], false), $form->field($model, 'commentID')->hiddenInput(['style' => 'display: none'])->label(false);
?>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Закрыть</button>
예제 #22
-1
<?php

use kartik\form\ActiveForm;
use kartik\icons\Icon;
use kartik\widgets\Select2;
use yii\helpers\Html;
?>
<div class="well">
    <?php 
echo $this->render('alert');
?>
    <?php 
$form = ActiveForm::begin(['id' => 'Database', 'action' => \yii\helpers\Url::to(['']), 'type' => ActiveForm::TYPE_HORIZONTAL, 'enableClientScript' => false, 'enableClientValidation' => true, 'encodeErrorSummary' => false, 'options' => ['onkeypress' => "return event.keyCode != 13;"]]);
echo $form->errorSummary($model, ['class' => 'alert alert-danger']);
?>
    <?php 
echo $form->field($model, 'type')->widget(Select2::classname(), ['data' => $model->getTypes(), 'disabled' => true, 'options' => ['placeholder' => $model->getAttributeLabel('type')], 'pluginOptions' => ['allowClear' => false, 'minimumResultsForSearch' => '-1']]);
?>
    <?php 
foreach ($model->safeAttributes() as $index => $attribute) {
    if ($attribute == 'type') {
        continue;
    }
    $type = $attribute != 'createdb' ? $attribute == 'password' ? 'passwordInput' : 'textInput' : 'checkbox';
    echo $form->field($model, $attribute)->{$type}(['autocomplete' => 'off', 'placeholder' => $model->getAttributeLabel($attribute)]);
}
?>
    <?php 
echo \yii\bootstrap\Button::widget(['id' => 'backButton', 'label' => Icon::show('arrow-circle-left') . Yii::t('install', 'Back'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-info', 'onClick' => new \yii\web\JsExpression("\n            \$('#stepsMenu a:eq({$previousStep})').click();\n            return false;")]]);
echo Html::a(Icon::show('arrow-circle-right') . Yii::t('install', 'Continue'), '', ['class' => 'btn btn-info', 'style' => 'margin-left: 10px;', 'onClick' => new \yii\web\JsExpression("\n        \$('#Database').submit();\n        return false;")]);
?>
예제 #23
-1
			<?= $form->field($model, 'head_picture')->label(Yii::t('app', 'Upload Head Picture'))->widget(FileInput::classname(), [
		    'pluginOptions' => [
		        'uploadUrl' => Url::to(['/user/upload-head-pic']),
		        'uploadAsync' => false,
		        'allowedPreviewTypes' => ['image'],
		        'allowedFileExtensions' => ['png', 'jpg', 'jpeg'],
		        'maxFileCount' => 1,
		        'maxFileSize' => 1000,
		        'uploadExtraData' => [
		            '_csrf' => Yii::$app->request->csrfToken,
		            'User[id]' => $model->id,
		        ] 
		    ]
	   		]); ?>

	   	<?php ActiveForm::end(); ?>
   	</div>

   	<div class="col-lg-2 col-lg-offset-5 col-md-2 col-md-offset-5 col-sm-2 col-sm-offset-2 profile-save">
   		<button class="btn btn-info" onclick="profileSave()" id="profile-save-btn"><span class="fa fa-spinner fa-pulse" style="display:none"></span>保存</button>
   	</div>
		
		
	</div>

<!-- 	<div class="mengceng">
		<span class="fa fa-refresh fa-spin fa-3x gif"></span>
	</div> -->

	<script type="text/javascript">
예제 #24
-1
if ($mode == 'new') {
    $this->title = 'Добавление новости';
    $breadcrumb = $this->title;
}
$this->params['breadcrumbs'][] = ['url' => '/news', 'label' => 'Новости'];
$this->params['breadcrumbs'][] = $breadcrumb;
echo Html::beginTag('div', ['class' => 'col-xs-12']);
if (\Yii::$app->session->getFlash('saved', false)) {
    echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]);
} else {
    if (\Yii::$app->session->getFlash('error', false)) {
        echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]);
    }
}
echo Html::endTag('div');
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo $this->render('_news_header_buttons', ['model' => $model, 'mode' => $mode]);
?>
    </div>
    <div class="panel-body">
        <?php 
echo Html::tag('div', $form->field($model, 'title') . $form->field($model, 'category')->widget(\kartik\select2\Select2::className(), ['data' => ArrayHelper::map(Category::find()->where(['deleted' => 0])->asArray()->all(), 'id', 'title')]) . $form->field($model, 'link')->hint('Оставьте поле пустым, чтобы ссылку сгенерировала система') . $form->field($model, 'text')->widget(\yii\imperavi\Widget::className(), ['id' => 'textEditor', 'options' => ['lang' => 'ru', 'imageUpload' => '/news/upload', 'imageManagerJson' => '/news/uploaded'], 'plugins' => ['imagemanager', 'video', 'border']]) . $form->field($model, 'metaDescription')->textarea() . $form->field($model, 'metaKeywords') . $form->field($model, 'language')->dropDownList($model->getLanguages()) . $form->field($model, 'publishDate')->widget(\kartik\datetime\DateTimePicker::className(), ['pluginOptions' => ['format' => 'dd.mm.yyyy HH:ii']]) . $form->field($model, 'genre')->dropDownList($model->getGenres()) . $form->field($model, 'author'), ['class' => 'col-xs-12']), $form->field($model, 'published', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'favorite', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'deleted', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'moderatedComments', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), Html::tag('div', Html::button(FontAwesome::i('save') . Html::tag('small', 'сохранить'), ['class' => 'btn btn-app btn-success', 'type' => 'submit']), ['class' => 'text-center']);
?>
    </div>
</div>
<?php 
$form->end();