/** * 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 ADcomments indicator * * @return string */ protected function getAdcommentsIndicator() { $result = ''; if (!isset($this->alterCfg['NO_ADCOMMENTS_IN_PROFILE'])) { if ($this->alterCfg['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('USERNOTES'); $result = ' ' . wf_Link('?module=notesedit&username='******''); } else { $result = ''; } } return $result; }
/** * Returns list of duplicate coords/name items for some existing map * * @param int $mapid * @return string */ public function renderItemDuplicateList($mapid) { $mapid = vf($mapid, 3); $result = ''; $messages = new UbillingMessageHelper(); $itemsCount = 0; $filterArray = array(); if ($this->altCfg['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('CUSTMAPITEMS'); $adc = true; } else { $adc = false; } //counting unique geo coords if (!empty($this->allItems)) { foreach ($this->allItems as $ia => $eachItem) { if ($eachItem['mapid'] == $mapid) { if (isset($filterArray[$eachItem['geo']])) { $filterArray[$eachItem['geo']]++; } else { $filterArray[$eachItem['geo']] = 1; } } } } $result .= wf_Link('?module=custmaps&showitems=' . $mapid, __('Back'), false, 'ubButton'); $result .= wf_delimiter(); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Type')); $cells .= wf_TableCell(__('Geo location')); $cells .= wf_TableCell(__('Name')); $cells .= wf_TableCell(__('Location')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->allItems)) { foreach ($this->allItems as $io => $each) { $indicator = $adc ? $adcomments->getCommentsIndicator($each['id']) : ''; if ($each['mapid'] == $mapid) { if (isset($filterArray[$each['geo']])) { if ($filterArray[$each['geo']] > 1) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($this->itemGetTypeName($each['type'])); $cells .= wf_TableCell($each['geo']); $cells .= wf_TableCell($each['name']); $cells .= wf_TableCell($each['location']); $actLinks = ''; if (cfr('CUSTMAPEDIT')) { $actLinks .= wf_JSAlertStyled('?module=custmaps&deleteitem=' . $each['id'], web_delete_icon(), $messages->getDeleteAlert()) . ' '; } $actLinks .= wf_JSAlertStyled('?module=custmaps&edititem=' . $each['id'], web_edit_icon(), $messages->getEditAlert()) . ' '; $actLinks .= wf_Link('?module=custmaps&showmap=' . $each['mapid'] . '&locateitem=' . $each['geo'] . '&zoom=' . $this->ymapsCfg['FINDING_ZOOM'], wf_img('skins/icon_search_small.gif', __('Find on map')), false) . ' '; $actLinks .= $indicator; $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row3'); $itemsCount++; } } } } } $result .= wf_TableBody($rows, '100%', '0', 'sortable'); $result .= __('Total') . ': ' . $itemsCount; return $result; return $result; }
/** * 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; }
/** * renders available signups data * * @return void */ public function renderList() { $totalcount = $this->getCount(); if (!wf_CheckGet(array('page'))) { $current_page = 1; } else { $current_page = vf($_GET['page'], 3); } if ($totalcount > $this->perpage) { $paginator = wf_pagination($totalcount, $this->perpage, $current_page, "?module=sigreq", 'ubButton'); $this->loadRequests($this->perpage * ($current_page - 1), $this->perpage); } else { $paginator = ''; $this->loadRequests(0, $this->perpage); } $result = ''; //additional comments indicator if ($this->altcfg['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('SIGREQ'); } $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('Date')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Full address')); $tablecells .= wf_TableCell(__('Real Name')); $tablecells .= wf_TableCell(__('Processed')); $tablecells .= wf_TableCell(__('Actions')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($this->requests)) { foreach ($this->requests as $io => $eachreq) { $tablecells = wf_TableCell($eachreq['id']); $tablecells .= wf_TableCell($eachreq['date']); $tablecells .= wf_TableCell(wf_Link(self::URL_WHOIS . $eachreq['ip'], $eachreq['ip'])); if (empty($eachreq['apt'])) { $apt = 0; } else { $apt = $eachreq['apt']; } $reqaddr = $eachreq['street'] . ' ' . $eachreq['build'] . '/' . $apt; $tablecells .= wf_TableCell($reqaddr); $tablecells .= wf_TableCell($eachreq['realname']); if ($this->altcfg['ADCOMMENTS_ENABLED']) { $commIndicator = ' ' . $adcomments->getCommentsIndicator($eachreq['id']); } else { $commIndicator = ''; } $tablecells .= wf_TableCell(web_bool_led($eachreq['state']) . $commIndicator); $actlinks = wf_Link('?module=sigreq&showreq=' . $eachreq['id'], wf_img('skins/icon_search_small.gif') . ' ' . __('Show'), true, 'ubButton'); $tablecells .= wf_TableCell($actlinks); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); $result .= $paginator; //check database configuration table if (zb_CheckTableExists('sigreqconf')) { $confControl = wf_Link('?module=sigreq&settings=true', wf_img('skins/settings.png', __('Settings')), false) . ' '; } else { $confControl = ''; } $viewControl = wf_Link('?module=sigreq&calendarview=true', wf_img('skins/icon_calendar.gif', __('As calendar')), false, ''); show_window($confControl . __('Available signup requests') . ' ' . $viewControl, $result); }
function web_UserEditShowForm($login) { global $ubillingConfig; $alter_conf = $ubillingConfig->getAlter(); $stgdata = zb_UserGetStargazerData($login); $address = zb_UserGetFullAddress($login); $realname = zb_UserGetRealName($login); $phone = zb_UserGetPhone($login); $contract = zb_UserGetContract($login); $mobile = zb_UserGetMobile($login); $mail = zb_UserGetEmail($login); $notes = zb_UserGetNotes($login); $ip = $stgdata['IP']; $mac = zb_MultinetGetMAC($stgdata['IP']); $speedoverride = zb_UserGetSpeedOverride($login); $tariff = $stgdata['Tariff']; $credit = $stgdata['Credit']; $cash = $stgdata['Cash']; $password = $stgdata['Password']; $aonline = $stgdata['AlwaysOnline']; $dstatdisable = $stgdata['DisabledDetailStat']; $passive = $stgdata['Passive']; $down = $stgdata['Down']; $creditexpire = $stgdata['CreditExpire']; if ($alter_conf['PASSWORDSHIDE']) { $password = __('Hidden'); } if ($speedoverride == '0') { $speedoverride = __('No'); } if ($creditexpire > 0) { $creditexpire = date("Y-m-d", $creditexpire); } else { $creditexpire = __('No'); } $cells = wf_TableCell(__('Parameter')); $cells .= wf_TableCell(__('Current value')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row2'); //express card if ($alter_conf['CRM_MODE']) { $cells = wf_TableCell(__('Express card')); $cells .= wf_TableCell(''); $cells .= wf_TableCell(wf_Link('?module=expresscard&username='******'skins/express.gif') . ' ' . __('Edit'))); $rows .= wf_TableRow($cells, 'row3'); } //default fields editing $cells = wf_TableCell(__('Full address')); $cells .= wf_TableCell($address); $cells .= wf_TableCell(wf_Link('?module=binder&username='******'skins/icon_build.gif') . ' ' . __('Occupancy'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Password')); $cells .= wf_TableCell($password); $cells .= wf_TableCell(wf_Link('?module=passwordedit&username='******'skins/icon_key.gif') . ' ' . __('Change') . ' ' . __('password'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Real Name')); $cells .= wf_TableCell($realname); $cells .= wf_TableCell(wf_Link('?module=realnameedit&username='******'skins/icon_user.gif') . ' ' . __('Change') . ' ' . __('Real Name'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Phone')); $cells .= wf_TableCell($phone); $cells .= wf_TableCell(wf_Link('?module=phoneedit&username='******'skins/icon_phone.gif') . ' ' . __('Change') . ' ' . __('phone'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Mobile')); $cells .= wf_TableCell($mobile); $cells .= wf_TableCell(wf_Link('?module=mobileedit&username='******'skins/icon_mobile.gif') . ' ' . __('Change') . ' ' . __('mobile'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Contract')); $cells .= wf_TableCell($contract); $cells .= wf_TableCell(wf_Link('?module=contractedit&username='******'skins/icon_link.gif') . ' ' . __('Change') . ' ' . __('contract'))); $rows .= wf_TableRow($cells, 'row3'); if ($alter_conf['CORPS_ENABLED']) { $greed = new Avarice(); $corpsRuntime = $greed->runtime('CORPS'); if (!empty($corpsRuntime)) { $corps = new Corps(); $corpsCheck = $corps->userIsCorporate($login); $cells = wf_TableCell(__('User type')); if (cfr('CORPS')) { $corpControls = wf_Link(Corps::URL_USER_MANAGE . $login, wf_img('skins/corporate_small.gif') . ' ' . __('Change') . ' ' . __('user type')); } else { $corpControls = ''; } if ($corpsCheck) { $cells .= wf_TableCell(__('Corporate user')); $cells .= wf_TableCell($corpControls); } else { $cells .= wf_TableCell(__('Private user')); $cells .= wf_TableCell($corpControls); } $rows .= wf_TableRow($cells, 'row3'); } } $cells = wf_TableCell(__('Email')); $cells .= wf_TableCell($mail); $cells .= wf_TableCell(wf_Link('?module=mailedit&username='******'skins/icon_mail.gif') . ' ' . __('Change') . ' ' . __('email'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Tariff')); $cells .= wf_TableCell($tariff); $cells .= wf_TableCell(wf_Link('?module=tariffedit&username='******'skins/icon_tariff.gif') . ' ' . __('Change') . ' ' . __('tariff'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Speed override')); $cells .= wf_TableCell($speedoverride); $cells .= wf_TableCell(wf_Link('?module=speededit&username='******'skins/icon_speed.gif') . ' ' . __('Change') . ' ' . __('speed override'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Credit')); $cells .= wf_TableCell($credit); $cells .= wf_TableCell(wf_Link('?module=creditedit&username='******'skins/icon_credit.gif') . ' ' . __('Change') . ' ' . __('credit limit'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Credit expire')); $cells .= wf_TableCell($creditexpire); $cells .= wf_TableCell(wf_Link('?module=creditexpireedit&username='******'skins/icon_calendar.gif') . ' ' . __('Change') . ' ' . __('credit expire date'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Balance')); $cells .= wf_TableCell($cash); $cells .= wf_TableCell(wf_Link('?module=addcash&username='******'#profileending', wf_img('skins/icon_dollar.gif') . ' ' . __('Finance operations'))); $rows .= wf_TableRow($cells, 'row3'); if (isset($alter_conf['SIGNUP_PAYMENTS']) && !empty($alter_conf['SIGNUP_PAYMENTS'])) { $payment = zb_UserGetSignupPrice($login); $paid = zb_UserGetSignupPricePaid($login); if ($payment != $paid && $payment > 0) { $cells = wf_TableCell(__('Signup paid')); $cells .= wf_TableCell(zb_UserGetSignupPricePaid($login) . '/' . zb_UserGetSignupPrice($login)); $cells .= wf_TableCell(wf_Link('?module=signupprices&username='******'skins/icons/register.png', __('Edit signup price')) . ' ' . __('Edit signup price'))); $rows .= wf_TableRow($cells, 'row3'); } } $cells = wf_TableCell(__('IP')); $cells .= wf_TableCell($ip); $cells .= wf_TableCell(wf_Link('?module=pl_ipchange&username='******'skins/icon_ip.gif') . ' ' . __('Change') . ' ' . __('IP'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('MAC')); $cells .= wf_TableCell($mac); $cells .= wf_TableCell(wf_Link('?module=macedit&username='******'skins/icon_ether.gif') . ' ' . __('Change') . ' ' . __('MAC'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('AlwaysOnline')); $cells .= wf_TableCell(web_trigger($aonline)); $cells .= wf_TableCell(wf_Link('?module=aoedit&username='******'skins/icon_online.gif') . ' ' . __('AlwaysOnline'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Disable detailed stats')); $cells .= wf_TableCell(web_trigger($dstatdisable)); $cells .= wf_TableCell(wf_Link('?module=dstatedit&username='******'skins/icon_stats.gif') . ' ' . __('Disable detailed stats'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('User passive')); $cells .= wf_TableCell(web_trigger($passive)); $cells .= wf_TableCell(wf_Link('?module=passiveedit&username='******'skins/icon_passive.gif') . ' ' . __('User passive'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('User down')); $cells .= wf_TableCell(web_trigger($down)); $cells .= wf_TableCell(wf_Link('?module=downedit&username='******'skins/icon_down.gif') . ' ' . __('User down'))); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Passport data')); $cells .= wf_TableCell(''); $cells .= wf_TableCell(wf_Link('?module=pdataedit&username='******'skins/icon_passport.gif') . ' ' . __('Change') . ' ' . __('passport data'))); $rows .= wf_TableRow($cells, 'row3'); if ($alter_conf['CONDET_ENABLED']) { $conDet = new ConnectionDetails(); $cells = wf_TableCell(__('Connection details')); $cells .= wf_TableCell($conDet->renderData($login)); $cells .= wf_TableCell(wf_Link('?module=condetedit&username='******'skins/cableseal_small.png') . ' ' . __('Change') . ' ' . __('Connection details'))); $rows .= wf_TableRow($cells, 'row3'); } //additional comments indication if ($alter_conf['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('USERNOTES'); $indicatorIcon = ' ' . wf_Link('?module=notesedit&username='******''); } else { $indicatorIcon = ''; } $cells = wf_TableCell(__('Notes')); $cells .= wf_TableCell($notes . $indicatorIcon); $cells .= wf_TableCell(wf_Link('?module=notesedit&username='******'skins/icon_note.gif') . ' ' . __('Notes'))); $rows .= wf_TableRow($cells, 'row3'); $form = wf_TableBody($rows, '100%', '0'); show_window(__('Edit user') . ' ' . $address, $form); cf_FieldEditor($login); show_window('', web_UserControls($login)); }
function zb_AsteriskParseCDR($data) { global $altcfg; $normalData = $data; $adcomments = new ADcomments('ASTERISK'); // minus one SQL query per call // only one instance of object required if (!empty($normalData)) { $totalTime = 0; $callsCounter = 0; $cells = wf_TableCell('#'); $cells .= wf_TableCell(__('Time')); $cells .= wf_TableCell(__('From')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('To')); $cells .= wf_TableCell(__('Type')); $cells .= wf_TableCell(__('Status')); $cells .= wf_TableCell(__('Talk time')); if (wf_CheckPost(array('countnum')) and !isset($user_login) and $_POST['countnum']) { $cells .= wf_TableCell(__('Назойливость')); } else { $cells .= wf_TableCell(__('Comments')); } $rows = wf_TableRow($cells, 'row1'); foreach ($normalData as $io => $each) { if (isset($normalData[$io - 1]['src'])) { if ($normalData[$io]['src'] == $normalData[$io - 1]['src'] and $normalData[$io - 1]['disposition'] == 'NO ANSWER' and $normalData[$io]['disposition'] != 'ANSWERED') { continue; } if ($normalData[$io]['src'] == $normalData[$io - 1]['src'] and $normalData[$io - 1]['dst'] == 'hangup') { continue; } if ($normalData[$io]['src'] == $normalData[$io - 1]['src'] and $normalData[$io - 1]['dst'] == 'musiconhold') { continue; } } $callsCounter++; $AsteriskGetLoginByNumberAraySrc = array(zb_AsteriskGetLoginByNumber($each['src'])); foreach ($AsteriskGetLoginByNumberAraySrc as $data) { $link_src = $data['link']; $login = $data['login']; $name_src = $data['name']; $adres_src = $data['adres']; } $debugData = wf_tag('pre') . print_r($each, true) . wf_tag('pre', true); $startTime = $each['calldate']; //$startTime= explode(' ', $each['calldate']); //@$startTime=$startTime[1]; $tmpTime = strtotime($each['calldate']); $endTime = $tmpTime + $each['duration']; $endTime = date("H:i:s", $endTime); $answerTime = $tmpTime + ($each['duration'] - $each['billsec']); $answerTime = date("H:i:s", $answerTime); $tmpStats = __('Taken up the phone') . ': ' . $answerTime . "\n"; $tmpStats .= __('End of call') . ': ' . $endTime; $sessionTimeStats = wf_tag('abbr', false, '', 'title="' . $tmpStats . '"'); $sessionTimeStats .= $startTime; $sessionTimeStats .= wf_tag('abbr', true); $callDirection = ''; $cells = wf_TableCell(wf_modal($callsCounter, $callsCounter, $debugData, '', '500', '600'), '', '', 'sorttable_customkey="' . $callsCounter . '"'); $cells .= wf_TableCell($sessionTimeStats, '', '', 'sorttable_customkey="' . $tmpTime . '"'); $cells .= wf_TableCell($link_src); $cells .= wf_TableCell($name_src); $cells .= wf_TableCell($adres_src); $AsteriskGetLoginByNumberArayDst = array(zb_AsteriskGetLoginByNumber($each['dst'])); foreach ($AsteriskGetLoginByNumberArayDst as $data) { $link_dst = $data['link']; if (!empty($data['login'])) { $login = $data['login']; } } //$cells.= wf_TableCell(zb_AsteriskGetNumAlias($each['dst'])); $cells .= wf_TableCell($link_dst); $CallType = __('Dial'); if (ispos($each['lastapp'], 'internal-caller-transfer')) { $CallType = __('Call transfer'); } $cells .= wf_TableCell($CallType); $callStatus = $each['disposition']; $statusIcon = ''; if (ispos($each['disposition'], 'ANSWERED')) { $callStatus = __('Answered'); $statusIcon = wf_img('skins/calls/phone_green.png'); } if (ispos($each['disposition'], 'NO ANSWER')) { $callStatus = __('No answer'); $statusIcon = wf_img('skins/calls/phone_red.png'); } if (ispos($each['disposition'], 'BUSY')) { $callStatus = __('Busy'); $statusIcon = wf_img('skins/calls/phone_yellow.png'); } if (ispos($each['disposition'], 'FAILED')) { $callStatus = __('Failed'); $statusIcon = wf_img('skins/calls/phone_fail.png'); } $cells .= wf_TableCell($statusIcon . ' ' . $callStatus); $speekTime = $each['billsec']; $totalTime = $totalTime + $each['billsec']; $speekTime = zb_AsteriskFormatTime($speekTime); $cells .= wf_TableCell($speekTime, '', '', 'sorttable_customkey="' . $each['billsec'] . '"'); if (wf_CheckPost(array('countnum')) and !isset($user_login) and $_POST['countnum']) { $cells .= wf_TableCell(__($each['countnum'])); } else { if (!empty($login)) { $itemId = $each['uniqueid'] . $each['disposition'][0]; if ($adcomments->haveComments($itemId)) { $link_text = wf_tag('center') . $adcomments->getCommentsIndicator($itemId) . wf_tag('br') . wf_tag('span', false, '', 'style="font-size:14px;color: black;"') . zb_CheckCommentsForUser('ASTERISK', $itemId) . wf_tag('span', true) . wf_tag('center', true); } else { $link_text = wf_tag('center') . __('Add comments') . wf_tag('center', true); } $cells .= wf_TableCell(wf_Link('?module=asterisk&addComments=' . $itemId . '&username='******'#profileending', $link_text, false)); } else { $cells .= wf_TableCell(__('')); } } $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', '0', 'sortable'); $result .= __('Time spent on calls') . ': ' . zb_AsteriskFormatTime($totalTime) . wf_tag('br'); $result .= __('Total calls') . ': ' . $callsCounter; show_window('', $result); } }