public function run()
 {
     $this->clientOptions['treeViewId'] = $this->treeViewId;
     $this->registerWidget();
     \yii\helpers\Html::addCssClass($this->options, 'execut-tree-filter-input');
     $inputOptions = $this->inputOptions;
     Html::addCssClass($inputOptions, 'form-control');
     $inputOptions['autocomplete'] = 'off';
     echo $this->_renderContainer(Html::input('text', 'search', null, $inputOptions) . '<span class="close" title="Clear search results">×</span>');
 }
Ejemplo n.º 2
0
 /**
  * Ham tao giao dien upload anh
  * @return string
  */
 public static function generateInsertFromUrl($image)
 {
     // Image preview
     $template = Html::beginTag('div', ['class' => 'col-sm-12']);
     $template .= Html::img($image, ['id' => 'embed_image_url']);
     $template .= Html::endTag('div');
     // Caption image
     $template .= Html::beginTag('div', ['class' => 'col-sm-12 embed_field']);
     $template .= Html::beginTag('label', ['class' => 'row']);
     $template .= Html::tag('span', 'Caption', ['class' => 'col-sm-12']);
     $template .= Html::textarea('', '', ['class' => 'form-control col-sm-12']);
     $template .= Html::endTag('label');
     $template .= Html::endTag('div');
     // Alt text image
     $template .= Html::beginTag('div', ['class' => 'col-sm-12 embed_field']);
     $template .= Html::beginTag('label', ['class' => 'row']);
     $template .= Html::tag('span', 'Alt text', ['class' => 'col-sm-12']);
     $template .= Html::input('text', '', '', ['class' => 'form-control col-sm-12']);
     $template .= Html::endTag('label');
     $template .= Html::endTag('div');
     return $template;
 }
Ejemplo n.º 3
0
 /**
  * @param null $options
  * @param null $pluginOptions
  *
  * @return string
  * @throws \Exception
  */
 public function getItem($options = null, $pluginOptions = null)
 {
     switch ($this->type) {
         case self::TYPE_TEXT:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_EMAIL:
             return Html::input('email', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_NUMBER:
             return Html::input('number', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_TEXTAREA:
             return Html::textarea('Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_COLOR:
             return ColorInput::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'options' => $options != null ? $options : ['class' => 'form-control']]);
         case self::TYPE_DATE:
             return DatePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]);
         case self::TYPE_TIME:
             return TimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['minuteStep' => 1, 'showSeconds' => true, 'showMeridian' => false]]);
         case self::TYPE_DATETIME:
             return DateTimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['format' => 'yyyy-mm-dd H:i:s', 'todayHighlight' => true]]);
         case self::TYPE_PASSWORD:
             return PasswordInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['showMeter' => true, 'toggleMask' => false]]);
         case self::TYPE_ROXYMCE:
             return RoxyMceWidget::widget(['id' => 'Setting_' . $this->code, 'name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'action' => Url::to(['roxymce/default']), 'options' => $options != null ? $options : ['title' => $this->getName()], 'clientOptions' => $pluginOptions != null ? $pluginOptions : []]);
         case self::TYPE_SELECT:
             return Select2::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'data' => $this->getStoreRange(), 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_MULTI_SELECT:
             $options['multiple'] = true;
             if (!isset($options['class'])) {
                 $options['class'] = 'form-control';
             }
             return Select2::widget(['name' => 'Setting[' . $this->code . ']', 'value' => explode(",", $this->value), 'data' => $this->getStoreRange(), 'options' => $options, 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_FILE_PATH:
             $value = Yii::getAlias($this->store_dir) . DIRECTORY_SEPARATOR . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control', 'multiple' => false], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreview' => !$this->isNewRecord ? [$this->value] : []]]);
         case self::TYPE_FILE_URL:
             $value = $this->store_url . '/' . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreviewAsData' => true, 'initialPreviewFileType' => self::fileType(pathinfo($this->value, PATHINFO_EXTENSION)), 'initialPreview' => !$this->isNewRecord ? $value : [], 'initialCaption' => $this->value]]);
         case self::TYPE_PERCENT:
             return RangeInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'html5Options' => ['min' => 0, 'max' => 100, 'step' => 1], 'options' => $options != null ? $options : ['class' => 'form-control'], 'addon' => ['append' => ['content' => '%']]]);
         case self::TYPE_SWITCH:
             $selector = explode(',', $this->store_range);
             if (count($selector) != 2) {
                 throw new ErrorException(Yii::t('setting', 'Switch Field should have store with 2 value, and negative is first. Example: no,yes'), 500);
             }
             return Html::hiddenInput('Setting[' . $this->code . ']', $selector[0]) . SwitchInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $selector[1], 'containerOptions' => ['class' => 'nv-switch-container'], 'options' => $options != null ? $options : [], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['state' => $this->value == $selector[1], 'size' => 'small', 'offText' => ucfirst($selector[0]), 'onText' => ucfirst($selector[1])]]);
         case self::TYPE_CHECKBOX:
             $random = rand(1000, 9999);
             return Html::checkboxList('Setting[' . $this->code . ']', explode(",", $this->value), $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list checkbox', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::checkbox($name, $checked, ['id' => 'Setting_checkbox_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_checkbox_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_RADIO:
             $random = rand(1000, 9999);
             return Html::radioList('Setting[' . $this->code . ']', $this->value, $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list radio', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::radio($name, $checked, ['id' => 'Setting_radio_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_radio_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_SEPARATOR:
             return '<hr>';
         default:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
     }
 }
Ejemplo n.º 4
0
 public function run()
 {
     return Html::input($this->type, $this->name, $this->value, $this->options);
 }
Ejemplo n.º 5
0
 /**
  * Function generate preview infomation image
  * @param $image Infomation image
  * @return string
  */
 public static function generatePreviewImage($image)
 {
     $image = Json::decode($image);
     $url = ArrayHelper::getValue($image, 'url');
     $title = ArrayHelper::getValue($image, 'title');
     $caption = ArrayHelper::getValue($image, 'caption');
     $alt_text = ArrayHelper::getValue($image, 'alt_text');
     $imageUrl = Yii::getAlias('@web') . DIRECTORY_SEPARATOR . Yii::$app->getModule('gallery')->syaDirUpload . DIRECTORY_SEPARATOR . $url;
     $imagePath = Yii::getAlias(Yii::$app->getModule('gallery')->syaDirPath) . Yii::$app->getModule('gallery')->syaDirUpload . DIRECTORY_SEPARATOR . $url;
     $info = FileHelper::getInfomation($imagePath);
     $basename = ArrayHelper::getValue($info, 'basename');
     $filesize = ArrayHelper::getValue($info, 'filesize');
     $fileatime = ArrayHelper::getValue($info, 'fileatime');
     $width = ArrayHelper::getValue($info, 'width');
     $height = ArrayHelper::getValue($info, 'height');
     $template = Html::tag('h3', Yii::t('gallery', 'ATTACHMENT DETAILS'), []);
     // Info img
     $template .= Html::beginTag('div', ['class' => 'sya_info_galllery row']);
     $template .= Html::beginTag('div', ['class' => 'col-md-6', 'style' => 'padding: 0;']);
     $template .= Html::img($imageUrl, []);
     $template .= Html::endTag('div');
     $template .= Html::beginTag('div', ['class' => 'col-md-6', 'style' => 'padding: 0; word-break: break-word;']);
     // File Name
     $template .= Html::beginTag('div', ['style' => 'font-weight: bold;']);
     $template .= $basename;
     $template .= Html::endTag('div');
     $template .= Html::beginTag('div', []);
     $template .= date('d/m/Y', $fileatime);
     $template .= Html::endTag('div');
     // File size
     $template .= Html::beginTag('div', []);
     $template .= $filesize;
     $template .= Html::endTag('div');
     $template .= Html::beginTag('div', []);
     $template .= $width . ' x ' . $height;
     $template .= Html::endTag('div');
     $template .= Html::endTag('div');
     $template .= Html::endTag('div');
     // Attribute img
     $template .= Html::beginTag('div', ['class' => 'col-md-12 form-horizontal', 'style' => 'margin-top: 20px;']);
     $template .= Html::beginForm(' ', ' ', ['id' => 'sya_gallery_form_preview']);
     // Url
     $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-url']);
     $template .= Html::tag('label', 'Url', ['class' => 'control-label col-sm-3']);
     $template .= Html::beginTag('div', ['class' => 'col-sm-9']);
     $template .= Html::input('text', 'sya_url', $url, ['class' => 'col-sm-10 form-control', 'readonly' => true]);
     $template .= Html::endTag('div');
     $template .= Html::endTag('div');
     // Title
     $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-title']);
     $template .= Html::tag('label', 'Title', ['class' => 'control-label col-sm-3']);
     $template .= Html::beginTag('div', ['class' => 'col-sm-9']);
     $template .= Html::input('text', 'sya_title', $title, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_title']);
     $template .= Html::endTag('div');
     $template .= Html::endTag('div');
     // Caption
     $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-caption']);
     $template .= Html::tag('label', 'Caption', ['class' => 'control-label col-sm-3']);
     $template .= Html::beginTag('div', ['class' => 'col-sm-9']);
     $template .= Html::textarea('sya_caption', $caption, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_caption']);
     $template .= Html::endTag('div');
     $template .= Html::endTag('div');
     // Alt text
     $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-alt-text']);
     $template .= Html::tag('label', 'Alt text', ['class' => 'control-label col-sm-3']);
     $template .= Html::beginTag('div', ['class' => 'col-sm-9']);
     $template .= Html::input('text', 'sya_alt_text', $alt_text, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_alt_text']);
     $template .= Html::endTag('div');
     $template .= Html::endTag('div');
     $template .= Html::endForm();
     $template .= Html::endTag('div');
     return $template;
 }
Ejemplo n.º 6
0
echo Html::submitButton(Yii::t('backend', 'Flush'), ['class' => 'btn btn-danger']);
?>
            <?php 
ActiveForm::end();
?>
        </div>
        <div class="col-xs-6">
            <h4><?php 
echo Yii::t('backend', 'Invalidate tag');
?>
</h4>
            <?php 
ActiveForm::begin(['action' => Url::to('flush-cache-tag'), 'method' => 'get', 'layout' => 'inline']);
?>
                <?php 
echo Html::dropDownList('id', null, ArrayHelper::map($dataProvider->allModels, 'name', 'name'), ['class' => 'form-control', 'prompt' => Yii::t('backend', 'Select cache')]);
?>
                <?php 
echo Html::input('string', 'tag', null, ['class' => 'form-control', 'placeholder' => Yii::t('backend', 'Tag')]);
?>
                <?php 
echo Html::submitButton(Yii::t('backend', 'Flush'), ['class' => 'btn btn-danger']);
?>
            <?php 
ActiveForm::end();
?>
        </div>
    </div>

</div>
Ejemplo n.º 7
0
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title"><?php 
    echo Lang::t('main/comments', 'modalCommentAlarmTitle');
    ?>
</h4>
            </div>
            <div class="modal-body">
                <?php 
    echo Lang::t('main/comments', 'msgCommentAlarm');
    ?>
                <?php 
    echo Html::input('text', 'alarmMsg', '', ['class' => 'form-control']);
    ?>
            </div>
            <div class="modal-footer">
                <?php 
    echo Html::a(Lang::t('main/dialogs', 'modalAlarm_alarmBtn'), Url::to(['comment/alarm']), ['id' => 'alarm-comment', 'class' => 'btn btn-danger', 'data-href' => Url::to(['comment/alarm']), 'data-msg-alarm' => Lang::t('main/dialogs', 'modalAlarm_msg'), 'data-id' => '']), ' ';
    ?>
                <button type="button" class="btn btn-default"
                        data-dismiss="modal"><?php 
    echo Lang::t('main/dialogs', 'cancel');
    ?>
</button>
            </div>
        </div>
    </div>
</div>