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


PHP opToolkit::arrayMapRecursive方法代码示例

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


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

示例1: generateWidget

 public static function generateWidget($field, $choices = array())
 {
     $field = self::arrayKeyCamelize($field);
     $params = self::generateWidgetParams($field, $choices);
     if (in_array($field['FormType'], self::$choicesType)) {
         if ($field['FormType'] === 'select') {
             if (!$field['IsRequired']) {
                 $params['choices'] = array('' => sfContext::getInstance()->getI18N()->__('Please Select')) + $params['choices'];
             }
         } else {
             $params['expanded'] = true;
         }
     }
     switch ($field['FormType']) {
         case 'checkbox':
             $params['multiple'] = true;
             $obj = new sfWidgetFormChoice($params);
             break;
         case 'select':
             $obj = new sfWidgetFormChoice($params);
             break;
         case 'radio':
             $obj = new sfWidgetFormChoice($params);
             break;
         case 'textarea':
             $obj = new sfWidgetFormTextarea($params);
             break;
         case 'rich_textarea':
             $obj = new opWidgetFormRichTextarea($params);
             break;
         case 'password':
             $obj = new sfWidgetFormInputPassword($params);
             break;
         case 'date':
             unset($params['choices']);
             $params['culture'] = sfContext::getInstance()->getUser()->getCulture();
             $params['month_format'] = 'number';
             if (!$field['IsRequired']) {
                 $params['can_be_empty'] = true;
             }
             $obj = new opWidgetFormDate($params);
             break;
         case 'increased_input':
             $obj = new opWidgetFormInputIncreased($params);
             break;
         case 'language_select':
             $languages = sfConfig::get('op_supported_languages');
             $choices = opToolkit::getCultureChoices($languages);
             $obj = new sfWidgetFormChoice(array('choices' => $choices));
             break;
         case 'country_select':
             $info = sfCultureInfo::getInstance(sfContext::getInstance()->getUser()->getCulture());
             $obj = new sfWidgetFormChoice(array('choices' => $info->getCountries()));
             break;
         case 'region_select':
             $list = sfYaml::load(sfConfig::get('sf_lib_dir') . '/config/config/regions.yml');
             $type = $field['ValueType'];
             if ('string' !== $type && isset($list[$type])) {
                 $list = $list[$type];
                 $list = array_combine($list, $list);
             } else {
                 foreach ($list as $k => $v) {
                     if ($v) {
                         $list[$k] = array_combine($v, $v);
                     }
                 }
             }
             $list = opToolkit::arrayMapRecursive(array(sfContext::getInstance()->getI18N(), '__'), $list);
             $obj = new sfWidgetFormChoice(array('choices' => $list));
             break;
         default:
             $obj = new sfWidgetFormInput($params);
     }
     return $obj;
 }
开发者ID:phenom,项目名称:OpenPNE3,代码行数:75,代码来源:opFormItemGenerator.class.php

示例2: generateSearchWidget

 public static function generateSearchWidget($field, $choices = array())
 {
     $field = self::arrayKeyCamelize($field);
     $params = self::generateWidgetParams($field, $choices);
     switch ($field['FormType']) {
         // selection
         case 'checkbox':
         case 'select':
         case 'radio':
             $obj = new sfWidgetFormChoice($params);
             break;
             // doesn't allow searching
         // doesn't allow searching
         case 'increased_input':
         case 'language_select':
         case 'password':
             $obj = null;
             break;
             // country
         // country
         case 'country_select':
             $info = sfCultureInfo::getInstance(sfContext::getInstance()->getUser()->getCulture());
             $params['choices'] = array('' => '') + $info->getCountries();
             $obj = new sfWidgetFormChoice($params);
             break;
             // region
         // region
         case 'region_select':
             $list = (array) (include sfContext::getInstance()->getConfigCache()->checkConfig('config/regions.yml'));
             $type = $field['ValueType'];
             if ('string' !== $type && isset($list[$type])) {
                 $list = $list[$type];
                 $list = array_combine($list, $list);
             } else {
                 foreach ($list as $k => $v) {
                     if ($v) {
                         $list[$k] = array_combine($v, $v);
                     }
                 }
             }
             $list = opToolkit::arrayMapRecursive(array(sfContext::getInstance()->getI18N(), '__'), $list);
             $params['choices'] = array('' => '') + $list;
             $obj = new sfWidgetFormChoice($params);
             break;
             // date
         // date
         case 'date':
             unset($params['choices']);
             $params['culture'] = sfContext::getInstance()->getUser()->getCulture();
             $params['month_format'] = 'number';
             $params['can_be_empty'] = true;
             $obj = new opWidgetFormDate($params);
             break;
             // text and something else
         // text and something else
         default:
             $obj = new sfWidgetFormInput($params);
     }
     return $obj;
 }
开发者ID:niryuu,项目名称:OpenPNE3,代码行数:60,代码来源:opFormItemGenerator.class.php


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