本文整理汇总了PHP中kartik\helpers\Html::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::tag方法的具体用法?PHP Html::tag怎么用?PHP Html::tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\helpers\Html
的用法示例。
在下文中一共展示了Html::tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->options['class'] = 'ajax-form';
parent::run();
$content = ob_get_clean();
return Html::tag('div', $content, ['class' => 'ajax-form-wrapper', 'style' => "max-width:{$this->maxWidth}px"]);
}
示例2: run
public function run()
{
$this->genButton = Html::a(Icon::show('edit') . Yii::t('app', 'Generate'), '#', ['class' => 'btn btn-success', 'id' => 'btn-generate']);
$parent_id = $this->model->main_category_id;
$owner_id = $this->model->id;
$this->addButton = Html::a(Icon::show('plus') . Yii::t('app', 'Add'), Url::toRoute(['/shop/backend-product/edit', 'parent_id' => $parent_id, 'owner_id' => $owner_id, 'returnUrl' => \app\backend\components\Helper::getReturnUrl()]), ['class' => 'btn btn-success', 'id' => 'btn-add']);
if (!empty($this->footer)) {
$this->footer = Html::tag('div', $this->addButton . ' ' . $this->genButton, ['class' => 'widget-footer']);
}
$this->object = Object::getForClass(get_class($this->model));
$rest_pg = (new Query())->select('id, name')->from(PropertyGroup::tableName())->where(['object_id' => $this->object->id])->orderBy('sort_order')->all();
$this->property_groups_to_add = [];
foreach ($rest_pg as $row) {
$this->property_groups_to_add[$row['id']] = $row['name'];
}
$optionGenerate = Json::decode($this->model->option_generate);
if (null === PropertyGroup::findOne($optionGenerate['group'])) {
$this->model->option_generate = $optionGenerate = null;
}
$groupModel = null;
if (isset($optionGenerate['group'])) {
$groupModel = PropertyGroup::findOne($optionGenerate['group']);
$properties = Property::getForGroupId($optionGenerate['group']);
} else {
$group_ids = array_keys($this->property_groups_to_add);
$group_id = array_shift($group_ids);
$groupModel = PropertyGroup::findOne($group_id);
$properties = Property::getForGroupId($group_id);
}
if (is_null($groupModel)) {
$groupModel = new PropertyGroup();
}
return $this->render($this->viewFile, ['model' => $this->model, 'form' => $this->form, 'groups' => $this->property_groups_to_add, 'groupModel' => $groupModel, 'properties' => $properties, 'optionGenerate' => $optionGenerate, 'footer' => $this->footer]);
}
示例3: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
$value = $this->getDataCellValue($model, $key, $index);
$name = $this->getLabelName($model, $key, $index, $value);
$class = ArrayHelper::getValue($this->cssCLasses, $value, 'default');
$html = Html::tag('span', Html::encode($name), ['class' => 'label label-' . $class]);
return $value === null ? $this->grid->emptyCell : $html;
}
示例4: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$value = $this->getDataCellValue($model, $key, $index);
$label = $value ? $this->getRoleLabel($value) : $value;
$class = $value == $this->defaultRole ? 'primary' : 'danger';
$html = Html::tag('span', Html::encode($label), ['class' => 'label label-' . $class]);
return $value === null ? $this->grid->emptyCell : $html;
}
示例5: renderDataCell
/**
* @inheritdoc
*/
public function renderDataCell($model, $key, $index)
{
if (!$this->_isContextMenu) {
return parent::renderDataCell($model, $key, $index);
} else {
$options = $this->fetchContentOptions($model, $key, $index);
$this->parseExcelFormats($options, $model, $key, $index);
$out = $this->renderDataCellContent($model, $key, $index);
return Html::tag('td', $out, $options);
}
}
示例6: run
public function run()
{
if (!empty($this->footer)) {
$this->footer = Html::tag('div', $this->footer, ['class' => 'widget-footer']);
}
if (!empty($this->icon)) {
$this->title = Icon::show($this->icon) . $this->title;
}
$this->params['title'] = $this->title;
$this->params['header_append'] = $this->header_append;
$this->params['footer'] = $this->footer;
$this->params['_id'] = $this->getId();
return parent::run();
}
示例7: renderAddon
protected function renderAddon(&$options, $type = 'picker')
{
if ($options === false) {
return '';
}
if (is_string($options)) {
return $options;
}
Html::addCssClass($options, 'input-group-addon');
$icon = $type === 'picker' ? 'date_range' : 'close';
$icon = '<i class="glyphicon-calendar material-icons">' . $icon . '</i>';
if (empty($options['title'])) {
$title = $type === 'picker' ? Yii::t('kvdtime', 'Select date & time') : Yii::t('kvdtime', 'Clear field');
if ($title != false) {
$options['title'] = $title;
}
}
return Html::tag('span', $icon, $options);
}
示例8: run
public function run()
{
$rb = Yii::$app->user->can(Rbac::PERMISSION_ADMIN_PANEL);
$model = new $this->model();
$points = $model::find()->all();
if (count($points) > 0) {
$geoObject = ['type' => 'FeatureCollection'];
foreach ($points as $point) {
if ($rb) {
$delete = '<hr>' . Html::a('<i class="material-icons">create</i> Редактировать', ['/admin/default/map-edit', 'id' => $point->id]) . ' ' . Html::a('<i class="material-icons">delete</i> Удалить', ['/admin/default/map-delete', 'id' => $point->id]);
} else {
$delete = '';
}
$geoObject['features'][] = ['type' => 'Feature', 'id' => $point->id, 'geometry' => ['type' => 'Point', 'coordinates' => explode(',', $point->point)], 'properties' => ['balloonContent' => $point->body . $delete, 'iconContent' => $point->title], 'options' => ['id' => $point->id, 'preset' => $point->preset]];
}
} else {
$geoObject = false;
}
$view = $this->view;
$view->registerJs("var geoObj = " . Json::encode($geoObject) . ";", $view::POS_HEAD);
MapInputAsset::register($view);
return Html::tag('div', '', ['id' => 'map', 'style' => "height:{$this->height}px"]);
}
示例9: function
* @var \app\models\Form $searchModel
*/
use kartik\dynagrid\DynaGrid;
use kartik\helpers\Html;
$this->title = Yii::t('app', 'Currencies');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
echo app\widgets\Alert::widget(['id' => 'alert']);
$this->beginBlock('add-button');
echo \yii\helpers\Html::a(\kartik\icons\Icon::show('plus') . ' ' . Yii::t('app', 'Add'), ['edit', 'returnUrl' => \app\backend\components\Helper::getReturnUrl()], ['class' => 'btn btn-success']);
echo \app\backend\widgets\RemoveAllButton::widget(['url' => 'remove-all', 'gridSelector' => '.grid-view', 'htmlOptions' => ['class' => 'btn btn-danger pull-right']]);
$this->endBlock();
?>
<div class="row">
<div class="col-md-12">
<?php
echo DynaGrid::widget(['options' => ['id' => 'currencies-grid'], 'columns' => [['class' => \app\backend\columns\CheckboxColumn::className()], 'id', 'name', 'iso_code', 'convert_nominal', 'convert_rate', ['attribute' => 'currency_rate_provider_id', 'class' => \kartik\grid\EditableColumn::className(), 'editableOptions' => ['data' => [0 => '-'] + \app\components\Helper::getModelMap(\app\modules\shop\models\CurrencyRateProvider::className(), 'id', 'name'), 'inputType' => 'dropDownList', 'placement' => 'left', 'formOptions' => ['action' => 'update-editable']], 'filter' => \app\components\Helper::getModelMap(\app\modules\shop\models\CurrencyRateProvider::className(), 'id', 'name'), 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
if ($model === null || $model->rateProvider === null) {
return null;
}
return Html::tag('div', $model->rateProvider->name, ['class' => $model->rateProvider->name]);
}], ['class' => \app\backend\components\ActionColumn::className()]], 'theme' => 'panel-default', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'panel' => ['heading' => $this->render('_tabs', ['currencies' => true]), 'after' => $this->blocks['add-button']]]]);
?>
</div>
</div>
示例10: run
public function run()
{
$options = ['model' => $this->model, 'form' => $this->_form, 'attributes' => $this->attributes] + $this->options;
echo Form::widget($options);
if ($this->buttons != null) {
$tag = ArrayHelper::remove($this->buttonsContainer, 'tag', 'div');
echo Html::tag($tag, $this->_buttons, $this->buttonsContainer);
}
ActiveForm::end();
}
示例11:
<?php
/**
* @var $dataProvider \yii\data\ActiveDataProvider
* @var $searchModel \app\components\SearchModel
* @var $this \yii\web\View
*/
use app\backend\components\ActionColumn;
use kartik\dynagrid\DynaGrid;
use kartik\helpers\Html;
use kartik\icons\Icon;
$this->title = Yii::t('app', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<?php
echo DynaGrid::widget(['options' => ['id' => 'users-grid'], 'columns' => [['class' => \kartik\grid\CheckboxColumn::className(), 'options' => ['width' => '10px']], 'id', 'username', 'email:email', ['attribute' => 'status', 'filter' => \app\modules\user\models\User::getStatuses()], 'create_time:datetime', ['class' => ActionColumn::className(), 'options' => ['width' => '95px'], 'buttons' => [['url' => 'update', 'icon' => 'pencil', 'class' => 'btn-primary', 'label' => Yii::t('app', 'Edit')], ['url' => 'delete', 'icon' => 'trash-o', 'class' => 'btn-danger', 'options' => ['data-action' => 'delete'], 'label' => Yii::t('app', 'Delete')]]]], 'theme' => 'panel-default', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'panel' => ['heading' => Html::tag('h3', $this->title, ['class' => 'panel-title']), 'after' => Html::a(Icon::show('plus') . Yii::t('app', 'Add'), ['/user/backend-user/update'], ['class' => 'btn btn-success']) . \app\backend\widgets\RemoveAllButton::widget(['url' => '/user/backend-user/remove-all', 'gridSelector' => '.grid-view', 'htmlOptions' => ['class' => 'btn btn-danger pull-right']])]]]);
?>
</div>
示例12:
* @var $form \yii\widgets\ActiveForm
* @var $label string
* @var $model \app\properties\AbstractModel
* @var $multiple boolean
* @var $property_id integer
* @var $property_key string
* @var $this \yii\web\View
* @var $values \app\properties\PropertyValue
*/
use app\models\Property;
use app\modules\shop\models\Product;
use yii\helpers\ArrayHelper;
use kartik\helpers\Html;
$productIds = ArrayHelper::getColumn($values->values, 'value');
/** @var Product[] $products */
$products = Product::findAll($productIds);
?>
<dl>
<?php
if (count($productIds) == 0) {
return;
}
$property = Property::findById($property_id);
echo Html::tag('dt', $property->name);
foreach ($products as $product) {
echo Html::tag('dd', Html::a($product->name, ['@product', 'model' => $product]));
}
?>
</dl>
示例13:
<?php
use kartik\helpers\Html;
use yii\bootstrap\ActiveForm;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$form = ActiveForm::begin(['id' => 'user-form', 'layout' => 'inline', 'method' => 'POST']);
$ka = $rowNr;
echo Html::beginTag('table');
echo Html::beginTag('tr', ['data-row' => '1']);
echo Html::tag('td', $form->field($auth, '[' . $ka . ']type')->dropDownList($auth->getTypeArr(), ['style' => 'width:120px;', 'prompt' => '--']));
echo Html::tag('td', $form->field($auth, '[' . $ka . ']allowFrom')->textInput(['style' => 'width:120px;']));
echo Html::tag('td', $form->field($auth, '[' . $ka . ']allowTo')->textInput(['style' => 'width:120px;']));
echo Html::endTag('tr');
echo Html::endTag('table');
$form->end();
示例14: registerAssets
/**
* Register assets
*/
protected function registerAssets()
{
$view = $this->getView();
DetailViewAsset::register($view);
if (empty($this->alertWidgetOptions['closeButton'])) {
$button = '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>';
} else {
$opts = $this->alertWidgetOptions['closeButton'];
$tag = ArrayHelper::remove($opts, 'tag', 'button');
$label = ArrayHelper::remove($opts, 'label', '×');
if ($tag === 'button' && !isset($opts['type'])) {
$opts['type'] = 'button';
}
$button = Html::tag($tag, $label, $opts);
}
$opts = ArrayHelper::getValue($this->alertWidgetOptions, 'options', []);
if (!empty($opts['class'])) {
$opts['class'] .= ' {class} fade in';
} else {
$opts['class'] = '{class} fade in';
}
$deleteConfirmMsg = Yii::t('kvdetail', 'Are you sure you want to delete this item?');
$this->pluginOptions = ['fadeDelay' => $this->fadeDelay, 'alertTemplate' => Html::tag('div', $button . '{content}', $opts), 'alertMessageSettings' => $this->alertMessageSettings, 'deleteParams' => ArrayHelper::getValue($this->deleteOptions, 'params', []), 'deleteAjaxSettings' => ArrayHelper::getValue($this->deleteOptions, 'ajaxSettings', []), 'deleteConfirm' => ArrayHelper::remove($this->deleteOptions, 'confirm', $deleteConfirmMsg), 'showErrorStack' => ArrayHelper::remove($this->deleteOptions, 'showErrorStack', false)];
$id = 'jQuery("#' . $this->container['id'] . '")';
if ($this->enableEditMode) {
$options['mode'] = $this->mode;
}
$this->registerPlugin($this->pluginName, $id);
if ($this->tooltips) {
$view->registerAssetBundle('yii\\bootstrap\\BootstrapPluginAsset');
$view->registerJs($id . '.find("[data-toggle=tooltip]").tooltip();');
}
}
示例15: actionUpdatePaymentType
/**
* @param $id
* @return array
* @throws BadRequestHttpException
* @throws NotFoundHttpException
*/
public function actionUpdatePaymentType($id)
{
Yii::$app->response->format = Response::FORMAT_JSON;
$post = Yii::$app->request->post();
if (!isset($post['Order']['payment_type_id'])) {
throw new BadRequestHttpException();
}
$value = $post['Order']['payment_type_id'];
$order = $this->findModel($id);
$order->payment_type_id = $value;
/** @var PaymentType $paymentType */
$paymentType = PaymentType::findOne($value);
if ($paymentType === null || !$order->save(true, ['payment_type_id'])) {
return ['message' => Yii::t('app', 'Cannot change a payment type')];
}
return ['output' => Html::tag('span', $paymentType->name)];
}