示例#1
0
/**
 * Generates statistics page for the given period
 *
 * @param iMSCP_pTemplate $tpl template engine instance
 * @return void
 */
function generatePage($tpl)
{
    if (isset($_GET['month']) && isset($_GET['year'])) {
        $year = intval($_GET['year']);
        $month = intval($_GET['month']);
    } else {
        if (isset($_POST['month']) && isset($_POST['year'])) {
            $year = intval($_POST['year']);
            $month = intval($_POST['month']);
        } else {
            $month = date('m');
            $year = date('y');
        }
    }
    $stmt = exec_query('SELECT traff_time FROM server_traffic ORDER BY traff_time ASC LIMIT 1');
    if ($stmt->rowCount()) {
        $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
        $numberYears = date('y') - date('y', $row['traff_time']);
        $numberYears = $numberYears ? $numberYears + 1 : 1;
    } else {
        $numberYears = 1;
    }
    generateMonthsAndYearsHtmlList($tpl, $month, $year, $numberYears);
    $stmt = exec_query('SELECT bytes_in FROM server_traffic WHERE traff_time BETWEEN ? AND ? LIMIT 1', array(getFirstDayOfMonth($month, $year), getLastDayOfMonth($month, $year)));
    if ($stmt->rowCount()) {
        if ($month == date('m') && $year == date('y')) {
            $curday = date('j');
        } else {
            $curday = date('j', getLastDayOfMonth($month, $year));
        }
        $all = array_fill(0, 8, 0);
        for ($day = 1; $day <= $curday; $day++) {
            $beginDate = mktime(0, 0, 0, $month, $day, $year);
            $endDate = mktime(23, 59, 59, $month, $day, $year);
            list($webIn, $webOut, $smtpIn, $smtpOut, $popIn, $popOut, $otherIn, $otherOut, $allIn, $allOut) = _getServerTraffic($beginDate, $endDate);
            $tpl->assign(array('DAY' => tohtml($day), 'YEAR' => tohtml($year), 'MONTH' => tohtml($month), 'WEB_IN' => tohtml(bytesHuman($webIn)), 'WEB_OUT' => tohtml(bytesHuman($webOut)), 'SMTP_IN' => tohtml(bytesHuman($smtpIn)), 'SMTP_OUT' => tohtml(bytesHuman($smtpOut)), 'POP_IN' => tohtml(bytesHuman($popIn)), 'POP_OUT' => tohtml(bytesHuman($popOut)), 'OTHER_IN' => tohtml(bytesHuman($otherIn)), 'OTHER_OUT' => tohtml(bytesHuman($otherOut)), 'ALL_IN' => tohtml(bytesHuman($allIn)), 'ALL_OUT' => tohtml(bytesHuman($allOut)), 'ALL' => tohtml(bytesHuman($allIn + $allOut)), 'DAY_STATS_QSTRING' => tohtml("year={$year}&month={$month}&day={$day}", 'htmlAttr')));
            $all[0] += $webIn;
            $all[1] += $webOut;
            $all[2] += $smtpIn;
            $all[3] += $smtpOut;
            $all[4] += $popIn;
            $all[5] += $popOut;
            $all[6] += $allIn;
            $all[7] += $allOut;
            $tpl->parse('DAY_SERVER_STATISTICS_BLOCK', '.day_server_statistics_block');
        }
        $allOtherIn = $all[6] - ($all[0] + $all[2] + $all[4]);
        $allOtherOut = $all[7] - ($all[1] + $all[3] + $all[5]);
        $tpl->assign(array('WEB_IN_ALL' => tohtml(bytesHuman($all[0])), 'WEB_OUT_ALL' => tohtml(bytesHuman($all[1])), 'SMTP_IN_ALL' => tohtml(bytesHuman($all[2])), 'SMTP_OUT_ALL' => tohtml(bytesHuman($all[3])), 'POP_IN_ALL' => tohtml(bytesHuman($all[4])), 'POP_OUT_ALL' => tohtml(bytesHuman($all[5])), 'OTHER_IN_ALL' => tohtml(bytesHuman($allOtherIn)), 'OTHER_OUT_ALL' => tohtml(bytesHuman($allOtherOut)), 'ALL_IN_ALL' => tohtml(bytesHuman($all[6])), 'ALL_OUT_ALL' => tohtml(bytesHuman($all[7])), 'ALL_ALL' => tohtml(bytesHuman($all[6] + $all[7]))));
    } else {
        set_page_message(tr('No statistics found for the given period. Try another period.'), 'static_info');
        $tpl->assign('SERVER_STATISTICS_BLOCK', '');
    }
}
示例#2
0
/**
 * Generate statistics for the given period
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @return void
 */
function generatePage($tpl)
{
    $domainId = get_user_domain_id($_SESSION['user_id']);
    if (isset($_POST['month']) && isset($_POST['year'])) {
        $year = intval($_POST['year']);
        $month = intval($_POST['month']);
    } else {
        if (isset($_GET['month']) && isset($_GET['year'])) {
            $month = intval($_GET['month']);
            $year = intval($_GET['year']);
        } else {
            $month = date('m');
            $year = date('Y');
        }
    }
    $stmt = exec_query('SELECT dtraff_time FROM domain_traffic WHERE domain_id = ? ORDER BY dtraff_time ASC LIMIT 1', $domainId);
    if ($stmt->rowCount()) {
        $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
        $numberYears = date('y') - date('y', $row['dtraff_time']);
        $numberYears = $numberYears ? $numberYears + 1 : 1;
    } else {
        $numberYears = 1;
    }
    generateMonthsAndYearsHtmlList($tpl, $month, $year, $numberYears);
    $stmt = exec_query('SELECT domain_id FROM domain_traffic WHERE domain_id = ? AND dtraff_time >= ? AND dtraff_time <= ? LIMIT 1', array($domainId, getFirstDayOfMonth($month, $year), getLastDayOfMonth($month, $year)));
    if ($stmt->rowCount()) {
        $requestedPeriod = getLastDayOfMonth($month, $year);
        $toDay = $requestedPeriod < time() ? date('j', $requestedPeriod) : date('j');
        $all = array_fill(0, 8, 0);
        $dateFormat = iMSCP_Registry::get('config')->DATE_FORMAT;
        for ($fromDay = 1; $fromDay <= $toDay; $fromDay++) {
            $beginTime = mktime(0, 0, 0, $month, $fromDay, $year);
            $endTime = mktime(23, 59, 59, $month, $fromDay, $year);
            list($webTraffic, $ftpTraffic, $smtpTraffic, $popTraffic) = _getUserTraffic($domainId, $beginTime, $endTime);
            $tpl->assign(array('DATE' => tohtml(date($dateFormat, strtotime($year . '-' . $month . '-' . $fromDay))), 'WEB_TRAFF' => tohtml(bytesHuman($webTraffic)), 'FTP_TRAFF' => tohtml(bytesHuman($ftpTraffic)), 'SMTP_TRAFF' => tohtml(bytesHuman($smtpTraffic)), 'POP_TRAFF' => tohtml(bytesHuman($popTraffic)), 'SUM_TRAFF' => tohtml(bytesHuman($webTraffic + $ftpTraffic + $smtpTraffic + $popTraffic))));
            $all[0] += $webTraffic;
            $all[1] += $ftpTraffic;
            $all[2] += $smtpTraffic;
            $all[3] += $popTraffic;
            $tpl->parse('TRAFFIC_TABLE_ITEM', '.traffic_table_item');
        }
        $tpl->assign(array('WEB_ALL' => tohtml(bytesHuman($all[0])), 'FTP_ALL' => tohtml(bytesHuman($all[1])), 'SMTP_ALL' => tohtml(bytesHuman($all[2])), 'POP_ALL' => tohtml(bytesHuman($all[3])), 'SUM_ALL' => tohtml(bytesHuman(array_sum($all)))));
    } else {
        set_page_message(tr('No statistics found for the given period. Try another period.'), 'static_info');
        $tpl->assign('STATISTICS_BLOCK', '');
    }
}
示例#3
0
/**
 * Generates page
 *
 * @param iMSCP_pTemplate $tpl Template instance engine
 * @param int $domainId Domain unique identifier
 * @return void
 */
function admin_generatePage($tpl, $domainId)
{
    $stmt = exec_query('SELECT domain_admin_id FROM domain WHERE domain_id = ?', $domainId);
    if (!$stmt->rowCount()) {
        showBadRequestErrorPage();
    }
    $domainAdminId = $stmt->fields['domain_admin_id'];
    $domainProperties = get_domain_default_props($domainAdminId);
    // Domain IP address info
    $stmt = exec_query("SELECT ip_number FROM server_ips WHERE ip_id = ?", $domainProperties['domain_ip_id']);
    if (!$stmt->rowCount()) {
        $domainIpAddr = tr('Not found.');
    } else {
        $domainIpAddr = $stmt->fields['ip_number'];
    }
    $domainStatus = $domainProperties['domain_status'];
    // Domain status
    if ($domainStatus == 'ok' || $domainStatus == 'disabled' || $domainStatus == 'todelete' || $domainStatus == 'toadd' || $domainStatus == 'torestore' || $domainStatus == 'tochange' || $domainStatus == 'toenable' || $domainStatus == 'todisable') {
        $domainStatus = '<span style="color:green">' . tohtml(translate_dmn_status($domainStatus)) . '</span>';
    } else {
        $domainStatus = '<b><font size="3" color="red">' . $domainStatus . "</font></b>";
    }
    // Get total domain traffic usage in bytes
    $query = "\n\t\tSELECT\n\t\t\tIFNULL(SUM(dtraff_web), 0) AS dtraff_web, IFNULL(SUM(dtraff_ftp), 0) AS dtraff_ftp,\n\t\t\tIFNULL(SUM(dtraff_mail), 0) AS dtraff_mail, IFNULL(SUM(dtraff_pop), 0) AS dtraff_pop\n\t\tFROM\n\t\t\tdomain_traffic\n\t\tWHERE\n\t\t\tdomain_id = ?\n\t\tAND\n\t\t\tdtraff_time BETWEEN ? AND ?\n\t";
    $stmt = exec_query($query, array($domainProperties['domain_id'], getFirstDayOfMonth(), getLastDayOfMonth()));
    if ($stmt->rowCount()) {
        $trafficUsageBytes = $stmt->fields['dtraff_web'] + $stmt->fields['dtraff_ftp'] + $stmt->fields['dtraff_mail'] + $stmt->fields['dtraff_pop'];
    } else {
        $trafficUsageBytes = 0;
    }
    // Get limits in bytes
    $trafficLimitBytes = $domainProperties['domain_traffic_limit'] * 1048576;
    $diskspaceLimitBytes = $domainProperties['domain_disk_limit'] * 1048576;
    // Get usages in percent
    $trafficUsagePercent = make_usage_vals($trafficUsageBytes, $trafficLimitBytes);
    $diskspaceUsagePercent = make_usage_vals($domainProperties['domain_disk_usage'], $diskspaceLimitBytes);
    // Get Email quota info
    list($quota, $quotaLimit) = admin_gen_mail_quota_limit_mgs($domainAdminId);
    # Features
    $tpl->assign(array('DOMAIN_ID' => $domainId, 'VL_DOMAIN_NAME' => tohtml(decode_idna($domainProperties['domain_name'])), 'VL_DOMAIN_IP' => tohtml($domainIpAddr), 'VL_STATUS' => $domainStatus, 'VL_PHP_SUPP' => translate_limit_value($domainProperties['domain_php']), 'VL_PHP_EDITOR_SUPP' => translate_limit_value($domainProperties['phpini_perm_system']), 'VL_CGI_SUPP' => translate_limit_value($domainProperties['domain_cgi']), 'VL_DNS_SUPP' => translate_limit_value($domainProperties['domain_dns']), 'VL_EXT_MAIL_SUPP' => translate_limit_value($domainProperties['domain_external_mail']), 'VL_SOFTWARE_SUPP' => translate_limit_value($domainProperties['domain_software_allowed']), 'VL_BACKUP_SUP' => translate_limit_value($domainProperties['allowbackup']), 'VL_TRAFFIC_PERCENT' => $trafficUsagePercent, 'VL_TRAFFIC_USED' => bytesHuman($trafficUsageBytes), 'VL_TRAFFIC_LIMIT' => bytesHuman($trafficLimitBytes), 'VL_DISK_PERCENT' => $diskspaceUsagePercent, 'VL_DISK_USED' => bytesHuman($domainProperties['domain_disk_usage']), 'VL_DISK_LIMIT' => bytesHuman($diskspaceLimitBytes), 'VL_MAIL_ACCOUNTS_USED' => get_domain_running_mail_acc_cnt($domainId), 'VL_MAIL_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_mailacc_limit']), 'VL_MAIL_QUOTA_USED' => $quota, 'VL_MAIL_QUOTA_LIMIT' => $domainProperties['domain_mailacc_limit'] != '-1' ? $quotaLimit : tr('Disabled'), 'VL_FTP_ACCOUNTS_USED' => get_customer_running_ftp_acc_cnt($domainAdminId), 'VL_FTP_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_ftpacc_limit']), 'VL_SQL_DB_ACCOUNTS_USED' => get_domain_running_sqld_acc_cnt($domainId), 'VL_SQL_DB_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_sqld_limit']), 'VL_SQL_USER_ACCOUNTS_USED' => get_domain_running_sqlu_acc_cnt($domainId), 'VL_SQL_USER_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_sqlu_limit']), 'VL_SUBDOM_ACCOUNTS_USED' => get_domain_running_sub_cnt($domainId), 'VL_SUBDOM_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_subd_limit']), 'VL_DOMALIAS_ACCOUNTS_USED' => get_domain_running_als_cnt($domainId), 'VL_DOMALIAS_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_alias_limit'])));
}
define('DEFAULT_SICK_LEAVE_HRS', 320);
define('DEFAULT_REGULAR_LEAVE_DAYS', 21);
define('DEFAULT_SICK_LEAVE_DAYS', 4);
define('HOURS_IN_DAY', 8);
define('HOURS_IN_WEEK', 40);
define('DEFAULT_WORKING_DAYS', '1,2,3,4,5');
define('DEFAULT_COMPANYID', 1);
define('PAYEID', 2);
define('NSSFID', 3);
define('ADVANCE', 5);
define('TPID', 9);
define('DEFAULT_NSSF_EMP', 5);
define('DEFAULT_NSSF_COM', 10);
define('DEFAULT_LUNCH_DURATION', 1);
define('DEFAULT_APPNAME_CHARS', 12);
define('YEAR_START', getFirstDayOfMonth(1, date('Y')));
define('YEAR_END', getLastDayOfMonth(12, date('Y')));
function companiesRequireApproval()
{
    $config = Zend_Registry::get("config");
    return $config->system->approvalrequired == 'on' || $config->system->approvalrequired == '1' ? true : false;
}
function getDefaultCharsForAppName()
{
    $config = Zend_Registry::get("config");
    return $config->system->appnamechars;
}
function getTrialDays()
{
    $config = Zend_Registry::get("config");
    return $config->system->daysoftrial;
 public function init()
 {
     parent::init();
     $current_timestamp = strtotime('now');
     $now_iso = date('Y-m-d H:i:s', $current_timestamp);
     $this->view->now_iso = $now_iso;
     //debugMessage('now '.$now_iso.'-'.$current_timestamp);
     $onehourago_timestamp = strtotime('-1 hour');
     $onehourago_iso = date('Y-m-d H:i:s', $onehourago_timestamp);
     $this->view->onehourago_iso = $onehourago_iso;
     $this->view->onehourago_timestamp = $onehourago_timestamp;
     // debugMessage('now '.$onehourago_iso.'-'.$onehourago_timestamp);
     $sixhourago_timestamp = strtotime('-6 hour');
     $sixhourago_iso = date('Y-m-d H:i:s', $sixhourago_timestamp);
     $this->view->sixhourago_iso = $sixhourago_iso;
     $this->view->sixhourago_timestamp = $sixhourago_timestamp;
     $twelvehourago_timestamp = strtotime('-12 hour');
     $twelvehourago_iso = date('Y-m-d H:i:s', $twelvehourago_timestamp);
     $this->view->twelvehourago_timestamp = $twelvehourago_timestamp;
     $this->view->twelvehourago_iso = $twelvehourago_iso;
     // debugMessage($logged_today_sql);
     $today_iso = date('Y-m-d');
     $today = changeMySQLDateToPageFormat($today_iso);
     $this->view->today_iso = $today_iso;
     //debugMessage('today '.$today_iso);
     $today_iso_short = date('M j', $current_timestamp);
     $yestday_iso = date('Y-m-d', strtotime('1 day ago'));
     $yestday = changeMySQLDateToPageFormat($yestday_iso);
     $this->view->yestday_iso = $yestday_iso;
     //debugMessage('yesterday '.$yestday_iso);
     $yestday_iso_short = date('M j', strtotime($yestday_iso));
     $weekday = date("N");
     // monday of week
     $mondaythisweek_iso = date('Y-m-d', strtotime('monday this week'));
     $mondaythisweek = changeMySQLDateToPageFormat($mondaythisweek_iso);
     if ($weekday == 1) {
         $mondaythisweek_iso = $today_iso;
         $mondaythisweek = $today;
     }
     if ($weekday == 7) {
         $mondaythisweek_iso = date('Y-m-d', strtotime('monday last week'));
         $mondaythisweek = changeMySQLDateToPageFormat($mondaythisweek_iso);
     }
     $this->view->mondaythisweek_iso = $mondaythisweek_iso;
     //debugMessage('monday this week '.$mondaythisweek_iso);
     // sunday of week
     $sundaythisweek_iso = date('Y-m-d', strtotime('sunday this week'));
     $sundaythisweek = changeMySQLDateToPageFormat($sundaythisweek_iso);
     if ($weekday == 1) {
         $sundaythisweek_iso = date('Y-m-d', strtotime('today + 7 days'));
         $sundaythisweek = changeMySQLDateToPageFormat($sundaythisweek_iso);
     }
     if ($weekday == 7) {
         $sundaythisweek_iso = $today_iso;
         $sundaythisweek = $today;
     }
     $this->view->sundaythisweek_iso = $sundaythisweek_iso;
     // debugMessage('sunday this week '.$sundaythisweek_iso);
     // monday last week
     $mondaylastweek_iso = date('Y-m-d', strtotime('-7 days', strtotime($mondaythisweek_iso)));
     //debugMessage('monday last week '.$mondaylastweek_iso);
     $this->view->mondaylastweek_iso = $mondaylastweek_iso;
     // sunday last week
     $sundaylastweek_iso = date('Y-m-d', strtotime('-7 days', strtotime($sundaythisweek_iso)));
     // debugMessage('sunday last week '.$sundaylastweek_iso);
     $this->view->sundaylastweek_iso = $sundaylastweek_iso;
     // firstday this month
     $firstdayofthismonth_iso = getFirstDayOfCurrentMonth();
     //debugMessage('1st day this month '.$firstdayofthismonth_iso);
     $this->view->firstdayofthismonth_iso = $firstdayofthismonth_iso;
     // lastday this month
     $lastdayofthismonth_iso = getLastDayOfCurrentMonth();
     //debugMessage('last day this month '.$lastdayofthismonth_iso);
     $this->view->lastdayofthismonth_iso = $lastdayofthismonth_iso;
     // firstday last month
     $firstdayoflastmonth_iso = getFirstDayOfMonth(date('m') - 1, date('Y'));
     //debugMessage('1st day last month '.$firstdayoflastmonth_iso);
     $this->view->firstdayoflastmonth_iso = $firstdayoflastmonth_iso;
     // lastday last month
     $lastdayoflastmonth_iso = getLastDayOfMonth(date('m') - 1, date('Y'));
     //debugMessage('last day last month '.$lastdayoflastmonth_iso);
     $this->view->lastdayoflastmonth_iso = $lastdayoflastmonth_iso;
     // firstday 2 month ago
     $firstdayof2monthago_iso = getFirstDayOfMonth(date('m') - 2, date('Y'));
     //debugMessage('1st day 2 month ago '.$firstdayof2monthago_iso);
     $this->view->firstdayof2monthago_iso = $firstdayof2monthago_iso;
     // lastday 2 month ago
     $lastdayof2monthago_iso = getLastDayOfMonth(date('m') - 2, date('Y'));
     //debugMessage('last day last month '.$lastdayof2monthago_iso);
     $this->view->lastdayof2monthago_iso = $lastdayof2monthago_iso;
     // firstday 3 month ago
     $firstdayof3monthago_iso = getFirstDayOfMonth(date('m') - 3, date('Y'));
     //debugMessage('1st day 3 month ago '.$firstdayof3monthago_iso);
     $this->view->firstdayof3monthago_iso = $firstdayof3monthago_iso;
     // lastday 3 month ago
     $lastdayof3monthago_iso = getLastDayOfMonth(date('m') - 3, date('Y'));
     //debugMessage('last day last month '.$lastdayof3monthago_iso);
     $this->view->lastdayof3monthago_iso = $lastdayof3monthago_iso;
     // firstday this year
     $firstdayofyear_iso = getFirstDayOfMonth(1, date('Y'));
     //debugMessage('1st day this year '.$firstdayofyear_iso);
     $this->view->firstdayofyear_iso = $firstdayofyear_iso;
     // lastday this year
     $lastdayofyear_iso = getLastDayOfMonth(12, date('Y'));
     //debugMessage('last day this year '.$lastdayofyear_iso);
     $this->view->lastdayofyear_iso = $lastdayofyear_iso;
     // first day of month one year ago
     $startofmonth_oneyearago = getFirstDayOfMonth(date('m', strtotime('1 year ago')), date('Y', strtotime('1 year ago')));
     $this->view->startofmonth_oneyearago = $startofmonth_oneyearago;
     $firstsystemday_iso = '2013-01-01';
     $this->view->firstsystemday_iso = $firstsystemday_iso;
 }
/**
 * Generate page
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @param int $userId User unique identifier
 * @return void
 */
function generatePage($tpl, $userId)
{
    $stmt = exec_query('
			SELECT
				admin_name, domain_id
			FROM
				admin
			INNER JOIN
				domain ON(domain_admin_id = admin_id)
			WHERE
				admin_id = ?
		', $userId);
    if (!$stmt->rowCount()) {
        showBadRequestErrorPage();
    }
    $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
    $domainId = $row['domain_id'];
    $adminName = decode_idna($row['admin_name']);
    if (isset($_POST['month']) && isset($_POST['year'])) {
        $year = intval($_POST['year']);
        $month = intval($_POST['month']);
    } else {
        $month = date('m');
        $year = date('y');
    }
    $stmt = exec_query('SELECT dtraff_time FROM domain_traffic WHERE domain_id = ? ORDER BY dtraff_time ASC LIMIT 1', $domainId);
    if ($stmt->rowCount()) {
        $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
        $numberYears = date('y') - date('y', $row['dtraff_time']);
        $numberYears = $numberYears ? $numberYears + 1 : 1;
    } else {
        $numberYears = 1;
    }
    generateMonthsAndYearsHtmlList($tpl, $month, $year, $numberYears);
    $stmt = exec_query('SELECT domain_id FROM domain_traffic WHERE domain_id = ? AND dtraff_time BETWEEN ? AND ? LIMIT 1', array($domainId, getFirstDayOfMonth($month, $year), getLastDayOfMonth($month, $year)));
    if ($stmt->rowCount()) {
        $requestedPeriod = getLastDayOfMonth($month, $year);
        $toDay = $requestedPeriod < time() ? date('j', $requestedPeriod) : date('j');
        $all = array_fill(0, 8, 0);
        $dateFormat = iMSCP_Registry::get('config')->DATE_FORMAT;
        for ($fromDay = 1; $fromDay <= $toDay; $fromDay++) {
            $beginTime = mktime(0, 0, 0, $month, $fromDay, $year);
            $endTime = mktime(23, 59, 59, $month, $fromDay, $year);
            list($webTraffic, $ftpTraffic, $smtpTraffic, $popTraffic) = _getUserTraffic($domainId, $beginTime, $endTime);
            $tpl->assign(array('DATE' => date($dateFormat, strtotime($year . '-' . $month . '-' . $fromDay)), 'WEB_TRAFFIC' => tohtml(bytesHuman($webTraffic)), 'FTP_TRAFFIC' => tohtml(bytesHuman($ftpTraffic)), 'SMTP_TRAFFIC' => tohtml(bytesHuman($smtpTraffic)), 'POP3_TRAFFIC' => tohtml(bytesHuman($popTraffic)), 'ALL_TRAFFIC' => tohtml(bytesHuman($webTraffic + $ftpTraffic + $smtpTraffic + $popTraffic))));
            $all[0] += $webTraffic;
            $all[1] += $ftpTraffic;
            $all[2] += $smtpTraffic;
            $all[3] += $popTraffic;
            $tpl->parse('TRAFFIC_TABLE_ITEM', '.traffic_table_item');
        }
        $tpl->assign(array('USER_ID' => tohtml($userId), 'USERNAME' => tohtml($adminName), 'ALL_WEB_TRAFFIC' => tohtml(bytesHuman($all[0])), 'ALL_FTP_TRAFFIC' => tohtml(bytesHuman($all[1])), 'ALL_SMTP_TRAFFIC' => tohtml(bytesHuman($all[2])), 'ALL_POP3_TRAFFIC' => tohtml(bytesHuman($all[3])), 'ALL_ALL_TRAFFIC' => tohtml(bytesHuman(array_sum($all)))));
    } else {
        set_page_message(tr('No statistics found for the given period. Try another period.'), 'static_info');
        $tpl->assign(array('USERNAME' => tohtml($adminName), 'USER_ID' => tohtml($userId), 'RESELLER_USER_STATISTICS_DETAIL_BLOCK' => ''));
    }
}
示例#7
0
 public function setTableDefinition()
 {
     parent::setTableDefinition();
     $this->setTableName('company');
     # override the not null and not blank properties for the createdby column in the BaseEntity
     $this->hasColumn('createdby', 'integer', 11, array('default' => NULL));
     $this->hasColumn('refno', 'string', 15);
     $this->hasColumn('name', 'string', 255, array('notblank' => true));
     $this->hasColumn('appname', 'string', 255);
     $this->hasColumn('headertype', 'integer', null, array('default' => 0));
     $this->hasColumn('slogan', 'string', 255);
     $this->hasColumn('username', 'string', 255);
     $this->hasColumn('abbrv', 'string', 255);
     $this->hasColumn('status', 'integer', null, array('default' => NULL));
     $this->hasColumn('contactperson', 'string', 255);
     $this->hasColumn('email', 'string', 255);
     $this->hasColumn('phone', 'string', 15);
     $this->hasColumn('country', 'string', 2, array('default' => 'UG'));
     $this->hasColumn('addressline1', 'string', 255);
     $this->hasColumn('addressline2', 'string', 255);
     $this->hasColumn('city', 'string', 255);
     $this->hasColumn('postalcode', 'string', 10);
     $this->hasColumn('industrycode', 'string', 15);
     $this->hasColumn('description', 'string', 1000);
     $this->hasColumn('remarks', 'string', 255);
     $this->hasColumn('yearstart', 'date', null, array('default' => getFirstDayOfMonth(1, date('Y'))));
     $this->hasColumn('yearend', 'date', null, array('default' => getLastDayOfMonth(12, date('Y'))));
     $this->hasColumn('ipsubnets', 'string', 255);
     $this->hasColumn('hoursinday', 'string', 50, array('default' => HOURS_IN_DAY));
     $this->hasColumn('openinghour', 'string', 50, array('default' => '08:00 AM'));
     $this->hasColumn('closinghour', 'string', 50, array('default' => '05:00 PM'));
     $this->hasColumn('lunchduration', 'string', 50, array('default' => DEFAULT_LUNCH_DURATION));
     $this->hasColumn('payspaye', 'string', 50, array('default' => 1));
     $this->hasColumn('paysnssf', 'string', 50, array('default' => 1));
     $this->hasColumn('nssfemployeerate', 'string', 50, array('default' => DEFAULT_NSSF_EMP));
     $this->hasColumn('nssfcompanyrate', 'string', 50, array('default' => DEFAULT_NSSF_COM));
     $this->hasColumn('workingdays', 'string', 50);
     $this->hasColumn('maxhoursperday', 'string', 50, array('default' => HOURS_IN_DAY));
     $this->hasColumn('maxhoursperweek', 'string', 50, array('default' => HOURS_IN_WEEK));
     $this->hasColumn('defaultuserid', 'integer', null, array('default' => NULL));
     $this->hasColumn('dateapproved', 'date', null, array('default' => NULL));
     $this->hasColumn('approvedbyid', 'integer', null, array('default' => NULL));
     $this->hasColumn('isinvited', 'integer', null, array('default' => NULL));
     $this->hasColumn('invitedbyid', 'integer', null);
     $this->hasColumn('hasacceptedinvite', 'integer', null, array('default' => 0));
     $this->hasColumn('dateinvited', 'date');
     $this->hasColumn('startdate', 'date', null, array('default' => NULL));
     $this->hasColumn('enddate', 'date', null, array('default' => NULL));
     $this->hasColumn('layout', 'string', 25, array('default' => getDefaultLayout()));
     $this->hasColumn('topbar', 'string', 25, array('default' => getDefaultTopBar()));
     $this->hasColumn('sidebar', 'string', 25, array('default' => getDefaultSideBar()));
     $this->hasColumn('colortheme', 'string', 25, array('default' => getDefaultTheme()));
     $this->hasColumn('showsidebar', 'string', 25, array('default' => getDefaultShowSideBar()));
     $this->hasColumn('logo', 'string', 255);
     $this->hasColumn('defaultadminname', 'string', 255, array('default' => getDefaultAdminName()));
     $this->hasColumn('defaultadminemail', 'string', 255, array('default' => getDefaultAdminEmail()));
     $this->hasColumn('currencysymbol', 'string', 15, array('default' => getCountryCurrencySymbol()));
     $this->hasColumn('currencycode', 'string', 15, array('default' => getCountryCurrencyCode()));
     $this->hasColumn('currencydecimalplaces', 'string', 15, array('default' => getCurrencyDecimalPlaces()));
     $this->hasColumn('numberdecimalplaces', 'string', 15, array('default' => getNumberDecimalPlaces()));
     $this->hasColumn('countryisocode', 'string', 15, array('default' => getCountryCode()));
     $this->hasColumn('phonemaxlength', 'string', 15, array('default' => getMaxPhoneLength()));
     $this->hasColumn('phoneminlength', 'string', 15, array('default' => getMinPhoneLength()));
     $this->hasColumn('nationalidminlength', 'string', 15, array('default' => getNationalIDMaxLength()));
     $this->hasColumn('nationalidmaxlength', 'string', 15, array('default' => getNationalIDMinLength()));
     $this->hasColumn('countryphonecode', 'string', 15, array('default' => getDefaultPhoneCode()));
     $this->hasColumn('timezone', 'string', 255, array('default' => getTimeZine()));
 }
示例#8
0
        $line = fgets($fp, 1024);
        eregi('<B>([0-9]*)</B>', $line, $out);
        $visits = $out[1];
        do {
            $line = fgets($fp, 1024);
            // Finds the KBytes using regular expressions
        } while (!feof($fp) && !eregi('Total KBytes', $line, $out));
        $line = fgets($fp, 1024);
        eregi('<B>([0-9]*)</B>', $line, $out);
        $kbytes = $out[1];
        do {
            $line = fgets($fp, 1024);
            // Finds the Sites using regular expressions
        } while (!feof($fp) && !eregi('Unique Sites', $line, $out));
        $line = fgets($fp, 1024);
        eregi('<B>([0-9]*)</B>', $line, $out);
        $sites = $out[1];
        fclose($fp);
    }
    echo "{$monthn} {$year} {$hits} {$files} {$sites} {$kbytes} " . getFirstDayOfMonth($yearmonth, $year) . ' ' . getLastDayOfMonth($yearmonth, $year) . " {$pages} {$visits}\n";
    //echo "$monthn $year\n";
    $yearmonth--;
    if ($yearmonth == 0) {
        $yearmonth = 12;
        $year--;
    }
    // Year goes backwards until 2000
    if ($year == 2000) {
        break;
    }
}
function showMonth($month, $year, $unterkunft_id, $zimmer_id, $link, $saAktiviert, $sprache)
{
    //anzahl der tage des monats:
    $anzahlTage = getNumberOfDays($month, $year);
    $firstDay = getFirstDayOfMonth($month, $year);
    $MO = getUebersetzung("MO", $sprache, $link);
    $DI = getUebersetzung("DI", $sprache, $link);
    $MI = getUebersetzung("MI", $sprache, $link);
    $DO = getUebersetzung("DO", $sprache, $link);
    $FR = getUebersetzung("FR", $sprache, $link);
    $SA = getUebersetzung("SA", $sprache, $link);
    $SO = getUebersetzung("SO", $sprache, $link);
    //erste tag im monat ist ein montag:
    if ($firstDay == "Mon") {
        ?>
<table width="100%" border="0" class="tableColor">
        <tr> 
          <td colspan="7" class="standardSchriftBold"><?php 
        echo getUebersetzung(parseMonthName($month), $sprache, $link) . " " . $year;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor"><?php 
        echo $MO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $MI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $FR;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SA;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SO;
        ?>
</td>
        </tr>
        <tr> 
		<?php 
        for ($i = 1; $i <= 7; $i++) {
            ?>
          <td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		<?php 
        }
        ?>
          
        </tr>
        <tr> 
        <?php 
        for ($i = 8; $i <= 14; $i++) {
            ?>
          <td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		<?php 
        }
        ?>
 
        </tr>
        <tr> 
        <?php 
        for ($i = 15; $i <= 21; $i++) {
            ?>
          <td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		<?php 
        }
        ?>
 
        </tr>
        <tr> 
        <?php 
        for ($i = 22; $i <= 28; $i++) {
            ?>
          <td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		<?php 
        }
        ?>
 
        </tr>
        <tr>
          <td class="<?php 
        if ($anzahlTage >= 29) {
            echo getStatusString($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 29) {
            printRes($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 30) {
            echo getStatusString($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 30) {
            printRes($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 31) {
            echo getStatusString($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 31) {
            printRes($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
		<tr>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
      </table><?php 
    } elseif ($firstDay == "Tue") {
        ?>
<table width="100%" border="0" class="tableColor">
        <tr> 
          <td colspan="7" class="standardSchriftBold"><?php 
        echo getUebersetzung(parseMonthName($month), $sprache, $link) . " " . $year;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor"><?php 
        echo $MO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $MI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $FR;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SA;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SO;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor">&nbsp;</td>
          <?php 
        for ($i = 1; $i <= 6; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 7; $i <= 13; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 14; $i <= 20; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 21; $i <= 27; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr>
          <td class="<?php 
        echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
        ?>
"><?php 
        printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 29) {
            echo getStatusString($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 29) {
            printRes($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 30) {
            echo getStatusString($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 30) {
            printRes($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 31) {
            echo getStatusString($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 31) {
            printRes($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
		<tr>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
      </table><?php 
    } elseif ($firstDay == "Wed") {
        ?>
<table width="100%" border="0" class="tableColor">
        <tr> 
          <td colspan="7" class="standardSchriftBold"><?php 
        echo getUebersetzung(parseMonthName($month), $sprache, $link) . " " . $year;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor"><?php 
        echo $MO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $MI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $FR;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SA;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SO;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <?php 
        for ($i = 1; $i <= 5; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 6; $i <= 12; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 13; $i <= 19; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 20; $i <= 26; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr>
          <?php 
        for ($i = 27; $i <= 28; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
          
          <td class="<?php 
        if ($anzahlTage >= 29) {
            echo getStatusString($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 29) {
            printRes($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 30) {
            echo getStatusString($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 30) {
            printRes($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 31) {
            echo getStatusString($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 31) {
            printRes($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
		<tr>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
      </table><?php 
    } elseif ($firstDay == "Thu") {
        ?>
<table width="100%" border="0" class="tableColor">
        <tr> 
          <td colspan="7" class="standardSchriftBold"><?php 
        echo getUebersetzung(parseMonthName($month), $sprache, $link) . " " . $year;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor"><?php 
        echo $MO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $MI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $FR;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SA;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SO;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
          <?php 
        for ($i = 1; $i <= 4; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 5; $i <= 11; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 12; $i <= 18; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 19; $i <= 25; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr>
          <?php 
        for ($i = 26; $i <= 28; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
          
          <td class="<?php 
        if ($anzahlTage >= 29) {
            echo getStatusString($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 29) {
            printRes($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 30) {
            echo getStatusString($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 30) {
            printRes($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 31) {
            echo getStatusString($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 31) {
            printRes($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="tableColor">&nbsp;</td>          
        </tr>
		<tr>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
      </table><?php 
    } elseif ($firstDay == "Fri") {
        ?>
<table width="100%" border="0" class="tableColor">
        <tr> 
          <td colspan="7" class="standardSchriftBold"><?php 
        echo getUebersetzung(parseMonthName($month), $sprache, $link) . " " . $year;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor"><?php 
        echo $MO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $MI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $FR;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SA;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SO;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
          <?php 
        for ($i = 1; $i <= 3; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 4; $i <= 10; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 11; $i <= 17; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 18; $i <= 24; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr>
          <?php 
        for ($i = 25; $i <= 28; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
          
          <td class="<?php 
        if ($anzahlTage >= 29) {
            echo getStatusString($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 29) {
            printRes($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 30) {
            echo getStatusString($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 30) {
            printRes($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 31) {
            echo getStatusString($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 31) {
            printRes($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
         </tr>
		 <tr>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
      </table><?php 
    } elseif ($firstDay == "Sat") {
        ?>
<table width="100%" border="0" class="tableColor">
        <tr> 
          <td colspan="7" class="standardSchriftBold"><?php 
        echo getUebersetzung(parseMonthName($month), $sprache, $link) . " " . $year;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor"><?php 
        echo $MO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $MI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $FR;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SA;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SO;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
          <?php 
        for ($i = 1; $i <= 2; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 3; $i <= 9; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 10; $i <= 16; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 17; $i <= 23; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr>
          <?php 
        for ($i = 24; $i <= 28; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
          
          <td class="<?php 
        if ($anzahlTage >= 29) {
            echo getStatusString($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 29) {
            printRes($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 30) {
            echo getStatusString($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 30) {
            printRes($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
         </tr>
		 <tr>
          <td class="<?php 
        if ($anzahlTage >= 31) {
            echo getStatusString($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 31) {
            printRes($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
        </tr>
      </table><?php 
    } elseif ($firstDay == "Sun") {
        ?>
<table width="100%" border="0" class="tableColor">
        <tr> 
          <td colspan="7" class="standardSchriftBold"><?php 
        echo getUebersetzung(parseMonthName($month), $sprache, $link) . " " . $year;
        ?>
</td>
        </tr>
       <tr> 
          <td class="tableColor"><?php 
        echo $MO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $MI;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $DO;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $FR;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SA;
        ?>
</td>
          <td class="tableColor"><?php 
        echo $SO;
        ?>
</td>
        </tr>
        <tr> 
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>
		  <td class="tableColor">&nbsp;</td>          
          <td class="<?php 
        echo getStatusString($zimmer_id, 1, $month, $year, $saAktiviert, $link);
        ?>
"><?php 
        printRes($zimmer_id, 1, $month, $year, $saAktiviert, $link);
        ?>
</td>
        </tr>
        <tr> 
          <?php 
        for ($i = 2; $i <= 8; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 9; $i <= 15; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr> 
          <?php 
        for ($i = 16; $i <= 22; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
        </tr>
        <tr>
          <?php 
        for ($i = 23; $i <= 28; $i++) {
            ?>
          	<td class="<?php 
            echo getStatusString($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
"><?php 
            printRes($zimmer_id, $i, $month, $year, $saAktiviert, $link);
            ?>
</td>
		  <?php 
        }
        ?>
          
          <td class="<?php 
        if ($anzahlTage >= 29) {
            echo getStatusString($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 29) {
            printRes($zimmer_id, 29, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
         </tr>
		 <tr>
		  <td class="<?php 
        if ($anzahlTage >= 30) {
            echo getStatusString($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 30) {
            printRes($zimmer_id, 30, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
          <td class="<?php 
        if ($anzahlTage >= 31) {
            echo getStatusString($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "tableColor";
        }
        ?>
"><?php 
        if ($anzahlTage >= 31) {
            printRes($zimmer_id, 31, $month, $year, $saAktiviert, $link);
        } else {
            echo "&nbsp;";
        }
        ?>
</td>
		  <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
          <td class="tableColor">&nbsp;</td>
		 </tr>
		</table><?php 
    }
    //ende if sonntag
}
示例#10
0
/**
 * Generates server traffic bar
 *
 * @param  iMSCP_pTemplate $tpl iMSCP_pTemplate instance
 * @return void
 */
function admin_generateServerTrafficInfo($tpl)
{
    $cfg = iMSCP_Registry::get('config');
    $trafficLimitBytes = intval($cfg['SERVER_TRAFFIC_LIMIT']) * 1048576;
    $trafficWarningBytes = intval($cfg['SERVER_TRAFFIC_WARN']) * 1048576;
    if (!$trafficWarningBytes) {
        $trafficWarningBytes = $trafficLimitBytes;
    }
    // Get server traffic usage value in bytes for the current month
    $stmt = exec_query('
            SELECT IFNULL((SUM(bytes_in) + SUM(bytes_out)), 0) AS serverTrafficUsage FROM server_traffic
            WHERE  traff_time BETWEEN ? AND ?
        ', array(getFirstDayOfMonth(), getLastDayOfMonth()));
    if ($stmt->rowCount()) {
        $row = $stmt->fetchRow();
        $trafficUsageBytes = $row['serverTrafficUsage'];
    } else {
        $trafficUsageBytes = 0;
    }
    // Get traffic usage in percent
    $trafficUsagePercent = make_usage_vals($trafficUsageBytes, $trafficLimitBytes);
    if ($trafficLimitBytes) {
        $trafficMessage = tr('%1$s%% [%2$s of %3$s]', $trafficUsagePercent, bytesHuman($trafficUsageBytes), bytesHuman($trafficLimitBytes));
    } else {
        $trafficMessage = tr('%1$s%% [%2$s of unlimited]', $trafficUsagePercent, bytesHuman($trafficUsageBytes));
    }
    // Warning message about traffic
    if ($trafficUsageBytes && ($trafficWarningBytes && $trafficUsageBytes > $trafficWarningBytes || $trafficLimitBytes && $trafficUsageBytes > $trafficLimitBytes)) {
        set_page_message(tr('You are exceeding the monthly server traffic limit.'), 'static_warning');
    }
    $tpl->assign(array('TRAFFIC_WARNING' => $trafficMessage, 'TRAFFIC_PERCENT' => $trafficUsagePercent));
}
示例#11
0
文件: index.php 项目: richtastic/ff
 $endDate = null;
 $message = "";
 if ($calType == $ACTION_TYPE_CALENDAR_DAY) {
     $startDate = standardSQLDateFromSeconds(getDayStartFromSeconds($calTime));
     $endDate = standardSQLDateFromSeconds(getDayEndFromSeconds($calTime));
     $message = "day";
 } else {
     if ($calType == $ACTION_TYPE_CALENDAR_WEEK) {
         $firstDayOfWeek = getFirstMondayOfWeek($calTime);
         $lastDayOfWeek = getLastSundayOfWeek($calTime);
         $startDate = standardSQLDateFromSeconds(getDayStartFromSeconds($firstDayOfWeek));
         $endDate = standardSQLDateFromSeconds(getDayEndFromSeconds($lastDayOfWeek));
         $message = "week";
     } else {
         if ($calType == $ACTION_TYPE_CALENDAR_MONTH) {
             $firstDayOfMonth = getFirstDayOfMonth($calTime);
             $lastDayOfMonth = getLastDayOfMonth($calTime);
             $startDate = standardSQLDateFromSeconds(getDayStartFromSeconds($firstDayOfMonth));
             $endDate = standardSQLDateFromSeconds(getDayEndFromSeconds($lastDayOfMonth));
             $message = "month";
         } else {
             echo '{ "status":"error", "message":"invalid type" }';
             return;
         }
     }
 }
 if ($calOption == $ACTION_TYPE_CALENDAR_OPTION_SELF && $ACTION_VALUE_USER_ID > 0) {
     $calOption = ' and shifts.user_id="' . $ACTION_VALUE_USER_ID . '" ';
 } else {
     $calOption = '';
 }