public function render() { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Text')); $cells .= wf_TableCell(__('Processed')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->alltickets)) { foreach ($this->alltickets as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['date']); if (strlen($each['text']) > 140) { $textPreview = mb_substr(strip_tags($each['text']), 0, 140, 'utf-8') . '...'; } else { $textPreview = strip_tags($each['text']); } $cells .= wf_TableCell($textPreview); $cells .= wf_TableCell(web_bool_led($each['status'])); $cells .= wf_TableCell(wf_Link('?module=ticketing&showticket=' . $each['id'], __('Show'), false, 'ubButton')); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
/** * Renders list of available SMS in queue with some controls * * @return string */ public function render() { $result = ''; if (!empty($this->queue)) { $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Mobile')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($this->queue as $io => $each) { $cells = wf_TableCell($each['date']); $cells .= wf_TableCell($each['number']); $actLinks = wf_modalAuto(wf_img('skins/icon_search_small.gif', __('Preview')), __('Preview'), $this->smsPreview($each), ''); $actLinks .= wf_JSAlert('?module=tsmsqueue&deletesms=' . $each['filename'], web_delete_icon(), __('Are you serious')); $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', 0, 'sortable'); } else { $result .= wf_tag('span', false, 'alert_info'); $result .= wf_tag('center', false); $result .= __('Nothing found'); $result .= wf_tag('center', true); $result .= wf_tag('span', true); } return $result; }
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; }
/** * Renders search results for used cards * * @param int $year * @param string $month * * @return void */ function web_CardShowUsageByMonth($year, $month) { $month = mysql_real_escape_string($month); $year = mysql_real_escape_string($year); $query = "SELECT * from `cardbank` WHERE `usedate` LIKE '%" . $year . "-" . $month . "-%'"; $allusedcards = simple_queryall($query); $allrealnames = zb_UserGetAllRealnames(); $alladdress = zb_AddressGetFulladdresslist(); $totalsumm = 0; $totalcount = 0; $csvdata = ''; $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('Serial number')); $tablecells .= wf_TableCell(__('Cash')); $tablecells .= wf_TableCell(__('Usage date')); $tablecells .= wf_TableCell(__('Used login')); $tablecells .= wf_TableCell(__('Full address')); $tablecells .= wf_TableCell(__('Real name')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($allusedcards)) { $csvdata = __('ID') . ';' . __('Serial number') . ';' . __('Cash') . ';' . __('Usage date') . ';' . __('Used login') . ';' . __('Full address') . ';' . __('Real name') . "\n"; foreach ($allusedcards as $io => $eachcard) { $tablecells = wf_TableCell($eachcard['id']); $tablecells .= wf_TableCell($eachcard['serial']); $tablecells .= wf_TableCell($eachcard['cash']); $tablecells .= wf_TableCell($eachcard['usedate']); $profilelink = wf_Link("?module=userprofile&username="******"\n"; } } if (!empty($csvdata)) { $exportFilename = 'exports/cardreport_' . $year . '-' . $month . '.csv'; $csvdata = iconv('utf-8', 'windows-1251', $csvdata); file_put_contents($exportFilename, $csvdata); $exportLink = wf_Link('?module=cardreport&dloadcsv=' . base64_encode($exportFilename), wf_img('skins/excel.gif', __('Export')), false, ''); } else { $exportLink = ''; } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); $result .= __('Total') . ': ' . $totalcount . ' ' . __('payments') . ', ' . __('with total amount') . ': ' . $totalsumm; show_window(__('Payment cards usage report') . ' ' . $exportLink, $result); }
function ts_EmployeeMonthGraphs() { $curmonth = curmonth(); $employees = ts_GetAllEmployee(); $month_jobs_q = "SELECT `workerid`,`jobid` from `jobs` WHERE `date` LIKE '" . $curmonth . "%'"; $alljobs = simple_queryall($month_jobs_q); $jobtypes = ts_GetAllJobtypes(); $jobdata = array(); $result = ''; if (!empty($employees)) { if (!empty($alljobs)) { foreach ($alljobs as $io => $eachjob) { if (isset($jobdata[$eachjob['workerid']][$eachjob['jobid']])) { $jobdata[$eachjob['workerid']][$eachjob['jobid']]++; } else { $jobdata[$eachjob['workerid']][$eachjob['jobid']] = 1; } } } //build graphs for each employee if (!empty($jobdata)) { foreach ($jobdata as $employee => $each) { $employeeName = isset($employees[$employee]) ? $employees[$employee] : __('Deleted'); $result .= wf_tag('h3', false) . $employeeName . wf_tag('h3', true); $rows = ''; if (!empty($each)) { foreach ($each as $jobid => $count) { $cells = wf_TableCell(@$jobtypes[$jobid], '40%'); $cells .= wf_TableCell($count, '20%'); $cells .= wf_TableCell(web_bar($count, sizeof($alljobs)), '40%'); $rows .= wf_TableRow($cells, 'row3'); } } $result .= wf_TableBody($rows, '100%', 0); $result .= wf_delimiter(); } } } return $result; }
function web_UsersLister($users) { $tablecells = wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Real Name')); $tablecells .= wf_TableCell(__('Full address')); $tablecells .= wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Tariff speeds')); $tablecells .= wf_TableCell(__('Speed override')); $tablecells .= wf_TableCell(__('Actions')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($users)) { $udata = array(); $alluserdata = zb_UserGetAllStargazerData(); $alladdress = zb_AddressGetFulladdresslist(); $allrealnames = zb_UserGetAllRealnames(); $allspeeds = zb_TariffGetAllSpeeds(); if (!empty($alluserdata)) { foreach ($alluserdata as $ia => $eachdata) { $udata[$eachdata['login']]['Tariff'] = $eachdata['Tariff']; @($udata[$eachdata['login']]['Address'] = $alladdress[$eachdata['login']]); @($udata[$eachdata['login']]['RealName'] = $allrealnames[$eachdata['login']]); @($udata[$eachdata['login']]['NormalSpeedDown'] = $allspeeds[$eachdata['Tariff']]['speeddown']); @($udata[$eachdata['login']]['NormalSpeedUp'] = $allspeeds[$eachdata['Tariff']]['speedup']); } } foreach ($users as $io => $eachuser) { $tablecells = wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachuser['login'])); $tablecells .= wf_TableCell($udata[$eachuser['login']]['RealName']); $tablecells .= wf_TableCell($udata[$eachuser['login']]['Address']); $tablecells .= wf_TableCell($udata[$eachuser['login']]['Tariff']); $tablecells .= wf_TableCell($udata[$eachuser['login']]['NormalSpeedDown'] . '/' . $udata[$eachuser['login']]['NormalSpeedUp']); $tablecells .= wf_TableCell(zb_UserGetSpeedOverride($eachuser['login'])); $fixlink = wf_JSAlert('?module=speedcontrol&fix=' . $eachuser['login'], '<img src="skins/icon_repair.gif" title=' . __('Fix') . '>', 'Are you serious'); $tablecells .= wf_TableCell($fixlink); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); return $result; }
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; }
/** * Renders per-payment system openpayz transaction charts * * @return string */ public function renderGraphs() { $psysdata = array(); $gcAllData = array(); $gcMonthData = array(); $result = wf_Link('?module=openpayz', __('Back'), true, 'ubButton'); if (!empty($this->allTransactions)) { foreach ($this->allTransactions as $io => $each) { $timestamp = strtotime($each['date']); $curMonth = curmonth(); $date = date("Y-m-01", $timestamp); if (isset($psysdata[$each['paysys']][$date]['count'])) { $psysdata[$each['paysys']][$date]['count']++; $psysdata[$each['paysys']][$date]['summ'] = $psysdata[$each['paysys']][$date]['summ'] + $each['summ']; } else { $psysdata[$each['paysys']][$date]['count'] = 1; $psysdata[$each['paysys']][$date]['summ'] = $each['summ']; } //all time stats if (isset($gcAllData[$each['paysys']])) { $gcAllData[$each['paysys']]++; } else { $gcAllData[$each['paysys']] = 1; } //current month stats if (ispos($date, $curMonth . '-')) { if (isset($gcMonthData[$each['paysys']])) { $gcMonthData[$each['paysys']]++; } else { $gcMonthData[$each['paysys']] = 1; } } } } $chartOpts = "chartArea: { width: '90%', height: '90%' }, legend : {position: 'right'}, "; if (!empty($gcAllData)) { $gcAllPie = wf_gcharts3DPie($gcAllData, __('All time'), '400px', '400px', $chartOpts); } else { $gcAllPie = ''; } if (!empty($gcMonthData)) { $gcMonthPie = wf_gcharts3DPie($gcMonthData, __('Current month'), '400px', '400px', $chartOpts); } else { $gcMonthPie = ''; } $gcells = wf_TableCell($gcAllPie); $gcells .= wf_TableCell($gcMonthPie); $grows = wf_TableRow($gcells); $result .= wf_TableBody($grows, '100%', 0, ''); if (!empty($psysdata)) { foreach ($psysdata as $psys => $opdate) { $gdata = __('Date') . ',' . __('Count') . ',' . __('Cash') . "\n"; foreach ($opdate as $datestamp => $optrans) { $gdata .= $datestamp . ',' . $optrans['count'] . ',' . $optrans['summ'] . "\n"; } $result .= wf_tag('div', false, '', ''); $result .= wf_tag('h2') . $psys . wf_tag('h2', true) . wf_delimiter(); $result .= wf_Graph($gdata, '800', '200', false); $result .= wf_tag('div', true); } } return $result; }
/** * Shows signup tariffs popularity chart * * @return void */ function web_SignupGraph() { if (!wf_CheckGet(array('month'))) { $cmonth = curmonth(); } else { $cmonth = mysql_real_escape_string($_GET['month']); } $where = "WHERE `date` LIKE '" . $cmonth . "%'"; $alltariffnames = zb_TariffsGetAll(); $tariffusers = zb_TariffsGetAllUsers(); $allsignups = zb_SignupsGet($where); $tcount = array(); if (!empty($allsignups)) { foreach ($alltariffnames as $io => $eachtariff) { foreach ($allsignups as $ii => $eachsignup) { if (@$tariffusers[$eachsignup['login']] == $eachtariff['name']) { @($tcount[$eachtariff['name']] = $tcount[$eachtariff['name']] + 1); } } } } $tablecells = wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Count')); $tablecells .= wf_TableCell(__('Visual')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($tcount)) { foreach ($tcount as $sigtariff => $eachcount) { $tablecells = wf_TableCell($sigtariff); $tablecells .= wf_TableCell($eachcount); $tablecells .= wf_TableCell(web_bar($eachcount, sizeof($allsignups)), '', '', 'sorttable_customkey="' . $eachcount . '"'); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); show_window(__('Tariffs report'), $result); }
/** * 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; }
/** * Returns CFs listing for some login * * @param string $login Existing user login * * @return string */ function cf_FieldShower($login) { $alltypes = cf_TypeGetAll(); $login = mysql_real_escape_string($login); $result = ''; if (!empty($alltypes)) { $rows = ''; foreach ($alltypes as $io => $eachtype) { $cells = wf_TableCell($eachtype['name'], '30%', 'row2'); $cells .= wf_TableCell(cf_FieldDisplay($eachtype['type'], cf_FieldGet($login, $eachtype['id'])), '', 'row3'); $rows .= wf_TableRow($cells); } $result = wf_TableBody($rows, '100%', 0, ''); } return $result; }
function web_TsmsMassendConfirm($userarray) { global $td_users, $td_mobiles, $td_realnames, $td_realnamestrans, $td_tariffprices, $td_alladdress; global $ubillingConfig; $altCfg = $ubillingConfig->getAlter(); $template = tsms_GetTemplate(); $excludeUsers = tsms_GetExcludeUsers(); $excludeArr = array(); //ignoring DEAD_TAGID users if ($altCfg['CEMETERY_ENABLED']) { $cemetery = new Cemetery(); $excludeCemetery = $cemetery->getAllTagged(); if (!empty($excludeCemetery)) { foreach ($excludeCemetery as $eecl => $eecld) { $excludeUsers[$eecl] = 'NOP'; } } } $cells = wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('SMS')); $cells .= wf_TableCell(__('Mobile')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Balance')); $cells .= wf_TableCell(__('Credit')); $rows = wf_TableRow($cells, 'row1'); if (!empty($userarray)) { //excluded users handling if (!empty($excludeUsers)) { $excludeResult = wf_tag('h3') . __('Next users will be ignored while SMS sending') . wf_tag('h3', true); foreach ($excludeUsers as $excludeLogin => $nop) { unset($userarray[$excludeLogin]); $excludeArr[$excludeLogin] = $excludeLogin; } } else { $excludeResult = ''; } foreach ($userarray as $login => $phone) { $message = tsms_ParseTemplate($login, $template); $smsContainer = wf_modal(__('Show'), __('SMS'), $message, '', '300', '200'); $cells = wf_TableCell(wf_Link("?module=userprofile&username="******"", 'POST', $inputs, 'glamour'); $result = $confirmForm; $result .= wf_TableBody($rows, '100%', '0', 'sortable'); //showing which users will be excluded if (!empty($excludeUsers)) { $result .= $excludeResult; $result .= web_UserArrayShower($excludeArr); } 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; }
/** * Renders full cemetary log for some user * * @param string $login * * @return string */ public function renderCemeteryLog($login) { $result = ''; if (!empty($this->allDead)) { $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Status')); $rows = wf_TableRow($cells, 'row1'); foreach ($this->allDead as $io => $each) { if ($each['login'] == $login) { $led = $each['state'] ? web_bool_led(0) : web_bool_led(1); $cells = wf_TableCell($each['date']); $cells .= wf_TableCell($led); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); if (cfr('USERREG')) { if ($this->isUserDead($login)) { $inputs = wf_HiddenInput('cemeterysetasundead', $login); $inputs .= wf_Submit(__('Set user connected')); $result .= wf_Form('', 'POST', $inputs, 'glamour'); } else { $inputs = wf_HiddenInput('cemeterysetasdead', $login); $inputs .= wf_Submit(__('Set user disconnected')); $result .= wf_Form('', 'POST', $inputs, 'glamour'); } } } return $result; }
/** * Returns list of available comments for some item * * @param string $item * @return string */ public function renderComments($item) { $this->setItem($item); $this->loadComments(); $this->commentSaver(); @($employeeLogins = unserialize(ts_GetAllEmployeeLoginsCached())); $result = ''; $rows = ''; if (!empty($this->data)) { foreach ($this->data as $io => $each) { $authorRealname = isset($employeeLogins[$each['admin']]) ? $employeeLogins[$each['admin']] : $each['admin']; $authorName = wf_tag('center') . wf_tag('b') . $authorRealname . wf_tag('b', true) . wf_tag('center', true); $authorAvatar = wf_tag('center') . @gravatar_ShowAdminAvatar($each['admin'], '64') . wf_tag('center', true); $commentController = wf_tag('center') . $this->commentControls($each['id']) . wf_tag('center', true); $authorPanel = $authorName . wf_tag('br') . $authorAvatar . wf_tag('br') . $commentController; $commentText = nl2br($each['text']); if (wf_CheckPost(array('adcommentseditid'))) { if ($_POST['adcommentseditid'] == $each['id']) { $commentText = $this->commentEditForm($each['id']); } else { $commentText = nl2br($each['text']); } } $cells = wf_TableCell('', '20%'); $cells .= wf_TableCell($each['date']); $rows .= wf_TableRow($cells, 'row2'); $cells = wf_TableCell($authorPanel); $cells .= wf_TableCell($commentText); $rows .= wf_TableRow($cells, 'row3'); } $result .= wf_TableBody($rows, '100%', '0', ''); } $result .= $this->commentAddForm(); return $result; }
function zb_AskoziaParseStatus($rawData) { $exploded = explodeRows($rawData); $data = array('phones' => 0, 'curcalls' => 0, 'totalcalls' => 0, 'ram' => 0, 'disk' => 0, 'uptime' => 0); if (!empty($exploded)) { foreach ($exploded as $each) { //detecting stats if (ispos($each, ';')) { $parse = explode(';', $each); //current calls $data['curcalls'] = $parse[1]; //total calls $data['totalcalls'] = $parse[2]; //registered phones $data['phones'] = $parse[4]; //uptime in days or minutes $data['uptime'] = $parse[5]; $data['uptime'] = str_replace('min', __('minutes'), $data['uptime']); $data['uptime'] = str_replace('hours', __('hours'), $data['uptime']); $data['uptime'] = str_replace('hour', __('hour'), $data['uptime']); $data['uptime'] = str_replace('days', __('days'), $data['uptime']); $data['uptime'] = str_replace('day', __('day'), $data['uptime']); //system memory $data['ram'] = $parse[6]; //external storage $data['disk'] = $parse[7]; } } } $cells = wf_TableCell(__('Phones')); $cells .= wf_TableCell(__('Current calls')); $cells .= wf_TableCell(__('Calls processed')); $cells .= wf_TableCell(__('Uptime')); $cells .= wf_TableCell(__('Memory usage')); $cells .= wf_TableCell(__('External storage')); $rows = wf_TableRow($cells, 'row2'); $cells = wf_TableCell($data['phones']); $cells .= wf_TableCell($data['curcalls']); $cells .= wf_TableCell($data['totalcalls']); $cells .= wf_TableCell($data['uptime']); $cells .= wf_TableCell(web_bar($data['ram'], '100') . ' ' . $data['ram'] . '%'); $cells .= wf_TableCell(web_bar($data['disk'], '100') . ' ' . $data['disk'] . '%'); $rows .= wf_TableRow($cells, 'row3'); $result = wf_TableBody($rows, '100%', 0, ''); return $result; }
/** * Do the search in dead switches time machine * * @param string $query * @return string */ function ub_SwitchesTimeMachineSearch($request) { $request = strtolower_utf8($request); $result = ''; $query = "SELECT * from `switchdeadlog` ORDER BY `id` DESC"; $raw = simple_queryall($query); $deadcount = 0; $tmpArr = array(); if (!empty($raw)) { foreach ($raw as $io => $each) { if (!empty($each)) { $switchData = unserialize($each['swdead']); foreach ($switchData as $switchIp => $switchLocation) { if (ispos(strtolower_utf8($switchIp), $request) or ispos(strtolower_utf8($switchLocation), $request)) { $searchId = zb_rand_string(8); $tmpArr[$searchId]['date'] = $each['date']; $tmpArr[$searchId]['ip'] = $switchIp; $tmpArr[$searchId]['location'] = $switchLocation; } } } } } if (!empty($tmpArr)) { $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Location')); $rows = wf_TableRow($cells, 'row1'); foreach ($tmpArr as $ia => $eachResult) { $cells = wf_TableCell($eachResult['date']); $cells .= wf_TableCell($eachResult['ip']); $cells .= wf_TableCell($eachResult['location']); $rows .= wf_TableRow($cells, 'row3'); $deadcount++; } $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $deadcount; } else { $result = __('Nothing found'); } 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; }
$realname = @$allrealnames[$backmaclogin]; $usertariff = @$alltariffs[$backmaclogin]; $userip = @$alluserips[$backmaclogin]; } else { $profilelink = ''; $realname = ''; $usertariff = ''; $userip = ''; } $tablecells = wf_TableCell($profilelink); $tablecells .= wf_TableCell($realname); $tablecells .= wf_TableCell($usertariff); $tablecells .= wf_TableCell($userip); $tablecells .= wf_TableCell($eachmac); $tablecells .= wf_TableCell($displaysig); $tablerows .= wf_TableRow($tablecells, $rowclass); } $result .= wf_TableBody($tablerows, '100%', '0', 'sortable'); } else { $result .= __('Empty reply received'); } $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true); $result .= wf_tag('div', false, 'glamour') . __('Total') . ': ' . $userCounter . wf_tag('div', true); $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true); $result .= wf_delimiter(); } } else { $result = __('No devices for signal monitoring found'); } //if called as an user profile plugin if (isset($_GET['username'])) {
/** * Renders PON signal from cache * * @return string */ protected function getPonSignalControl() { $result = ''; $searched = __('No'); $sigColor = '#000000'; if ($this->alterCfg['SIGNAL_IN_PROFILE']) { $query = "SELECT `mac`,`oltid` FROM `pononu` WHERE `login`='" . $this->login . "'"; $onu_data = simple_query($query); if (!empty($onu_data)) { $availCacheData = rcms_scandir(PONizer::SIGCACHE_PATH, $onu_data['oltid'] . "_" . PONizer::SIGCACHE_EXT); if (!empty($availCacheData)) { foreach ($availCacheData as $io => $each) { $raw = file_get_contents(PONizer::SIGCACHE_PATH . $each); $raw = unserialize($raw); foreach ($raw as $mac => $signal) { if ($mac == $onu_data['mac']) { if ($signal > 0 or $signal < -25) { $sigColor = '#ab0000'; } else { $sigColor = '#005502'; } $searched = $signal; } } } } $cells = wf_TableCell(__("ONU Signal"), '30%', 'row2'); $cells .= wf_TableCell(wf_tag('strong') . wf_tag('font color=' . $sigColor, false) . $searched . wf_tag('font', true) . wf_tag('strong', true)); $rows = wf_TableRow($cells, 'row3'); $result = wf_TableBody($rows, '100%', '0'); } } return $result; }
$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'), ''); $form->addrow(__('Service'), $content); // - Атрибут $content = $form->text_box('add[Attribute]', '');
$allsw = simple_queryall($query); if (!empty($allsw)) { $tablecells = wf_TableCell(__('Location')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Model')); $tablecells .= wf_TableCell(__('Remote ID')); $tablerows = wf_TableRow($tablecells, 'row1'); foreach ($allsw as $io => $eachsw) { $swloc = $eachsw['location']; $swip = $eachsw['ip']; $swmod = $eachsw['modelname']; $swid = $eachsw['swid']; if (!empty($swid)) { $tablecells = wf_TableCell($swloc); $tablecells .= wf_TableCell($swip); $tablecells .= wf_TableCell($swmod); $tablecells .= wf_TableCell($swid); $tablerows .= wf_TableRow($tablecells, 'row4'); } } $result .= wf_TableBody($tablerows, '100%', '0', 'sortable'); } else { $result .= $messages->getStyledMessage(__('No switches found'), 'info'); } show_window(__('Remote Switch ID Module'), $result); } else { show_error(__('This module is disabled')); } } else { show_error(__('You cant control this module')); }
/** * 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 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; }
/** * renders streets report * * @return void */ public function reportStreets() { $ukvCities = array(); $ukvStreets = array(); //loads cities and streets occupied by UKV users $ukvCities_q = "SELECT DISTINCT `city` from `ukv_users` ORDER BY `city` ASC"; $ukvCitiesRaw = simple_queryall($ukvCities_q); if (!empty($ukvCitiesRaw)) { foreach ($ukvCitiesRaw as $ieuc => $euc) { $ukvCities[$euc['city']] = $euc['city']; } } $ukvStreets_q = "SELECT DISTINCT `street` from `ukv_users` ORDER BY `street` ASC"; $ukvStreetsRaw = simple_queryall($ukvStreets_q); if (!empty($ukvStreetsRaw)) { foreach ($ukvStreetsRaw as $ieus => $eus) { $ukvStreets[$eus['street']] = $eus['street']; } } //main codepart $citySelected = wf_CheckPost(array('streetreportcity')) ? $_POST['streetreportcity'] : ''; $streetSelected = wf_CheckPost(array('streetreportstreet')) ? $_POST['streetreportstreet'] : ''; $inputs = wf_Selector('streetreportcity', $ukvCities, __('City'), $citySelected, false); $inputs .= wf_Selector('streetreportstreet', $ukvStreets, __('Street'), $streetSelected, false); $inputs .= wf_Submit(__('Show')); $form = wf_Form('', 'POST', $inputs, 'glamour'); show_window(__('Streets report'), $form); if (wf_CheckPost(array('streetreportcity', 'streetreportstreet')) or wf_CheckGet(array('rc', 'rs'))) { //set form data if (wf_CheckPost(array('streetreportcity', 'streetreportstreet'))) { $citySearch = $_POST['streetreportcity']; $streetSearch = $_POST['streetreportstreet']; } //or printable report if (wf_CheckGet(array('rc', 'rs'))) { $citySearch = $_GET['rc']; $streetSearch = $_GET['rs']; } if (!empty($this->users)) { $counter = 0; $cells = wf_TableCell(__('Contract'), '10%'); $cells .= wf_TableCell(__('Full address'), '31%'); $cells .= wf_TableCell(__('Real Name'), '30%'); $cells .= wf_TableCell(__('Tariff'), '15%'); $cells .= wf_TableCell(__('Cash'), '7%'); $cells .= wf_TableCell(__('Status'), '7%'); $rows = wf_TableRow($cells, 'row1'); foreach ($this->users as $io => $eachUser) { if ($eachUser['city'] == $citySearch and $eachUser['street'] == $streetSearch) { $cells = wf_TableCell($eachUser['contract']); $fullAddress = $this->userGetFullAddress($eachUser['id']); $profileLink = wf_Link(self::URL_USERS_PROFILE . $eachUser['id'], web_profile_icon() . ' ', false, ''); $cells .= wf_TableCell($profileLink . $fullAddress); $cells .= wf_TableCell($eachUser['realname']); $cells .= wf_TableCell($this->tariffs[$eachUser['tariffid']]['tariffname']); $cells .= wf_TableCell($eachUser['cash']); $cells .= wf_TableCell(web_bool_led($eachUser['active'], true)); $rows .= wf_TableRow($cells, 'row3'); $counter++; } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); $result .= __('Total') . ': ' . $counter; if (wf_CheckGet(array('printable'))) { $this->reportPrintable($citySearch . ' / ' . $streetSearch, $result); } else { $printlink = wf_Link(self::URL_REPORTS_MGMT . 'reportStreets&rc=' . $citySearch . '&rs=' . $streetSearch . '&printable=true', wf_img('skins/icon_print.png', __('Print')), false, ''); show_window($citySearch . ' / ' . $streetSearch . ' ' . $printlink, $result); } } else { show_window(__('Result'), __('Any users found')); } } }
function zb_NewMacShow() { global $ubillingConfig; $billing_config = $ubillingConfig->getBilling(); $alter_config = $ubillingConfig->getAlter(); $allarp = array(); $sudo = $billing_config['SUDO']; $cat = $billing_config['CAT']; $grep = $billing_config['GREP']; $tail = $billing_config['TAIL']; $alter_conf = parse_ini_file(CONFIG_PATH . 'alter.ini'); $leases = $alter_conf['NMLEASES']; $leasemark = $alter_conf['NMLEASEMARK']; $command = $sudo . ' ' . $cat . ' ' . $leases . ' | ' . $grep . ' "' . $leasemark . '" | ' . $tail . ' -n 200'; $rawdata = shell_exec($command); $allusedMacs = zb_getAllUsedMac(); $result = ''; //fdb cache preprocessing $fdbData_raw = rcms_scandir('./exports/', '*_fdb'); if (!empty($fdbData_raw)) { $fdbArr = sn_SnmpParseFdbCacheArray($fdbData_raw); $fdbColumn = true; } else { $fdbArr = array(); $fdbColumn = false; } $cells = wf_TableCell(__('MAC')); if (!empty($fdbColumn)) { $cells .= wf_TableCell(__('Switch')); } if ($alter_config['MACVEN_ENABLED']) { $cells .= wf_TableCell(__('Manufacturer')); } $rows = wf_TableRow($cells, 'row1'); if (!empty($rawdata)) { $cleardata = exploderows($rawdata); foreach ($cleardata as $eachline) { preg_match('/[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}/i', $eachline, $matches); if (!empty($matches)) { $allarp[] = $matches[0]; } } $un_arr = array_unique($allarp); if (!empty($un_arr)) { if ($alter_config['MACVEN_ENABLED']) { //adding ajax loader $result .= wf_AjaxLoader(); } foreach ($un_arr as $io => $eachmac) { if (zb_checkMacFree($eachmac, $allusedMacs)) { $cells = wf_TableCell(@$eachmac); if (!empty($fdbColumn)) { $cells .= wf_TableCell(sn_SnmpParseFdbExtract(@$fdbArr[$eachmac])); } if ($alter_config['MACVEN_ENABLED']) { $containerName = 'NMRSMCNT_' . zb_rand_string(8); $lookupVendorLink = wf_AjaxLink('?module=macvendor&mac=' . @$eachmac . '&raw=true', wf_img('skins/macven.gif', __('Device vendor')), $containerName, false, ''); $lookupVendorLink .= wf_tag('span', false, '', 'id="' . $containerName . '"') . '' . wf_tag('span', true); $cells .= wf_TableCell($lookupVendorLink, '350'); } $rows .= wf_TableRow($cells, 'row3'); } } } } $result .= wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
public function documents_list_show($item, $item_id) { // Get documents list using the elements' id: $query = "SELECT * FROM `" . self::TABLE_DOCS . "` WHERE `" . $item . "_id` = '" . $item_id . "'"; $result = simple_queryall($query); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Title')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Filename')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row2'); if (!empty($result)) { foreach ($result as $document) { $filename = basename($document['path']); $cells = wf_TableCell($document['id']); $cells .= wf_TableCell($document['title']); $cells .= wf_TableCell($document['date']); $cells .= wf_TableCell($filename); $actions = wf_Link(self::URL_DOC_DOWNLOAD . $document['id'], wf_img('skins/icon_download.png', __('Download'))); $actions .= wf_Link(self::URL_DOC_DELETE . $document['id'], web_delete_icon()); $cells .= wf_TableCell($actions); $rows .= wf_TableRow($cells, 'row3'); } } else { $cells = wf_TableCell(__('There is no documents to show'), null, null, 'colspan="5" align="center"'); $rows .= wf_TableRow($cells, 'row3'); } return wf_TableBody($rows, '100%', '0'); }
/** * Renders previously generated all users documents * * @return string */ public function renderAllUserDocuments() { $allAddress = zb_AddressGetFulladdresslistCached(); $allRealnames = zb_UserGetAllRealnames(); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Public')); $cells .= wf_TableCell(__('Template')); $cells .= wf_TableCell(__('Path')); $cells .= wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->allUserDocuments)) { foreach ($this->allUserDocuments as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['date']); $cells .= wf_TableCell(web_bool_led($each['public'])); @($templateName = $this->templates[$each['templateid']]['name']); $cells .= wf_TableCell(wf_tag('abbr', false, '', 'title="' . $each['templateid'] . '"') . $templateName . wf_tag('abbr', true)); $downloadLink = wf_Link('?module=report_documents&documentdownload=' . $each['path'], $each['path'], false, ''); $cells .= wf_TableCell($downloadLink); $profileLink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login']); $cells .= wf_TableCell($profileLink); $cells .= wf_TableCell(@$allAddress[$each['login']]); $cells .= wf_TableCell(@$allRealnames[$each['login']]); $actionLinks = wf_JSAlert('?module=report_documents&deletedocument=' . $each['id'], web_delete_icon(), __('Are you serious')); $cells .= wf_TableCell($actionLinks); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', ''); return $result; }