本文整理汇总了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;
}