function intSetTariffInfo(&$smarty, $tariff_name, $include_prefixes = True)
{
    $req = new GetTariffInfo($tariff_name, $include_prefixes);
    $resp = $req->sendAndRecv();
    if ($resp->isSuccessful()) {
        $smarty->assign_array($resp->getResult());
    } else {
        $resp->setErrorInSmarty($smarty);
    }
}
Exemple #2
0
function intDownloadPrefixes(&$smarty, $tariff_name, $separator)
{
    $req = new GetTariffInfo($tariff_name, TRUE);
    $resp = $req->sendAndRecv();
    if ($resp->isSuccessful()) {
        $result = $resp->getResult();
        $csv = new CSVGenerator($separator);
        $csv->sendHeader("voip_tariff_{$tariff_name}.csv");
        foreach ($result["prefixes"] as $prefix) {
            $csv->doLine($prefix["prefix_name"], $prefix["prefix_code"], $prefix["cpm"], $prefix["free_seconds"], $prefix["min_duration"], $prefix["round_to"]);
        }
    } else {
        $resp->setErrorInSmarty($smarty);
        intShowTariffInfo($smarty, $tariff_name);
    }
}