Example #1
0
 public function init()
 {
     $publishFolder = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets', false, -1, true);
     Yii::app()->clientScript->packages['_fileuploader'] = array('baseUrl' => $publishFolder, 'js' => array('js/vendor/jquery.ui.widget.js', 'js/jquery.iframe-transport.js', 'js/jquery.fileupload.js', 'js/jquery.fileupload-process.js'), 'css' => array('css/jquery.fileupload.css', 'css/jquery.fileupload-ui'), 'depends' => array('jquery', 'glyphicons'));
     Yii::app()->clientScript->registerPackage('_fileuploader');
     $this->render('index', array('controlId' => $this->id . '_uploader', 'uploadName' => $this->hasModel() ? CHtml::activeName($this->model, $this->attribute) : $this->name, 'uploadUrl' => CHtml::normalizeUrl($this->url), 'uploadId' => $this->hasModel() ? CHtml::activeId($this->model, $this->attribute) : "{$this->id}_{$this->name}", 'publicUrl' => $publishFolder));
 }
Example #2
0
 /**
  * @param array $widgetOptions Widget options.
  * @covers ::run
  * @dataProvider testRun_FieldRendering_Provider
  */
 public function testRun_FieldRendering($widgetOptions)
 {
     $widget = $this->makeWidget();
     foreach ($widgetOptions as $option => $value) {
         $widget->{$option} = $value;
     }
     $widgetOutput = $this->runAndCapture($widget);
     $value = isset($widgetOptions['model']) ? $widgetOptions['model']->login : $widgetOptions['value'];
     if (isset($widgetOptions['model'])) {
         $name = CHtml::activeName($widgetOptions['model'], $widgetOptions['attribute']);
     } elseif (isset($widgetOptions['htmlOptions']['name'])) {
         $name = $widgetOptions['htmlOptions']['name'];
     } else {
         $name = $widgetOptions['name'];
     }
     if (isset($widgetOptions['model'])) {
         $id = CHtml::activeId($widgetOptions['model'], $widgetOptions['attribute']);
     } elseif (isset($widgetOptions['htmlOptions']['id'])) {
         $id = $widgetOptions['htmlOptions']['id'];
     } else {
         $id = CHtml::getIdByName($widgetOptions['name']);
     }
     if ($widgetOptions['type'] == Select2::TYPE_TEXT) {
         $this->assertTag(['tag' => 'input', 'attributes' => ['type' => 'text', 'name' => $name, 'id' => $id, 'value' => $value, 'class' => 'baz']], $widgetOutput);
     } else {
         $this->assertTag(['tag' => 'select', 'attributes' => ['name' => $name, 'id' => $id, 'class' => 'baz']], $widgetOutput);
         $this->assertTag(['tag' => 'option', 'parent' => ['tag' => 'select'], 'attributes' => ['selected' => 'selected', 'value' => $value]], $widgetOutput);
     }
 }
Example #3
0
 public function init()
 {
     $this->options = array_merge($this->options, array('autoFocus' => true, 'showAnim' => 'fold'));
     $this->autoCompleteHtmlOptions = array_merge($this->autoCompleteHtmlOptions, array('name' => $this->returnId ? str_replace('[', '_disabled[', CHtml::activeName($this->model, $this->attribute)) : CHtml::activeName($this->model, $this->attribute), 'id' => CHtml::activeId($this->model, $this->attribute), 'value' => $this->value));
     if ($this->returnId) {
         $this->options = array_merge($this->options, array('select' => "js:function(event,ui){\n\t\t\t\t\t\t\t\t\$('input#'+\$(this).attr('id')+'[type=hidden]').attr('value',ui.item.id);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}"));
     }
 }
Example #4
0
 public static function getExtProducts($shipment)
 {
     $result = array();
     $products = self::model()->findAll();
     foreach ($products as $product) {
         array_push($result, array('boxLabel' => $product->name, 'name' => CHtml::activeName($shipment, 'service_type'), 'id' => str_replace(" ", "-", $product->name), 'inputValue' => $product->name, 'width' => 150, 'checked' => $shipment->service_type == $product->name));
     }
     return CJSON::encode($result);
 }
Example #5
0
 /**
  * @param $attribute
  * @return string
  */
 public function getName($attribute)
 {
     $name = $attribute;
     if ($this->model instanceof CActiveRecord && isset($this->model->{$attribute})) {
         $name = CHtml::activeName($this->model, $attribute);
     } elseif ($this->prefixName) {
         $name = $this->prefixName . "[{$attribute}]";
     }
     return $name;
 }
 protected function renderDataCellContent($row, $data)
 {
     $model = CustomerDiscount::model()->findByAttributes(array('customer_id' => $this->customer_id, 'service_id' => $data->id));
     if (!$model instanceof CustomerDiscount) {
         $model = new CustomerDiscount();
     }
     $options = $this->checkBoxHtmlOptions;
     $options['name'] = str_replace('CustomerDiscount', 'CustomerDiscount[' . $row . ']', CHtml::activeName($model, $this->forAttribute));
     $options['class'] = $this->id;
     echo CHtml::activeCheckBox($model, $this->forAttribute, $options);
 }
Example #7
0
 public function toRequestParams()
 {
     $attributes = array('objectId', 'instanceId', 'parameterId', 'tmpId');
     $result = array();
     foreach ($attributes as $attrName) {
         if ($this->{$attrName} === null) {
             continue;
         }
         $result[CHtml::activeName($this, $attrName)] = $this->{$attrName};
     }
     return $result;
 }
Example #8
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     Yii::import("sys.models.SysModules");
     $module = Yii::app()->controller->module->id;
     $sysModule = SysModules::model()->find(TUtil::qc('code') . "=:code", array(":code" => $module));
     if ($sysModule != null && $sysModule->enable_attachment == 0) {
         return;
     }
     $id = $this->id . '-file';
     $containerId = $this->id . '-container';
     $label = '从本地选择';
     if ($this->hasModel()) {
         $name = CHtml::activeName($this->model, $this->attribute) . '[]';
         $attributes = array('name' => $name, 'id' => $id, 'hideFocus' => true);
         if (isset($this->htmlOptions['accept'])) {
             $attributes['accept'] = $this->htmlOptions['accept'];
         }
         if (isset($this->htmlOptions['maxlength'])) {
             $attributes['maxlength'] = $this->htmlOptions['maxlength'];
         }
         if (isset($this->htmlOptions['multiple'])) {
             $attributes['multiple'] = $this->htmlOptions['multiple'];
         }
         if ($this->form) {
             $label .= $this->form->fileField($this->model, $this->attribute, $attributes);
         } else {
             $label .= CHtml::activeFileField($this->model, $this->attribute, $attributes);
         }
     }
     $this->controller->widget('bootstrap.widgets.TbButton', array('type' => $this->selectorType, 'label' => $label, 'icon' => 'storage', 'encodeLabel' => false, 'htmlOptions' => $this->htmlOptions));
     if ($this->enableFileFolder == true) {
         echo "   ";
         $this->controller->widget('bootstrap.widgets.TbButton', array('type' => $this->selectorType, 'label' => '从文件柜选择', 'buttonType' => 'button', 'icon' => 'folder', 'id' => $id . '_btn'));
     }
     if ($this->enableInsertPicture == true) {
         echo "   ";
         $this->widget('core.widgets.TPictureSelector', array('model' => $this->model, 'attribute' => $this->attribute . "_picture"));
     }
     if ($this->enableFileFolder == true) {
         echo "<div id='SelFileDiv'></div>";
     }
     echo CHtml::tag('div', array('id' => $containerId), '', true);
     if ($this->enableFileFolder == true) {
         echo CHtml::hiddenField('Sel_ATTACHMENT_ID', '', array('id' => 'Sel_ATTACHMENT_ID'));
         echo CHtml::hiddenField('Sel_ATTACHMENT_NAME', '', array('id' => 'Sel_ATTACHMENT_NAME'));
         $this->registerClientScript($id);
     }
     Yii::app()->bootstrap->registerAssetCss('bootstrap-file-selector.css');
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('multifile');
     $cs->registerScript(__CLASS__ . '#' . $this->id, "\n\$('#{$id}').MultiFile(" . CJavaScript::encode($this->options) . ")");
 }
Example #9
0
    public function run()
    {
        $model = $this->model;
        $cities = $this->cities;
        $locations = $model->locations;
        if (empty($locations)) {
            $location = new CompetitionLocation();
            $locations = array($location->attributes);
        }
        //tab
        echo CHtml::openTag('ul', array('class' => 'nav nav-tabs', 'role' => 'tablist'));
        foreach ($locations as $key => $location) {
            $index = $key + 1;
            echo CHtml::tag('li', array('class' => $key == 0 ? 'active' : ''), CHtml::tag('a', array('href' => '#location-' . $index, 'role' => 'tab', 'data-toggle' => 'tab'), '地址' . $index . ($key == 0 ? '<span class="required">*</span></a>' : '')));
        }
        echo '<li><a id="addLocation"><i class="fa fa-plus"></i> 添加</a></li>';
        echo CHtml::closeTag('ul');
        echo '<div class="text-danger col-lg-12">地址1必填,除非多地点比赛,否则请只填写一个地址,留空即可删去多余地址。</div>';
        //tab content
        echo CHtml::openTag('div', array('class' => 'tab-content locations'));
        foreach ($locations as $key => $location) {
            $index = $key + 1;
            echo CHtml::openTag('div', array('class' => 'tab-pane location' . ($key == 0 ? ' active' : ''), 'id' => 'location-' . $index));
            echo Html::formGroup($model, 'locations[province_id][]', array('class' => 'col-lg-6'), CHtml::label('省份', false), CHtml::dropDownList(CHtml::activeName($model, 'locations[province_id][]'), $location['province_id'], Region::getProvinces(false), array('class' => 'form-control province', 'prompt' => '')), CHtml::error($model, 'locations.province_id.' . $key, array('class' => 'text-danger')));
            echo Html::formGroup($model, 'locations[city_id][]', array('class' => 'col-lg-6'), CHtml::label('城市', false), CHtml::dropDownList(CHtml::activeName($model, 'locations[city_id][]'), $location['city_id'], isset($cities[$location['province_id']]) ? $cities[$location['province_id']] : array(), array('class' => 'form-control city', 'prompt' => '')), CHtml::error($model, 'locations.city_id.' . $key, array('class' => 'text-danger')));
            echo Html::formGroup($model, 'locations[venue_zh][]', array('class' => 'col-lg-12'), CHtml::label('中文地址', false), CHtml::textField(CHtml::activeName($model, 'locations[venue_zh][]'), $location['venue_zh'], array('class' => 'form-control')), CHtml::error($model, 'locations.venue_zh.' . $key, array('class' => 'text-danger')));
            echo Html::formGroup($model, 'locations[venue][]', array('class' => 'col-lg-12'), CHtml::label('英文地址', false), CHtml::textField(CHtml::activeName($model, 'locations[venue][]'), $location['venue'], array('class' => 'form-control')), CHtml::error($model, 'locations.venue.' . $key, array('class' => 'text-danger')));
            echo CHtml::closeTag('div');
        }
        echo CHtml::closeTag('div');
        Yii::app()->clientScript->registerScript('MultiLocations', <<<EOT
  \$(document).on('click', '#addLocation', function() {
    var location = \$('.location:last').clone();
    var index = \$('.location').length + 1;
    var tab = \$('<a role="tab" data-toggle="tab">').attr('href', '#location-' + index).text('地址' + index);
    location.appendTo(\$('.locations'));
    location.find('.province').val('').trigger('change');
    location.find('input').val('');
    location.attr('id', 'location-' + index).removeClass('active');
    \$('<li>').append(
      tab
    ).insertBefore(\$('#addLocation').parent());
    tab.tab('show');
  });
EOT
);
    }
Example #10
0
 /**
  * Create a div and the appropriate Javascript to make the div into the file upload area
  */
 public function run()
 {
     if (!$this->url || $this->url == '') {
         $this->url = Yii::app()->createUrl('site/upload');
     }
     echo CHtml::openTag('div', array('class' => 'dropzone', 'id' => 'fileup'));
     echo CHtml::closeTag('div');
     if (!$this->name && ($this->model && $this->attribute) && $this->model instanceof CModel) {
         $this->name = CHtml::activeName($this->model, $this->attribute);
     }
     $this->mimeTypes = CJavaScript::encode($this->mimeTypes);
     $options = CMap::mergeArray(array('url' => $this->url, 'parallelUploads' => 1, 'paramName' => $this->name, 'accept' => "js:function(file, done){if(jQuery.inArray(file.type,{$this->mimeTypes}) == -1 ){done('File type not allowed.');}else{done();}}", 'init' => "js:function(){this.on('success',function(file){{$this->onSuccess}});}"), $this->options);
     $options = CJavaScript::encode($options);
     $script = "Dropzone.options.fileup = {$options}";
     $this->registerAssets();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), $script, CClientScript::POS_END);
 }
Example #11
0
 public function init()
 {
     if (!$this->url) {
         $this->url = Yii::app()->createUrl('site/upload');
     }
     if (!$this->name && $this->model instanceof CModel && $this->attribute) {
         $this->name = CHtml::activeName($this->model, $this->attribute);
     }
     if (empty($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->id;
     } else {
         $this->id = $this->htmlOptions['id'];
     }
     if ($this->enableTranslate) {
         $this->initTranslate();
     }
 }
Example #12
0
 /**
  * @return array the name and the ID of the input.
  * @throws \foundation\exception\InvalidConfigException
  */
 protected function resolveNameID()
 {
     if ($this->name !== null) {
         $name = $this->name;
     } elseif (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } elseif ($this->hasModel()) {
         $name = \CHtml::activeName($this->model, $this->attribute);
     } else {
         throw new InvalidConfigException(\Yii::t('yii', '{class} must specify "model" and "attribute" or "name" property values.', array('{class}' => get_class($this))));
     }
     if (($id = $this->getId(false)) === null) {
         if (isset($this->htmlOptions['id'])) {
             $id = $this->htmlOptions['id'];
         } else {
             $id = \CHtml::getIdByName($name);
         }
     }
     return array($name, $id);
 }
Example #13
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id . '-file';
     $containerId = $this->id . '-container';
     $label = '选择文件';
     if ($this->hasModel()) {
         $name = CHtml::activeName($this->model, $this->attribute) . '[]';
         if ($this->form) {
             $label .= $this->form->fileField($this->model, $this->attribute, array('name' => $name, 'id' => $id, 'hideFocus' => true));
         } else {
             $label .= CHtml::activeFileField($this->model, $this->attribute, array('name' => $name, 'id' => $id, 'hideFocus' => true));
         }
     }
     $this->controller->widget('bootstrap.widgets.TbButton', array('label' => $label, 'size' => 'small', 'icon' => 'plus', 'encodeLabel' => false, 'htmlOptions' => $this->htmlOptions));
     echo CHtml::tag('div', array('id' => $containerId), '', true);
     Yii::app()->bootstrap->registerAssetCss('bootstrap-file-selector.css');
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('multifile');
     $cs->registerScript(__CLASS__ . '#' . $this->id, "\n\$('#{$id}').MultiFile(" . CJavaScript::encode($this->options) . ")");
 }
Example #14
0
 /**
  * Resolves name and ID of the input. Source property of the name and/or source property of the attribute
  * could be customized by specifying first and/or second parameter accordingly.
  * @param string $nameProperty class property name which holds element name to be used. This parameter
  * is available since 1.1.14.
  * @param string $attributeProperty class property name which holds model attribute name to be used. This
  * parameter is available since 1.1.14.
  * @return array name and ID of the input: array('name','id').
  * @throws CException in case model and attribute property or name property cannot be resolved.
  */
 protected function resolveNameID($nameProperty = 'name', $attributeProperty = 'attribute')
 {
     if ($this->{$nameProperty} !== null) {
         $name = $this->{$nameProperty};
     } elseif (isset($this->htmlOptions[$nameProperty])) {
         $name = $this->htmlOptions[$nameProperty];
     } elseif ($this->hasModel()) {
         $name = CHtml::activeName($this->model, $this->{$attributeProperty});
     } else {
         throw new CException(Yii::t('zii', '{class} must specify "model" and "{attribute}" or "{name}" property values.', array('{class}' => get_class($this), '{attribute}' => $attributeProperty, '{name}' => $nameProperty)));
     }
     if (($id = $this->getId(false)) === null) {
         if (isset($this->htmlOptions['id'])) {
             $id = $this->htmlOptions['id'];
         } else {
             $id = CHtml::getIdByName($name);
         }
     }
     return array($name, $id);
 }
Example #15
0
 /**
  * Create a div and the appropriate Javascript to make the div into the file upload area
  */
 public function run()
 {
     if (!$this->url || $this->url == '') {
         $this->url = Yii::app()->createUrl('site/upload');
     }
     if (!$this->name && ($this->model && $this->attribute) && $this->model instanceof CModel) {
         $this->name = CHtml::activeName($this->model, $this->attribute);
     }
     echo CHtml::openTag('div', CMap::mergeArray(array('class' => 'dropzone', 'id' => $this->name), $this->htmlOptions));
     echo CHtml::closeTag('div');
     $this->mimeTypes = CJavaScript::encode($this->mimeTypes);
     $onEvents = '';
     foreach ($this->events as $event => $func) {
         $onEvents .= "this.on('{$event}', function(param, param2, param3){{$func}} );";
     }
     $options = CMap::mergeArray(array('url' => $this->url, 'parallelUploads' => 5, 'paramName' => $this->name, 'accept' => "js:function(file, done){if(jQuery.inArray(file.type,{$this->mimeTypes}) == -1 ){done('File type not allowed.');}else{done();}}", 'init' => "js:function(){{$onEvents}}"), $this->options);
     $options = CJavaScript::encode($options);
     $script = "Dropzone.options.{$this->name} = {$options}";
     $this->registerAssets();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), $script, CClientScript::POS_LOAD);
 }
 public function actionResidence()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         throw new CHttpException('403');
     }
     if ($_POST) {
         $id = (int) $_POST['id'];
         $this_model = $_POST["who_this"];
         $who_model = $_POST['who_model'];
         $prefix = $_POST['prefix'];
         $model = !empty($_POST['model']) && class_exists($_POST['model']) ? new $_POST['model']() : '';
         $data = [];
         $empty = '';
         $js_param_two = 'region';
         if ($who_model == 'region') {
             $js_param_two = 'city';
             $regions = Regions::model()->findAllByAttributes(['id_' . $this_model => $id]);
             $data = CHtml::listData($regions, 'id_region', 'region_name_ru');
             $empty = 'Select region';
         } elseif ($who_model == 'city') {
             $js_param_two = '';
             $cities = City::model()->findAllByAttributes(['id_' . $this_model => $id]);
             $data = CHtml::listData($cities, 'id_city', 'city_name_ru');
             $empty = 'Select city';
         }
         $url = $this->createUrl('/residence/residence/residence');
         $name = $who_model;
         if ($model && $model instanceof CActiveRecord && isset($model->{$who_model})) {
             $name = CHtml::activeName($model, $who_model);
         } elseif ($prefix) {
             $name = $prefix . "[{$who_model}]";
         }
         if ($model && $model instanceof CActiveRecord && isset($model->{$who_model})) {
             $label = $model->getAttributeLabel($who_model);
         } else {
             $label = Yii::t('choose-city', $who_model);
         }
         $this->renderPartial('residence.views.widget._select_block', ['attribute' => $who_model, 'label' => $label, 'name' => $name, 'data' => $data, 'onChange' => "showCities{$prefix}(\$(this),'{$js_param_two}','{$who_model}','{$url}')", 'empty' => $empty]);
     }
 }
Example #17
0
 protected function resolveID($attr)
 {
     $name = CHtml::activeName($this->model, $attr);
     $id = CHtml::getIdByName($name);
     return $id;
 }
Example #18
0
<?php

/* @var UserController $this */
$cs = Yii::app()->clientScript;
$this->registerJsFile('user.js');
$cs->registerScript("registerForm", "User.showPassBind('showPass','register-form','" . CHtml::activeName($model, "user_password") . "');", CClientScript::POS_READY);
$form = $this->beginWidget('CActiveForm', array('id' => 'register-form', 'enableAjaxValidation' => true, 'enableClientValidation' => true, 'focus' => array($model, 'name'), 'htmlOptions' => array('class' => ''), 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false), 'errorMessageCssClass' => 'label label-important'));
?>
  <?php 
echo $form->errorSummary($model, false);
?>
  <fieldset>
    <div class="form-group">
      <?php 
echo $form->labelEx($model, 'name', array('class' => 'control-label'));
?>
        <?php 
echo $form->textField($model, 'name', array('class' => 'form-control'));
?>
        <?php 
echo $form->error($model, 'name');
?>
    </div>
<!-- +not-encode-mail -->
    <div class="form-group">
      <?php 
echo $form->labelEx($model, 'mail', array('class' => 'control-label'));
?>
        <?php 
echo $form->textField($model, 'mail', array('class' => 'form-control', 'type' => 'email'));
?>
Example #19
0
<table width="100%" class="form">
	<tr>
		<th width="160">
			<?php 
echo CHtml::activeLabelEx($category, 'name', array('for' => CHtml::activeId($category, 'i18nFormData[name_' . $lang . ']')));
?>
		</th>
		<td>
			<?php 
echo CHtml::textField(CHtml::activeName($category, 'i18nFormData') . '[name_' . $lang . ']', $category->i18nFormData['name_' . $lang], array('size' => 80));
?>
		</td>
	</tr>

	
	<tr>
		<th>
			<?php 
echo CHtml::activeLabelEx($category, 'is_released', array('for' => CHtml::activeId($category, 'i18nFormData[is_released_' . $lang . ']')));
?>
		</th>
		<td>
			<?php 
echo CHtml::hiddenField(CHtml::activeName($category, 'i18nFormData') . '[is_released_' . $lang . ']', 0, array('id' => false));
?>
			<?php 
echo CHtml::checkBox(CHtml::activeName($category, 'i18nFormData') . '[is_released_' . $lang . ']', $category->i18nFormData['is_released_' . $lang]);
?>
		</td>
	</tr>
</table>
Example #20
0
echo CHtml::activeLabelEx($product, 'content', array('for' => CHtml::activeId($product, 'i18nFormData[content_' . $lang . ']')));
?>
		</th>
		<td>
			<?php 
$this->widget('ext.tinymce.TinyMCEWidget', array('name' => CHtml::activeName($product, 'i18nFormData') . '[content_' . $lang . ']', 'value' => $product->i18nFormData['content_' . $lang], 'htmlOptions' => array('cols' => 30, 'rows' => 10)));
?>
			<?php 
echo Helper::fieldTips('输入 {gallery}, 该位置将会被替换成图库');
?>
			<?php 
echo CHtml::tag('div', array(), CHtml::link('移除/加载编辑器', '#', array('class' => 'toggle-tinymce-editor')));
?>
		</td>
	</tr> -->
	<tr>
		<th>
			<?php 
echo CHtml::activeLabelEx($product, 'is_released', array('for' => CHtml::activeId($product, 'i18nFormData[is_released_' . $lang . ']')));
?>
		</th>
		<td>
			<?php 
echo CHtml::hiddenField(CHtml::activeName($product, 'i18nFormData') . '[is_released_' . $lang . ']', 0, array('id' => false));
?>
			<?php 
echo CHtml::checkBox(CHtml::activeName($product, 'i18nFormData') . '[is_released_' . $lang . ']', $product->i18nFormData['is_released_' . $lang]);
?>
		</td>
	</tr>
</table>
Example #21
0
			<?php 
echo $form->error($model, 'stationID');
?>
		</div>

		<div class="row">
			<label>Character</label>
			<?php 
echo $form->dropDownList($model, 'characterID', $this->getCharacters());
?>
			<?php 
echo $form->error($model, 'characterID');
?>
		</div>
		
		<input name=<?php 
echo CHtml::activeName($model, 'typeID');
?>
 type="hidden" id="typeIDHidden">
		<div class="row buttons">
			<?php 
echo CHtml::submitButton('Submit');
?>
		</div>

	<?php 
$this->endWidget();
?>

	</div><!-- form -->
</div>
Example #22
0
												flex:.25,
												height:150,
												title:'SERVICE CHARGES',
												layout:'absolute',
												items:[
													{
														xtype:'textfield',
														labelWidth:120,
														fieldLabel:'1. Service Charge',
														anchor:'95%',
														id:<?php 
echo CJSON::encode(CHtml::activeId($shipment, 'shipping_charges'));
?>
,
														name:<?php 
echo CJSON::encode(CHtml::activeName($shipment, 'shipping_charges'));
?>
,
														value:<?php 
echo CJSON::encode($shipment->shipping_charges);
?>
,
														x:5,
														y:5
													},
													{
														xtype:'textfield',
														labelWidth:120,
														fieldLabel:'2. Insurance Charge',
														anchor:'95%',
														id:'insurance',
Example #23
0
echo Yii::app()->baseUrl;
?>
/ueditor/";
    (function(){window.UMEDITOR_CONFIG={UMEDITOR_HOME_URL:URL}})();
</script>
<?php 
$cs = Yii::app()->clientScript;
$cs->registerScriptFile(Yii::app()->baseUrl . '/ueditor/umeditor.js', CClientScript::POS_END);
$cs->registerScriptFile(Yii::app()->baseUrl . '/ueditor/lang/zh-cn/zh-cn.js', CClientScript::POS_END);
$cs->registerScriptFile(Yii::app()->baseUrl . '/common/uploadify/jquery.uploadify-3.1.min.js', CClientScript::POS_END);
?>
<textarea id="<?php 
echo CHtml::activeId($model, $attri);
?>
" name="<?php 
echo CHtml::activeName($model, $attri);
?>
" style="width:500px;height:200px;">
<?php 
echo zmf::text(array('action' => 'edit', 'encode' => 'yes'), $content);
?>
</textarea>
<textarea id="input_tmp" name="input_tmp" style="display: none"></textarea>
<input id="textareaid" type="hidden" value="<?php 
echo CHtml::activeId($model, $attri);
?>
"/>
<script>
var tipImgUploadUrl="<?php 
echo $upurl;
?>
Example #24
0
 /**
  * @return array the name and the ID of the drop-down element.
  */
 protected function resolveDropDownNameID()
 {
     $ni = array();
     if (!empty($this->name)) {
         $dname = $this->name;
     } else {
         if ($this->hasModel()) {
             $dname = CHtml::activeName($this->model, $this->dropDownAttribute);
             CHtml::resolveNameID($this->model, $this->dropDownAttribute, $ni);
         } else {
             throw new CException(Yii::t('EchMultiSelect.EchMultiSelect', '{class} must specify "model" and "dropDownAttribute" or "name" property values.', array('{class}' => get_class($this))));
         }
     }
     if (isset($this->dropDownHtmlOptions['id'])) {
         $id = $this->dropDownHtmlOptions['id'];
     } else {
         if (!empty($ni['id'])) {
             $id = $ni['id'];
         } else {
             $id = CHtml::getIdByName($dname);
         }
     }
     return array($dname, $id);
 }
Example #25
0
 public function testActiveName()
 {
     $testModel = new CHtmlTestModel();
     $this->assertEquals('CHtmlTestModel[attr1]', CHtml::activeName($testModel, 'attr1'));
     $this->assertEquals('CHtmlTestModel[attr2]', CHtml::activeName($testModel, 'attr2'));
     $this->assertEquals('CHtmlTestModel[attr3]', CHtml::activeName($testModel, 'attr3'));
     $this->assertEquals('CHtmlTestModel[attr4]', CHtml::activeName($testModel, 'attr4'));
 }
Example #26
0
            </div>
        </div>

        <div class="form-group" style="display: none;">
            <label class="control-label" for="<?php 
    echo CHtml::activeId($newAttachedFile, 'filePath');
    ?>
">
                Ссылка на файл
                <span class="required">*</span>
            </label>
            <div>
                <input type="text" id="<?php 
    echo CHtml::activeId($newAttachedFile, 'filePath');
    ?>
" name="<?php 
    echo CHtml::activeName($newAttachedFile, 'filePath');
    ?>
" class="form-control" value="<?php 
    $newAttachedFile->filePath;
    ?>
"/>
            </div>
        </div>

        <?php 
    echo BsHtml::submitButton('Добавить', array('color' => BsHtml::BUTTON_COLOR_PRIMARY));
    ?>
    <?php 
    $this->endWidget();
}
Example #27
0
 /**
  * Prepares widget to be used by setting necessary
  * configurations, publishing assets and registering
  * necessary javascripts and css to be rendered.
  */
 public function init()
 {
     $this->setDefaults();
     $config = $this->cleanConfig();
     $language = $this->cleanLanguage();
     $model = $this->model;
     $modelAttribute = $this->modelAttribute;
     // self::$model and self::$modelAttribute are specified
     if (isset($model, $modelAttribute)) {
         if (empty($config['id'])) {
             $config['id'] = $this->htmlOptions['id'] = CHtml::activeId($model, $modelAttribute);
         }
         if (empty($config['name'])) {
             $config['name'] = CHtml::activeName($model, $modelAttribute);
         }
         if ($this->showModelAttributeValue === true) {
             $modelAttributeValue = $model->{$modelAttribute};
             $this->contentValue = !empty($modelAttributeValue) ? $modelAttributeValue : null;
         }
     } else {
         //if name and id attributes are not specified in self::$config, generate them
         if (empty($config['id'])) {
             $config['id'] = 'xheditor_' . rand(1, 1000);
         }
         if (empty($config['name'])) {
             $config['name'] = 'xheditor';
         }
     }
     if (empty($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $config['id'];
     }
     $this->_field = CHtml::textArea($config['name'], $this->contentValue, $this->htmlOptions);
     // publish assets
     $assets = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xheditor';
     $this->_baseUrl = Yii::app()->getAssetManager()->publish($assets, true, -1, YII_DEBUG);
     // register css and js to be rendered
     $script_filename = str_replace(array('{version}', '{language}'), array($this->_XHeditor_version, $language), $this->_filename_pattern);
     Yii::app()->clientScript->registerCss($config['id'], '#' . $config['id'] . ' {width:' . $config['width'] . ';height:' . $config['height'] . ';}');
     Yii::app()->clientScript->registerScriptFile($this->_baseUrl . '/' . $script_filename);
     Yii::app()->clientScript->registerScript($config['id'], '$("#' . $config['id'] . '").xheditor(' . CJavaScript::encode($config) . ');');
 }
Example #28
0
 * Date: 02.11.14
 * Time: 22:20
 */
/* @var $this CController */
/* @var $formModel SurveyRequestStep4 */
/* @var $methods array */
/* @var $form BsActiveForm */
?>
<div class="form-group">
    <label class="control-label" for="<?php 
echo CHtml::activeId($formModel, 'minimalSelectionOfInvestigation');
?>
">
        Минимальная расчетная выборка для одного региона составляет
        <input name="<?php 
echo CHtml::activeName($formModel, 'minimalSelectionOfInvestigation');
?>
" id="<?php 
echo CHtml::activeId($formModel, 'minimalSelectionOfInvestigation');
?>
" class="form-control" type="number" value="<?php 
echo $formModel->minimalSelectionOfInvestigation ? $formModel->minimalSelectionOfInvestigation : 385;
?>
" style="width: 80px; display: inline;">
        анкет. Вы можете поменять размер выборки в большую (сокращение погрешности) или меньшую сторону (увеличение погрешности).
    </label>
</div>

<p>
    <b>Выберите метод сбора анкет:</b>
    <a class="view" title="Рекомендуем отметить все подходящие варианты. Вам будет предложен самый эффективный вариант с точки зрения соотношения стоимости и сроков" data-toggle="tooltip" href="#">
Example #29
0
            <?php 
echo Html::activeLabelEx($form, 'from_date');
?>

            <?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => CHtml::activeName($form, 'from_date'), 'value' => $form->from_date, 'options' => array('dateFormat' => "yy-mm-dd")));
?>
</div>

        <div class="row-form">
            <?php 
echo CHtml::activeLabelEx($form, 'to_date');
?>

            <?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => CHtml::activeName($form, 'to_date'), 'value' => $form->to_date, 'options' => array('dateFormat' => "yy-mm-dd")));
?>
</div>

        <div class="row-form">
            <?php 
echo Html::link('<span class="icon-medium icon-arrow-right-2 colorWhite"></span>', 'javascript:void(0)', array('class' => 'btn bBlue ', 'onClick' => '$("#filter_form").submit()'));
?>
        </div> <div class="clear"></div>
            <?php 
echo Html::endForm();
?>



        <div class="clear"></div></div>
Example #30
0
?>
"  name="<?php 
echo CHtml::activeName($model, 'lat');
?>
" class="form-control" placeholder="标注点的纬度">        
        </div>    
        <div class="input-group">
            <span class="input-group-addon">缩放</span>
            <input type="text" value="<?php 
echo $model->mapZoom;
?>
" id="<?php 
echo CHtml::activeId($model, 'mapZoom');
?>
"  name="<?php 
echo CHtml::activeName($model, 'mapZoom');
?>
" class="form-control" placeholder="当前地图缩放级别">
        </div>
    </div>
    <div class="pull-right">
        <div class="btn-group" role="group">
            <button type="button"  id="cancelmapbutton" class="btn btn-default">删除定位信息</button>
            <button type="button" class="btn btn-primary" onclick="$('.map-holder').slideUp();"><i class="fa fa-angle-double-up"></i></button>
        </div>
    </div>
    <div class="clearfix"></div>
    <script>
        $("#address").keypress(function (event) {
            var e = event || window.event;
            if ((e.keyCode == 13 || e.which == 13) && this.value != "") {