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


PHP CActiveForm::dropDownList方法代码示例

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


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

示例1: dropDownList

 public function dropDownList($model, $attribute, $data, $htmlOptions = array())
 {
     if ($model->isAttributeRequired($attribute)) {
         $htmlOptions['required'] = 'required';
     }
     return parent::dropDownList($model, $attribute, $data, $htmlOptions);
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:7,代码来源:BackendActiveForm.php

示例2: enum

 public function enum($attribute)
 {
     $enumClass = get_class($this->model);
     foreach (explode('_', $attribute) as $name) {
         $enumClass .= ucfirst($name);
     }
     $enumClass .= 'Enum';
     $htmlOptions = array('key' => 'id');
     if ($attribute == 'type') {
         $htmlOptions['onChange'] = '$(this).closest("form").find(".typeEnumerable").hide();' . '$(this).closest("form").find(".typeEnumerable").closest("fieldset").hide();' . '$(this).closest("form").find(".typeEnumerable_" + $(this).val()).show();' . '$(this).closest("form").find(".typeEnumerable_" + $(this).val()).closest("fieldset").show();';
         Yii::app()->clientScript->registerScript('initTypeInput', '
             $("[name*=type]").each(function(){
                 $(this).change();
             });
         ', CClientScript::POS_LOAD);
     }
     $html = parent::dropDownList($this->model, $attribute, $enumClass::$names, $htmlOptions);
     return $html;
 }
开发者ID:schyzoo,项目名称:YiiBoilerplate,代码行数:19,代码来源:ModelForm.php

示例3: dropDownList

 /**
  * @inheritDoc
  */
 public function dropDownList($model, $attribute, $data, $htmlOptions = array())
 {
     if (!$this->qualifyNames && !isset($htmlOptions['name'])) {
         $htmlOptions['name'] = $attribute;
     }
     if (!isset($htmlOptions['itemprop'])) {
         $htmlOptions['itemprop'] = $this->getItemPropName($attribute);
     }
     return parent::dropDownList($model, $attribute, $data, $htmlOptions);
 }
开发者ID:codemix,项目名称:restyii,代码行数:13,代码来源:ActiveForm.php

示例4: CActiveForm

<?php

$form = new CActiveForm();
foreach ($models as $model) {
    ?>
<div class="row-fluid">
     <?php 
    echo $form->dropDownList($model, "[]BenefitID", Benefit::DropDown(), array('class' => "span12"));
    ?>
</div>
<?php 
}
开发者ID:upmunspel,项目名称:abiturient,代码行数:12,代码来源:_view.php

示例5: getActionElements

 public function getActionElements($controller, $action)
 {
     $form = new CActiveForm();
     $p = Yii::app()->createController($controller);
     if ($p && isset($p[0])) {
         $contObj = $p[0];
     } else {
         $contObj = array();
     }
     if ($contObj && ($actonArr = $contObj->actions())) {
         if (isset($actonArr[$action]) && $actonArr[$action]['class'] == 'CViewAction') {
             $path = $contObj->viewPath . '/pages';
             $files = array();
             if (is_dir($path)) {
                 foreach (scandir($path) as $file) {
                     if (strpos($file, '.php')) {
                         $name = str_replace('.php', '', $file);
                         $files[$name] = $name;
                     }
                 }
             }
             if ($files) {
                 return $form->dropDownList($this, 'element', $files, array()) . $form->hiddenField($this, 'elementmodel', array('value' => 'CViewAction'));
             }
         }
     }
     $actions = array();
     $controller = $_SERVER['DOCUMENT_ROOT'] . '/protected/controllers/' . $controller . 'Controller.php';
     $file = file_get_contents($controller);
     preg_match('!.*action' . $action . '(.*)!im', $file, $matches);
     if (isset($matches[1])) {
         preg_match('!\\/\\*(.*)\\*\\/!ism', $matches[1], $matches);
     }
     if (isset($matches[1])) {
         parse_str($matches[1]);
         //
         $criteria = new CDbCriteria();
         if ($condition) {
             $criteria->condition = $condition;
         }
         if ($order) {
             $criteria->order = $order;
         }
         $returmnodels = new $model();
         $returmnodels = $returmnodels->model()->findAll($criteria);
         $this->elementmodel = $model;
         if (isset($selectitem3)) {
             return $form->dropDownList($this, 'element', CHtml::listData($returmnodels, $selectitem1, $selectitem2, $selectitem3), array('prompt' => 'Выбирите...')) . $form->hiddenField($this, 'elementmodel');
         } else {
             return $form->dropDownList($this, 'element', CHtml::listData($returmnodels, $selectitem1, $selectitem2), array('prompt' => 'Выбирите...')) . $form->hiddenField($this, 'elementmodel');
         }
     } else {
         return '';
     }
 }
开发者ID:ASDAFF,项目名称:RosYama.2,代码行数:55,代码来源:MainMenu.php

示例6: dropDownList

 /**
  * Renders a dropdown list for a model attribute.
  * @param CModel $parentModel the parent data model
  * @param string $attributedPath the attribute or path to related model attribute
  * @param array $data data for generating the list options (value=>display)
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated drop down list
  */
 public function dropDownList($parentModel, $attributedPath, $data, $htmlOptions = array())
 {
     list($model, $attribute, $htmlOptions) = self::resolveArgs($parentModel, $attributedPath, $htmlOptions);
     return parent::dropDownList($model, $attribute, $data, $htmlOptions);
 }
开发者ID:nov072008,项目名称:yiitesting,代码行数:13,代码来源:WForm.php

示例7: dropDownList

 public function dropDownList($model, $attribute, $data, $htmlOptions = array())
 {
     return $this->label($model, $attribute) . parent::dropDownList($model, $attribute, $data, $htmlOptions);
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:4,代码来源:JQActiveForm.php


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