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); } }
/** * Encapsulates {@link CJuiButton} and {@link CHtml::radioButtonList} for an easy way to create input for flag fields. * There are two uses for this method: static and active fields. * Static fields make use of CHtml methods to create the radio buttons, and you'll only need the three first arguments. * For use with {@link CActiveForm} you can skip the $value argument and supply $form and $model too, or use * {@link activeJuiFlag}, that's a shorthand method to simplify this use. * * @param string $name the field name * @param array $options a list of options, where the keys are the field values and * the values are: a string with the label or an array where the first element * is the label and the second is the icon class. For adding icons, you need to * include CSS rules that add an image as background to that class, like: * <code>.ui-icon-custom-yes { background-image: url(/images/icons/tick.png); }</code> * @param mixed $value [optional] The current value for the field. * @param CActiveForm [optional] $form the form widget being used * @param CModel [optional] $model the model */ public function juiFlag($name, array $options, $value = null, CActiveForm $form = null, CModel $model = null) { $radio_options = $icons = array(); $button_number = 0; foreach ($options as $value => $data) { $radio_options[$value] = ($is_array = is_array($data)) ? $data[0] : $data; if ($is_array && isset($data[1])) { $icons[$button_number] = $data[1]; } ++$button_number; } $this->owner->beginWidget('zii.widgets.jui.CJuiButton', array('buttonType' => 'buttonset', 'name' => $name)); if ($form) { echo $form->radioButtonList($model, $name, $radio_options, array('separator' => '')); $radio_id_prefix = get_class($model) . '_' . $name; } else { echo CHtml::radioButtonList($name, $value, $radio_options, array('separator' => '')); $radio_id_prefix = $name; } $this->owner->endWidget(); $js = function () use($icons, $radio_id_prefix) { $js = ''; foreach ($icons as $i => $icon) { $js .= "\$('#{$radio_id_prefix}_{$i}').button('option', 'icons', {primary: '{$icon}'})\n"; } return $js; }; Yii::app()->clientScript->registerScript("{$radio_id_prefix}_juiFlagIcons", $js()); }
public function renderBoolean($name, array $metaData, $form = null) { $out = ''; $id = $name; $value = isset($metaData['current']) ? $metaData['current'] : ''; if (isset($metaData['label'])) { $out .= CHtml::label($metaData['label'], $id); } $out .= CHtml::radioButtonList($id, $value, array(0 => 'False', 1 => 'True'), array('id' => $id, 'form' => $form, 'container' => 'div', 'separator' => '')); return $out; }
public function listing($model, $listModel, $relational, $type = 'checkbox') { self::startWidget(Ucfirst($listModel)); echo " <div style='max-height:300px;overflow:auto;border:1px solid #ddd;padding:10px;'>"; $cat = CHtml::listData($listModel::model()->findAll(array("order" => "name ASC")), 'term_id', 'name'); $selected_keys = array_keys(CHtml::listData($model->{$relational}, 'term_id', 'term_id')); if ($type == 'checkbox') { $selected_keys = isset($_POST[$relational]) ? $_POST[$relational] : $selected_keys; echo CHtml::checkBoxList($relational, $selected_keys, $cat, array('separator' => '', 'template' => '<label class="' . $type . '"> {input}{label} </label>')); } else { $radioSelect = isset($_POST[$relational]) ? $_POST[$relational] : ''; foreach ($selected_keys as $key) { $radioSelect = $key; } echo CHtml::radioButtonList($relational, $radioSelect, $cat, array('separator' => '', 'template' => '<label class="' . $type . '"> {input}{label} </label>')); } echo " </div>"; self::endWidget(); }
/** * Generates a switch which only allows single selection. * @param string $name name of the switch. You can use this name to retrieve * the selected value(s) once the form is submitted. * @param string $select selection of the radio buttons. * @param array $data value-label pairs used to generate the radio button list. * Note, the values will be automatically HTML-encoded, while the labels will not. * @param array $htmlOptions addtional HTML options. The options will be applied to * each radio button input. The following special options are recognized: * <ul> * <li>template: string, specifies how each radio button is rendered. Defaults * to "{input} {label}", where "{input}" will be replaced by the generated * radio button input tag while "{label}" will be replaced by the corresponding radio button label.</li> * <li>separator: string, specifies the string that separates the generated radio buttons. Defaults to new line (<br/>).</li> * <li>labelOptions: array, specifies the additional HTML attributes to be rendered * for every label tag in the list.</li> * <li>container: string, specifies the radio buttons enclosing tag. Defaults to 'span'. * If the value is an empty string, no enclosing tag will be generated</li> * </ul> * @return string the generated radio button list */ public static function radioButtonSwitch($name, $select, $data, $htmlOptions = array()) { $container = "div"; $template = isset($htmlOptions['template']) ? $htmlOptions['template'] : '{input} {label}'; $separator = isset($htmlOptions['separator']) ? $htmlOptions['separator'] : ""; unset($htmlOptions['template'], $htmlOptions['separator'], $htmlOptions['container']); $labelOptions = isset($htmlOptions['labelOptions']) ? $htmlOptions['labelOptions'] : array(); unset($htmlOptions['labelOptions']); $items = array(); $baseID = self::getIdByName($name); $id = 0; foreach ($data as $value => $label) { $checked = !strcmp($value, $select); $htmlOptions['value'] = $value; $htmlOptions['id'] = $baseID . '_' . $id++; $option = self::radioButton($name, $checked, $htmlOptions); $label = self::label($label, $htmlOptions['id'], $labelOptions); $items[] = strtr($template, array('{input}' => $option, '{label}' => $label)); } return self::tag($container, array('id' => $baseID, 'class' => 'switch'), implode($separator, $items)); return CHtml::radioButtonList($name, $select, $data, $htmlOptions); }
?> </h3> <div class="editinstructions"> <?php echo Yii::t('admin', 'Choose the header image you wish to use with your theme. This image is used by both the site template as well as emailed receipts sent to customers.'); ?> </div> <div class="clearfix spaceafter"></div> <?php echo CHtml::beginForm('header', 'post', array('enctype' => 'multipart/form-data')); ?> <?php echo CHtml::radioButtonList('headerimage', _xls_get_conf('HEADER_IMAGE'), $arrHeaderImages); ?> <div class="clearfix spaceafter"></div> <hr> <div class="row-fluid editinstructions"> <?php if (Yii::app()->user->fullname == "Lightspeed") { } ?> <?php if (Yii::app()->user->fullname == "Lightspeed") { echo "<p><strong>" . Yii::t('admin', 'To upload a new header image to add to your collection, drag and drop a file on top of the Choose File button, then click Upload. NOTE: You can also log into Admin Panel externally at {url} to use the Choose File button normally.', array('{url}' => $this->createAbsoluteUrl("/admin"))) . "</strong></p>"; } else { echo Yii::t('admin', 'To upload a new header image to add to your collection, click Choose File and select your file, then click Upload.');
if ($model->selectedObjects) { echo "margin-left: 260px;"; } ?> width: 600px"> <?php $firstExporter = current(array_keys($model->exporters)); ?> <div id="exporterType"> <fieldset> <legend><?php echo Yii::t('core', 'type'); ?> </legend> <?php echo CHtml::radioButtonList('Export[exporter]', $firstExporter, $model->exporters, array('separator' => ' ')); ?> </fieldset> </div> <div id="exporterSettings"> <?php foreach ($model->exporterInstances as $exporter) { ?> <div id="exporterSettings_<?php echo get_class($exporter); ?> "> <?php echo $exporter->getSettingsView(); ?> </div>
} ?> </div> <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"> <?php echo CHtml::link("<div id='smallcalendar' class='well'></div>", array('evento/index')); ?> <div class="well" style='margin-top:30px; text-align:center;'> <?php foreach ($encuestas as $encuesta) { $respuestas = OpcionesEncuesta::model()->findAll("estatus_did = 1 and encuesta_did = " . $encuesta->id); if (count($respuestas) > 0) { echo "<h3>" . $encuesta->nombre . "</h3>"; $respuestasArray = array(); $c = 0; foreach ($respuestas as $respuesta) { $respuestasArray[$c] = $respuesta->nombre; $c++; } echo CHtml::hiddenField($encuesta->id, $encuesta->nombre); echo CHtml::radioButtonList('choice', "selec", $respuestasArray, array('separator' => " ")); } echo '<div class="col-lg-2 col-lg-offset-2">'; $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Crear' : 'Guardar')); echo '</div>'; } ?> </div> </div> </div>
<?php } echo CHtml::beginForm(array('/order/create'), 'POST', array('id' => 'orderForm')); ?> <?php echo CHtml::hiddenField('delivery_address', 'address_value', array('id' => 'hide_address')); ?> <div class="box"> <div class="box-title container_24">支付方式</div> <div class="box-content" style="vertical-align:middle;"> <?php $cri = new CDbCriteria(array('condition' => 'enabled = 1')); $paymentMethod = PaymentMethod::model()->findAll($cri); $list = CHtml::listData($paymentMethod, 'payment_method_id', 'name'); echo CHtml::radioButtonList('payment_method_id', '0', $list); ?> </div> </div> <?php $imageHelper = new ImageHelper(); ?> <div class="box"> <div class="box-title container_24">商品列表</div> <div class="box-content cart container_24"> <table id="list-div-box" class="table"> <tr style="background:#F3F3F3;"> <th class="col-xs-3">图片</th> <th class="col-xs-3">名称</th> <th class="col-xs-3">属性</th>
</span> </div> <div class="nav btn-group background-color-5"> <div class="table-cell"> <div class="btn btn-small three-white-bars background-color-hover-6"></div> </div> <div class="table-cell full-width"> <div class="btn btn-large cursor-default text-left">支付方式</div> </div> </div> <div class="checkout-payment-content background-color-0"> <?php $cri = new CDbCriteria(array('condition' => 'enabled = 1')); $paymentMethod = PaymentMethod::model()->findAll($cri); $list = CHtml::listData($paymentMethod, 'id', 'name'); echo CHtml::radioButtonList('pay_method', '1', $list); ?> </div> <div class="nav btn-group background-color-5"> <div class="table-cell"> <div class="btn btn-small three-white-bars background-color-hover-6"></div> </div> <div class="table-cell full-width"> <div class="btn btn-large cursor-default text-left">购物车</div> </div> </div> <table class="table-dark background-color-2"> <thead class="light-text background-color-6"> <tr> <th class="text-center" style='width:150px'>编号</th> <th class="text-center" style='width:150px'>图片</th>
?> <?php echo CHtml::activeTelField($model, 'request_name', array('placeholder' => Yii::t('sniper_ebay', 'Request'))); ?> <span class="required">*</span> </div> <?php if (!$model->isNewRecord) { ?> <div class="span6 offset2"> <div class="span3"> Request: </div> <?php $request_types = array('new' => 'Create New', 'update' => 'Update Current'); echo CHtml::radioButtonList('request_type', 'update', $request_types, array('template' => '<span class="span4">{beginLabel}{input}{labelTitle}{endLabel}</span>', 'separator' => ' ')); ?> </div> <?php } ?> </td> </tr> <tr> <td> <div class="span4"> <?php //echo CHtml::textField('request[keyWord]', '', array('placeholder' => Yii::t('sniper_ebay', 'Keyword'))); ?> <?php echo CHtml::activeTelField($model, 'keyword', array('placeholder' => Yii::t('sniper_ebay', 'Keyword'))) . ' <span class="required">*</span>';
<?php echo CHtml::form(Yii::app()->request->url, 'post', array('onsubmit' => 'return submitForm(this);')); ?> <div> 移动至 <strong>编号</strong> <?php echo CHtml::textField('target_id', '', array('size' => '6')); ?> <?php echo CHtml::radioButtonList('pos', '2', array('1' => '之前', '2' => '之后'), array('separator' => ' ')); ?> <?php echo CHtml::submitButton('修改排序'); ?> </div> <?php echo CHtml::endForm(); ?> <script type="text/javascript"> function submitForm(f) { targetId = $('#target_id').val(); if (targetId.length == 0) { alert('请输入编号'); $('#target_id').focus(); return false;
//var_dump($products);die(); foreach ($products as $position => $product) { if ($model = Products::model()->findByPk($product['product_id'])) { $variations = ''; if (isset($product['Variations'])) { foreach ($product['Variations'] as $specification => $variation) { if ($specification = ProductSpecification::model()->findByPk($specification)) { if ($specification->input_type == 'textfield') { $variation = $variation[0]; } else { $variation = ProductVariation::model()->findByPk($variation); } if (Shop::module()->allowPositionLiveChange) { if ($specification->input_type == 'select') { $name = sprintf('variation_%s_%s', $position, $specification->id); $variations .= CHtml::radioButtonList($name, $variation->id, ProductVariation::listData($variation->getVariations(), true)); Yii::app()->clientScript->registerScript($name, "\r\n\t\t\t\t\t\t\t\t\t\t\$('[name=\"" . $name . "\"]').click(function(){\r\n\t\t\t\t\t\t\t\t\t\$.ajax({\r\n\t\t\t\t\t\t\t\t\t\t\t'url' : '" . CController::createUrl('//shop/shoppingCart/updateVariation') . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'type' : 'POST',\r\n\t\t\t\t\t\t\t\t\t\t\t'data' : \$(this),\r\n\t\t\t\t\t\t\t\t\t\t\terror: function() {\r\n\t\t\t\t\t\t\t\t\t\t\t\$('#amount_" . $position . "').css('background-color', 'red');\r\n\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\tsuccess: function(result) {\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').html(\$('.amount_" . $position . "').val());\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.price_" . $position . "').html(result);\t\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.price_single_" . $position . "').load('" . $this->createUrl('//shop/shoppingCart/getPriceSingle?position=' . $position) . "');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.price_total').load('" . $this->createUrl('//shop/shoppingCart/getPriceTotal') . "');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.shipping_costs').load('" . $this->createUrl('//shop/shoppingCart/getShippingCosts') . "');\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\t\t\t\t\$('input:checked').trigger('click');\r\n\t\t\t\t\t\t\t\t\t\t"); $variations .= '<br />'; } } else { $variations .= $specification . ': ' . $variation . '<br />'; } } $img = CHtml::image(Yii::app()->baseUrl . '/' . $variation, '', array('width' => Shop::module()->imageWidthThumb)); } } printf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class="text-right price_single_' . $position . '">%s</td><td class="text-right price_' . $position . '">%s</td><td>%s</td></tr>', $img, CHtml::textField('amount_' . $position, $product['amount'], array('size' => 4, 'class' => 'amount_' . $position)), $model->title, $variations, Shop::priceFormat($model->getPrice($product['Variations'])), Shop::priceFormat($model->getPrice($product['Variations'], $product['amount'])), CHtml::link(Shop::t('Remove'), array('//shop/shoppingCart/delete', 'id' => $position), array('confirm' => Shop::t('Are you sure?')))); Yii::app()->clientScript->registerScript('amount_' . $position, "\r\n\t\t\t\t\t\$('.amount_" . $position . "').keyup(function() {\r\n\t\t\t\t\t\t\$.ajax({\r\n\t\t\t\t\t\t\turl:'" . $this->createUrl('//shop/shoppingCart/updateAmount') . "',\r\n\t\t\t\t\t\t\tdata: \$('#amount_" . $position . "'),\r\n\t\t\t\t\t\t\tsuccess: function(result) {\r\n\t\t\t\t\t\t\t\$('.amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').html(\$('.amount_" . $position . "').val());\r\n\t\t\t\t\t\t\t\$('.price_" . $position . "').html(result);\t\r\n\t\t\t\t\t\t\t\$('.price_total').load('" . $this->createUrl('//shop/shoppingCart/getPriceTotal') . "');\r\n\t\t\t\t\t\t\t\$('.shipping_costs').load('" . $this->createUrl('//shop/shoppingCart/getShippingCosts') . "');\r\n\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\terror: function() {\r\n\t\t\t\t\t\t\t\$('#amount_" . $position . "').css('background-color', 'red');\r\n\t\t\t\t\t\t\t},\r\n\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t\t\t"); } } if ($shippingMethod = Shop::getShippingMethod()) {
<p>This is the game of Hangman. You must guess a word, a letter at a time. If you make too many mistakes, you lose the game!</p> <?php echo CHtml::beginForm(); ?> <?php echo CHtml::radioButtonList('level', null, $levels); ?> <br/> <?php echo CHtml::submitButton('Play!'); ?> <?php if ($error) { ?> <span style="color:red">You must choose a difficulty level!</span> <?php } ?> <?php echo CHtml::endForm();
<?php $this->breadcrumbs = array('商品中心' => array('index'), '管理'); $this->menu = array(array('label' => '创建商品', 'url' => array('create'))); ?> <h1>商品管理</h1> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'item-form', 'action' => 'bulk', 'htmlOptions' => array('enctype' => 'multipart/form-data'), 'enableAjaxValidation' => false)); ?> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'item-grid', 'dataProvider' => $model->search(), 'selectableRows' => 2, 'filter' => $model, 'columns' => array(array('class' => 'CCheckBoxColumn', 'name' => 'id', 'value' => '$data->id'), array('name' => 'cate_id', 'value' => '$data->cat->cate_name'), 'item_name', 'item_sn', array('name' => 'if_show', 'value' => '$data->getShow()'), array('name' => 'is_tejia', 'value' => '$data->getTejia()'), array('name' => 'is_new', 'value' => '$data->getNew()'), array('name' => 'recommended', 'value' => '$data->getRecommend()'), 'sort_order', array('class' => 'CButtonColumn', 'header' => '操作', 'template' => '[{update}] [{delete}]', 'updateButtonImageUrl' => false, 'deleteButtonImageUrl' => false, 'htmlOptions' => array('width' => '63'))))); ?> <div class="row buttons" style="padding-top:10px"> <?php echo CHtml::radioButtonList('act', '', array('delete' => '删除商品', 'if_show' => '上架商品', 'un_show' => '下架商品', 'is_tejia' => '设为特价', 'un_tejia' => '取消特价', 'is_new' => '设为新品', 'un_new' => '取消新品', 'recommended' => '推荐商品', 'un_recommended' => '取消推荐'), array('separator' => ' ')); ?> <?php echo CHtml::submitButton('提交'); ?> </div> <?php $this->endWidget();
} else { echo "<div title='" . $element->getUserDate($issueId) . "'>"; echo CHtml::textArea("Result[elementid][{$element->id}]", $element->getResult($issueId), array('maxlength' => 1500)); echo "</div>"; echo "<div class='exceltools' style='display:none'><input class='Excel' type='button' value='Excel Chart' onclick=location.href='" . $url . "';></div>"; if ($element->getUserDate($issueId)) { echo "<div style='background-color:rgb(220,220,220); font-size:small; display:none; padding:4px; border-radius:3px;' class='info'>" . $element->getUserDate($issueId) . "</div>"; } } break; break; case 5: $url = Yii::app()->request->baseUrl . "/index.php/step/excelComp/" . $issueId . "?" . "elementId=" . $element->id; //funciona echo "<div title='" . $element->getUserDate($issueId) . "'>"; echo CHtml::radioButtonList("Result[elementid][{$element->id}]", $element->getResult($issueId), CHtml::listData($element->values, 'id', 'value')); echo "</br><div class='exceltools' style='display:none'><input class='Excel' type='button' value='Excel Chart' onclick=location.href='" . $url . "';></div>"; if ($element->getUserDate($issueId)) { echo "<br><p style='background-color:rgb(220,220,220);font-size:small; display:none; padding:4px; border-radius:3px;' class='info'>" . $element->getUserDate($issueId) . "</p>"; } echo "</div>"; break; case 6: $url = Yii::app()->request->baseUrl . "/index.php/step/excelComp/" . $issueId . "?" . "elementId=" . $element->id; //funciona echo CHtml::checkBoxList("Checks[elementid][{$element->id}]", $element->getResults($issueId), CHtml::listData($element->values, 'id', 'value'), array('labelOptions' => array('title' => $element->getUserForBox2($issueId)))); echo "</br><div class='exceltools' style='display:none'><input class='Excel' type='button' value='Excel Chart' onclick=location.href='" . $url . "';></div>"; echo "<div>" . $element->getUserForBox($issueId) . "</div>"; break; case 7: $url = Yii::app()->request->baseUrl . "/index.php/step/excelComp/" . $issueId . "?" . "elementId=" . $element->id;
<?php $id = 'feature[' . $attr->id . ']'; echo CHtml::radioButtonList($id, '2', array('1' => 'есть', '0' => 'нет', '2' => 'неважно'), array('onchange' => 'SendSearchReg()'));
?> "; var okBtn = "<?php eT("OK", 'js'); ?> "; var deletefrompanelmsg = "<?php eT("Please choose one option.", 'js'); ?> "; var noRowSelected = "<?php eT("You have no row selected", 'js'); ?> "; var deleteMsg = '<br/>'+deletefrompanelmsg+'<br/><br/><?php echo str_replace("\n", '', CHtml::radioButtonList('deleteMode', '', array('po' => gT("Delete participant(s) from central participants panel only"), 'ptt' => gT("Delete participant(s) from central panel and tokens tables"), 'ptta' => gT("Delete participant(s) from central panel, tokens tables and all associated responses")))); ?> '; var searchBtn = "<?php eT("Search", 'js'); ?> "; var shareMsg = "<?php eT("You can see and edit settings for shared participants in share panel.", 'js'); ?> "; //PLEASE REVIEW var jsonUrl = "<?php echo Yii::app()->getController()->createUrl("admin/participants/sa/" . $urlsearch); ?> "; var jsonSearchUrl = "<?php
<?php echo CHtml::activeLabel($model, 'valokuvaaja'); ?> <br /> <?php echo CHtml::activeTextField($model, 'valokuvaaja'); ?> </div> </td> <td colspan="2" class="withborder"> <div class="row" id="addorreplace"> <?php echo CHtml::resetButton('Tyhjennä kentät', array('class' => 'buttonlink', 'style' => 'float:right;height:50px;width:150px;')); echo CHtml::radioButtonList('addOrReplaceKuvateksti', 0, array(true => 'Vaihda kuvateksti', false => 'Lisää kuvatekstin perään'), array('separator' => '<br />')); ?> <br /> <?php echo CHtml::textField('kuvateksti', '', array('style' => 'width:500px;')); ?> </div> </td> </tr> </table> </div> <hr /> <?php
<?php if (!Yii::app()->user->isGuest) { ?> <h4>Оцените сайт</h4> <div id="voting"> <input type="hidden" name="site_id" value="<?php print $site->site_id; ?> " /> <?php $marks = array(1 => '1 (самая низкая)', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => '11', 12 => '12 (самая высокая)'); print CHtml::radioButtonList('mark', $value, $marks, array('separator' => ' ')); ?> <br /> <br /> <input type="button" value="Оценить" id="mark_submit" /> </div> <?php } ?> <p>Средний балл: <?php print $site->avgValue; ?>
public function renderRadio($name, array $metaData, $form = null) { $value = isset($metaData['current']) ? $metaData['current'] : (isset($metaData['default']) ? $metaData['default'] : null); $htmlOptions = $this->htmlOptions($metaData, $form); return CHtml::radioButtonList($name, $value, $metaData['options'], $htmlOptions); }
<?php $this->breadcrumbs = array(Yii::t('main', 'List Item') => array('admin'), Yii::t('main', 'Manage')); $this->menu = array(array('label' => Yii::t('frontend', 'Create Item'), 'icon' => 'plus', 'url' => array('create'))); ?> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'item-form', 'action' => 'bulk', 'htmlOptions' => array('enctype' => 'multipart/form-data'), 'enableAjaxValidation' => false)); $this->widget('bootstrap.widgets.TbGridView', array('id' => 'item-grid', 'type' => 'striped bordered condensed', 'dataProvider' => $model->search(), 'selectableRows' => 2, 'enableHistory' => 'true', 'columns' => array(array('class' => 'CCheckBoxColumn', 'name' => 'item_id', 'value' => '$data->item_id'), array('name' => 'category.name', 'header' => Yii::t('backend', 'Item Categories')), array('name' => 'title', 'header' => '商品名字'), array('name' => 'stock', 'header' => '库存'), array('name' => 'min_number', 'header' => '最小数量'), array('name' => 'price', 'header' => '价格'), array('name' => 'is_show', 'header' => '上架', 'value' => 'Tbfunction::showYesOrNo($data->is_show)', 'filter' => Tbfunction::ReturnYesOrNo()), array('name' => 'is_promote', 'header' => '热销', 'value' => 'Tbfunction::showYesOrNo($data->is_promote)', 'filter' => Tbfunction::ReturnYesOrNo()), array('name' => 'is_new', 'header' => '新品', 'value' => 'Tbfunction::showYesOrNo($data->is_new)', 'filter' => Tbfunction::ReturnYesOrNo()), array('name' => 'is_hot', 'header' => '热卖', 'value' => 'Tbfunction::showYesOrNo($data->is_hot)', 'filter' => Tbfunction::ReturnYesOrNo()), array('name' => 'is_best', 'header' => '精品', 'value' => 'Tbfunction::showYesOrNo($data->is_best)', 'filter' => Tbfunction::ReturnYesOrNo()), array('class' => 'bootstrap.widgets.TbButtonColumn')))); ?> <div class="span12"> <div class="bulk-action span10"> <?php echo CHtml::radioButtonList('act', '', array('delete' => '删除产品', 'is_show' => '上架', 'un_show' => '下架', 'is_promote' => '促销', 'un_promote' => '取消促销', 'is_new' => '新品', 'un_new' => '取消新品', 'hot' => '热卖', 'un_hot' => '取消热卖', 'best' => '精品', 'un_best' => '取消精品'), array('separator' => ' ')); ?> </div> <div class="bulk-action span2"> <?php echo CHtml::submitButton('提交', array('class' => 'btn btn-primary')); ?> </div> </div> <?php $this->endWidget();
</th> <td> <input class="form-control" type="text" value=" <?php echo htmlentities($model['phone']); ?> " name="TradingOffice[phone]"> </td> </tr> <tr> <th><?php echo $form->labelEx($model, 'status'); ?> </th> <td> <?php echo CHtml::radioButtonList('TradingOffice[status]', $model->status, array('1' => Yii::t('trading', 'Active'), '0' => Yii::t('trading', 'Inactive')), array('separator' => " ")); echo $form->error($model, 'status'); ?> </td> </tr> <tr> <th></th> <th> <?php echo CHtml::submitButton(Yii::t('trading', $model->isNewRecord ? 'Create' : 'Save'), array('class' => 'btn btn-primary')); ?> <a class="btn btn-primary" href="<?php echo Yii::app()->request->baseUrl; ?> /index.php/<?php echo backend;
echo CHtml::radioButtonList('table','', array('NotificationCategories'=>'NotificationCategories', 'Roles'=>'Roles', 'WaterQualities'=>'WaterQualities', 'WaterRequestParameters'=>'WaterRequestParameters', 'Zones'=>'Zones'), array('labelOptions'=>array('style'=>'display:inline'), 'separator'=>'<br>', 'onChange'=>CHtml::ajax(array('type'=>'POST', 'url'=>array('fileUpload/updateFields'), 'success'=>'function(data){ $("#fields").html(data); $("#fields").find("select").uniform(); }' )), ));*/ echo CHtml::radioButtonList('table', '', array('Zones' => Yii::t('generic', 'Zones'), 'WaterRequestParameters' => Yii::t('generic', 'Parameters'), 'Formulas' => Yii::t('generic', 'Formulas'), 'WaterSupply' => Yii::t('generic', 'Water Supply'), 'SAOperativeMargin' => Yii::t('generic', 'Operative Margin')), array('labelOptions' => array('style' => 'display:inline'), 'separator' => '<br>', 'onChange' => CHtml::ajax(array('type' => 'POST', 'url' => array('fileUpload/updateFields'), 'success' => 'function(data){ $("#fields").html(data); $("#fields").find("select").uniform(); }')))); echo Chtml::hiddenField('xlsAttributes', json_encode($xlsAttributes)); echo Chtml::hiddenField('filename', $filename); ?> </div> <div id="fields" style="margin-top:40px"></div> <div class="jFormComponent button"> <?php echo CHtml::submitButton(Yii::t('excel', 'Save')); ?> </div> <?php
unset($_SESSION['model']); echo "<h3>" . Yii::t('admin', 'Upload File') . "</h3>"; echo CHtml::form('importModels', 'post', array('enctype' => 'multipart/form-data', 'id' => 'importModels')); echo CHtml::fileField('data', '', array('id' => 'data')) . "<br>"; echo CHtml::hiddenField('model', $model); echo "<i>" . Yii::t('app', 'Allowed filetypes: .csv') . "</i><br><br>"; echo "<h3>" . Yii::t('admin', 'Import Map') . " <a class='pseudo-link' id='toggle-map-upload'>" . X2Html::fa('fa-caret-down') . "</a></h3>"; echo "<div id='upload-map' style='display:none;'>"; echo Yii::t('admin', "You may select a predefined map here, or upload your own.") . "<br />"; $availImportMaps = $this->availableImportMaps($model); if (empty($availImportMaps)) { echo "<div style='color:red'>"; echo Yii::t('app', "No related import maps were found."); echo "</div>"; } else { echo CHtml::radioButtonList('x2maps', null, $availImportMaps, array('labelOptions' => array('style' => 'display:inline'))); } echo "<br /><br />"; echo CHtml::fileField('mapping', '', array('id' => 'mapping')) . "<br>"; echo "<i>" . Yii::t('app', 'Allowed filetypes: .json') . "</i>"; echo "</div><br><br>"; echo CHtml::submitButton(Yii::t('app', 'Submit'), array('class' => 'x2-button')); echo CHtml::endForm(); echo "</div>"; } else { echo "<h3>" . Yii::t('admin', 'Please select a module to import records into.') . "</h3>"; foreach ($modelList as $class => $modelName) { echo CHtml::link($modelName, array('/admin/importModels', 'model' => $class)) . "<br />"; } } ?>
foreach ($variations as $variation) { $i++; $field = "Variations[{$variation[0]->specification_id}][]"; echo '<div class="product_variation product_variation_' . $i . '">'; echo CHtml::label($variation[0]->specification->title, $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 echo CHtml::radioButtonList($field, $variation[0]->specification->required ? $variation[0]->id : null, ProductVariation::listData($variation)); } else { if ($variation[0]->specification->input_type == 'image') { echo CHtml::fileField($field); } } } echo '</div>'; if ($i % 2 == 0) { echo '<div style="clear: both;"></div>'; } } } echo '<div style="clear: both;"></div>'; echo '<br />'; echo CHtml::hiddenField('product_id', $model->product_id);
echo $RIDCheckNo; ?> >No</option> </select> </td> </tr> <tr style="display: none"> <td align="right" style="text-align: right;"> <label for='gender'><?php $clang->eT("Gender* : "); ?> </label> </td> <td> <?php echo CHtml::radioButtonList('gender', $mrw['gender'], array('m' => 'Male', 'f' => 'Female'), array('separator' => ' ')); ?> </td> <td align="right" style="text-align: right;"> <label for='birthdate'><?php $clang->eT("Birth Date : "); ?> </label> </td> <td> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'birthdate', 'value' => $mrw['birth_date'], 'options' => array('dateFormat' => 'dd-M-yy', 'showAnim' => 'blind', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '1930:2020'), 'htmlOptions' => array('style' => 'height:20px;'))); ?> </td> </tr> <tr>
<div class="input-wrapper"> <?php $radioButtonList = Lists::model()->getList("PublicPlacesParkType"); foreach ($radioButtonList as $thisKey => $radioButton) { if ($radioButton == 'None') { $radioButtonList[$thisKey] = 'All'; } } $typeId = isset($place['typeId']) ? $place['typeId'] : 1; ?> <?php if ($mobile) { echo CHtml::dropDownList('Place[typeId]', $typeId, $radioButtonList); } else { echo CHtml::radioButtonList('Place[typeId]', $typeId, $radioButtonList, array('class' => 'no-margin', 'separator' => ' ', 'labelOptions' => array('class' => 'radio-label right-margin'))); } ?> </div> </div> </div> <div class="row"> <div class="cell right"> <input type="submit" value="SEARCH" class="btn half-width"> </div> </div> </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; }