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


PHP Read::array_search方法代码示例

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


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

示例1: date_select

 public static function date_select($field_id, $field_setup)
 {
     $field_setup['attr']['class'] = 'singleline_selectfield ' . $field_setup['attr']['class'];
     if (Read::array_search('date', $field_setup['rules'])) {
         Form::rules($field_id, array('date'));
     }
     if (Form::is_submitted()) {
         $field_setup['value'] = Form::get_value($field_id);
     }
     // get busy: value for all 3 fields is passed as one unique string
     list($year, $month, $day) = Format::string_explode($field_setup['value'], '-');
     // day widget
     $widget_day = Form::select($field_id . '[day]', array('options' => Format::array_format(range(1, 31), array('keyval' => TRUE, 'label' => !empty($field_setup['labels']['day']) ? $field_setup['labels']['day'] : 'Day')), 'value' => $day, 'attr' => array('class' => $field_setup['attr']['class'], 'css' => $field_setup['attr']['css'], 'onchange' => $field_setup['attr']['onchange'], 'disabled' => $field_setup['attr']['disabled'])));
     // month widget
     $widget_month = Form::select($field_id . '[month]', array('options' => Format::array_format(range(1, 12), array('keyval' => TRUE, 'label' => !empty($field_setup['labels']['month']) ? $field_setup['labels']['month'] : 'Month')), 'value' => $month, 'attr' => array('class' => $field_setup['attr']['class'], 'css' => $field_setup['attr']['css'], 'onchange' => $field_setup['attr']['onchange'], 'disabled' => $field_setup['attr']['disabled'])));
     // year widget
     $widget_year = Form::select($field_id . '[year]', array('options' => Format::array_format(range(!empty($field_setup['options']['years']['from']) ? $field_setup['options']['years']['from'] : date(Y) - 10, !empty($field_setup['options']['years']['to']) ? $field_setup['options']['years']['to'] : date(Y)), array('keyval' => TRUE, 'label' => !empty($field_setup['labels']['year']) ? $field_setup['labels']['year'] : 'Year')), 'value' => $year, 'attr' => array('class' => $field_setup['attr']['class'], 'css' => $field_setup['attr']['css'], 'onchange' => $field_setup['attr']['onchange'], 'disabled' => $field_setup['attr']['disabled'])));
     if (empty($field_setup['format'])) {
         // set template format
         $field_setup['format'] = '%d %m %y';
     }
     // construct complete widget
     $widget = $field_setup['format'];
     $widget = str_replace('%d', $widget_day, $widget);
     $widget = str_replace('%m', $widget_month, $widget);
     $widget = str_replace('%y', $widget_year, $widget);
     return $widget;
 }
开发者ID:gamespree,项目名称:simplon_form,代码行数:28,代码来源:__legacyClass.php


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