function dashboard_system_messages_show()
{
    global $smarty;
    cw_system_messages_show($_GET['type']);
    $sections = array(0 => 'system_messages', 1 => 'awaiting_actions', 2 => 'system_info');
    $section_name = $sections[$_GET['type']];
    $system_messages = cw_system_messages($_GET['type'], true);
    $smarty->assign($section_name, $system_messages);
    cw_ajax_add_block(array('id' => 'dashboard_name_' . $section_name, 'template' => 'addons/dashboard/admin/sections/' . $section_name . '.tpl'));
    cw_ajax_add_block(array('id' => $section_name . '_bottom', 'action' => 'hide'));
}
function dashboard_section_system_info($params, $return = null)
{
    global $tables, $smarty;
    // Set the dashboard code name here
    $name = 'system_info';
    // If the section is disabled then skip it on dashboard
    if ($params['mode'] == 'dashboard' && $params['sections'][$name]['active'] === '0') {
        return $return;
    }
    // Define basic data for configuration
    $return[$name] = array('title' => 'System Information', 'description' => 'This is example of dashboard section explains how to build your own widget', 'active' => 1, 'pos' => 60, 'size' => 'small', 'frame' => 1, 'header' => 1);
    if ($params['mode'] == 'setting') {
        return $return;
    }
    // Add content for dashboard in 'dashboard' mode
    // Define either content or template name or both
    // Categories counter
    $cat_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['categories']}");
    $facet_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['clean_urls_custom_facet_urls']}");
    cw_system_messages_add('category_count', cw_get_langvar_by_name('lbl_category') . ' | ' . cw_get_langvar_by_name('lbl_facet_count') . ' - <a href="index.php?target=categories">' . $cat_cnt . '</a> | <a href="index.php?target=custom_facet_urls">' . $facet_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Products counter
    $product_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['products']}");
    cw_system_messages_add('product_count', cw_get_langvar_by_name('lbl_product_count') . ' -
	<a href="index.php?target=products&mode=search&new_search=1">' . $product_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Orders counter
    $order_cnt = cw_query_hash("SELECT status, count(*)  FROM {$tables['docs']} WHERE type='O' GROUP BY status", 'status', false, true);
    $msg = cw_get_langvar_by_name('lbl_order_count') . ' -';
    foreach ($order_cnt as $status => $count) {
        $msg .= ' <a href="index.php?target=docs_O&mode=search&data[status]=' . $status . '" class="order_' . $status . '" title="' . $status . '">&nbsp;' . $count . '&nbsp;</a>';
    }
    cw_system_messages_add('order_count', $msg, constant('SYSTEM_MESSAGE_SYSTEM'));
    // Customers counter
    $customer_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['customers']} WHERE usertype='C'");
    cw_system_messages_add('customer_count', cw_get_langvar_by_name('lbl_customer_count') . ' - 
	<a href="index.php?target=user_C&mode=search&new_search=1">' . $customer_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Mail counter
    $mail_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['mail_spool']} WHERE send=0");
    cw_system_messages_add('mail_count', cw_get_langvar_by_name('lbl_mail_queue') . ' - 
	<a href="index.php?target=mail_queue">' . $mail_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Sess counter
    $sess_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['sessions_data']} WHERE expiry>" . cw_core_get_time());
    cw_system_messages_add('session_count', cw_get_langvar_by_name('lbl_active_sessions') . ' - 
	<a href="index.php?target=sessions">' . $sess_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    cw_event('on_dashboard_system_info');
    // Handlers must add lines via cw_system_messages_add (type = SYSTEM_MESSAGE_SYSTEM)
    /*
     * GET SYSTEM MESSAGES
     */
    $system_messages = cw_system_messages(constant('SYSTEM_MESSAGE_SYSTEM'), true);
    $smarty->assign('system_info', $system_messages);
    $return[$name]['template'] = 'addons/dashboard/admin/sections/system_info.tpl';
    if (empty($system_messages)) {
        unset($return[$name]);
    }
    return $return;
}