function web_TstatsShow() { $allclasses = zb_DirectionsGetAll(); $classtraff = array(); $traffCells = wf_TableCell(__('Traffic classes'), '20%'); $traffCells .= wf_TableCell(__('Traffic'), '20%'); $traffCells .= wf_TableCell(__('Traffic classes')); $traffRows = wf_TableRow($traffCells, 'row1'); if (!empty($allclasses)) { foreach ($allclasses as $eachclass) { $d_name = 'D' . $eachclass['rulenumber']; $u_name = 'U' . $eachclass['rulenumber']; $query_d = "SELECT SUM(`" . $d_name . "`) FROM `users`"; $query_u = "SELECT SUM(`" . $u_name . "`) FROM `users`"; $classdown = simple_query($query_d); $classdown = $classdown['SUM(`' . $d_name . '`)']; $classup = simple_query($query_u); $classup = $classup['SUM(`' . $u_name . '`)']; $classtraff[$eachclass['rulename']] = $classdown + $classup; } if (!empty($classtraff)) { $total = max($classtraff); foreach ($classtraff as $name => $count) { $traffCells = wf_TableCell($name); $traffCells .= wf_TableCell(stg_convert_size($count), '', '', 'sorttable_customkey="' . $count . '"'); $traffCells .= wf_TableCell(web_bar($count, $total), '', '', 'sorttable_customkey="' . $count . '"'); $traffRows .= wf_TableRow($traffCells, 'row3'); } } } $result = wf_TableBody($traffRows, '100%', 0, 'sortable'); show_window(__('Traffic report'), $result); }
function ts_EmployeeMonthGraphs() { $curmonth = curmonth(); $employees = ts_GetAllEmployee(); $month_jobs_q = "SELECT `workerid`,`jobid` from `jobs` WHERE `date` LIKE '" . $curmonth . "%'"; $alljobs = simple_queryall($month_jobs_q); $jobtypes = ts_GetAllJobtypes(); $jobdata = array(); $result = ''; if (!empty($employees)) { if (!empty($alljobs)) { foreach ($alljobs as $io => $eachjob) { if (isset($jobdata[$eachjob['workerid']][$eachjob['jobid']])) { $jobdata[$eachjob['workerid']][$eachjob['jobid']]++; } else { $jobdata[$eachjob['workerid']][$eachjob['jobid']] = 1; } } } //build graphs for each employee if (!empty($jobdata)) { foreach ($jobdata as $employee => $each) { $employeeName = isset($employees[$employee]) ? $employees[$employee] : __('Deleted'); $result .= wf_tag('h3', false) . $employeeName . wf_tag('h3', true); $rows = ''; if (!empty($each)) { foreach ($each as $jobid => $count) { $cells = wf_TableCell(@$jobtypes[$jobid], '40%'); $cells .= wf_TableCell($count, '20%'); $cells .= wf_TableCell(web_bar($count, sizeof($alljobs)), '40%'); $rows .= wf_TableRow($cells, 'row3'); } } $result .= wf_TableBody($rows, '100%', 0); $result .= wf_delimiter(); } } } return $result; }
/** * renders users signup report * * @return void */ public function reportSignup() { $regdates = array(); $months = months_array(); $monthCount = array(); $showYear = wf_CheckPost(array('showyear')) ? vf($_POST['showyear'], 3) : curyear(); $showMonth = wf_CheckGet(array('month')) ? mysql_real_escape_string($_GET['month']) : curmonth(); $yearCount = 0; if (!empty($this->users)) { foreach ($this->users as $io => $each) { if (!empty($each['regdate'])) { $dateTime = explode(' ', $each['regdate']); $regdates[$dateTime[0]][] = $each['id']; } } } // show year selector $yearInputs = wf_YearSelector('showyear', ' ', false); $yearInputs .= wf_Submit(__('Show')); $yearForm = wf_Form('', 'POST', $yearInputs, 'glamour'); show_window(__('Year'), $yearForm); //extract year signup count data foreach ($months as $eachMonth => $monthName) { $sigcount = 0; if (!empty($regdates)) { foreach ($regdates as $eachRegDate => $userIds) { $dateMark = $showYear . '-' . $eachMonth; if (ispos($eachRegDate, $dateMark)) { $sigcount = $sigcount + count($regdates[$eachRegDate]); } $monthCount[$eachMonth] = $sigcount; } $yearCount = $yearCount + $sigcount; } } //render per year grid $cells = wf_TableCell(''); $cells .= wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Signups')); $cells .= wf_TableCell(__('Visual')); $rows = wf_TableRow($cells, 'row1'); foreach ($months as $eachMonth => $monthName) { $cells = wf_TableCell($eachMonth); $monthLink = wf_Link(self::URL_REPORTS_MGMT . 'reportSignup&month=' . $showYear . '-' . $eachMonth, rcms_date_localise($monthName), false); $cells .= wf_TableCell($monthLink); $cells .= wf_TableCell($monthCount[$eachMonth]); $cells .= wf_TableCell(web_bar($monthCount[$eachMonth], $yearCount)); $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $yearCount; show_window(__('User signups by year') . ' ' . $showYear, $result); //render per month registrations $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Tariff')); $rows = wf_TableRow($cells, 'row1'); if (!empty($regdates)) { foreach ($regdates as $eachRegDate => $eachRegUsers) { if (ispos($eachRegDate, $showMonth)) { foreach ($eachRegUsers as $ix => $eachUserId) { $cells = wf_TableCell($eachUserId); $cells .= wf_TableCell($this->users[$eachUserId]['regdate']); $userLink = wf_Link(self::URL_USERS_PROFILE . $eachUserId, web_profile_icon() . ' ', false); $cells .= wf_TableCell($userLink . $this->userGetFullAddress($eachUserId)); $cells .= wf_TableCell($this->users[$eachUserId]['realname']); $cells .= wf_TableCell(@$this->tariffs[$this->users[$eachUserId]['tariffid']]['tariffname']); $rows .= wf_TableRow($cells, 'row3'); } } } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); if ($showMonth == curmonth()) { $monthTitle = __('Current month user signups'); } else { $monthTitle = __('User signups by month') . ' ' . $showMonth; } show_window($monthTitle, $result); }
/** * Shows signup tariffs popularity chart * * @return void */ function web_SignupGraph() { if (!wf_CheckGet(array('month'))) { $cmonth = curmonth(); } else { $cmonth = mysql_real_escape_string($_GET['month']); } $where = "WHERE `date` LIKE '" . $cmonth . "%'"; $alltariffnames = zb_TariffsGetAll(); $tariffusers = zb_TariffsGetAllUsers(); $allsignups = zb_SignupsGet($where); $tcount = array(); if (!empty($allsignups)) { foreach ($alltariffnames as $io => $eachtariff) { foreach ($allsignups as $ii => $eachsignup) { if (@$tariffusers[$eachsignup['login']] == $eachtariff['name']) { @($tcount[$eachtariff['name']] = $tcount[$eachtariff['name']] + 1); } } } } $tablecells = wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Count')); $tablecells .= wf_TableCell(__('Visual')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($tcount)) { foreach ($tcount as $sigtariff => $eachcount) { $tablecells = wf_TableCell($sigtariff); $tablecells .= wf_TableCell($eachcount); $tablecells .= wf_TableCell(web_bar($eachcount, sizeof($allsignups)), '', '', 'sorttable_customkey="' . $eachcount . '"'); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); show_window(__('Tariffs report'), $result); }
function zb_AskoziaParseStatus($rawData) { $exploded = explodeRows($rawData); $data = array('phones' => 0, 'curcalls' => 0, 'totalcalls' => 0, 'ram' => 0, 'disk' => 0, 'uptime' => 0); if (!empty($exploded)) { foreach ($exploded as $each) { //detecting stats if (ispos($each, ';')) { $parse = explode(';', $each); //current calls $data['curcalls'] = $parse[1]; //total calls $data['totalcalls'] = $parse[2]; //registered phones $data['phones'] = $parse[4]; //uptime in days or minutes $data['uptime'] = $parse[5]; $data['uptime'] = str_replace('min', __('minutes'), $data['uptime']); $data['uptime'] = str_replace('hours', __('hours'), $data['uptime']); $data['uptime'] = str_replace('hour', __('hour'), $data['uptime']); $data['uptime'] = str_replace('days', __('days'), $data['uptime']); $data['uptime'] = str_replace('day', __('day'), $data['uptime']); //system memory $data['ram'] = $parse[6]; //external storage $data['disk'] = $parse[7]; } } } $cells = wf_TableCell(__('Phones')); $cells .= wf_TableCell(__('Current calls')); $cells .= wf_TableCell(__('Calls processed')); $cells .= wf_TableCell(__('Uptime')); $cells .= wf_TableCell(__('Memory usage')); $cells .= wf_TableCell(__('External storage')); $rows = wf_TableRow($cells, 'row2'); $cells = wf_TableCell($data['phones']); $cells .= wf_TableCell($data['curcalls']); $cells .= wf_TableCell($data['totalcalls']); $cells .= wf_TableCell($data['uptime']); $cells .= wf_TableCell(web_bar($data['ram'], '100') . ' ' . $data['ram'] . '%'); $cells .= wf_TableCell(web_bar($data['disk'], '100') . ' ' . $data['disk'] . '%'); $rows .= wf_TableRow($cells, 'row3'); $result = wf_TableBody($rows, '100%', 0, ''); return $result; }
/** * Renders report by private data prop * * @return string */ public function render() { $cells = wf_TableCell(__('Tariff line')); $cells .= wf_TableCell(__('Payments count')); $cells .= wf_TableCell(__('ARPU')); $cells .= wf_TableCell(__('Cash')); $cells .= wf_TableCell(__('Visual')); $rows = wf_TableRow($cells, 'row1'); $result = $this->panel(); if (!empty($this->data)) { foreach ($this->data as $line => $data) { $monthArpu = $data['count'] != 0 ? $mountArpu = round($data['summ'] / $data['count'], 2) : 0; $cells = wf_TableCell($line); $cells .= wf_TableCell($data['count']); $cells .= wf_TableCell($monthArpu); $cells .= wf_TableCell($data['summ']); $cells .= wf_TableCell(web_bar($data['summ'], $this->totalsum), '', '', 'sorttable_customkey="' . $data['summ'] . '"'); $rows .= wf_TableRow($cells, 'row3'); } } $result .= wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
/** * Renders tags assign report * * @return void */ public function renderReport() { $result = $this->panel(); $messages = new UbillingMessageHelper(); $months = months_array_localized(); $reportTmp = array(); $totalCount = 0; if (!empty($this->allnames)) { $result .= wf_tag('br'); $inputs = wf_YearSelector('reportyear', __('Year'), false) . ' '; $curTagid = wf_CheckPost(array('reporttagid')) ? vf($_POST['reporttagid'], 3) : ''; $inputs .= wf_Selector('reporttagid', $this->allnames, __('Tag'), $curTagid, false) . ' '; $inputs .= wf_Submit(__('Show')); $result .= wf_Form('', 'POST', $inputs, 'glamour'); } else { $result .= $messages->getStyledMessage(__('Nothing found'), 'info'); } if (wf_CheckPost(array('reportyear', 'reporttagid'))) { $tagid = vf($_POST['reporttagid'], 3); $year = vf($_POST['reportyear'], 3); $datemask = $year . '-%'; $query = "SELECT * from `weblogs` WHERE `date` LIKE '" . $datemask . "' AND `event` LIKE 'TAGADD (%' AND `event` LIKE '%TAGID%';"; $raw = simple_queryall($query); if (!empty($raw)) { foreach ($raw as $io => $each) { $eventtagid = preg_match("/\\[[^\\]]*\\]/", $each['event'], $matches); @($eventtagid = vf($matches[0], 3)); if (!empty($eventtagid)) { if ($eventtagid == $tagid) { $eventTime = strtotime($each['date']); $eventMonth = date("m", $eventTime); if (!isset($reportTmp[$eventMonth])) { $reportTmp[$eventMonth] = 1; } else { $reportTmp[$eventMonth]++; } $totalCount++; } } } } $cells = wf_TableCell($year); $cells .= wf_TableCell(__('Month')); $cells .= wf_TableCell($this->allnames[$tagid]); $cells .= wf_TableCell(__('Visual')); $rows = wf_TableRow($cells, 'row1'); foreach ($months as $monthNumber => $monthName) { $cells = wf_TableCell($monthNumber); $cells .= wf_TableCell($monthName); $monthData = isset($reportTmp[$monthNumber]) ? $reportTmp[$monthNumber] : 0; $cells .= wf_TableCell($monthData); $cells .= wf_TableCell(web_bar($monthData, $totalCount), '', '', 'sorttable_customkey="' . $monthData . '"'); $rows .= wf_TableRow($cells, 'row3'); } $result .= wf_TableBody($rows, '100%', '0', 'sortable'); $result .= wf_tag('b') . __('Total') . ':' . wf_tag('b', true) . ' ' . $totalCount; } show_window(__('Tags'), $result); }
/** * Renders dead switches top * * @return string */ function web_DeadSwitchesTop() { $topThreshold = 10; $result = ''; $cyear = curyear(); $query = "SELECT `id`,`date`,`timestamp`,`swdead` from `switchdeadlog` WHERE `date` LIKE '" . $cyear . "-%' ORDER BY `id` ASC"; $rawData = simple_queryall($query); $topTmp = array(); $totalCount = 0; if (!empty($rawData)) { foreach ($rawData as $io => $each) { if (!empty($each['swdead'])) { $deadData = unserialize($each['swdead']); if (!empty($deadData)) { foreach ($deadData as $eachDeadIp => $eachDeadName) { if (isset($topTmp[$eachDeadIp])) { $topTmp[$eachDeadIp]['count']++; } else { $topTmp[$eachDeadIp]['count'] = 1; $topTmp[$eachDeadIp]['name'] = $eachDeadName; } $totalCount++; } } } } } if (!empty($topTmp)) { $cells = wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Location')); $cells .= wf_TableCell(__('Count')); $cells .= wf_TableCell(__('Visual')); $rows = wf_TableRow($cells, 'row1'); foreach ($topTmp as $io => $each) { if ($each['count'] > $topThreshold) { $cells = wf_TableCell($io); $cells .= wf_TableCell($each['name']); $cells .= wf_TableCell($each['count']); $cells .= wf_TableCell(web_bar($each['count'], $totalCount)); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); } return $result; }
function catv_PaymentsShowGraph($year) { $months = months_array(); $result = '<table width="100%" class="sortable" border="0">'; $year_summ = catv_PaymentsGetYearSumm($year); $result .= ' <tr class="row1"> <td></td> <td>' . __('Month') . '</td> <td>' . __('Payments count') . '</td> <td>' . __('ARPU') . '</td> <td>' . __('Cash') . '</td> <td width="50%">' . __('Visual') . '</td> </tr> '; foreach ($months as $eachmonth => $monthname) { $month_summ = catv_PaymentsGetMonthSumm($year, $eachmonth); $paycount = catv_PaymentsGetMonthCount($year, $eachmonth); $result .= ' <tr class="row3"> <td>' . $eachmonth . '</td> <td><a href="?module=catv&action=reports&showreport=finance&month=' . $year . '-' . $eachmonth . '">' . rcms_date_localise($monthname) . '</a></td> <td>' . $paycount . '</td> <td>' . @round($month_summ / $paycount, 2) . '</td> <td>' . $month_summ . '</td> <td>' . web_bar($month_summ, $year_summ) . '</td> </tr> '; } $result .= '</table>'; show_window(__('Payments by') . ' ' . $year, $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; }
public function renderTariffsGraph() { $result = ''; if (!empty($this->tariffstats)) { $cells = wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Count')); $cells .= wf_TableCell(__('Visual')); $rows = wf_TableRow($cells, 'row1'); foreach ($this->tariffstats as $tariffName => $countCredits) { $cells = wf_TableCell($tariffName); $cells .= wf_TableCell($countCredits); $cells .= wf_TableCell(web_bar($countCredits, sizeof($this->data))); $rows .= wf_TableRow($cells, 'row3'); } $graphs = wf_TableBody($rows, '100%', '0', 'sortable'); $result = wf_modal(wf_img('skins/icon_stats.gif', __('Tariffs')), __('Tariffs'), $graphs, '', '800', '600'); } return $result; }
public function render() { if (!empty($this->streets)) { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('City')); $cells .= wf_TableCell(__('Street')); $cells .= wf_TableCell(__('Builds')); $cells .= wf_TableCell(__('Registered')); $cells .= wf_TableCell(__('Visual')); $cells .= wf_TableCell(__('Level')); $rows = wf_TableRow($cells, 'row1'); foreach ($this->streets as $streetid => $each) { $cells = wf_TableCell($streetid); $cells .= wf_TableCell(@$this->cities[$each['cityid']]); $cells .= wf_TableCell($each['streetname']); $cells .= wf_TableCell($each['buildcount']); $cells .= wf_TableCell($each['usercount']); $cells .= wf_TableCell(web_bar($each['usercount'], $this->totalusercount), '50%', '', 'sorttable_customkey="' . $each['usercount'] . '"'); $cells .= wf_TableCell($this->getLevel($each['usercount'], $each['buildcount'])); $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', '0', 'sortable'); } else { $result = __('Nothing found'); } return $result; }