Пример #1
0
function gen_disk_usage(&$tpl, $usage, $max_usage, $bars_max)
{
    if (0 !== $max_usage) {
        list($percent, $bars) = calc_bars($usage, $max_usage, $bars_max);
        $max_usage = sizeit($max_usage);
    } else {
        $percent = 0;
        $bars = 0;
        $max_usage = tr('unlimited');
    }
    $traffic_usage_data = sprintf("%s%% [%s " . tr('of') . " %s]", $percent, sizeit($usage), $max_usage);
    $tpl->assign(array('DISK_USAGE_DATA' => $traffic_usage_data, 'DISK_BARS' => $bars));
}
Пример #2
0
function gen_disk_usage(&$tpl, $usage, $max_usage, $bars_max)
{
    list($percent, $bars) = calc_bars($usage, $max_usage, $bars_max);
    if ($max_usage != 0) {
        $traffic_usage_data = sprintf("%s%% [%s " . tr('of') . " %s]", $percent, sizeit($usage), sizeit($max_usage));
    } else {
        $traffic_usage_data = sprintf("%s%% [%s " . tr('of') . " %s]", $percent, sizeit($usage), tr('unlimited'));
    }
    $tpl->assign(array('DISK_USAGE_DATA' => $traffic_usage_data, 'DISK_BARS' => $bars));
    if ($max_usage != 0 && $usage > $max_usage) {
        $tpl->assign('TR_DISK_WARNING', tr('You are exceeding your disk limit!'));
    } else {
        $tpl->assign('DISK_WARN', '');
    }
}
Пример #3
0
/**
 * @param EasySCP_TemplateEngine $tpl
 * @param float $usage
 * @param float $max_usage
 * @param float $bars_max
 */
function gen_disk_usage($tpl, $usage, $max_usage, $bars_max)
{
    if (0 !== $max_usage) {
        list($percent, $bars) = calc_bars($usage, $max_usage, $bars_max);
        $traffic_usage_data = tr('%1$s%% [%2$s of %3$s]', $percent, sizeit($usage), sizeit($max_usage));
    } else {
        $percent = 0;
        $bars = 0;
        $traffic_usage_data = tr('%1$s%% [%2$s of unlimited]', $percent, sizeit($usage));
    }
    $tpl->assign(array('DISK_USAGE_DATA' => $traffic_usage_data, 'DISK_BARS' => $bars, 'DISK_PERCENT' => $percent));
}
Пример #4
0
/**
 * @param EasySCP_TemplateEngine $tpl
 * @param float $usage
 * @param float $max_usage
 * @param float $bars_max
 */
function gen_disk_usage($tpl, $usage, $max_usage, $bars_max)
{
    list($percent, $bars) = calc_bars($usage, $max_usage, $bars_max);
    if ($max_usage != 0) {
        $traffic_usage_data = tr('%1$s%% [%2$s of %3$s]', $percent, sizeit($usage), sizeit($max_usage));
    } else {
        $traffic_usage_data = tr('%1$s%% [%2$s of unlimited]', $percent, sizeit($usage));
    }
    $tpl->assign(array('DISK_USAGE_DATA' => $traffic_usage_data, 'DISK_BARS' => $bars, 'DISK_PERCENT' => $percent));
    if ($max_usage != 0 && $usage > $max_usage) {
        $tpl->assign('TR_DISK_WARNING', tr('You are exceeding your disk limit!'));
    } else {
        $tpl->assign('DISK_WARN', '');
    }
}
Пример #5
0
/**
 * Generates disk usage bar.
 *
 * @param iMSCP_pTemplate $tpl Template engine
 * @param $usage
 * @param $maxUsage
 * @param $barMax
 * @return void
 */
function client_generateDiskUsageBar($tpl, $usage, $maxUsage, $barMax)
{
    list($percent, $bars) = calc_bars($usage, $maxUsage, $barMax);
    if ($maxUsage != 0) {
        $traffic_usage_data = tr('%1$s%% [%2$s of %3$s]', $percent, bytesHuman($usage), bytesHuman($maxUsage));
    } else {
        $traffic_usage_data = tr('%1$s%% [%2$s of unlimited]', $percent, bytesHuman($usage));
    }
    $tpl->assign(array('DISK_USAGE_DATA' => $traffic_usage_data, 'DISK_BARS' => $bars, 'DISK_PERCENT' => $percent > 100 ? 100 : $percent));
    if ($maxUsage != 0 && $usage > $maxUsage) {
        $tpl->assign('TR_DISK_WARNING', tr('You are exceeding your disk space limit.'));
    } else {
        $tpl->assign('DISK_WARNING', '');
    }
}