/** * Returns available streets list with editing controls * * @return string */ function web_StreetLister() { $allstreets = zb_AddressGetStreetAllData(); $tmpCities = zb_AddressGetCityAllData(); $allcities = array(); if (!empty($tmpCities)) { foreach ($tmpCities as $ia => $eachcity) { $allcities[$eachcity['id']] = $eachcity['cityname']; } } $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('City')); $cells .= wf_tablecell(__('Street name')); $cells .= wf_tablecell(__('Street alias')); $cells .= wf_tablecell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allstreets)) { foreach ($allstreets as $io => $eachstreet) { $cityName = isset($allcities[$eachstreet['cityid']]) ? $allcities[$eachstreet['cityid']] : __('Error'); $cells = wf_TableCell($eachstreet['id']); $cells .= wf_TableCell($cityName); $cells .= wf_tablecell($eachstreet['streetname']); $cells .= wf_tablecell($eachstreet['streetalias']); $acts = wf_JSAlert('?module=streets&action=delete&streetid=' . $eachstreet['id'], web_delete_icon(), 'Removing this may lead to irreparable results'); $acts .= wf_JSAlert('?module=streets&action=edit&streetid=' . $eachstreet['id'], web_edit_icon(), 'Are you serious'); $acts .= wf_Link('?module=builds&action=edit&streetid=' . $eachstreet['id'], web_build_icon(), false); $cells .= wf_tablecell($acts); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $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'), '25%'); $cells .= wf_TableCell(__('Tariff'), '15%'); $cells .= wf_TableCell(__('Cash'), '7%'); $cells .= wf_TableCell(__('Seal'), '5%'); $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($eachUser['cableseal']); $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); } }