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


PHP helpers\Html类代码示例

本文整理汇总了PHP中kartik\helpers\Html的典型用法代码示例。如果您正苦于以下问题:PHP Html类的具体用法?PHP Html怎么用?PHP Html使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Html类的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"]);
 }
开发者ID:promo-pr,项目名称:cms,代码行数:7,代码来源:AjaxForm.php

示例2: run

    function run()
    {
        parent::run();
        $wid = $this->options['id'];
        echo Html::activeHiddenInput($this->model, $this->attribute);
        echo Html::beginTag('div', ['id' => $wid . '-buttons', 'class' => 'input-group btn-group']);
        $items = PublishBehavior::getPublishedOptions();
        $colors = PublishBehavior::getPublishedColors();
        foreach ($items as $key => $item) {
            echo Html::button($item, ['data' => ['value' => $key], 'class' => $key == $this->model->{$this->attribute} ? 'btn btn-' . $colors[$key] . ' active' : 'btn btn-default']);
        }
        echo Html::endTag('div');
        $js_colors = Json::encode($colors);
        $js = <<<JS
 \$('#{$wid}-buttons').find('button').each(function(){
   \$(this).on('click',function(){
     \$('#{$wid}-buttons').find('button').each(function(){
        \$(this).removeClass('btn-danger btn-warning btn-success btn-info active');
        \$(this).addClass('btn-default');
     });
     var color={$js_colors};
     \$(this).removeClass('btn-default');
     \$(this).addClass('btn-'+color[\$(this).data('value')]+' active');
     \$('#{$wid}').val(\$(this).data('value'))
   });  
});               
JS;
        $this->view->registerJs($js);
    }
开发者ID:claudejanz,项目名称:yii2-toolbox,代码行数:29,代码来源:PublishWidget.php

示例3: init

    public function init()
    {
        if (is_array($this->copyFrom)) {
            $id = Html::getInputId($this->model, $this->attribute);
            $buttonId = $id . '-copyButton';
            $this->addon['append'] = ['content' => Html::button(Icon::show('code'), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true];
            $encodedFrom = Json::encode($this->copyFrom);
            $encodedTo = Json::encode('#' . $id);
            $js = <<<EOT
\$("#{$buttonId}").click(function(){
Admin.copyFrom(
    {$encodedFrom},
    {$encodedTo}
);
});
EOT;
            $this->form->getView()->registerJs($js);
        } elseif (is_array($this->makeSlug)) {
            $id = Html::getInputId($this->model, $this->attribute);
            $buttonId = $id . '-slugButton';
            $this->addon['append'] = ['content' => Html::button(Icon::show('code'), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true];
            $encodedFrom = Json::encode($this->makeSlug);
            $encodedTo = Json::encode('#' . $id);
            $js = <<<EOT
\$("#{$buttonId}").click(function(){
Admin.makeSlug(
    {$encodedFrom},
    {$encodedTo}
);
});
EOT;
            $this->form->getView()->registerJs($js);
        }
        parent::init();
    }
开发者ID:heartshare,项目名称:dotplant2,代码行数:35,代码来源:ActiveField.php

示例4: 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]);
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:34,代码来源:OptionGenerate.php

示例5: 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;
 }
开发者ID:promo-pr,项目名称:cms,代码行数:11,代码来源:SetColumn.php

示例6: 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;
 }
开发者ID:promo-pr,项目名称:cms,代码行数:8,代码来源:RoleColumn.php

示例7: preNext

 public static function preNext()
 {
     $offset = max(0, \yii::$app->request->get('filter_offset', 0));
     $limit = \yii::$app->request->get('filter_limit', 100);
     $q = \yii::$app->request->queryParams;
     $panel = '<div class="btn-group" role="group">' . Html::a("上一页", array_merge($q, [\yii::$app->controller->action->id, 'filter_limit' => $limit, 'filter_offset' => $offset - $limit > 0 ? $offset - $limit : 0]), ['class' => 'btn btn-default']) . Html::a("下一页", array_merge($q, [\yii::$app->controller->action->id, 'filter_limit' => $limit, 'filter_offset' => $offset + $limit]), ['class' => 'btn btn-default']) . '</div>';
     return $panel;
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:8,代码来源:Page.php

示例8: renderDataCellContent

 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $value = $this->getDataCellValue($model, $key, $index);
     $text = $this->grid->formatter->format($value, $this->format);
     $url = $this->createUrl($model, $key, $index);
     $options = $this->targetBlank ? ['target' => '_blank'] : [];
     return $value === null ? $this->grid->emptyCell : Html::a($text, $url, $options);
 }
开发者ID:promo-pr,项目名称:cms,代码行数:11,代码来源:LinkColumn.php

示例9: statusRadius

function statusRadius($model)
{
    if ($model->sttKoordinat == 1) {
        return Html::a('<i class="glyphicon glyphicon-ok"></i> Suitable', '#', ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
    } elseif ($model->sttKoordinat == 2) {
        return Html::a('<i class="glyphicon glyphicon-time"></i> Deviate', '#', ['class' => 'btn btn-warning btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
    } elseif ($model->sttKoordinat == 3) {
        return Html::a('<i class="glyphicon glyphicon-thumbs-down"></i> Missing', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
    }
}
开发者ID:adem-team,项目名称:advanced,代码行数:10,代码来源:index.php

示例10: tombolInvestInput

function tombolInvestInput($id)
{
    $title = Yii::t('app', 'Investment input');
    $options = ['id' => 'input-invest', 'data-toggle' => "modal", 'data-target' => "#input-invest-actual", 'class' => 'btn btn-info btn-sm'];
    $icon = '<span class="glyphicon glyphicon-search"></span>';
    $label = $icon . ' ' . $title;
    $url = Url::toRoute(['/purchasing/data-term/actual-review-add', 'id' => $id]);
    $content = Html::a($label, $url, $options);
    return $content;
}
开发者ID:adem-team,项目名称:advanced,代码行数:10,代码来源:actual_review.php

示例11: status

function status($model)
{
    if ($model->STT_DEFAULT == 0) {
        return Html::a('<i class="glyphicon glyphicon-retweet"></i> Non Aktif', '#', ['class' => 'btn btn-warning btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
    } elseif ($model->STT_DEFAULT == 1) {
        return Html::a('<i class="glyphicon glyphicon-ok"></i> Aktif', '#', ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
    } else {
        return Html::a('<i class="glyphicon glyphicon-question-sign"></i> Unknown', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Detail']);
    }
}
开发者ID:adem-team,项目名称:advanced,代码行数:10,代码来源:index.php

示例12: init

 public function init()
 {
     echo Html::activeHiddenInput($this->model, $this->attribute, $this->options);
     echo Html::error($this->model, $this->attribute, $this->options);
     $id = Html::getInputId($this->model, $this->attribute);
     echo FileInput::widget(['name' => 'file', 'options' => ['accept' => 'image/*', 'multiple' => false], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index) {
                 $("#' . $id . '").val(data.response.url);
             }'], 'pluginOptions' => ['initialPreview' => $this->model->{$this->attribute} ? [Html::img($this->model->{$this->attribute}, ['class' => 'file-preview-image'])] : false, 'maxFileCount' => 1, 'minFileCount' => 1, 'previewFileType' => 'image', 'multiple' => false, 'showPreview' => true, 'showUploadedThumbs' => false, 'uploadUrl' => \yii\helpers\Url::to(['/system/image/upload'])]]);
     parent::init();
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:10,代码来源:VipFileInput.php

示例13: sttPembukuan

function sttPembukuan($model)
{
    if ($model->STATUS == 0) {
        /*open*/
        return Html::a('<i class="glyphicon glyphicon-ok"></i> proses', '#', ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'process']);
    } elseif ($model->STATUS == 1) {
        /*closing*/
        return Html::a('<i class="fa fa-remove fa-md"></i> Closing', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '25px'], 'title' => 'Closing']);
    }
}
开发者ID:ptrnov,项目名称:ubudsatu,代码行数:10,代码来源:index.php

示例14: tombolInvest

function tombolInvest()
{
    $title = Yii::t('app', 'Account Investment');
    $options = ['id' => 'account-invest', 'data-toggle' => "modal", 'data-target' => "#check-barang-umum", 'class' => 'btn btn-info btn-sm'];
    $icon = '<span class="glyphicon glyphicon-search"></span>';
    $label = $icon . ' ' . $title;
    $url = Url::toRoute(['#']);
    $content = Html::a($label, $url, $options);
    return $content;
}
开发者ID:adem-team,项目名称:advanced,代码行数:10,代码来源:_viewData.php

示例15: tombolEditketerangan

function tombolEditketerangan($model)
{
    $title = Yii::t('app', '');
    $options = ['id' => 'edit-keterangan', 'data-toggle' => "modal", 'data-target' => "#keterangan", 'class' => 'btn btn-info btn-xs'];
    $icon = '<span class="glyphicon glyphicon-save"></span>';
    $label = $icon . ' ' . $title;
    $url = Url::toRoute(['/widget/berita/set-keterangan', 'id' => $model->KD_BERITA]);
    $content = Html::a($label, $url, $options);
    return $content;
}
开发者ID:adem-team,项目名称:advanced,代码行数:10,代码来源:_view_detailberita_headline.php


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