public function render() { $cells = wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Traffic')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->data)) { $allrealnames = zb_UserGetAllRealnames(); $alladdress = zb_AddressGetFulladdresslist(); foreach ($this->data as $io => $each) { $loginLink = wf_Link("?module=userprofile&username="******"' . $each['traffic'] . '"'); $actionLinks = wf_Link('?module=pl_traffdetails&username='******'login'], wf_img('skins/icon_stats.gif', __('Detailed stats')), false, ''); $actionLinks .= wf_link('?module=dstatedit&username='******'login'], web_edit_icon(), false, ''); $cells .= wf_TableCell($actionLinks); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
/** * Render available tag types list with all needed controls * * @return string */ function stg_show_tagtypes() { $messages = new UbillingMessageHelper(); $query = "SELECT * from `tagtypes` ORDER BY `id` ASC"; $alltypes = simple_queryall($query); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Color')); $cells .= wf_TableCell(__('Priority')); $cells .= wf_TableCell(__('Text')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($alltypes)) { foreach ($alltypes as $io => $eachtype) { $eachtagcolor = $eachtype['tagcolor']; $actions = wf_JSAlert('?module=usertags&delete=' . $eachtype['id'], web_delete_icon(), $messages->getDeleteAlert()); $actions .= wf_JSAlert('?module=usertags&edit=' . $eachtype['id'], web_edit_icon(), $messages->getEditAlert()); $cells = wf_TableCell($eachtype['id']); $cells .= wf_TableCell(wf_tag('font', false, '', 'color="' . $eachtagcolor . '"') . $eachtagcolor . wf_tag('font', true)); $cells .= wf_TableCell($eachtype['tagsize']); $cells .= wf_TableCell($eachtype['tagname']); $cells .= wf_TableCell($actions); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); //construct adding form $inputs = wf_ColPicker('newcolor', __('Color'), '#' . rand(11, 99) . rand(11, 99) . rand(11, 99), false, '10'); $inputs .= wf_TextInput('newtext', __('Text'), '', false, '15'); $inputs .= web_priority_selector() . ' '; $inputs .= wf_HiddenInput('addnewtag', 'true'); $inputs .= wf_Submit(__('Create')); $form = wf_Form("", 'POST', $inputs, 'glamour'); $result .= $form; return $result; }
/** * Returns available administrators list * * @return string */ function web_list_admins() { $alladmins = rcms_scandir(USERS_PATH); $cells = wf_TableCell(__('Admin')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($alladmins)) { foreach ($alladmins as $eachadmin) { $actions = wf_JSAlert('?module=permissions&delete=' . $eachadmin, web_delete_icon(), 'Removing this may lead to irreparable results'); $actions .= wf_Link('?module=permissions&passwd=' . $eachadmin, web_key_icon()); $actions .= wf_Link('?module=permissions&edit=' . $eachadmin, web_edit_icon('Rights')); $cells = wf_TableCell($eachadmin); $cells .= wf_TableCell($actions); $rows .= wf_TableRow($cells, 'row3'); } } $form = wf_TableBody($rows, '100%', '0', 'sortable'); return $form; }
function web_NasTemplatesShow() { $query = "SELECT * from `nastemplates`"; $alltemplates = simple_queryall($query); $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('NAS')); $tablecells .= wf_TableCell(__('Template')); $tablecells .= wf_TableCell(__('Actions')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($alltemplates)) { foreach ($alltemplates as $io => $eachtemplate) { $nasdata = zb_NasGetData($eachtemplate['nasid']); $tablecells = wf_TableCell($eachtemplate['id']); $tablecells .= wf_TableCell($eachtemplate['nasid'] . ':' . $nasdata['nasname']); $tablecells .= wf_TableCell('<pre>' . $eachtemplate['template'] . '</pre>'); $actions = wf_JSAlert("?module=radiust&delete=" . $eachtemplate['id'], web_delete_icon(), 'Are you serious'); $actions .= wf_Link("?module=radiust&edit=" . $eachtemplate['id'], web_edit_icon(), false, ''); $tablecells .= wf_TableCell($actions); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); show_window(__('Available NAS Radius attribute templates'), $result); }
function web_PhpConsoleShowTemplates() { $alltemplatekeys = zb_StorageFindKeys('PHPCONSOLETEMPLATE:'); $tablecells = wf_TableCell(__('Template'), '80%'); $tablecells .= wf_TableCell(__('Actions')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($alltemplatekeys)) { foreach ($alltemplatekeys as $eachtemplatekey) { $templatearray = zb_PhpConsoleGetTemplate($eachtemplatekey['key']); $templatename = $templatearray['name']; $templatebody = $templatearray['body']; //show code template $runlink = wf_JSAlert('?module=sqlconsole&devconsole=true&runtpl=' . $eachtemplatekey['key'], $templatename, 'Insert this template into PHP console'); $tablecells = wf_TableCell($runlink); $actionlinks = wf_JSAlert('?module=sqlconsole&devconsole=true&deltemplate=' . $eachtemplatekey['key'], web_delete_icon(), 'Are you serious'); $actionlinks .= wf_Link('?module=sqlconsole&devconsole=true&edittemplate=' . $eachtemplatekey['key'], web_edit_icon()); $tablecells .= wf_TableCell($actionlinks); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $createlink = __('Available code templates') . ' ' . wf_Link("?module=sqlconsole&devconsole=true&templateadd=true", wf_img("skins/icon_add.gif", __('Create')), false); $result = $createlink . ' ' . wf_TableBody($tablerows, '100%', '0', 'sortable'); return $result; }
/** * Returns list of all available switches devices with its controls. Also catches ajaxping and forcereping events. * * @return string */ function web_SwitchesShow() { global $ubillingConfig; $alterconf = $ubillingConfig->getAlter(); $allswitches = zb_SwitchesGetAll(); $modelnames = zb_SwitchModelsGetAllTag(); $currenttime = time(); $reping_timeout = $alterconf['SW_PINGTIMEOUT']; $deathTime = zb_SwitchesGetAllDeathTime(); //counters $countTotal = 0; $countAlive = 0; $countDead = 0; $countNp = 0; $countOnMap = 0; $countSwpoll = 0; $countMtsigmon = 0; $countOlt = 0; $countLinked = 0; //non realtime switches pinging $last_pingtime = zb_StorageGet('SWPINGTIME'); if (!$last_pingtime) { zb_SwitchesRepingAll(); zb_StorageSet('SWPINGTIME', $currenttime); $last_pingtime = $currenttime; } else { if ($currenttime > $last_pingtime + $reping_timeout * 60) { // normal timeout reping sub here zb_SwitchesRepingAll(); zb_StorageSet('SWPINGTIME', $currenttime); } } //force total reping and update cache if (wf_CheckGet(array('forcereping'))) { zb_SwitchesRepingAll(); zb_StorageSet('SWPINGTIME', $currenttime); if (wf_CheckGet(array('ajaxping'))) { $dead_raw = zb_StorageGet('SWDEAD'); $deathTime = zb_SwitchesGetAllDeathTime(); $deadarr = array(); $ajaxResult = ''; if ($dead_raw) { $deadarr = unserialize($dead_raw); if (!empty($deadarr)) { //there is some dead switches $deadcount = sizeof($deadarr); if ($alterconf['SWYMAP_ENABLED']) { //getting geodata $switchesGeo = zb_SwitchesGetAllGeo(); } //ajax container $ajaxResult .= wf_tag('div', false, '', 'id="switchping"'); foreach ($deadarr as $ip => $switch) { if ($alterconf['SWYMAP_ENABLED']) { if (isset($switchesGeo[$ip])) { if (!empty($switchesGeo[$ip])) { $devicefind = wf_Link('?module=switchmap&finddevice=' . $switchesGeo[$ip], wf_img('skins/icon_search_small.gif', __('Find on map'))) . ' '; } else { $devicefind = ''; } } else { $devicefind = ''; } } else { $devicefind = ''; } //check morgue records for death time if (isset($deathTime[$ip])) { $deathClock = wf_img('skins/clock.png', __('Switch dead since') . ' ' . $deathTime[$ip]) . ' '; } else { $deathClock = ''; } //switch location link $switchLocator = wf_Link('?module=switches&gotoswitchbyip=' . $ip, web_edit_icon(__('Go to switch'))); //add switch as dead $ajaxResult .= $devicefind . ' ' . $switchLocator . ' ' . $deathClock . $ip . ' - ' . $switch . '<br>'; } } else { $ajaxResult = __('Switches are okay, everything is fine - I guarantee'); } } $ajaxResult .= wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s"); print $ajaxResult; //darkvoid update $notifyArea = new DarkVoid(); $notifyArea->flushCache(); die; } } //load dead switches cache $dead_switches_raw = zb_StorageGet('SWDEAD'); if (!$dead_switches_raw) { $dead_switches = array(); } else { $dead_switches = unserialize($dead_switches_raw); } //create new ADcomments object if enabled if ($alterconf['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('SWITCHES'); } $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Location')); $tablecells .= wf_TableCell(__('Active')); $tablecells .= wf_TableCell(__('Model')); $tablecells .= wf_TableCell(__('SNMP community')); $tablecells .= wf_TableCell(__('Geo location')); $tablecells .= wf_TableCell(__('Description')); $tablecells .= wf_TableCell(__('Actions')); $tablerows = wf_TableRow($tablecells, 'row1'); $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" '; if (!empty($allswitches)) { foreach ($allswitches as $io => $eachswitch) { if (isset($dead_switches[$eachswitch['ip']])) { if (isset($deathTime[$eachswitch['ip']])) { $obituary = __('Switch dead since') . ' ' . $deathTime[$eachswitch['ip']]; } else { $obituary = ''; } $aliveled = web_red_led($obituary); $aliveflag = '0'; $countDead++; } else { if (strpos($eachswitch['desc'], 'NP') === false) { $aliveled = web_green_led(); $aliveflag = '1'; $countAlive++; } else { $aliveled = web_yellow_led(); $aliveflag = '2'; $countNp++; } } $tablecells = wf_TableCell($eachswitch['id']); $tablecells .= wf_TableCell($eachswitch['ip'], '', '', 'sorttable_customkey="' . ip2int($eachswitch['ip']) . '"'); $tablecells .= wf_TableCell($eachswitch['location']); $tablecells .= wf_TableCell($aliveled, '', '', 'sorttable_customkey="' . $aliveflag . '"'); $tablecells .= wf_TableCell(@$modelnames[$eachswitch['modelid']]); $tablecells .= wf_TableCell($eachswitch['snmp']); $tablecells .= wf_TableCell($eachswitch['geo']); $tablecells .= wf_TableCell($eachswitch['desc']); $switchcontrols = ''; if (cfr('SWITCHESEDIT')) { $switchcontrols .= wf_Link('?module=switches&edit=' . $eachswitch['id'], web_edit_icon()); } if (cfr('SWITCHPOLL')) { if (!empty($eachswitch['snmp']) and ispos($eachswitch['desc'], 'SWPOLL')) { $switchcontrols .= ' ' . wf_Link('?module=switchpoller&switchid=' . $eachswitch['id'], wf_img('skins/snmp.png', __('SNMP query'))); $countSwpoll++; } } if ($alterconf['SWYMAP_ENABLED']) { if (!empty($eachswitch['geo'])) { $switchcontrols .= wf_Link('?module=switchmap&finddevice=' . $eachswitch['geo'], wf_img('skins/icon_search_small.gif', __('Find on map'))); $countOnMap++; } if (!empty($eachswitch['parentid'])) { $switchcontrols .= wf_Link('?module=switchmap&finddevice=' . $eachswitch['geo'] . '&showuplinks=true&traceid=' . $eachswitch['id'], wf_img('skins/ymaps/uplinks.png', __('Uplink switch'))); $countLinked++; } } if (ispos($eachswitch['desc'], 'MTSIGMON')) { $countMtsigmon++; } if (ispos($eachswitch['desc'], 'OLT')) { $countOlt++; } if ($alterconf['ADCOMMENTS_ENABLED']) { $switchcontrols .= $adcomments->getCommentsIndicator($eachswitch['id']); } if (isset($alterconf['SW_WEBNAV'])) { if ($alterconf['SW_WEBNAV']) { $switchcontrols .= ' ' . wf_tag('a', false, '', 'href="http://' . $eachswitch['ip'] . '" target="_BLANK"') . wf_img('skins/ymaps/globe.png', __('Go to the web interface')) . wf_tag('a', true); } } $tablecells .= wf_TableCell($switchcontrols); $tablerows .= wf_tag('tr', false, 'row3', $lighter); $tablerows .= $tablecells; $tablerows .= wf_tag('tr', true); $countTotal++; } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); $result .= wf_img('skins/icon_active.gif') . ' ' . __('Alive switches') . ' - ' . ($countAlive + $countNp) . ' (' . $countAlive . '+' . $countNp . ')' . wf_tag('br'); $result .= wf_img('skins/icon_inactive.gif') . ' ' . __('Dead switches') . ' - ' . $countDead . wf_tag('br'); $result .= wf_img('skins/yellow_led.png') . ' ' . __('NP switches') . ' - ' . $countNp . wf_tag('br'); $result .= wf_img('skins/snmp.png') . ' ' . __('SWPOLL query') . ' - ' . $countSwpoll . wf_tag('br'); $result .= wf_img('skins/wifi.png') . ' ' . __('MTSIGMON devices') . ' - ' . $countMtsigmon . wf_tag('br'); $result .= wf_img('skins/pon_icon.gif') . ' ' . __('OLT devices') . ' - ' . $countOlt . wf_tag('br'); $result .= wf_img('skins/icon_search_small.gif') . ' ' . __('Placed on map') . ' - ' . $countOnMap . wf_tag('br'); $result .= wf_img('skins/ymaps/uplinks.png') . ' ' . __('Have uplinks') . ' - ' . $countLinked . wf_tag('br'); $result .= wf_tag('br') . wf_tag('b') . __('Total') . ': ' . $countTotal . wf_tag('b', true) . wf_tag('br'); return $result; }
/** * Returns available time rules grid * * @return string */ public function renderList() { $messages = new UbillingMessageHelper(); $allTariffs = zb_TariffGetPricesAll(); $query = "SELECT * from `dshape_time` ORDER BY `id` ASC"; $allrules = simple_queryall($query); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Time from')); $cells .= wf_TableCell(__('Time to')); $cells .= wf_TableCell(__('Speed')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allrules)) { foreach ($allrules as $io => $eachrule) { $rowClass = isset($allTariffs[$eachrule['tariff']]) ? 'row3' : 'sigdeleteduser'; $tariffControl = cfr('TARIFFSPEED') ? wf_Link('?module=tariffspeeds&tariff=' . $eachrule['tariff'], $eachrule['tariff'], false) : $eachrule['tariff']; $cells = wf_TableCell($eachrule['id']); $cells .= wf_TableCell($tariffControl); $cells .= wf_TableCell($eachrule['threshold1']); $cells .= wf_TableCell($eachrule['threshold2']); $cells .= wf_TableCell($eachrule['speed']); $actions = wf_JSAlert('?module=dshaper&delete=' . $eachrule['id'], web_delete_icon(), $messages->getDeleteAlert()); $actions .= wf_JSAlert('?module=dshaper&edit=' . $eachrule['id'], web_edit_icon(), $messages->getEditAlert()); $cells .= wf_TableCell($actions); $rows .= wf_TableRow($cells, $rowClass); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
/** * Renders ips associated with some poolid * * @param int $poolid Existing pool ID * * @return string */ public function renderIps($poolid) { $poolid = vf($poolid, 3); $result = ''; if (empty($this->switches)) { $this->loadSwitches(); } if (isset($this->pools[$poolid])) { if (!empty($this->ips)) { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Gateway')); $cells .= wf_TableCell(__('Netmask')); $cells .= wf_TableCell(__('NAS')); $cells .= wf_TableCell(__('Interface')); $cells .= wf_TableCell(__('MAC')); $cells .= wf_TableCell(__('Switch')); $cells .= wf_TableCell(__('Port')); $cells .= wf_TableCell(__('VLAN')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($this->ips as $io => $eachip) { if ($eachip['poolid'] == $poolid) { $cells = wf_TableCell($eachip['id']); $cells .= wf_TableCell($eachip['ip']); $cells .= wf_TableCell($this->pools[$poolid]['gw']); $cells .= wf_TableCell($this->cidrToMask[$this->pools[$poolid]['netmask']]); $cells .= wf_TableCell($eachip['nas']); $cells .= wf_TableCell($eachip['iface']); $cells .= wf_TableCell($eachip['mac']); $cells .= wf_TableCell(@$this->switches[$eachip['switchid']]); $cells .= wf_TableCell($eachip['port']); $cells .= wf_TableCell($this->pools[$poolid]['vlan']); $actionsLink = wf_modal(web_edit_icon(), __('Edit') . ' ' . $eachip['ip'], $this->ipsEditForm($eachip['id']), '', '400', '300'); $cells .= wf_TableCell($actionsLink); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); //back links controls if (!empty($this->pools[$poolid]['login'])) { $result .= wf_Link("?module=userprofile&username=" . $this->pools[$poolid]['login'], __('Back to user profile'), false, 'ubButton'); } $result .= wf_Link('?module=extnets&showpoolbynetid=' . $this->pools[$poolid]['netid'], __('Back') . ' ' . $this->pools[$poolid]['pool'] . '/' . $this->pools[$poolid]['netmask'], true, 'ubButton'); } } else { throw new Exception(self::EX_NOEXPOOL); } return $result; }
/** * renders CaTV tariffs list with some controls * * @return void */ public function renderTariffs() { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Tariff name')); $cells .= wf_TableCell(__('Tariff Fee')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->tariffs)) { foreach ($this->tariffs as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['tariffname']); $cells .= wf_TableCell($each['price']); $actlinks = wf_JSAlert(self::URL_TARIFFS_MGMT . '&tariffdelete=' . $each['id'], web_delete_icon(), __('Removing this may lead to irreparable results')); $actlinks .= wf_modal(web_edit_icon(), __('Edit') . ' ' . $each['tariffname'], $this->tariffEditForm($each['id']), '', '400', '200'); $cells .= wf_TableCell($actlinks, '', '', $customkey = 'sorttable_customkey="0"'); //need this to keep table sortable $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); $result .= wf_modal(wf_img('skins/plus.png', __('Create new tariff')), __('Create new tariff'), $this->tariffCreateForm(), '', '400', '200'); return $result; }
/** * Returns available cities lister with some controls * * @return string */ function web_CityLister() { $allcity = zb_AddressGetCityAllData(); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('City name')); $cells .= wf_TableCell(__('City alias')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allcity)) { foreach ($allcity as $io => $eachcity) { $cells = wf_TableCell($eachcity['id']); $cells .= wf_TableCell($eachcity['cityname']); $cells .= wf_TableCell($eachcity['cityalias']); $acts = wf_JSAlert('?module=city&action=delete&cityid=' . $eachcity['id'], web_delete_icon(), 'Removing this may lead to irreparable results') . ' '; $acts .= wf_JSAlert('?module=city&action=edit&cityid=' . $eachcity['id'], web_edit_icon(), 'Are you serious') . ' '; $acts .= wf_Link('?module=streets', web_street_icon(), false, ''); $cells .= wf_TableCell($acts); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
if (!wf_CheckGet(array('add'))) { if (method_exists($corps, $beggar['METH']['RENDER'])) { show_window(__('Available corps'), $corps->{$beggar}['METH']['RENDER']()); } } } } //user management if ($route == Corps::URL_USER) { if (wf_CheckGet(array('username'))) { $login = mysql_real_escape_string($_GET['username']); $userCorpCheck = $corps->userIsCorporate($login); if ($userCorpCheck) { //enterprise user $corpsControls = $corps->corpPreview($userCorpCheck); $corpsControls .= wf_Link(Corps::URL_CORPS_EDIT . $userCorpCheck . '&usercallback=' . $login, web_edit_icon() . ' ' . __('Edit'), true, 'ubButton'); $corpsControls .= wf_delimiter(); $corpsControls .= web_UserControls($login); show_window(__('Corporate user'), $corpsControls); } else { //user is private if (wf_CheckPost(array('bindsomelogin', 'bindlogintocorpid'))) { $corps->userBind($_POST['bindsomelogin'], $_POST['bindlogintocorpid']); rcms_redirect(Corps::URL_USER_MANAGE . $_POST['bindsomelogin']); } if (method_exists($corps, $beggar['BU']['F'])) { $corpAttachControls = $corps->{$beggar}['BU']['F']($login); show_window(__('Private user'), $corpAttachControls); } if (method_exists($corps, $beggar['BU']['AB'])) { $corpAddAttachControls = $corps->{$beggar}['BU']['AB']($login);
/** * Renders available reports list * * @return string */ function web_ReportMasterShowReportsList() { $messages = new UbillingMessageHelper(); $reports_path = DATA_PATH . "reports/"; $allreports = rcms_scandir($reports_path); $cells = wf_TableCell(__('Report name')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allreports)) { foreach ($allreports as $eachreport) { $report_template = rcms_parse_ini_file($reports_path . $eachreport); $cells = wf_TableCell(wf_Link('?module=reportmaster&view=' . $eachreport, __($report_template['REPORT_NAME']))); $actControls = wf_JSAlert('?module=reportmaster&delete=' . $eachreport, web_delete_icon(), $messages->getDeleteAlert()); $actControls .= wf_JSAlert('?module=reportmaster&edit=' . $eachreport, web_edit_icon(), $messages->getEditAlert()); $cells .= wf_TableCell($actControls); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
/** * Returns list of map placemarks * * @param int $id * * @return string */ public function mapGetPlacemarks($id) { $id = vf($id, 3); $result = ''; if (!empty($this->allItems)) { foreach ($this->allItems as $io => $each) { if ($each['mapid'] == $id and !empty($each['geo'])) { $icon = $this->itemGetIcon($each['type']); $content = $this->itemGetTypeName($each['type']) . ': ' . $each['name']; $controls = wf_Link('?module=custmaps&edititem=' . $each['id'], web_edit_icon(), false); $controls = str_replace("'", '`', $controls); $controls = str_replace("\n", '', $controls); $result .= $this->mapAddMark($each['geo'], $each['location'], $content, $controls, $icon, ''); } } } return $result; }
/** * Renders ticket, all of replies and all needed controls/forms for they * * @param int $ticketid * * @return string */ function web_TicketDialogue($ticketid) { $ticketid = vf($ticketid, 3); $ticketdata = zb_TicketGetData($ticketid); $ticketreplies = zb_TicketGetReplies($ticketid); $result = wf_tag('p', false, '', 'align="right"') . wf_Link('?module=ticketing', 'Back to tickets list', true, 'ubButton') . wf_tag('p', true); if (!empty($ticketdata)) { $alladdress = zb_AddressGetFulladdresslist(); $allrealnames = zb_UserGetAllRealnames(); $alltariffs = zb_TariffsGetAllUsers(); $allcash = zb_CashGetAllUsers(); $allcredits = zb_CreditGetAllUsers(); $alluserips = zb_UserGetAllIPs(); if ($ticketdata['status']) { $actionlink = wf_Link('?module=ticketing&openticket=' . $ticketdata['id'], 'Open', false, 'ubButton'); } else { $actionlink = wf_Link('?module=ticketing&closeticket=' . $ticketdata['id'], 'Close', false, 'ubButton'); } $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('Date')); $tablecells .= wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Real Name')); $tablecells .= wf_TableCell(__('Full address')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Balance')); $tablecells .= wf_TableCell(__('Credit')); $tablecells .= wf_TableCell(__('Processed')); $tablerows = wf_TableRow($tablecells, 'row1'); $tablecells = wf_TableCell($ticketdata['id']); $tablecells .= wf_TableCell($ticketdata['date']); $profilelink = wf_Link('?module=userprofile&username='******'from'], web_profile_icon() . ' ' . $ticketdata['from']); $tablecells .= wf_TableCell($profilelink); $tablecells .= wf_TableCell(@$allrealnames[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alladdress[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alluserips[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alltariffs[$ticketdata['from']]); $tablecells .= wf_TableCell(@$allcash[$ticketdata['from']]); $tablecells .= wf_TableCell(@$allcredits[$ticketdata['from']]); $tablecells .= wf_TableCell(web_bool_led($ticketdata['status'])); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0'); //ticket body $tickettext = strip_tags($ticketdata['text']); $tickettext = nl2br($tickettext); $tablecells = wf_TableCell('', '20%'); $tablecells .= wf_TableCell($ticketdata['date']); $tablerows = wf_TableRow($tablecells, 'row2'); $ticketauthor = wf_tag('center') . wf_tag('b') . @$allrealnames[$ticketdata['from']] . wf_tag('b', true) . wf_tag('center', true); $ticketavatar = wf_tag('center') . wf_img('skins/userava.png') . wf_tag('center', true); $ticketpanel = $ticketauthor . wf_tag('br') . $ticketavatar; $tablecells = wf_TableCell($ticketpanel); $tablecells .= wf_TableCell($tickettext); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= $actionlink; } if (!empty($ticketreplies)) { $result .= wf_tag('h2') . __('Replies') . wf_tag('h2', true); $result .= wf_CleanDiv(); foreach ($ticketreplies as $io => $eachreply) { //reply if ($eachreply['admin']) { $replyauthor = wf_tag('center') . wf_tag('b') . $eachreply['admin'] . wf_tag('b', true) . wf_tag('center', true); $replyavatar = wf_tag('center') . gravatar_ShowAdminAvatar($eachreply['admin'], '64') . wf_tag('center', true); } else { $replyauthor = wf_tag('center') . wf_tag('b') . @$allrealnames[$eachreply['from']] . wf_tag('b', true) . wf_tag('center', true); $replyavatar = wf_tag('center') . wf_img('skins/userava.png') . wf_tag('center', true); } $replyactions = wf_tag('center'); $replyactions .= wf_JSAlert('?module=ticketing&showticket=' . $ticketdata['id'] . '&deletereply=' . $eachreply['id'], web_delete_icon(), 'Removing this may lead to irreparable results') . ' '; $replyactions .= wf_JSAlert('?module=ticketing&showticket=' . $ticketdata['id'] . '&editreply=' . $eachreply['id'], web_edit_icon(), 'Are you serious'); $replyactions .= wf_tag('center', true); // reply body if (isset($_GET['editreply'])) { if ($_GET['editreply'] == $eachreply['id']) { //is this reply editing? $replytext = web_TicketReplyEditForm($eachreply['id']); } else { //not this ticket edit $replytext = strip_tags($eachreply['text']); } } else { //normal text by default $replytext = strip_tags($eachreply['text']); $replytext = nl2br($replytext); } $replypanel = $replyauthor . wf_tag('br') . $replyavatar . wf_tag('br') . $replyactions; $tablecells = wf_TableCell('', '20%'); $tablecells .= wf_TableCell($eachreply['date']); $tablerows = wf_TableRow($tablecells, 'row2'); $tablecells = wf_TableCell($replypanel); $tablecells .= wf_TableCell($replytext); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= wf_CleanDiv(); } } //reply form and previous tickets $allprevious = zb_TicketsGetAllByUser($ticketdata['from']); $previoustickets = ''; if (!empty($allprevious)) { $previoustickets = wf_tag('h2') . __('All tickets by this user') . wf_tag('h2', true); foreach ($allprevious as $io => $eachprevious) { $tablecells = wf_TableCell($eachprevious['date']); $tablecells .= wf_TableCell(web_bool_led($eachprevious['status'])); $prevaction = wf_Link('?module=ticketing&showticket=' . $eachprevious['id'], 'Show', false, 'ubButton'); $tablecells .= wf_TableCell($prevaction); $tablerows = wf_TableRow($tablecells, 'row3'); $previoustickets .= wf_TableBody($tablerows, '100%', '0'); } } $tablecells = wf_TableCell(web_TicketReplyForm($ticketid), '50%', '', 'valign="top"'); $tablecells .= wf_TableCell($previoustickets, '50%', '', 'valign="top"'); $tablerows = wf_TableRow($tablecells); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= wf_CleanDiv(); return $result; }
function zb_LicenseLister() { $avarice = new Avarice(); $all = $avarice->getLicenseKeys(); $cells = wf_TableCell(__('Module')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($all)) { foreach ($all as $io => $each) { //construct edit form $editinputs = wf_HiddenInput('editdbkey', $each['KEY']); $editinputs .= wf_TextArea('editlicense', '', $each['LICENSE'], true, '50x10'); $editinputs .= wf_Submit(__('Save')); $editform = wf_Form("", 'POST', $editinputs, 'glamour'); $editcontrol = wf_modal(web_edit_icon(), __('Edit'), $editform, '', '500', '300'); //construct deletion controls $deletecontrol = wf_JSAlert('?module=licensekeys&licensedelete=' . $each['KEY'], web_delete_icon(), __('Removing this may lead to irreparable results')); $cells = wf_TableCell($each['MODULE']); $cells .= wf_TableCell($deletecontrol . ' ' . $editcontrol); $rows .= wf_TableRow($cells, 'row3'); } } //constructing license creation form $addinputs = wf_TextArea('createlicense', '', '', true, '50x10'); $addinputs .= wf_Submit(__('Add')); $addform = wf_Form("", 'POST', $addinputs, 'glamour'); $addcontrol = wf_modal(wf_img('skins/icon_add.gif', __('Add')) . ' ' . __('Add'), __('Add'), $addform, 'ubButton', '500', '300'); $result = wf_TableBody($rows, '100%', 0, ''); $result .= $addcontrol; show_window(__('Installed license keys'), $result); }
/** * Renders tasks list as human readable view * * @param array $tasksArray * * @return string */ public function renderTasks($tasksArray) { $result = ''; $totalCount = 0; if (!empty($tasksArray)) { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Job type')); $cells .= wf_TableCell(__('Phone')); $cells .= wf_TableCell(__('Who should do')); $cells .= wf_TableCell(__('Worker done')); $cells .= wf_TableCell(__('Target date')); $cells .= wf_TableCell(__('Finish date')); $cells .= wf_TableCell(__('Status')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($tasksArray as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['address']); $cells .= wf_TableCell(@$this->allJobtypes[$each['jobtype']]); $cells .= wf_TableCell($each['phone']); $cells .= wf_TableCell(@$this->allEmployee[$each['employee']]); $cells .= wf_TableCell(@$this->allEmployee[$each['employeedone']]); $cells .= wf_TableCell($each['startdate'] . ' ' . $each['starttime']); $cells .= wf_TableCell($each['enddate']); $cells .= wf_TableCell(web_bool_led($each['status']), '', '', 'sorttable_customkey="' . $each['status'] . '"'); $actLinks = wf_Link(self::URL_TASKVIEW . $each['id'], web_edit_icon(), false); $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row3'); $totalCount++; } $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $totalCount; } else { $messages = new UbillingMessageHelper(); $result = $messages->getStyledMessage(__('Nothing found'), 'warning'); } return $result; }
function web_TariffLister() { $alltariffs = billing_getalltariffs(); $dbSchema = zb_CheckDbSchema(); global $ubillingConfig; $alter = $ubillingConfig->getAlter(); $cells = wf_TableCell(__('Tariff name')); $cells .= wf_TableCell(__('Tariff Fee')); if ($dbSchema > 0) { $cells .= wf_TableCell(__('Period')); } $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); $result = wf_Link("?module=tariffs&action=new", __('Create new tariff'), true, 'ubButton'); if (!empty($alltariffs)) { foreach ($alltariffs as $io => $eachtariff) { $cells = wf_TableCell($eachtariff['name']); $cells .= wf_TableCell($eachtariff['Fee']); if ($dbSchema > 0) { $cells .= wf_TableCell(__($eachtariff['period'])); } $actions = wf_JSAlert("?module=tariffs&action=delete&tariffname=" . $eachtariff['name'], web_delete_icon(), __('Delete') . ' ' . $eachtariff['name'] . '? ' . __('Removing this may lead to irreparable results')); $actions .= wf_JSAlert("?module=tariffs&action=edit&tariffname=" . $eachtariff['name'], web_edit_icon(), __('Edit') . ' ' . $eachtariff['name'] . '? ' . __('Are you serious')); $actions .= wf_Link('?module=tariffspeeds&tariff=' . $eachtariff['name'], wf_img('skins/icon_speed.gif', __('Edit speed')), false, ''); $actions .= isset($alter['SIGNUP_PAYMENTS']) && !empty($alter['SIGNUP_PAYMENTS']) ? wf_Link('?module=signupprices&tariff=' . $eachtariff['name'], wf_img('skins/icons/register.png', __('Edit signup price')), false, '') : null; $cells .= wf_TableCell($actions); $rows .= wf_TableRow($cells, 'row3'); } } $result .= wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
function catv_UserShowAllpayments($userid) { $catvconf = catv_LoadConfig(); $alluserpayments = catv_PaymentsGetAllByUser($userid); $montharray_wz = months_array_wz(); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Cash')); $cells .= wf_TableCell(__('From month')); $cells .= wf_TableCell(__('From year')); $cells .= wf_TableCell(__('Notes')); $cells .= wf_TableCell(__('Admin')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($alluserpayments)) { foreach ($alluserpayments as $io => $eachpayrow) { //check is payments protected? if ($catvconf['PAYMENTS_PROTECT']) { $paycontrols = ''; } else { $paycontrols = ' ' . wf_JSAlert('?module=catv_addcash&userid=' . $eachpayrow['userid'] . '&deletepayment=' . $eachpayrow['id'], web_delete_icon(), 'Removing this may lead to irreparable results') . ' ' . wf_JSAlert('?module=catv_addcash&userid=' . $eachpayrow['userid'] . '&editpayment=' . $eachpayrow['id'], web_edit_icon(), 'Are you serious') . ' '; } // month locale $transmonth = $montharray_wz[$eachpayrow['from_month']]; $transmonth = rcms_date_localise($transmonth); $cells = wf_TableCell($eachpayrow['id']); $cells .= wf_TableCell($eachpayrow['date']); $cells .= wf_TableCell($eachpayrow['summ']); $cells .= wf_TableCell($transmonth); $cells .= wf_TableCell($eachpayrow['from_year']); $cells .= wf_TableCell($eachpayrow['notes']); $cells .= wf_TableCell($eachpayrow['admin']); $cells .= wf_TableCell($paycontrols); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
public function listAllTasks() { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Active')); $cells .= wf_TableCell(__('Name')); $cells .= wf_TableCell(__('Check type')); $cells .= wf_TableCell(__('Parameter')); $cells .= wf_TableCell(__('Operator')); $cells .= wf_TableCell(__('Condition')); $cells .= wf_TableCell(__('Actions')); $cells .= wf_TableCell(__('Manage')); $rows = wf_TableRow($cells, 'row1'); $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" '; if (!empty($this->allTasks)) { foreach ($this->allTasks as $io => $eachtask) { $details = wf_tag('pre') . print_r($eachtask, true) . wf_tag('pre', true); $detailLink = wf_modal($eachtask['id'], $eachtask['name'], $details, '', '600', '400'); $cells = wf_TableCell($detailLink, '', '', 'sorttable_customkey="' . $eachtask['id'] . '"'); $cells .= wf_TableCell(web_bool_led($eachtask['active']), '', '', 'sorttable_customkey="' . $eachtask['active'] . '"'); $cells .= wf_TableCell($eachtask['name']); $cells .= wf_TableCell($eachtask['checktype']); $cells .= wf_TableCell($eachtask['param']); $cells .= wf_TableCell($eachtask['operator']); $cells .= wf_TableCell($eachtask['condition']); $cells .= wf_TableCell($eachtask['action']); $controls = wf_JSAlert('?module=watchdog&delete=' . $eachtask['id'], web_delete_icon(), __('Removing this may lead to irreparable results')); $controls .= wf_JSAlert('?module=watchdog&edit=' . $eachtask['id'], web_edit_icon(), __('Are you serious')); $cells .= wf_TableCell($controls); $rows .= wf_tag('tr', false, 'row3', $lighter); $rows .= $cells; $rows .= wf_tag('tr', true); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
$swlinks .= wf_Link('?module=switchmodels', wf_img('skins/switch_models.png') . ' ' . __('Available switch models'), false, 'ubButton'); } $swlinks .= wf_Link('?module=switches&forcereping=true', wf_img('skins/refresh.gif') . ' ' . __('Force ping'), false, 'ubButton'); $swlinks .= wf_Link('?module=switches&timemachine=true', wf_img('skins/time_machine.png') . ' ' . __('Time machine'), false, 'ubButton'); if ($altCfg['SWYMAP_ENABLED']) { $swlinks .= wf_Link('?module=switchmap', wf_img('skins/ymaps/network.png') . ' ' . __('Switches map'), false, 'ubButton'); } if ($altCfg['SWITCH_AUTOCONFIG']) { if (cfr(SwitchLogin::MODULE)) { $swlinks .= wf_Link(SwitchLogin::MODULE_URL, wf_img('skins/sw_login.png') . ' ' . __('Switch login'), false, 'ubButton'); } } //parental switch deletion alternate controls if (isset($_GET['switchdelete'])) { $swlinks = ''; $swlinks .= wf_Link('?module=switches&edit=' . $_GET['switchdelete'], web_edit_icon() . ' ' . __('Edit'), false, 'ubButton') . ' '; $swlinks .= wf_JSAlertStyled('?module=switches&switchdelete=' . $_GET['switchdelete'] . '&forcedel=true', web_delete_icon() . ' ' . __('Force deletion'), __('Removing this may lead to irreparable results'), 'ubButton'); } show_window('', $swlinks); if (!isset($_GET['timemachine'])) { if (!isset($_GET['switchdelete'])) { //display switches list show_window(__('Available switches'), web_SwitchesShow()); } } else { //show dead switch time machine if (!isset($_GET['snapshot'])) { //cleanup subroutine if (wf_CheckGet(array('flushalldead'))) { ub_SwitchesTimeMachineCleanup(); rcms_redirect("?module=switches&timemachine=true");
function multinet_show_available_services() { $allservices = multinet_get_services(); $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('Network')); $tablecells .= wf_TableCell(__('Service name')); $tablecells .= wf_TableCell(__('Actions')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($allservices)) { foreach ($allservices as $io => $eachservice) { $netdesc = multinet_get_network_params($eachservice['netid']); $tablecells = wf_TableCell($eachservice['id']); $tablecells .= wf_TableCell($netdesc['desc']); $tablecells .= wf_TableCell($eachservice['desc']); $actionlinks = wf_JSAlert('?module=multinet&deleteservice=' . $eachservice['id'], web_delete_icon(), 'Removing this may lead to irreparable results'); $actionlinks .= wf_JSAlert('?module=multinet&editservice=' . $eachservice['id'], web_edit_icon(), 'Are you serious'); $tablecells .= wf_TableCell($actionlinks); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); show_window(__('Services'), $result); }
/** * Renders available and enabled alerts into DarkVoid notification area * * @return void */ protected function updateAlerts() { //new tickets alert if ($this->altCfg['TB_NEWTICKETNOTIFY']) { $newticketcount = zb_TicketsGetAllNewCount(); if ($newticketcount != 0) { $this->alerts .= wf_Link('?module=ticketing', wf_img('skins/ticketnotify.gif', $newticketcount . ' ' . __('support tickets expected processing')), false); } } //new signups notification if ($this->altCfg['SIGREQ_ENABLED']) { $signups = new SignupRequests(); $newreqcount = $signups->getAllNewCount(); if ($newreqcount != 0) { $this->alerts .= wf_Link('?module=sigreq', wf_img('skins/sigreqnotify.gif', $newreqcount . ' ' . __('signup requests expected processing')), false); } } //check for unread messages in instant messanger if ($this->altCfg['TB_UBIM']) { if (cfr('UBIM')) { $unreadMessageCount = im_CheckForUnreadMessages(); if ($unreadMessageCount) { //we have new messages $unreadIMNotify = __('You received') . ' ' . $unreadMessageCount . ' ' . __('new messages'); $urlIM = $unreadIMNotify . wf_delimiter() . wf_Link("?module=ubim&checknew=true", __('Click here to go to the instant messaging service.'), false, 'ubButton'); $this->alerts .= wf_Link("?module=ubim&checknew=true", wf_img("skins/ubim_blink.gif", $unreadMessageCount . ' ' . __('new message received')), false, ''); //$this->alerts.=wf_modalOpened(__('New messages received'), $urlIM, '450', '200'); } } } //check sms sending queue if ($this->altCfg['WATCHDOG_ENABLED']) { $smsQueueCount = rcms_scandir(DATA_PATH . 'tsms/'); $smsQueueCount = sizeof($smsQueueCount); if ($smsQueueCount > 0) { $this->alerts .= wf_Link("?module=tsmsqueue", wf_img("skins/sms.png", $smsQueueCount . ' ' . __('SMS in queue')), false, ''); } } if ($this->altCfg['TB_TASKMANNOTIFY']) { //only "for me" tasks notification if ($this->altCfg['TB_TASKMANNOTIFY'] == 1) { $undoneTasksCount = ts_GetUndoneCountersMy(); if ($undoneTasksCount > 0) { $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ' ' . __('for me'); $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, ''); } } //total undone tasks count notification if ($this->altCfg['TB_TASKMANNOTIFY'] == 2) { $undoneTasksCount = ts_GetUndoneCountersAll(); if ($undoneTasksCount > 0) { $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ' ' . __('for all'); $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, ''); } } //total+my undone tasks count notification if ($this->altCfg['TB_TASKMANNOTIFY'] == 3) { $undoneTasksCount = ts_GetUndoneCountersAll(); if ($undoneTasksCount > 0) { $undoneTasksCountMy = ts_GetUndoneCountersMy(); $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ': ' . __('for all') . ' ' . ($undoneTasksCount - $undoneTasksCountMy) . ' / ' . __('for me') . ' ' . $undoneTasksCountMy; $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, ''); } } } //switchmon at notify area if ($this->altCfg['TB_SWITCHMON']) { $dead_raw = zb_StorageGet('SWDEAD'); $last_pingtime = zb_StorageGet('SWPINGTIME'); $deathTime = zb_SwitchesGetAllDeathTime(); $deadarr = array(); $content = ''; if ($this->altCfg['SWYMAP_ENABLED']) { $content = wf_Link('?module=switchmap', wf_img('skins/swmapsmall.png', __('Switches map')), false); } $content .= wf_AjaxLoader() . wf_AjaxLink("?module=switches&forcereping=true&ajaxping=true", wf_img('skins/refresh.gif', __('Force ping')), 'switchping', true, ''); if ($dead_raw) { $deadarr = unserialize($dead_raw); if (!empty($deadarr)) { //there is some dead switches $deadcount = sizeof($deadarr); if ($this->altCfg['SWYMAP_ENABLED']) { //getting geodata $switchesGeo = zb_SwitchesGetAllGeo(); } //ajax container $content .= wf_tag('div', false, '', 'id="switchping"'); foreach ($deadarr as $ip => $switch) { if ($this->altCfg['SWYMAP_ENABLED']) { if (isset($switchesGeo[$ip])) { if (!empty($switchesGeo[$ip])) { $devicefind = wf_Link('?module=switchmap&finddevice=' . $switchesGeo[$ip], wf_img('skins/icon_search_small.gif', __('Find on map'))) . ' '; } else { $devicefind = ''; } } else { $devicefind = ''; } } else { $devicefind = ''; } //check morgue records for death time if (isset($deathTime[$ip])) { $deathClock = wf_img('skins/clock.png', __('Switch dead since') . ' ' . $deathTime[$ip]) . ' '; } else { $deathClock = ''; } //switch location link $switchLocator = wf_Link('?module=switches&gotoswitchbyip=' . $ip, web_edit_icon(__('Go to switch'))); //add switch as dead $content .= $devicefind . ' ' . $switchLocator . ' ' . $deathClock . $ip . ' - ' . $switch . '<br>'; } //ajax container end $content .= wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s", $last_pingtime) . wf_tag('div', true); $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('Dead switches') . ': ' . $deadcount, __('Dead switches'), $content, '', '500', '400') . wf_tag('div', true); } else { $content .= wf_tag('div', false, '', 'id="switchping"') . __('Switches are okay, everything is fine - I guarantee') . wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s", $last_pingtime) . wf_tag('div', true); $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('All switches alive'), __('All switches alive'), $content, '', '500', '400') . wf_tag('div', true); } } else { $content .= wf_tag('div', false, '', 'id="switchping"') . __('Switches are okay, everything is fine - I guarantee') . wf_delimiter() . __('Cache state at time') . ': ' . @date("H:i:s", $last_pingtime) . wf_tag('div', true); $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('All switches alive'), __('All switches alive'), $content, '', '500', '400') . wf_tag('div', true); } } file_put_contents(self::CACHE_PATH . self::CACHE_PREFIX . $this->myLogin, $this->alerts); }
/** * Returns list of expired undone tasks * * @return string */ function ts_ShowLate() { $allemployee = ts_GetAllEmployee(); $alljobtypes = ts_GetAllJobtypes(); $curyear = curyear(); $curmonth = date("m"); $curdate = curdate(); if ($curmonth != 1 and $curmonth != 12) { $query = "SELECT * from `taskman` WHERE `status`='0' AND `startdate` LIKE '" . $curyear . "-%' AND `startdate`< '" . $curdate . "' ORDER BY `startdate` ASC"; } else { $query = "SELECT * from `taskman` WHERE `status`='0' AND `startdate`< '" . $curdate . "' ORDER BY `startdate` ASC"; } $cells = wf_TableCell(__('Target date')); $cells .= wf_TableCell(__('Task address')); $cells .= wf_TableCell(__('Phone')); $cells .= wf_TableCell(__('Job type')); $cells .= wf_TableCell(__('Who should do')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); $all = simple_queryall($query); if (!empty($all)) { foreach ($all as $io => $each) { $cells = wf_TableCell($each['startdate']); $cells .= wf_TableCell($each['address']); $cells .= wf_TableCell($each['phone']); $cells .= wf_TableCell(@$alljobtypes[$each['jobtype']]); $cells .= wf_TableCell(@$allemployee[$each['employee']]); $actions = wf_Link('?module=taskman&edittask=' . $each['id'], web_edit_icon(), false, ''); $cells .= wf_TableCell($actions); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
function dhcp_show_available_nets() { $query = "SELECT * from `dhcp`"; $allnets = simple_queryall($query); $result = '<table width="100%" class="sortable" border="0" class="sortable">'; $result .= ' <tr class="row1"> <td> ID </td> <td> ' . __('Network/CIDR') . ' </td> <td> ' . __('DHCP custom subnet template') . ' </td> <td> ' . __('DHCP config name') . ' </td> <td> ' . __('Actions') . ' </td> </tr> '; if (!empty($allnets)) { foreach ($allnets as $io => $eachnet) { $netdata = multinet_get_network_params($eachnet['netid']); $result .= ' <tr class="row3"> <td> ' . $eachnet['id'] . ' </td> <td> ' . $netdata['desc'] . ' </td> <td> ' . web_bool_led($eachnet['dhcpconfig']) . ' </td> <td> ' . $eachnet['confname'] . ' </td> <td> ' . wf_JSAlert('?module=dhcp&delete=' . $eachnet['id'], web_delete_icon(), 'Removing this may lead to irreparable results') . ' <a href="?module=dhcp&edit=' . $eachnet['id'] . '">' . web_edit_icon() . '</a> </td> </tr> '; } } $result .= '</table>'; show_window(__('Available DHCP networks'), $result); }
$cells .= wf_TableCell(__('Attribute')); $cells .= wf_TableCell(__('op')); $cells .= wf_TableCell(__('Value')); $cells .= wf_TableCell(__('Foreach')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($results)) { foreach ($results as $result) { $cells = wf_TableCell($result['id']); $cells .= wf_TableCell($result['scenario']); $cells .= wf_TableCell($result['Attribute']); $cells .= wf_TableCell($result['op']); $cells .= wf_TableCell($result['Value']); $content = web_bool_led($result['login'] == '*'); $cells .= wf_TableCell($content); $content = wf_Link("?module=freeradius&netid={$netid}&edit=" . $result['id'], web_edit_icon()); $content .= wf_JSAlert("?module=freeradius&netid={$netid}&delete=" . $result['id'], web_delete_icon(), 'Are you serious'); $cells .= wf_TableCell($content); $rows .= wf_TableRow($cells, 'row3'); } } /* Кнопка "Назад" */ $html .= wf_Link("?module=multinet", __('Back'), false, 'ubButton'); // Форма добавления нового атрибута $form = new InputForm('', 'POST', __('Save'), '', '', '', 'add'); // - Сценарий $content = $form->radio_button('add[scenario]', $scenarios, 'check'); $form->addrow(__('Scenario'), $content); // - Сервис (disabled) $content = $form->select_tag('add[netid]', getServiceIdDesc(), $netid, 'disabled'); $content .= $form->checkbox('add[login]', '*', __('Foreach'), '');
/** * Renders list of available contractors with some controls * * @return string */ public function contractorsRenderList() { $result = ''; $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Name')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->allContractors)) { foreach ($this->allContractors as $id => $name) { $cells = wf_TableCell($id); $cells .= wf_TableCell($name); $actLinks = wf_JSAlert(self::URL_ME . '&' . self::URL_CONTRACTORS . '&deletecontractor=' . $id, web_delete_icon(), $this->messages->getDeleteAlert()) . ' '; $actLinks .= wf_modalAuto(web_edit_icon(), __('Edit'), $this->contractorsEditForm($id)); $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
/** * Show data for some device * * @param $ip device ip * @param $community snmp community * @param $alltemplates all of snmp templates * @param $quiet no output * * @return void */ function sp_SnmpPollDevice($ip, $community, $alltemplates, $deviceTemplate, $allusermacs, $alladdress, $quiet = false) { global $ubillingConfig; if (isset($alltemplates[$deviceTemplate])) { $currentTemplate = $alltemplates[$deviceTemplate]; if (!empty($currentTemplate)) { $deviceDescription = $currentTemplate['define']['DEVICE']; $deviceFdb = $currentTemplate['define']['FDB']; $sectionResult = ''; $sectionName = ''; $finalResult = ''; $tempArray = array(); $alterCfg = $ubillingConfig->getAlter(); $snmp = new SNMPHelper(); //selecting FDB processing mode if (isset($currentTemplate['define']['FDB_MODE'])) { $deviceFdbMode = $currentTemplate['define']['FDB_MODE']; } else { $deviceFdbMode = 'default'; } //selecting FDB ignored port for skipping MAC-s on it if (isset($currentTemplate['define']['FDB_IGNORE_PORTS'])) { $deviceFdbIgnore = $currentTemplate['define']['FDB_IGNORE_PORTS']; $deviceFdbIgnore = explode(',', $deviceFdbIgnore); $deviceFdbIgnore = array_flip($deviceFdbIgnore); } else { $deviceFdbIgnore = array(); } //parse each section of template foreach ($alltemplates[$deviceTemplate] as $section => $eachpoll) { if ($section != 'define') { if (!$quiet) { $finalResult .= wf_tag('div', false, 'dashboard', ''); } $sectionName = $eachpoll['NAME']; $sectionOids = explode(',', $eachpoll['OIDS']); $sectionParser = $eachpoll['PARSER']; $sectionResult = ''; //now parse each oid foreach ($sectionOids as $eachOid) { $eachOid = trim($eachOid); $rawData = $snmp->walk($ip, $community, $eachOid, true); $rawData = str_replace('"', '`', $rawData); $parseCode = '$sectionResult.=' . $sectionParser . '("' . $rawData . '");'; eval($parseCode); } if (!$quiet) { $finalResult .= wf_tag('div', false, 'dashtask', '') . wf_tag('strong') . __($sectionName) . wf_tag('strong', true) . '<br>'; $finalResult .= $sectionResult . wf_tag('div', true); } } } $finalResult .= wf_tag('div', true); $finalResult .= wf_tag('div', false, '', 'style="clear:both;"'); $finalResult .= wf_tag('div', true); if (!$quiet) { show_window('', $finalResult); } // //parsing data from FDB table // if ($deviceFdb == 'true') { $portData = array(); $snmp->setBackground(false); // need to process data with system + background if ($deviceFdbMode == 'default') { //default zyxel & cisco port table $portTable = $snmp->walk($ip, $community, '.1.3.6.1.2.1.17.4.3.1.2', true); } else { if ($deviceFdbMode == 'dlp') { //custom dlink port table with VLANS $portTable = $snmp->walk($ip, $community, '.1.3.6.1.2.1.17.7.1.2.2.1.2', true); } } if (!empty($portTable)) { if ($deviceFdbMode == 'default') { //default FDB parser $portData = sp_SnmpParseFDB($portTable); } else { if ($deviceFdbMode == 'dlp') { //exotic dlink parser $portData = sp_SnmpParseFdbDl($portTable); } } //skipping some port data if FDB_IGNORE_PORTS option is set if (!empty($deviceFdbIgnore)) { if (!empty($portData)) { foreach ($portData as $some_mac => $some_port) { if (!isset($deviceFdbIgnore[$some_port])) { $tempArray[$some_mac] = $some_port; } } $portData = $tempArray; } } $fdbCache = serialize($portData); file_put_contents('exports/' . $ip . '_fdb', $fdbCache); } //show port data User friendly :) if (!empty($portData)) { //extracting all needed data for switchport control if ($alterCfg['SWITCHPORT_IN_PROFILE']) { $allswitchesArray = zb_SwitchesGetAll(); $allportassigndata = array(); $allportassigndata_q = "SELECT * from `switchportassign`;"; $allportassigndata_raw = simple_queryall($allportassigndata_q); if (!empty($allportassigndata_raw)) { foreach ($allportassigndata_raw as $iopd => $eachpad) { $allportassigndata[$eachpad['login']] = $eachpad; } } } $allusermacs = array_flip($allusermacs); $cells = wf_TableCell(__('User'), '30%'); $cells .= wf_TableCell(__('MAC')); $cells .= wf_TableCell(__('Ports')); $rows = wf_TableRow($cells, 'row1'); foreach ($portData as $eachMac => $eachPort) { //user detection if (isset($allusermacs[$eachMac])) { $userLogin = $allusermacs[$eachMac]; @($useraddress = $alladdress[$userLogin]); $userlink = wf_Link('?module=userprofile&username='******' ' . $useraddress, false); //switch port assing form if ($alterCfg['SWITCHPORT_IN_PROFILE']) { $assignForm = wf_modal(web_edit_icon(__('Switch port assign')), __('Switch port assign'), web_SnmpSwitchControlForm($userLogin, $allswitchesArray, $allportassigndata, @$_GET['switchid'], $eachPort), '', '500', '250'); if (isset($allportassigndata[$userLogin])) { $assignForm .= wf_img('skins/arrow_right_green.png') . @$allportassigndata[$userLogin]['port']; } } else { $assignForm = ''; } } else { $userlink = ''; $assignForm = ''; } $cells = wf_TableCell($userlink . $assignForm, '', '', 'sorttable_customkey="' . $eachPort . '"'); $cells .= wf_TableCell($eachMac); $cells .= wf_TableCell($eachPort); $rows .= wf_TableRow($cells, 'row3'); } if (!$quiet) { show_window(__('FDB'), wf_TableBody($rows, '100%', '0', 'sortable')); } } } } } }
/** * Renders available employee wages list with some controls * * @return string */ public function employeeWagesRender() { $result = ''; $messages = new UbillingMessageHelper(); $cells = wf_TableCell(__('Employee')); $cells .= wf_TableCell(__('Wage')); $cells .= wf_TableCell(__('Bounty')); $cells .= wf_TableCell(__('Work hours')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->allWages)) { foreach ($this->allWages as $io => $each) { $rowClass = isset($this->allEmployee[$io]) ? 'row3' : 'sigdeleteduser'; $cells = wf_TableCell(@$this->allEmployeeRaw[$io]); $cells .= wf_TableCell($this->allWages[$io]['wage']); $cells .= wf_TableCell($this->allWages[$io]['bounty']); $cells .= wf_TableCell($this->allWages[$io]['worktime']); $actlinks = wf_JSAlertStyled('?module=salary&employeewages=true&deletewage=' . $io, web_delete_icon(), $messages->getDeleteAlert()); $actlinks .= wf_modalAuto(web_edit_icon(), __('Edit'), $this->employeeWageEditForm($io)); $cells .= wf_TableCell($actlinks); $rows .= wf_TableRow($cells, $rowClass); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
/** * Generates HTML-table, containing existing lines * * @return string HTML-table */ public function line_list_show() { // Query lines: $query = "SELECT\n `" . self::TABLE_LINES . "`.`id`,\n `" . self::TABLE_LINES . "`.`point_start`,\n `" . self::TABLE_LINES . "`.`point_end`,\n `" . self::TABLE_LINES . "`.`fibers_amount`,\n `" . self::TABLE_LINES . "`.`length`,\n `" . self::TABLE_LINES . "`.`description`,\n `employee`.`name` AS `engineer`,\n `" . self::TABLE_LINES . "`.`param_color`,\n `" . self::TABLE_LINES . "`.`geo`\n FROM `" . self::TABLE_LINES . "`\n LEFT JOIN `employee`\n ON `" . self::TABLE_LINES . "`.`employee_id` = `employee`.id\n "; $result = simple_queryall($query); // HTML-table header: $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Starting point')); $cells .= wf_TableCell(__('End point')); $cells .= wf_TableCell(__('Fibers amount'), 75); $cells .= wf_TableCell(__('Length'), 100); $cells .= wf_TableCell(__('Description'), 350); $cells .= wf_TableCell(__('Engineer')); $cells .= wf_TableCell(__('Color'), 60); $cells .= wf_TableCell(__('Actions'), 80); $rows = wf_TableRow($cells, 'row2'); // HTML-table content: if (!empty($result)) { foreach ($result as $line) { // Color decoration: $line['param_color'] = '<span style="color: ' . $line['param_color'] . '">' . $line['param_color'] . '</span>'; $cells = wf_TableCell($line['id']); $cells .= wf_TableCell($line['point_start']); $cells .= wf_TableCell($line['point_end']); $cells .= wf_TableCell($line['fibers_amount']); $cells .= wf_TableCell($line['length']); $cells .= wf_TableCell($line['description']); $cells .= wf_TableCell($line['engineer']); $cells .= wf_TableCell($line['param_color']); // Actions: $actions = wf_Link(self::URL_LINE_DEL . $line['id'], web_delete_icon()); $actions .= wf_Link(self::URL_LINE_EDIT . $line['id'], web_edit_icon()); $actions .= wf_Link(self::URL_LINE_DOCS . $line['id'], web_corporate_icon('Documentation')); if (empty($line['geo']) || $line['geo'] == '[ ]') { $actions .= wf_Link(self::URL_LINE_PLACE . $line['id'], web_add_icon(__('Place on map'))); } $cells .= wf_TableCell($actions); $rows .= wf_TableRow($cells, 'row3'); } } else { $cells = wf_TableCell(__('There is no lines to show'), null, null, 'colspan="9" align="center"'); $rows .= wf_TableRow($cells, 'row3'); } // Generate HTML-table: return wf_TableBody($rows, '100%', '0'); }
/** * Renders json formatted data for jquery data tables list * * @return string */ public function ajaxOnuData() { $allRealnames = zb_UserGetAllRealnames(); $allAddress = zb_AddressGetFulladdresslistCached(); if ($this->altCfg['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('PONONU'); $adc = true; } else { $adc = false; } $this->loadSignalsCache(); $result = '{ "aaData": [ '; if (!empty($this->allOnu)) { foreach ($this->allOnu as $io => $each) { if (!empty($each['login'])) { $userLogin = trim($each['login']); $userLink = wf_Link('?module=userprofile&username='******' ' . @$allAddress[$userLogin], false); $userLink = str_replace('"', '', $userLink); $userLink = trim($userLink); @($userRealName = $allRealnames[$userLogin]); $userRealName = str_replace('"', '', $userRealName); $userRealName = trim($userRealName); } else { $userLink = ''; $userRealName = ''; } //checking adcomments availability if ($adc) { $indicatorIcon = $adcomments->getCommentsIndicator($each['id']); $indicatorIcon = str_replace('"', '\'', $indicatorIcon); $indicatorIcon = trim($indicatorIcon); } else { $indicatorIcon = ''; } $actLinks = wf_Link('?module=ponizer&editonu=' . $each['id'], web_edit_icon(), false); $actLinks = str_replace('"', '', $actLinks); $actLinks = trim($actLinks); $actLinks .= ' ' . $indicatorIcon; //coloring signal if (isset($this->signalCache[$each['mac']])) { $signal = $this->signalCache[$each['mac']]; if ($signal > 0 or $signal < -25) { $sigColor = '#ab0000'; } else { $sigColor = '#005502'; } } elseif (isset($this->signalCache[$each['serial']])) { $signal = $this->signalCache[$each['serial']]; if ($signal > 0 or $signal < -25) { $sigColor = '#ab0000'; } else { $sigColor = '#005502'; } } else { $signal = __('No'); $sigColor = '#000000'; } $result .= ' [ "' . $each['id'] . '", "' . $this->getModelName($each['onumodelid']) . '", "' . @$this->allOltDevices[$each['oltid']] . '", "' . $each['ip'] . '", "' . $each['mac'] . '", "<font color=' . $sigColor . '>' . $signal . '</font>", "' . $userLink . '", "' . $userRealName . '", "' . $actLinks . '" ],'; } } $result = substr($result, 0, -1); $result .= '] }'; return $result; }