roundcubemail/program/lib/Roundcube/rcube_output.php
public static function get_edit_field($col, $value, $attrib, $type = 'text')
    {
        static $colcounts = array();

        $fname = '_'.$col;
        $attrib['name']  = $fname . ($attrib['array'] ? '[]' : '');
        $attrib['class'] = trim($attrib['class'] . ' ff_' . $col);

        if ($type == 'checkbox') {
            $attrib['value'] = '1';
            $input = new html_checkbox($attrib);
        }
        else if ($type == 'textarea') {
            $attrib['cols'] = $attrib['size'];
            $input = new html_textarea($attrib);
        }
        else if ($type == 'select') {
            $input = new html_select($attrib);
            $input->add('---', '');
            $input->add(array_values($attrib['options']), array_keys($attrib['options']));
        }
        else if ($type == 'password' || $attrib['type'] == 'password') {
            $input = new html_passwordfield($attrib);
        }
        else {
            if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden') {
                $attrib['type'] = 'text';
            }
            $input = new html_inputfield($attrib);
        }

        // use value from post
        if (isset($_POST[$fname])) {
            $postvalue = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true);
            $value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue;
        }

        $out = $input->show($value);

        return $out;
    }
public static function get_edit_field($col, $value, $attrib, $type = 'text')
    {
        static $colcounts = array();

        $fname = '_'.$col;
        $attrib['name']  = $fname . ($attrib['array'] ? '[]' : '');
        $attrib['class'] = trim($attrib['class'] . ' ff_' . $col);

        if ($type == 'checkbox') {
            $attrib['value'] = '1';
            $input = new html_checkbox($attrib);
        }
        else if ($type == 'textarea') {
            $attrib['cols'] = $attrib['size'];
            $input = new html_textarea($attrib);
        }
        else if ($type == 'select') {
            $input = new html_select($attrib);
            $input->add('---', '');
            $input->add(array_values($attrib['options']), array_keys($attrib['options']));
        }
        else if ($type == 'password' || $attrib['type'] == 'password') {
            $input = new html_passwordfield($attrib);
        }
        else {
            if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden') {
                $attrib['type'] = 'text';
            }
            $input = new html_inputfield($attrib);
        }

        // use value from post
        if (isset($_POST[$fname])) {
            $postvalue = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true);
            $value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue;
        }

        $out = $input->show($value);

        return $out;
    }
public static function get_edit_field ( $ col , $ value , $ attrib , $ type = 'text' ) { static $ colcounts = array ( ) ; $ fname = '_' . $ col ; $ attrib [ 'name' ] = $ fname . ( $ attrib [ 'array' ] ? '[]' : '' ) ; $ attrib [ 'class' ] = trim ( $ attrib [ 'class' ] . ' ff_' . $ col ) ; if ( $ type == 'checkbox' ) { $ attrib [ 'value' ] = '1' ; $ input = new html_checkbox ( $ attrib ) ; } else if ( $ type == 'textarea' ) { $ attrib [ 'cols' ] = $ attrib [ 'size' ] ; $ input = new html_textarea ( $ attrib ) ; } else if ( $ type == 'select' ) { $ input = new html_select ( $ attrib ) ; $ input -> add ( '---' , '' ) ; $ input -> add ( array_values ( $ attrib [ 'options' ] ) , array_keys ( $ attrib [ 'options' ] ) ) ; } else if ( $ type == 'password' || $ attrib [ 'type' ] == 'password' ) { $ input = new html_passwordfield ( $ attrib ) ; } else { if ( $ attrib [ 'type' ] != 'text' && $ attrib [ 'type' ] != 'hidden' ) { $ attrib [ 'type' ] = 'text' ; } $ input = new html_inputfield ( $ attrib ) ; } // use value from post if ( isset ( $ _POST [ $ fname ] ) ) { $ postvalue = rcube_utils :: get_input_value ( $ fname , rcube_utils :: INPUT_POST , true ) ; $ value = $ attrib [ 'array' ] ? $ postvalue [ intval ( $ colcounts [ $ col ] ++ ) ] : $ postvalue ; } $ out = $ input -> show ( $ value ) ; return $ out ; }
Create an edit field for inclusion on a form

@param string $col    Field name
@param string $value  Field value
@param array  $attrib HTML element attributes for the field
@param string $type   HTML element type (default 'text')

@return string HTML field definition
Create an edit field for inclusion on a form