예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 /**
  * returns logout dialog localised template
  * 
  * @return string
  */
 protected function createDialog()
 {
     $autoLogoutTimerContainer = wf_tag('div', false, '', 'id="idledialog" title="' . __('Your session is about to expire!') . '"');
     $autoLogoutTimerContainer .= wf_tag('span', false, 'ui-icon ui-icon-alert', 'style="float:left; margin:0 7px 50px 0;"') . wf_tag('span', true);
     $autoLogoutTimerContainer .= __('You will be logged off in') . ' ';
     $autoLogoutTimerContainer .= wf_tag('span', false, '', 'id="dialog-countdown" style="font-weight:bold"') . wf_tag('span', true);
     $autoLogoutTimerContainer .= ' ' . __('seconds') . wf_delimiter();
     $autoLogoutTimerContainer .= wf_tag('center', false) . wf_tag('img', false, '', 'src="skins/idleicon.gif" width="160"') . wf_tag('center', true);
     $autoLogoutTimerContainer .= wf_tag('div', true);
     return $autoLogoutTimerContainer;
 }
예제 #3
0
 function web_AnnihilateFormShow($login)
 {
     $alladdress = zb_AddressGetFulladdresslist();
     $inputs = __('Be careful, this module permanently deletes user and all data associated with it. Opportunities to raise from the dead no longer.');
     $inputs .= wf_tag('br');
     $inputs .= __('To ensure that we have seen the seriousness of your intentions to enter the word сonfirm the field below.');
     $inputs .= wf_tag('br');
     $inputs .= wf_tag('input', false, '', 'type="text" name="confirmation" autocomplete="off"');
     $inputs .= wf_HiddenInput('anihilation', 'true');
     $inputs .= wf_delimiter();
     $inputs .= wf_Submit(__('I really want to stop suffering User'));
     $form = wf_Form('', 'POST', $inputs, 'glamour');
     show_window(__('Deleting user') . ' ' . @$alladdress[$login] . ' (' . $login . ')', $form);
 }
예제 #4
0
 /**
  * Renders search form
  * 
  * @return string
  */
 public function renderSearchInput()
 {
     $result = '';
     if ($this->alterConf['GLOBALSEARCH_ENABLED']) {
         $result .= $this->styles;
         $result .= $this->jsRuntime;
         $result .= wf_tag('input', false, '.ui-autocomplete', 'type="text" id="globalsearch" name="globalsearchquery"' . $this->placeholder);
         $result .= wf_tag('input', false, '', 'type="hidden" id="globalsearch_type" name="globalsearch_type" value="" ');
     } else {
         $result = wf_tag('input', false, '', 'type="text" name="partialaddr"' . $this->placeholder);
     }
     $result .= '';
     return $result;
 }
예제 #5
0
 /**
  * Returns FDB cache lister MAC filters setup form
  * 
  * @return string
  */
 function web_FDBTableFiltersForm()
 {
     $currentFilters = '';
     $oldFilters = zb_StorageGet('FDBCACHEMACFILTERS');
     if (!empty($oldFilters)) {
         $currentFilters = base64_decode($oldFilters);
     }
     $inputs = __('One MAC address per line') . wf_tag('br');
     $inputs .= wf_TextArea('newmacfilters', '', $currentFilters, true, '40x10');
     $inputs .= wf_HiddenInput('setmacfilters', 'true');
     $inputs .= wf_CheckInput('deletemacfilters', __('Cleanup'), true, false);
     $inputs .= wf_Submit(__('Save'));
     $result = wf_Form('', 'POST', $inputs, 'glamour');
     return $result;
 }
예제 #6
0
 function web_UserGenForm()
 {
     $alltariffs_raw = zb_TariffsGetAll();
     $alltariffs = array();
     if (!empty($alltariffs_raw)) {
         foreach ($alltariffs_raw as $it => $eachtariff) {
             $alltariffs[$eachtariff['name']] = $eachtariff['name'];
         }
     }
     $inputs = wf_TextInput('gencount', __('Count of users to generate'), '', true);
     $inputs .= wf_Selector('gentariff', $alltariffs, __('Existing tariff for this users'), '', true);
     $inputs .= multinet_service_selector() . ' ' . __('Service for new users') . wf_tag('br');
     $inputs .= wf_CheckInput('fastsqlgen', __('Fast SQL Inserts - need to shutdown stargazer'), true, false);
     $inputs .= wf_Submit(__('Go!'));
     $result = wf_Form("", "POST", $inputs, 'glamour');
     show_window(__('Sample user generator'), $result);
 }
예제 #7
0
 /**
  * Just demonstration of unstandart widgets usage
  * 
  * @return string
  */
 public function render()
 {
     $angle = rand(160, 280);
     $result = wf_tag('style');
     $result .= 'body.transform {
                  transform:rotate(' . $angle . 'deg);
                  -ms-transform:rotate(' . $angle . 'deg);
                 -webkit-transform:rotate(' . $angle . 'deg);
             }
     ';
     $result .= wf_tag('style', true);
     $result .= wf_tag('script', false, '', '');
     $result .= '
             document.body.className = \'transform\';
             setTimeout(function(){ document.body.className = \'\'; },3000);';
     $result .= wf_tag('script', true);
     return $result;
 }
예제 #8
0
 /**
  * Stores raw login form into private property
  * 
  * @param bool $br
  * @param bool $container
  * 
  * @return void
  */
 protected function loadForm($br, $container)
 {
     $this->breaks = $br;
     $this->container = $container;
     if (file_exists('DEMO_MODE')) {
         $this->loginPreset = 'admin';
         $this->passwordPreset = 'demo';
     }
     if ($this->container) {
         $this->form .= wf_tag('div', false, 'ubLoginContainer');
     }
     $inputs = wf_HiddenInput('login_form', '1');
     $inputs .= wf_TextInput('username', __('Login'), $this->loginPreset, $this->breaks, $this->inputSize);
     $inputs .= wf_PasswordInput('password', __('Password'), $this->passwordPreset, $this->breaks, $this->inputSize);
     $inputs .= wf_Submit(__('Log in'));
     $this->form .= wf_Form("", 'POST', $inputs, 'ubLoginForm');
     if ($this->container) {
         $this->form .= wf_tag('div', true);
     }
 }
예제 #9
0
 function web_SignupsGraphYear($year)
 {
     global $ubillingConfig;
     $altCfg = $ubillingConfig->getAlter();
     $cemeteryEnabled = @$altCfg['CEMETERY_ENABLED'] ? true : false;
     if ($cemeteryEnabled) {
         $cemetery = new Cemetery();
     }
     $year = vf($year);
     $yearcount = zb_SignupsGetCountYear($year);
     $maxsignups = max($yearcount);
     $allmonths = months_array();
     $totalcount = 0;
     $tablecells = wf_TableCell('');
     $tablecells .= wf_TableCell(__('Month'));
     $tablecells .= wf_TableCell(__('Signups'));
     if ($cemeteryEnabled) {
         $tablecells .= wf_TableCell(__('Dead souls'));
         $tablecells .= wf_TableCell('', '10%');
     }
     $tablecells .= wf_TableCell(__('Visual'), '50%');
     $tablerows = wf_TableRow($tablecells, 'row1');
     foreach ($yearcount as $eachmonth => $count) {
         $totalcount = $totalcount + $count;
         $tablecells = wf_TableCell($eachmonth);
         $tablecells .= wf_TableCell(wf_Link('?module=report_signup&month=' . $year . '-' . $eachmonth, rcms_date_localise($allmonths[$eachmonth])));
         $tablecells .= wf_TableCell($count);
         if ($cemeteryEnabled) {
             $deadDateMask = $year . '-' . $eachmonth . '-';
             $deadCount = $cemetery->getDeadDateCount($deadDateMask);
             $deadBar = web_barTariffs($count, $deadCount);
             $tablecells .= wf_TableCell($deadCount);
             $tablecells .= wf_TableCell($deadBar);
         }
         $tablecells .= wf_TableCell(web_bar($count, $maxsignups), '', '', 'sorttable_customkey="' . $count . '"');
         $tablerows .= wf_TableRow($tablecells, 'row3');
     }
     $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
     $result .= wf_tag('b', false) . __('Total') . ': ' . $totalcount . wf_tag('b', true);
     show_window(__('User signups by year') . ' ' . $year, $result);
 }
예제 #10
0
 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;
 }
예제 #11
0
 /**
  * Returns container of succefull UHW usages
  * 
  * @return string
  */
 public function renderUsageList()
 {
     $result = '';
     $result .= wf_tag('table', false, 'display compact', 'id="uhwlisthp"');
     $result .= wf_tag('thead', false);
     $tablecells = wf_TableCell(__('ID'));
     $tablecells .= wf_TableCell(__('Date'));
     $tablecells .= wf_TableCell(__('Password'));
     $tablecells .= wf_TableCell(__('Login'));
     $tablecells .= wf_TableCell(__('Address'));
     $tablecells .= wf_TableCell(__('Real name'));
     $tablecells .= wf_TableCell(__('IP'));
     $tablecells .= wf_TableCell(__('NHID'));
     $tablecells .= wf_TableCell(__('Old MAC'));
     $tablecells .= wf_TableCell(__('New MAC'));
     $result .= wf_TableRow($tablecells);
     $result .= wf_tag('thead', true);
     $result .= wf_tag('table', true);
     $columns = array('ID', 'Date', 'Password', 'Login', 'Address', 'Real name', 'IP', 'NHID', 'Old MAC', 'New MAC');
     $result = wf_JqDtLoader($columns, '?module=uhw&ajax=true', false, 'users', 100);
     return $result;
 }
예제 #12
0
/**
 * Extracts array data for some mac from sn_SnmpParseFdbCacheArray results
 * 
 * @param array $data
 * 
 * @return string
 */
function sn_SnmpParseFdbExtract($data)
{
    $result = '';
    $modalContent = '';
    if (!empty($data)) {
        if (sizeof($data) == 1) {
            foreach ($data as $io => $each) {
                $result .= $each;
            }
        } else {
            foreach ($data as $io => $each) {
                $modalContent .= $each . wf_tag('br');
            }
            $result .= $each . ' ' . wf_modal(wf_img_sized('skins/menuicons/switches.png', __('Switches'), '12', '12'), __('Switches'), $modalContent, '', '600', '400');
        }
    }
    return $result;
}
예제 #13
0
 /**
  * returns some build passport edit form
  * 
  * @praram $buildid existing build id
  * 
  * @return string
  */
 public function renderEditForm($buildid)
 {
     $buildid = vf($buildid, 3);
     if (isset($this->data[$buildid])) {
         $currentData = $this->data[$buildid];
     } else {
         $currentData = array();
     }
     $inputs = wf_HiddenInput('savebuildpassport', $buildid);
     $inputs .= wf_Selector('powner', $this->ownersArr, __('Owner'), @$currentData['owner'], true);
     $inputs .= wf_TextInput('pownername', __('Owner name'), @$currentData['ownername'], true, 30);
     $inputs .= wf_TextInput('pownerphone', __('Owner phone'), @$currentData['ownerphone'], true, 30);
     $inputs .= wf_TextInput('pownercontact', __('Owner contact person'), @$currentData['ownercontact'], true, 30);
     $keys = @$currentData['keys'] == 1 ? true : false;
     $inputs .= wf_CheckInput('pkeys', __('Keys available'), true, $keys);
     $inputs .= wf_TextInput('paccessnotices', __('Build access notices'), @$currentData['accessnotices'], true, 40);
     $inputs .= wf_Selector('pfloors', $this->floorsArr, __('Floors'), @$currentData['floors'], false);
     $inputs .= wf_Selector('pentrances', $this->entrancesArr, __('Entrances'), @$currentData['entrances'], false);
     $inputs .= wf_TextInput('papts', __('Apartments'), @$currentData['apts'], true, 5);
     $inputs .= __('Notes') . wf_tag('br');
     $inputs .= wf_TextArea('pnotes', '', @$currentData['notes'], true, '50x6');
     $inputs .= wf_Submit(__('Save'));
     $result = wf_Form('', 'POST', $inputs, 'glamour');
     return $result;
 }
예제 #14
0
 /**
  * Renders user profile with all loaded data
  * 
  * @return string
  */
 public function render()
 {
     //all configurable features must be received via getters
     $profile = '';
     //activity and other flags
     $passiveicon = $this->userdata['Passive'] ? wf_img_sized('skins/icon_passive.gif', '', '', '12') . ' ' : '';
     $downicon = $this->userdata['Down'] ? wf_img_sized('skins/icon_down.gif', '', '', '12') . ' ' : '';
     $activity = $this->userdata['Cash'] < '-' . $this->userdata['Credit'] ? wf_img_sized('skins/icon_inactive.gif', '', '', '12') . ' ' . __('No') : wf_img_sized('skins/icon_active.gif', '', '', '12') . ' ' . __('Yes');
     // user linking controller
     $profile .= $this->getUserLinking();
     $profile .= wf_tag('table', false, '', self::MAIN_TABLE_STYLE);
     //external profile container
     $profile .= wf_tag('tbody', false);
     $profile .= wf_tag('tr', false);
     $profile .= wf_tag('td', false, '', 'valign="top"');
     $profile .= wf_tag('table', false, '', self::MAIN_TABLE_STYLE);
     //main profile data
     $profile .= wf_tag('tbody', false);
     //address row and controls
     $profile .= $this->addRow(__('Full address') . $this->getTaskCreateControl(), $this->useraddress . $this->getBuildControls());
     //apt data like floor and entrance row
     $profile .= $this->addRow(__('Entrance') . ', ' . __('Floor'), @$this->aptdata['entrance'] . ' ' . @$this->aptdata['floor']);
     //realname row
     $profile .= $this->addRow(__('Real name') . $this->getPhotostorageControls() . $this->getPassportDataControl(), $this->realname, true);
     //contract row
     $profile .= $this->addRow(__('Contract'), $this->contract, false);
     //contract date row
     $profile .= $this->getContractDate();
     //assigned agents row
     $profile .= $this->getAgentsControls();
     //old corporate users aka userlinking
     $profile .= $this->getCorporateControls();
     //phone
     $profile .= $this->addRow(__('Phone'), $this->phone);
     //and mobile data rows
     $profile .= $this->addRow(__('Mobile'), $this->mobile);
     //Email data row
     $profile .= $this->addRow(__('Email'), $this->mail);
     //payment ID data
     $profile .= $this->addRow(__('Payment ID'), $this->paymentid, true);
     //LAT data row
     $profile .= $this->getUserLat();
     //login row
     $profile .= $this->addRow(__('Login'), $this->userdata['login'], true);
     //password row
     $profile .= $this->addRow(__('Password'), $this->getUserPassword(), true);
     //User IP data and extended networks controls if available
     $profile .= $this->addRow(__('IP'), $this->userdata['IP'] . $this->getExtNetsControls(), true);
     //MAC address row
     $profile .= $this->addRow(__('MAC') . ' ' . $this->getSearchmacControl() . ' ' . $this->getProfileFdbSearchControl(), $this->mac);
     //User tariff row
     $profile .= $this->addRow(__('Tariff') . $this->getTariffInfoControls($this->userdata['Tariff']), $this->userdata['Tariff'] . $this->getTariffInfoContrainer(), true);
     //Tariff change row
     $profile .= $this->addRow(__('Planned tariff change') . $this->getTariffInfoControls($this->userdata['TariffChange']), $this->userdata['TariffChange']);
     //old CaTv backlink if needed
     $profile .= $this->getCatvBacklinks();
     //Speed override row
     $profile .= $this->addRow(__('Speed override'), $this->speedoverride);
     // signup pricing row
     $profile .= $this->getSignupPricing();
     //User current cash row
     $profile .= $this->addRow(__('Balance'), $this->getUserCash(), true);
     //User credit row & easycredit control if needed
     $profile .= $this->addRow(__('Credit') . ' ' . $this->getEasyCreditController(), $this->userdata['Credit'], true);
     //credit expire row
     $profile .= $this->addRow(__('Credit expire'), $this->getUserCreditExpire());
     //Prepayed traffic
     $profile .= $this->addRow(__('Prepayed traffic'), $this->userdata['FreeMb']);
     //finance activity row
     $profile .= $this->addRow(__('Active') . $this->getCemeteryControls(), $activity);
     //DN online detection row
     $profile .= $this->getUserOnlineDN();
     //Always online flag row
     $profile .= $this->addRow(__('Always Online'), web_trigger($this->userdata['AlwaysOnline']));
     //Detail stats flag row
     $profile .= $this->addRow(__('Disable detailed stats'), web_trigger($this->userdata['DisabledDetailStat']));
     //Frozen aka passive flag row
     $profile .= $this->addRow(__('Freezed'), $passiveicon . web_trigger($this->userdata['Passive']), true);
     //Disable aka Down flag row
     $profile .= $this->addRow(__('Disabled'), $downicon . web_trigger($this->userdata['Down']), true);
     //Connection details  row
     $profile .= $this->getUserConnectionDetails();
     //User notes row
     $profile .= $this->addRow(__('Notes'), zb_UserGetNotes($this->login) . $this->getAdcommentsIndicator());
     $profile .= wf_tag('tbody', true);
     $profile .= wf_tag('table', true);
     $profile .= wf_tag('td', true);
     //end of main profile container
     $profile .= wf_tag('td', false, '', 'valign="top" width="10%"');
     //profile plugins container
     $profile .= $this->plugins;
     $profile .= wf_tag('td', true);
     // end of plugins container
     $profile .= wf_tag('tr', true);
     // close profile+plugins row
     $profile .= wf_tag('tbody', true);
     $profile .= wf_tag('table', true);
     //end of all profile container
     //profile switch port controls
     $profile .= $this->getSwitchAssignControls();
     //profile onu signal controls
     $profile .= $this->getPonSignalControl();
     //profile vlan controls
     $profile .= $this->getVlanAssignControls();
     //profile vlan online
     $profile .= $this->getVlanOnline();
     //Custom filelds display
     $profile .= cf_FieldShower($this->login);
     //Tags add control and exiting tags listing
     if (cfr('TAGS')) {
         $profile .= wf_Link('?module=usertags&username='******'Tags')), false);
     }
     $profile .= stg_show_user_tags($this->login);
     //main profile controls here
     $profile .= $this->getMainControls();
     //Profile ending anchor for addcash links scroll
     $profile .= wf_tag('a', false, '', 'id="profileending"') . wf_tag('a', true);
     return $profile;
 }
예제 #15
0
 /**
  * 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;
 }
예제 #16
0
 /**
  * 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'));
 }
예제 #17
0
             //cleanup subroutine
             if (wf_CheckGet(array('flushalldead'))) {
                 ub_SwitchesTimeMachineCleanup();
                 rcms_redirect("?module=switches&timemachine=true");
             }
             //calendar view time machine
             if (!wf_CheckPost(array('switchdeadlogsearch'))) {
                 $deadTimeMachine = ub_JGetSwitchDeadLog();
                 $timeMachine = wf_FullCalendar($deadTimeMachine);
             } else {
                 //search processing
                 $timeMachine = ub_SwitchesTimeMachineSearch($_POST['switchdeadlogsearch']);
             }
             $timeMachineCleanupControl = wf_JSAlert('?module=switches&timemachine=true&flushalldead=true', wf_img('skins/icon_cleanup.png', __('Cleanup')), __('Are you serious'));
             //here some searchform
             $timeMachineSearchForm = web_SwitchTimeMachineSearchForm() . wf_tag('br');
             show_window(__('Dead switches time machine') . ' ' . $timeMachineCleanupControl, $timeMachineSearchForm . $timeMachine);
         } else {
             //showing dead switches snapshot
             ub_SwitchesTimeMachineShowSnapshot($_GET['snapshot']);
         }
     }
 } else {
     //editing switch form
     $switchid = vf($_GET['edit'], 3);
     $switchdata = zb_SwitchGetData($switchid);
     //if someone edit switch
     if (wf_CheckPost(array('editmodel'))) {
         if (cfr('SWITCHESEDIT')) {
             simple_update_field('switches', 'modelid', $_POST['editmodel'], "WHERE `id`='" . $switchid . "'");
             simple_update_field('switches', 'ip', $_POST['editip'], "WHERE `id`='" . $switchid . "'");
예제 #18
0
<?php

if (cfr('USERPROFILE')) {
    if (isset($_GET['username'])) {
        $login = vf($_GET['username']);
        $login = trim($login);
        try {
            $profile = new UserProfile($login);
            show_window(__('User profile'), $profile->render());
        } catch (Exception $exception) {
            show_window(__('Error'), __('Strange exeption') . ': ' . wf_tag('pre') . $exception->getMessage() . wf_tag('pre', true));
        }
    } else {
        throw new Exception('GET_NO_USERNAME');
    }
}
예제 #19
0
 /**
  * Shows report editing form
  * 
  * @param string $reportfile
  */
 function web_ReportMasterShowEditForm($reportfile)
 {
     $reports_path = DATA_PATH . "reports/";
     $report_template = rcms_parse_ini_file($reports_path . $reportfile);
     $inputs = wf_TextInput('editreportname', __('Report name'), $report_template['REPORT_NAME'], true, 40);
     $inputs .= wf_TextInput('editsqlquery', __('SQL Query'), $report_template['REPORT_QUERY'], true, 40);
     $inputs .= wf_TextInput('editdatakeys', __('Data keys, separated by comma'), $report_template['REPORT_KEYS'], true, 40);
     $inputs .= wf_TextInput('editfieldnames', __('Field names, separated by comma'), $report_template['REPORT_FIELD_NAMES'], true, 40);
     $inputs .= web_RMTriggerSelector('editaddr', $report_template['REPORT_ADDR']) . ' ' . __('Show full address by login key') . wf_tag('br');
     $inputs .= web_RMTriggerSelector('editrnames', $report_template['REPORT_RNAMES']) . ' ' . __('Show Real Names by login key') . wf_tag('br');
     $inputs .= web_RMTriggerSelector('editrowcount', $report_template['REPORT_ROW_COUNT']) . ' ' . __('Show data query row count') . wf_tag('br');
     $inputs .= wf_Submit(__('Save'));
     $form = wf_Form('', 'POST', $inputs, 'glamour');
     show_window(__('Edit report'), $form);
 }
예제 #20
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;
 }
예제 #21
0
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;
}
예제 #22
0
/**
 * 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 .= '&nbsp;' . 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;
}
예제 #23
0
 /**
  * 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;
 }
예제 #24
0
 /**
  * Retuns connection details edit form
  * 
  * @param string $login
  * @return string
  */
 public function editForm($login)
 {
     $login = mysql_real_escape_string($login);
     $currentData = $this->getByLogin($login);
     $inputs = wf_TextInput('newseal', __('Cable seal'), @$currentData['seal'], true, '40');
     $inputs .= wf_TextInput('newlength', __('Cable length') . ', ' . __('m'), @$currentData['length'], true, '5');
     $inputs .= wf_TextInput('newprice', __('Signup price'), @$currentData['price'], true, '5');
     $inputs .= wf_HiddenInput('editcondet', 'true');
     $inputs .= wf_tag('br');
     $inputs .= wf_Submit(__('Save'));
     $result = wf_Form("", 'POST', $inputs, 'glamour');
     return $result;
 }
예제 #25
0
     if ($_GET['ajax'] == 'connect_edit') {
         $swLogin->SwLoginEditConnForm($_GET['edit']);
     }
 }
 if (!isset($_GET['edit'])) {
     $megaForm = wf_AjaxLoader();
     $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=snmp', 'SNMP', 'megaContainer1', false, 'ubButton');
     $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=connect', 'Connect', 'megaContainer1', false, 'ubButton');
     $megaForm .= wf_tag('div', false, '', 'id="megaContainer1"') . wf_tag('div', true);
     show_window(__("Switches login data"), $megaForm);
     $swLogin->ShowSwAllLogin();
 } else {
     $megaEditForm = wf_AjaxLoader();
     $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=snmp_edit', 'SNMP', 'megaContainer1', false, 'ubButton');
     $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=connect_edit', 'Connect', 'megaContainer1', false, 'ubButton');
     $megaEditForm .= wf_tag('div', false, '', 'id="megaContainer1"') . wf_tag('div', true);
     show_warning(__("Are you sure that you want to change switch login data") . "?");
     show_window(__("Switches login data"), $megaEditForm);
     $back = wf_Link(SwitchLogin::MODULE_URL, __('Back'), false, 'ubButton');
     show_window('', $back);
 }
 if (isset($_POST['add'])) {
     $params = array('swmodel', 'SwMethod');
     if (wf_CheckPost($params)) {
         $model = $_POST['swmodel'];
         $snmpTemplate = $_POST['snmptemplate'];
         $login = $_POST['SwLogin'];
         $pass = $_POST['SwPass'];
         $method = $_POST['SwMethod'];
         $community = $_POST['RwCommunity'];
         $enable = $_POST['Enable'];
예제 #26
0
 /**
  * renders fees report by selected month
  * 
  * @return void
  */
 public function reportFees()
 {
     $allFeesDates_q = "SELECT * from `ukv_fees` ORDER BY `id` DESC;";
     $allFeesDates = simple_queryall($allFeesDates_q);
     $result = '';
     $csvData = '';
     //existing report download
     if (wf_CheckGet(array('downloadfeereport'))) {
         $filenameToDownload = base64_decode($_GET['downloadfeereport']);
         zb_DownloadFile('exports/' . $filenameToDownload, 'docx');
     }
     //render fees list
     $cells = wf_TableCell(__('Month'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($allFeesDates)) {
         foreach ($allFeesDates as $ia => $eachFee) {
             $feeLink = wf_Link(self::URL_REPORTS_MGMT . 'reportFees&showfees=' . $eachFee['yearmonth'], $eachFee['yearmonth'], false);
             $cells = wf_TableCell($feeLink);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result .= wf_TableBody($rows, '30%', '0', 'sortable');
     show_window(__('By date'), $result);
     //render fees by selected month
     if (wf_CheckGet(array('showfees'))) {
         $feesSumm = 0;
         $feesCount = 0;
         $searchFees = mysql_real_escape_string($_GET['showfees']);
         $payments_q = "SELECT * from `ukv_payments` WHERE `date` LIKE '" . $searchFees . "%' AND `note` LIKE 'UKVFEE:%' ORDER BY `id` DESC";
         $allPayments = simple_queryall($payments_q);
         if (!empty($allPayments)) {
             $cells = wf_TableCell(__('ID'));
             $cells .= wf_TableCell(__('Date'));
             $cells .= wf_TableCell(__('Cash'));
             $cells .= wf_TableCell(__('Full address'));
             $cells .= wf_TableCell(__('Real Name'));
             $rowsf = wf_TableRow($cells, 'row1');
             foreach ($allPayments as $io => $eachPayment) {
                 if ($eachPayment['summ'] < 0) {
                     $cells = wf_TableCell($eachPayment['id']);
                     $cells .= wf_TableCell($eachPayment['date']);
                     $cells .= wf_TableCell($eachPayment['summ']);
                     $userLink = wf_Link(self::URL_USERS_PROFILE . $eachPayment['userid'], web_profile_icon() . ' ', false);
                     $userAddress = $this->userGetFullAddress($eachPayment['userid']);
                     $cells .= wf_TableCell($userLink . $userAddress);
                     $userRealName = $this->users[$eachPayment['userid']]['realname'];
                     $cells .= wf_TableCell($userRealName);
                     $rowsf .= wf_TableRow($cells, 'row3');
                     $feesCount++;
                     $feesSumm = $feesSumm + $eachPayment['summ'];
                     $csvData .= $eachPayment['id'] . ';' . $eachPayment['date'] . ';' . $eachPayment['summ'] . ';' . $userAddress . ';' . $userRealName . "\r" . "\n";
                 }
             }
             //saving downloadable report
             $csvSaveName = $searchFees . '_ukvfeesreport.csv';
             $csvData = iconv('utf-8', 'windows-1251', $csvData);
             file_put_contents('exports/' . $csvSaveName, $csvData);
             $downloadLink = wf_Link(self::URL_REPORTS_MGMT . 'reportFees&downloadfeereport=' . base64_encode($csvSaveName), wf_img('skins/excel.gif', __('Download')), false);
             $result = wf_tag('strong') . __('Count') . ': ' . $feesCount;
             $result .= wf_tag('br');
             $result .= __('Money') . ': ' . $feesSumm;
             $result .= wf_tag('strong', true);
             $result .= wf_TableBody($rowsf, '100%', '0', 'sortable');
             show_window(__('Money fees') . ' ' . $searchFees . ' ' . $downloadLink, $result);
         }
     }
 }
예제 #27
0
 /**
  * Renders all-time funeral charts
  * 
  * @return string
  */
 public function renderChart()
 {
     $data = __('Month') . ',' . __('Subscriber is connected') . ',' . __('Subscriber is not connected') . "\n";
     $tmpArr = array();
     $totalCount = 0;
     if (!empty($this->allDead)) {
         foreach ($this->allDead as $io => $each) {
             $time = strtotime($each['date']);
             $month = date("Y-m-d", $time);
             if (isset($tmpArr[$month])) {
                 if ($each['state']) {
                     $tmpArr[$month]['inactive']++;
                 } else {
                     $tmpArr[$month]['active']++;
                 }
                 $totalCount++;
             } else {
                 if ($each['state']) {
                     $tmpArr[$month]['inactive'] = 1;
                     $tmpArr[$month]['active'] = 0;
                 } else {
                     $tmpArr[$month]['active'] = 1;
                     $tmpArr[$month]['inactive'] = 0;
                 }
                 $totalCount++;
             }
         }
     }
     if (!empty($tmpArr)) {
         foreach ($tmpArr as $ia => $each) {
             $data .= $ia . ',' . ($totalCount - $each['active']) . ',' . ($totalCount - $each['inactive']) . "\n";
         }
     }
     $result = wf_tag('div', false, '', '');
     $result .= wf_Graph($data, '800', '300', false) . wf_tag('div', true);
     return $result;
 }
예제 #28
0
/**
 * Renders printable tasks filtered by dates
 * 
 * @param string $datefrom
 * @param string $dateto
 * 
 * @return void
 */
function ts_PrintTasks($datefrom, $dateto)
{
    $datefrom = mysql_real_escape_string($datefrom);
    $dateto = mysql_real_escape_string($dateto);
    $allemployee = ts_GetAllEmployee();
    $alljobtypes = ts_GetAllJobtypes();
    $result = wf_tag('style');
    $result .= '
        table.gridtable {
	font-family: verdana,arial,sans-serif;
	
	font-size:9pt; 
	color:#333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
        }
        table.gridtable th {
	border-width: 1px;
	padding: 3px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
        }
        table.gridtable td {
	border-width: 1px;
	padding: 3px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff; 
        }
        ';
    $result .= wf_tag('style', true);
    $query = "select * from `taskman` where `startdate` BETWEEN '" . $datefrom . " 00:00:00' AND '" . $dateto . " 23:59:59' AND `status`='0'";
    $alltasks = simple_queryall($query);
    if (!empty($alltasks)) {
        foreach ($alltasks as $io => $each) {
            $rows = '';
            $cells = wf_TableCell(__('ID'));
            $cells .= wf_TableCell($each['id']);
            $rows .= wf_TableRow($cells);
            $cells = wf_TableCell(__('Target date'));
            $cells .= wf_TableCell($each['startdate'] . ' ' . @$each['starttime']);
            $rows .= wf_TableRow($cells);
            $cells = wf_TableCell(__('Task address'));
            $cells .= wf_TableCell($each['address']);
            $rows .= wf_TableRow($cells);
            $cells = wf_TableCell(__('Phone'));
            $cells .= wf_TableCell($each['phone']);
            $rows .= wf_TableRow($cells);
            $cells = wf_TableCell(__('Job type'));
            $cells .= wf_TableCell(@$alljobtypes[$each['jobtype']]);
            $rows .= wf_TableRow($cells);
            $cells = wf_TableCell(__('Who should do'));
            $cells .= wf_TableCell(@$allemployee[$each['employee']]);
            $rows .= wf_TableRow($cells);
            $cells = wf_TableCell(__('Job note'));
            $cells .= wf_TableCell($each['jobnote']);
            $rows .= wf_TableRow($cells);
            $tasktable = wf_TableBody($rows, '100%', '0', 'gridtable');
            $result .= wf_tag('div', false, '', 'style="width: 300px; height: 250px; float: left; border: dashed; border-width:1px; margin:5px; page-break-inside: avoid;"');
            $result .= $tasktable;
            $result .= wf_tag('div', true);
        }
        $result .= '<script language="javascript"> 
                        window.print();
                    </script>';
        die($result);
    }
}
예제 #29
0
 public function document_add_form_show($item, $item_id)
 {
     $inputs = wf_HiddenInput(self::FORM_ADD . '[' . $item . '_id]', $item_id);
     $inputs .= wf_TextInput(self::FORM_ADD . '[title]', __('Title'), null, true, '20');
     $inputs .= __('Select document from HDD') . wf_tag('br');
     $inputs .= wf_tag('input', false, '', 'id="fileselector" type="file" name="' . self::FORM_ADD . '[file]"') . wf_tag('br');
     $inputs .= wf_Submit('Upload');
     return bs_UploadFormBody('', 'POST', $inputs, 'glamour');
 }
예제 #30
0
 function zb_AskoziaParseCallHistory($data)
 {
     global $altcfg;
     $normalData = array();
     $callersData = array();
     $data = explodeRows($data);
     if (!empty($data)) {
         foreach ($data as $eachline) {
             $explode = explode(';', $eachline);
             //in 2.2.8 delimiter changed from ," to ;
             if (!empty($eachline)) {
                 $normalData[] = str_replace('"', '', $explode);
             }
         }
     }
     //custom caller options
     if (isset($altcfg['ASKOZIA_CUSTOM'])) {
         if (!empty($altcfg['ASKOZIA_CUSTOM'])) {
             // 0 - internal peers
             // 1 - external gateways
             // 2 - group prefix
             // 3 - parking
             $customCfg = explode(',', $altcfg['ASKOZIA_CUSTOM']);
         } else {
             $customCfg = array();
         }
     } else {
         $customCfg = array();
     }
     if (!empty($normalData)) {
         $totalTime = 0;
         $callsCounter = 0;
         $answerCounter = 0;
         $noAnswerCounter = 0;
         $chartData = array();
         $cells = wf_TableCell('#');
         $cells .= wf_TableCell(__('Time'));
         $cells .= wf_TableCell(__('From'));
         $cells .= wf_TableCell(__('To'));
         $cells .= wf_TableCell(__('Picked up'));
         $cells .= wf_TableCell(__('Type'));
         $cells .= wf_TableCell(__('Status'));
         $cells .= wf_TableCell(__('Talk time'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($normalData as $io => $each) {
             //fix parsing for askozia 2.2.8
             if ($each[0] != 'accountcode') {
                 $callsCounter++;
                 $debugData = wf_tag('pre') . print_r($each, true) . wf_tag('pre', true);
                 $startTime = explode(' ', $each[9]);
                 @($startDate = $startTime[0]);
                 @($startTime = $startTime[1]);
                 @($startHour = date("H:00:00", strtotime($startTime)));
                 $endTime = explode(' ', $each[11]);
                 @($endTime = $endTime[1]);
                 $answerTime = explode(' ', $each[10]);
                 @($answerTime = $answerTime[1]);
                 $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 = '';
                 //detectiong direction icon
                 if (!empty($customCfg)) {
                     if (isset($customCfg[0]) and $customCfg[1]) {
                         if (zb_AskoziaCheckPrefix($customCfg[0], $each[1])) {
                             $callDirection = wf_img('skins/calls/outgoing.png') . ' ';
                         }
                         if (zb_AskoziaCheckPrefix($customCfg[1], $each[1])) {
                             $callDirection = wf_img('skins/calls/incoming.png') . ' ';
                         }
                     }
                 }
                 $cells = wf_TableCell(wf_modal($callsCounter, $callsCounter, $debugData, '', '500', '600'), '', '', 'sorttable_customkey="' . $callsCounter . '"');
                 $cells .= wf_TableCell($callDirection . $sessionTimeStats, '', '', 'sorttable_customkey="' . strtotime($each[9]) . '"');
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($each[1]));
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($each[2]));
                 $receiveCid = '';
                 if (!empty($each[6])) {
                     $tmpRcid = explode('-', $each[6]);
                     @($receiveCid = vf($tmpRcid[0], 3));
                 }
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($receiveCid));
                 $CallType = __('Dial');
                 if (ispos($each[3], 'internal-caller-transfer')) {
                     $CallType = __('Call transfer');
                 }
                 if (ispos($each[7], 'VoiceMail')) {
                     $CallType = __('Voice mail');
                 }
                 $cells .= wf_TableCell($CallType);
                 $callStatus = $each[14];
                 $statusIcon = '';
                 if (ispos($each[14], 'ANSWERED')) {
                     $callStatus = __('Answered');
                     $statusIcon = wf_img('skins/calls/phone_green.png');
                     $answerCounter++;
                     if (isset($chartData[$startDate . ' ' . $startHour]['answered'])) {
                         $chartData[$startDate . ' ' . $startHour]['answered']++;
                     } else {
                         $chartData[$startDate . ' ' . $startHour]['answered'] = 1;
                     }
                 }
                 if (ispos($each[14], 'NO ANSWER')) {
                     $callStatus = __('No answer');
                     $statusIcon = wf_img('skins/calls/phone_red.png');
                     $noAnswerCounter++;
                     if (isset($chartData[$startDate . ' ' . $startHour]['noanswer'])) {
                         $chartData[$startDate . ' ' . $startHour]['noanswer']++;
                     } else {
                         $chartData[$startDate . ' ' . $startHour]['noanswer'] = 1;
                     }
                 }
                 if (ispos($each[14], 'BUSY')) {
                     $callStatus = __('Busy');
                     $statusIcon = wf_img('skins/calls/phone_yellow.png');
                 }
                 if (ispos($each[14], 'FAILED')) {
                     $callStatus = __('Failed');
                     $statusIcon = wf_img('skins/calls/phone_fail.png');
                 }
                 $cells .= wf_TableCell($statusIcon . ' ' . $callStatus);
                 $speekTimeRaw = $each[13];
                 $totalTime = $totalTime + $each[13];
                 $speekTime = zb_AskoziaFormatTime($speekTimeRaw);
                 //current caller stats
                 if (isset($callersData[$each[1]])) {
                     $callersData[$each[1]]['calls'] = $callersData[$each[1]]['calls'] + 1;
                     $callersData[$each[1]]['time'] = $callersData[$each[1]]['time'] + $speekTimeRaw;
                 } else {
                     $callersData[$each[1]]['calls'] = 1;
                     $callersData[$each[1]]['time'] = $speekTimeRaw;
                 }
                 if (isset($callersData[$each[2]])) {
                     $callersData[$each[2]]['calls'] = $callersData[$each[2]]['calls'] + 1;
                     $callersData[$each[2]]['time'] = $callersData[$each[2]]['time'] + $speekTimeRaw;
                 } else {
                     $callersData[$each[2]]['calls'] = 1;
                     $callersData[$each[2]]['time'] = $speekTimeRaw;
                 }
                 if (!empty($receiveCid)) {
                     if (isset($callersData[$receiveCid])) {
                         $callersData[$receiveCid]['calls'] = $callersData[$receiveCid]['calls'] + 1;
                         $callersData[$receiveCid]['time'] = $callersData[$receiveCid]['time'] + $speekTimeRaw;
                     } else {
                         $callersData[$receiveCid]['calls'] = 1;
                         $callersData[$receiveCid]['time'] = $speekTimeRaw;
                     }
                 }
                 $cells .= wf_TableCell($speekTime, '', '', 'sorttable_customkey="' . $each[13] . '"');
                 $rows .= wf_TableRow($cells, 'row3');
             }
         }
         if (!empty($callersData)) {
             if (!empty($customCfg)) {
                 $gcells = wf_TableCell(__('Phone'));
                 $gcells .= wf_TableCell(__('Total calls'));
                 $gcells .= wf_TableCell(__('Time'));
                 $grows = wf_TableRow($gcells, 'row1');
             }
             foreach ($callersData as $cix => $eachcdat) {
                 if (!empty($customCfg)) {
                     if (zb_AskoziaCheckPrefix($customCfg[0], $cix) and strlen($cix) < 4) {
                         $gcells = wf_TableCell(zb_AskoziaGetNumAlias($cix));
                         $gcells .= wf_TableCell($eachcdat['calls']);
                         $gcells .= wf_TableCell(zb_AskoziaFormatTime($eachcdat['time']), '', '', 'sorttable_customkey="' . $eachcdat['time'] . '"');
                         $grows .= wf_TableRow($gcells, 'row3');
                     }
                 }
             }
         }
         //total time stats
         $result = '';
         if (!empty($chartData)) {
             if (sizeof($chartData) >= 2) {
                 $gdata = __('Date') . ',' . __('Total') . ',' . __('Answered') . ',' . __('No answer') . "\n";
                 foreach ($chartData as $io => $each) {
                     @($gdata .= $io . ',' . ($each['answered'] + $each['noanswer']) . ',' . $each['answered'] . ',' . $each['noanswer'] . "\n");
                 }
                 $result .= wf_tag('div', false, '', '');
                 $result .= wf_tag('h2') . __('Stats') . wf_tag('h2', true) . wf_tag('br');
                 $result .= wf_Graph($gdata, '800', '200', false);
                 $result .= wf_tag('div', true);
                 $result .= wf_delimiter();
             }
         }
         $result .= __('Time spent on calls') . ': ' . zb_AskoziaFormatTime($totalTime) . wf_tag('br');
         $result .= __('Answered') . ' / ' . __('No answer') . ': ' . $answerCounter . ' / ' . $noAnswerCounter . wf_tag('br');
         $result .= __('Total calls') . ': ' . $callsCounter;
         if (!empty($customCfg)) {
             @($result .= wf_delimiter() . wf_TableBody($grows, '100%', '0', 'sortable') . wf_delimiter());
         }
         $result .= wf_TableBody($rows, '100%', '0', 'sortable');
         show_window('', $result);
     }
 }