<?php
include_once CMCR_PLUGIN_DIR . '/backend/classes/SettingsView.php';
$settingsView = new CMCR_SettingsView();

$tabs = array(
    'upgradenow'=>'Upgrade',
   'general' => 'General',
    'labels'  => 'Labels',
    'installation'=>'Installation Guide'
);
$tabs = apply_filters('cmcr_settings_pages', $tabs);

if( !function_exists('cmcr_settings_radio') )
{

    function cmcr_settings_radio($name, $options, $currentValue)
    {
        $result = '';
        foreach($options as $value => $text)
        {
            $result .= sprintf('<div style="margin-bottom:0.5em;"><input type="radio" name="%s" id="%s_%s" value="%s"%s />'
                    . '<label for="%s_%s"> %s</label></div>', $name, $name, $value, $value, ( $currentValue == $value ? ' checked="checked"' : ''), $name, $value, $text
            );
        }
        return $result;
    }

}
?>

<div class="clear"></div>
<?php do_action('CMCR_show_messages'); ?>
<?php
if( !empty($messages) ):
    foreach($messages as $message):
        ?><div class="updated"><p><?php echo $message; ?></p></div><?php
    endforeach;
endif;
?>

<div class="cminds_settings_description">

</div>

<?php include plugin_dir_path(__FILE__) . 'settings/top.phtml'; ?>


<form method="post" enctype="multipart/form-data" id="cm-custom-reports-settings-form">

    <div id="tabs">
        <ul><?php foreach($tabs as $id => $name): ?>
                <li><a href="#tab_<?php echo $id; ?>"><?php echo $name; ?></a></li>
            <?php endforeach; ?></ul>


        <?php foreach($tabs as $id => $name): ?>
            <div id="tab_<?php echo $id; ?>" class="tab-content">
                <?php require('settings/' . $id . '.phtml'); ?>
            </div>
        <?php endforeach; ?>
    </div>
    <input type="submit" class="button button-primary" value="Update" />
</form>
