当前位置: 首页>>代码示例>>PHP>>正文


PHP CHtml::hiddenField方法代码示例

本文整理汇总了PHP中CHtml::hiddenField方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::hiddenField方法的具体用法?PHP CHtml::hiddenField怎么用?PHP CHtml::hiddenField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CHtml的用法示例。


在下文中一共展示了CHtml::hiddenField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionGetVariations

 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);
     }
 }
开发者ID:axetion007,项目名称:yii-shop,代码行数:33,代码来源:ProductsController.php

示例2: run

 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $this->hidden ? $id . '_hidden' : $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $this->hidden ? $name . '_hidden' : $name;
     }
     if ($this->hasModel()) {
         echo $this->hidden ? BsHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions) : BsHtml::activeTelFieldControlGroup($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo $this->hidden ? CHtml::hiddenField($name, $this->value, $this->htmlOptions) : CHtml::textField($name, $this->value, $this->htmlOptions);
     }
     $options = CJavaScript::encode($this->options);
     $js = "jQuery('#{$id}').{$this->mode}picker({$options});";
     if (isset($this->language)) {
         $this->registerScriptFile($this->i18nScriptFile);
         $js = "jQuery('#{$id}').{$this->mode}picker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['{$this->language}'], {$options}));";
     }
     $cs = Yii::app()->getClientScript();
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets');
     $cs->registerCssFile($assets . self::ASSETS_NAME . '.css');
     $cs->registerScriptFile($assets . self::ASSETS_NAME . '.js', CClientScript::POS_END);
     $cs->registerScript(__CLASS__, $this->defaultOptions ? 'jQuery.{$this->mode}picker.setDefaults(' . CJavaScript::encode($this->defaultOptions) . ');' : '');
     $cs->registerScript(__CLASS__ . '#' . $id, $js);
 }
开发者ID:nsarvar,项目名称:performance,代码行数:31,代码来源:CJuiDateTimePicker.php

示例3: formButton

 /**
  * @param array $options
  * @return string
  */
 public function formButton($options = array())
 {
     $form = CHtml::beginForm($this->url(), 'get');
     $form .= CHtml::hiddenField('business', $this->business);
     foreach (CMap::mergeArray($this->defaultOptions, $options) as $k => $v) {
         $form .= CHtml::hiddenField($k, $v);
     }
     $form .= CHtml::imageButton($this->image, array('border' => 0, 'alt' => $this->imageAltText));
     $form .= CHtml::endForm();
     return $form;
 }
开发者ID:cornernote,项目名称:yii-dressing,代码行数:15,代码来源:YdPayPalHelper.php

示例4: showLangModal

 public function showLangModal()
 {
     $language = Yii::app()->params['language'];
     $this->beginWidget('bootstrap.widgets.TbModal', array('id' => $this->modalId, 'htmlOptions' => array('style' => 'margin-top:-200px;', 'backdrop' => 'static')));
     echo "<div class=\"modal-header\">\n                <h4 style=\"width:30%;display: inline-block;\">翻译</h4> \n                <span id='" . $this->modalId . "message' style=\"margin-left:30px;color:red;\"></span>\n            </div>";
     echo "<div id='" . $this->modalId . "ModalBody' class=\"modal-body\" style=\"text-align:center\">";
     $tableName = $this->model->tableName();
     $attribute = $this->attribute;
     echo CHtml::hiddenField('tableName', $tableName);
     echo CHtml::hiddenField('attribute', $attribute);
     $pk = $this->model->primaryKey;
     echo CHtml::activeHiddenField($this->model, $this->model->pk, array('name' => 'pk'));
     $result = Translation::model()->find('model=:tableName and pk=:pk and attribute=:attribute', array(':tableName' => $tableName, ':pk' => $pk, ':attribute' => $attribute));
     $data = json_decode($result->data);
     foreach ($language as $key => $value) {
         if (strtolower($key) == 'zh_cn') {
             continue;
         }
         echo "<div><span style='width:80px !important;display: inline-block;'>" . $value . '</span>' . CHtml::textField($key, $data->{$key}) . "</div>";
     }
     echo "</div>";
     echo "<div class=\"modal-footer\" style=\"text-align: center;\">";
     $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'type' => 'info', 'label' => '保存', 'htmlOptions' => array('id' => $this->modalId . 'save')));
     echo "&nbsp;";
     $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'label' => '取消', 'htmlOptions' => array("data-dismiss" => "modal", 'id' => $this->modalId . 'back')));
     echo "</div>";
     $this->endWidget();
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:28,代码来源:TTranslate.php

示例5: run

 public function run()
 {
     echo CHtml::hiddenField($this->name, '', array('id' => $this->id . '_hidden'));
     //beckause disabled elements no serialize
     echo CHtml::activeTextField($this->model, $this->attribute, array('class' => 'text'));
     echo '<div class="alias_preloader" ></div>';
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:7,代码来源:AliasField.php

示例6: actionInterviewSelected

 public function actionInterviewSelected()
 {
     if (isset($_POST) && isset($_POST['stu_job_id']) && !empty($_POST['stu_job_id'])) {
         $interviewCancelForm = new InterviewCancelForm(InterviewCancelForm::TYPE_EMP);
         //$interviewCancelForm->attributes=$_POST['InterviewCancelForm'];
         $unInteResumes = InterviewStudentJobTitle::getUnInterviewResumes($_POST['stu_job_id'], Yii::app()->user->id);
         if (count($unInteResumes) > 0) {
             try {
                 if (InterviewStudentJobTitle::saveInterviewResumes($unInteResumes, Yii::app()->user->id, $_POST['interviewDate'])) {
                     echo "I am here   ";
                     $interviewCancelForm->sendIn();
                     echo "I am here after send";
                     $this->renderPartial('/common/_alerts', array('type' => 'success', 'msg' => Yii::t('app', 'msg.success.interview_resumes')));
                 }
                 echo CHtml::hiddenField('interviewed-date', $_POST['interviewDate']);
             } catch (Exception $e) {
                 $this->renderPartial('/common/_alerts', array('type' => 'danger', 'msg' => Yii::t('app', 'msg.error.interview_resumes')));
             }
             echo CHtml::hiddenField('interviewed-resumes', implode(',', $unInteResumes));
         } else {
             $this->renderPartial('/common/_alerts', array('type' => 'warning', 'msg' => Yii::t('app', 'msg.alert.no_interview_resumes')));
         }
     } else {
         $this->renderPartial('/common/_alerts', array('type' => 'danger', 'msg' => Yii::t('app', 'msg.error.resumes_not_found')));
     }
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:26,代码来源:EmployerInterviewController.php

示例7: init

 /**
  * Initializes the menu widget.
  * This method mainly normalizes the {@link items} property.
  * If this method is overridden, make sure the parent implementation is invoked.
  */
 public function init()
 {
     echo CHtml::openTag('div', array("id" => "divsearch"));
     echo CHtml::tag("input", array("id" => "searchtext", "type" => "text"));
     echo CHtml::openTag("button", array("id" => "searchbutton", "class" => "btn btn-primary"));
     echo "Cari";
     echo CHtml::closeTag('button');
     echo CHtml::closeTag('div');
     echo CHtml::openTag('div', array("id" => "clocationmap", "style" => "height:" . $this->height)) . "\n";
     echo CHtml::closeTag('div');
     $randNumber = rand(0, 100000);
     $className = get_class($this->model);
     echo CHtml::hiddenField($className . "[" . $this->latId . "]", $this->model->latitude, array("class" => "lat_" . $randNumber));
     echo CHtml::hiddenField($className . "[" . $this->lonId . "]", $this->model->longitude, array("class" => "lon_" . $randNumber));
     echo CHtml::openTag('script', array("src" => "https://maps.googleapis.com/maps/api/js?key=AIzaSyAtc_4SE2BhMel6_WVpSBAjAeF1iczXUow&sensor=false")) . "\n";
     echo CHtml::closeTag('script');
     echo CHtml::openTag('style');
     echo "#clocationmap img { max-width: none; }\n\t\t\t#divsearch { text-align : right }\n\t\t\t#divsearch input { margin : 5px }";
     echo CHtml::closeTag('style');
     ob_start();
     include "picker.js";
     $picker = ob_get_clean();
     echo CHtml::openTag('script');
     echo $picker;
     echo CHtml::closeTag('script');
     //Yii::app()->getClientScript()->registerScript('CLocationPicker',$picker);
 }
开发者ID:phpsong,项目名称:hotel-information-system,代码行数:32,代码来源:CLocationPicker.php

示例8: run

 /**
  * Renders the content of the portlet.
  */
 public function run()
 {
     $shortTextTpl = '<span class="short-text" title="Click to view">%s</span>';
     $fullTextTpl = '<span class="full-text hide">%s</span>';
     Yii::app()->clientScript->registerScript('short-text-widget', "\n\t\t\t\$('body').on('click', '.short-text', function() {\n\t\t\t\t\$(this).hide();\n\t\t\t\t\$(this).siblings('.full-text').removeClass('hide');\n\t\t\t\t\$.get(\$(this).siblings('.short-text-url').val());\n\t\t\t});\n\t\t");
     echo sprintf($shortTextTpl, InputHelper::stripoff($this->text, 4)) . sprintf($fullTextTpl, $this->text) . CHtml::hiddenField('', $this->urlOnCLick, array('class' => 'short-text-url'));
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:10,代码来源:ShortTextWidget.php

示例9: autoComplete

 function autoComplete($name, $complete_view, $id = '', $value = '')
 {
     $url = is_array($complete_view) ? $complete_view : array($complete_view);
     $dom_id = CHtml::getIdByName($name);
     echo CHtml::hiddenField($name, $id, array('id' => $dom_id));
     $this->widget('zii.widgets.jui.CJuiAutoComplete', array('name' => $dom_id . '_autocomplete', 'sourceUrl' => $url, 'options' => array('select' => "js:function(event, ui) {\n                                \$('#{$dom_id}').val(ui.item.id);\n                            }"), 'value' => $value));
 }
开发者ID:black2279,项目名称:Tracy-openshift,代码行数:7,代码来源:Controller.php

示例10: run

 /**
  * Runs the widget and displays the input field
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $htmlOptions = $this->htmlOptions;
     $htmlOptions['id'] = $id;
     if (!isset($htmlOptions['class'])) {
         $htmlOptions['class'] = $this->containerClass;
     }
     if ($this->hasModel()) {
         $value = $this->model->{$this->attribute};
     } else {
         $value = $this->value;
     }
     if ($value instanceof Traversable) {
         $value = (array) $value;
     }
     if (!is_array($value)) {
         $value = array();
     }
     echo CHtml::openTag($this->tagName, $htmlOptions);
     echo CHtml::hiddenField($name, "");
     echo $this->renderArray($value, $name);
     echo CHtml::closeTag($this->tagName);
     $baseUrl = Yii::app()->assetManager->publish(__DIR__ . "/assets");
     Yii::app()->clientScript->registerScriptFile($baseUrl . "/AArrayInputWidget.js");
     $script = "jQuery('#{$id}').arrayInputWidget()";
     Yii::app()->clientScript->registerScript(get_class($this) . "#" . $id, $script);
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:31,代码来源:AArrayInputWidget.php

示例11: run

 /**
  * Run this widget.
  * This method registers necessary javascript and renders the needed HTML code.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $name;
     }
     if ($this->hasModel() === false && $this->value !== null) {
         $this->options['value'] = $this->value;
     }
     if ($this->hasModel()) {
         echo CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::hiddenField($name, $this->value, $this->htmlOptions);
     }
     $idHidden = $this->htmlOptions['id'];
     $nameHidden = $this->htmlOptions['name'];
     $this->htmlOptions['id'] = $idHidden . '_slider';
     $this->htmlOptions['name'] = $nameHidden . '_slider';
     echo CHtml::openTag($this->tagName, $this->htmlOptions);
     echo CHtml::closeTag($this->tagName);
     $this->options[$this->event] = 'js:function(event, ui) { jQuery(\'#' . $idHidden . '\').val(ui.value); }';
     $options = empty($this->options) ? '' : CJavaScript::encode($this->options);
     $js = "jQuery('#{$id}_slider').slider({$options});\n";
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, $js);
 }
开发者ID:BGCX261,项目名称:zii-svn-to-git,代码行数:36,代码来源:CJuiSliderInput.php

示例12: renderCheckoutForm

 public function renderCheckoutForm(Payment $payment, Order $order, $return = false)
 {
     $settings = $payment->getPaymentSystemSettings();
     $mrhLogin = $settings['login'];
     $mrhPass1 = $settings['password1'];
     $culture = $settings['language'];
     $invId = $order->id;
     $invDesc = Yii::t('RobokassaModule.robokassa', 'Payment order #{id} on "{site}" website', ['{id}' => $order->id, '{site}' => Yii::app()->getModule('yupe')->siteName]);
     $outSum = Yii::app()->money->convert($order->getTotalPrice(), $payment->currency_id);
     $crc = md5("{$mrhLogin}:{$outSum}:{$invId}:{$mrhPass1}");
     $form = CHtml::form($settings['testmode'] ? "http://test.robokassa.ru/Index.aspx" : "https://merchant.roboxchange.com/Index.aspx");
     $form .= CHtml::hiddenField('MrchLogin', $mrhLogin);
     $form .= CHtml::hiddenField('OutSum', $outSum);
     $form .= CHtml::hiddenField('InvId', $invId);
     $form .= CHtml::hiddenField('Desc', $invDesc);
     $form .= CHtml::hiddenField('SignatureValue', $crc);
     $form .= CHtml::hiddenField('Culture', $culture);
     $form .= CHtml::submitButton(Yii::t('RobokassaModule.robokassa', 'Pay'));
     $form .= CHtml::endForm();
     if ($return) {
         return $form;
     } else {
         echo $form;
     }
 }
开发者ID:RonLab1987,项目名称:43berega,代码行数:25,代码来源:RobokassaPaymentSystem.php

示例13: showsaveform

 function showsaveform()
 {
     //Show 'SAVE FORM' only when click the 'Save so far' button the first time, or when duplicate is found on SAVE FORM.
     global $errormsg, $thissurvey, $surveyid, $clang, $clienttoken, $thisstep;
     $redata = compact(array_keys(get_defined_vars()));
     $sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
     sendCacheHeaders();
     doHeader();
     echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata);
     echo "\n\n<!-- JAVASCRIPT FOR CONDITIONAL QUESTIONS -->\n" . "\t<script type='text/javascript'>\n" . "\t<!--\n" . "function checkconditions(value, name, type, evt_type)\n" . "\t{\n" . "\t}\n" . "\t//-->\n" . "\t</script>\n\n";
     echo CHtml::form(array("/survey/index"), 'post') . "\n";
     //PRESENT OPTIONS SCREEN
     if (isset($errormsg) && $errormsg != "") {
         $errormsg .= "<p>" . $clang->gT("Please try again.") . "</p>";
     }
     echo templatereplace(file_get_contents($sTemplatePath . "save.pstpl"), array(), $redata);
     //END
     echo "<input type='hidden' name='sid' value='{$surveyid}' />\n";
     echo "<input type='hidden' name='thisstep' value='{$thisstep}' />\n";
     echo CHtml::hiddenField('token', $clienttoken) . "\n";
     echo "<input type='hidden' name='saveprompt' value='Y' />\n";
     echo "</form>";
     echo templatereplace(file_get_contents($sTemplatePath . "endpage.pstpl"), array(), $redata);
     echo "</html>\n";
     exit;
 }
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:26,代码来源:Save.php

示例14: renderField

 /**
  * Renders the input file field
  */
 public function renderField()
 {
     list($name, $id) = $this->resolveNameID();
     TbArray::defaultValue('id', $id, $this->htmlOptions);
     TbArray::defaultValue('name', $name, $this->htmlOptions);
     TbHtml::addCssClass('bfh-selectbox', $this->wrapperOptions);
     echo CHtml::openTag('div', $this->wrapperOptions);
     if ($this->hasModel()) {
         echo CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
         $value = $this->model->{$this->attribute};
         $valueText = $value && isset($this->data[$value]) ? $this->data[$value] : '&nbsp;';
     } else {
         echo CHtml::hiddenField($name, $this->value, $this->htmlOptions);
         $value = $this->value;
         $valueText = $value && isset($this->data[$value]) ? $this->data[$value] : '&nbsp;';
     }
     echo CHtml::openTag('a', array('class' => 'bfh-selectbox-toggle', 'role' => 'button', 'data-toggle' => 'bfh-selectbox', 'href' => '#'));
     echo CHtml::tag('span', array('class' => 'bfh-selectbox-option ' . $this->size, 'data-option' => $value), $valueText);
     echo CHtml::tag('b', array('class' => 'caret'), '&nbsp;');
     echo CHtml::closeTag('a');
     echo CHtml::openTag('div', array('class' => 'bfh-selectbox-options'));
     if ($this->displayFilter) {
         echo '<input type="text" class="bfh-selectbox-filter">';
     }
     $items = array();
     foreach ($this->data as $key => $item) {
         $items[] = CHtml::tag('a', array('tabindex' => '-1', 'href' => '#', 'data-option' => $key), $item);
     }
     echo CHtml::tag('ul', array('role' => 'options'), '<li>' . implode('</li><li>', $items) . '</li>');
     echo CHtml::closeTag('div');
     echo CHtml::closeTag('div');
 }
开发者ID:2amigos,项目名称:yiiwheels,代码行数:35,代码来源:WhSelectBox.php

示例15: init

 public function init()
 {
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets');
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
     $this->id = $id = $this->htmlOptions['id'];
     echo CHtml::image($this->url, $this->alt, $this->htmlOptions);
     if (!empty($this->buttons)) {
         echo '<div class="jcrop-buttons">' . CHtml::button($this->buttons['start']['label'], $this->getHtmlOptions('start', 'inline'));
         echo CHtml::button($this->buttons['crop']['label'], $this->getHtmlOptions('crop'));
         echo CHtml::button($this->buttons['cancel']['label'], $this->getHtmlOptions('cancel')) . '</div>';
     }
     echo CHtml::hiddenField($id . '_x', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_y', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_w', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_h', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_x2', 0, array('class' => 'coords'));
     echo CHtml::hiddenField($id . '_y2', 0, array('class' => 'coords'));
     $cls = Yii::app()->getClientScript();
     $cls->registerScriptFile($assets . '/js/jquery.Jcrop.min.js');
     $cls->registerScriptFile($assets . '/js/ejcrop.js', CClientScript::POS_HEAD);
     $cls->registerCssFile($assets . '/css/jquery.Jcrop.css');
     $this->options['onChange'] = "js:function(c) {ejcrop_getCoords(c,'{$id}'); ejcrop_showThumb(c,'{$id}');}";
     $this->options['ajaxUrl'] = $this->ajaxUrl;
     $this->options['ajaxParams'] = $this->ajaxParams;
     $options = CJavaScript::encode($this->options);
     if (!empty($this->buttons)) {
         $js = "ejcrop_initWithButtons('{$id}', {$options});";
     } else {
         $js = "jQuery('#{$id}').Jcrop({$options});";
     }
     $cls->registerScript(__CLASS__ . '#' . $id, $js, CClientScript::POS_READY);
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:34,代码来源:EJcrop.php


注:本文中的CHtml::hiddenField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。