
class DACdbSetting
    {
            if($show_map == 1){
                $map = '
                    <div id="Map"></div>
                    <div id="map_canvas" style="min-height:600px;"></div>
                    <div id="MapData" style="display:none;"></div>
                    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
                    <script async defer type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key='.$options['map_api'].'"></script>

                        <script type="text/javascript" >
                        var j$ = jQuery.noConflict();
                            var temp = "";
                            function showMap(json) {
                                temp = json.text
                            }
                                function showPopUpData(json) {
                                        document.getElementById(\'MapData\').innerHTML = json.text;
                            }
                            j$(document).ready(function() {
                                        eval(temp);
                                        j$("#Map").hide();
                                        j$("#MapData").hide();
                            });
                        </script>
                        <script src="https://ismyrotaryclub.com/map/PopUpClubData.cfm?AccountID='.$options['dacdb_district'].'&xsl=ClubData.xsl&callback=showPopUpData&zlevel=0" type="text/javascript"></script>
                        <script src="https://ismyrotaryclub.com/map/indexClub.cfm?AccountID='.$options['dacdb_district'].'&xsl=ClubInteractive2.xsl&callback=showMap&zlevel=0" type="text/javascript"></script>
                    ';

                return $map;
            }

            //TODO update committee to count down the people and close out the row if odd
            if($show_committee == 1){
                    $committees = '';
                    $counter = 1;
                    $grid_counter = 0;


                    if ($options['committee_members_per_row'] == '') {
                        $options['committee_members_per_row'] = 1;
                    }
                    $committees .= '<style>h1.entry-title { display:none !important; }</style>';
                    $xml = simplexml_load_file($data_path.'wp_ById2.cfm?AccountID='.$options['dacdb_district'].'&ClubID='.$options['dacdb_club'].'&id='.$cid.'&RoleKey=');
                    $lastCounter = count($xml->committeemembers);
                        foreach($xml->committeemembers as $committeemembers) {
                            if ($counter == 1){
                                if ($options['committee_global_name'] == 1) {
                                    $committees .= '<h1>'.$committeemembers->committeename.' Committee Members</h1>';
                                }
                                $url=strtok($_SERVER["REQUEST_URI"],'?');

                                if ($options['committee_global_description'] == 1) {
                                    $committees .= '<div>'.$committeemembers->description.'</div><br><br>';
                                }
                                $counter = 2;
                            }

                            $grid_counter = $grid_counter + 1;

                            if ($options['committee_members_per_row'] == 1) {
                                $grid_counter = 1;
                            }

                            if ( $grid_counter == 1 ) {
                                $committees .= '<div class="dac-row">';
                            }
                            $setDivWidth = 150;
                            $setImgWidth = 140;

                            if ($options['committee_members_per_row'] == 1) {
                                $committees .= '<div class="members dac-col-xs-12">';
                            } else if ($options['committee_members_per_row'] == 2) {
                                $committees .= '<div class="members dac-col-xs-12 dac-col-sm-6">';
                            } else if ($options['committee_members_per_row'] == 3) {
                                $committees .= '<div class="members dac-col-xs-12 dac-col-sm-12 dac-col-md-4">';
                            } else if ($options['committee_members_per_row'] == 4) {
                                $committees .= '<div class="members dac-col-xs-12 dac-col-sm-6 dac-col-md-3 dac-col-lg-3">';
                                $setDivWidth = 120;
                                $setImgWidth = 110;
                            }

                                if ( $options['committee_members_pics'] == 0 ) {
                                    $committees .= '<table style="vertical-align: top;padding:0;border:0 !important;"><tr>';
                                } else {
                                    if ($committeemembers->image == '') {
                                            $committees .= '<table style="vertical-align: top;padding:0;border:0 !important;"><tr><td style="border:0 !important;vertical-align: top;padding:0;max-width:'.$setDivWidth.'px;width:'.$setDivWidth.'px"><img src="'. plugins_url( 'img/no_image.jpg', __FILE__ ) .'" width="'.$setImgWidth.'"></td>';
                                    } else {
                                            $committees .= '<table style="vertical-align: top;padding:0;border:0 !important;"><tr><td style="border:0 !important;vertical-align: top;padding:0;max-width:'.$setDivWidth.'px;width:'.$setDivWidth.'px"><img src="'.$committeemembers->imgpath.''.$committeemembers->image.'" width="'.$setImgWidth.'"></td>';
                                    }
                                }

                                if ( $options['committee_members_contact_link'] == 1 ) {
                                        $committees .= '<td style="border:0 !important;max-width:1px;width:1px;padding:0;">&nbsp;</td><td style="border:0 !important;vertical-align: top;padding:0;"><a href="'.$data_path.'R_Emailer.cfm?UserID='.$committeemembers->userid.'" class="iframe3 cboxElement"><b>'.$committeemembers->username.'</b></a>';
                                } else {
                                    $committees .= '<td style="border:0 !important;max-width:1px;width:1px;padding:0;">&nbsp;</td><td style="border:0 !important;vertical-align: top;padding:0;"><b>'.$committeemembers->username.'</b>';
                                }

                                        if ( $options['committee_members_committeeposition'] == 1 ) {
                                            if ( $committeemembers->committeeposition != '') {
                                            $committees .= '<br>'.$committeemembers->committeeposition.'';
                                        }
                                        }

                                        if ( $options['committee_global_show_district_number'] == 1 ) {
                                            if ( $committeemembers->accountid != '') {
                                                $committees .= '<br>District '.$committeemembers->accountid.'';
                                            }
                                        }
                                        if ( $options['committee_members_busposition'] == 1 ) {
                                            if ( $committeemembers->busposition != '') {
                                                $committees .= '<br>'.$committeemembers->busposition.'';
                                            }
                                        }

                                    if ( $options['committee_members_classification'] == 1 ) {
                                        if ( $committeemembers->classification != '') {
                                        $committees .= '<br>'.$committeemembers->classification.'';
                                    }
                                }

                                    if ( $options['committee_members_contact_link'] == 1 ) {
                                        $committees .= '<br><a href="'.$data_path.'R_Emailer.cfm?UserID='.$committeemembers->userid.'" class="iframe3 cboxElement">Contact</a>';
                                    }
                                        $committees .= '</td></tr></table>';


                                $committees .= '</div>';

                                if ( $grid_counter == $options['committee_members_per_row'] ) {
                                    $committees .= '</div>';
                                    $grid_counter = 0;
                                }



                        }
                         if ($lastCounter == $counter) {
                            if ($grid_counter > 0) {
                                $members .= '</div>';
                            }
                         }
                            //  $committees .= '</div>';
                return $committees;
            }

            if($show_wcm == 1){
                /*
                    [dacdb_plus show="wcm" sort="area"]
                    sort = date

                    0 = Default
                    1 = Area
                    2 = Date
                    3 = Detail
                    4 = Club

                */
                if ($options['wcm_show_layout'] == 0) {
                    // Do nothing leave sort as what was selected
                } elseif ($options['wcm_show_layout'] == 1) {
                    $sort = 'area';
                } elseif ($options['wcm_show_layout'] == 2) {
                    $sort = 'date';
                } elseif ($options['wcm_show_layout'] == 3) {
                    $sort = 'detail';
                } elseif ($options['wcm_show_layout'] == 4) {
                    $sort = 'club';
                }
                $xml = simplexml_load_file($data_path.'wp_wcm.cfm?AccountID='.$options['dacdb_district'].'&SortBy='.$sort.'');
                $wcms = '';
                $counter = 1;

s            }

    }
}
