Ejemplo n.º 1
0
    function stg_show_fulluserlistOld()
    {
        global $alter_conf;
        $allusers = zb_UserGetAllStargazerData();
        $allrealnames = zb_UserGetAllRealnames();
        $alladdress = zb_AddressGetFulladdresslist();
        if ($alter_conf['USER_LINKING_ENABLED']) {
            $alllinkedusers = cu_GetAllLinkedUsers();
            $allparentusers = cu_GetAllParentUsers();
        }
        $totaltraff_i = 0;
        $totaltraff_m = 0;
        $totaltraff = 0;
        $ucount = 0;
        $trueonline = 0;
        $inacacount = 0;
        $tcredit = 0;
        $tcash = 0;
        // LAT column
        if ($alter_conf['ONLINE_LAT']) {
            $lat_col_head = wf_TableCell(__('LAT'));
            $act_offset = 1;
        } else {
            $lat_col_head = '';
            $act_offset = 0;
        }
        //online stars
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_header = wf_TableCell(__('Users online'));
            $true_online_selector = ' col_' . (5 + $act_offset) . ': "select",';
        } else {
            $true_online_header = '';
            $true_online_selector = '';
        }
        //extended filters
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $extfilters = wf_Link('javascript:showfilter();', __('Extended filters'), false);
        } else {
            $extfilters = '';
        }
        //additional finance links
        if ($alter_conf['FAST_CASH_LINK']) {
            $fastcash = true;
        } else {
            $fastcash = false;
        }
        $result = $extfilters;
        $result .= wf_tag('table', false, 'sortable', 'width="100%" id="onlineusers"');
        $headerCells = wf_TableCell(__('Full address'));
        $headerCells .= wf_TableCell(__('Real Name'));
        $headerCells .= wf_TableCell(__('IP'));
        $headerCells .= wf_TableCell(__('Tariff'));
        $headerCells .= $lat_col_head;
        $headerCells .= wf_TableCell(__('Active'));
        $headerCells .= $true_online_header;
        $headerCells .= wf_TableCell(__('Traffic'));
        $headerCells .= wf_TableCell(__('Balance'));
        $headerCells .= wf_TableCell(__('Credit'));
        $headerRow = wf_TableRow($headerCells, 'row1');
        $result .= $headerRow;
        if (!empty($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]);
                }
                $totaltraff = $totaltraff + $tinet;
                $tcredit = $tcredit + $credit;
                $tcash = $tcash + $cash;
                $act = web_green_led() . ' ' . __('Yes');
                //finance check
                if ($cash < '-' . $credit) {
                    $act = web_red_led() . ' ' . __('No');
                    $inacacount++;
                }
                if ($alter_conf['ONLINE_LAT']) {
                    $user_lat = wf_TableCell(date("Y-m-d H:i:s", $eachuser['LastActivityTime']));
                } else {
                    $user_lat = '';
                }
                //online check
                if ($alter_conf['DN_ONLINE_DETECT']) {
                    if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) {
                        $online_flag = 1;
                        $trueonline++;
                    } else {
                        $online_flag = 0;
                    }
                    $online_cell = wf_TableCell(web_bool_star($online_flag, true), '', '', 'sorttable_customkey="' . $online_flag . '"');
                } else {
                    $online_cell = '';
                    $online_flag = 0;
                }
                if ($alter_conf['ONLINE_LIGHTER']) {
                    $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
                } else {
                    $lighter = '';
                }
                //user linking indicator
                if ($alter_conf['USER_LINKING_ENABLED']) {
                    //is user child?
                    if (isset($alllinkedusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $alllinkedusers[$eachuser['login']], web_corporate_icon(), false);
                    } else {
                        $corporate = '';
                    }
                    //is  user parent?
                    if (isset($allparentusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $allparentusers[$eachuser['login']], web_corporate_icon('Corporate parent'), false);
                    }
                } else {
                    $corporate = '';
                }
                //fast cash link
                if ($fastcash) {
                    $financelink = wf_Link('?module=addcash&username='******'login'] . '#profileending', wf_img('skins/icon_dollar.gif', __('Finance operations')), false);
                } else {
                    $financelink = '';
                }
                $result .= wf_tag('tr', false, 'row3', $lighter);
                $result .= wf_tag('td', false);
                $result .= wf_Link('?module=traffstats&username='******'login'], web_stats_icon(), false);
                $result .= $financelink;
                $result .= wf_Link('?module=userprofile&username='******'login'], web_profile_icon(), false);
                $result .= $corporate;
                $result .= @$alladdress[$eachuser['login']];
                $result .= wf_tag('td', true);
                $result .= wf_TableCell(@$allrealnames[$eachuser['login']]);
                $result .= wf_TableCell($eachuser['IP'], '', '', 'sorttable_customkey="' . ip2int($eachuser['IP']) . '"');
                $result .= wf_TableCell($eachuser['Tariff']);
                $result .= $user_lat;
                $result .= wf_TableCell($act);
                $result .= $online_cell;
                $result .= wf_TableCell(stg_convert_size($tinet), '', '', 'sorttable_customkey="' . $tinet . '"');
                $result .= wf_TableCell(round($eachuser['Cash'], 2));
                $result .= wf_TableCell(round($eachuser['Credit'], 2));
                $result .= wf_tag('tr', true);
            }
        }
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_counter = wf_TableCell(__('Users online') . ' ' . $trueonline);
        } else {
            $true_online_counter = null;
        }
        $result .= wf_tag('table', true);
        $footerCells = wf_TableCell(__('Total') . ': ' . $ucount);
        $footerCells .= wf_TableCell(__('Active users') . ' ' . ($ucount - $inacacount) . ' / ' . __('Inactive users') . ' ' . $inacacount);
        $footerCells .= $true_online_counter;
        $footerCells .= wf_TableCell(__('Traffic') . ': ' . stg_convert_size($totaltraff));
        $footerCells .= wf_TableCell(__('Total') . ': ' . round($tcash, 2));
        $footerCells .= wf_TableCell(__('Credit total') . ': ' . $tcredit);
        $footerRows = wf_TableRow($footerCells, 'row1');
        $result .= wf_TableBody($footerRows, '100%', '0');
        //extended filters again
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $filtercode = wf_tag('script', false, '', 'language="javascript" type="text/javascript"');
            $filtercode .= '
            //<![CDATA[
            function showfilter() {
            var onlinefilters = {
		btn: false,
          	col_' . (4 + $act_offset) . ': "select",
               ' . $true_online_selector . '
		btn_text: ">"
               }
                setFilterGrid("onlineusers",0,onlinefilters);
             }
            //]]>';
            $filtercode .= wf_tag('script', true);
        } else {
            $filtercode = '';
        }
        $result .= $filtercode;
        return $result;
    }
Ejemplo n.º 2
0
 /**
  * Generates HTML-table, containing existing lines
  * 
  * @return  string  HTML-table
  */
 public function line_list_show()
 {
     // Query lines:
     $query = "SELECT\n                     `" . self::TABLE_LINES . "`.`id`,\n                     `" . self::TABLE_LINES . "`.`point_start`,\n                     `" . self::TABLE_LINES . "`.`point_end`,\n                     `" . self::TABLE_LINES . "`.`fibers_amount`,\n                     `" . self::TABLE_LINES . "`.`length`,\n                     `" . self::TABLE_LINES . "`.`description`,\n                     `employee`.`name` AS `engineer`,\n                     `" . self::TABLE_LINES . "`.`param_color`,\n                     `" . self::TABLE_LINES . "`.`geo`\n                FROM `" . self::TABLE_LINES . "`\n           LEFT JOIN `employee`\n                  ON `" . self::TABLE_LINES . "`.`employee_id` = `employee`.id\n            ";
     $result = simple_queryall($query);
     // HTML-table header:
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Starting point'));
     $cells .= wf_TableCell(__('End point'));
     $cells .= wf_TableCell(__('Fibers amount'), 75);
     $cells .= wf_TableCell(__('Length'), 100);
     $cells .= wf_TableCell(__('Description'), 350);
     $cells .= wf_TableCell(__('Engineer'));
     $cells .= wf_TableCell(__('Color'), 60);
     $cells .= wf_TableCell(__('Actions'), 80);
     $rows = wf_TableRow($cells, 'row2');
     // HTML-table content:
     if (!empty($result)) {
         foreach ($result as $line) {
             // Color decoration:
             $line['param_color'] = '<span style="color: ' . $line['param_color'] . '">' . $line['param_color'] . '</span>';
             $cells = wf_TableCell($line['id']);
             $cells .= wf_TableCell($line['point_start']);
             $cells .= wf_TableCell($line['point_end']);
             $cells .= wf_TableCell($line['fibers_amount']);
             $cells .= wf_TableCell($line['length']);
             $cells .= wf_TableCell($line['description']);
             $cells .= wf_TableCell($line['engineer']);
             $cells .= wf_TableCell($line['param_color']);
             // Actions:
             $actions = wf_Link(self::URL_LINE_DEL . $line['id'], web_delete_icon());
             $actions .= wf_Link(self::URL_LINE_EDIT . $line['id'], web_edit_icon());
             $actions .= wf_Link(self::URL_LINE_DOCS . $line['id'], web_corporate_icon('Documentation'));
             if (empty($line['geo']) || $line['geo'] == '[  ]') {
                 $actions .= wf_Link(self::URL_LINE_PLACE . $line['id'], web_add_icon(__('Place on map')));
             }
             $cells .= wf_TableCell($actions);
             $rows .= wf_TableRow($cells, 'row3');
         }
     } else {
         $cells = wf_TableCell(__('There is no lines to show'), null, null, 'colspan="9" align="center"');
         $rows .= wf_TableRow($cells, 'row3');
     }
     // Generate HTML-table:
     return wf_TableBody($rows, '100%', '0');
 }
Ejemplo n.º 3
0
function bs_ShowHash($hash)
{
    $hash = vf($hash);
    $allrealnames = zb_UserGetAllRealnames();
    $alladdress = zb_AddressGetFulladdresslist();
    $checkarr = bs_SearchCheckArr($alladdress, $allrealnames);
    $alter_conf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini');
    $query = "SELECT * from `bankstaparsed` WHERE `hash`='" . $hash . "' ORDER BY `id` DESC";
    $alldata = simple_queryall($query);
    // проверяем врублены ли корпоративные пользователи
    if ($alter_conf['USER_LINKING_ENABLED']) {
        $alllinkedusers = cu_GetAllLinkedUsers();
        $allparentusers = cu_GetAllParentUsers();
    }
    if (!empty($alldata)) {
        $tablecells = wf_TableCell(__('ID'));
        $tablecells .= wf_TableCell(__('Real Name'));
        $tablecells .= wf_TableCell(__('Address'));
        $tablecells .= wf_TableCell(__('Cash'));
        $tablecells .= wf_TableCell(__('Login poroposal'));
        $tablecells .= wf_TableCell(__('Processed'));
        $tablecells .= wf_TableCell(__('Actions'));
        $tablerows = wf_TableRow($tablecells, 'row1');
        foreach ($alldata as $io => $eachrow) {
            $tablecells = wf_TableCell($eachrow['id']);
            $tablecells .= wf_TableCell(bs_NameEditForm($eachrow['id'], $eachrow['realname']));
            $tablecells .= wf_TableCell(bs_AddressEditForm($eachrow['id'], $eachrow['address']));
            $tablecells .= wf_TableCell($eachrow['summ']);
            //proposal subroutine
            if (empty($eachrow['login'])) {
                $proposed_login = bs_SearchLoginByAddresspart($eachrow['address'], $eachrow['realname'], $checkarr);
                //if no one found
                if (sizeof($proposed_login) == 0) {
                    $proposal_form = bs_LoginProposalForm($eachrow['id'], '');
                }
                //if only one user found
                if (sizeof($proposed_login) == 1) {
                    $proposal_form = bs_LoginProposalForm($eachrow['id'], $proposed_login[0]);
                    //заполним со старта что-ли
                    simple_update_field('bankstaparsed', 'login', $proposed_login[0], "WHERE `id`='" . $eachrow['id'] . "'");
                }
                //if many users found
                if (sizeof($proposed_login) > 1) {
                    //считаем что это корпоративный пользователь и достаем для него родительского
                    if ($alter_conf['USER_LINKING_ENABLED']) {
                        foreach ($proposed_login as $eachcorp) {
                            if (bs_cu_IsParent($eachcorp, $allparentusers)) {
                                $proposal_form = web_corporate_icon() . ' ' . $eachcorp;
                                //заполним родительского пользователя
                                simple_update_field('bankstaparsed', 'login', $eachcorp, "WHERE `id`='" . $eachrow['id'] . "'");
                            }
                        }
                    } else {
                        // если корпоративщина не включена - вываливаем екзепшн
                        $proposal_form = __('Multiple users found');
                    }
                }
            } else {
                $proposal_form = bs_LoginProposalForm($eachrow['id'], $eachrow['login']);
            }
            $tablecells .= wf_TableCell($proposal_form);
            $procflag = web_bool_led($eachrow['state']);
            if (!$eachrow['state']) {
                $actlink = wf_JSAlert("?module=bankstatements&lockrow=" . $eachrow['id'] . "&showhash=" . $eachrow['hash'], web_key_icon('Lock'), __('Are you serious'));
            } else {
                $actlink = '';
            }
            $tablecells .= wf_TableCell($procflag);
            $tablecells .= wf_TableCell($actlink);
            $tablerows .= wf_TableRow($tablecells, 'row3');
        }
        $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
    } else {
        $result = __('Strange exeption catched');
    }
    show_window('', wf_Link("?module=bankstatements", 'Back', true, 'ubButton'));
    show_window(__('Bank statement processing'), $result);
}