public function actionGetVariations() { if (Yii::app()->request->isAjaxRequest && isset($_POST['product'])) { $product = Products::model()->findByPk($_POST['product']); echo CHtml::hiddenField('product_id', $product->product_id); if ($variations = $product->getVariations()) { foreach ($variations as $variation) { $field = "Variations[{$variation[0]->specification_id}][]"; echo '<div class="shop-variation-element">'; echo '<strong>' . CHtml::label($variation[0]->specification->title . '</strong>', $field, array('class' => 'lbl-header')); if ($variation[0]->specification->required) { echo ' <span class="required">*</span>'; } echo '<br />'; if ($variation[0]->specification->input_type == 'textfield') { echo CHtml::textField($field); } else { if ($variation[0]->specification->input_type == 'select') { // If the specification is required, preselect the first field. // Otherwise let the customer choose which one to pick // $product->variationCount > 1 ? true : false means, that the // widget should display the _absolute_ price if only 1 variation // is available, otherwise the relative (+ X $) echo CHtml::radioButtonList($field, $variation[0]->specification->required ? $variation[0]->id : null, ProductVariation::listData($variation, $product->variationCount > 1 ? true : false), array('template' => '{input} {label}', 'separator' => '<div class="clear"></div>')); } } echo '</div>'; } } } else { throw new CHttpException(404); } }
public function run() { /* <div class="switch-toggle switch-3 switch-ios large-9 columns" data="<?php echo $checked->accepted ?>"> <input id="DataItem_<?php echo $genId ?>_accepted_0" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="1" <?php echo $checked->accepted==1?'checked':''?> /> <label for="DataItem_<?php echo $genId ?>_accepted_0" onclick="">Yes</label> <input id="DataItem_<?php echo $genId ?>_accepted_1" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="-1" <?php echo $checked->accepted==-1?'checked':''?> /> <label for="DataItem_<?php echo $genId ?>_accepted_1" onclick="">No</label> <input id="DataItem_<?php echo $genId ?>_accepted_2" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="0" <?php echo $checked->accepted==0?'checked':''?> /> <label for="DataItem_<?php echo $genId ?>_accepted_2" onclick="">N/A</label> <a></a> </div> */ $cs = Yii::app()->getClientScript(); $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'); $cs->registerCssFile($assets . DIRECTORY_SEPARATOR . 'toggle-switch.css'); $cs->registerScriptFile($assets . DIRECTORY_SEPARATOR . 'script.js', CClientScript::POS_BEGIN); $nOfItems = count($this->data); if ($this->type == 'switch-toggle') { //You can add up to 5 items by using the .switch-3, .switch-4 and .switch-5 classes. echo CHtml::openTag('div', array('class' => 'switch-toggle switch-' . $nOfItems . ' ' . $this->scheme . ' columns')); foreach ($this->data as $key => $label) { $checked = $this->selected == $key; echo CHtml::radioButton($this->name, $checked, array('value' => $key, 'id' => $this->name . '_' . $key)); echo CHtml::label($label, $this->name . '_' . $key, array('onclick' => '')); } echo CHtml::tag('a', array(), '', true); echo CHtml::closeTag('div'); } if ($this->type == 'switch-light') { echo CHtml::openTag('label', array('class' => 'switch-light ' . $this->scheme, 'onclick' => '')); echo CHtml::checkBox(''); echo CHtml::openTag('span'); echo CHtml::tag('span', array(), 'Off'); echo CHtml::tag('span', array(), 'On'); echo CHtml::closeTag('span'); echo CHtml::tag('a', array(), '', true); echo CHtml::closeTag('label'); } }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; if($this->value) { $oldOptions = array('readonly'=>true); if($this->isReadonly) $tagOptions['disabled'] = true; echo CHtml::textField("{$inputName}[old]", $this->value, $oldOptions); unset($oldOptions['readonly']); ?> <label class="delfile"> <?php echo Yii::t('AutoAdmin.form', '<b class="warning">Delete</b> the file')?> <span class="tip">(<?php echo Yii::t('AutoAdmin.form', 'set checkbox on for confirm')?>)</span>: <?php echo CHtml::checkBox("{$inputName}[del]", false, $oldOptions);?> </label> <?php } $tagOptions['id'] = $inputID; echo CHtml::label(Yii::t('AutoAdmin.form', 'New file').':', $inputID); ?> <div class="tip inline"><a href=<?php echo $this->options['directoryPath']?>/</div> <?php echo CHtml::fileField(AutoAdmin::INPUT_PREFIX."[{$this->name}_new]", null, $tagOptions); return ob_get_clean(); }
public function fileField($model, $attribute, $htmlOptions = array()) { $controlOptions = BsArray::popValue('controlOptions', $htmlOptions, array()); $labelOptions = BsArray::popValue('labelOptions', $htmlOptions, array()); $layout = $this->layout; $output = ''; $output .= CHtml::activeFileField($model, $attribute, $htmlOptions); $attr = $model->{$attribute}; if (!empty($attr)) { //Special logic for ContentTypes $tmpModel = $model; if ($model instanceof ContentType) { $tmpModel = $model->Content; } $output .= '<p class="file">' . CHtml::link($model->{$attribute}, array('/site/getFile', 'id' => $tmpModel->id, 'field' => $attribute, 'modelName' => get_class($tmpModel))) . '</p>'; $output .= '<div class="checkbox">' . CHtml::checkBox($attribute . '_delete'); $output .= CHtml::label('Delete?', $attribute . '_delete') . '</div>'; } $htmlOptions['input'] = $output; $htmlOptions['labelOptions'] = BsHtml::setLabelOptionsByLayout($layout, $labelOptions); if (!empty($layout)) { if ($layout === BsHtml::FORM_LAYOUT_HORIZONTAL) { $controlClass = BsArray::popValue('class', $controlOptions, BsHtml::$formLayoutHorizontalControlClass); BsHtml::addCssClass($controlClass, $htmlOptions['controlOptions']); } } return BsHTML::activeTextFieldControlGroup($model, $attribute, $htmlOptions); }
public function getMenuSubTitle() { return 'YII_DEBUG ' . CHtml::label( YII_DEBUG ? 'ON' : 'OFF', null, array( 'style'=>sprintf('color:%s;',YII_DEBUG ? 'red':'green') )); }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; $tagOptions['id'] = $inputID; if($this->value) { $tagOptions['value'] = 1; ?> <div> <?php echo Yii::t('AutoAdmin.form', '<span class="warning">Replace</span> password')?> (<?php echo Yii::t('AutoAdmin.form', 'set checkbox on for confirm')?>): <br/><label><?php echo CHtml::checkBox("{$inputName}[is_new]", null, $tagOptions)?> <?php echo Yii::t('AutoAdmin.common', 'Yes')?></label> </div> <?php echo CHtml::passwordField("{$inputName}[val]", '******', array('disabled'=>true)); } else { if(!empty($this->options['pattern'])) $tagOptions['pattern'] = $this->options['pattern']; if(isset($this->options['maxlength'])) $tagOptions['maxlength'] = $this->options['maxlength']; echo CHtml::passwordField("{$inputName}[val]", $this->value, $tagOptions); } return ob_get_clean(); }
public static function getViewActionMenuListItem($modelId) { if (Yii::app()->controller->action->getId() === 'view') { return array('name' => 'view', 'label' => Yii::t('app', 'View') . X2Html::minimizeButton(array('class' => 'record-view-type-menu-toggle'), '#record-view-type-menu', true, Yii::app()->params->profile->miscLayoutSettings['viewModeActionSubmenuOpen']), 'encodeLabel' => false, 'url' => array('view', 'id' => $modelId), 'linkOptions' => array('onClick' => '$(this).find ("i:visible").click ();'), 'itemOptions' => array('id' => 'view-record-action-menu-item'), 'submenuOptions' => array('id' => 'record-view-type-menu', 'style' => Yii::app()->params->profile->miscLayoutSettings['viewModeActionSubmenuOpen'] ? '' : 'display: none;'), 'items' => array(array('encodeLabel' => false, 'name' => 'journalView', 'label' => CHtml::checkBox('journalView', Yii::app()->params->profile->miscLayoutSettings['enableJournalView'], array('class' => 'journal-view-checkbox')) . CHtml::label(Yii::t('app', 'Journal View'), 'journalView')), array('encodeLabel' => false, 'name' => 'transactionalView', 'label' => CHtml::checkBox('transactionalView', Yii::app()->params->profile->miscLayoutSettings['enableTransactionalView'], array('class' => 'transactional-view-checkbox')) . CHtml::label(Yii::t('app', 'List View'), 'transactionalView')))); } else { return array('name' => 'view', 'label' => Yii::t('app', 'View'), 'encodeLabel' => true, 'url' => array('view', 'id' => $modelId)); } }
function groupForm($role) { ob_start(); ?> <table class="stdtable"> <tr> <td> <?php echo CHtml::label(Yii::t('mc', 'Prefix'), 'prefix_' . $role); ?> </td> <td> <?php echo CHtml::label(Yii::t('mc', 'Suffix'), 'suffix_' . $role); ?> </td> <td> <?php echo CHtml::label(Yii::t('mc', 'Can Build'), 'build_' . $role); ?> </td> </tr> <tr> <td> <?php echo CHtml::textField('prefix_' . $role, @$_POST['prefix_' . $role]); ?> </td> <td> <?php echo CHtml::textField('suffix_' . $role, @$_POST['suffix_' . $role]); ?> </td> <td> <?php echo CHtml::dropDownList('build_' . $role, @$_POST['build_' . $role], array(0 => Yii::t('mc', 'Yes'), 1 => Yii::t('mc', 'No'))); ?> </td> </tr> <tr> <td colspan="3"> <?php echo CHtml::label(Yii::t('mc', 'Permissions, comma sepparated'), 'perms_' . $role); ?> </td> </tr> <tr> <td colspan="3"> <?php echo CHtml::textField('perms_' . $role, @$_POST['perms_' . $role], array('style' => 'width: 540px')); ?> </td> </tr> </table> <?php return ob_get_clean(); }
public function quickNoteSelector(CFormModel $formModel) { ob_start(); ob_implicit_flush(false); echo CHtml::label(Yii::t('app', 'Quick Note'), 'quickNote', array('style' => 'display:inline-block; margin-right: 10px;')); echo X2Html::dropDownList('quickNote', '', array_merge(array('' => '-'), Dropdowns::getItems(117)), array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{"val":$(this).val(),"dropdownId":"117"}', 'update' => $this->resolveIds('#quickNote2')), 'id' => $this->resolveId('quickNote'), 'class' => 'quick-note')); echo X2Html::dropDownList('quickNote2', '', array('' => '-'), array('id' => $this->resolveId('quickNote2'), 'class' => 'quick-note')); Yii::app()->clientScript->registerScript('quickNoteSelector', "\n \$('#{$this->resolveId('quickNote2')}').change (function () {\n \$(this).next ().val (\$(this).val ());\n });\n "); return ob_get_clean(); }
public function renderInput($attr) { switch ($attr) { case 'password': echo CHtml::activePasswordField($this, $attr, $this->htmlOptions($attr)); echo CHtml::label(Yii::t('app', 'Visible?'), 'visible', array('style' => 'display: inline')); echo CHtml::checkBox('visible', false, array('id' => 'password-visible', 'onchange' => 'js: x2.credManager.swapPasswordVisibility("#Credentials_auth_password")')); break; default: parent::renderInput($attr); } }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); echo CHtml::label($this->label, "{$inputName}[d]"); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; $d = $this->value ? $this->value : new DateTime(); //If not defined take current date list($year, $month, $day) = explode('.', $d->format('Y.m.d')); ?> <table class="time-panel"><tbody> <tr> <td class="calendar"><input type="text"/> <?php if(!empty($this->options['min'])) echo CHtml::tag('span', array('class'=>'mindate'), $this->options['min']); if(!empty($this->options['max'])) echo CHtml::tag('span', array('class'=>'maxdate'), $this->options['max']); ?> </td> <td> <?php $days = array(); for($j = 1; $j <= 31; $j++) $days[$j] = $j; $tagOptions['id'] = "{$inputName}[d]"; echo CHtml::dropDownList("{$inputName}[d]", (int)$day, $days, $tagOptions); ?> </td> <td> <?php $tagOptions['id'] = "{$inputName}[m]"; $tagOptions['tabindex']++; echo CHtml::dropDownList("{$inputName}[m]", (int)$month, Yii::app()->locale->getMonthNames(), $tagOptions); ?> </td> <td> <?php $tagOptions['id'] = "{$inputName}[y]"; $tagOptions['tabindex']++; echo CHtml::textField("{$inputName}[y]", $year, $tagOptions, array_merge($tagOptions, array('maxlength'=>4, 'class'=>'i-year'))); ?> </td> </tr> </tbody></table> <?php return ob_get_clean(); }
/** * Формирует поле для редактирование параметра модуля * @param \yupe\components\WebModule $module * @param $param * @return string */ private function getModuleParamRow(\yupe\components\WebModule $module, $param) { $editableParams = $module->getEditableParams(); $moduleParamsLabels = CMap::mergeArray($module->getParamsLabels(), $module->getDefaultParamsLabels()); $res = CHtml::label($moduleParamsLabels[$param], $param); /* если есть ключ в массиве параметров, то значит этот параметр выпадающий список в вариантами */ if (array_key_exists($param, $editableParams)) { $res .= CHtml::dropDownList($param, $module->{$param}, $editableParams[$param], ['class' => 'form-control', 'empty' => Yii::t('YupeModule.yupe', '--choose--')]); } else { $res .= CHtml::textField($param, $module->{$param}, ['class' => 'form-control']); } return $res; }
/** * Returns the formatted button * @return string the resulting HTML */ public function renderButtons() { list($name, $id) = $this->resolveNameID(); $buttons = array(); $checked = $this->hasModel() ? !$this->model->{$this->attribute} : true; $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_on', 'value' => 1)); $buttons[] = \CHtml::label($this->offLabel, $id . '_on'); $checked = $checked ? false : true; $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_off', 'value' => 1)); $buttons[] = \CHtml::label($this->onLabel, $id . '_off'); $buttons[] = '<span></span>'; return \CHtml::tag('div', $this->htmlOptions, implode("\n", $buttons)); }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; $tagOptions['id'] = $inputID; echo CHtml::checkBox($inputName, (bool)(isset($this->value) ? $this->value : $this->defaultValue), $tagOptions); return ob_get_clean(); }
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 ); }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); $tagOptions['id'] = $inputID; $valueOptions = $this->options['enumValues']; if($this->allowNull) $valueOptions = array(''=>'') + $valueOptions; echo CHtml::dropDownList($inputName, ($this->value ? $this->value : $this->defaultValue), $valueOptions, $tagOptions); return ob_get_clean(); }
/** * @see IExporter::getSettingsView() */ public function getSettingsView() { $r = ''; // Structure $r .= '<fieldset>'; $r .= CHtml::label(Yii::t('core', 'separateFieldsBy'), 'Export_settings_CsvExporter_fieldTerminator') . ' '; $r .= " " . CHtml::textField("Export[settings][CsvExporter][fieldTerminator]", $this->settings["fieldTerminator"]) . '<br />'; $r .= CHtml::label(Yii::t('core', 'encloseFieldsBy'), 'Export_settings_CsvExporter_fieldEncloseString') . ' '; $r .= " " . CHtml::textField("Export[settings][CsvExporter][fieldEncloseString]", $this->settings["fieldEncloseString"]) . '<br />'; $r .= CHtml::label(Yii::t('core', 'escapeFieldTextDelimiterWith'), 'Export_settings_CsvExporter_fieldEscapeString') . ' '; $r .= " " . CHtml::textField("Export[settings][CsvExporter][fieldEscapeString]", $this->settings["fieldEscapeString"]) . '<br />'; $r .= CHtml::checkBox('Export[settings][CsvExporter][fieldsFirstRow]', $this->settings['fieldsFirstRow']) . ' '; $r .= CHtml::label(Yii::t('core', 'fieldNamesInFirstRow'), 'Export_settings_CsvExporter_fieldsFirstRow') . '<br />'; $r .= CHtml::checkBox('Export[settings][CsvExporter][hexBlobs]', $this->settings['hexBlobs']) . ' '; $r .= CHtml::label(Yii::t('core', 'useHexForBlob'), 'Export_settings_SqlExporter_hexBlobs') . '<br />'; $r .= '</fieldset>'; return $r; }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); echo CHtml::label($this->label, "{$inputName}[d]"); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; list($hour, $minute, $second) = explode(':', ($this->value ? $this->value : date("H:i:s"))); ?> <table class="time-panel"><tbody> <tr> <td> <?php $tagOptions['id'] = "{$inputName}[h]"; $tagOptions['tabindex']++; $tagOptions['maxlength'] = 4; echo CHtml::textField("{$inputName}[h]", $hour, $tagOptions); ?> </td> <td>:</td> <td> <?php $tagOptions['id'] = "{$inputName}[n]"; $tagOptions['tabindex']++; echo CHtml::textField("{$inputName}[n]", $minute, $tagOptions); ?> </td> <td>:</td> <td> <?php $tagOptions['id'] = "{$inputName}[s]"; $tagOptions['tabindex']++; echo CHtml::textField("{$inputName}[s]", $second, $tagOptions); ?> </td> </tr> </tbody></table> <?php return ob_get_clean(); }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); $tagOptions['id'] = $inputID; if($this->isReadonly) $tagOptions['disabled'] = true; $value = str_replace("<p>", "", $this->value); $value = str_replace("</p>", "", $value); $value = str_replace('<br/>', "\n", $value); $value = AAHelperForm::prepareTextForForm($value); echo CHtml::textArea($inputName, $value, $tagOptions); return ob_get_clean(); }
public function renderSettings($paymentSettings = array(), $return = false) { $params = $this->getParameters(); $settings = ''; foreach ((array) $params['settings'] as $param) { $variable = $param['variable']; $settings .= CHtml::openTag('div', array('class' => 'form-group')); $settings .= CHtml::label($param['name'], 'Payment_settings_' . $variable, array('class' => 'control-label')); $value = isset($paymentSettings[$variable]) ? $paymentSettings[$variable] : null; if (isset($param['options'])) { $settings .= CHtml::dropDownList('PaymentSettings[' . $variable . ']', $value, CHtml::listData($param['options'], 'value', 'name'), array('class' => 'form-control')); } else { $settings .= CHtml::textField('PaymentSettings[' . $variable . ']', $value, array('class' => 'form-control')); } $settings .= CHtml::closeTag('div'); } if ($return) { return $settings; } else { echo $settings; } }
public function renderContactFields($model) { $defaultFields = X2Model::model('Fields')->findAllByAttributes(array('modelName' => 'Contacts'), array('condition' => "fieldName IN ('firstName', 'lastName', 'email', 'phone')")); $requiredFields = X2Model::model('Fields')->findAllByAttributes(array('modelName' => 'Contacts', 'required' => 1), array('condition' => "fieldName NOT IN ('firstName', 'lastName', 'phone', 'email', 'visibility')")); $i = 0; $fields = array_merge($requiredFields, $defaultFields); foreach ($fields as $field) { if ($field->type === 'boolean') { $class = ""; echo "<div>"; } else { $class = $field->fieldName === 'firstName' || $field->fieldName === 'lastName' ? 'quick-contact-narrow' : 'quick-contact-wide'; } $htmlAttr = array('class' => $class, 'tabindex' => 100 + $i, 'title' => $field->attributeLabel, 'id' => 'quick_create_' . $field->modelName . '_' . $field->fieldName); if ($field->type === 'boolean') { echo CHtml::label($field->attributeLabel, $htmlAttr['id']); } echo X2Model::renderModelInput($model, $field, $htmlAttr); if ($field->type === 'boolean') { echo "</div>"; } ++$i; } }
public function formInput(&$controller, $tagOptions=array()) { if(!Yii::app()->clientScript->isScriptFileRegistered(AutoAdmin::$assetPath.'/js/text-editor.js')) Yii::app()->clientScript->registerScriptFile(AutoAdmin::$assetPath.'/js/text-editor.js'); ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); $value = str_replace('<br/>', "\n", $this->value); $value = AAHelperForm::prepareTextForForm($value); $value = str_replace("<p>", "", $value); $value = str_replace("</p>", "", $value); $tagOptions['id'] = $inputID; if($this->isReadonly) $tagOptions['disabled'] = true; else { echo CHtml::button('STRONG'); echo CHtml::button('EM'); echo CHtml::button('H3'); echo CHtml::button('H4'); echo CHtml::button('UL'); echo CHtml::button('OL'); echo CHtml::button('Link'); echo CHtml::button('MailTo'); echo CHtml::button('Img'); echo CHtml::button('<..>'); } echo CHtml::textArea($inputName, $value, $tagOptions); return ob_get_clean(); }
<?php echo CHtml::beginForm(); ?> <div class="row"> <?php echo CHtml::label('Method', 'method'); ?> <?php echo CHtml::dropDownList('method', '', array('all' => 'All', 'one' => 'By user')); ?> </div> <div class="row"> <?php echo CHtml::label('User ID', 'user_id'); ?> <?php echo CHtml::textField('user_id'); ?> </div> <div class="row submit"> <?php echo CHtml::submitButton('Submit'); ?> </div> <?php echo CHtml::endForm(); ?>
</div> <!--div class="row"> <div class="row-column1"> <?php //echo CHtml::label('Mobile No. :','student_mobile_no'); ?> <?php // echo $info->student_mobile_no;?> </div> <!--div class="row-column2"> <?php //echo CHtml::label('Batch :','student_transaction_batch_id'); ?> <?php //if($model->student_transaction_batch_id!=0) //echo $model->Rel_Batch->batch_code; ?> </div> </div--> <div class="row"> <div class="row-column1"> <?php echo CHtml::label('Contact No. :','student_mobile_no'); ?> <?php echo (!empty($info->student_mobile_no) ? $info->student_mobile_no : "Not Set");?> </div> <div class="row-column2"> <?php echo CHtml::label('Student Email :','student_email_id_1'); ?> <?php if(!empty($info->student_email_id_1)) echo $info->student_email_id_1; else echo "Not Set";?> </div> </div>
if ($file->operation === CCodeFile::OP_OVERWRITE) { ?> (<?php echo CHtml::link('diff', array('diff', 'id' => $i), array('class' => 'view-code', 'rel' => $file->path)); ?> ) <?php } ?> </td> <td class="confirm"> <?php if ($file->operation === CCodeFile::OP_SKIP) { echo 'unchanged'; } else { $key = md5($file->path); echo CHtml::label($file->operation, "answers_{$key}") . ' ' . CHtml::checkBox("answers[{$key}]", $model->confirmed($file)); } ?> </td> </tr> <?php } ?> </table> <?php } ?> </div> <?php }
<?php echo CHtml::dropDownList('months_advance', 1, array(1 => '1 Month', 3 => '3 Months', 6 => '6 Months')); ?> </div> <div class="large-4 columns"> <?php echo CHtml::label('Starting from', 'starting_from'); ?> <?php echo CHtml::dropDownList('starting_from', 1, $DeliveryDate->getFutureDeliveryDates()); ?> </div> <div class="large-4 columns"> <?php echo CHtml::label('Every', 'every'); ?> <?php echo CHtml::dropDownList('every', 1, array('week' => 'week', 'fortnight' => 'fortnight')); ?> </div> </div> <div class="row"> <div class="large-12 columns"> <?php echo CHtml::submitButton('Set recurring order', array('name' => 'btn_recurring', 'class' => 'button small tiny right')); ?> <?php echo CHtml::submitButton('Clear all orders', array('name' => 'btn_clear_orders', 'class' => 'button small tiny right')); ?> </div>
<div class="row-fluid"> <div class="span12"> <?php echo $result; ?> </div> </div> <?php } else { ?> <?php echo CHtml::beginForm('import', 'post', array('enctype' => 'multipart/form-data')); ?> <div class="row-fluid"> <div class="span5"><?php echo CHtml::label(Yii::t('admin', 'Choose your .csv file (Max size: {max}):', array('{max}' => ini_get('upload_max_filesize'))), 'csv_file'); ?> </div> <div class="span5"><?php echo CHtml::fileField('csv_file', '', array('id' => 'csv_file')); ?> </div> </div> <div class="row-fluid"> <div class="span5"><span>Folder Import<span style="font-size:11px;color:#ff0000"> (import images need to upload into this folder)</span></span></div> <div class="span5"><input type="text" name="dirimg" id="dirimg" value="/images/import/" /></div> </div> <div class="row-fluid"> <div class="span12"><p> </p></div> </div> <div class="row-fluid">
echo CHtml::checkBox($complectation->name, false, array('class' => 'forcount', 'title' => $complectation->outCorrSymbol() . $complectation->outPriceCorrectionCounted(1, '{price}', 0))); if ($complectation->correction_type > 0) { echo ' (' . $complectation->outCorrSymbol() . ' ' . $complectation->outPriceCorrectionCounted(1, '{price}', 0, ',', ' ') . 'р.)'; } } else { $arrayValueList = $complectation->arrayValuesForList(); if (isset($complectation->hide_notused) && $complectation->hide_notused) { $empty = null; } else { $empty = 'Не выбрано'; } if (isset($complectation->display_type) && $complectation->display_type == 1) { echo CHtml::tag('span'); $select = true; foreach ($arrayValueList['values'] as $key => $value) { echo CHtml::radioButton($complectation->name, $select, array('id' => $complectation->name . $key, 'class' => 'forcount', 'title' => $arrayValueList['options'][$key]['title'], 'value' => $key)); //'options'=>$arrayValueList['options'], 'empty'=>$empty)); echo CHtml::label($value, $complectation->name . $key); echo '<br/>'; $select = false; } } else { echo CHtml::dropDownList($complectation->name, false, $arrayValueList['values'], array('class' => 'forcount', 'options' => $arrayValueList['options'])); } } ?> </div> </div> <?php }
public function run() { // here render procedures echo CHtml::beginForm($this->action, $this->method, array('id' => $this->id, 'enctype' => $this->enctype, 'target' => $this->target)); // you better create a function but // for the sake of the example... foreach ($this->attributes as $attr) { // here we can actually say i // this is very simple but you get the idea echo CHtml::label($attr['label'], $attr['name']); if ($attr['type'] == 'text') { echo CHtml::textField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'textarea') { echo CHtml::textArea($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'password') { echo CHtml::passwordField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkbox') { echo CHtml::checkBox($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkboxlist') { echo CHtml::checkBoxList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'date') { echo CHtml::dateField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'dropdownlist') { echo CHtml::dropDownList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'file') { echo CHtml::fileField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'hidden') { echo CHtml::hiddenField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radio') { echo CHtml::radioButton($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radiolist') { echo CHtml::radioButtonList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } } } } } } } } } } } // do more here } echo "<br/><br/><div class='row-fluid'>"; echo CHtml::submitButton($this->submit['label'], $this->submit['options']); echo "</div>"; echo CHtml::endForm(); }
/** * @see IExporter::getSettingsView() */ public function getSettingsView() { $r = ''; // Structure $r .= '<fieldset>'; $r .= '<legend>' . CHtml::checkBox('Export[settings][SqlExporter][exportStructure]', $this->settings['exportStructure']) . ' ' . CHtml::label(Yii::t('core', 'exportStructure'), 'Export_settings_SqlExporter_exportStructure') . '</legend>'; $r .= CHtml::checkBox('Export[settings][SqlExporter][addDropObject]', $this->settings['addDropObject']) . ' ' . CHtml::label(Yii::t('core', 'addDropObject'), 'Export_settings_SqlExporter_addDropObject') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][addIfNotExists]', $this->settings['addIfNotExists']) . ' ' . CHtml::label(Yii::t('core', 'addIfNotExists'), 'Export_settings_SqlExporter_addIfNotExists'); $r .= '</fieldset>'; // Data $r .= '<fieldset>'; $r .= '<legend>' . CHtml::checkBox('Export[settings][SqlExporter][exportData]', $this->settings['exportData']) . ' ' . CHtml::label(Yii::t('core', 'exportData'), 'Export_settings_SqlExporter_exportData') . '</legend>'; $r .= CHtml::label(Yii::t('core', 'command'), 'Export_settings_SqlExporter_insertCommand') . ': ' . CHtml::radioButtonList('Export[settings][SqlExporter][insertCommand]', $this->settings['insertCommand'], array('INSERT' => 'INSERT', 'REPLACE' => 'REPLACE'), array('separator' => ' ')) . '<br />' . CHtml::label(Yii::t('core', 'rowsPerInsert'), 'Export_settings_SqlExporter_rowsPerInsert') . ': ' . CHtml::textField('Export[settings][SqlExporter][rowsPerInsert]', $this->settings['rowsPerInsert']) . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][completeInserts]', $this->settings['completeInserts']) . ' ' . CHtml::label(Yii::t('core', 'useCompleteInserts'), 'Export_settings_SqlExporter_completeInserts') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][ignoreInserts]', $this->settings['ignoreInserts']) . ' ' . CHtml::label(Yii::t('core', 'useInsertIgnore'), 'Export_settings_SqlExporter_ignoreInserts') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][delayedInserts]', $this->settings['delayedInserts']) . ' ' . CHtml::label(Yii::t('core', 'useDelayedInserts'), 'Export_settings_SqlExporter_delayedInserts') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][hexBlobs]', $this->settings['hexBlobs']) . ' ' . CHtml::label(Yii::t('core', 'useHexForBlob'), 'Export_settings_SqlExporter_hexBlobs') . '<br />'; $r .= '</fieldset>'; return $r; }