/**
 * get the layout for theme panel
 * layout framework
 * @param $type = type of layout that will inserted into layout structure
 * @param $id = unique id, for layout indetifier
 *
 * @return html structure
 */
function wipfr_get_layout_for_setting($type = "fullwidth", $id, $parentID = 0, $forPage = false)
{
    switch ($type) {
        case 'fullwidth':
            return wipfr_fullwidth_module($id, '', $forPage);
            break;
        case 'sidebar_content':
            return wipfr_sidebarcontent_module('sidebar_content', $id, '', $forPage);
            break;
        case 'content_sidebar':
            return wipfr_sidebarcontent_module('content_sidebar', $id, '', $forPage);
            break;
        case '4col':
            return wipfr_columns_module(4, $id, $parentID, '4col');
            break;
        case '3col':
            return wipfr_columns_module(3, $id, $parentID, '3col');
            break;
        case '2col':
            return wipfr_columns_module(2, $id, $parentID, '2col');
            break;
        case '1_2_3col':
            $colConcept = array('1/3', '2/3');
            return wipfr_mix_columns_module($colConcept, $id, $parentID, '1_2_3col');
            break;
        case '2_1_3col':
            $colConcept = array('2/3', '1/3');
            return wipfr_mix_columns_module($colConcept, $id, $parentID, '2_1_3col');
            break;
        case '1_1_2_4col':
            $colConcept = array('1/4', '1/4', '2/4');
            return wipfr_mix_columns_module($colConcept, $id, $parentID, '1_1_2_4col');
            break;
        case '1_2_1_4col':
            $colConcept = array('1/4', '2/4', '1/4');
            return wipfr_mix_columns_module($colConcept, $id, $parentID, '1_2_1_4col');
            break;
        case '2_1_1_4col':
            $colConcept = array('2/4', '1/4', '1/4');
            return wipfr_mix_columns_module($colConcept, $id, $parentID, '2_1_1_4col');
            break;
        case '1_3_4col':
            $colConcept = array('1/4', '3/4');
            return wipfr_mix_columns_module($colConcept, $id, $parentID, '1_3_4col');
            break;
        case '3_1_4col':
            $colConcept = array('3/4', '1/4');
            return wipfr_mix_columns_module($colConcept, $id, $parentID, '3_1_4col');
            break;
        case 'divider1':
        case 'divider2':
            return wipfr_divider_layout($id, $parentID, $type);
            break;
        case 'paragraph-text':
            return wipfr_full_paragraph_layout($id, $parentID);
            break;
        case 'tagline':
            return wipfr_full_tagline_layout($id, $parentID);
            break;
        case 'taglinebutton':
            return wipfr_full_taglinebutton_layout($id, $parentID);
            break;
        case 'single-page':
            return wipfr_get_singlepage_layout($id, $parentID);
            break;
        case 'single-page-content':
            return wipfr_get_singlepagecontent_layout($id, $parentID);
            break;
        case 'blog-lists':
            return wipfr_get_bloglists_layout($id, $parentID);
            break;
        case 'product-lists':
            return wipfr_get_product_layout($id, $parentID);
            break;
        case 'portfolio-lists':
            return wipfr_get_portfolio_layout($id, $parentID);
            break;
    }
}
 function _get_current_content_db($postid, $parentID)
 {
     $contentStruct = get_post_meta($postid, '_wipfr_page_content_layout', true);
     $con = '';
     if (!empty($contentStruct) && is_array($contentStruct)) {
         $con = '<ul class="layout-placer-lists">' . "\n";
         foreach ($contentStruct as $id => $c) {
             if (isset($c['parent']) && $c['parent'] == $parentID) {
                 $thisID = isset($c['id']) ? $c['id'] : '';
                 $type = isset($c['type']) ? $c['type'] : '';
                 if ($type != "") {
                     if (substr($type, -3) == 'col') {
                         switch ($type) {
                             case '4col':
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_columns_module(4, $thisID, $parentID, '4col', $insidecol);
                                 break;
                             case '3col':
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_columns_module(3, $thisID, $parentID, '3col', $insidecol);
                                 break;
                             case '2col':
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_columns_module(2, $thisID, $parentID, '2col', $insidecol);
                                 break;
                             case '1_2_3col':
                                 $colConcept = array('1/3', '2/3');
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_mix_columns_module($colConcept, $thisID, $parentID, '1_2_3col', $insidecol);
                                 break;
                             case '2_1_3col':
                                 $colConcept = array('2/3', '1/3');
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_mix_columns_module($colConcept, $thisID, $parentID, '2_1_3col', $insidecol);
                                 break;
                             case '1_1_2_4col':
                                 $colConcept = array('1/4', '1/4', '2/4');
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_mix_columns_module($colConcept, $thisID, $parentID, '1_1_2_4col', $insidecol);
                                 break;
                             case '1_2_1_4col':
                                 $colConcept = array('1/4', '2/4', '1/4');
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_mix_columns_module($colConcept, $thisID, $parentID, '1_2_1_4col', $insidecol);
                                 break;
                             case '2_1_1_4col':
                                 $colConcept = array('2/4', '1/4', '1/4');
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_mix_columns_module($colConcept, $thisID, $parentID, '2_1_1_4col', $insidecol);
                                 break;
                             case '1_3_4col':
                                 $colConcept = array('1/4', '3/4');
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_mix_columns_module($colConcept, $thisID, $parentID, '1_3_4col', $insidecol);
                                 break;
                             case '3_1_4col':
                                 $colConcept = array('3/4', '1/4');
                                 $insidecol = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $col_content_type = '';
                                     if (isset($t['content'])) {
                                         $col_content_type = $t['content'];
                                     }
                                     $fields = array();
                                     foreach ($t as $name => $value) {
                                         if ($name != 'content') {
                                             $fields[] = $value;
                                         }
                                     }
                                     if ($col_content_type != '') {
                                         $insidecol[] = wipfr_content_for_column($col_content_type, $z, $thisID, $fields);
                                     } else {
                                         $insidecol[] = "";
                                     }
                                 }
                                 $con .= wipfr_mix_columns_module($colConcept, $thisID, $parentID, '3_1_4col', $insidecol);
                                 break;
                         }
                     } else {
                         switch ($type) {
                             case 'divider1':
                             case 'divider2':
                                 $fields = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $fields[] = $t;
                                 }
                                 $con .= wipfr_divider_layout($thisID, $parentID, $type, $fields);
                                 break;
                             case 'paragraph-text':
                                 $fields = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $fields[] = $t;
                                 }
                                 $con .= wipfr_full_paragraph_layout($thisID, $parentID, $fields);
                                 break;
                             case 'tagline':
                                 $fields = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $fields[] = $t;
                                 }
                                 $con .= wipfr_full_tagline_layout($thisID, $parentID, $fields);
                                 break;
                             case 'taglinebutton':
                                 $fields = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $fields[] = $t;
                                 }
                                 $con .= wipfr_full_taglinebutton_layout($thisID, $parentID, $fields);
                                 break;
                             case 'single-page-content':
                                 $con .= wipfr_get_singlepagecontent_layout($thisID, $parentID);
                                 break;
                             case 'blog-lists':
                                 $fields = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $fields[] = $t;
                                 }
                                 $con .= wipfr_get_bloglists_layout($thisID, $parentID, $fields);
                                 break;
                             case 'portfolio-lists':
                                 $fields = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $fields[] = $t;
                                 }
                                 $con .= wipfr_get_portfolio_layout($thisID, $parentID, $fields);
                                 break;
                             case 'product-lists':
                                 $fields = array();
                                 foreach ($c['field'] as $z => $t) {
                                     $fields[] = $t;
                                 }
                                 $con .= wipfr_get_product_layout($thisID, $parentID, $fields);
                                 break;
                         }
                     }
                 }
             }
         }
         $con .= '</ul>';
     }
     return $con;
 }