Example #1
0
 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;
 }
Example #2
0
/**
 * 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;
}
Example #3
0
 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;
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 /**
  * 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;
 }
Example #6
0
<?php

if (cfr('SWITCHID')) {
    $altCfg = $ubillingConfig->getAlter();
    if ($altCfg['SWITCHES_EXTENDED']) {
        $messages = new UbillingMessageHelper();
        $result = wf_Link('?module=switches', __('Back'), true, 'ubButton');
        $result .= wf_tag('br');
        $query = "SELECT switches.modelid,switches.ip,switches.id,switches.swid,switches.location,switchmodels.id,switchmodels.modelname " . "FROM switches,switchmodels WHERE switches.modelid=switchmodels.id";
        $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 {
Example #7
0
 /**
  * Returns list of duplicate coords/name items for some existing map
  * 
  * @param int $mapid
  * @return string
  */
 public function renderItemDuplicateList($mapid)
 {
     $mapid = vf($mapid, 3);
     $result = '';
     $messages = new UbillingMessageHelper();
     $itemsCount = 0;
     $filterArray = array();
     if ($this->altCfg['ADCOMMENTS_ENABLED']) {
         $adcomments = new ADcomments('CUSTMAPITEMS');
         $adc = true;
     } else {
         $adc = false;
     }
     //counting unique geo coords
     if (!empty($this->allItems)) {
         foreach ($this->allItems as $ia => $eachItem) {
             if ($eachItem['mapid'] == $mapid) {
                 if (isset($filterArray[$eachItem['geo']])) {
                     $filterArray[$eachItem['geo']]++;
                 } else {
                     $filterArray[$eachItem['geo']] = 1;
                 }
             }
         }
     }
     $result .= wf_Link('?module=custmaps&showitems=' . $mapid, __('Back'), false, 'ubButton');
     $result .= wf_delimiter();
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Type'));
     $cells .= wf_TableCell(__('Geo location'));
     $cells .= wf_TableCell(__('Name'));
     $cells .= wf_TableCell(__('Location'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->allItems)) {
         foreach ($this->allItems as $io => $each) {
             $indicator = $adc ? $adcomments->getCommentsIndicator($each['id']) : '';
             if ($each['mapid'] == $mapid) {
                 if (isset($filterArray[$each['geo']])) {
                     if ($filterArray[$each['geo']] > 1) {
                         $cells = wf_TableCell($each['id']);
                         $cells .= wf_TableCell($this->itemGetTypeName($each['type']));
                         $cells .= wf_TableCell($each['geo']);
                         $cells .= wf_TableCell($each['name']);
                         $cells .= wf_TableCell($each['location']);
                         $actLinks = '';
                         if (cfr('CUSTMAPEDIT')) {
                             $actLinks .= wf_JSAlertStyled('?module=custmaps&deleteitem=' . $each['id'], web_delete_icon(), $messages->getDeleteAlert()) . ' ';
                         }
                         $actLinks .= wf_JSAlertStyled('?module=custmaps&edititem=' . $each['id'], web_edit_icon(), $messages->getEditAlert()) . ' ';
                         $actLinks .= wf_Link('?module=custmaps&showmap=' . $each['mapid'] . '&locateitem=' . $each['geo'] . '&zoom=' . $this->ymapsCfg['FINDING_ZOOM'], wf_img('skins/icon_search_small.gif', __('Find on map')), false) . ' ';
                         $actLinks .= $indicator;
                         $cells .= wf_TableCell($actLinks);
                         $rows .= wf_TableRow($cells, 'row3');
                         $itemsCount++;
                     }
                 }
             }
         }
     }
     $result .= wf_TableBody($rows, '100%', '0', 'sortable');
     $result .= __('Total') . ': ' . $itemsCount;
     return $result;
     return $result;
 }
Example #8
0
 /**
  * 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;
 }
Example #9
0
<?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, '');
Example #10
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);
 }
Example #11
0
 /**
  * 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;
 }
Example #12
0
/**
 * Shows task editing/management form
 * 
 * @global object $ubillingConfig
 * @param int $taskid
 * 
 * @return void
 */
function ts_TaskChangeForm($taskid)
{
    global $ubillingConfig;
    $altercfg = $ubillingConfig->getAlter();
    $taskid = vf($taskid, 3);
    $taskdata = ts_GetTaskData($taskid);
    $result = '';
    $allemployee = ts_GetAllEmployee();
    $activeemployee = ts_GetActiveEmployee();
    $alljobtypes = ts_GetAllJobtypes();
    $messages = new UbillingMessageHelper();
    $smsData = '';
    if (!empty($taskdata)) {
        //not done task
        if (empty($taskdata['login'])) {
            $login_detected = ts_DetectUserByAddress($taskdata['address']);
            if ($login_detected) {
                $addresslink = wf_Link("?module=userprofile&username="******"?module=userprofile&username="******"H:i", strtotime($taskdata['starttime'])) : '';
                $smsJobNote = mysql_real_escape_string($taskdata['jobnote']);
                $smsEmployee = vf($taskdata['employee']);
                $newSmsText = $smsAddress . ' ' . $smsPhone . ' ' . $smsJobNote . $smsJobTime;
                $smsDataCells = wf_TableCell(__('Employee'), '', 'row2');
                $smsDataCells .= wf_TableCell(@$allemployee[$taskdata['employee']]);
                $smsDataRows = wf_TableRow($smsDataCells, 'row3');
                $smsDataCells = wf_TableCell(__('Message'), '', 'row2');
                $smsDataCells .= wf_TableCell(zb_TranslitString($newSmsText));
                $smsDataRows .= wf_TableRow($smsDataCells, 'row3');
                $smsDataTable = wf_TableBody($smsDataRows, '100%', '0', 'glamour');
                $smsInputs = $smsDataTable;
                $smsInputs .= wf_HiddenInput('postsendemployee', $smsEmployee);
                $smsInputs .= wf_HiddenInput('postsendsmstext', $newSmsText);
                $smsInputs .= wf_Submit(__('Send SMS'));
                $smsForm = wf_Form('', 'POST', $smsInputs, '');
                $smsData = wf_modal(wf_img_sized('skins/icon_mobile.gif', __('Send SMS'), '10'), __('Send SMS'), $smsForm, '', '400', '200');
            }
        }
        $tablecells = wf_TableCell(__('ID'), '30%');
        $tablecells .= wf_TableCell($taskdata['id']);
        $tablerows = wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Task creation date') . ' / ' . __('Administrator'));
        $tablecells .= wf_TableCell($taskdata['date'] . ' / ' . $taskdata['admin']);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Target date'));
        $tablecells .= wf_TableCell(wf_tag('strong') . $taskdata['startdate'] . ' ' . $taskdata['starttime'] . wf_tag('strong', true));
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Task address'));
        $tablecells .= wf_TableCell($addresslink);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Login'));
        $tablecells .= wf_TableCell($taskLogin . $loginType);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Phone'));
        $tablecells .= wf_TableCell($taskdata['phone']);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Job type'));
        $tablecells .= wf_TableCell(@$alljobtypes[$taskdata['jobtype']]);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Who should do'));
        $tablecells .= wf_TableCell(@$allemployee[$taskdata['employee']] . ' ' . $smsData);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Job note'));
        $tablecells .= wf_TableCell(nl2br($taskdata['jobnote']));
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $result .= wf_TableBody($tablerows, '100%', '0', 'glamour');
        $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true);
        // show task preview
        show_window(__('View task') . ' ' . $modform, $result);
        //Salary accounting
        if ($altercfg['SALARY_ENABLED']) {
            if (cfr('SALARYTASKSVIEW')) {
                $salary = new Salary();
                show_window(__('Additional jobs done'), $salary->taskJobCreateForm($_GET['edittask']));
            }
        }
        //warehouse integration
        if ($altercfg['WAREHOUSE_ENABLED']) {
            if (cfr('WAREHOUSE')) {
                $warehouse = new Warehouse();
                show_window(__('Additionally spent materials'), $warehouse->taskMaterialsReport($_GET['edittask']));
            }
        }
        //if task undone
        if ($taskdata['status'] == 0) {
            $sup = wf_tag('sup') . '*' . wf_tag('sup', false);
            $inputs = wf_HiddenInput('changetask', $taskid);
            $inputs .= wf_DatePicker('editenddate') . wf_tag('label', false) . __('Finish date') . $sup . wf_tag('label', true) . wf_tag('br');
            $inputs .= wf_tag('br');
            $inputs .= wf_Selector('editemployeedone', $activeemployee, __('Worker done'), $taskdata['employee'], true);
            $inputs .= wf_tag('br');
            $inputs .= wf_tag('label', false) . __('Finish note') . wf_tag('label', true) . wf_tag('br');
            $inputs .= wf_TextArea('editdonenote', '', '', true, '35x3');
            $inputs .= wf_tag('br');
            $inputs .= $jobgencheckbox;
            $inputs .= wf_Submit(__('This task is done'));
            $form = wf_Form("", 'POST', $inputs, 'glamour');
            if (cfr('TASKMANDELETE')) {
                show_window('', wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton'));
            }
            //show editing form
            if (cfr('TASKMANDONE')) {
                show_window(__('If task is done'), $form);
            }
        } else {
            $donecells = wf_TableCell(__('Finish date'), '30%');
            $donecells .= wf_TableCell($taskdata['enddate']);
            $donerows = wf_TableRow($donecells, 'row3');
            $donecells = wf_TableCell(__('Worker done'));
            $donecells .= wf_TableCell($allemployee[$taskdata['employeedone']]);
            $donerows .= wf_TableRow($donecells, 'row3');
            $donecells = wf_TableCell(__('Finish note'));
            $donecells .= wf_TableCell($taskdata['donenote']);
            $donerows .= wf_TableRow($donecells, 'row3');
            $doneresult = wf_TableBody($donerows, '100%', '0', 'glamour');
            if (cfr('TASKMANDELETE')) {
                $doneresult .= wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton');
            }
            if (cfr('TASKMANDONE')) {
                $doneresult .= '&nbsp;';
                $doneresult .= wf_JSAlertStyled('?module=taskman&setundone=' . $taskid, wf_img('skins/icon_key.gif') . ' ' . __('No work was done'), $messages->getEditAlert(), 'ubButton');
            }
            show_window(__('Task is done'), $doneresult);
        }
    }
}
Example #13
0
 /**
  * Returns ONU edit form
  * 
  * @param int $onuId
  * 
  * @return string
  */
 public function onuEditForm($onuId)
 {
     $onuId = vf($onuId, 3);
     $result = '';
     if (isset($this->allOnu[$onuId])) {
         $messages = new UbillingMessageHelper();
         $models = array();
         if (!empty($this->allModelsData)) {
             foreach ($this->allModelsData as $io => $each) {
                 $models[$each['id']] = $each['modelname'];
             }
         }
         $inputs = wf_HiddenInput('editonu', $onuId);
         $inputs .= wf_Selector('editoltid', $this->allOltDevices, __('OLT device') . $this->sup, $this->allOnu[$onuId]['oltid'], true);
         $inputs .= wf_Selector('editonumodelid', $models, __('ONU model') . $this->sup, $this->allOnu[$onuId]['onumodelid'], true);
         $inputs .= wf_TextInput('editip', __('IP'), $this->allOnu[$onuId]['ip'], true, 20);
         $inputs .= wf_TextInput('editmac', __('MAC') . $this->sup . ' ' . $this->getSearchmacControl($this->allOnu[$onuId]['mac']), $this->allOnu[$onuId]['mac'], true, 20);
         $inputs .= wf_TextInput('editserial', __('Serial number'), $this->allOnu[$onuId]['serial'], true, 20);
         $inputs .= wf_TextInput('editlogin', __('Login'), $this->allOnu[$onuId]['login'], true, 20);
         $inputs .= wf_Submit(__('Save'));
         $result = wf_Form('', 'POST', $inputs, 'glamour');
         $result .= wf_CleanDiv();
         $result .= wf_delimiter();
         $result .= wf_Link('?module=ponizer', __('Back'), false, 'ubButton');
         if (!empty($this->allOnu[$onuId]['login'])) {
             $result .= wf_Link('?module=userprofile&username='******'login'], wf_img('skins/icon_user.gif') . ' ' . __('User profile'), false, 'ubButton');
         }
         $result .= wf_JSAlertStyled('?module=ponizer&deleteonu=' . $onuId, web_delete_icon() . ' ' . __('Delete'), $messages->getDeleteAlert(), 'ubButton');
     } else {
         $result = wf_tag('div', false, 'alert_error') . __('Strange exeption') . ': ONUID_NOT_EXISTS' . wf_tag('div', true);
     }
     //Signal history chart
     $result .= $this->onuSignalHistory($onuId);
     //additional comments handling
     if ($this->altCfg['ADCOMMENTS_ENABLED']) {
         $adcomments = new ADcomments('PONONU');
         $result .= wf_delimiter();
         $result .= wf_tag('h3') . __('Additional comments') . wf_tag('h3', true);
         $result .= $adcomments->renderComments($onuId);
     }
     return $result;
 }
Example #14
0
 /**
  * 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);
         }
     }
 }
Example #15
0
/**
 * 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;
}
Example #16
0
 /**
  * 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;
 }
Example #17
0
 /**
  * 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;
 }
Example #18
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'));
 }
Example #19
0
 /**
  * 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;
 }