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;
 }
 public function actionForm()
 {
     echo Html::beginForm();
     echo Html::checkboxList('test', ['value 1' => 'item 1', 'value 2' => 'item 2', 'value 3' => 'item 3'], isset($_POST['test']) ? $_POST['test'] : null, function ($index, $label, $name, $value, $checked) {
         return Html::label($label . ' ' . Html::checkbox($name, $value, $checked), null, ['class' => 'inline checkbox']);
     });
     echo Html::submitButton();
     echo Html::endForm();
     print_r($_POST);
 }
Exemplo n.º 3
1
 public function renderLabel()
 {
     $label = $this->encodeLabel ? Html::encode($this->label) : $this->label;
     if (!isset($this->labelOptions['for'])) {
         $this->labelOptions['for'] = $this->hasModel() ? $this->attribute : $this->name;
     }
     return $this->hasModel() ? Html::activeLabel($this->model, $this->attribute, $this->labelOptions) : Html::label($this->label, $this->labelOptions['for'], $this->labelOptions);
 }
Exemplo n.º 4
1
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $items = '';
     foreach ($this->buttons as $value => $label) {
         $items .= Html::label(Html::radio(null, $model->{$this->attribute} == $value, ['value' => $value]) . $label, $model->{$this->attribute} == $value, ['class' => 'btn ' . ($model->{$this->attribute} == $value ? 'btn-primary' : 'btn-default')]);
     }
     return Html::tag('div', $items, ['data-action' => 'toggle-column', 'data-attribute' => $this->attribute, 'data-id' => $model->id, 'data-model' => get_class($model), 'data-url' => Url::to($this->updateAction), 'data-toggle' => 'buttons', 'class' => 'btn-group-xs btn-group']);
 }
Exemplo n.º 5
0
 public function statusTipe1($field, $label, $format)
 {
     /**
      * @var $field=target field, $label=label grid, $format=tipe data output
      * 
      * ON VIEW
      * ============================================================================
      * GridView::widget([
      *    ...
      * '  columns' => [
      *       ...,
      *       Yii::$app->gridview->statusTipe1('namafield','namalabel','formatraw'),
      *        ...,
      *       ],
      * ]);
      *
      * akan memberikan nilai return :
      * 1. "Aktif" jika status = 1
      * 2. "Tidak aktif" jika status <> 1
      *
      **/
     $this->st = $field;
     $de_array = ['label' => $label, 'format' => $format, 'value' => function ($data) {
         $sts = $this->st;
         if ($data->{$sts} == 1) {
             $statusnya = Html::label('Aktif', null, ['class' => 'label label-info']);
         } else {
             $statusnya = Html::label('Tidak Aktif', null, ['class' => 'label label-danger']);
         }
         return $statusnya;
     }];
     return $de_array;
 }
Exemplo n.º 6
0
    /**
     * @inheritdoc
     */
    public function actions()
    {
        return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => [['class' => CreatedAtColumn::className()], 'id', ['class' => DataColumn::className(), 'attribute' => 'status_code', 'format' => 'raw', 'filter' => ArrayHelper::map(ShopOrderStatus::find()->all(), 'code', 'name'), 'value' => function (ShopOrder $order) {
            return Html::label($order->status->name, null, ['style' => "background: {$order->status->color}", 'class' => "label"]) . "<br />" . Html::tag("small", \Yii::$app->formatter->asDatetime($order->status_at) . " (" . \Yii::$app->formatter->asRelativeTime($order->status_at) . ")");
        }], ['class' => BooleanColumn::className(), 'attribute' => 'payed', 'format' => 'raw'], ['class' => DataColumn::className(), 'attribute' => "canceled", 'format' => "raw", 'filter' => ['Y' => \Yii::t('app', 'Yes'), 'N' => \Yii::t('app', 'No')], 'value' => function (ShopOrder $shopOrder) {
            return $shopOrder->canceled == "Y" ? \Yii::t('app', 'Yes') : \Yii::t('app', 'No');
        }], ['class' => DataColumn::className(), 'attribute' => "user_id", 'label' => \skeeks\cms\shop\Module::t('app', 'Buyer'), 'format' => "raw", 'value' => function (ShopOrder $shopOrder) {
            return (new \skeeks\cms\shop\widgets\AdminBuyerUserWidget(['user' => $shopOrder->user]))->run();
        }], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopOrder $model) {
            if ($model->shopBaskets) {
                $result = [];
                foreach ($model->shopBaskets as $shopBasket) {
                    $money = \Yii::$app->money->intlFormatter()->format($shopBasket->money);
                    $result[] = Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank']) . <<<HTML
  — {$shopBasket->quantity} {$shopBasket->measure_name}
HTML;
                }
                return implode('<hr style="margin: 0px;"/>', $result);
            }
        }], ['class' => DataColumn::className(), 'format' => 'raw', 'attribute' => 'price', 'label' => \skeeks\cms\shop\Module::t('app', 'Sum'), 'value' => function (ShopOrder $model) {
            return \Yii::$app->money->intlFormatter()->format($model->money);
        }], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(CmsSite::find()->active()->all(), 'id', 'name'), 'attribute' => 'site_id', 'format' => 'raw', 'visible' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Site'), 'value' => function (ShopOrder $model) {
            return $model->site->name . " [{$model->site->code}]";
        }]]], "view" => ['class' => AdminOneModelEditAction::className(), "name" => \Yii::t('app', "Информация"), "icon" => "glyphicon glyphicon-eye-open", "priority" => 5, "callback" => [$this, 'view']]]);
    }
Exemplo n.º 7
0
 public function renderLabel()
 {
     if (!isset($this->labelOptions['for'])) {
         $this->labelOptions['for'] = $this->inputOptions['id'];
     }
     return $this->hasModel() ? Html::activeLabel($this->model, $this->attribute, $this->labelOptions) : Html::label($this->label, $this->labelOptions['for'], $this->labelOptions);
 }
Exemplo n.º 8
0
 public function init()
 {
     parent::init();
     $this->_inputStr = '<div class="form-group">';
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeLabel($this->model, $this->attribute);
     } else {
         $this->_inputStr .= Html::label($this->name);
     }
     $this->_inputStr .= '<div id="' . Html::encode($this->name) . '" class="input-group date">';
     if ($this->hasModel()) {
         $value = Html::getAttributeValue($this->model, $this->attribute);
     } else {
         $value = $this->value;
     }
     if ($value !== null) {
         $value = Yii::$app->formatter->asDatetime($value);
     }
     $options = $this->options;
     $options['class'] = 'form-control';
     //$options['readonly'] = '';
     $options['value'] = $value;
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeTextInput($this->model, $this->attribute, $options);
     } else {
         $this->_inputStr .= Html::textInput($this->name, $this->value, $options);
     }
     $this->_inputStr .= '<span class="input-group-addon">
                                     <span class="glyphicon-calendar glyphicon"></span>
                                 </span>
                             </div>
                             </div>
                             ';
 }
Exemplo n.º 9
0
 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->model !== null) {
         return Html::activeLabel($this->model, $this->attribute, $this->options);
     }
     return Html::label($this->text, null, $this->options);
 }
Exemplo n.º 10
0
 protected function honeypot()
 {
     $field = Html::beginTag('div', ['class' => '', 'style' => 'display:none']);
     $field .= Html::label(Yii::t('app', 'Excuse me, but leave this field in blank'), "_email", ['class' => 'control-label']);
     $field .= Html::textInput("_email", null, ['id' => '_email', 'class' => 'form-control']);
     $field .= Html::endTag('div') . ' ';
     $field .= Html::endForm();
     return $field;
 }
Exemplo n.º 11
0
 private function variant($item)
 {
     $return = [];
     $checked = $this->model->checkedId($item->id);
     $return[] = Html::checkbox('variant', $checked, ['id' => 'filtervariant' . $item->id, 'data-id' => $item->id]);
     $return[] = ' ';
     $return[] = Html::label($item->value, 'filtervariant' . $item->id);
     return Html::tag('li', implode('', $return));
 }
Exemplo n.º 12
0
 protected function get_content($data, $isActiveForm = FALSE)
 {
     $res = array();
     // Ссылка добавления настройка для секции
     $res[] = Html::a('<i class="fa fa-cog"></i> add', [$this->add_set_link], ['class' => 'add_settings_in_section']);
     foreach ($data as $item) {
         $res[] = '<div class="row">' . '<div class="form-group">' . Html::label($item['key'], $item['key'], ['class' => 'col-sm-2 control-label']) . '<div class="col-sm-3">' . $this->set_input_type($item['type'], $item['key'], $item['value']) . Html::hiddenInput($item['key'] . '[type]', $item['type']) . '</div>' . '</div>' . '<div class="col-sm-4">' . Html::tag('span', $item['description']) . '</div>' . Html::label('active', 'active', ['class' => 'col-sm-2 control-label']) . '<div class="col-sm-1">' . Html::checkbox($item['key'] . '[active]', $this->has_checked($this->has_checked($item['active'])), ['data-atr' => 'icheck', 'class' => 'flat-red']) . '</div>';
     }
     return $res;
 }
Exemplo n.º 13
0
 private function variant($item, $checked)
 {
     $return = [];
     if ($checked) {
         $checked = in_array($item->id, $checked);
     }
     $return[] = Html::checkbox('variant', $checked, ['autocomplete' => 'off', 'id' => 'fieldvariant' . $item->id, 'data-id' => $item->id]);
     $return[] = ' ';
     $return[] = Html::label($item->value, 'fieldvariant' . $item->id);
     return Html::tag('li', implode('', $return));
 }
Exemplo n.º 14
0
 public function run()
 {
     if (is_null($this->imageOptions)) {
         $this->imageOptions = ['class' => 'img-responsive'];
     }
     $this->imageOptions['id'] = Yii::$app->getSecurity()->generateRandomString(10);
     $inputField = Html::getInputId($this->model, $this->attribute);
     echo Html::beginTag('div', ['id' => $inputField . '-cutter']);
     echo Html::activeFileInput($this->model, $this->attribute, ['class' => 'hide']);
     echo Html::beginTag('div', ['class' => 'preview-pane', 'style' => $this->model->{$this->attribute} ? 'display:block' : 'display:none']);
     echo Html::beginTag('div', ['class' => 'preview-container']);
     echo Html::img($this->previewImgSrc ? $this->previewImgSrc : $this->model->{$this->attribute}, ['class' => 'preview-image ' . $this->previewImgClass]);
     echo Html::endTag('div');
     echo Html::endTag('div');
     echo Html::checkbox($this->attribute . '-remove', false, ['label' => Yii::t('davfervaz/cutter', 'Remove photo')]);
     Modal::begin(['header' => Html::tag('h4', Yii::t('davfervaz/cutter', 'Select the cut area')), 'closeButton' => [], 'footer' => $this->getModalFooter($inputField), 'size' => Modal::SIZE_LARGE]);
     echo Html::beginTag('div', ['class' => 'image-container']);
     echo Html::img(null, $this->imageOptions);
     echo Html::endTag('div');
     echo Html::tag('br');
     echo Html::beginTag('div', ['class' => 'row']);
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'ASPECT_RATIO'), $inputField . '-aspectRatio');
     echo Html::textInput($this->attribute . '-aspectRatio', isset($this->cropperOptions['aspectRatio']) ? $this->cropperOptions['aspectRatio'] : 0, ['id' => $inputField . '-aspectRatio', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'ANGLE'), $inputField . '-dataRotate');
     echo Html::textInput($this->attribute . '-cropping[dataRotate]', '', ['id' => $inputField . '-dataRotate', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'POSITION') . ' (X)', $inputField . '-dataX');
     echo Html::textInput($this->attribute . '-cropping[dataX]', '', ['id' => $inputField . '-dataX', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'POSITION') . ' (Y)', $inputField . '-dataY');
     echo Html::textInput($this->attribute . '-cropping[dataY]', '', ['id' => $inputField . '-dataY', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'WIDTH'), $inputField . '-dataWidth');
     echo Html::textInput($this->attribute . '-cropping[dataWidth]', '', ['id' => $inputField . '-dataWidth', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::beginTag('div', ['class' => 'col-md-2']);
     echo Html::label(Yii::t('davfervaz/cutter', 'HEIGHT'), $inputField . '-dataHeight');
     echo Html::textInput($this->attribute . '-cropping[dataHeight]', '', ['id' => $inputField . '-dataHeight', 'class' => 'form-control']);
     echo Html::endTag('div');
     echo Html::endTag('div');
     Modal::end();
     echo Html::endTag('div');
     $view = $this->getView();
     CutterAsset::register($view);
     $options = ['inputField' => $inputField, 'useWindowHeight' => $this->useWindowHeight, 'cropperOptions' => $this->cropperOptions];
     $options = Json::encode($options);
     $view->registerJs('jQuery("#' . $inputField . '").cutter(' . $options . ');');
 }
Exemplo n.º 15
0
 public function run()
 {
     $list = [];
     $selectedValue = $this->model->{$this->attribute};
     $_index = 0;
     foreach ($this->items as $k => $v) {
         $list[] = Html::tag('li', Html::checkbox($this->name, $k == $selectedValue, ['id' => $this->id . '_' . $_index, 'hidden' => 'hidden']) . Html::label($v, $this->id . '_' . $_index));
         $_index++;
     }
     $this->options['class'] .= ' m00nk_b3w_checkboxlist';
     echo Html::tag('ul', implode('', $list), $this->options);
 }
Exemplo n.º 16
0
 /**
  * @inheritdoc
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         return $this->filter;
     }
     $model = $this->grid->filterModel;
     if ($this->filter !== false && $model instanceof Model && $this->attribute !== null && $model->isAttributeActive($this->attribute)) {
         $dateParts = explode('-', $model->{$this->attribute});
         Html::addCssClass($this->btnOptions, 'btn btn-container-open');
         $content = Html::beginTag('div', ['class' => 'column-filter']);
         $content .= Html::beginTag('div', ['class' => 'col-md-12 input-group']);
         $content .= Html::beginTag('span', ['class' => 'input-group-btn']);
         $content .= Html::button('...', $this->btnOptions);
         $content .= Html::endTag('span');
         $content .= Html::activeTextInput($model, $this->attribute, ['class' => 'form-control date-filter-range-input']);
         $content .= Html::endTag('div');
         $content .= Html::beginTag('div', ['class' => 'column-filter-container date-filter-range']);
         $content .= Html::beginTag('div', ['class' => 'row']);
         $content .= Html::beginTag('div', ['class' => 'dateFrom col-md-12']);
         $content .= Html::button($this->labelBtnApply, ['class' => 'btn-apply btn btn-success']);
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $content .= Html::beginTag('div', ['class' => 'row']);
         $content .= Html::beginTag('div', ['class' => 'dateFrom col-md-6']);
         $content .= Html::label($this->labelDateFrom);
         $content .= \kak\widgets\datetimepicker\DateTimePicker::widget(['name' => '', 'value' => isset($dateParts[0]) ? trim($dateParts[0]) : '', 'clientOptions' => $this->clientOptions, 'showInputIcon' => false]);
         $content .= Html::endTag('div');
         $content .= Html::beginTag('div', ['class' => 'dateTo col-md-6']);
         $content .= Html::label($this->labelDateTo);
         $content .= \kak\widgets\datetimepicker\DateTimePicker::widget(['name' => '', 'value' => isset($dateParts[1]) ? trim($dateParts[1]) : '', 'clientOptions' => $this->clientOptions, 'showInputIcon' => false]);
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $content .= Html::endTag('div');
         $error = '';
         if ($model->hasErrors($this->attribute)) {
             $error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
         }
         /*
         
         if (is_array($this->filter)) {
             $options = array_merge(['prompt' => ''], $this->filterInputOptions);
             return Html::activeDropDownList($model, $this->attribute, $this->filter, $options) . $error;
         } else {
         
         }
         */
         return $content . $error;
     }
     return $this->grid->emptyCell;
     /*parent::renderFilterCellContent();*/
 }
Exemplo n.º 17
0
 protected function renderControls()
 {
     $html = '';
     $html .= '<div class="form-group">';
     if ($this->labelPostcode) {
         $html .= Html::label($this->labelPostcode, 'proxPostcode', ['class' => 'lbl-prox-postcode ' . $this->labelClass]);
     }
     $html .= Html::textInput('proxPostcode', isset($_GET['proxPostcode']) ? $_GET['proxPostcode'] : '', ['id' => 'proxPostcode', 'class' => 'form-control']);
     $html .= '</div>';
     $html .= '<div class="form-group">';
     $html .= Html::dropDownList('proxDistance', isset($_GET['proxDistance']) ? $_GET['proxDistance'] : '', $this->distanceValues, ['id' => 'proxDistance', 'class' => 'form-control']);
     $html .= '</div>';
     return $html;
 }
Exemplo n.º 18
0
 /**
  * Rendering the widget dropdown.
  * Default page size is 20.
  * @return string
  */
 public function run()
 {
     $size = 20;
     $saved = Yii::$app->session->get('per-page');
     if (in_array($saved, $this->pageSizes)) {
         $size = $saved;
     }
     $selected = Yii::$app->request->get('per-page');
     if (in_array($selected, $this->pageSizes)) {
         $size = $selected;
     }
     Yii::$app->session->set('per-page', $size);
     return Html::tag('div', Html::tag('div', Html::label(Yii::t('podium/view', 'Results per page'), 'per-page') . ' ' . Html::dropDownList('per-page', $size, $this->pageSizes, ['class' => 'form-control input-sm', 'id' => 'per-page']), ['class' => 'form-group']), ['class' => 'pull-right form-inline']) . '<br><br>';
 }
Exemplo n.º 19
0
 public function generateTemplate($options)
 {
     $header = Html::tag('div', $options['headerContent'], ['class' => implode(' ', ['header', $options['headerOptions']]), 'id' => 'header-content']);
     $label = Html::label($options['labelContent'], $options['labelFor'], ['class' => $options['labelOptions'], 'id' => 'header-label']);
     $meta = Html::tag('div', implode('', ['<span id="meta-content">&nbsp;', $options['metaContent'], '</span>']), ['class' => implode(' ', ['meta', $options['metaOptions']])]);
     $content = Html::tag('div', $label . $header . $meta, ['class' => 'ui center aligned content']);
     $left_floated = Html::label($options['leftFloatedContent'], $options['leftFloatedFor'], ['id' => 'left-content', 'class' => $options['leftFloatedOptions'], 'style' => 'color: #555; font-weight: 600;']);
     $right_floated = Html::tag('span', Html::tag('div', $options['rightFloatedContent'] . '<div class="icon active" style="font-size: 16px;"></div>', ['id' => 'right-content', 'class' => implode(' ', ['ui star rating', $options['rightFloatedOptions']])]), ['class' => 'right floated', 'data-rating' => 1]);
     $extra_content = Html::tag('div', implode('', ['<span class="left floated">', $left_floated . '</span>' . $right_floated]), ['class' => 'extra content']);
     $image = Html::tag('div', Html::img($options['imageContent'], ['class' => 'tiny image']), ['class' => ['image']]);
     $card = Html::tag('div', $image . $content . $extra_content, ['class' => ['card']]);
     $template = Html::tag('div', $card, ['class' => ['ui center aligned stackable cards']]);
     return $template;
 }
Exemplo n.º 20
0
 /**
  * Runs the widget and render the output
  */
 public function run()
 {
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->id;
     }
     if ($this->encodeLabel) {
         $this->label = Html::encode($this->label);
     }
     $perPage = !empty($_GET[$this->pageSizeParam]) ? $_GET[$this->pageSizeParam] : 0;
     if (!$perPage) {
         $perPage = !empty($_SESSION['per-page']) ? $_SESSION['per-page'] : $this->defaultPageSize;
     }
     $listHtml = Html::dropDownList('per-page', $perPage, $this->sizes, $this->options);
     $labelHtml = Html::label($this->label, $this->options['id'], $this->labelOptions);
     $output = str_replace(['{list}', '{label}'], [$listHtml, $labelHtml], $this->template);
     return '<div class="pull-right">' . $output . '</div>';
 }
Exemplo n.º 21
0
 /**
  * Runs the widget and render the output
  */
 public function run()
 {
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->id;
     }
     $this->label1 = Yii::t('backend', 'View');
     $this->label2 = Yii::t('backend', 'records');
     if ($this->encodeLabel) {
         $this->label1 = Html::encode($this->label1);
         $this->label2 = Html::encode($this->label2);
     }
     $perPage = !empty($_GET[$this->pageSizeParam]) ? $_GET[$this->pageSizeParam] : $this->defaultPageSize;
     $listHtml = Html::dropDownList('per-page', $perPage, $this->sizes, $this->options);
     $label1Html = Html::label($this->label1, $this->options['id'], $this->label1Options);
     $label2Html = Html::label($this->label2, $this->options['id'], $this->label2Options);
     $output = str_replace(['{list}', '{label1}', '{label2}'], [$listHtml, $label1Html, $label2Html], $this->template);
     return $output;
 }
Exemplo n.º 22
0
 /**
  * Adds a save button. When clicked the form will be submitted with the $_POST value
  * of "saveAndStay". Use [[stayAfterSave()]] to redirect appropriately in a controller.
  * 
  * This method MUST be called within a form as it renders a hidden form field. The
  * hidden field is used to save the form with a submit button outside the form. 
  *
  * @param string $text a text for the button.
  * @param string $icon name of an icon type to use
  * @param array $options additional tag options
  * @return Toolbar the current toolbar instance to support chaining.
  */
 public function saveStay($text = null, $icon = 'refresh', $options = [])
 {
     if ($text === null) {
         $text = Yii::t('cms/toolbar', 'Update');
     }
     Yii::$app->getView()->registerJs('
         $("#save-stay-button").click(function(e){
             $("#' . static::POST_VAR_SAVE_STAY . '").val("1");
         });
         $("#save-button").click(function(e){
             $("#' . static::POST_VAR_SAVE_STAY . '").val("0");
         });
     ');
     $this->items[] = Html::label($this->createText($icon, $text), 'save-stay-button', $this->createButtonOptions($options));
     echo Html::submitInput('saveStay', ['style' => 'display:none;', 'id' => 'save-stay-button']);
     echo Html::hiddenInput(static::POST_VAR_SAVE_STAY, '', ['id' => static::POST_VAR_SAVE_STAY]);
     return $this;
 }
Exemplo n.º 23
0
 /**
  * Create a new Term model for hierarchical Taxonomy through AJAX request.
  */
 public function actionAjaxCreateHierarchical()
 {
     $item = '';
     $term = new Term();
     $termRelationship = new TermRelationship();
     if ($term->load(Yii::$app->request->post())) {
         if ($termRelationship->load(Yii::$app->request->post()) && $termRelationship->post_id) {
             $term->count = 1;
             if ($term->save()) {
                 $termRelationship->term_id = $term->id;
                 if ($termRelationship->save()) {
                     $item = $item . '<br />' . Html::label(Html::checkbox('termIds[]', true, ['value' => $term->id]) . $term->name);
                 }
             }
         } elseif ($term->save()) {
             $item = $item . '<br />' . Html::label(Html::checkbox('termIds[]', true, ['value' => $term->id]) . $term->name);
         }
     }
     return $item;
 }
Exemplo n.º 24
0
 public function init()
 {
     parent::init();
     $this->options['encodeSpaces'] = true;
     $postCategoryIds = [];
     if ($this->postId !== null) {
         $post = Post::find()->andwhere('cid=:cid', [':cid' => $this->postId])->one();
         $postCategories = $post->getCategories()->asArray()->all();
         $postCategoryIds = yii\helpers\ArrayHelper::getColumn($postCategories, 'mid');
     }
     $categories = CategoryTree::getInstance()->getAllCategories();
     $this->_inputStr = '<div class="form-group">';
     $this->_inputStr .= Html::label('分类');
     if (!empty($categories)) {
         foreach ($categories as $v) {
             $this->_inputStr .= '<div class="checkbox">';
             $this->_inputStr .= str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $v['depth'] - 1) . Html::checkbox('inputCategories[]', in_array($v['mid'], $postCategoryIds), ['label' => $v['name'], 'value' => $v['mid']]);
             $this->_inputStr .= '</div>';
         }
     }
     $this->_inputStr .= '</div>';
 }
Exemplo n.º 25
0
 /**
  * Create term taxonomy non-hierarchical
  */
 public function actionAjaxCreateHierarchical()
 {
     $term = new Term();
     $termRelationship = new TermRelationship();
     if ($term->load(Yii::$app->request->post())) {
         if ($termRelationship->load(Yii::$app->request->post()) && $termRelationship->post_id) {
             $term->term_count = 1;
             if ($term->save()) {
                 $termRelationship->term_id = $term->id;
                 if ($termRelationship->save()) {
                     echo '<br />';
                     echo Html::label(Html::checkbox('termIds', true, ['value' => $term->id, 'class' => 'new-i-check']) . ' ' . $term->term_name);
                 }
             }
         } else {
             if ($term->save()) {
                 echo '<br />';
                 echo Html::label(Html::checkbox('termIds', true, ['value' => $term->id]) . $term->term_name);
             }
         }
     }
 }
Exemplo n.º 26
0
 public function renderItem($item)
 {
     if (is_string($item)) {
         return Html::a(Html::img($item), $item, ['class' => 'gallery-item']);
     }
     $src = ArrayHelper::getValue($item, 'src');
     if ($src === null) {
         return null;
     }
     $url = ArrayHelper::getValue($item, 'url', $src);
     $options = ArrayHelper::getValue($item, 'options', []);
     Html::addCssClass($options, 'gallery-item');
     $inputHtml = [];
     foreach ($this->inputFields as $name => $label) {
         $values = ArrayHelper::getValue($item, 'values', []);
         if (is_integer($name)) {
             $inputHtml[] = Html::hiddenInput($label, $values[$label]);
         } else {
             $inputHtml[] = Html::label($label, $name) . Html::textInput($name, $values[$name]);
         }
     }
     $inputHtml = implode('', $inputHtml);
     return Html::a(Html::img($src) . $inputHtml, $url, $options);
 }
Exemplo n.º 27
0
        <h3 class="box-title">SEO</h3>

        <div class="box-tools pull-right">
            <a class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></a>
        </div>
    </div>

    <div class="box-body">

        <div class="form-group">
            <?php 
echo Html::label(Yii::t('writesdown', 'Keyword'), 'meta-keyword');
?>
            <?php 
echo Html::textInput("meta[seo][keywords]", isset($meta['keywords']) ? $meta['keywords'] : '', ['id' => 'meta-keyword', 'class' => 'form-control']);
?>
        </div>

        <div class="form-group">
            <?php 
echo Html::label(Yii::t('writesdown', 'Description'), 'meta-description');
?>
            <?php 
echo Html::textarea("meta[seo][description]", isset($meta['description']) ? $meta['description'] : '', ['id' => 'meta-description', 'class' => 'form-control']);
?>
        </div>

    </div>

</div>
        <?php $form = ActiveForm::begin(); ?>

        <?= $form->field($modelProduto, 'nome')->textInput(['maxlength' => true])->label('Produto Venda') ?>

        <?= $form->field($modelProduto, 'valorVenda')->widget(MaskMoney::classname(), [
            'options' => ['disabled' => true,
              ],
            'pluginOptions' => [
                'prefix' => 'R$ ',

                'allowNegative' => false,
            ]
        ]); ?>
        <p>
        <?=  Html::label('Preço de Custo de Produto')?>
     
        <?= 
       
        MaskMoney::widget([
    'name' => 'calculoPrecoProduto',
    'value' => $modelProduto->calculoPrecoProduto($modelProduto->idProduto),
            'options' => ['id' => 'valorantigo',],
]);
        ?>

   </p>
        <?= $form->field($modelProduto, 'valorVenda')->widget(MaskMoney::classname(), [
            'options' => ['id' => 'valornovo',],
            'pluginOptions' => [
                'prefix' => 'R$ ',
Exemplo n.º 29
0
echo Html::beginForm(['give-feedback', 'id' => $model['id'], 'evidenceId' => $evidence['id']], 'post');
?>
    <?php 
$array = [['value' => 1, 'estado' => 'Aceptado'], ['value' => 2, 'estado' => 'No aceptado']];
?>
    <?php 
echo Html::label('Aceptar avance?');
?>

    <?php 
echo Html::radioList('aceptado', 1, ArrayHelper::map($array, 'value', 'estado'), ['class' => "form-control", 'required' => true]);
?>

    <br>
    <?php 
echo Html::label('Retroalimentación');
?>
    <br>

    <?php 
echo Html::textarea('feedback', null, ['class' => "form-control", 'required' => true]);
?>
    <br>
    <?php 
echo Html::submitButton('Guardar', ['class' => 'btn btn-success pull-right']);
?>

    <?php 
echo Html::endForm();
?>
Exemplo n.º 30
0
							</br><?php 
echo Html::label("Pelanggaran", ["class" => "form-control"]);
?>
						
							<?php 
echo Html::input("text", "pelanggaran", null, ["placeholder" => "Pelanggaran", "required" => "required", "class" => "form-control"]);
?>
							</br><?php 
echo Html::label("Tanggal Melanggar", ["class" => "form-control"]);
?>
						
							<?php 
echo Html::input("date", "tgl_melanggar", null, ["required" => "required", "class" => "form-control"]);
?>
							</br><?php 
echo Html::label("Tindakan", ["class" => "form-control"]);
?>
						
							<?php 
echo Html::input("text", "tindakan", null, ["placeholder" => "Tindakan", "required" => "required", "class" => "form-control"]);
?>
				
						</div>
						<div class="form-group">
							<?php 
echo Html::submitButton('Save', ['class' => 'btn btn-primary', 'name' => 'save-button']);
?>
						</div>
					</div>
				</div>
			</div>