function web_AvailableDBBackupsList() { $backupsPath = DATA_PATH . 'backups/sql/'; $availbacks = rcms_scandir($backupsPath); $messages = new UbillingMessageHelper(); $result = $messages->getStyledMessage(__('No existing DB backups here'), 'warning'); if (!empty($availbacks)) { $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Size')); $cells .= wf_TableCell(__('Filename')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($availbacks as $eachDump) { $fileDate = filectime($backupsPath . $eachDump); $fileDate = date("Y-m-d H:i:s", $fileDate); $fileSize = filesize($backupsPath . $eachDump); $fileSize = stg_convert_size($fileSize); $encodedDumpPath = base64_encode($backupsPath . $eachDump); $downloadLink = wf_Link('?module=backups&download=' . $encodedDumpPath, $eachDump, false, ''); $actLinks = wf_JSAlert('?module=backups&deletedump=' . $encodedDumpPath, web_delete_icon(), __('Removing this may lead to irreparable results')) . ' '; $actLinks .= wf_Link('?module=backups&download=' . $encodedDumpPath, wf_img('skins/icon_download.png', __('Download')), false, ''); $actLinks .= wf_JSAlert('?module=backups&restore=true&restoredump=' . $encodedDumpPath, wf_img('skins/icon_restoredb.png', __('Restore DB')), __('Are you serious')); $cells = wf_TableCell($fileDate); $cells .= wf_TableCell($fileSize); $cells .= wf_TableCell($downloadLink); $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', '0', 'sortable'); } return $result; }
public function render() { $result = ''; if (!empty($this->alltickets)) { $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'); 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'); } else { $messages = new UbillingMessageHelper(); $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
/** * Shows signups performed today * * @return void */ function web_SignupsShowToday() { $messages = new UbillingMessageHelper(); $query = "SELECT COUNT(`id`) from `userreg` WHERE `date` LIKE '" . curdate() . "%'"; $sigcount = simple_query($query); $sigcount = $sigcount['COUNT(`id`)']; show_window('', $messages->getStyledMessage(__('Today signups') . ': ' . wf_tag('strong') . $sigcount . wf_tag('strong', true), 'info')); }
$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')); }
/** * 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; }
<?php $result = ''; if (cfr('USERPROFILE')) { if (wf_CheckGet(array('tariff'))) { $tariffName = mysql_real_escape_string($_GET['tariff']); $tariffNameRaw = $_GET['tariff']; $tariffInfo = ''; if ($tariffName == '*_NO_TARIFF_*') { $messages = new UbillingMessageHelper(); $tariffInfo = $messages->getStyledMessage(__('No tariff'), 'warning'); } else { $tariffPrice = zb_TariffGetPrice($tariffNameRaw); $tariffPeriods = zb_TariffGetPeriodsAll(); $tariffSpeeds = zb_TariffGetAllSpeeds(); $speedDown = isset($tariffSpeeds[$tariffName]) ? $tariffSpeeds[$tariffName]['speeddown'] : __('No'); $speedUp = isset($tariffSpeeds[$tariffName]) ? $tariffSpeeds[$tariffName]['speedup'] : __('No'); $period = isset($tariffPeriods[$tariffName]) ? __($tariffPeriods[$tariffName]) : __('No'); $cells = wf_TableCell(__('Fee'), '', 'row1'); $cells .= wf_TableCell($tariffPrice); $rows = wf_TableRow($cells, 'row2'); $cells = wf_TableCell(__('Download speed'), '', 'row1'); $cells .= wf_TableCell($speedDown); $rows .= wf_TableRow($cells, 'row2'); $cells = wf_TableCell(__('Upload speed'), '', 'row1'); $cells .= wf_TableCell($speedUp); $rows .= wf_TableRow($cells, 'row2'); $cells = wf_TableCell(__('Period'), '', 'row1'); $cells .= wf_TableCell($period); $rows .= wf_TableRow($cells, 'row2'); $tariffInfo = wf_TableBody($rows, '40%', 0, '');
/** * Renders tags assign report * * @return void */ public function renderReport() { $result = $this->panel(); $messages = new UbillingMessageHelper(); $months = months_array_localized(); $reportTmp = array(); $totalCount = 0; if (!empty($this->allnames)) { $result .= wf_tag('br'); $inputs = wf_YearSelector('reportyear', __('Year'), false) . ' '; $curTagid = wf_CheckPost(array('reporttagid')) ? vf($_POST['reporttagid'], 3) : ''; $inputs .= wf_Selector('reporttagid', $this->allnames, __('Tag'), $curTagid, false) . ' '; $inputs .= wf_Submit(__('Show')); $result .= wf_Form('', 'POST', $inputs, 'glamour'); } else { $result .= $messages->getStyledMessage(__('Nothing found'), 'info'); } if (wf_CheckPost(array('reportyear', 'reporttagid'))) { $tagid = vf($_POST['reporttagid'], 3); $year = vf($_POST['reportyear'], 3); $datemask = $year . '-%'; $query = "SELECT * from `weblogs` WHERE `date` LIKE '" . $datemask . "' AND `event` LIKE 'TAGADD (%' AND `event` LIKE '%TAGID%';"; $raw = simple_queryall($query); if (!empty($raw)) { foreach ($raw as $io => $each) { $eventtagid = preg_match("/\\[[^\\]]*\\]/", $each['event'], $matches); @($eventtagid = vf($matches[0], 3)); if (!empty($eventtagid)) { if ($eventtagid == $tagid) { $eventTime = strtotime($each['date']); $eventMonth = date("m", $eventTime); if (!isset($reportTmp[$eventMonth])) { $reportTmp[$eventMonth] = 1; } else { $reportTmp[$eventMonth]++; } $totalCount++; } } } } $cells = wf_TableCell($year); $cells .= wf_TableCell(__('Month')); $cells .= wf_TableCell($this->allnames[$tagid]); $cells .= wf_TableCell(__('Visual')); $rows = wf_TableRow($cells, 'row1'); foreach ($months as $monthNumber => $monthName) { $cells = wf_TableCell($monthNumber); $cells .= wf_TableCell($monthName); $monthData = isset($reportTmp[$monthNumber]) ? $reportTmp[$monthNumber] : 0; $cells .= wf_TableCell($monthData); $cells .= wf_TableCell(web_bar($monthData, $totalCount), '', '', 'sorttable_customkey="' . $monthData . '"'); $rows .= wf_TableRow($cells, 'row3'); } $result .= wf_TableBody($rows, '100%', '0', 'sortable'); $result .= wf_tag('b') . __('Total') . ':' . wf_tag('b', true) . ' ' . $totalCount; } show_window(__('Tags'), $result); }
/** * Renders available tasks list with controls * * @param sring $login * * @return string */ public function renderTasksList($login = '') { $result = ''; $messages = new UbillingMessageHelper(); $tmpArr = array(); if (!empty($this->allTasks)) { foreach ($this->allTasks as $io => $each) { if (empty($login)) { $tmpArr[$io] = $each; } else { if ($login == $each['login']) { $tmpArr[$io] = $each; } } } } if (!empty($tmpArr)) { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('User')); $cells .= wf_TableCell(__('Task')); $cells .= wf_TableCell(__('Parameter')); $cells .= wf_TableCell(__('Notes')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($tmpArr as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['date']); $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login'], false, '')); $cells .= wf_TableCell($this->actionNames[$each['action']]); $cells .= wf_TableCell($each['param']); $cells .= wf_TableCell($each['note']); $taskControls = wf_JSAlert(self::URL_ME . '&username='******'login'] . '&deletetaskid=' . $each['id'], web_delete_icon(), $messages->getDeleteAlert()); $cells .= wf_TableCell($taskControls); $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', 0, 'sortable'); } else { $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
/** * Shows salary summary report * * @return void */ public function summaryReport() { $result = ''; if ($_SERVER['QUERY_STRING'] == 'module=salary') { $messages = new UbillingMessageHelper(); if (empty($this->allEmployee)) { $result .= $messages->getStyledMessage(__('No available workers for wage creation'), 'error'); } else { $result .= $messages->getStyledMessage(__('Total existing employees') . ': ' . sizeof($this->allEmployee), 'info'); } if (empty($this->allJobtypes)) { $result .= $messages->getStyledMessage(__('No available job types for pricing'), 'error'); } else { $result .= $messages->getStyledMessage(__('Total existing job types') . ': ' . sizeof($this->allJobtypes), 'info'); } if (empty($this->allJobPrices)) { $result .= $messages->getStyledMessage(__('There is no set prices for job types'), 'warning'); } else { $result .= $messages->getStyledMessage(__('Total paid types of work') . ': ' . sizeof($this->allJobPrices), 'info'); } if (empty($this->allWages)) { $result .= $messages->getStyledMessage(__('There is no set wages for workers'), 'warning'); } if (empty($this->allJobs)) { $result .= $messages->getStyledMessage(__('Not done yet any paid work'), 'warning'); } else { $todayJobs = $this->jobsFilterDate(curdate()); $todayJobsCount = sizeof($todayJobs); $monthJobs = $this->jobsFilterDate(curmonth()); $monthJobsCount = sizeof($monthJobs); $result .= $messages->getStyledMessage(__('Today performed paid work') . ': ' . $todayJobsCount, 'success'); $result .= $messages->getStyledMessage(__('Month performed paid work') . ': ' . $monthJobsCount, 'success'); $result .= $messages->getStyledMessage(__('Total performed paid work') . ': ' . sizeof($this->allJobs), 'success'); } if (empty($this->allTimesheetDates)) { $result .= $messages->getStyledMessage(__('No filled timesheets'), 'warning'); } else { if (!isset($this->allTimesheetDates[curdate()])) { $result .= $messages->getStyledMessage(__('For today is not filled timesheets'), 'warning'); } else { $result .= $messages->getStyledMessage(__('For today timesheets is filled'), 'success'); } $result .= $messages->getStyledMessage(__('Filled timesheets for') . ' ' . sizeof($this->allTimesheetDates) . ' ' . __('days'), 'success'); } if (!empty($result)) { show_window(__('Stats'), $result); } } }
/** * Returns configuration editor to display in sysconf module * * @global bool $hide_passwords * @param string $prefix * @param array $configdata * @param array $optsdata * @return string */ function web_ConfigEditorShow($prefix, $configdata, $optsdata) { global $hide_passwords; global $configOptionsMissed; $messages = new UbillingMessageHelper(); $result = ''; if (!empty($configdata) and !empty($optsdata)) { foreach ($optsdata as $option => $handlers) { if (isset($configdata[$option]) or ispos($option, 'CHAPTER')) { if (!ispos($option, 'CHAPTER')) { $currentdata = $configdata[$option]; $handlers = explode('|', $handlers); $type = $handlers[0]; //option description if (!empty($handlers[1])) { $description = trim($handlers[1]); $description = __($description); } else { $description = $option; } //option controls if ($type == 'TRIGGER') { $control = web_bool_led($configdata[$option]); } if ($type == 'VARCHAR') { if ($hide_passwords) { if (isset($handlers[2])) { if ($handlers[2] == 'PASSWD') { $datavalue = __('Hidden'); } else { $datavalue = $configdata[$option]; } } else { $datavalue = $configdata[$option]; } } else { $datavalue = $configdata[$option]; } $control = wf_tag('input', false, '', 'type="text" name="' . $prefix . '_' . $option . '" size="25" value="' . $datavalue . '" readonly') . "\n"; } $result .= $control . ' ' . $description . wf_tag('br'); } else { if (ispos($option, 'CHAPTER_')) { $result .= wf_tag('div', false, '', 'id="tabs-' . $option . '"'); $result .= wf_tag('h2', false); $result .= __($handlers); $result .= wf_tag('h2', true); } if (ispos($option, 'CHAPTEREND_')) { $result .= wf_tag('div', true) . "\n"; } } } else { $result .= wf_tag('div', false, '', 'style="vertical-align: top; margin:5px; padding:5px; "'); $result .= wf_tag('font', false, '', 'style="color: #FF0000; font-size:100%"'); $result .= __('You missed an important option') . ': ' . $option . ''; $configOptionsMissed .= $messages->getStyledMessage(__('You missed an important option') . ': ' . $option, 'error'); $result .= wf_tag('font', true); $result .= wf_tag('div', true); $result .= wf_tag('br'); } } } return $result; }
/** * Renders swpoll logs control * * @global object $ubillingConfig * * @return string */ function web_FDBTableLogControl() { global $ubillingConfig; $messages = new UbillingMessageHelper(); $result = ''; $logPath = 'exports/swpolldata.log'; $logData = array(); $renderData = ''; $rows = ''; $recordsLimit = 200; $prevTime = ''; $curTimeTime = ''; $diffTime = ''; if (file_exists($logPath)) { $billCfg = $ubillingConfig->getBilling(); $tailCmd = $billCfg['TAIL']; $runCmd = $tailCmd . ' -n ' . $recordsLimit . ' ' . $logPath; $rawResult = shell_exec($runCmd); $renderData .= __('Showing') . ' ' . $recordsLimit . ' ' . __('last events') . wf_tag('br'); $renderData .= wf_Link('?module=switchpoller&dlswpolllog=true', wf_img('skins/icon_download.png', __('Download')) . ' ' . __('Download full log'), true); if (!empty($rawResult)) { $logData = explodeRows($rawResult); if (!empty($logData)) { $cells = wf_TableCell(__('Time') . ' (' . __('seconds') . ')'); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Event')); $rows .= wf_TableRow($cells, 'row1'); // $logData = array_reverse($logData); foreach ($logData as $io => $each) { if (!empty($each)) { if (!ispos($each, 'SWPOLLSTART')) { $eachEntry = explode(' ', $each); $curTime = $eachEntry[0] . ' ' . $eachEntry[1]; $curTime = strtotime($curTime); if (!empty($prevTime)) { $diffTime = $curTime - $prevTime; } else { $diffTime = 0; } $prevTime = $eachEntry[0] . ' ' . $eachEntry[1]; $prevTime = strtotime($prevTime); $cells = wf_TableCell($diffTime); $cells .= wf_TableCell($eachEntry[0] . ' ' . $eachEntry[1]); $cells .= wf_TableCell($eachEntry[2]); $cells .= wf_TableCell($eachEntry[3] . ' ' . @$eachEntry[4] . ' ' . @$eachEntry[5]); $rows .= wf_TableRow($cells, 'row3'); } else { $eachEntry = explode(' ', $each); $prevTime = strtotime($eachEntry[0] . ' ' . $eachEntry[1]); } } } $renderData .= wf_TableBody($rows, '100%', 0, 'sortable'); } } else { $renderData .= $messages->getStyledMessage(__('Nothing found'), 'warning'); } $result = wf_modal(wf_img('skins/log_icon_small.png', __('Swpoll log')), __('Swpoll log'), $renderData, '', '800', '600'); } return $result; }
/** * Renders phone data with available controls * * @return string */ public function renderContacts() { $result = ''; $messages = new UbillingMessageHelper(); if (!empty($this->allContacts) or !empty($this->allBuildContacts)) { $cells = wf_TableCell(__('Phone')); $cells .= wf_TableCell(__('Name')); if (cfr('PHONEBOOKEDIT')) { $cells .= wf_TableCell(__('Actions')); } $rows = wf_TableRow($cells, 'row1'); //normal contacts processing if (!empty($this->allContacts)) { foreach ($this->allContacts as $io => $each) { $cells = wf_TableCell($each['phone']); $cells .= wf_TableCell($each['name']); if (cfr('PHONEBOOKEDIT')) { $actLinks = wf_JSAlert(self::URL_ME . '&deletecontactid=' . $io, web_delete_icon(), $messages->getDeleteAlert()); $actLinks .= wf_modalAuto(web_edit_icon(), __('Edit'), $this->editForm($io)); $cells .= wf_TableCell($actLinks); } $rows .= wf_TableRow($cells, 'row3'); } } //build passport contacts processing if (!empty($this->allBuildContacts)) { foreach ($this->allBuildContacts as $io => $each) { $cells = wf_TableCell($each['phone']); $cells .= wf_TableCell($each['name']); if (cfr('PHONEBOOKEDIT')) { $cells .= wf_TableCell(''); } $rows .= wf_TableRow($cells, 'row3'); } } $result .= wf_TableBody($rows, '100%', 0, 'sortable'); } else { $messages = new UbillingMessageHelper(); $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
/** * Renders list of associated friend users for some parent login * * @param string $parentLogin * * @return string */ public function renderFriendsList($parentLogin) { $result = ''; $allRealnames = zb_UserGetAllRealnames(); $allAddress = zb_AddressGetFulladdresslistCached(); $messages = new UbillingMessageHelper(); $friendCount = 0; if (!empty($this->allFriends)) { $cells = wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($this->allFriends as $friendLogin => $parent) { if ($parent == $parentLogin) { $cells = wf_TableCell(wf_Link('?module=userprofile&username='******' ' . $friendLogin)); $cells .= wf_TableCell(@$allRealnames[$friendLogin]); $cells .= wf_TableCell(@$allAddress[$friendLogin]); $actLinks = wf_JSAlert('?module=pl_friendship&username='******'&deletefriend=' . $friendLogin, web_delete_icon(), $messages->getDeleteAlert()); $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row2'); $friendCount++; } } if ($friendCount > 0) { $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $friendCount; } else { $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } } else { $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }