/** * Loads existing tariffs from database * * @return void */ protected function loadTariffs() { $raw = zb_TariffsGetAll(); if (!empty($raw)) { foreach ($raw as $io => $each) { $this->allTariffs[$each['name']] = $each['name']; } } }
function web_UserGenForm() { $alltariffs_raw = zb_TariffsGetAll(); $alltariffs = array(); if (!empty($alltariffs_raw)) { foreach ($alltariffs_raw as $it => $eachtariff) { $alltariffs[$eachtariff['name']] = $eachtariff['name']; } } $inputs = wf_TextInput('gencount', __('Count of users to generate'), '', true); $inputs .= wf_Selector('gentariff', $alltariffs, __('Existing tariff for this users'), '', true); $inputs .= multinet_service_selector() . ' ' . __('Service for new users') . wf_tag('br'); $inputs .= wf_CheckInput('fastsqlgen', __('Fast SQL Inserts - need to shutdown stargazer'), true, false); $inputs .= wf_Submit(__('Go!')); $result = wf_Form("", "POST", $inputs, 'glamour'); show_window(__('Sample user generator'), $result); }
/** * Shows signup tariffs popularity chart * * @return void */ function web_SignupGraph() { if (!wf_CheckGet(array('month'))) { $cmonth = curmonth(); } else { $cmonth = mysql_real_escape_string($_GET['month']); } $where = "WHERE `date` LIKE '" . $cmonth . "%'"; $alltariffnames = zb_TariffsGetAll(); $tariffusers = zb_TariffsGetAllUsers(); $allsignups = zb_SignupsGet($where); $tcount = array(); if (!empty($allsignups)) { foreach ($alltariffnames as $io => $eachtariff) { foreach ($allsignups as $ii => $eachsignup) { if (@$tariffusers[$eachsignup['login']] == $eachtariff['name']) { @($tcount[$eachtariff['name']] = $tcount[$eachtariff['name']] + 1); } } } } $tablecells = wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Count')); $tablecells .= wf_TableCell(__('Visual')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($tcount)) { foreach ($tcount as $sigtariff => $eachcount) { $tablecells = wf_TableCell($sigtariff); $tablecells .= wf_TableCell($eachcount); $tablecells .= wf_TableCell(web_bar($eachcount, sizeof($allsignups)), '', '', 'sorttable_customkey="' . $eachcount . '"'); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); show_window(__('Tariffs report'), $result); }
function web_TsmsMassendForm() { $tariffsRaw = zb_TariffsGetAll(); $alltariffs = array(); if (!empty($tariffsRaw)) { foreach ($tariffsRaw as $io => $each) { $alltariffs[$each['name']] = $each['name']; } } $inputs = wf_RadioInput('msendtype', __('Debtors with balance less then 0'), 'msenddebtors', true, true); $inputs .= wf_RadioInput('msendtype', __('Users who have money left for 5 days'), 'msendless5', true, false); $inputs .= wf_RadioInput('msendtype', __('Users who have zero balance'), 'msendzero', true, false); $inputs .= wf_RadioInput('msendtype', __('All users with mobile'), 'msendall', true, false); $inputs .= wf_RadioInput('msendtype', __('All users with tariff'), 'msendtariff', false, false); $inputs .= wf_Selector('msendtariffname', $alltariffs, '', '', true); $inputs .= wf_Submit(__('Search')); $result = wf_Form("", "POST", $inputs, 'glamour'); return $result; }
/** * Tariff selector for Express box */ function web_ExpressTariffSelector($fieldname = 'tariffsel', $current = '') { $alltariffs = zb_TariffsGetAll(); $selector = '<select name="' . $fieldname . '">'; if (!empty($alltariffs)) { foreach ($alltariffs as $io => $eachtariff) { if ($current != $eachtariff['name']) { $selected = ''; } else { $selected = 'SELECTED'; } $selector .= '<option value="' . $eachtariff['name'] . '" ' . $selected . '>' . $eachtariff['name'] . '</option>'; } } $selector .= '</select>'; return $selector; }
/** * Returns available tariffs selector excluding already lousy * * @param string $fieldname * @return string */ function web_LousyTariffSelector($fieldname = 'tariffsel') { $alltariffs = zb_TariffsGetAll(); $options = array(); if (!empty($alltariffs)) { $allLousy = zb_LousyTariffGetAll(); foreach ($alltariffs as $io => $eachtariff) { if (!isset($allLousy[$eachtariff['name']])) { $options[$eachtariff['name']] = $eachtariff['name']; } } } $selector = wf_Selector($fieldname, $options, '', '', false); return $selector; }
/** * Returns alive/dead user counts on each tariff * * @return array */ function zb_TariffGetLiveCount() { $allusers = zb_UserGetAllStargazerData(); $alltariffs = zb_TariffsGetAll(); $result = array(); //fill array with some tariff entries if (!empty($alltariffs)) { foreach ($alltariffs as $io => $eachtariff) { $result[$eachtariff['name']]['alive'] = 0; $result[$eachtariff['name']]['dead'] = 0; } } //count users for each tariff if (!empty($allusers)) { foreach ($allusers as $ia => $eachlogin) { if (isset($result[$eachlogin['Tariff']])) { if ($eachlogin['Cash'] >= '-' . $eachlogin['Credit']) { $result[$eachlogin['Tariff']]['alive'] = $result[$eachlogin['Tariff']]['alive'] + 1; } else { $result[$eachlogin['Tariff']]['dead'] = $result[$eachlogin['Tariff']]['dead'] + 1; } } } } return $result; }