<?php

// custom code for this hook
$panel_width = 650;
$panel_animation_out = 15;
$this->smarty->assign(array('mailbeez_entry_url' => mh_href_link(mh_fn('FILENAME_MAILBEEZ'), 'ver=' . mh_cfg('MAILBEEZ_VERSION'))));
$this->smarty->assign(array('panel_width' => $panel_width . 'px'));
$this->smarty->assign(array('panel_animation_out_delta' => $panel_animation_out . 'px'));
$this->smarty->assign(array('panel_animation_out' => ($panel_animation_out + $panel_width) . 'px'));
//$this->smarty->assign(array('panel_position' => 'top: 75%'));
$this->smarty->assign(array('panel_position' => mh_cfg('MAILBEEZ_INSIGHT_PANEL_TAB_POS_RELATIVE') . ': ' . mh_cfg('MAILBEEZ_INSIGHT_PANEL_TAB_POS_VALUE')));
$this->smarty->assign(array('panel_size' => ( mh_cfg('MAILBEEZ_INSIGHT_PANEL_TAB_SIZE') == 'Normal') ? 130 : 30));
$this->smarty->assign(array('panel_show_label' => ( mh_cfg('MAILBEEZ_INSIGHT_PANEL_TAB_SIZE') == 'Normal') ? true : false));
$this->smarty->assign(array('panel_pro' => mh_cfg('MAILBEEZ_BEEZDESK_STATUS')));
$this->smarty->assign(array('observer_refresh' => '30000')); // msec
//$this->smarty->assign(array('panel_slide_mode' => 'mega'));
$this->smarty->assign(array('panel_slide_mode' => 'simple'));

/*
 * disable mega mode
$this->smarty->assign(array('panel_slide_mode' => mh_cfg('MAILBEEZ_INSIGHT_VIEW_MODE') ? mh_cfg('MAILBEEZ_INSIGHT_VIEW_MODE') : 'simple'));
if (mh_cfg('MH_PLATFORM') == 'gambio' && mh_cfg('MH_PLATFORM_GAMBIO') < 2.5 || mh_cfg('MH_PLATFORM') == 'zencart') {
    // gambio: admin interface incompatible with mega
    // zencart: spiffycal code incompatible with mega

    $this->smarty->assign(array('panel_slide_mode' => 'simple'));
}
*/

// get modules
$mailbeez_insight_all_modules = mh_insight_view(null, false, 'panel');

$all_modules_panel = $mailbeez_insight_all_modules;
$view_panel = array();
foreach ($all_modules_panel as $sort_order_key => $file) {
    $class = substr($file, 0, strrpos($file, '.'));

    if ($class == $this->code) {
        continue;
    }

    $view_module = $GLOBALS[$class];

    $start_time = microtime(true);
    $panel_content = $view_module->get_view_panel();
    mh_log("processing panel module: $class in %s", microtime(true) - $start_time);

    if ($panel_content == false) {
        continue;
    }

    $view_panel[] = array('title' => $view_module->title,
        'panel' => $panel_content,
        'code' => $view_module->code,
        'icon_path' => $view_module->get_icon_path(),
        'link' => $view_module->get_menu_link()
    );
}
$this->smarty->assign(array('panel_array' => $view_panel));


