/** * Loads cached address data to private data property * * @return void */ protected function loadAddress() { if ($this->cachedAddress) { $this->alladdress = zb_AddressGetFulladdresslistCached(); } else { $this->alladdress = zb_AddressGetFulladdresslist(); } }
protected function render($creditUserList) { $counter = 0; $allrealnames = zb_UserGetAllRealnames(); $alladdress = zb_AddressGetFulladdresslistCached(); $cells = wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Cash')); $cells .= wf_TableCell(__('Credit')); $cells .= wf_TableCell(__('Credit expire')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Real name')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($creditUserList)) { foreach ($creditUserList as $io => $eachuser) { $cells = wf_TableCell($eachuser['login']); $cells .= wf_TableCell($eachuser['Tariff']); $cells .= wf_TableCell($eachuser['Cash']); $cells .= wf_TableCell($eachuser['Credit']); if ($eachuser['CreditExpire'] != '0') { $expireDate = date("Y-m-d", $eachuser['CreditExpire']); } else { $expireDate = __('Forever and ever'); } $cells .= wf_TableCell($expireDate); $cells .= wf_TableCell(@$alladdress[$eachuser['login']]); $cells .= wf_TableCell(@$allrealnames[$eachuser['login']]); $actlinks = ''; if (cfr('CREDIT')) { $actlinks .= wf_Link('?module=report_creditexpire&fastfix=' . $eachuser['login'], wf_img('skins/icon_repair.gif', __('Fix')), false, ''); } $actlinks .= wf_Link('?module=userprofile&username='******'login'], web_profile_icon(), false, ''); $actlinks .= wf_Link('?module=creditexpireedit&username='******'login'], wf_img('skins/icon_calendar.gif', __('Change') . ' ' . __('Credit expire')), false, ''); $cells .= wf_TableCell($actlinks); $rows .= wf_TableRow($cells, 'row3'); $counter++; } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); $result .= wf_tag('b') . __('Total') . ': ' . $counter . wf_tag('b', true); return $result; }
public function render() { $allAddress = zb_AddressGetFulladdresslistCached(); $allRealNames = zb_UserGetAllRealnames(); $stargazerUsers = zb_UserGetAllStargazerData(); $allUsers = array(); if (!empty($stargazerUsers)) { foreach ($stargazerUsers as $io => $each) { $allUsers[$each['login']] = $each['Credit']; } } $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Cash')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->data)) { foreach ($this->data as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['date']); $loginLink = wf_Link("?module=userprofile&username=" . @$each['login'], web_profile_icon() . ' ' . @$each['login'], false, ''); $cells .= wf_TableCell($loginLink); $cells .= wf_TableCell(@$allAddress[$each['login']]); $cells .= wf_TableCell(@$allRealNames[$each['login']]); $cells .= wf_TableCell(@$each['balance']); //deleded users indication if (@isset($allUsers[$each['login']])) { $rowClass = 'row3'; } else { $rowClass = 'sigdeleteduser'; } $rows .= wf_TableRow($cells, $rowClass); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
$tsms_db = "passed"; $tsms_login = "******"; $tsms_password = $altercfg['TSMS_PASSWORD']; $tsms_table = $tsms_login; $tsms_prefix = $altercfg['TSMS_PHONEPREFIX']; $tsms_phone_key = $altercfg['TSMS_PHONE_KEY']; $tsms_msg_key = $altercfg['TSMS_MESSAGE_KEY']; //loading ubilling database $td_realnames = zb_UserGetAllRealnames(); $td_realnamestrans = tsms_RealnamesTranslit($td_realnames); $td_tariffprices = zb_TariffGetPricesAll(); $td_tariffperiods = zb_TariffGetPeriodsAll(); $td_curdate = curdate(); $td_users = tsms_UserGetAllStargazerData(); $td_mobiles = tsms_GetAllMobileNumbers(); $td_alladdress = zb_AddressGetFulladdresslistCached(); $td_allpayids = tsms_PaymentIDGetAll(); function tsms_query($query) { global $tsms_host, $tsms_db, $tsms_login, $tsms_password, $tsms_table; log_register("TSMS REQ" . $tsms_host . '?' . $query . '&' . $tsms_password); $r = file_get_contents($tsms_host . '?' . $query . '&' . $tsms_password); log_register("TSMS RESP" . $r); $result = array(); return $result; } function tsms_CheckMobile($num) { if (strlen($num) > 11) { return true; } else {
/** * Returns partial address search form * * @global object $ubillingConfig * @return string */ function web_UserSearchAddressPartialForm() { global $ubillingConfig; $alterconf = $ubillingConfig->getAlter(); if ($alterconf['SEARCHADDR_AUTOCOMPLETE']) { $alladdress = zb_AddressGetFulladdresslistCached(); natsort($alladdress); $inputs = wf_AutocompleteTextInput('partialaddr', $alladdress, '', '', false, 30); } else { $inputs = wf_TextInput('partialaddr', '', '', false, 30); } $inputs .= wf_Submit('Search'); $result = wf_Form('', 'POST', $inputs, '', ''); return $result; }
/** * Renders tickets calendar view widget * * @return string */ function web_TicketsCalendar() { $curyear = curyear(); $query = "SELECT * from `ticketing` WHERE `to` IS NULL AND `replyid` IS NULL AND `date` LIKE '" . $curyear . "-%' ORDER BY `date` ASC"; $all = simple_queryall($query); $allAddress = zb_AddressGetFulladdresslistCached(); $result = ''; $calendarData = ''; if (!empty($all)) { foreach ($all as $io => $each) { $timestamp = strtotime($each['date']); $date = date("Y, n-1, j", $timestamp); $rawTime = date("H:i:s", $timestamp); if ($each['status'] == 0) { $coloring = "className : 'undone',"; } else { $coloring = ''; } $calendarData .= "\n {\n title: '" . $rawTime . ' ' . @$allAddress[$each['from']] . "',\n url: '?module=ticketing&showticket=" . $each['id'] . "',\n start: new Date(" . $date . "),\n end: new Date(" . $date . "),\n " . $coloring . " \n },\n "; } } $result = wf_FullCalendar($calendarData); return $result; }
/** * Returns JSON for actual ARP table * * @return string */ public function ajaxReplyArp() { $result = ''; $command = 'arp -a'; $raw = shell_exec($command); $jsonAAData = array(); if (!empty($raw)) { $allUserAddress = zb_AddressGetFulladdresslistCached(); $allUserIps = zb_UserGetAllIPs(); $allUserIps = array_flip($allUserIps); $allSwitchesIps = $this->getAllSwitchesIps(); $raw = explodeRows($raw); if (!empty($raw)) { foreach ($raw as $io => $each) { if (!empty($each)) { $ip = zb_ExtractIpAddress($each); $mac = zb_ExtractMacAddress($each); $hostType = $this->getHostLink($allUserIps, $allUserAddress, $allSwitchesIps, $ip); $jsonItem = array(); $jsonItem[] = $ip; $jsonItem[] = $mac; $jsonItem[] = $hostType; $jsonAAData[] = $jsonItem; } } } } $result = array("aaData" => $jsonAAData); return json_encode($result); }
/** * extracts data from agentPring cache for future export in CSV * * @param int $agentid Existing agent ID in database * * @return void */ public function exportCSV2($agentid) { $tmpArr = array(); $result = ''; $shortAddres = zb_AddressGetFulladdresslistCached(); if (!empty($this->altcfg)) { $altercfg = $this->altcfg; } else { global $ubillingConfig; $this->altcfg = $ubillingConfig->getAlter(); $altercfg = $this->altcfg; } if (file_exists(self::EXPORT_PATH . 'report_agentfinance.prindataraw')) { $rawData = file_get_contents(self::EXPORT_PATH . 'report_agentfinance.prindataraw'); $tmpArr = unserialize($rawData); $allservicenames = zb_VservicesGetAllNamesLabeled(); $this->loadUserRealnames(); $this->loadCashTypes(); if (!empty($tmpArr)) { if (isset($tmpArr[$agentid])) { if (!empty($tmpArr[$agentid])) { //CSV header $result .= __('Date') . ';' . __('Cash') . ';' . __('Full address') . ';' . __('Real Name') . ';' . __('Notes') . "\n"; //CSV data foreach ($tmpArr[$agentid] as $io => $each) { $summ = str_replace('.', ',', $each['summ']); //need for normal summ in excel $timeStamp = strtotime($each['date']); $newDate = date("Y-m-d", $timeStamp); $result .= $newDate . ';' . $summ . ';' . @$shortAddres[$each['login']] . ';' . @$this->userRealnames[$each['login']] . ';' . zb_TranslatePaymentNote($each['note'], $allservicenames) . "\n"; } } } } } $saveCsvName = self::EXPORT_PATH . 'report_agentfinance_' . $agentid . '_' . zb_rand_string(8) . '.csv'; $result = iconv('utf-8', 'windows-1251', $result); file_put_contents($saveCsvName, $result); zb_DownloadFile($saveCsvName, 'csv'); die; }
/** * Loads users address list into protected property * * @return void */ protected function loadAddress() { $this->allAddress = zb_AddressGetFulladdresslistCached(); }
/** * Renders list of strict login=>agent assigns with some controls * * @return string */ function web_AgentAssignStrictShow() { $allassigns = zb_AgentAssignStrictGetAllData(); $allahens = zb_ContrAhentGetAllData(); $allrealnames = zb_UserGetAllRealnames(); $alladdress = zb_AddressGetFulladdresslistCached(); $allusertariffs = zb_TariffsGetAllUsers(); $agentnames = array(); if (!empty($allahens)) { foreach ($allahens as $io => $eachahen) { $agentnames[$eachahen['id']] = $eachahen['contrname']; } } $cells = wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Contrahent name')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allassigns)) { foreach ($allassigns as $eachlogin => $eachagent) { $loginLink = wf_Link('?module=userprofile&username='******' ' . $eachlogin, false, ''); $cells = wf_TableCell($loginLink); $cells .= wf_TableCell(@$alladdress[$eachlogin]); $cells .= wf_TableCell(@$allrealnames[$eachlogin]); $cells .= wf_TableCell(@$allusertariffs[$eachlogin]); $cells .= wf_TableCell(@$agentnames[$eachagent]); $actLinks = wf_JSAlert('?module=contractedit&username='******'Are you serious')); $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
/** * Returns user array in table view * * @global object $ubillingConfig * @param array $usersarr * @return string */ function web_UserArrayShower($usersarr) { global $ubillingConfig; $alterconf = $ubillingConfig->getAlter(); if (!empty($usersarr)) { $alladdress = zb_AddressGetFulladdresslistCached(); $allrealnames = zb_UserGetAllRealnames(); $alltariffs = zb_TariffsGetAllUsers(); $allusercash = zb_CashGetAllUsers(); $allusercredits = zb_CreditGetAllUsers(); $alluserips = zb_UserGetAllIPs(); if ($alterconf['ONLINE_LAT']) { $alluserlat = zb_LatGetAllUsers(); } //additional finance links if ($alterconf['FAST_CASH_LINK']) { $fastcash = true; } else { $fastcash = false; } $tablecells = wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Address')); $tablecells .= wf_TableCell(__('Real Name')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Tariff')); // last activity time if ($alterconf['ONLINE_LAT']) { $tablecells .= wf_TableCell(__('LAT')); } $tablecells .= wf_TableCell(__('Active')); //online detect if ($alterconf['DN_ONLINE_DETECT']) { $tablecells .= wf_TableCell(__('Users online')); } $tablecells .= wf_TableCell(__('Balance')); $tablecells .= wf_TableCell(__('Credit')); $tablerows = wf_TableRow($tablecells, 'row1'); foreach ($usersarr as $eachlogin) { @($usercash = $allusercash[$eachlogin]); @($usercredit = $allusercredits[$eachlogin]); //finance check $activity = web_green_led(); $activity_flag = 1; if ($usercash < '-' . $usercredit) { $activity = web_red_led(); $activity_flag = 0; } //fast cash link if ($fastcash) { $financelink = wf_Link('?module=addcash&username='******'skins/icon_dollar.gif', __('Finance operations')), false, ''); } else { $financelink = ''; } $profilelink = $financelink . wf_Link('?module=userprofile&username='******' ' . $eachlogin); $tablecells = wf_TableCell($profilelink); $tablecells .= wf_TableCell(@$alladdress[$eachlogin]); $tablecells .= wf_TableCell(@$allrealnames[$eachlogin]); $tablecells .= wf_TableCell(@$alluserips[$eachlogin], '', '', 'sorttable_customkey="' . ip2int(@$alluserips[$eachlogin]) . '"'); $tablecells .= wf_TableCell(@$alltariffs[$eachlogin]); if ($alterconf['ONLINE_LAT']) { if (isset($alluserlat[$eachlogin])) { $cUserLat = date("Y-m-d H:i:s", $alluserlat[$eachlogin]); } else { $cUserLat = __('No'); } $tablecells .= wf_TableCell($cUserLat); } $tablecells .= wf_TableCell($activity, '', '', 'sorttable_customkey="' . $activity_flag . '"'); if ($alterconf['DN_ONLINE_DETECT']) { if (file_exists(DATA_PATH . 'dn/' . $eachlogin)) { $online_flag = 1; } else { $online_flag = 0; } $tablecells .= wf_TableCell(web_bool_star($online_flag), '', '', 'sorttable_customkey="' . $online_flag . '"'); } $tablecells .= wf_TableCell($usercash); $tablecells .= wf_TableCell($usercredit); $tablerows .= wf_TableRow($tablecells, 'row3'); } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); $result .= wf_tag('b') . __('Total') . ': ' . wf_tag('b', true) . sizeof($usersarr); } else { $result = __('Any users found'); } return $result; }
public function renderAntiDebtors($cutdata = false) { $alladdress = zb_AddressGetFulladdresslistCached(); $allrealnames = zb_UserGetAllRealnames(); $userCounter = 0; $cells = ''; if (!$cutdata) { $cells .= wf_TableCell(__('Login')); } $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Cash')); $cells .= wf_TableCell(__('Credit')); $cells .= wf_TableCell(__('Contract')); $cells .= wf_TableCell(__('Service active')); $rows = wf_TableRow($cells, 'row1'); if (!empty($this->data)) { foreach ($this->data as $io => $each) { if ($each['Cash'] >= '-' . $each['Credit'] and @$this->actives[$each['login']] != 1 and $each['Passive'] != 1) { $cells = ''; if (!$cutdata) { $profileLink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login'], false, ''); $cells = wf_TableCell($profileLink); } $cells .= wf_TableCell(@$alladdress[$each['login']]); $cells .= wf_TableCell(@$allrealnames[$each['login']]); $cells .= wf_TableCell($each['IP']); $cells .= wf_TableCell($each['Tariff']); $cells .= wf_TableCell($each['Cash']); $cells .= wf_TableCell($each['Credit']); $cells .= wf_TableCell(@$this->contracts[$each['login']]); $actFlag = web_bool_led(@$this->actives[$each['login']], true); if ($cutdata) { $actFlag = strip_tags($actFlag); } $cells .= wf_TableCell($actFlag, '', '', 'sorttable_customkey="' . @$this->actives[$each['login']] . '"'); $rows .= wf_TableRow($cells, 'row3'); $userCounter++; } } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); $result .= __('Total') . ': ' . $userCounter; return $result; }
/** * Renders ajax data subscriptions * * @return void */ public function subscribtionsListAjax() { $allAddress = zb_AddressGetFulladdresslistCached(); $allRealNames = zb_UserGetAllRealnames(); $allBalance = zb_UserGetAllBalance(); $result = '{ "aaData": [ '; if (!empty($this->allSubscribers)) { foreach ($this->allSubscribers as $io => $each) { $userLink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . @$allAddress[$each['login']], false); $userLink = $this->jqDtFilter($userLink); @($userRealName = $this->jqDtFilter($allRealNames[$each['login']])); $actFlag = $this->jqDtFilter(web_bool_led($each['active'], false)); $primFlag = $this->jqDtFilter(web_bool_led($each['primary'], false)); $freeperiodFlag = $this->jqDtFilter(web_bool_led($each['freeperiod'], false)); $actLinks = wf_Link(self::URL_ME . '&' . self::URL_SUBVIEW . '&subid=' . $each['id'], wf_img('skins/icon_edit.gif')); $actLinks = $this->jqDtFilter($actLinks); @($userCash = $this->jqDtFilter($allBalance[$each['login']])); $result .= ' [ "' . $each['id'] . '", "' . $userLink . '", "' . $userRealName . '", "' . $userCash . '", "' . @$this->allTariffs[$each['tariffid']]['name'] . '", "' . $each['actdate'] . '", "' . $actFlag . '", "' . $primFlag . '", "' . $freeperiodFlag . '", "' . $actLinks . '" ],'; } } $result = zb_CutEnd($result); $result .= '] }'; die($result); }
/** * Renders json data for large databases. Not using json_encode & manual json assembly to minimaze execution time. * * @global array $alter_conf * * @return string */ function zb_AjaxOnlineDataSourceFast() { global $alter_conf; $query = "SELECT * from `users`"; $query_fio = "SELECT * from `realname`"; $allusers = simple_queryall($query); $allfioz = simple_queryall($query_fio); $fioz = zb_UserGetAllRealnames(); $detect_address = zb_AddressGetFulladdresslistCached(); $ucount = 0; $deadUsers = array(); //alternate view of online module $addrDelimiter = ''; if (isset($alter_conf['ONLINE_ALTERNATE_VIEW'])) { if ($alter_conf['ONLINE_ALTERNATE_VIEW']) { $addrDelimiter = wf_tag('br'); } } //hide dead users array if ($alter_conf['DEAD_HIDE']) { if (!empty($alter_conf['DEAD_TAGID'])) { $tagDead = vf($alter_conf['DEAD_TAGID'], 3); $query_dead = "SELECT `login`,`tagid` from `tags` WHERE `tagid`='" . $tagDead . "'"; $alldead = simple_queryall($query_dead); if (!empty($alldead)) { foreach ($alldead as $idead => $eachDead) { $deadUsers[$eachDead['login']] = $eachDead['tagid']; } } } } $result = '{'; $result .= ' "aaData": [ '; if (!empty($allusers)) { $totalusers = sizeof($allusers); foreach ($allusers as $io => $eachuser) { $tinet = 0; $ucount++; $cash = $eachuser['Cash']; $credit = $eachuser['Credit']; for ($classcounter = 0; $classcounter <= 9; $classcounter++) { $dc = 'D' . $classcounter . ''; $uc = 'U' . $classcounter . ''; $tinet = $tinet + ($eachuser[$dc] + $eachuser[$uc]); } $act = '<img src=skins/icon_active.gif>' . __('Yes'); //finance check if ($cash < '-' . $credit) { $act = '<img src=skins/icon_inactive.gif>' . __('No'); } //online activity check if ($alter_conf['DN_ONLINE_DETECT']) { $onlineFlag = '"<img src=skins/icon_nostar.gif> ' . __('No') . '",'; if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) { $onlineFlag = '"<img src=skins/icon_star.gif> ' . __('Yes') . '",'; } } else { $onlineFlag = ''; } @($clearuseraddress = $detect_address[$eachuser['login']]); $clearuseraddress = trim($clearuseraddress); $clearuseraddress = str_replace("'", '`', $clearuseraddress); $clearuseraddress = mysql_real_escape_string($clearuseraddress); //additional finance links if ($alter_conf['FAST_CASH_LINK']) { $fastcashlink = ' <a href=?module=addcash&username='******'login'] . '#profileending><img src=skins/icon_dollar.gif border=0></a> '; } else { $fastcashlink = ''; } if (!$alter_conf['DEAD_HIDE']) { $result .= ' [ "<a href=?module=traffstats&username='******'login'] . '><img src=skins/icon_stats.gif border=0 title=' . __('Stats') . '></a> <a href=?module=userprofile&username='******'login'] . '><img src=skins/icon_user.gif border=0 title=' . __('Profile') . '></a> ' . $fastcashlink . $addrDelimiter . $clearuseraddress . '", "' . @mysql_real_escape_string(trim($fioz[$eachuser['login']])) . '", "' . $eachuser['IP'] . '", "' . $eachuser['Tariff'] . '", "' . $act . '", ' . $onlineFlag . ' "' . zb_TraffToGb($tinet) . '", "' . round($eachuser['Cash'], 2) . '", "' . round($eachuser['Credit'], 2) . '" ],'; } else { if (!isset($deadUsers[$eachuser['login']])) { $result .= ' [ "<a href=?module=traffstats&username='******'login'] . '><img src=skins/icon_stats.gif border=0 title=' . __('Stats') . '></a> <a href=?module=userprofile&username='******'login'] . '><img src=skins/icon_user.gif border=0 title=' . __('Profile') . '></a> ' . $fastcashlink . $clearuseraddress . '", "' . @mysql_real_escape_string(trim($fioz[$eachuser['login']])) . '", "' . $eachuser['IP'] . '", "' . $eachuser['Tariff'] . '", "' . $act . '", ' . $onlineFlag . ' "' . zb_TraffToGb($tinet) . '", "' . round($eachuser['Cash'], 2) . '", "' . round($eachuser['Credit'], 2) . '" ],'; } } } } $result = substr($result, 0, -1); $result .= ' ] } '; return $result; }
/** * Renders list of associated friend users for some parent login * * @param string $parentLogin * * @return string */ public function renderFriendsList($parentLogin) { $result = ''; $allRealnames = zb_UserGetAllRealnames(); $allAddress = zb_AddressGetFulladdresslistCached(); $messages = new UbillingMessageHelper(); $friendCount = 0; if (!empty($this->allFriends)) { $cells = wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($this->allFriends as $friendLogin => $parent) { if ($parent == $parentLogin) { $cells = wf_TableCell(wf_Link('?module=userprofile&username='******' ' . $friendLogin)); $cells .= wf_TableCell(@$allRealnames[$friendLogin]); $cells .= wf_TableCell(@$allAddress[$friendLogin]); $actLinks = wf_JSAlert('?module=pl_friendship&username='******'&deletefriend=' . $friendLogin, web_delete_icon(), $messages->getDeleteAlert()); $cells .= wf_TableCell($actLinks); $rows .= wf_TableRow($cells, 'row2'); $friendCount++; } } if ($friendCount > 0) { $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $friendCount; } else { $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } } else { $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
/** * Renders previously generated all users as fullcalendar widget * * @return string */ public function renderAllUserDocumentsCalendar() { $allAddress = zb_AddressGetFulladdresslistCached(); $calendarData = ''; $yearDocuments = $this->getAllUsersDocumentsThisYear(); if (!empty($yearDocuments)) { foreach ($yearDocuments as $io => $each) { $timestamp = strtotime($each['date']); $date = date("Y, n-1, j", $timestamp); $rawTime = date("H:i:s", $timestamp); $calendarData .= "\n {\n title: '" . $rawTime . ' ' . @$allAddress[$each['login']] . "',\n url: '?module=userprofile&username="******"',\n start: new Date(" . $date . "),\n end: new Date(" . $date . "),\n },\n "; } } $result = wf_FullCalendar($calendarData); return $result; }
/** * Returns task editing form * * @global object $ubillingConfig * @param int $taskid * @return string */ function ts_TaskModifyForm($taskid) { global $ubillingConfig; $altercfg = $ubillingConfig->getAlter(); $taskid = vf($taskid, 3); $taskdata = ts_GetTaskData($taskid); $result = ''; $allemployee = ts_GetAllEmployee(); $activeemployee = ts_GetActiveEmployee(); $alljobtypes = ts_GetAllJobtypes(); if (!empty($taskdata)) { $inputs = wf_HiddenInput('modifytask', $taskid); $inputs .= '<!--ugly hack to prevent datepicker autoopen --> <input type="text" name="shittyhackmod" style="width: 0; height: 0; top: -100px; position: absolute;"/>'; if (cfr('TASKMANDATE')) { $inputs .= wf_DatePickerPreset('modifystartdate', $taskdata['startdate']); } else { $inputs .= wf_HiddenInput('modifystartdate', $taskdata['startdate']); } $inputs .= wf_TimePickerPreset('modifystarttime', $taskdata['starttime'], '', false); $inputs .= wf_tag('label') . __('Target date') . wf_tag('sup') . '*' . wf_tag('sup', true) . wf_tag('label', true); $inputs .= wf_delimiter(); $inputs .= wf_tag('br'); if ($altercfg['SEARCHADDR_AUTOCOMPLETE']) { $alladdress = zb_AddressGetFulladdresslistCached(); natsort($alladdress); $inputs .= wf_AutocompleteTextInput('modifytaskaddress', $alladdress, __('Address') . '<sup>*</sup>', $taskdata['address'], true, '30'); } else { $inputs .= wf_TextInput('modifytaskaddress', __('Address') . '<sup>*</sup>', $taskdata['address'], true, '30'); } $inputs .= wf_tag('br'); //custom login text input $inputs .= wf_TextInput('modifytasklogin', __('Login'), $taskdata['login'], true, 30); $inputs .= wf_tag('br'); $inputs .= wf_TextInput('modifytaskphone', __('Phone') . '<sup>*</sup>', $taskdata['phone'], true, '30'); $inputs .= wf_tag('br'); $inputs .= wf_Selector('modifytaskjobtype', $alljobtypes, __('Job type'), $taskdata['jobtype'], true); $inputs .= wf_tag('br'); $inputs .= wf_Selector('modifytaskemployee', $activeemployee, __('Who should do'), $taskdata['employee'], true); $inputs .= wf_tag('br'); $inputs .= wf_tag('label') . __('Job note') . wf_tag('label', true) . wf_tag('br'); $inputs .= wf_TextArea('modifytaskjobnote', '', $taskdata['jobnote'], true, '35x5'); $inputs .= wf_Submit(__('Save')); $result = wf_Form("", 'POST', $inputs, 'glamour'); $result .= __('All fields marked with an asterisk are mandatory'); } return $result; }
/** * Renders json formatted data for jquery data tables list * * @return string */ public function ajaxOnuData() { $allRealnames = zb_UserGetAllRealnames(); $allAddress = zb_AddressGetFulladdresslistCached(); if ($this->altCfg['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('PONONU'); $adc = true; } else { $adc = false; } $this->loadSignalsCache(); $result = '{ "aaData": [ '; if (!empty($this->allOnu)) { foreach ($this->allOnu as $io => $each) { if (!empty($each['login'])) { $userLogin = trim($each['login']); $userLink = wf_Link('?module=userprofile&username='******' ' . @$allAddress[$userLogin], false); $userLink = str_replace('"', '', $userLink); $userLink = trim($userLink); @($userRealName = $allRealnames[$userLogin]); $userRealName = str_replace('"', '', $userRealName); $userRealName = trim($userRealName); } else { $userLink = ''; $userRealName = ''; } //checking adcomments availability if ($adc) { $indicatorIcon = $adcomments->getCommentsIndicator($each['id']); $indicatorIcon = str_replace('"', '\'', $indicatorIcon); $indicatorIcon = trim($indicatorIcon); } else { $indicatorIcon = ''; } $actLinks = wf_Link('?module=ponizer&editonu=' . $each['id'], web_edit_icon(), false); $actLinks = str_replace('"', '', $actLinks); $actLinks = trim($actLinks); $actLinks .= ' ' . $indicatorIcon; //coloring signal if (isset($this->signalCache[$each['mac']])) { $signal = $this->signalCache[$each['mac']]; if ($signal > 0 or $signal < -25) { $sigColor = '#ab0000'; } else { $sigColor = '#005502'; } } elseif (isset($this->signalCache[$each['serial']])) { $signal = $this->signalCache[$each['serial']]; if ($signal > 0 or $signal < -25) { $sigColor = '#ab0000'; } else { $sigColor = '#005502'; } } else { $signal = __('No'); $sigColor = '#000000'; } $result .= ' [ "' . $each['id'] . '", "' . $this->getModelName($each['onumodelid']) . '", "' . @$this->allOltDevices[$each['oltid']] . '", "' . $each['ip'] . '", "' . $each['mac'] . '", "<font color=' . $sigColor . '>' . $signal . '</font>", "' . $userLink . '", "' . $userRealName . '", "' . $actLinks . '" ],'; } } $result = substr($result, 0, -1); $result .= '] }'; return $result; }
/** * Processing of task creation in profile feature * * @return string */ protected function getTaskCreateControl() { //profile task creation icon if ($this->alterCfg['CREATETASK_IN_PROFILE']) { $fulladdresslist = zb_AddressGetFulladdresslistCached(); @($shortAddress = $fulladdresslist[$this->login]); $createForm = ts_TaskCreateFormProfile($shortAddress, $this->mobile, $this->phone, $this->login); $result = wf_modal(wf_img('skins/createtask.gif', __('Create task')), __('Create task'), $createForm, '', '450', '540'); } else { $result = ''; } return $result; }
/** * Renders complex users assign forms or something like that. * * @return void */ public function reportComplexAssign() { $nologinUsers = array(); $ukvContracts = array(); $inetContracts = array(); $contractCfId = ''; //updating inet login if required if (wf_CheckPost(array('assignComplexLogin', 'assignComplexUkvId'))) { $updateUserId = vf($_POST['assignComplexUkvId'], 3); $updateInetLogin = $_POST['assignComplexLogin']; if ($this->users[$updateUserId]['inetlogin'] != $updateInetLogin) { simple_update_field('ukv_users', 'inetlogin', $updateInetLogin, "WHERE `id`='" . $updateUserId . "';"); log_register('UKV USER ((' . $updateUserId . ')) ASSIGN INETLOGIN `' . $updateInetLogin . '`'); rcms_redirect(self::URL_REPORTS_MGMT . 'reportComplexAssign'); } } $allInetUsers = zb_UserGetAllStargazerDataAssoc(); $allAddress = zb_AddressGetFulladdresslistCached(); $allRealNames = zb_UserGetAllRealnames(); //preparing ukv users if (!empty($this->users)) { foreach ($this->users as $io => $each) { if (empty($each['inetlogin'])) { $nologinUsers[$each['id']] = $each; $ukvContracts[$each['contract']] = $each['id']; } } } //getting complex contract CF id if (!empty($this->altCfg['COMPLEX_CFIDS'])) { $cfDataRaw = $this->altCfg['COMPLEX_CFIDS']; $cfData = explode(',', $cfDataRaw); $contractCfId = isset($cfData[0]) ? vf($cfData[0], 3) : ''; } //prepare cf logins=>contract pairs if (!empty($contractCfId)) { $query = "SELECT `login`,`content` from `cfitems` WHERE `typeid`='" . $contractCfId . "' AND `content` IS NOT NULL;"; $rawCfs = simple_queryall($query); if (!empty($rawCfs)) { foreach ($rawCfs as $io => $each) { $inetContracts[$each['login']] = $each['content']; } } } //rendering main form if (!empty($inetContracts)) { $cells = wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Contract')); $cells .= wf_TableCell(__('Login')); $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); foreach ($inetContracts as $login => $contract) { if (isset($allInetUsers[$login])) { if (!empty($contract)) { @($ukvUserId = $ukvContracts[$contract]); if (!empty($ukvUserId)) { if (isset($nologinUsers[$ukvUserId])) { $ukvRealname = @$this->users[$ukvUserId]['realname']; $inetRealname = @$allRealNames[$login]; $ukvAddress = $this->userGetFullAddress($ukvUserId); $inetAddress = @$allAddress[$login]; $catvLink = wf_link(self::URL_USERS_PROFILE . $ukvUserId, web_profile_icon() . ' ' . $ukvAddress); $cells = wf_TableCell($catvLink); $cells .= wf_TableCell($ukvRealname); $cells .= wf_TableCell(@$this->tariffs[$this->users[$ukvUserId]['tariffid']]['tariffname']); $cells .= wf_TableCell($contract); $profileLink = wf_Link('?module=userprofile&username='******' ' . $login, false); $cells .= wf_TableCell($profileLink); $cells .= wf_TableCell($inetAddress); $cells .= wf_TableCell($inetRealname); $assignInputs = wf_HiddenInput('assignComplexLogin', $login); $assignInputs .= wf_HiddenInput('assignComplexUkvId', $ukvUserId); $assignInputs .= wf_Submit(__('Assign')); $assignContols = wf_Form('', 'POST', $assignInputs, ''); $cells .= wf_TableCell($assignContols); $rowclass = 'row3'; //coloring results if (!empty($ukvRealname) and !empty($inetRealname)) { $ukvNameTmp = explode(' ', $ukvRealname); $inetNameTmp = explode(' ', $inetRealname); if (@$ukvNameTmp[0] == @$inetNameTmp[0]) { $rowclass = 'ukvassignnamerow'; } if (!empty($inetAddress) and !empty($ukvAddress)) { if ($inetAddress == $ukvAddress and @$ukvNameTmp[0] == @$inetNameTmp[0]) { $rowclass = 'ukvassignaddrrow'; } } } $rows .= wf_TableRow($cells, $rowclass); } } } } } $result = wf_TableBody($rows, '100%', 0, 'sortable'); show_window(__('Assign UKV users to complex profiles'), $result); } }