当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::button方法代码示例

本文整理汇总了PHP中yii\bootstrap\Html::button方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::button方法的具体用法?PHP Html::button怎么用?PHP Html::button使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\bootstrap\Html的用法示例。


在下文中一共展示了Html::button方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateGalleryTemplate

 /**
  * Ham tao giao dien cho image
  * @param array $galleries mang cac gia tri cua image
  * @param string $module ten module dang su dung
  * @param array $columns danh sach truong cua image
  * @return string
  */
 public static function generateGalleryTemplate($galleries, $module, $columns = [])
 {
     $templateGallery = '';
     foreach ($galleries as $galleryId => $gallery) {
         // Gia tri mac dinh cua image
         $urlImg = ArrayHelper::getValue($gallery, 'url');
         $type = ArrayHelper::getValue($gallery, 'type');
         // Tao giao dien cho cac image
         $templateGallery .= Html::beginTag('tr', ['id' => 'imageItem', 'style' => 'width: 100%; background: white;']);
         $templateGallery .= Html::beginTag('td');
         $templateGallery .= self::generateImageByType($urlImg, $type);
         $templateGallery .= Html::endTag('td');
         $templateGallery .= Html::beginTag('td', ['style' => 'vertical-align: middle; text-align: center;']);
         $templateGallery .= Html::textInput($module . '[gallery][' . $galleryId . '][url]', $urlImg, ['class' => 'form-control', 'readonly' => true]);
         $templateGallery .= Html::endTag('td');
         // Type upload hidden
         $templateGallery .= Html::hiddenInput($module . '[gallery][' . $galleryId . '][type]', $type, ['class' => 'form-control']);
         // Lay ra cac truong cua image
         foreach ($columns as $keyColumn => $column) {
             $templateGallery .= Html::beginTag('td', ['style' => 'vertical-align: middle; text-align: center;']);
             $templateGallery .= self::generateColumnByType($keyColumn, $column, $gallery, $module, $galleryId);
             $templateGallery .= Html::endTag('td');
         }
         // Cac action xu ly cua image
         $templateGallery .= Html::beginTag('td', ['style' => 'vertical-align: middle; text-align: center;']);
         $templateGallery .= Html::button('<i class="fa fa-trash"></i>', ['class' => 'btn btn-white', 'onclick' => 'removeImage(this);']);
         $templateGallery .= Html::endTag('td');
         $templateGallery .= Html::endTag('tr');
     }
     return $templateGallery;
 }
开发者ID:heartshare,项目名称:yii2-gallery,代码行数:38,代码来源:Gallery.php

示例2: getLessonsList

 private function getLessonsList($lessons_array, $week, $day)
 {
     foreach ($lessons_array as $key => $element) {
         if ($element->week != $week || $element->day != $day) {
             unset($lessons_array[$key]);
         }
     }
     $lessons = $lessons_array;
     $items = array();
     $result = array();
     foreach ($lessons as $lesson) {
         foreach ($this->attributes as $attr) {
             if ($attr == $this->group) {
                 $items[] = Html::tag('td', Html::a($lesson->{$attr}, Url::to(['//group/view', 'id' => $lesson->groupHasDiscipline->group->id])));
             } elseif ($attr == $this->teacher) {
                 $items[] = Html::tag('td', Html::button($lesson->{$attr}, ['value' => Url::to(['//teacher/view', 'id' => $lesson->teacherHasDiscipline->teacher->id]), 'class' => 'btn-link modalButton']));
             } elseif ($attr == $this->discipline && (Yii::$app->user->can('chief') || isset(Yii::$app->user->identity->student) && $lesson->groupHasDiscipline->checkStudent(Yii::$app->user->identity->student->id) || isset(Yii::$app->user->identity->teacher) && $lesson->groupHasDiscipline->checkTeacher(Yii::$app->user->identity->teacher->id))) {
                 $items[] = Html::tag('td', Html::a($lesson->groupHasDiscipline->discipline->name, Url::to(['//group-has-discipline', 'id' => $lesson->groupHasDiscipline->id]), ['class' => 'btn-link']));
             } else {
                 $items[] = Html::tag('td', $lesson->{$attr});
             }
         }
         $result[] = Html::tag('tr', implode("\n", $items));
         $items = null;
     }
     return Html::tag('tr', implode("\n", $result));
 }
开发者ID:mrhat24,项目名称:site-for-pm,代码行数:27,代码来源:Schedule.php

示例3: rec

 private function rec($key, $list, $padding, $collapse = true)
 {
     $result = '<div id="' . $key . '" class="list-group ' . ($collapse ? 'collapse' : '') . '" style="padding-left:' . $padding . 'px">';
     foreach ($list as $item) {
         if (isset($item['children']) && sizeof($item['children']) > 0) {
             $result .= Html::button('<span class="badge">' . $item['count'] . '</span>' . $item['title'], ['class' => 'list-group-item accordion-toggle collapsed', 'data-toggle' => 'collapse', 'data-target' => '#' . $item['key']]);
             $result .= $this->rec($item['key'], $item['children'], $padding + $this->options['padding']);
         } else {
             $result .= Html::button($item['title'], ['class' => 'list-group-item list-group-item-info accordion-file', 'onclick' => 'tryInfoM(\'' . $item['key'] . '\')']);
         }
     }
     return $result . '</div>';
 }
开发者ID:omeke,项目名称:yii2-papa,代码行数:13,代码来源:ListGroupWidget.php

示例4: foreach

<?php

/**
 * @package   yii2-document
 * @author    Yuri Shekhovtsov <shekhovtsovy@yandex.ru>
 * @copyright Copyright &copy; Yuri Shekhovtsov, lowbase.ru, 2015 - 2016
 * @version   1.0.0
 */
use yii\bootstrap\Html;
use yii\helpers\Url;
foreach ($model->fields as $field_id => $field) {
    echo "<div class='lb-document-module-field' id='field-" . $field_id . "'>";
    if ($field['max'] > 1) {
        echo "<p>" . Html::button(Yii::t('document', 'Добавить'), ['class' => 'add-item btn btn-default']) . "</p>";
    }
    foreach ($field['data'] as $data_id => $data) {
        echo $this->render('_field', ['model' => $model, 'field' => $field, 'field_id' => $field_id, 'data' => $data, 'data_id' => $data_id]);
    }
    echo "</div>";
}
$document_id = $model->isNewRecord ? 0 : $model->id;
$this->registerJs("\n    var multi_new = 0;\n    \$('.add-item').click(function(){\n        var field_id = \$(this).parent().parent().attr('id').substr(6);\n        \$.ajax({\n            url: '" . Url::to(['document/field']) . "',\n            type: 'POST',\n            data: {\n                'field_id' : field_id,\n                'document_id' : " . $document_id . ",\n                'data_id' : multi_new\n            },\n            success: function(data){\n                \$('#field-'+field_id).append(data);\n                multi_new++;\n            }\n        });\n    });\n");
开发者ID:lowbase,项目名称:yii2-document,代码行数:22,代码来源:_fields.php

示例5:

<?php

use yii\bootstrap\Modal;
use yii\bootstrap\Html;
use yii\web\View;
/* @var $this View */
/* @var $widget \phpnt\cropper\ImageLoadWidget */
/* @var $modelImageForm \phpnt\cropper\models\ImageForm */
/* @var $attribute string */
/* @var $imagePath string */
$render = $widget->images_num == 1 ? '_image' : '_image-many';
echo $this->render($render, ['modelName' => $widget->modelName, 'id' => $widget->id, 'object_id' => $widget->object_id, 'images_num' => $widget->images_num, 'images_label' => $widget->images_label, 'images_temp' => $widget->images_temp, 'imageSmallWidth' => $widget->imageSmallWidth, 'buttonClass' => $widget->buttonClass, 'previewSize' => $widget->previewSize, 'imageSmallHeight' => $widget->imageSmallHeight, 'imagesObject' => $widget->imagesObject, 'modelImageForm' => $modelImageForm, 'createImageText' => $widget->createImageText, 'updateImageText' => $widget->updateImageText, 'deleteImageText' => $widget->deleteImageText, 'frontendUrl' => $widget->frontendUrl, 'baseUrl' => $widget->baseUrl, 'imagePath' => $widget->imagePath, 'noImage' => $widget->noImage, 'loaderImage' => $widget->loaderImage, 'backend' => $widget->backend, 'imageClass' => $widget->classesWidget['imageClass'], 'buttonDeleteClass' => $widget->classesWidget['buttonDeleteClass'], 'imageContainerClass' => $widget->classesWidget['imageContainerClass'], 'formImagesContainerClass' => $widget->classesWidget['formImagesContainerClass']]);
Modal::begin(['size' => $widget->sizeModal, 'header' => '<h2>' . $widget->headerModal . '</h2>', 'footer' => Html::button('Применить', ['class' => 'btn btn-primary crop-submit']) . Html::button('Отмена', ['class' => 'btn btn-default', 'onclick' => '$("#modal-' . $widget->id . '").modal("hide")']), 'toggleButton' => false, 'options' => ['id' => 'modal-' . $widget->id]]);
?>
    <div class="crop-image-container-<?php 
echo $widget->id;
?>
">

        <?php 
echo Html::img('', ['id' => 'previewImg-' . $widget->id, 'class' => 'cropper-image img-responsive', 'alt' => 'crop-image', 'style' => 'width: 100%']);
?>
    </div>
<?php 
Modal::end();
开发者ID:phpnt,项目名称:yii2-cropper,代码行数:25,代码来源:view.php

示例6: function

$customerModal = new \bobroid\remodal\Remodal(['addRandomToID' => false, 'id' => 'addUser', 'confirmButton' => false, 'cancelButton' => false]);
echo $customerModal->renderModal($this->render('_new_user', ['model' => new \backend\models\SiteuserForm()]));
?>

<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FA::i('plus') . Html::tag('small', 'Добавить'), '#addUser', ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $siteusersDataProvider, 'summary' => false, 'bordered' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'columns' => [['vAlign' => GridView::ALIGN_MIDDLE, 'class' => SerialColumn::className()], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '200px', 'attribute' => 'username'], ['vAlign' => GridView::ALIGN_MIDDLE, 'attribute' => 'email'], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '100px', 'attribute' => 'status', 'value' => function ($model) {
    if ($model->status == $model::STATUS_ACTIVE) {
        return 'Активен';
    }
    return 'Не активен';
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '160px', 'attribute' => 'created_at', 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->created_at);
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '150px', 'attribute' => 'last_visit', 'value' => function ($model) {
    return \Yii::$app->formatter->asRelativeTime($model->last_visit);
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '100px', 'class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{edit}{status}', ['class' => 'btn-group']), 'buttons' => ['edit' => function () {
    return Html::button(FA::i('pencil'), ['class' => 'btn btn-default editUser', 'title' => 'Редактировать']);
}, 'status' => function ($key, $model) {
    $active = $model->status == $model::STATUS_ACTIVE;
    return Html::button(FA::i($active ? 'unlock' : 'lock'), ['class' => 'btn changeStatus btn-' . ($active ? 'success' : 'danger')]);
}]]]]);
?>

    </div>
</div>
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:31,代码来源:index.php

示例7: JsExpression

<?php

use backend\helpers\ArrayHelper;
use backend\models\Category;
use backend\models\News;
use kartik\form\ActiveForm;
use kartik\select2\Select2;
use yii\web\JsExpression;
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-theme-form', 'options' => ['data-pjax' => true]]);
echo $form->field($model, 'name'), $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 = $("#mainthemeform-categories").val(); if(categories !== null && categories.length > 0){ data.excludedCategories = categories;} return data; }')]]]), $form->field($model, 'color')->dropDownList($model->getColors()), $form->field($model, 'titleWords', ['inputOptions' => ['format' => 'number']]), $form->field($model, 'textWords', ['inputOptions' => ['format' => 'number']]), $form->field($model, 'enabled')->checkbox([], false), \yii\bootstrap\Html::tag('div', \yii\bootstrap\Html::button('Сохранить', ['class' => 'btn btn-success btn-lg', 'type' => 'submit']), ['class' => 'text-center']);
$form->end();
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:11,代码来源:editForm.php

示例8: function

<?php

use app\func\Proc;
use app\models\Fregat\Recoveryrecieveaktmat;
use kartik\dynagrid\DynaGrid;
use yii\bootstrap\Html;
use yii\helpers\Url;
$recoveryrecieveaktmat_repaired = Recoveryrecieveaktmat::VariablesValues('recoveryrecieveaktmat_repaired');
echo DynaGrid::widget(Proc::DGopts(['options' => ['id' => 'recoverysendmat_grid'], 'columns' => Proc::DGcols(['columns' => ['id_recoverysendakt', ['attribute' => 'idRecoverysendakt.recoverysendakt_date', 'format' => 'date'], ['attribute' => 'recoveryrecieveaktmat_date', 'format' => 'date'], 'recoveryrecieveaktmat_result', ['attribute' => 'recoveryrecieveaktmat_repaired', 'filter' => $recoveryrecieveaktmat_repaired, 'value' => function ($model) use($recoveryrecieveaktmat_repaired) {
    return isset($recoveryrecieveaktmat_repaired[$model->recoveryrecieveaktmat_repaired]) ? $recoveryrecieveaktmat_repaired[$model->recoveryrecieveaktmat_repaired] : '';
}], 'idTrMatOsmotr.id_osmotraktmat'], 'buttons' => ['recoveryrecieveaktmatreport' => function ($url, $model) use($params) {
    return Html::button('<i class="glyphicon glyphicon-list"></i>', ['type' => 'button', 'title' => 'Скачать акт получения материалов от сторонней организации', 'class' => 'btn btn-xs btn-default', 'onclick' => 'DownloadReport("' . Url::to(['Fregat/recoveryrecieveaktmat/recoveryrecieveaktmat-report']) . '", null, {id: ' . $model->id_recoverysendakt . '} )']);
}]]), 'gridOptions' => ['dataProvider' => $dataProvider_recoverysendmat, 'filterModel' => $searchModel_recoverysendmat, 'panel' => ['heading' => '<i class="glyphicon glyphicon-wrench"></i> Восстановление, как материал']]]));
开发者ID:vovancho,项目名称:yii2test,代码行数:13,代码来源:_recoverymat_jurnal.php

示例9: run

 public function run()
 {
     parent::run();
     return Html::a($this->label, 'javascript:;', ['data' => ['toggled' => $this->isFollow, 'param' => $this->param, 'url' => $this->url], 'class' => $this->className]);
     return Html::button($this->label, ['data' => ['toggled' => $this->isFollow, 'param' => $this->param, 'url' => $this->url], 'class' => 'tagFollowToggle color-grey ' . $this->className]);
 }
开发者ID:awebc,项目名称:web_xbf,代码行数:6,代码来源:FollowBtn.php

示例10: generateTemplatePosition

 /**
  * Ham get ra template cua position
  * @param int $numberColumn so cot cua position
  * @param string $diyId id cua diy
  * @param string $containerId id cua container
  * @param string $itemId id cua position
  * @param array $widgetItems mang cac widget cua position
  * @return string
  */
 public static function generateTemplatePosition($numberColumn = 12, $diyId = null, $containerId, $itemId = null, $widgetItems = [])
 {
     $tempalatePosition = Html::beginTag('div', ['class' => 'let_position col-md-' . $numberColumn . ' col-sm-' . $numberColumn . ' col-xs-12', 'id' => $itemId, 'data-diyId' => $diyId, 'data-id' => $itemId]);
     // Begin button delete position
     $tempalatePosition .= Html::beginTag('div', ['class' => 'row positionButton', 'style' => 'margin: 10px 0 10px 0;']);
     $tempalatePosition .= Html::beginTag('div', ['class' => 'pull-right']);
     $tempalatePosition .= Html::beginTag('div', ['class' => 'btn-group buttonDelete']);
     $tempalatePosition .= Html::button('<i class="glyphicon glyphicon-trash"></i>', ['class' => 'btn btn-danger btn-xs', 'onclick' => 'deleteItems(this, "p", ".let_position");']);
     $tempalatePosition .= Html::endTag('div');
     $tempalatePosition .= Html::endTag('div');
     $tempalatePosition .= Html::endTag('div');
     // End button delete position
     $tempalatePosition .= Html::beginTag('div', ['class' => 'let_widget_position']);
     if (!empty($widgetItems)) {
         foreach ($widgetItems as $widgetId => $widget) {
             $id = ArrayHelper::getValue($widget, 'id');
             $settings = ArrayHelper::getValue($widget, 'settings', []);
             $tempalatePosition .= DiyWidget::generateTemplateSetting($containerId, $itemId, $widgetId, $id, $settings);
         }
     }
     $tempalatePosition .= Html::endTag('div');
     $tempalatePosition .= Html::endTag('div');
     return $tempalatePosition;
 }
开发者ID:letyii,项目名称:yii2-diy,代码行数:33,代码来源:Diy.php

示例11: function

<?php

use app\func\Proc;
use kartik\dynagrid\DynaGrid;
use yii\bootstrap\Html;
use yii\helpers\Url;
echo DynaGrid::widget(Proc::DGopts(['options' => ['id' => 'mattraffic_contain_grid'], 'columns' => Proc::DGcols(['columns' => ['id_installakt', ['attribute' => 'idInstallakt.installakt_date', 'format' => 'date'], 'idMattraffic.idMaterial.material_name', 'idMattraffic.idMaterial.material_inv', 'idMattraffic.mattraffic_number', ['attribute' => 'idMattraffic.idMol.idperson.auth_user_fullname', 'label' => 'Материально-ответственное лицо'], ['attribute' => 'idMattraffic.idMol.iddolzh.dolzh_name', 'label' => 'Должность материально-ответственного лица'], ['attribute' => 'idMattraffic.idMol.idbuild.build_name', 'label' => 'Здание материально-ответственного лица'], ['attribute' => 'idMattraffic.mattraffic_username', 'visible' => false], ['attribute' => 'idMattraffic.mattraffic_lastchange', 'format' => 'datetime', 'visible' => false]], 'buttons' => array_merge(['installaktmatreport' => function ($url, $model) {
    return Html::button('<i class="glyphicon glyphicon-list"></i>', ['type' => 'button', 'title' => 'Скачать акт перемещения матер-ой цен-ти', 'class' => 'btn btn-xs btn-default', 'onclick' => 'DownloadReport("' . Url::to(['Fregat/installakt/installakt-report']) . '", null, {id: ' . $model->id_installakt . '} )']);
}])]), 'gridOptions' => ['dataProvider' => $dataProvider_mattraffic_contain, 'filterModel' => $searchModel_mattraffic_contain, 'panel' => ['heading' => '<i class="glyphicon glyphicon-th-list"></i> Состав материальной ценности']]]));
开发者ID:vovancho,项目名称:yii2test,代码行数:9,代码来源:_material_contain.php

示例12:

 * @var string  $display
 */
use common\models\School;
use frontend\models\Lang;
use frontend\widgets\SchoolList;
use frontend\widgets\ModalDialogsWidget;
use yii\bootstrap\Html;
$this->registerJsFile(Yii::$app->request->baseUrl . '/js/school/list.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
?>
    <div id="blockList">
        <?php 
foreach ($schools as $school) {
    if ($display == SchoolList::SCHOOL_LIST_DISPLAY_MAIN) {
        echo $this->render('view', ['school' => $school, 'dateCreateType' => $dateCreateType]);
    } else {
        if ($display == SchoolList::SCHOOL_LIST_DISPLAY_MINI) {
            echo $this->render('viewMini', ['school' => $school, 'dateCreateType' => $dateCreateType]);
        }
    }
}
?>
    </div>

<?php 
if (!$onlySchool) {
    if (count($schools) >= SchoolList::DEFAULT_LIMIT) {
        echo Html::button(Lang::t("main", "showMore"), ['class' => 'btn btn-primary', 'id' => 'loadMore']);
    }
    echo ModalDialogsWidget::widget(['action' => ModalDialogsWidget::ACTION_MODAL_SHOW_IMG]);
    echo ModalDialogsWidget::widget(['action' => ModalDialogsWidget::ACTION_MODAL_SHOW_LOCATION]);
}
开发者ID:IVsevolod,项目名称:zouk,代码行数:31,代码来源:list.php

示例13:

echo Yii::t('account', 'Permission');
?>
</a></li>
        <li role="presentation" class="active"><a href="<?php 
echo Url::to(['/account/rbac/actionlist']);
?>
"><?php 
echo Yii::t('account', 'Action list');
?>
</a></li>
    </ul>
    <div id="message"></div>
    <div class="row m-b-md">
        <div class="col-lg-12">
            <div class="btn-group">
                <?php 
echo Html::button(Yii::t('yii', 'Create Permissions'), ['class' => 'btn btn-success', 'onclick' => 'addPermissionFromActionList();']);
?>
                <?php 
echo Html::a(Yii::t('yii', 'Get Permissions'), ['rbac/actionlist', 'generation' => 1], ['class' => 'btn btn-info']);
?>
            </div>
        </div>
    </div>

    <?php 
echo GridView::widget(['panel' => ['heading' => Yii::t(Yii::$app->controller->module->id, 'Account'), 'tableOptions' => ['id' => 'listDefault']], 'pjax' => TRUE, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'app\\modules\\account\\components\\SelectActionForItemColumn'], '_id', 'module', 'app', 'controller', 'action', ['attribute' => 'is_permission', 'class' => '\\app\\components\\BooleanColumn']], 'responsive' => true, 'hover' => true]);
?>


</div>
开发者ID:quynhvv,项目名称:stepup,代码行数:31,代码来源:actionlist.php

示例14: empty

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']);
?>
    </div>
<?php 
$form->end();
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:31,代码来源:editForm.php

示例15:

<?php

use yii\bootstrap\Html;
$form = new \yii\widgets\ActiveForm(['action' => '/siteusers/adduser']);
$form->begin();
?>

<?php 
echo $form->field($model, 'username');
echo $form->field($model, 'email');
echo $form->field($model, 'password')->passwordInput();
echo Html::button('Отмена', ['data-remodal-action' => 'cancel', 'class' => 'remodal-cancel']);
echo Html::button('Создать', ['class' => 'remodal-confirm', 'type' => 'success']);
$form->end();
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:14,代码来源:_new_user.php


注:本文中的yii\bootstrap\Html::button方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。