См. также: http://getbootstrap.com/css
См. также: http://getbootstrap.com/components
С версии: 2.0
Автор: Kartik Visweswaran (kartikv2@gmail.com)
Наследование: extends yii\helpers\Html
Пример #1
1
 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
1
    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);
    }
Пример #3
0
    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();
    }
Пример #4
0
 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]);
 }
Пример #5
0
 /**
  * @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;
 }
Пример #6
0
 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;
 }
Пример #7
0
 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;
 }
Пример #8
0
 /**
  * @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);
 }
Пример #9
0
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']);
    }
}
Пример #10
0
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;
}
Пример #11
0
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']);
    }
}
Пример #12
0
 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();
 }
Пример #13
0
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']);
    }
}
Пример #14
0
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;
}
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;
}
Пример #16
0
function toExportExcel()
{
    $title = Yii::t('app', 'Excel');
    $options = ['id' => 'export-excel', 'class' => 'btn btn-default btn-sm'];
    $icon = '<span class="glyphicon glyphicon-search"></span>';
    $label = $icon . ' ' . $title;
    $url = Url::toRoute(['#']);
    $content = Html::a($label, $url, $options);
    return $content;
}
Пример #17
0
function kembali()
{
    $title = Yii::t('app', '');
    $options = ['id' => 'berita-reply-id', 'class' => 'btn-xs', 'title' => 'Back'];
    $icon = '<span class="fa fa-rotate-left fa-xs"> Back</span>';
    $label = $icon . ' ' . $title;
    //$label = 'Reply';
    $url = Url::toRoute('/widget/chat');
    $content = Html::a($label, $url, $options);
    return $content;
}
Пример #18
0
/**
 * Performance Employee
 * @author ptrnov  <*****@*****.**>
 * @since 1.1
 */
function tombolMap()
{
    $title1 = Yii::t('app', 'Map');
    $options1 = ['id' => 'performance'];
    $icon1 = '<span class="fa fa-graduation-cap fa-md"></span>';
    $label1 = $icon1 . ' ' . $title1;
    $url1 = Url::toRoute(['/master/customers/esm-map']);
    //,'kd'=>$kd]);
    $content = Html::a($label1, $url1, $options1);
    return $content;
}
 /**
  * @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);
     }
 }
Пример #20
0
function tombolCreate()
{
    $title1 = Yii::t('app', 'Create');
    $options1 = ['id' => 'modl', 'data-toggle' => "modal", 'data-target' => "#form2", 'class' => 'btn btn-success btn-sm'];
    $icon1 = '<i class="glyphicon glyphicon-plus"></i>';
    $label1 = $icon1 . ' ' . $title1;
    $url1 = Url::toRoute(['/mastercrm/kota-customers-crm/createkota']);
    //,'kd'=>$kd]);
    $content = Html::a($label1, $url1, $options1);
    return $content;
}
Пример #21
0
/**
 * Logoff
 * @author ptrnov  <*****@*****.**>
 * @since 1.1
 */
function tombolLentera()
{
    $title1 = Yii::t('app', ' . . . read-more');
    $options1 = ['id' => 'lentera', 'data-target' => "#dashboard-lentera", 'style' => 'color:rgba(255, 255, 19, 1)'];
    //$icon1 = '<span class="fa fa-power-off fa-lg"></span>';
    $label1 = $title1;
    //$icon1 . ' ' . $title1;
    $url1 = Url::toRoute(['/sistem/user-profile/lentera']);
    //,'kd'=>$kd]);
    $content = Html::a($label1, $url1, $options1);
    return $content;
}
Пример #22
0
function statusIssue($model)
{
    if ($model->STATUS == 1) {
        /*REVIEW*/
        return Html::a('<i class="fa fa-square-o fa-md"></i> REVIEW', '#', ['class' => 'btn btn-info btn-xs', 'style' => ['width' => '100px'], 'title' => 'Review']);
    } elseif ($model->STATUS == 2) {
        /*PROCESS*/
        return Html::a('<i class="fa fa-check-square-o fa-md"></i> PROCESS', '#', ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'Process']);
    } elseif ($model->STATUS == 3) {
        /*CLODED*/
        return Html::a('<i class="glyphicon glyphicon-remove"></i> CLOSED', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Closed']);
    }
}
Пример #23
0
function statusTerm($model)
{
    if ($model['STATUS'] == 0) {
        /*New*/
        return Html::a('<i class="fa fa-square-o fa-md"></i> New', '#', ['class' => 'btn btn-info btn-xs', 'style' => ['width' => '100px'], 'title' => 'New']);
    } elseif ($model['STATUS'] == 1) {
        /*Approved*/
        return Html::a('<i class="fa fa-check-square-o fa-md"></i>Approved', '#', ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'Approved']);
    } elseif ($model['STATUS'] == 3) {
        /*REJECT*/
        return Html::a('<i class="fa fa-remove fa-md"></i>Reject ', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Reject']);
    }
}
Пример #24
0
 public function init()
 {
     if (!isset($this->resetLinkOptions['title'])) {
         $this->resetLinkOptions['title'] = Yii::t('user', 'Click here to reset your lost password.');
     }
     Module::validateConfig($this->_module);
     $this->attributes += ['username' => ['type' => Form::INPUT_TEXT], 'password' => ['type' => Form::INPUT_PASSWORD], 'rememberMe' => ['type' => Form::INPUT_CHECKBOX]];
     $resetLink = Html::a(Yii::t('user', 'Forgot password?'), Url::to($this->_module->actionSettings[Module::ACTION_RECOVERY]), $this->resetLinkOptions);
     if (!isset($this->buttons)) {
         $this->buttons = $resetLink . '&nbsp; {submit}';
     }
     $this->submitButtonOptions += ['label' => Yii::t('user', 'Login'), 'icon' => 'log-in', 'class' => 'btn btn-primary'];
     parent::init();
 }
Пример #25
0
 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();
 }
Пример #26
0
function statusIssue($model)
{
    if ($model->STATUS == 1) {
        /*REVIEW*/
        // return Html::a('<i class="fa fa-square-o fa-md"></i> REVIEW','#',['class'=>'btn btn-info btn-xs', 'style'=>['width'=>'100px'],'title'=>'Review']);
        return Html::button(Yii::t('app', 'Review'), ['value' => url::to(['link-berita', 'id' => $model->ID]), 'id' => 'modal-btn-issue', 'class' => "btn btn-info btn-xs", 'style' => ['width' => '100px']]);
    } elseif ($model->STATUS == 2) {
        /*PROCESS*/
        return Html::a('<i class="fa fa-check-square-o fa-md"></i> OPEN', url::toRoute(['/widget/berita/detail-berita-open', 'id' => $model->ID_ISSUE_REF]), ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'Process']);
    } elseif ($model->STATUS == 3) {
        /*CLODED*/
        return Html::a('<i class="glyphicon glyphicon-remove"></i> CLOSED', url::toRoute(['/widget/berita/detail-berita-open', 'id' => $model->ID_ISSUE_REF]), ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Closed']);
    }
}
Пример #27
0
 /**
  * @return array [[DropDownList]]
  */
 public static function getOrderStatusArray($asHtml = false)
 {
     $cacheKey = 'OrderStatusItems:' . implode(':', [intval($asHtml)]);
     $items = Yii::$app->cache->get($cacheKey);
     if ($items !== false) {
         return $items;
     }
     $data = self::find()->select(['order_status_id', 'name', 'color'])->orderBy('name ASC')->asArray()->all();
     $cache_tags = [ActiveRecordHelper::getCommonTag(static::className())];
     foreach ($data as $val) {
         $key = $val['order_status_id'];
         $items[$key] = $asHtml ? Html::badge($val['name'], ['class' => 'btn btn-xs btn-block ' . $val['color']]) : $val['name'];
         $cache_tags[] = ActiveRecordHelper::getObjectTag(static::className(), $key);
     }
     Yii::$app->cache->set($cacheKey, $items, 86400, new TagDependency(['tags' => $cache_tags]));
     return $items;
 }
Пример #28
0
 public function run()
 {
     $months = [0 => 'Январь', 1 => 'Февраль', 2 => 'Март', 3 => 'Апрель', 4 => 'Май', 5 => 'Июнь', 6 => 'Июль', 7 => 'Август', 8 => 'Сентябрь', 9 => 'Октябрь', 10 => 'Ноябрь', 11 => 'Декабрь'];
     $time = time();
     $request = \Yii::$app->request;
     $time = $request->get('time', $time);
     $month = date('n', $time);
     $year = date('Y', $time);
     echo '<div class="b-calendar b-calendar--along">';
     echo '<h4 class="text-center">';
     echo Html::a(Html::icon('triangle-left'), '?time=' . strtotime('-1 month', $time), ['class' => 'pull-left']);
     echo $months[$month - 1] . '&nbsp;' . $year;
     echo Html::a(Html::icon('triangle-right'), '?time=' . strtotime('+1 month', $time), ['class' => 'pull-right']);
     echo '</h4>';
     echo $this->draw_calendar($month, 2016);
     echo '</div>';
 }
Пример #29
0
 /**
  * 
  * @param type $name
  * @param array $config
  */
 public static function getIcon($input, array $config = [])
 {
     //Lookup DB Value corresponding to input
     $model = models\IconRegister::findOne(['name' => $input]);
     $icon = NULL;
     if (!isset($model) || $model->framework_id == 'bdg') {
         $icon = isset($model) ? $model->icon : $input;
         $config['as_badge'] = TRUE;
     } else {
         $icon = Html::icon($model->icon, $config, $model->framework_id == 'bsg' ? 'glyphicon glyphicon-' : 'fa fa-fw fa-');
     }
     $output = $icon;
     if (isset($config['as_badge']) && $config['as_badge'] == TRUE) {
         $output = Html::badge($output . ' ' . (isset($config['label']) && isset($config['label_as_badge']) ? $config['label'] : ''), $config);
     }
     $label = isset($config['label']) && !isset($config['label_as_badge']) ? ' ' . $config['label'] : '';
     return $output . $label;
 }
Пример #30
0
    public function run()
    {
        if ($imageUrl = $this->model->getFileUrl($this->attribute)) {
            ?>
            <div class="file-input">
                <div class="file-preview">
                    <div class="file-preview-thumbnails">
                        <div class="file-preview-frame">
                            <?php 
            echo Html::img($imageUrl, ['class' => 'file-preview-image', 'alt' => \Yii::t('gromver.platform', 'File not found.')]);
            ?>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        <?php 
        }
        if ($imageUrl == null) {
            // to show FileInput only for new upload
            echo KartikFileInput::widget(['model' => $this->model, 'attribute' => $this->attribute, 'options' => $this->options, 'pluginOptions' => $this->pluginOptions]);
        } else {
            FileInputAsset::register($this->getView());
            ?>
            <div class="file-input">
                <div class="input-group">
                    <div class="form-control file-caption ">
                        <span class="glyphicon glyphicon-file"></span> <span class="file-caption-name"><?php 
            echo $this->model->getFileName($this->attribute);
            ?>
</span>
                    </div>
                    <div class="input-group-btn">
                        <?php 
            echo Html::a('Remove Image', [$this->deleteAction, 'pk' => $this->model->getPrimaryKey(), 'attribute' => $this->attribute], ['class' => 'btn btn-danger', 'data-method' => 'post']);
            ?>
                    </div>
                </div>

            </div>
        <?php 
        }
    }