/** * 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 .= ' '; $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); } } }
/** * Returns switch edit form for some existing device ID * * @param int $switchid * @return string */ function web_SwitchEditForm($switchid) { global $ubillingConfig; $switchid = vf($switchid, 3); $altCfg = $ubillingConfig->getAlter(); $result = ''; $allswitchmodels = zb_SwitchModelsGetAllTag(); $switchdata = zb_SwitchGetData($switchid); $editinputs = wf_Selector('editmodel', $allswitchmodels, 'Model', $switchdata['modelid'], true); $editinputs .= wf_TextInput('editip', 'IP', $switchdata['ip'], true, 20); $editinputs .= wf_TextInput('editlocation', 'Location', $switchdata['location'], true, 30); $editinputs .= wf_TextInput('editdesc', 'Description', $switchdata['desc'], true, 30); $editinputs .= wf_TextInput('editsnmp', 'SNMP community', $switchdata['snmp'], true, 20); $editinputs .= wf_TextInput('editgeo', 'Geo location', $switchdata['geo'], true, 20); $editinputs .= web_SwitchUplinkSelector('editparentid', __('Uplink switch'), $switchdata['parentid']); $editinputs .= wf_tag('br'); $editinputs .= wf_Submit('Save'); $result .= wf_Form('', 'POST', $editinputs, 'glamour'); $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true); $result .= wf_delimiter(); $result .= wf_Link('?module=switches', __('Back'), false, 'ubButton'); if (cfr('SWITCHPOLL')) { $fdbCacheName = 'exports/' . $switchdata['ip'] . '_fdb'; if (file_exists($fdbCacheName)) { $result .= wf_Link('?module=switchpoller&fdbfor=' . $switchdata['ip'], wf_img('skins/menuicons/switchpoller.png') . ' ' . __('Current FDB cache'), false, 'ubButton'); } if (!empty($switchdata['snmp'])) { $result .= wf_Link('?module=switchpoller&switchid=' . $switchid, wf_img('skins/snmp.png') . ' ' . __('SNMP query'), false, 'ubButton'); } } if (!empty($switchdata['ip'])) { $result .= wf_AjaxLink('?module=switches&backgroundicmpping=' . $switchdata['ip'], wf_img('skins/ping_icon.png') . ' ' . __('ICMP ping'), 'icmppingcontainer', false, 'ubButton'); } if (isset($altCfg['SW_WEBNAV'])) { if ($altCfg['SW_WEBNAV']) { $result .= ' ' . wf_tag('a', false, 'ubButton', 'href="http://' . $switchdata['ip'] . '" target="_BLANK"') . wf_img('skins/ymaps/globe.png') . ' ' . __('Go to the web interface') . wf_tag('a', true) . ' '; } } if (cfr('SWITCHEDIT')) { if (!ispos($switchdata['desc'], 'NP')) { $result .= wf_JSAlertStyled('?module=switchreplace&switchid=' . $switchid, wf_img('skins/duplicate_icon.gif') . ' ' . __('Replacement'), __('Are you serious'), 'ubButton') . ' '; } } if (cfr('SWITCHESEDIT')) { $result .= wf_JSAlertStyled('?module=switches&switchdelete=' . $switchid, web_delete_icon() . ' ' . __('Delete'), 'Removing this may lead to irreparable results', 'ubButton'); } if (!empty($switchdata['ip'])) { $result .= wf_AjaxLoader(); $result .= wf_AjaxContainer('icmppingcontainer'); } return $result; }
} $swlinks .= wf_Link('?module=switches&forcereping=true', wf_img('skins/refresh.gif') . ' ' . __('Force ping'), false, 'ubButton'); $swlinks .= wf_Link('?module=switches&timemachine=true', wf_img('skins/time_machine.png') . ' ' . __('Time machine'), false, 'ubButton'); if ($altCfg['SWYMAP_ENABLED']) { $swlinks .= wf_Link('?module=switchmap', wf_img('skins/ymaps/network.png') . ' ' . __('Switches map'), false, 'ubButton'); } if ($altCfg['SWITCH_AUTOCONFIG']) { if (cfr(SwitchLogin::MODULE)) { $swlinks .= wf_Link(SwitchLogin::MODULE_URL, wf_img('skins/sw_login.png') . ' ' . __('Switch login'), false, 'ubButton'); } } //parental switch deletion alternate controls if (isset($_GET['switchdelete'])) { $swlinks = ''; $swlinks .= wf_Link('?module=switches&edit=' . $_GET['switchdelete'], web_edit_icon() . ' ' . __('Edit'), false, 'ubButton') . ' '; $swlinks .= wf_JSAlertStyled('?module=switches&switchdelete=' . $_GET['switchdelete'] . '&forcedel=true', web_delete_icon() . ' ' . __('Force deletion'), __('Removing this may lead to irreparable results'), 'ubButton'); } show_window('', $swlinks); if (!isset($_GET['timemachine'])) { if (!isset($_GET['switchdelete'])) { //display switches list show_window(__('Available switches'), web_SwitchesShow()); } } else { //show dead switch time machine if (!isset($_GET['snapshot'])) { //cleanup subroutine if (wf_CheckGet(array('flushalldead'))) { ub_SwitchesTimeMachineCleanup(); rcms_redirect("?module=switches&timemachine=true"); }
/** * 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; }
/** * 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; }
/** * Renders of available warehouse item types * * @return string */ public function itemtypesRenderList() { $result = ''; $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Category')); $cells .= wf_TableCell(__('Name')); $cells .= wf_TableCell(__('Units')); $cells .= wf_TableCell(__('Reserve')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); $photoStorageEnabled = $this->altCfg['PHOTOSTORAGE_ENABLED'] ? true : false; if (!empty($this->allItemTypes)) { foreach ($this->allItemTypes as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell(@$this->allCategories[$each['categoryid']]); $cells .= wf_TableCell($each['name']); $cells .= wf_TableCell(@$this->unitTypes[$each['unit']]); $cells .= wf_TableCell($each['reserve']); $actLinks = wf_JSAlertStyled(self::URL_ME . '&' . self::URL_ITEMTYPES . '&deleteitemtype=' . $each['id'], web_delete_icon(), $this->messages->getDeleteAlert()); $actLinks .= wf_modalAuto(web_edit_icon(), __('Edit'), $this->itemtypesEditForm($each['id']), ''); if ($photoStorageEnabled) { $photostorageUrl = '?module=photostorage&scope=WAREHOUSEITEMTYPE&itemid=' . $each['id'] . '&mode=list'; $photostorageControl = ' ' . wf_Link($photostorageUrl, wf_img_sized('skins/photostorage.png', __('Upload images'), '16', '16'), false); } else { $photostorageControl = ''; } $actLinks .= $photostorageControl; $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
/** * Renders available employee wages list with some controls * * @return string */ public function employeeWagesRender() { $result = ''; $messages = new UbillingMessageHelper(); $cells = wf_TableCell(__('Employee')); $cells .= wf_TableCell(__('Wage')); $cells .= wf_TableCell(__('Bounty')); $cells .= wf_TableCell(__('Work hours')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->allWages)) { foreach ($this->allWages as $io => $each) { $rowClass = isset($this->allEmployee[$io]) ? 'row3' : 'sigdeleteduser'; $cells = wf_TableCell(@$this->allEmployeeRaw[$io]); $cells .= wf_TableCell($this->allWages[$io]['wage']); $cells .= wf_TableCell($this->allWages[$io]['bounty']); $cells .= wf_TableCell($this->allWages[$io]['worktime']); $actlinks = wf_JSAlertStyled('?module=salary&employeewages=true&deletewage=' . $io, web_delete_icon(), $messages->getDeleteAlert()); $actlinks .= wf_modalAuto(web_edit_icon(), __('Edit'), $this->employeeWageEditForm($io)); $cells .= wf_TableCell($actlinks); $rows .= wf_TableRow($cells, $rowClass); } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); return $result; }
/** * Renders subscribtion management form * * @param int $subId * * @return string */ public function renderSubManagerForm($subId) { $subId = vf($subId, 3); $result = ''; if (isset($this->allSubscribers[$subId])) { $baseUrl = self::URL_ME . '&' . self::URL_SUBVIEW . '&subid=' . $subId; $subData = $this->allSubscribers[$subId]; $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('User')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Active')); $cells .= wf_TableCell(__('Primary')); $cells .= wf_TableCell(__('Free period')); $rows = wf_TableRow($cells, 'row1'); $cells = wf_TableCell($subData['id']); $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $subData['login'])); $cells .= wf_TableCell($this->allTariffs[$subData['tariffid']]['name']); $cells .= wf_TableCell($subData['actdate']); $cells .= wf_TableCell(web_bool_led($subData['active'])); $cells .= wf_TableCell(web_bool_led($subData['primary'])); $cells .= wf_TableCell(web_bool_led($subData['freeperiod'])); $rows .= wf_TableRow($cells, 'row3'); $result = wf_TableBody($rows, '100%', 0, ''); $result .= wf_delimiter(); if (cfr('ROOT')) { $controls = wf_Link($baseUrl . '&maction=subscribe', web_bool_star(1) . ' ' . __('Subscribe with Megogo API'), true, 'ubButton') . wf_tag('br'); $controls .= wf_Link($baseUrl . '&maction=unsubscribe', web_bool_star(0) . ' ' . __('Unubscribe with Megogo API'), true, 'ubButton') . wf_tag('br'); $controls .= wf_Link($baseUrl . '&maction=activate', web_bool_led(1) . ' ' . __('Activate subscription'), true, 'ubButton') . wf_tag('br'); $controls .= wf_Link($baseUrl . '&maction=deactivate', web_bool_led(0) . ' ' . __('Deactivate subscription'), true, 'ubButton') . wf_tag('br'); $controls .= wf_JSAlertStyled($baseUrl . '&maction=delete', web_delete_icon() . ' ' . __('Delete subscription'), $this->messages->getDeleteAlert(), 'ubButton'); $result .= $controls; } } else { $result = $this->messages->getStyledMessage(__('Something went wrong') . ' EX_ID_NOEXISTS', 'error'); } return $result; }