public static function addOmsConfUsageClientAreaPage($vars) { global $product_core_name, $product_disk_name, $product_memory_name, $oms_usage_db, $whmcs_admin_user, $whmcs_admin_password, $whmcs_api_url; $clientId = $_SESSION['uid']; if (is_numeric($clientId)) { $whmcsDbService = new \Opennode\Whmcs\Service\WhmcsDbService(); $whmcsExternalService = new \Opennode\Whmcs\Service\WhmcsExternalService($whmcs_admin_user, $whmcs_admin_password, $whmcs_api_url, $oms_usage_db); $omsReduction = new \Opennode\Whmcs\Service\OmsReductionService($product_core_name, $product_disk_name, $product_memory_name, $oms_usage_db, $whmcsExternalService, $whmcsDbService); $startDate = date_sub(date_create(), date_interval_create_from_date_string("1 months")); $endDate = date_create(); $confChanges = $omsReduction->findClientConfChanges($clientId, $startDate, $endDate); $parsedChanges = $omsReduction->parseClientConfChanges($confChanges, $clientId); return array("omsconfs" => $parsedChanges); } }
<?php require "init.php"; require_once dirname(__FILE__) . '/includes/hooks/inc/oms_config.php'; require_once __DIR__ . '/Classes/Autoloader.php'; $ca = new WHMCS_ClientArea(); $ca->setPageTitle("Resource consumption summary"); $ca->addToBreadCrumb('index.php', $whmcs->get_lang('globalsystemname')); $ca->addToBreadCrumb('oms_usage.php', 'OMS usage'); $ca->initPage(); //get parameters $user_id = mysql_real_escape_string($_GET['user_id']); $clientId = $_SESSION['uid']; global $product_core_name, $product_disk_name, $product_memory_name, $oms_usage_db, $whmcs_admin_user, $whmcs_admin_password, $whmcs_api_url, $oms_usage_db; $whmcsDbService = new \Opennode\Whmcs\Service\WhmcsDbService(); $whmcsExternalService = new \Opennode\Whmcs\Service\WhmcsExternalService($whmcs_admin_user, $whmcs_admin_password, $whmcs_api_url, $oms_usage_db); $omsReduction = new \Opennode\Whmcs\Service\OmsReductionService($product_core_name, $product_disk_name, $product_memory_name, $oms_usage_db, $whmcsExternalService, $whmcsDbService); $confChanges = $omsReduction->findClientConfChanges($clientId, null, null); $parsedChanges = $omsReduction->parseClientConfChanges($confChanges, $clientId); $ca->assign('omsconfs', $parsedChanges); $ca->setTemplate('omsclientusage'); $ca->output();