Exemplo n.º 1
2
 public function renderFileContent()
 {
     $attribute = $this->attribute;
     $input = $thumb = '';
     $selectedFileOpt = ['class' => 'fm-browse-input'];
     if ($this->model->{$attribute}) {
         $filesModel = \Yii::$app->getModule('filemanager')->models['files'];
         $file = $filesModel::findOne(['file_identifier' => $this->model->{$attribute}]);
     }
     if (isset($file) && $file) {
         $fileType = $file->mime_type;
         if ($file->dimension) {
             $src = $file->object_url . $file->thumbnail_name;
             $fileType = 'image';
         } else {
             $src = $file->object_url . $file->src_file_name;
         }
         $gridBox = new \dpodium\filemanager\components\GridBox(['owner' => $this, 'src' => $src, 'fileType' => $fileType, 'toolArray' => [['tagType' => 'i', 'options' => ['class' => 'fa-icon fa fa-times fm-remove', 'title' => Yii::t('filemanager', 'Remove')]]], 'thumbnailSize' => \Yii::$app->getModule('filemanager')->thumbnailSize]);
         foreach ($this->fileData as $attribute) {
             $value = isset($file->{$attribute}) ? $file->{$attribute} : null;
             $input .= Html::input('input', "Filemanager[{$attribute}]", $value);
         }
         $thumb = $gridBox->renderGridBox();
     } else {
         $selectedFileOpt['value'] = '';
     }
     $fileView = Html::tag('div', $thumb, ['class' => 'fm-browse-selected-view']);
     $selectedFile = Html::activeInput('input', $this->model, $this->attribute, $selectedFileOpt);
     $buttonClass = empty($this->options['class']) ? 'btn btn-primary' : $this->options['class'];
     $browseButton = Html::label(Yii::t('filemanager', 'Browse'), Html::getInputId($this->model, $this->attribute), ['class' => 'fm-btn-browse btn-browse ' . $buttonClass, 'data-url' => Url::to(['/filemanager/files/browse']), 'data-backdrop' => 'static', 'data-toggle' => 'modal', 'data-target' => '#fm-modal']);
     return $fileView . $browseButton . $selectedFile . $input;
 }
Exemplo n.º 2
2
 protected function launch()
 {
     echo Html::beginForm($this->url, 'get');
     echo Html::input('text', $this->queryParam, $this->query);
     echo Html::submitButton(\Yii::t('gromver.platform', 'Find'));
     echo Html::endForm();
 }
 public function run()
 {
     $this->registerClientScript();
     Html::addCssClass($this->wrapperOptions, 'input-touchspin');
     echo Html::beginTag('div', $this->wrapperOptions);
     if ($this->hasModel()) {
         if ($this->default !== false) {
             $value = $this->model->{$this->attribute};
             if (!is_numeric($value) || $value < $this->min || $value > $this->max) {
                 $this->model->{$this->attribute} = $this->default;
             }
         }
         echo Html::activeInput($this->type, $this->model, $this->attribute, $this->options);
     } else {
         if ($this->default !== false) {
             if (!is_numeric($this->value) || $this->value < $this->min || $this->value > $this->max) {
                 $this->value = $this->default;
             }
         }
         echo Html::input($this->type, $this->name, $this->value, $this->options);
     }
     echo Html::tag('div', null, ['class' => 'caret step-up']);
     echo Html::tag('div', null, ['class' => 'caret step-down']);
     echo Html::endTag('div');
 }
Exemplo n.º 4
1
 /**
  * @return string
  */
 public function run()
 {
     $options = ArrayHelper::merge($this->defaultOptions, $this->options);
     if ($this->hasModel()) {
         return Html::activeInput($this->htmlTagType, $this->model, $this->attribute, $options);
     }
     return Html::input($this->htmlTagType, $this->name, $this->value, $options);
 }
Exemplo n.º 5
1
 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->form !== null && $this->model !== null) {
         return $this->form->field($this->model, $this->attribute)->hint($this->hint)->passwordInput($this->htmlOptions);
     }
     if ($this->model !== null) {
         return Html::activePasswordInput($this->model, $this->attribute, $this->htmlOptions);
     }
     return Html::input('password', $this->name, $this->value, $this->htmlOptions);
 }
 /**
  * Initializes the widget.
  * This method will register the bootstrap asset bundle. If you override this method,
  * make sure you call the parent implementation first.
  */
 public function init()
 {
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     echo Html::input($this->type, $this->name, $this->value, $this->options);
 }
Exemplo n.º 7
0
 public function run()
 {
     $this->registerJs();
     switch ($this->style) {
         case self::STYLE_SLIDER:
             Html::addCssClass($this->options, self::STYLE_SLIDER);
             break;
         case self::STYLE_TOGGLE:
             Html::addCssClass($this->options, self::STYLE_TOGGLE);
             break;
     }
     if ($this->isDisabled) {
         Html::addCssClass($this->options, 'disabled');
         $this->inputOptions['disabled'] = 'disabled';
     }
     if ($this->isActive) {
         Html::addCssClass($this->options, 'checked');
         $this->inputOptions['checked'] = '';
     }
     if ($this->isReadOnly) {
         Html::addCssClass($this->options, 'read-only');
     }
     Html::addCssClass($this->options, 'ui checkbox');
     $body = Html::input('checkbox', $this->name, $this->value, $this->inputOptions);
     $body .= Html::tag('label', $this->label);
     echo Html::tag('div', $body, $this->options);
 }
Exemplo n.º 8
0
 public function init()
 {
     parent::init();
     Html::addCssClass($this->htmlOptions, 'custom-dz');
     /** @var Image[] $files */
     $files = Image::find()->where(['and', 'object_id = :objectId', 'object_model_id = :modelId'], [':objectId' => $this->objectId, ':modelId' => $this->modelId])->orderBy(['sort_order' => SORT_ASC])->all();
     /** Image $file */
     foreach ($files as $file) {
         $thumbnail_src = $file->getThumbnail('80x80');
         $this->storedFiles[] = ['id' => $file->id, 'name' => $file->filename, 'file' => $file->file, 'thumbnail' => $thumbnail_src, 'description' => $file->image_description];
     }
     $params = ArrayHelper::merge(isset($this->options['params']) ? $this->options['params'] : [], ['objectId' => $this->objectId, 'modelId' => $this->modelId]);
     $this->sortable = true;
     $this->options = ArrayHelper::merge($this->options, ['acceptedFiles' => 'image/*', 'params' => $params, 'previewTemplate' => '<div class="file-row">
                     ' . Html::input('hidden', 'id[]') . Html::input('hidden', 'file[]') . '
                     <!-- This is used as the file preview template -->
                     <div>
                         <span class="preview"><img style="width: 80px; height: 80px;" data-dz-thumbnail /></span>
                     </div>
                     <div>
                         <p class="name" data-dz-name></p>
                         <div class="dz-error-message"><span data-dz-errormessage></span></div>
                     </div>
                     <div class="description">
                         ' . Html::textarea('description', '', ['style' => 'width: 100%; min-width: 80px; height: 80px;']) . '
                     </div>
                     <div>
                         <p class="size" data-dz-size></p>
                         <div class="dz-progress progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
                           <div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
                         </div>
                         <div class="dz-success-mark"><span>✔</span> OK</div>
                         <div class="dz-error-mark"><span>✘</span> ERROR</div>
                     </div>
                     <div>
                       <button data-dz-remove class="btn btn-danger delete">
                         <i class="fa fa-trash-o"></i>
                         <span>' . Yii::t('app', 'Delete') . '</span>
                       </button>
                     </div>
                   </div>', 'thumbnailWidth' => '80', 'thumbnailHeight' => '80', 'previewsContainer' => "#{$this->id}"]);
     $this->eventHandlers = ['removedfile' => 'function(file) {
             jQuery.get(
                 "' . Url::toRoute($this->removeUrl) . '",
                 {
                     "id" : jQuery(file.previewElement).find("[name=\\"id[]\\"]").val(),
                     "filename" : jQuery(file.previewElement).data("filename")
                 }
             ).done(function (data) { return data });
         }', 'success' => 'function(file, response) {
             response = jQuery.parseJSON(response);
             jQuery(file.previewElement).find("[data-dz-name]").text(response.filename);
             jQuery(file.previewElement).data("filename", response.filename);
             jQuery(file.previewElement).find("[name=\\"id[]\\"]").val(response.afterUpload.id);
             jQuery(file.previewElement).find("[name=\\"file[]\\"]").val(response.afterUpload.file);
             jQuery(file.previewElement).find(".description textarea").attr("name", "description["+response.afterUpload.id+"]");
         }', 'complete' => 'function(file) {
             jQuery(file.previewElement).removeClass("dz-processing");
         }'];
 }
Exemplo n.º 9
0
    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']]);
    }
Exemplo n.º 10
0
 protected function set_input_type($type, $name, $value)
 {
     if (isset($type) && isset($name) && isset($value)) {
         $input = NULL;
         $input_name = $name . '[value]';
         switch ($type) {
             case 'string':
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'integer':
                 $input = Html::input('number', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'text':
                 $input = Html::textarea($input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'boolean':
                 $input = Switchery::widget(['name' => $input_name, 'clientOptions' => ['color' => '#64bd63', 'secondaryColor' => '#dfdfdf', 'jackColor' => '#fff', 'jackSecondaryColor' => null, 'className' => 'switchery', 'disabled' => FALSE, 'disabledOpacity' => 0.5, 'speed' => '0.1s', 'size' => 'default'], 'options' => array_merge(['value' => '1'], $this->has_checked($value))]);
                 break;
             default:
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
         }
         return $input;
     }
     return FALSE;
 }
Exemplo n.º 11
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     echo Html::beginTag('div', ['class' => 'main-sidebar']);
     echo Html::beginTag('div', ['class' => 'sidebar']);
     if (isset($this->user) and count($this->user) > 0) {
         $image = isset($this->user['image']) ? $this->user['image'] : '';
         $username = isset($this->user['username']) ? $this->user['username'] : '';
         echo Html::beginTag('div', ['class' => 'user-panel']);
         echo Html::beginTag('div', ['class' => 'pull-left image']);
         echo '<img src="' . $image . '" class="img-circle" alt="user" />';
         echo Html::endTag('div');
         echo Html::beginTag('div', ['class' => 'pull-left info']);
         echo Html::tag('p', $username);
         echo Html::tag('a', '<i class="fa fa-circle text-success"></i> Online');
         echo Html::endTag('div');
         echo Html::endTag('div');
     }
     if (isset($this->search) and count($this->search) > 0) {
         $method = isset($this->search['method']) ? $this->search['method'] : 'get';
         $action = isset($this->search['action']) ? $this->search['action'] : '';
         echo Html::beginTag('form', ['method' => $method, 'action' => $action, 'class' => 'sidebar-form']);
         echo Html::beginTag('div', ['class' => 'input-group']);
         echo Html::input('text', 'q', '', ['class' => 'form-control', 'placeholder' => 'Search...']);
         echo Html::beginTag('span', ['class' => 'input-group-btn']);
         echo Html::submitButton(Html::tag('i', '', ['class' => 'fa fa-search']), ['id' => 'search-btn', 'class' => "btn btn-flat"]);
         echo Html::endTag('span');
         echo Html::endTag('div');
         echo Html::endTag('form');
     }
 }
Exemplo n.º 12
0
 public function run()
 {
     $input = Html::input('text', 'code', '', ['class' => 'form-control buy-by-code-input', 'placeholder' => yii::t('order', 'Code')]);
     $error = Html::tag('div', '', ['class' => 'error-block', 'style' => 'color: red; position: absolute; top: -17px;']);
     $button = Html::tag('button', '<i class="glyphicon glyphicon-plus"></i>', ['data-href' => Url::toRoute(['tools/buy-product-by-code']), 'type' => 'submit', 'class' => 'btn btn-success promo-code-enter-btn']);
     $button = Html::tag('span', $button, ['class' => 'input-group-btn']);
     return Html::tag('div', $error . $input . $button, ['class' => 'input-group buy-by-code']);
 }
Exemplo n.º 13
0
 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeInput('text', $this->model, $this->attribute, $this->options);
     } else {
         echo Html::input('text', $this->name, $this->value, $this->options);
     }
 }
Exemplo n.º 14
0
 public function run()
 {
     $model = $this->model;
     $input = Html::input('text', 'code', '', ['class' => 'input buy']);
     //$button = Html::submitButton('В корзину', ['class' => 'btn btn-lg ', 'name' => 'buy-button']);
     $button = Html::submitInput('В корзину', ['class' => 'btn btn-primary', 'name' => 'buy-button']);
     return Html::tag('div', $input . ' ' . $button, ['class' => 'buy-button']);
 }
Exemplo n.º 15
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;
 }
Exemplo n.º 16
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         echo Html::activeHiddenInput($this->model, $this->attribute, ['id' => null]) . Html::activeInput('file', $this->model, $this->attribute, $this->options);
     } else {
         echo Html::hiddenInput($this->name, $this->value, ['id' => null]) . Html::input('file', $this->name, $this->value, $this->options);
     }
 }
Exemplo n.º 17
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         echo Html::activeInput('text', $this->model, $this->attribute, $this->options);
     } else {
         echo Html::input('text', $this->name, $this->value, $this->options);
     }
 }
Exemplo n.º 18
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         $this->id = Html::getInputId($this->model, $this->attribute);
         $this->registerJs('#' . $this->htmlOptions['id'], $this->options, $this->callback);
         return Html::activeInput($this->type, $this->model, $this->attribute, $this->htmlOptions + ['class' => 'form-control']);
     } else {
         $this->registerJs('#' . $this->htmlOptions['id'], $this->options, $this->callback);
         return Html::input($this->type, $this->name, $this->value, $this->htmlOptions);
     }
 }
Exemplo n.º 19
0
 public function input($config = array())
 {
     $this->registerAssets($config);
     $return = '<div class="form-group">';
     if (isset($config['label'])) {
         $return .= '<label class="control-label col-sm-3" for="' . $config['name'] . '">' . $config['label'] . '</label>';
     }
     $return .= '<div class="col-sm-9">' . Html::input('text', $config['name'], null, ['id' => $config['id']]) . '</div>';
     $return .= "</div>";
     return $return;
 }
Exemplo n.º 20
0
 private function _getToolArray($fileId)
 {
     $input = Html::input('radio', 'fm-gallery-group', $fileId, ['data-url' => \yii\helpers\Url::to(['/filemanager/files/update', 'id' => $fileId])]);
     $view = Html::tag('i', '', ['class' => 'fa-icon fa fa-eye fm-view', 'title' => \Yii::t('filemanager', 'View')]);
     $toolArray = [['tagType' => 'label', 'content' => $input . $view]];
     if ($this->viewFrom == 'modal') {
         $toolArray[] = ['tagType' => 'i', 'options' => ['class' => 'fa-icon fa fa-link fm-use', 'title' => \Yii::t('filemanager', 'Use'), 'data-url' => \yii\helpers\Url::to(['/filemanager/files/use']), 'data-id' => $fileId]];
         $toolArray[] = ['tagType' => 'i', 'options' => ['class' => 'fa-icon fa fa-trash fm-delete', 'title' => \Yii::t('filemanager', 'Delete Permanently'), 'data-url' => \yii\helpers\Url::to(['/filemanager/files/delete', 'id' => $fileId]), 'onclick' => 'confirmDelete = confirm("Confirm delete this file?");']];
     }
     return $toolArray;
 }
Exemplo n.º 21
0
 public function renderItems()
 {
     $out = Html::input('hidden', $this->name, $this->value, $this->inputOptions);
     $out .= Html::tag('div', '', ['class' => 'text']);
     $out .= Elements::icon('dropdown');
     $elems = '';
     foreach ($this->items as $item) {
         $elems .= $this->renderItem($item);
     }
     $out .= Html::tag('div', $elems, ['class' => 'menu']);
     return $out;
 }
Exemplo n.º 22
0
 public function run()
 {
     $variantsList = $this->field->variants;
     $variantsList = ArrayHelper::map($variantsList, 'id', 'value');
     $variantsList[0] = '-';
     ksort($variantsList);
     $value = $this->model->getField($this->field->slug);
     $input = Html::input('date', 'choice-field-value', $value, ['data-id' => $this->field->id, 'data-item-id' => $this->model->id, 'class' => 'form-control', 'placeholder' => '']);
     $button = Html::tag('span', Html::button('<i class="glyphicon glyphicon-ok"></i>', ['class' => ' btn btn-success field-save-value']), ['class' => 'input-group-btn']);
     $this->options['class'] .= ' input-group';
     $block = Html::tag('div', $input . $button, $this->options);
     return $block;
 }
Exemplo n.º 23
0
 public function run()
 {
     $variantsList = $this->filter->variants;
     $this->options['class'] .= ' filter-variants';
     $this->options['item'] = function ($item, $index) {
         return $this->variant($item);
     };
     $variants = Html::ul($variantsList, $this->options);
     $new = [];
     $new[] = Html::input('text', 'variant_value', '', ['placeholder' => 'Новый вариант', 'data-filter-id' => $this->filter->id, 'data-create-action' => Url::toRoute(['/filter/filter-variant/create']), 'class' => ' form-control']);
     $new[] = Html::button(Html::tag('i', '', ['class' => 'glyphicon glyphicon-plus']), ['class' => 'btn btn-success']);
     $variants .= Html::tag('div', implode('', $new), ['class' => 'new-variant']);
     return $variants;
 }
Exemplo n.º 24
0
 public function run()
 {
     if (!isset($this->clientOptions['container'])) {
         $this->clientOptions['container'] = 'body';
     }
     $this->registerJqueryPlugin('pickadate');
     Html::addCssClass($this->options, 'datepicker');
     if ($this->hasModel()) {
         $this->options['data-value'] = isset($this->value) ? $this->value : Html::getAttributeValue($this->model, $this->attribute);
         return Html::activeInput('date', $this->model, $this->attribute, $this->options);
     } else {
         $this->options['data-value'] = $this->value;
         return Html::input('date', $this->name, $this->value, $this->options);
     }
 }
Exemplo n.º 25
0
 public function run()
 {
     if ($this->showArrows) {
         $downArr = Html::a($this->downArr, '#', ['class' => 'pistol88-arr pistol88-downArr']);
         $upArr = Html::a($this->upArr, '#', ['class' => 'pistol88-arr pistol88-upArr']);
     } else {
         $downArr = $upArr = '';
     }
     if (!$this->model instanceof \app\modules\cart\interfaces\CartElement) {
         $input = Html::activeTextInput($this->model, 'count', ['type' => 'number', 'class' => 'pistol88-cart-element-count', 'data-line-selector' => $this->lineSelector, 'data-id' => $this->model->getId(), 'data-href' => Url::toRoute("/cart/element/update")]);
     } else {
         $input = Html::input('number', 'count', $this->defaultValue, ['class' => 'pistol88-cart-element-before-count', 'data-line-selector' => $this->lineSelector, 'data-id' => $this->model->getCartId()]);
     }
     return Html::tag('div', $downArr . $input . $upArr, ['class' => $this->cssClass]);
 }
Exemplo n.º 26
0
    protected function initOptions()
    {
        $view = $this->getView();
        GooglemapAssets::register($view);
        $id = uniqid('gmap_');
        $mapCenter = $this->value ? $this->value : $this->center;
        $script = <<<HTML
            var {$id};
            var {$id}_markers = [];
            var mapOptions = {
                zoom: 10,
                scrollwheel: false,
                center: new google.maps.LatLng({$mapCenter})
            };
            {$id} = new google.maps.Map(document.getElementById('{$id}'), mapOptions);
HTML;
        if ($this->value) {
            $script .= <<<HTML
            var position = new google.maps.LatLng({$this->value});
            var marker = new google.maps.Marker({
                position: position,
                map: {$id},
            });
            {$id}_markers.push(marker);
HTML;
        }
        $script .= <<<HTML
            google.maps.event.addListener({$id}, 'click', function(event) {
                var location = event.latLng;
                for (var i = 0; i < {$id}_markers.length; i++) {
                    {$id}_markers[i].setMap(null);
                }
                var marker = new google.maps.Marker({
                    position: location,
                    map: {$id},
                    draggable:true
                });
                google.maps.event.addListener(marker,'dragend',function(event) {
                    \$('#hidden-{$id}').val(event.latLng.lat() + ', ' +  event.latLng.lng());
                });
                {$id}_markers.push(marker);
                \$('#hidden-{$id}').val(location.lat() + ', ' +  location.lng());
            });
HTML;
        echo Html::tag('div', '', ['id' => $id, 'data-gmap' => true, 'style' => ['height' => $this->height ? $this->height : $this->_height, 'width' => $this->width ? $this->width : $this->_width]]);
        echo Html::input('hidden', $this->name, $this->value, ['data-name' => $this->name, 'id' => 'hidden-' . $id]);
        $view->registerJs($script);
    }
Exemplo n.º 27
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     $this->registerClientScript();
     $options = ArrayHelper::merge($this->options, ['data-toggle' => 'toggle']);
     $fieldName = $this->attribute;
     if ($this->model->{$fieldName}) {
         $options['checked'] = 'checked';
     }
     if ($this->textOn) {
         $options['data-on'] = $this->textOn;
     }
     if ($this->textOff) {
         $options['data-off'] = $this->textOff;
     }
     return Html::tag('div', Html::input('checkbox', $this->attrName, 1, $options), ['style' => 'display:block;']);
 }
Exemplo n.º 28
0
 public function run()
 {
     $content = Html::beginTag('div', ['id' => $this->options['id']]);
     foreach ($this->value as $k => $v) {
         $content .= Html::beginTag('div', ['class' => 'input-group']);
         $content .= Html::input($this->inputOptions['type'], $this->name, $v, $this->inputOptions);
         $content .= Html::tag('a', Html::tag('i', '', ['class' => 'glyphicon glyphicon-remove']), ['class' => 'input-group-addon array-input-remove', 'href' => '#']);
         $content .= Html::endTag('div');
     }
     $content .= Html::beginTag('div', ['class' => 'input-group']);
     $content .= Html::input($this->inputOptions['type'], $this->name, null, $this->inputOptions);
     $content .= Html::tag('a', Html::tag('i', '', ['class' => 'glyphicon glyphicon-plus']), ['class' => 'input-group-addon array-input-plus', 'href' => '#']);
     $content .= Html::endTag('div');
     $content .= Html::endTag('div');
     return $content;
 }
Exemplo n.º 29
0
 public function run()
 {
     $countval = count($this->model->eventVenueMap);
     echo Html::input('hidden', 'venueC', $countval, ['id' => 'venueC']);
     $countval = 0;
     foreach ($this->model->eventVenueMap as $mapmodel) {
         if ($mapmodel->mapType == 200) {
             $icon = 'fa-tag';
         } else {
             $icon = 'fa-cutlery';
         }
         $name = $mapmodel->venue->name . ' in ' . $mapmodel->venue->localityname . ' ' . $mapmodel->venue->cityname . '(' . $mapmodel->venue->zonename . ')';
         echo '<div id="venueArray[]"><i class="fa ' . $icon . '"></i>' . $name . '<input type="hidden"  value ="' . $mapmodel->mapId . '" class="form-control"  name="' . $this->model->formName() . '[venue][' . $countval . '][venueId]"><input type="hidden" value ="' . $mapmodel->mapType . '" class="form-control"  name="' . $this->model->formName() . '[venue][' . $countval . '][venuetype]">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href= "javascript:void(0);" class="delete">Delete</a></div>';
         $countval++;
     }
 }
Exemplo n.º 30
0
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         switch ($this->editorType) {
             case 'uploadButton':
                 return Html::activeInput('text', $this->model, $this->attribute, ['id' => $this->id, 'readonly' => "readonly"]) . '<input type="button" id="uploadButton" value="Upload" />';
                 break;
             case 'colorpicker':
                 return Html::activeInput('text', $this->model, $this->attribute, ['id' => $this->id]) . '<input type="button" id="colorpicker" value="打开取色器" />';
                 break;
             case 'file-manager':
                 return Html::activeInput('text', $this->model, $this->attribute, ['id' => $this->id]) . '<input type="button" id="filemanager" value="浏览服务器" />';
                 break;
             case 'image-dialog':
                 return Html::activeInput('text', $this->model, $this->attribute, ['id' => $this->id]) . '<input type="button" id="imageBtn" value="选择图片" />';
                 break;
             case 'file-dialog':
                 return Html::activeInput('text', $this->model, $this->attribute, ['id' => $this->id]) . '<input type="button" id="insertfile" value="选择文件" />';
                 break;
             default:
                 return Html::activeTextarea($this->model, $this->attribute, ['id' => $this->id]);
                 break;
         }
     } else {
         switch ($this->editorType) {
             case 'uploadButton':
                 return Html::input('text', $this->id, $this->value, ['id' => $this->id, 'readonly' => "readonly"]) . '<input type="button" id="uploadButton" value="Upload" />';
                 break;
             case 'colorpicker':
                 return Html::input('text', $this->id, $this->value, ['id' => $this->id]) . '<input type="button" id="colorpicker" value="打开取色器" />';
                 break;
             case 'file-manager':
                 return Html::input('text', $this->id, $this->value, ['id' => $this->id]) . '<input type="button" id="filemanager" value="浏览服务器" />';
                 break;
             case 'image-dialog':
                 return Html::input('text', $this->id, $this->value, ['id' => $this->id]) . '<input type="button" id="imageBtn" value="选择图片" />';
                 break;
             case 'file-dialog':
                 return Html::input('text', $this->id, $this->value, ['id' => $this->id]) . '<input type="button" id="insertfile" value="选择文件" />';
                 break;
             default:
                 return Html::textarea($this->id, $this->value, ['id' => $this->id]);
                 break;
         }
     }
 }