本文整理汇总了PHP中yii\bootstrap\Html::beginTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::beginTag方法的具体用法?PHP Html::beginTag怎么用?PHP Html::beginTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Html
的用法示例。
在下文中一共展示了Html::beginTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
echo Html::beginTag('div', ['class' => 'input-group']);
if (!isset($this->options['class'])) {
$this->options['class'] = 'form-control';
}
$iconId = 'icon-' . $this->options['id'];
if (!isset($this->options['aria-describedby'])) {
$this->options['aria-describedby'] = $iconId;
}
if ($this->hasModel()) {
$replace['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->options);
} else {
$replace['{input}'] = Html::textInput($this->name, $this->value, $this->options);
}
if ($this->icon != '') {
$replace['{icon}'] = Html::tag('span', Icon::show($this->icon, [], Icon::FA), ['class' => 'input-group-addon', 'id' => $iconId]);
}
echo strtr($this->template, $replace);
echo Html::endTag('div');
$view = $this->getView();
Assets::register($view);
$idMaster = $this->hasModel() ? Html::getInputId($this->model, $this->fromField) : $this->fromField;
$idSlave = $this->options['id'];
$view->registerJs("\n \$('#{$idMaster}').syncTranslit({\n destination: '{$idSlave}',\n type: 'url',\n caseStyle: 'lower',\n urlSeparator: '-'\n });");
}
示例2: renderItem
public function renderItem($message, $options)
{
echo Html::beginTag('div', $options) . "\n";
echo Html::beginTag('p');
echo $message;
echo Html::endTag('p');
echo "\n" . Html::endTag('div');
}
示例3: run
/**
* @inheritdoc
*/
public function run()
{
Html::addCssClass($this->containerOptions, ['widget' => 'dropdown actions']);
$options = $this->containerOptions;
$tag = ArrayHelper::remove($options, 'tag', 'div');
$this->registerPlugin('button');
return implode("\n", [Html::beginTag($tag, $options), $this->renderButton(), $this->renderItems(), Html::endTag($tag)]);
}
示例4: run
/**
* Renders the widget.
*/
public function run()
{
// @todo use [[options]] instead of [[containerOptions]] and introduce [[buttonOptions]] before 2.1 release
Html::addCssClass($this->containerOptions, ['widget' => 'btn-group']);
$options = $this->containerOptions;
$tag = ArrayHelper::remove($options, 'tag', 'div');
$this->registerPlugin('button');
return implode("\n", [Html::beginTag($tag, $options), $this->renderButton(), $this->renderDropdown(), Html::endTag($tag)]);
}
示例5: init
/**
* Initializes the widget.
*/
public function init()
{
if (!isset($this->options['id'])) {
$this->options['id'] = $this->getId();
}
$this->initOptions();
echo $this->renderToggleButton() . "\n";
echo Html::beginTag('div', ['class' => 'modal-dialog ' . $this->size]) . "\n";
echo Html::beginTag('div', ['class' => 'modal-content']) . "\n";
echo $this->renderHeader() . "\n";
echo $this->renderBodyBegin() . "\n";
}
示例6: run
/**
* @inheritdoc
*/
public function run()
{
parent::run();
// TODO: Change the autogenerated stub
if (!empty($this->country)) {
$class = 'flag-icon flag-icon-' . $this->country;
Html::addCssClass($this->options, $class);
if ($this->squared) {
Html::addCssClass($this->options, 'flag-icon-squared');
}
$this->register();
echo Html::beginTag('span', $this->options);
echo Html::endTag('span');
}
}
示例7: torMenu
public function torMenu($parent = null, $level = 1)
{
$links = Links::find()->where(['categories_id' => $this->categories_id, 'parent' => $parent])->orderBy(['seq' => SORT_ASC])->all();
$items = Html::beginTag('ul', ['class' => 'tor-nav-' . $level . ' ' . ($level > 2 ? 'list-unstyled' : 'list-inline')]);
/** @var $link Links */
foreach ($links as $link) {
$items .= '<li>' . Html::a($link->anchor, $link->url);
if ($link->child_exist == 1) {
if ($link->level == 1) {
$items .= '<span class="caret"></span>' . Html::tag('div', $this->torMenu($link->id, $link->level + 1), ['class' => 'tor-sub-nav']);
} else {
$items .= $this->torMenu($link->id, $link->level + 1);
}
}
$items .= '</li>';
}
$items .= Html::endTag('ul');
return $items;
}
示例8: renderInput
/**
* @return string render input
*/
protected function renderInput()
{
$input = Html::dropDownList($this->name, $this->selected, $this->items, $this->options);
// If use form model then $input use active input
if ($this->hasModel()) {
$input = Html::activeDropDownList($this->model, $this->attribute . '[status]', $this->items, $this->options);
}
$input .= Html::beginTag('div', ['id' => 'status_payment', 'style' => 'margin-top: 20px;']);
foreach ($this->columns as $status => $item) {
$input .= Html::beginTag('div', ['class' => 'status_payment', 'id' => 'status_payment_' . $status, 'style' => 'display: none']);
foreach ($item as $name => $info) {
$placeholder = isset($info['placeholder']) ? $info['placeholder'] : null;
$value = isset($info['value']) ? $info['value'] : null;
$input .= Html::activeInput('text', $this->model, $this->attribute . '[infomation][' . $name . ']', ['placeholder' => $placeholder, 'class' => $this->options['columnClass'], 'readonly' => '', 'value' => $value, 'style' => 'margin-top: 20px;']);
}
$input .= Html::endTag('div');
}
$input .= Html::endTag('div');
return $input;
}
示例9: init
/**
* @inheritdoc
*/
public function init()
{
if (!isset($this->options['id'])) {
$this->options['id'] = $this->getId();
}
if ($this->requiresDjax()) {
ob_start();
ob_implicit_flush(false);
$view = $this->getView();
$view->clear();
$view->beginPage();
$view->head();
$view->beginBody();
if ($view->title !== null) {
echo Html::tag('title', Html::encode($view->title));
}
} else {
echo Html::beginTag('div', $this->options);
}
}
示例10: run
public function run()
{
$formId = $this->formOptions['id'];
$this->getView()->registerCss("#{$formId} button {-webkit-box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);}");
$form = ActiveForm::begin(array_merge($this->defaultFormOptions, $this->formOptions));
print Html::beginTag('div', ['class' => 'row']);
print Html::beginTag('div', ['class' => 'col-xs-12']);
print Html::beginTag('div', ['class' => 'input-group']);
if ($this->inputWidget) {
print $form->field($this->model, $this->attribute, ['template' => '{input}'])->widget($this->inputWidget, $this->inputOptions);
} else {
print $form->field($this->model, $this->attribute, ['template' => '{input}'])->input($this->inputType, array_merge(['placeholder' => $this->model->getAttributeLabel($this->attribute), 'class' => 'form-control'], $this->inputOptions));
}
print Html::beginTag('span', ['class' => 'input-group-btn']);
print Html::submitButton(Yii::t('hipanel', 'Search'), ['class' => 'btn btn-flat ' . $this->buttonColor]);
print Html::endTag('span');
print Html::endTag('div');
print Html::endTag('div');
print Html::endTag('div');
ActiveForm::end();
}
示例11: settingField
/**
* @param $item
* @return string
*/
public static function settingField($key, $item, $traslateCategory)
{
$return = '';
switch ($item['type']) {
case 'checkbox':
$return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::hiddenInput('Settings[' . $key . ']', 0) . \oakcms\bootstrapswitch\Switcher::widget(['id' => 'wid' . uniqid(), 'name' => 'Settings[' . $key . ']', 'checked' => $item['value']]) . parent::endTag('div') . parent::endTag('div');
break;
case 'textInput':
$return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::textInput('Settings[' . $key . ']', $item['value'], ['class' => 'form-control']) . parent::endTag('div') . parent::endTag('div');
break;
case 'textarea':
$return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::textarea('Settings[' . $key . ']', $item['value'], ['class' => 'form-control']) . parent::endTag('div') . parent::endTag('div');
break;
case 'mediaInput':
$return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . InputFile::widget(['id' => 'wid' . uniqid(), 'language' => \Yii::$app->language, 'filter' => 'image', 'name' => 'Settings[' . $key . ']', 'value' => $item['value']]) . parent::endTag('div') . parent::endTag('div');
break;
default:
$return = '';
break;
}
return $return;
}
示例12: generateTemplateSetting
/**
* Ham generate template widget khi move vao postion.
* @param string $containerId id cua container
* @param string $positionId id cua position
* @param string $widgetId id cua widget trong mang data cua diy
* @param string $id id cua widget
* @param array $settings Mang gia tri cua cac option
* @return string
*/
public static function generateTemplateSetting($containerId, $positionId, $widgetId, $id, $settings)
{
// Get widget info by id
$model = self::find()->where(['_id' => $id])->one();
$templateSetting = null;
if ($model) {
// Template widget
$templateSetting .= Html::beginTag('div', ['class' => 'let_widget row', 'data-id' => $id, 'id' => $widgetId]);
$templateSetting .= Html::beginTag('div', ['class' => 'btn btn-info']);
$templateSetting .= $model->title;
$templateSetting .= Html::endTag('div');
// Begin button widget
$templateSetting .= Html::beginTag('div', ['class' => 'pull-right']);
$templateSetting .= Html::beginTag('div', ['class' => 'btn-group buttonDeleteWidget']);
$templateSetting .= Html::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'button', 'class' => 'btn btn-danger btn-xs', 'onclick' => 'deleteItems(this, "w", ".let_widget");']);
$templateSetting .= Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type' => 'button', 'class' => 'btn btn-success btn-xs', 'onclick' => 'accordionWidget("' . $widgetId . '");']);
$templateSetting .= Html::endTag('div');
$templateSetting .= Html::endTag('div');
// End button widget
$templateSetting .= Html::beginTag('div', ['class' => 'row setting_widget', 'id' => 'setting_widget_' . $widgetId, 'style' => 'margin-top: 20px; display: none;', 'data-show' => 0, 'data-container' => $containerId, 'data-position' => $positionId, 'data-id' => $widgetId]);
// Begin template setting.
$templateSetting .= Html::beginForm(NULL, 'POST', ['role' => 'form', 'id' => 'settingForm']);
if (!empty($model->setting)) {
foreach ($model->setting as $keySetting => $config) {
// Kieu hien thi cua setting
$type = ArrayHelper::getValue($config, 'type');
// Gia tri cua setting
$value = ArrayHelper::getValue($settings, $keySetting);
// Danh sach cac gia tri cua setting neu la dropdown, checkbox, radio
$items = ArrayHelper::getValue($config, 'items');
$templateSetting .= Html::beginTag('div', ['class' => 'form-group field-setting-key']);
$templateSetting .= Html::beginTag('label', ['class' => 'control-label col-sm-2', 'for' => 'DiyWidget-' . $keySetting . '']);
$templateSetting .= $keySetting;
$templateSetting .= Html::endTag('label');
$templateSetting .= Html::beginTag('div', ['class' => 'col-sm-10']);
$templateSetting .= self::getInputByType($type, $templateSetting, $keySetting, $value, $items);
$templateSetting .= Html::beginTag('div', ['class' => 'help-block help-block-error help-block m-b-none']) . Html::endTag('div');
$templateSetting .= Html::endTag('div');
// End .col-sm-10
$templateSetting .= Html::endTag('div');
// End .field-setting-key
}
}
// Begin button save
$templateSetting .= Html::beginTag('div', ['class' => 'col-sm-12']);
$templateSetting .= Html::beginTag('div', ['class' => 'pull-right']);
$templateSetting .= Html::button(Yii::t('diy', 'Save'), ['type' => 'button', 'class' => 'btn btn-success', 'onclick' => 'saveSettingsWidget(this);']);
$templateSetting .= Html::endTag('div');
$templateSetting .= Html::endTag('div');
// End button save
$templateSetting .= Html::endForm();
// End template setting
$templateSetting .= Html::endTag('div');
// End .row
$templateSetting .= Html::endTag('div');
// End .let_widget
}
return $templateSetting;
}
示例13: 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;
}
示例14:
<?php
use yii\bootstrap\Html;
if ($link == true) {
echo Html::beginTag('a', $linkOptions);
}
echo Html::beginTag('div', $acronymHtmlOptions);
echo $acronym;
echo Html::endTag('div');
echo Html::img($space->getProfileImage()->getUrl(), $imageHtmlOptions);
if ($link == true) {
echo Html::endTag('a');
}
示例15:
echo Html::beginTag('div', ['class' => 'col-sm-10']);
if ($model->type === 'text') {
echo Html::textInput('setting[' . (string) $model->_id . ']', $model->value, ['class' => 'form-control']);
} else {
if ($model->type === 'dropdown') {
echo Html::dropDownList('setting[' . (string) $model->_id . ']', $model->value, $model->items, ['class' => 'form-control']);
} else {
if ($model->type === 'checkbox') {
echo Html::checkboxList('setting[' . (string) $model->_id . ']', $model->value, $model->items, ['class' => 'i-checks', 'separator' => '<br />']);
} else {
if ($model->type === 'radio') {
echo Html::radioList('setting[' . (string) $model->_id . ']', $model->value, $model->items, ['class' => 'i-checks', 'separator' => '<br />']);
}
}
}
}
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::beginTag('div', ['class' => 'hr-line-dashed']);
echo Html::endTag('div');
}
ActiveForm::end();
?>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>