/** * Shows user signups by year with funny bars * * @global object $ubillingConfig * @param int $year * * @return void */ function web_SignupsGraphYear($year) { global $ubillingConfig; $altCfg = $ubillingConfig->getAlter(); $cemeteryEnabled = @$altCfg['CEMETERY_ENABLED'] ? true : false; if ($cemeteryEnabled) { $cemetery = new Cemetery(); } $year = vf($year); $yearcount = zb_SignupsGetCountYear($year); $maxsignups = max($yearcount); $allmonths = months_array(); $totalcount = 0; $tablecells = wf_TableCell(''); $tablecells .= wf_TableCell(__('Month')); $tablecells .= wf_TableCell(__('Signups')); if ($cemeteryEnabled) { $tablecells .= wf_TableCell(__('Dead souls')); $tablecells .= wf_TableCell('', '10%'); } $tablecells .= wf_TableCell(__('Visual'), '50%'); $tablerows = wf_TableRow($tablecells, 'row1'); foreach ($yearcount as $eachmonth => $count) { $totalcount = $totalcount + $count; $tablecells = wf_TableCell($eachmonth); $tablecells .= wf_TableCell(wf_Link('?module=report_signup&month=' . $year . '-' . $eachmonth, rcms_date_localise($allmonths[$eachmonth]))); $tablecells .= wf_TableCell($count); if ($cemeteryEnabled) { $deadDateMask = $year . '-' . $eachmonth . '-'; $deadCount = $cemetery->getDeadDateCount($deadDateMask); $deadBar = web_barTariffs($count, $deadCount); $tablecells .= wf_TableCell($deadCount); $tablecells .= wf_TableCell($deadBar); } $tablecells .= wf_TableCell(web_bar($count, $maxsignups), '', '', 'sorttable_customkey="' . $count . '"'); $tablerows .= wf_TableRow($tablecells, 'row3'); } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); $result .= wf_tag('b', false) . __('Total') . ': ' . $totalcount . wf_tag('b', true); show_window(__('User signups by year') . ' ' . $year, $result); }
/** * renders tariffs popularity report * * @return void */ public function reportTariffs() { $tariffArr = array(); $tariffUsers = array(); $tariffCounter = array(); $userTotalCount = sizeof($this->users); $result = ''; if (!empty($this->tariffs)) { foreach ($this->tariffs as $io => $each) { $tariffArr[$each['id']] = $each['tariffname']; $tariffCounter[$each['id']]['all'] = 0; $tariffCounter[$each['id']]['alive'] = 0; } } if (!empty($tariffArr) and !empty($this->users)) { foreach ($this->users as $io => $eachUser) { if (!empty($eachUser['tariffid'])) { $tariffUsers[$eachUser['tariffid']][] = $eachUser; $tariffCounter[$eachUser['tariffid']]['all'] = $tariffCounter[$eachUser['tariffid']]['all'] + 1; if ($eachUser['active']) { $tariffCounter[$eachUser['tariffid']]['alive'] = $tariffCounter[$eachUser['tariffid']]['alive'] + 1; } } } } //tariff summary grid $cells = wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Total')); $cells .= wf_TableCell(__('Visual')); $cells .= wf_TableCell(__('Active')); $rows = wf_TableRow($cells, 'row1'); foreach ($tariffArr as $tariffId => $tariffName) { $tariffLink = wf_Link(self::URL_REPORTS_MGMT . 'reportTariffs&showtariffusers=' . $tariffId, $tariffName); $cells = wf_TableCell($tariffLink); $cells .= wf_TableCell($tariffCounter[$tariffId]['all']); $cells .= wf_TableCell(web_bar($tariffCounter[$tariffId]['all'], $userTotalCount)); $cells .= wf_TableCell(web_barTariffs($tariffCounter[$tariffId]['alive'], $tariffCounter[$tariffId]['all'] - $tariffCounter[$tariffId]['alive'])); $rows .= wf_TableRow($cells, 'row3'); } $result .= wf_TableBody($rows, '100%', '0', 'sortable'); //show per tariff users if (wf_CheckGet(array('showtariffusers'))) { $tariffSearch = vf($_GET['showtariffusers'], 3); if (isset($tariffUsers[$tariffSearch])) { if (!empty($tariffUsers[$tariffSearch])) { $result .= wf_delimiter(); $result .= wf_tag('h2') . __('Tariff') . ': ' . $tariffArr[$tariffSearch] . wf_tag('h2', true); $cells = wf_TableCell(__('Contract'), '10%'); $cells .= wf_TableCell(__('Full address'), '31%'); $cells .= wf_TableCell(__('Real Name'), '30%'); $cells .= wf_TableCell(__('Tariff'), '15%'); $cells .= wf_TableCell(__('Cash'), '7%'); $cells .= wf_TableCell(__('Status'), '7%'); $rows = wf_TableRow($cells, 'row1'); foreach ($tariffUsers[$_GET['showtariffusers']] as $io => $eachUser) { $cells = wf_TableCell($eachUser['contract']); $fullAddress = $this->userGetFullAddress($eachUser['id']); $profileLink = wf_Link(self::URL_USERS_PROFILE . $eachUser['id'], web_profile_icon() . ' ', false, ''); $cells .= wf_TableCell($profileLink . $fullAddress); $cells .= wf_TableCell($eachUser['realname']); $cells .= wf_TableCell($this->tariffs[$eachUser['tariffid']]['tariffname']); $cells .= wf_TableCell($eachUser['cash']); $cells .= wf_TableCell(web_bool_led($eachUser['active'], true)); $rows .= wf_TableRow($cells, 'row3'); } $result .= wf_TableBody($rows, '100%', '0', 'sortable'); } } $printableControl = wf_Link(self::URL_REPORTS_MGMT . 'reportTariffs&showtariffusers=' . $tariffSearch . '&printable=true', wf_img('skins/icon_print.png', __('Print'))); } else { $printableControl = wf_Link(self::URL_REPORTS_MGMT . 'reportTariffs&printable=true', wf_img('skins/icon_print.png', __('Print'))); } if (!wf_CheckGet(array('printable'))) { show_window(__('Tariffs report') . ' ' . $printableControl, $result); } else { $this->reportPrintable(__('Tariffs report'), $result); } }
/** * Returns tariffs popularity report * * @return string */ function web_TariffShowReport() { global $ubillingConfig; $altCfg = $ubillingConfig->getAlter(); $fullFlag = false; $tariffcount = zb_TariffGetLiveCount(); $allTariffData = zb_TariffGetAllData(); if (isset($altCfg['TARIFF_REPORT_FULL'])) { if ($altCfg['TARIFF_REPORT_FULL']) { $fullFlag = true; } } if ($fullFlag) { $dbSchema = zb_CheckDbSchema(); $tariffSpeeds = zb_TariffGetAllSpeeds(); } $maxArr = array(); $totalusers = 0; $liveusersCounter = 0; $deadusersCounter = 0; $cells = wf_TableCell(__('Tariff')); if ($fullFlag) { $cells .= wf_TableCell(__('Fee')); if ($dbSchema > 0) { $cells .= wf_TableCell(__('Period')); } $cells .= wf_TableCell(__('Speed')); } $cells .= wf_TableCell(__('Total')); $cells .= wf_TableCell(__('Visual')); $cells .= wf_TableCell(__('Active')); $rows = wf_TableRow($cells, 'row1'); if (!empty($tariffcount)) { $maxusers = 0; foreach ($tariffcount as $io => $eachtcount) { $maxArr[$io] = $eachtcount['alive'] + $eachtcount['dead']; } $maxusers = max($maxArr); foreach ($tariffcount as $eachtariffname => $eachtariffcount) { $totalusers = $totalusers + $eachtariffcount['alive'] + $eachtariffcount['dead']; $deadusersCounter = $deadusersCounter + $eachtariffcount['dead']; $liveusersCounter = $liveusersCounter + $eachtariffcount['alive']; $tarif_data = $allTariffData[$eachtariffname]; $cells = wf_TableCell($eachtariffname); if ($fullFlag) { $cells .= wf_TableCell($tarif_data['Fee']); if ($dbSchema > 0) { $cells .= wf_TableCell(__($tarif_data['period'])); } if (isset($tariffSpeeds[$eachtariffname])) { $speedData = $tariffSpeeds[$eachtariffname]['speeddown'] . ' / ' . $tariffSpeeds[$eachtariffname]['speedup']; } else { $speedData = wf_tag('font', false, '', 'color="#bc0000"') . __('Speed is not set') . wf_tag('font', true); } $cells .= wf_TableCell($speedData); } $cells .= wf_TableCell($eachtariffcount['alive'] + $eachtariffcount['dead']); $cells .= wf_TableCell(web_bar($eachtariffcount['alive'], $maxusers), '', '', 'sorttable_customkey="' . $eachtariffcount['alive'] . '"'); $cells .= wf_TableCell(web_barTariffs($eachtariffcount['alive'], $eachtariffcount['dead']), '', '', 'sorttable_customkey="' . $eachtariffcount['alive'] . '"'); $rows .= wf_TableRow($cells, 'row5'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= wf_tag('h2') . __('Total') . ': ' . $totalusers . wf_tag('h2', true); $result .= __('Active users') . ': ' . $liveusersCounter; $result .= wf_tag('br'); $result .= __('Inactive users') . ': ' . $deadusersCounter; return $result; }
/** * Returns tariffs popularity report * * @return string */ function web_TariffShowReport() { $tariffcount = zb_TariffGetLiveCount(); $maxArr = array(); $totalusers = 0; $liveusersCounter = 0; $deadusersCounter = 0; $cells = wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Total')); $cells .= wf_TableCell(__('Visual')); $cells .= wf_TableCell(__('Active')); $rows = wf_TableRow($cells, 'row1'); if (!empty($tariffcount)) { $maxusers = 0; foreach ($tariffcount as $io => $eachtcount) { $maxArr[$io] = $eachtcount['alive'] + $eachtcount['dead']; } $maxusers = max($maxArr); foreach ($tariffcount as $eachtariffname => $eachtariffcount) { $totalusers = $totalusers + $eachtariffcount['alive'] + $eachtariffcount['dead']; $deadusersCounter = $deadusersCounter + $eachtariffcount['dead']; $liveusersCounter = $liveusersCounter + $eachtariffcount['alive']; $cells = wf_TableCell($eachtariffname); $cells .= wf_TableCell($eachtariffcount['alive'] + $eachtariffcount['dead']); $cells .= wf_TableCell(web_bar($eachtariffcount['alive'], $maxusers), '', '', 'sorttable_customkey="' . $eachtariffcount['alive'] . '"'); $cells .= wf_TableCell(web_barTariffs($eachtariffcount['alive'], $eachtariffcount['dead']), '', '', 'sorttable_customkey="' . $eachtariffcount['alive'] . '"'); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= wf_tag('h2') . __('Total') . ': ' . $totalusers . wf_tag('h2', true); $result .= __('Active users') . ': ' . $liveusersCounter; $result .= wf_tag('br'); $result .= __('Inactive users') . ': ' . $deadusersCounter; return $result; }