コード例 #1
4
ファイル: Cropper.php プロジェクト: servsol/yii2-cropper
 /**
  * @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);
 }
コード例 #2
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;
 }
コード例 #3
2
 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');
 }
コード例 #4
1
ファイル: SelectTree.php プロジェクト: Liv1020/cms
 /**
  * @inheritdoc
  */
 public function run()
 {
     try {
         $this->_initAndValidate();
         $valueArray = [];
         $trees = [];
         $valueSingle = "";
         $select = "";
         $singleInput = "";
         if (in_array($this->mode, [self::MOD_COMBO, self::MOD_MULTI])) {
             $valueArray = Html::getAttributeValue($this->model, $this->attribute);
             $select = Html::activeListBox($this->model, $this->attribute, ['16' => "16"], ['multiple' => true, 'class' => 'sx-controll-element', 'style' => 'display: none;']);
             $trees = Tree::find()->where(['id' => $valueArray])->all();
         }
         if (in_array($this->mode, [self::MOD_COMBO, self::MOD_SINGLE])) {
             $singleInput = Html::activeInput("hidden", $this->model, $this->attributeSingle, ['class' => 'sx-single']);
             $valueSingle = Html::getAttributeValue($this->model, $this->attributeSingle);
         }
         $src = UrlHelper::construct('/cms/admin-tree')->set('mode', $this->mode)->set('s', $valueArray)->setSystemParam(Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->setSystemParam(Module::SYSTEM_QUERY_NO_ACTIONS_MODEL, 'true')->enableAdmin()->toString();
         $id = "sx-id-" . md5(serialize([$this->clientOptions, $this->mode, $this->attributeMulti, $this->attributeSingle]));
         $selected = [];
         foreach ($trees as $tree) {
             $selected[] = $tree->id;
         }
         return $this->render('widget', ['widget' => $this, 'id' => $id, 'select' => $select, 'src' => $src, 'valueSingle' => $valueSingle, 'singleInput' => $singleInput, 'clientOptions' => Json::encode(['src' => $src, 'name' => $id, 'id' => $id, 'selected' => $selected, 'valueSingle' => $valueSingle])]);
         //$this->registerClientScript();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
コード例 #5
1
 public function renderTable()
 {
     $second_day = 24 * 60 * 60;
     $weekday = (int) date('N', time());
     $monday = time() - ($weekday - 1) * $second_day;
     $data = '';
     if ($this->model && $this->attribute) {
         $options = isset($this->options['inputOptions']) ? $this->options['inputOptions'] : [];
         $data = Html::activeInput('hidden', $this->model, $this->attribute, $options);
     }
     for ($i = 0; $i < 7; $i++) {
         $weekday = Yii::$app->getFormatter()->asDate($monday + $i * $second_day, 'php:D');
         $data .= Html::beginTag('tr', ['data' => ['day' => $i, 'title' => $weekday]]);
         $data .= Html::tag('td', $weekday, ['class' => 'weekday']);
         $data .= $this->renderTime($i, '-');
         $data .= Html::endTag('tr');
     }
     $data .= Html::beginTag('tr');
     $data .= Html::tag('td', '', ['class' => 'weekday']);
     for ($i = 0; $i < 24; $i++) {
         $data .= Html::tag('td', ($i <= 9 ? '&nbsp;' . $i : $i) . ':00 ' . ($i + 1 <= 9 ? '&nbsp;' . ($i + 1) : $i + 1) . ':00', ['class' => 'time']);
     }
     $data .= Html::endTag('tr');
     $return = Html::tag('div', '', ['class' => 'clearfix']);
     $return .= $this->renderButtons();
     $return .= Html::tag('div', Html::tag('table', $data, ['id' => 'schedule-week-time']), ['class' => 'col-sm-10']);
     unset($data);
     return $return;
 }
コード例 #6
0
 /**
  * @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);
 }
コード例 #7
0
ファイル: TagsInput.php プロジェクト: asofter/yii2-tagsinput
 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);
     }
 }
コード例 #8
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);
     }
 }
コード例 #9
0
ファイル: FileUpload.php プロジェクト: itzj86/yii2-dwz
 public function run()
 {
     $view = $this->getView();
     FileUploadAsset::register($view);
     $this->createUploaderOptions();
     $this->options['class'] = 'required';
     echo Html::hiddenInput(Html::getInputName($this->model, $this->attribute), '', ['id' => 'dwz-file-uploader']);
     echo Html::activeInput('file', $this->model, $this->attribute, $this->options);
 }
コード例 #10
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);
     }
 }
コード例 #11
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);
     }
 }
コード例 #12
0
 protected function registerPlugin()
 {
     if ($this->selector) {
         $this->registerJs($this->selector, $this->options, $this->callback);
     } else {
         $id = $this->htmlOptions['id'];
         echo Html::activeInput('text', $this->model, $this->attribute, $this->htmlOptions);
         // echo Html::tag('input', '', $this->htmlOptions);
         $this->registerJs("#{$id}", $this->options, $this->callback);
     }
 }
コード例 #13
0
 protected function registerPlugin()
 {
     if ($this->selector) {
         $this->registerJs($this->selector, $this->options, $this->callback);
     } else {
         $id = $this->options['id'];
         $input = $this->hasModel() ? Html::activeInput('text', $this->model, $this->attribute, $this->options) : Html::textInput($this->name, $this->value, $this->options);
         echo $input;
         $this->registerJs("#{$id}", $this->options, $this->callback);
     }
 }
コード例 #14
0
ファイル: Datepicker.php プロジェクト: utiuam/uamext
 public function run()
 {
     $view = $this->getView();
     $id = $this->options['id'];
     //Register DtGridViewAsset
     DatepickerAsset::register($view);
     $content = Html::activeInput($this->type, $this->model, $this->attribute, $this->options);
     $clientOptions = Json::encode($this->clientOptions);
     $view->registerJs("jQuery('#{$id}').datepicker({$clientOptions});");
     return $content;
 }
コード例 #15
0
ファイル: Inputmask.php プロジェクト: utiuam/uamext
 public function run()
 {
     //var_dump($this->attribute);exit();
     $view = $this->getView();
     $id = $this->options['id'];
     //Register DtGridViewAsset
     InputmaskAsset::register($view);
     $content = Html::activeInput($this->type, $this->model, $this->attribute, $this->options);
     $clientOptions = Json::encode($this->clientOptions);
     $alias = Json::encode($this->alias);
     $view->registerJs("jQuery('#{$id}').inputmask({$alias},{$clientOptions});");
     return $content;
 }
コード例 #16
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->render) {
         if ($this->hasModel()) {
             switch ($this->editorType) {
                 case 'uploadButton':
                     return Html::activeInput('text', $this->model, $this->attribute, $this->options) . '<input type="button" id="uploadButton" value="Upload" />';
                     break;
                 case 'colorPicker':
                     return Html::activeInput('text', $this->model, $this->attribute, $this->options) . '<input type="button" id="colorpicker" value="打开取色器" />';
                     break;
                 case 'fileManager':
                     return Html::activeInput('text', $this->model, $this->attribute, $this->options) . '<input type="button" id="filemanager" value="浏览服务器" />';
                     break;
                 case 'imageDialog':
                     $value = $this->model->isNewRecord ? $this->defaultImg : Html::getAttributeValue($this->model, $this->attribute);
                     return "<img id='thumb-img-{$this->id}' type='img' src='{$value}' style='max-height:100px;' />\n                            <input type='hidden' id='thumb-{$this->id}' name='{$this->name}' value='{$value}' class='input-medium' data-rule-url='true' />\n                            <a id='img-{$this->id}' class='btn insertimage'>选择图片</a>";
                     break;
                 case 'fileDialog':
                     return Html::activeInput('text', $this->model, $this->attribute, $this->options) . '<input type="button" id="insertfile" value="选择文件" />';
                     break;
                 default:
                     return Html::activeTextarea($this->model, $this->attribute, $this->options);
                     break;
             }
         } else {
             switch ($this->editorType) {
                 case 'uploadButton':
                     return Html::input('text', $this->id, $this->value, $this->options) . '<input type="button" id="uploadButton" value="Upload" />';
                     break;
                 case 'colorPicker':
                     return Html::input('text', $this->id, $this->value, $this->options) . '<input type="button" id="colorpicker" value="打开取色器" />';
                     break;
                 case 'fileManager':
                     return Html::input('text', $this->id, $this->value, $this->options) . '<input type="button" id="filemanager" value="浏览服务器" />';
                     break;
                 case 'imageDialog':
                     $value = $this->model->isNewRecord ? get_params('UPLOAD_DEFAULT_IMG') : Html::getAttributeValue($this->model, $this->attribute);
                     return "<img id='thumb_img_{$this->id}' type='img' src='{$value}' style='max-height:100px;' />\n                            <input type='hidden' id='thumb-{$this->id}' name='{$this->name}' value='' class='input-medium' data-rule-url='true' />\n                            <a id='img-{$this->id}' class='btn insertimage'>选择图片</a>";
                     break;
                 case 'fileDialog':
                     return Html::input('text', $this->id, $this->value, $this->options) . '<input type="button" id="insertfile" value="选择文件" />';
                     break;
                 default:
                     return Html::textarea($this->id, $this->value, $this->options);
                     break;
             }
         }
     }
 }
コード例 #17
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);
     }
 }
コード例 #18
0
ファイル: Search.php プロジェクト: anli/yii2-metronic
 /**
  * Renders the widget.
  */
 public function run()
 {
     echo Html::beginTag('div', ['class' => 'portlet-input input-inline']);
     echo Html::beginTag('div', ['class' => 'input-icon right']);
     echo Html::tag('i', '', ['class' => 'icon-magnifier']);
     ActiveForm::begin(['action' => $this->url, 'method' => 'get']);
     echo Html::activeInput('text', $this->searchModel, 'searchField', ['class' => 'form-control input-circle', 'placeholder' => 'search...', 'autofocus' => true]);
     ActiveForm::end();
     echo Html::endTag('div');
     // portlet-input input-inline
     echo Html::endTag('div');
     // input-icon right
     echo ' ';
     echo Html::a(Html::tag('i', '', ['class' => 'fa fa-refresh']), $this->resetUrl, ['class' => 'btn btn-circle purple btn-sm', 'accesskey' => '', 'data-toggle' => 'tooltip', 'title' => 'Reset Search']);
 }
コード例 #19
0
ファイル: KindEditor.php プロジェクト: pjkui/kindeditor
 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;
         }
     }
 }
コード例 #20
0
 /**
  * 输出模型的属性
  * @param unknown $type    输入框类型
  * @param unknown $model    模型
  * @param unknown $attribute 属性
  * @param array $Options  选项
  *              inputOptions  输入框选项
  *                   placeholder   占位文字(默认是属性的名称)
  *              glyphicon     图标       
  */
 public function echoField($type, $model, $attribute, $Options)
 {
     if (!isset($Options['inputOptions'])) {
         $Options['inputOptions'] = ['class' => 'form-control'];
     } else {
         $Options['inputOptions']['class'] = 'form-control';
     }
     if (!isset($Options['inputOptions']['placeholder'])) {
         $Options['inputOptions']['placeholder'] = Html::encode($model->getAttributeLabel($attribute));
     }
     echo Html::beginTag('div', ['class' => 'form-group has-feedback']);
     echo Html::activeInput($type, $model, $attribute, $Options['inputOptions']);
     if (isset($Options['glyphicon'])) {
         echo Html::tag('span', '', ['class' => 'glyphicon ' . $Options['glyphicon'] . ' form-control-feedback']);
     }
     echo Html::endTag('div');
 }
コード例 #21
0
 public function run()
 {
     $inputName = Html::getInputName($this->model, $this->attribute);
     $replace['{hiddenInput}'] = Html::hiddenInput($inputName, '');
     if (!empty($this->imageUrl)) {
         $replace['{image}'] = Html::img($this->imageUrl, $this->imageOptions);
         $this->checkboxOptions['value'] = FileUploadBehavior::DELETE_VALUE;
         $replace['{checkbox}'] = strtr($this->checkboxTemplate, ['{checkbox}' => Html::checkbox($inputName, false, $this->checkboxOptions), '{checkboxLabel}' => \Yii::t('yii', 'Delete')]);
     } else {
         $replace['{image}'] = '';
         $replace['{checkbox}'] = '';
     }
     if ($this->hasModel()) {
         $replace['{fileInput}'] = Html::activeInput('file', $this->model, $this->attribute, $this->options);
     } else {
         $replace['{fileInput}'] = Html::input('file', $this->name, '', $this->options);
     }
     echo strtr($this->template, $replace);
 }
コード例 #22
0
 /**
  * Initializes the widget
  *
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if (!in_array($this->type, self::$_allowedTypes)) {
         $types = implode("', '", self::$_allowedTypes);
         throw new InvalidConfigException("Invalid 'type' entered. Must be one of: '{$types}'.");
     }
     parent::init();
     if (empty($this->options['class'])) {
         $this->options['class'] = 'form-control';
     }
     $this->initPluginOptions();
     if ($this->label !== false) {
         echo $this->getLabel();
     }
     if ($this->type == self::TYPE_HTML5) {
         $type = ArrayHelper::remove($this->options, 'type', 'text');
         $input = $this->hasModel() ? Html::activeInput($type, $this->model, $this->attribute, $this->options) : Html::input($type, $this->name, $this->value, $this->options);
     } else {
         $input = $this->getInput($this->type);
     }
     echo $input;
     $this->registerAssets();
 }
コード例 #23
0
ファイル: ImageInput.php プロジェクト: h11Nox/slug
 /**
  * Запустить
  * процесс
  * @return string
  */
 public function run()
 {
     $blockId = Html::getInputId($this->model, $this->attribute) . '-block';
     $content = Html::beginTag('div', ['class' => 'c-file-block', 'id' => $blockId]);
     $content .= Html::activeHiddenInput($this->model, $this->attribute);
     $fileInput = Html::activeInput('file', $this->model, $this->attribute, ['class' => 'styled']);
     $content .= '<div class="box box-success img-preview">';
     if ($this->model->{$this->attribute} instanceof AttachFileModel && $this->model->{$this->attribute}->isExists()) {
         $size = $this->model->{$this->attribute}->getSize();
         $buttonId = Html::getInputId($this->model, $this->attribute);
         $content .= '<div class="img">';
         $content .= '<img src="' . $this->model->{$this->attribute}->getThumb('220x160', 2) . '" /></div>';
         $content .= '<div class="controls-blk">' . $fileInput;
         $content .= '<a href="' . $this->model->{$this->attribute}->getDownloadLink() . '" class="btn btn-success btn-small control-btn">Скачать ' . $size . '</a>';
         $content .= '<div class="delete-row"><a class="btn btn-danger btn-small delete-file control-btn" href="javascript:void(0);" id="' . $buttonId . '">Удалить</a></div></div>';
         $js = "\n                \$(document).ready(function(){\n                    var \$block = \$('#{$blockId}');\n                    var \$img = \$block.find('img');\n                    \$block.find('.delete-file').click(function(){\n                        \$block.addClass('deleted').find('input[type=\"hidden\"]').val('remove');\n                    });\n                });\n            ";
         $this->getView()->registerJs($js);
     } else {
         $content .= '<div class="controls-blk">' . $fileInput . '</div>';
     }
     $content .= '</div></div>';
     return $content;
 }
コード例 #24
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $jsOptions = ['clientOptions' => $this->clientOptions, 'crop_class' => $this->crop_class];
     if ($this->hasModel()) {
         echo Html::activeInput('file', $this->model, $this->attribute, $this->options);
         $crops = null;
         foreach ($this->model->getBehaviors() as $beh) {
             if (!empty($beh->attribute) && $beh->attribute == $this->attribute && $beh instanceof CropImageUploadBehavior) {
                 $crops = $beh->getConfigurations();
                 $this->url = $beh->url;
                 break;
             }
         }
         if (!$crops) {
             throw new InvalidConfigException("CropImageUploadBehavior is not found for {$this->attribute} attribute");
         }
         $jsOptions['crops'] = [];
         $input_name = Html::getInputName($this->model, $this->attribute);
         $input_id = Html::getInputId($this->model, $this->attribute);
         echo Html::hiddenInput($input_name . '[file]', Html::getAttributeValue($this->model, $this->attribute), ['id' => $input_id . '_image']);
         foreach ($crops as $ind => $crop) {
             $crop_id = $input_id . '_crop' . $ind;
             echo Html::hiddenInput($input_name . '[' . $ind . ']', $crop['value'] === false ? '-' : $crop['value'], ['id' => $crop_id]);
             $jsOptions['crops'][] = ['input_id' => $crop_id, 'ratio' => $crop['ratio'], 'image' => $crop['image']];
         }
     } else {
         echo Html::fileInput($this->name, $this->value, $this->options);
         $crop_id = (isset($this->options['id']) ? $this->options['id'] : $this->name . '_id') . '_' . $this->crop_field;
         echo Html::hiddenInput($this->crop_field, $this->crop_value, ['id' => $crop_id]);
         $jsOptions['crops'][] = ['input_id' => $crop_id, 'ratio' => $this->ratio];
     }
     if ($this->url) {
         $this->url = \Yii::getAlias($this->url);
     }
     $jsOptions['url'] = $this->url;
     $this->registerPlugin($jsOptions);
 }
コード例 #25
0
ファイル: _item.php プロジェクト: apurey/cmf
    ?>
" src="<?php 
    echo $row->getPreviewUrl();
    ?>
">
    <?php 
}
?>

    <div class="caption">
        <div class="form-group">
            <?php 
echo Html::activeInput('text', $row, 'label', ['name' => $row->formName() . '[' . $row->id . '][label]', 'class' => 'form-control']);
?>
            <?php 
echo Html::activeInput('hidden', $row, 'position', ['name' => $row->formName() . '[' . $row->id . '][position]', 'class' => 'form-control']);
?>
        </div>
        <p>
            <a class="btn btn-danger" href="<?php 
echo Url::to(['/cp/magic/manage/delete', 'id' => $row->id]);
?>
" data-pjax="1"><?php 
echo Yii::t('yii', 'Delete');
?>
</a>

            <?php 
echo Html::submitButton(Yii::t('yii', 'Update'), ['class' => 'btn btn-primary']);
?>
コード例 #26
0
?>
										<div class="form-body">
											<div class="form-group">
												<label class="control-label col-md-3">ชื่อบ่อ<span class="required">*</span></label>
												<div class="col-md-9">
													<?php 
echo Html::activeInput('text', $model, 'name', ['class' => 'form-control', 'placeholder' => 'กรุณาระบุ ชื่อบ่อ']);
?>
												</div>
											</div>
											
											<div class="form-group">
												<label class="control-label col-md-3">ขนาดบ่อ<span class="required">*</span></label>
												<div class="col-md-9">
													<?php 
echo Html::activeInput('text', $model, 'size', ['class' => 'form-control', 'placeholder' => 'กรุณาระบุ  ขนาดของบ่อ']);
?>
												</div>
											</div>
											 <div class="form-group">
													<label class="control-label col-md-3">ผู้ดูแลบ่อ</label>
													<div class="col-md-9">
													<?php 
echo Html::dropDownList('user[]', unserialize($model->keeper), $arrUser, ['id' => 'type', 'class' => 'form-control select2-multiple', 'multiple' => '']);
?>
	
													</div>
												</div>
											<div class="form-group">
												<label class="control-label col-md-3"></label>
												<div class="col-md-9">
コード例 #27
0
JS;
$this->registerJs($script);
?>
<div id='maindiv'>
<input type='hidden' id="hiddenItemId" value = "<?php 
echo $itemData['item_id'];
?>
"/>
<?php 
echo '<label class="control-label">Name</label>';
echo Html::activeInput('text', $itemModel, 'item_name', ['style' => 'width:150px', 'value' => $itemData['item_name'], 'class' => 'form-control', 'id' => 'itemnametextbox']);
?>
<br/>
<?php 
echo '<label class="control-label">Hashtag</label>';
echo Html::activeInput('text', $itemModel, 'item_hashTag', ['style' => 'width:150px', 'value' => $itemData['item_hashTag'], 'class' => 'form-control', 'id' => 'itemhashtextbox']);
?>
<br/>
<?php 
echo '<label class="control-label">Mirror Value</label>';
for ($i = 0; $i < sizeof($mirrorValues); $i++) {
    if ($itemData['item_mirrorval'] == $mirrorValues[$i]) {
        $itemModel->item_mirrorval = $i;
        break;
    }
}
?>
<br/>
<?php 
echo Html::activeDropDownList($itemModel, 'item_mirrorval', $mirrorValues, ['id' => 'itemmirrvallist', 'style' => 'width:150px']);
?>
コード例 #28
0
ファイル: form.php プロジェクト: worstinme/yii2-zoo
<?php

use yii\helpers\Html;
$this->registerJs($model->addValidators($this, 'name'), 5);
?>

<?php 
echo Html::activeLabel($model, 'name', ['class' => 'uk-form-label']);
?>

<div class="uk-from-controls">
	<?php 
echo Html::activeInput('text', $model, 'name', ['class' => 'uk-width-1-1']);
?>
	<div class="uk-form-help-block uk-text-danger"></div>
</div>
コード例 #29
0
ファイル: _search.php プロジェクト: vinhhx/yii2_basic_startup
echo Html::activeInput('text', $model, 'id', array('placeholder' => $model->getAttributeLabel('id'), 'style' => 'width:100px'));
?>
            </li>
            <li class="form-item">
                <?php 
echo Html::activeInput('text', $model, 'username', array('placeholder' => $model->getAttributeLabel('username'), 'style' => 'width:150px'));
?>
            </li>
            <li class="form-item">
                <?php 
echo Html::activeInput('text', $model, 'email', array('placeholder' => $model->getAttributeLabel('email'), 'style' => 'width:150px'));
?>
            </li>
            <li class="form-item">
                <?php 
echo Html::activeInput('text', $model, 'phone', array('placeholder' => $model->getAttributeLabel('phone'), 'style' => 'width:150px'));
?>
            </li>
            <li class="form-item">
                <?php 
echo Html::activeDropDownList($model, 'status', \app\models\User::getStatusLabels(), array('prompt' => 'Trạng thái', 'style' => 'width:150px'));
?>
            </li>
            <li class="form-item">
                <?php 
echo Html::submitButton('Tìm kiếm', ['class' => 'btn btn-primary']);
?>
                <?php 
echo Html::resetButton('Reset', ['class' => 'btn btn-default']);
?>
            </li>
コード例 #30
-1
 /**
  * Renders an input tag.
  * @param string $type the input type (e.g. 'text', 'password')
  * @param array $options the tag options in terms of name-value pairs. These will be rendered as
  * the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
  * @return static the field object itself
  */
 public function input($type, $options = [])
 {
     $options = array_merge($this->inputOptions, ['class' => 'hint-' . Html::getInputId($this->model, $this->attribute)]);
     $this->adjustLabelFor($options);
     $this->parts['{input}'] = Html::activeInput($type, $this->model, $this->attribute, $options);
     return $this;
 }