<?php
/*
  MailBeez Automatic Trigger Email Campaigns
  http://www.mailbeez.com

  Copyright (c) 2010, 2011 MailBeez

  inspired and in parts based on
  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License

  v2.1
 */

///////////////////////////////////////////////////////////////////////////////
///																			 //
///                 MailBeez Core file - do not edit                         //
///                                                                          //
///////////////////////////////////////////////////////////////////////////////




if (mh_cfg('MH_DISABLE_PACKAGE_BUTTON')) {
    $show_select_package = false;
    $show_waiting_info = false;
    $show_install_package = false;
    $show_update_package = false;

    $select_package = false;
    $install_package = false;
    $update_package = false;

    $cloudbeez_select_package_button = false;
    $cloudbeez_install_package_button = false;
    $cloudbeez_update_package_button = false;

} else {
    list($show_select_package, $show_waiting_info, $show_install_package, $show_update_package) = cloudbeez_status_handler::getStatus();
    list($select_package, $install_package, $update_package, , ,) = cloudbeez_status_handler::getActionUrls();
    $cloudbeez_select_package_button = mb_admin_button($select_package, mh_lng('MAILBEEZ_MAILHIVE_CLOUDLOADER_SELECT_PACKAGE_BUTTON'), '', 'link', 'link', '', 'document', 'iframe');
    $cloudbeez_install_package_button = mb_admin_button($install_package, mh_lng('MAILBEEZ_MAILHIVE_CLOUDLOADER_INSTALL_PACKAGE_BUTTON'), '', 'popup', 'link', '', 'document', 'iframe');
    $cloudbeez_update_package_button = mb_admin_button($update_package, mh_lng('MAILBEEZ_MAILHIVE_CLOUDLOADER_UPDATE_PACKAGE_BUTTON'), '', 'popup', 'link', '', 'document', 'iframe');
}

if (mh_cfg('MAILBEEZ_TOUR_STATUS') == 'True') {
    include_once(MH_DIR_CONFIG . 'config_tour.php');
    require_once(MH_DIR_CONFIG . 'config_tour/functions/general.php');
    $new_tour_cnt = mh_tour_cnt();
}

$upd_cnt = array_key_exists('mailbeez_upd_cnt', $_SESSION) ? $_SESSION['mailbeez_upd_cnt'] : null;
$new_cnt = array_key_exists('mailbeez_new_cnt', $_SESSION) ? $_SESSION['mailbeez_new_cnt'] : null;

if ( !( mh_cfg('MH_SHOW_TABS') === false)) {


    ?>
    <div class="mailbeez_main_tabs">
        <link rel="stylesheet" type="text/css" media="print, projection, screen"
              href="<?php echo mh_cfg('MH_CATALOG_SERVER') . mh_cfg('MH_DIR_WS_CATALOG') . mh_cfg('MH_ROOT_PATH'); ?>common/admin_application_plugins/tabs.css">
        <link rel="stylesheet" type="text/css" media="print, projection, screen"
              href="<?php echo mh_cfg('MH_CATALOG_SERVER') . mh_cfg('MH_DIR_WS_CATALOG') . mh_cfg('MH_ROOT_PATH'); ?>common/admin_application_plugins/versioncheck.css">
        <ul class="tabs">

            <?php if ((mh_cfg('MAILBEEZ_TOUR_STATUS') == 'True')) {
                $tour_url = mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'app=load_app&app_path=config_tour/admin_application_plugins/overview.php');
                ?>
                <?php if (mh_cfg('MAILBEEZ_TOUR_MODE') == 'Popup') { ?>
                    <li class="tab_tour"><?php echo mb_admin_button($tour_url, '<img src="">', 'tab_tour', 'popup', 'link', '', 'document', 'iframe'); ?></li>
                <?php } else { ?>
                    <li class="tab_tour" style="min-width: 15px !important; padding: 0 5px !important;"><a
                                style="padding: 0px; padding-left: 5px" <?php if ($tab == 'tour'){ ?>class="current"
                                id="tab_tour_active" <?php } else { ?> id="tab_tour"<?php } ?>
                                href="<?php echo $tour_url; ?>"><img
                                    src="<?php echo mh_cfg('MH_CATALOG_SERVER') . mh_cfg('MH_DIR_WS_CATALOG') . mh_cfg('MH_ROOT_PATH'); ?>configbeez/config_tour/images/UI_37.png"
                                    width="14" height="14"><?php if ($new_tour_cnt > 0) { ?>
                                <span class="new_cnt"><?php echo $new_tour_cnt ?></span><?php } ?></a></li>
                <?php } ?>
            <?php } ?>

            <li><a <?php if ($tab == 'home'){ ?>class="current"
                   id="tab_dashboard_active" <?php } else { ?> id="tab_dashboard"<?php } ?>
                   href="<?php echo mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'tab=home'); ?>"><?php echo mh_cfg('MH_TAB_HOME'); ?><?php if ($upd_cnt && $upd_cnt['dashboardbeez'] > 0) { ?>
                        <span
                                class="upd_cnt"><?php echo $upd_cnt ? $upd_cnt['dashboardbeez'] : '' ?></span> <?php } ?><?php if ($new_cnt && $new_cnt['dashboardbeez'] > 0) { ?>
                        <span class="new_cnt"><?php echo $new_cnt ? $new_cnt['dashboardbeez'] : '' ?></span><?php } ?></a></li>
            <li><a <?php if ($tab == 'mailbeez') { ?>class="current"
                   id="tab_mailbeez_active" <?php } else { ?> id="tab_mailbeez" <?php } ?>
                   href="<?php echo mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'tab=mailbeez'); ?>
                "><?php echo mh_cfg('MH_TAB_MAILBEEZ'); ?><?php if ($upd_cnt && $upd_cnt['mailbeez'] > 0) { ?>
                        <span
                                class="upd_cnt"><?php echo $upd_cnt? $upd_cnt['mailbeez'] : '' ?></span> <?php } ?><?php if ($new_cnt && $new_cnt['mailbeez'] > 0) { ?>
                        <span class="new_cnt"><?php echo $new_cnt ? $new_cnt['mailbeez'] : '' ?></span><?php } ?></a></li>
            <li><a <?php if ($tab == 'filterbeez') { ?>class="current"
                   id="tab_filterbeez_active" <?php } else { ?> id="tab_filterbeez" <?php } ?>
                   href="<?php echo mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'tab=filterbeez'); ?>
                "><?php echo mh_cfg('MH_TAB_FILTER'); ?><?php if ($upd_cnt && $upd_cnt['filterbeez'] > 0) { ?>
                        <span
                                class="upd_cnt"><?php echo $upd_cnt ? $upd_cnt['filterbeez'] :
                                ''?></span> <?php } ?><?php if ($new_cnt && $new_cnt['filterbeez'] > 0) { ?>
                        <span class="new_cnt"><?php echo $new_cnt ? $new_cnt['filterbeez'] : ''?></span><?php } ?></a></li>
            <li><a <?php if ($tab == 'reportbeez') { ?>class="current"
                   id="tab_reportbeez_active" <?php } else { ?> id="tab_reportbeez" <?php } ?>
                   href="<?php echo mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'tab=reportbeez'); ?>
                "><?php echo mh_cfg('MH_TAB_REPORT'); ?><?php if ($upd_cnt && $upd_cnt['reportbeez'] > 0) { ?>
                        <span
                                class="upd_cnt"><?php echo $upd_cnt ? $upd_cnt['reportbeez'] : '' ?></span> <?php } ?><?php if ($new_cnt && $new_cnt['reportbeez'] > 0) { ?>
                        <span class="new_cnt"><?php echo $new_cnt ? $new_cnt['reportbeez'] : '' ?></span><?php } ?></a></li>
            <li><a <?php if ($tab == 'configbeez') { ?>class="current"
                   id="tab_configbeez_active" <?php } else { ?> id="tab_configbeez" <?php } ?>
                   href="<?php echo mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'tab=configbeez'); ?>
                "><?php echo mh_cfg('MH_TAB_CONFIGURATION'); ?><?php if ($upd_cnt && $upd_cnt['configbeez'] > 0) { ?>
                        <span
                                class="upd_cnt"><?php echo $upd_cnt ? $upd_cnt['configbeez'] : ''?></span> <?php } ?><?php if ($new_cnt && $new_cnt['configbeez'] > 0) { ?>
                        <span class="new_cnt"><?php echo $new_cnt ? $new_cnt['configbeez'] : ''?></span><?php } ?></a></li>
            <?php if (!mh_cfg('MH_DISABLE_ABOUT_TAB')) { ?>
                <li style="min-width: 10px !important; padding: 0 5px !important;"><a

                            style="padding: 0px; "
                            <?php if ($tab == 'about') { ?>class="current" id="tab_about_active" <?php } else { ?>
                        id="tab_about" <?php } ?>
                            href="<?php echo mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'tab=about'); ?>"><?php echo mh_cfg('MH_TAB_ABOUT'); ?></a>
                </li>
            <?php } ?>
            <?php if ($show_select_package) { ?>
                <li class="cloudbeez_select_button"><?php echo $cloudbeez_select_package_button; ?></li>
            <?php } ?>
            <?php if ($show_install_package) { ?>
                <li class="cloudbeez_select_button cloudbeez_install_button"><?php echo $cloudbeez_install_package_button; ?></li>
            <?php } elseif ($show_waiting_info) { ?>
                <li class="cloudbeez_select_button cloudbeez_wait_ipn">
                    <a href="#" onclick="return false;">
                        <?php echo mh_lng('MAILBEEZ_MAILHIVE_CLOUDLOADER_WAIT_IPN'); ?>
                    </a>
                </li>
            <?php } ?>
            <?php if ($show_update_package) { ?>
                <li class="cloudbeez_select_button cloudbeez_update_button"><?php echo $cloudbeez_update_package_button; ?></li>
            <?php } ?>

        </ul>
    </div>
    <?php if ($show_waiting_info) { ?>
        <div style="text-align: center;     background-color: #f8933c;
    border: 1px solid #f8933c;" class="cloudbeez_waiting_info">
            <br clear="all">
            <a href="<?php echo mh_href_link(mh_fn('FILENAME_MAILBEEZ'), ''); ?>">
                <?php echo mh_lng('MAILBEEZ_MAILHIVE_CLOUDLOADER_WAIT_IPN'); ?>
                <?php echo mh_lng('MAILBEEZ_MAILHIVE_CLOUDLOADER_WAIT_IPN_HINT'); ?>
            </a>
            <br/>
            <br clear="all">
        </div>
    <?php }
}
?>
