form_id = $_POST['form_id']; $this->show_builder(); $output = ob_get_contents(); ob_end_clean(); if(is_array($output)){ print_r($output); }else{ echo $output; } die; } /*** *** @sort array function ***/ function array_sort_by_column($arr, $col, $dir = SORT_ASC) { $sort_col = array(); foreach ($arr as $key=> $row) { $sort_col[$key] = $row[$col]; } array_multisort($sort_col, $dir, $arr); return $arr; } /*** *** @get fields in row ***/ function get_fields_by_row( $row_id ) { foreach( $this->global_fields as $key => $array ) { if ( !isset( $array['in_row'] ) || ( isset( $array['in_row'] ) && $array['in_row'] == $row_id ) ) { $results[$key] = $array; unset( $this->global_fields[$key] ); } } return ( isset ( $results ) ) ? $results : ''; } /*** *** @get fields by sub row ***/ function get_fields_in_subrow( $row_fields, $subrow_id ) { if ( !is_array( $row_fields ) ) return ''; foreach( $row_fields as $key => $array ) { if ( !isset( $array['in_sub_row'] ) || ( isset( $array['in_sub_row'] ) && $array['in_sub_row'] == $subrow_id ) ) { $results[$key] = $array; unset( $this->global_fields[$key] ); } } return ( isset ( $results ) ) ? $results : ''; } /*** *** @Display the builder ***/ function show_builder(){ global $ultimatemember; //print_r( get_option('um_form_rowdata_' . $this->form_id ) ); $fields = $ultimatemember->query->get_attr('custom_fields', $this->form_id ); if ( !isset( $fields ) || empty( $fields ) ) { ?>
global_fields = $fields; foreach( $this->global_fields as $key => $array ) { if ( $array['type'] == 'row' ) { $rows[$key] = $array; unset( $this->global_fields[ $key ] ); // not needed now } } if ( !isset( $rows ) ){ $rows = array( '_um_row_1' => array( 'type' => 'row', 'id' => '_um_row_1', 'sub_rows' => 1, 'cols' => 1 ) ); } foreach ( $rows as $row_id => $array ) { ?>