Beispiel #1
4
 /**
  * @inheritdoc
  */
 public function run()
 {
     $jsOptions = ['clientOptions' => $this->clientOptions];
     $this->options['id'] = 'input-id';
     if ($this->hasModel()) {
         echo Html::activeInput('file', $this->model, $this->attribute, $this->options);
         echo Html::img('#', ['id' => 'cropper-box']);
         echo Html::button('Crop', ['id' => 'cropImage']);
         $input_name = Html::getInputName($this->model, $this->attribute);
         $input_id = Html::getInputId($this->model, $this->attribute);
         echo Html::hiddenInput($input_name . '[file]', '', ['id' => $input_id . '_image']);
         $jsOptions['model'] = $this->model;
         $jsOptions['attribute'] = $this->attribute;
     } else {
         echo Html::fileInput($this->name, $this->value, $this->options);
         echo Html::img('#', ['id' => 'cropper-box']);
         echo Html::button('Crop', ['id' => 'cropImage']);
     }
     if ($this->uploadUrl) {
         $this->uploadUrl = \Yii::getAlias($this->uploadUrl);
     }
     $jsOptions['uploadUrl'] = $this->uploadUrl;
     $jsOptions['uploadCroppedUrl'] = $this->uploadCroppedUrl;
     $jsOptions['changeUrl'] = $this->changeUrl;
     $jsOptions['name'] = $this->name;
     $jsOptions['aspectRatio'] = $this->aspectRatio;
     $this->registerPlugin($jsOptions);
 }
Beispiel #2
3
 public function run()
 {
     $elements = $this->cart->elements;
     if (empty($elements)) {
         $cart = Html::tag('div', yii::t('cart', 'Your cart empty'), ['class' => 'pistol88-cart pistol88-empty-cart']);
     } else {
         $cart = Html::ul($elements, ['item' => function ($item, $index) {
             return $this->_row($item);
         }, 'class' => 'pistol88-cart-list']);
     }
     if (!empty($elements)) {
         $bottomPanel = '';
         if ($this->showTotal) {
             $bottomPanel .= Html::tag('div', Yii::t('cart', 'Total') . ': ' . yii::$app->cart->cost . ' ' . yii::$app->cart->currency, ['class' => 'pistol88-cart-total-row']);
         }
         if ($this->offerUrl && $this->showOffer) {
             $bottomPanel .= Html::a(yii::t('cart', 'Offer'), $this->offerUrl, ['class' => 'pistol88-cart-offer-button btn btn-success']);
         }
         if ($this->showTruncate) {
             $bottomPanel .= TruncateButton::widget();
         }
         $cart .= Html::tag('div', $bottomPanel, ['class' => 'pistol88-cart-bottom-panel']);
     }
     $cart = Html::tag('div', $cart, ['class' => 'pistol88-cart']);
     if ($this->type == self::TYPE_DROPDOWN) {
         $button = Html::button($this->textButton . Html::tag('span', '', ["class" => "caret"]), ['class' => 'btn dropdown-toggle', 'id' => 'pistol88-cart-drop', 'type' => "button", 'data-toggle' => "dropdown", 'aria-haspopup' => 'true', 'aria-expanded' => "false"]);
         $list = Html::tag('div', $cart, ['class' => 'dropdown-menu', 'aria-labelledby' => 'pistol88-cart-drop']);
         $cart = Html::tag('div', $button . $list, ['class' => 'pistol88-cart-dropdown dropdown']);
     }
     return Html::tag('div', $cart, ['class' => 'pistol88-cart-block']);
 }
Beispiel #3
1
 /**
  * Modal box for ajax requests
  * 
  * @param $id
  * @param $header
  * @param $content
  * @param null $footer
  * @param null $style
  * @return string
  */
 public static function frame($id, $header, $content, $footer = null, $modalStyle = null, $modalDialogStyle = null)
 {
     if (is_null($footer)) {
         $footer = Html::button('Bezárás', ['class' => 'btn btn-default', 'data-dismiss' => 'modal']);
     }
     if (!is_null($header)) {
         $header = '<h4 class="modal-title">' . $header . '</h4>';
     }
     return '<div id="myModalBox' . $id . '" class="fade modal" role="dialog" tabindex="-1" style="' . $modalStyle . '" data-backdrop="static">
                 <div class="modal-dialog" style="' . $modalDialogStyle . '">
                     <div class="modal-content">
                       <div class="modal-header">
                         <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                         ' . $header . '
                       </div>
                       <div class="modal-body">
                         ' . $content . '
                       </div>
                       <div class="modal-footer">
                         ' . $footer . '
                       </div>
                     </div><!-- /.modal-content -->
               </div>
             </div>';
 }
Beispiel #4
1
 /**
  * @return string bootstrap-picker button with hiddenInput field where we put selected value
  */
 public function run()
 {
     if ($this->hasModel()) {
         $inp = Html::activeHiddenInput($this->model, $this->attribute, $this->options);
     } else {
         $inp = Html::hiddenInput($this->name, $this->value, $this->options);
     }
     $picker = Html::button('Выберите иконку', $this->pickerOptions);
     return Html::tag('div', $picker . $inp, $this->containerOptions);
 }
Beispiel #5
0
 protected function renderButtonAdd()
 {
     Html::addCssClass($this->buttonOptions, 'btn');
     $this->buttonOptions = ArrayHelper::merge($this->buttonOptions, ['role' => 'area.add', 'data-tmpl' => $this->options['id']]);
     $templateButtonAdding = strtr($this->templateButtonAdding, ['{button}' => Html::button('+', $this->buttonOptions), '{label}' => Html::tag('label', $this->label)]);
     echo Html::tag('div', $templateButtonAdding, ['class' => 'form-group']);
 }
Beispiel #6
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     if (!$this->visible) {
         return "";
     }
     return Html::button($this->label, $this->options);
 }
 /**
  * Renders the widget.
  */
 public function run()
 {
     $this->registerClientScript();
     $button = Html::button(FontAwesome::icon('picture-o') . ' ' . $this->buttonLabel, $this->buttonOptions);
     $thumbs = '<ul class="kcf-thumbs" id="' . $this->getThumbsId() . '"></ul>';
     echo Html::tag('div', strtr($this->template, ['{button}' => $button, '{thumbs}' => $thumbs]), ['class' => 'kcf-input-group']);
 }
Beispiel #8
0
    private function initializeModal(){

        Modal::begin([
            'id' => 'activity-modal',
            'size' => $this->size,
            'header' => '<h2>'. $this->modelTitle .'</h2>',
            'footer' => Html::button('Close', ['class' => 'btn btn-info', 'data-dismiss' => 'modal']),
        ]);

        Modal::end();

//        Modal::begin([
//            'id' => 'activity-delete-modal',
//            'header' => '<h2>'. $this->deleteModelTitle .'</h2>',
//            'footer' => Html::button('Close', ['class' => 'btn btn-default', 'data-dismiss' => 'modal'])
//                . PHP_EOL . Html::button('Delete', [
//                    'class' => 'btn btn-primary btn-modal-save',
//                    'id' => 'delete-role-model',
//                    'data-id' => '',
//                    'onClick' => new JsExpression('var id=$("#delete-role-model").attr("data-id");$.ajax({type:"'. $this->deleteVerb .'",url:"'.$this->deleteUrl.'",data:{id:id},success:function(){$.pjax.reload({container:"#'. $this->pjaxContainerId .'",timeout:2e3}),$("#activity-delete-modal").modal("hide")}});')
//                ]),
//        ]);
//        echo 'Are You Sure To Delete This Item';
//        Modal::end();

    }
 /**
  * Creates a new ProyectoDistribucionPresupuestaria model.
  * For ajax request will return json object
  * and for non-ajax request if creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($proyecto)
 {
     $request = Yii::$app->request;
     $model = new ProyectoDistribucionPresupuestaria();
     $model->id_proyecto = $proyecto;
     if ($request->isAjax) {
         /*
          *   Process for ajax request
          */
         Yii::$app->response->format = Response::FORMAT_JSON;
         if ($request->isGet) {
             return ['title' => "Create new ProyectoDistribucionPresupuestaria", 'content' => $this->renderPartial('create', ['model' => $model]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
         } else {
             if ($model->load($request->post()) && $model->save()) {
                 return ['forceReload' => 'true', 'title' => "Create new ProyectoDistribucionPresupuestaria", 'content' => '<span class="text-success">Create ProyectoDistribucionPresupuestaria success</span>', 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::a('Create More', ['create'], ['class' => 'btn btn-primary', 'role' => 'modal-remote'])];
             } else {
                 return ['title' => "Create new ProyectoDistribucionPresupuestaria", 'content' => $this->renderPartial('create', ['model' => $model]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
             }
         }
     } else {
         /*
          *   Process for non-ajax request
          */
         if ($model->load($request->post()) && $model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             return $this->render('create', ['model' => $model]);
         }
     }
 }
Beispiel #10
0
function tombolCreate()
{
    if (getPermission()) {
        if (getPermission()->BTN_CREATE == 1) {
            $title1 = Yii::t('app', 'NEW PO');
            $options1 = ['id' => 'po-create', 'data-toggle' => "modal", 'data-target' => "#new-po", 'class' => 'btn btn-warning btn-sm'];
            $icon1 = '<span class="fa fa-plus fa-lg"></span>';
            $label1 = $icon1 . ' ' . $title1;
            $content = Html::button($label1, $options1);
            return $content;
        } else {
            $title1 = Yii::t('app', 'CREATE NEW PO');
            $options1 = ['id' => 'po-create', 'class' => 'btn btn-warning btn-sm', 'data-confirm' => 'Permission Failed !'];
            $icon1 = '<span class="fa fa-plus fa-lg"></span>';
            $label1 = $icon1 . ' ' . $title1;
            $content = Html::button($label1, $options1);
            return $content;
        }
    } else {
        $title1 = Yii::t('app', 'CREATE NEW PO');
        $options1 = ['id' => 'ro-create', 'class' => 'btn btn-warning btn-sm', 'data-confirm' => 'Permission Failed !'];
        $icon1 = '<span class="fa fa-plus fa-lg"></span>';
        $label1 = $icon1 . ' ' . $title1;
        $content = Html::button($label1, $options1);
        return $content;
    }
}
 /**
  * Creates a new UePartidaEntidad model.
  * For ajax request will return json object
  * and for non-ajax request if creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $request = Yii::$app->request;
     $model = new UePartidaEntidad();
     $ue = ArrayHelper::map(UnidadEjecutora::find()->asArray()->all(), 'id', 'nombre');
     $tipo_entidad = ArrayHelper::map(TipoEntidad::find()->asArray()->all(), 'id', 'nombre');
     if (!$request->isAjax) {
         /*
          *   Process for ajax request
          */
         Yii::$app->response->format = Response::FORMAT_JSON;
         if ($request->isGet) {
             return ['title' => "Create new UePartidaEntidad", 'content' => $this->renderAjax('create', ['model' => $model, 'ue' => $ue, 'tipo_entidad' => $tipo_entidad]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
         } else {
             if ($model->load($request->post()) && $model->save()) {
                 return ['forceReload' => '#crud-datatable-pjax', 'title' => "Create new UePartidaEntidad", 'content' => '<span class="text-success">Create UePartidaEntidad success</span>', 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::a('Create More', ['create'], ['class' => 'btn btn-primary', 'role' => 'modal-remote'])];
             } else {
                 return ['title' => "Create new UePartidaEntidad", 'content' => $this->renderAjax('create', ['model' => $model, 'ue' => $ue, 'tipo_entidad' => $tipo_entidad]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
             }
         }
     } else {
         /*
          *   Process for non-ajax request
          */
         if ($model->load($request->post()) && $model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             return $this->render('create', ['model' => $model, 'ue' => $ue, 'tipo_entidad' => $tipo_entidad]);
         }
     }
 }
 /**
  * @inheritdoc
  */
 protected function initDefaultButtons()
 {
     foreach ($this->languages as $lang_id => $lang) {
         $name = "update-{$lang_id}";
         $this->template .= ' {' . $name . '}';
         if (!isset($this->buttons[$name])) {
             $this->buttons[$name] = function () use($lang, $lang_id) {
                 /** @var \lav45\translate\TranslatedTrait $model */
                 $model = func_get_arg(1);
                 $key = func_get_arg(2);
                 $params = is_array($key) ? $key : ['id' => (string) $key];
                 $params[$this->languageAttribute] = $lang_id;
                 $params[0] = $this->controller ? $this->controller . '/update' : 'update';
                 $url = Url::toRoute($params);
                 $color = $model->hasTranslate($lang_id) ? 'info' : 'default';
                 $options = ['class' => "btn btn-xs btn-{$color}", 'title' => "Edit {$lang} version", 'data-pjax' => '0'];
                 if ($this->ajax) {
                     $options['data-href'] = $url;
                     return Html::button('<span class="glyphicon glyphicon-pencil"></span> ' . $lang, $options);
                 } else {
                     return Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . $lang, $url, $options);
                 }
             };
         }
     }
 }
Beispiel #13
0
 public function run()
 {
     if ($this->hasModel()) {
         $replace['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->options);
     } else {
         $replace['{input}'] = Html::textInput($this->name, $this->value, $this->options);
     }
     $replace['{button}'] = Html::button($this->buttonName, $this->buttonOptions);
     $replace['{preview}'] = Html::a($this->previewButtonName, "#" . $this->previewButtonOptions['id'] . '_popup', $this->previewButtonOptions) . '
         <div id="' . $this->previewButtonOptions['id'] . '_popup" class="modal fade" tabindex="-1" role="dialog">
             <div class="modal-dialog">
                 <div class="modal-content">
                     <div class="modal-header">
                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                         <h5 class="modal-title"><i class="fa fa-picture-o"></i> Preview</h5>
                     </div>
                     <div class="modal-body has-padding">
                         <img width="100%" src="' . $this->suffix . $this->model->{$this->attribute} . '">
                     </div>
                     <div class="modal-footer">
                         <button class="btn btn-warning" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
                     </div>
                 </div>
             </div>
         </div>';
     echo strtr($this->template, $replace);
     AssetsCallBack::register($this->getView());
     if (!empty($this->multiple)) {
         $this->getView()->registerJs("mihaildev.elFinder.register(" . Json::encode($this->options['id']) . ", function(files, id){ var _f = []; for (var i in files) { _f.push(files[i].url); } \$('#' + id).val(_f.join(', ')); return true;}); \$('#" . $this->buttonOptions['id'] . "').click(function(){mihaildev.elFinder.openManager(" . Json::encode($this->_managerOptions) . ");});");
     } else {
         $this->getView()->registerJs("mihaildev.elFinder.register(" . Json::encode($this->options['id']) . ", function(file, id){\r\n\t \$('#' + id).val(file.url.replace('" . $this->suffix . "', ''));\r\n\t \$('#' + id + '_preview_popup .modal-body').html('<img width=\"100%\" src=\"' + file.url + '\">'); return true;}); \$('#" . $this->buttonOptions['id'] . "').click(function(){mihaildev.elFinder.openManager(" . Json::encode($this->_managerOptions) . ");});");
     }
 }
    public function run()
    {
        parent::run();
        $this->registerAssets();
        $view = $this->getView();
        $id = $this->getId();
        $output = '';
        $output .= Html::input('hidden', $this->inputName, null, ['id' => $this->inputId]);
        $output .= Html::beginTag('div', ['class' => 'row']);
        $output .= Html::beginTag('div', ['class' => 'col-xs-12']);
        $output .= Html::tag('canvas', '', ['class' => ['signature-input-canvas'], 'style' => ['border' => '1px solid black', 'width' => '100%']]);
        $output .= Html::endTag('div');
        $output .= Html::beginTag('div', ['class' => 'col-xs-12']);
        $output .= Html::button(\Yii::t('app', 'Clear'), ['class' => ['col-xs-12', 'btn', 'btn-default'], 'id' => $id . '-clear']);
        $output .= Html::endTag('div');
        $output .= Html::endTag('div');
        $view->registerJs(<<<JS
\$(function(){
    var canvas = \$("#{$id} .signature-input-canvas")[0];
    var signaturePad = new SignaturePad(canvas);
    
    signaturePad.onEnd = function(){
        var result = signaturePad.toDataURL();
        \$('#{$this->inputId}').val(result);
    };
    
    \$('#{$id}-clear').on('click', function(){
        \$('#{$this->inputId}').val('');
        signaturePad.clear();
    });
})
JS
);
        return Html::tag('div', $output, ['id' => $id, 'class' => ['signature-input']]);
    }
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $result = '';
     if ($this->defaultItems) {
         $this->items = [['label' => Yii::t('yii', 'Update'), 'url' => ['update']], ['label' => Yii::t('yii', 'View'), 'url' => ['view']], ['label' => Yii::t('yii', 'Delete'), 'url' => ['delete'], 'linkOptions' => ['data-method' => 'post']]];
     }
     $firstKey = current(array_keys($this->items));
     $mainBtn = $this->items[$firstKey];
     $result .= Html::a($mainBtn['label'], array_merge($mainBtn['url'], [$model->primaryKey()[0] => $key]), array_merge(['class' => 'btn btn-default btn-sm'], isset($mainBtn['linkOptions']) ? $mainBtn['linkOptions'] : []));
     if (count($this->items) != 1) {
         $result .= Html::button(Html::tag('span', '', ['class' => 'caret']) . Html::tag('span', 'Toggle Dropdown', ['class' => 'sr-only']), ['class' => 'btn btn-default btn-sm dropdown-toggle', 'data-toggle' => 'dropdown', 'aria-haspopup' => 'true', 'aria-expanded' => 'false']);
         $items = '';
         $firstElement = true;
         foreach ($this->items as $itemIndex => $item) {
             if (isset($this->visibleButtons[$itemIndex])) {
                 $isVisible = $this->visibleButtons[$itemIndex] instanceof \Closure ? call_user_func($this->visibleButtons[$itemIndex], $model, $key, $index) : $this->visibleButtons[$itemIndex];
             } else {
                 $isVisible = true;
             }
             if ($isVisible) {
                 if ($firstElement) {
                     $firstElement = false;
                     continue;
                 }
                 $items .= Html::tag('li', Html::a($item['label'], array_merge($item['url'], [$model->primaryKey()[0] => $key]), isset($item['linkOptions']) ? $item['linkOptions'] : []), isset($item['options']) ? $item['options'] : []);
             }
         }
         $result .= Html::tag('ul', $items, ['class' => 'dropdown-menu dropdown-menu-right']);
     }
     return Html::tag('div', $result, ['class' => 'btn-group pull-right', 'style' => 'display: flex']);
 }
Beispiel #16
0
 /**
  * Рисуем кнопки отображения пунктов меню верхней и боковой панелей при узком экране
  *
  * @return string the rendering toggle buttons.
  */
 protected function renderToggleButton()
 {
     $bar = Html::tag('span', '', ['class' => 'icon-bar']);
     $screenReader = "<span class=\"sr-only\">{$this->screenReaderToggleText}</span>";
     $navBarButton = Html::button("{$screenReader}\n{$bar}\n{$bar}\n{$bar}", ['class' => 'navbar-toggle', 'data-toggle' => 'collapse', 'data-target' => "#{$this->containerOptions['id']}"]);
     $sidebarButton = Html::button("{$screenReader}\n{$bar}\n{$bar}\n{$bar}", ['class' => 'navbar-toggle menu-toggler pull-left', 'data-target' => "#sidebar"]);
     return $navBarButton . $sidebarButton;
 }
Beispiel #17
0
 /**
  * Prepares content for admin forums.
  * @param mixed $forum
  * @return string
  */
 public static function adminForumsPrepareContent($forum)
 {
     $actions = [];
     $actions[] = Html::button(Html::tag('span', '', ['class' => 'glyphicon glyphicon-eye-' . ($forum->visible ? 'open' : 'close')]), ['class' => 'btn btn-xs text-muted', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => $forum->visible ? Yii::t('podium/view', 'Forum visible for guests (if category is visible)') : Yii::t('podium/view', 'Forum hidden for guests')]);
     $actions[] = Html::a(Html::tag('span', '', ['class' => 'glyphicon glyphicon-cog']), ['admin/edit-forum', 'id' => $forum->id, 'cid' => $forum->category_id], ['class' => 'btn btn-default btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Edit Forum')]);
     $actions[] = Html::tag('span', Html::button(Html::tag('span', '', ['class' => 'glyphicon glyphicon-trash']), ['class' => 'btn btn-danger btn-xs', 'data-url' => Url::to(['admin/delete-forum', 'id' => $forum->id, 'cid' => $forum->category_id]), 'data-toggle' => 'modal', 'data-target' => '#podiumModalDelete']), ['data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Delete Forum')]);
     return Html::tag('p', implode(' ', $actions), ['class' => 'pull-right']) . Html::tag('span', Html::encode($forum->name), ['class' => 'podium-forum', 'data-id' => $forum->id, 'data-category' => $forum->category_id]);
 }
Beispiel #18
0
 /**
  * @return string
  */
 public function renderNavItem()
 {
     $output = '<li>' . Html::beginForm($this->action, $this->method, $this->formOptions) . '<div class="input-group">';
     $output .= Html::input('text', $this->name, $this->value, $this->inputOptions);
     $output .= '<div class="input-group-btn">';
     $output .= Html::button('<i class="glyphicon glyphicon-search"></i>', $this->buttonOptions);
     $output .= '</div></div>' . Html::endForm() . '</li>';
     return $output;
 }
Beispiel #19
0
function tombolCancelApproved()
{
    $title1 = Yii::t('app', 'Cancel Approved');
    $options1 = ['id' => 'po-cancel-approved', 'class' => 'btn btn-warning btn-sm'];
    $icon1 = '<span class="fa fa-plus fa-lg"></span>';
    $label1 = $icon1 . ' ' . $title1;
    $content = Html::button($label1, $options1);
    return $content;
}
 /**
  * @return string
  */
 protected function renderButtons()
 {
     $buttons = [self::ADD_ACTION => Html::button(Icon::show('plus') . ' ' . Yii::t('app', 'Add selected to:'), ['class' => isset($this->htmlOptions['add-class']) ? $this->htmlOptions['add-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::ADD_ACTION]), self::MOVE_ACTION => Html::button(Icon::show('arrows') . ' ' . Yii::t('app', 'Move selected to:'), ['class' => isset($this->htmlOptions['move-class']) ? $this->htmlOptions['move-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::MOVE_ACTION])];
     $group = '';
     foreach ($buttons as $id => $button) {
         $group .= Html::tag('div', Html::tag('div', $button . "\n\t" . Html::tag('div', Html::dropDownList(null, null, static::$categories, ['prompt' => Yii::t('app', 'Select category'), 'class' => 'form-control', 'id' => $id]), ['class' => 'input-group']), ['class' => 'btn-group']), ['class' => 'col-xs-12 col-sm-6']);
     }
     return Html::tag('div', $group, ['class' => 'row m-bottom-10']);
 }
 /**
  * @inheritdoc
  */
 public function run()
 {
     if (!$this->visible) {
         return "";
     }
     $str = Html::button($this->label, $this->options);
     $str .= "<span style='display: none;'>&nbsp;" . Html::dropDownList("parents", null, [], ["class" => "form-control"]) . "&nbsp;" . Html::button($this->labelOk, $this->optionsOk) . "</span>";
     return $str;
 }
Beispiel #22
0
function tombolCreate()
{
    $title1 = Yii::t('app', 'New Road Image');
    $url = Url::toRoute(['/roadsales/road-image/create']);
    $options1 = ['value' => $url, 'id' => 'road-image-id-create', 'class' => "btn btn-info btn-xs"];
    $icon1 = '<span class="fa fa-plus fa-lg"></span>';
    $label1 = $icon1 . ' ' . $title1;
    $content = Html::button($label1, $options1);
    return $content;
}
Beispiel #23
0
function prepareContent($category)
{
    $actions = [];
    $actions[] = Html::button(Html::tag('span', '', ['class' => 'glyphicon glyphicon-eye-' . ($category->visible ? 'open' : 'close')]), ['class' => 'btn btn-xs text-muted', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', $category->visible ? 'Category visible for guests' : 'Category hidden for guests')]);
    $actions[] = Html::a(Html::tag('span', '', ['class' => 'glyphicon glyphicon-list']), ['forums', 'cid' => $category->id], ['class' => 'btn btn-default btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'List Forums')]);
    $actions[] = Html::a(Html::tag('span', '', ['class' => 'glyphicon glyphicon-plus-sign']), ['new-forum', 'cid' => $category->id], ['class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Create new forum in this category')]);
    $actions[] = Html::a(Html::tag('span', '', ['class' => 'glyphicon glyphicon-cog']), ['edit-category', 'id' => $category->id], ['class' => 'btn btn-default btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Edit Category')]);
    $actions[] = Html::tag('span', Html::button(Html::tag('span', '', ['class' => 'glyphicon glyphicon-trash']), ['class' => 'btn btn-danger btn-xs', 'data-url' => Url::to(['delete-category', 'id' => $category->id]), 'data-toggle' => 'modal', 'data-target' => '#podiumModalDelete']), ['data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Delete Category')]);
    return Html::tag('p', implode(' ', $actions), ['class' => 'pull-right']) . Html::tag('span', Html::encode($category->name), ['class' => 'podium-forum', 'data-id' => $category->id]);
}
Beispiel #24
0
function tombolUpdate($url, $model)
{
    $title = Yii::t('app', 'Edit');
    $icon = '<span class="fa fa-edit"></span>';
    $label = $icon . ' ' . $title;
    $url = Url::toRoute(['/roadsales/road-list/edit', 'id' => $model->ID]);
    $options1 = ['value' => $url, 'id' => 'edit-road-id', 'class' => "btn btn-default btn-xs", 'style' => ['width' => '170px', 'height' => '25px', 'border' => 'none', 'background-color' => 'white']];
    $content = Html::button($label, $options1);
    return $content;
}
 public static function renderModal()
 {
     $btnClose = Html::button(Html::tag('span', '&times', ['aria-hidden' => 'true']), ['class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => "Close"]);
     $modalTitle = Html::tag('h4', Yii::t('filemanager', 'Media Gallery'), ['class' => 'modal-title', 'id' => 'fm-modal-label']);
     $modalHeader = Html::tag('div', $btnClose . $modalTitle, ['class' => 'modal-header']);
     $tab = Tabs::widget(['items' => [['label' => Yii::t('filemanager', 'Media Gallery'), 'linkOptions' => ['id' => 'fm-upload-tab', 'data-url' => \yii\helpers\Url::to(['/filemanager/files/upload-tab'])]], ['label' => Yii::t('filemanager', 'Library'), 'linkOptions' => ['id' => 'fm-library-tab', 'data-url' => \yii\helpers\Url::to(['/filemanager/files/library-tab'])]]]]);
     $modalBody = Html::tag('div', $tab, ['class' => 'modal-body', 'style' => 'min-height: 560px;']);
     $modalContent = Html::tag('div', $modalHeader . $modalBody, ['class' => 'modal-content']);
     $modalHtml = Html::tag('div', Html::tag('div', $modalContent, ['class' => 'modal-dialog modal-lg', 'role' => 'document']), ['class' => 'fm-modal modal fade', 'id' => "fm-modal", 'tabindex' => "-1", 'role' => "dialog", 'aria-labelledby' => "fm-modal-label"]);
     return $modalHtml;
 }
Beispiel #26
0
 public function run()
 {
     $this->getView()->registerCss("\n        .menu-button .nav > li > a {\n            padding: 5px 15px;\n        }\n        .menu-button .popover-content {\n            padding: 9px 0px;\n        }\n        ");
     $this->getView()->registerJs("\n            // Init popover\n            ;(function () {\n                var actionsButton = \$('.menu-button button[data-toggle=\"popover\"]');\n                actionsButton.popover();\n                // Show one popover and hide other popovers\n                actionsButton.on('click', function (e) {\n                    actionsButton.not(this).popover('hide');\n                });\n                // hide popover on click outside\n                \$(document).on('click', function (e) {\n                    actionsButton.each(function () {\n                        //the 'is' for buttons that trigger popups\n                        //the 'has' for icons within a button that triggers a popup\n                        if (!\$(this).is(e.target) && \$(this).has(e.target).length === 0 && \$('.popover').has(e.target).length === 0) {\n                            ((\$(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false  // fix for BS 3.3.6\n                        }\n\n                    });\n                });\n            })();\n        ");
     $class = $this->menuClass;
     $actionsMenu = $class::widget(['items' => $this->items, 'options' => ['class' => 'nav']]);
     $html = Html::beginTag('div', ['class' => 'menu-button visible-lg-inline visible-md-inline visible-sm-inline visible-xs-inline']);
     $html .= Html::button($this->icon, ['class' => 'btn btn-default btn-xs', 'data' => ['toggle' => 'popover', 'trigger' => 'click', 'content' => $actionsMenu, 'html' => 'true', 'placement' => 'bottom']]);
     $html .= Html::endTag('div');
     return $html;
 }
Beispiel #27
0
 /**
  * @return string bootstrap-picker button with hiddenInput field where we put selected value
  */
 public function run()
 {
     if ($this->hasModel()) {
         $inp = Html::activeTextInput($this->model, $this->attribute, $this->options);
     } else {
         $inp = Html::textInput($this->name, $this->value, $this->options);
     }
     $picker = Html::button('选择图标', $this->pickerOptions);
     $span = Html::tag('span', $picker, ['class' => 'input-group-btn']);
     return Html::tag('div', $inp . $span, $this->containerOptions);
 }
Beispiel #28
0
 protected function initTools()
 {
     if ($this->expandable || $this->collapsable) {
         $this->tools .= Html::button(new Icon($this->expandable ? 'plus' : 'minus'), ['class' => 'btn btn-box-tool', 'data-widget' => 'collapse']);
         if ($this->expandable) {
             Html::addCssClass($this->options, 'collapsed-box');
         }
     }
     if ($this->removable) {
         $this->tools .= Html::button(new Icon('times'), ['class' => 'btn btn-box-tool', 'data-widget' => 'remove']);
     }
 }
Beispiel #29
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $options = array_merge(['value' => $this->url, 'data-modal-id' => $this->modalId], $this->options);
     ModalButtonAsset::register(Yii::$app->controller->getView());
     Html::addCssClass($options, ['class' => 'show-modal-button']);
     if ('button' == $this->type) {
         return Html::button($this->label, $options);
     }
     if ('link' == $this->type) {
         return Html::a($this->label, false, $options);
     }
 }
Beispiel #30
0
 /**
  * Renders the list of users reading current section.
  * @return string
  */
 public function run()
 {
     $url = Yii::$app->request->getUrl();
     $out = '';
     switch ($this->what) {
         case 'forum':
             $out .= Yii::t('podium/view', 'Browsing this forum') . ': ';
             break;
         case 'topic':
             $out .= Yii::t('podium/view', 'Reading this thread') . ': ';
             break;
         case 'unread':
             $out .= Yii::t('podium/view', 'Browsing unread threads') . ': ';
             break;
         case 'members':
             $out .= Yii::t('podium/view', 'Browsing the members') . ': ';
             break;
     }
     $conditions = ['and', [Activity::tableName() . '.anonymous' => 0], ['is not', 'user_id', null], new Expression('`url` LIKE :url'), ['>=', Activity::tableName() . '.updated_at', time() - 5 * 60]];
     $guest = true;
     $anon = false;
     if (!Yii::$app->user->isGuest) {
         $guest = false;
         $me = User::findMe();
         $conditions[] = ['not in', 'user_id', $me->id];
         if ($me->anonymous == 0) {
             $out .= $me->podiumTag . ' ';
         } else {
             $anon = true;
         }
     }
     $users = Activity::find()->joinWith(['user'])->where($conditions)->params([':url' => $url . '%']);
     foreach ($users->each() as $user) {
         $out .= $user->user->podiumTag . ' ';
     }
     $conditions = ['and', ['anonymous' => 1], new Expression('`url` LIKE :url'), ['>=', 'updated_at', time() - 5 * 60]];
     $anonymous = Activity::find()->where($conditions)->params([':url' => $url . '%'])->count('id');
     if ($anon) {
         $anonymous += 1;
     }
     $conditions = ['and', ['user_id' => null], new Expression('`url` LIKE :url'), ['>=', 'updated_at', time() - 5 * 60]];
     $guests = Activity::find()->where($conditions)->params([':url' => $url . '%'])->count('id');
     if ($guest) {
         $guests += 1;
     }
     if ($anonymous) {
         $out .= Html::button(Yii::t('podium/view', '{n, plural, =1{# anonymous user} other{# anonymous users}}', ['n' => $anonymous]), ['class' => 'btn btn-xs btn-default disabled']) . ' ';
     }
     if ($guests) {
         $out .= Html::button(Yii::t('podium/view', '{n, plural, =1{# guest} other{# guests}}', ['n' => $guests]), ['class' => 'btn btn-xs btn-default disabled']);
     }
     return $out;
 }