当前位置: 首页>>代码示例>>PHP>>正文


PHP A2Billing::instance方法代码示例

本文整理汇总了PHP中A2Billing::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP A2Billing::instance方法的具体用法?PHP A2Billing::instance怎么用?PHP A2Billing::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在A2Billing的用法示例。


在下文中一共展示了A2Billing::instance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 function init($sA2Billing = null)
 {
     if ($sA2Billing) {
         $this->a2billing =& $sA2Billing;
     } else {
         $this->a2billing =& A2Billing::instance();
     }
     if (isset($GLOBALS['FG_DEBUG'])) {
         $this->FG_DEBUG = $GLOBALS['FG_DEBUG'];
     }
     // Fill a local array with dirty versions of data..
     if (!$this->prefix) {
         $this->_dirty_vars = array_merge($_GET, $_POST);
     } else {
         $tmp_arr = array_merge($_GET, $_POST);
         $tlen = strlen($this->prefix);
         $this->_dirty_vars = array();
         // Find vars matching prefix and strip that!
         foreach ($tmp_arr as $key => $data) {
             if (strncmp($this->prefix, $key, $tlen) == 0) {
                 $this->_dirty_vars[substr($key, $tlen)] = $data;
             }
         }
     }
     // set action, for a start:
     $this->action = $this->getpost_single('action');
     if ($this->action == null) {
         $this->action = $this->action_ask;
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:30,代码来源:Class.ActionElem.inc.php

示例2: init

 function init($sA2Billing = null, $stdActions = true)
 {
     if (!$this->rights_checked) {
         error_log("Attempt to use Callshop w/o rights!");
         die;
     }
     if ($sA2Billing) {
         $this->a2billing =& $sA2Billing;
     } else {
         $this->a2billing =& A2Billing::instance();
     }
     if (isset($GLOBALS['FG_DEBUG'])) {
         $this->FG_DEBUG = $GLOBALS['FG_DEBUG'];
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:15,代码来源:Class.CallShop.inc.php

示例3: detailQueryField

 public function detailQueryField(&$dbhandle)
 {
     if ($this->fieldexpr) {
         $fld = $this->fieldexpr;
     } else {
         $fld = $this->fieldname;
     }
     return "format_currency2({$fld}, '" . A2Billing::instance()->currency . "') AS " . $this->fieldname;
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:9,代码来源:Class.NumField.inc.php

示例4: define

// $files = $cli_args['input'];
//
// if (empty($files)){
// 	echo "No file specified!\n";
// 	exit(1);
// }
//
// $res= fopen($files[0],'r');
// if (!$res){
// 	echo "Could not open ".$files[0]." .\n";
// 	exit(2);
// }
define('DEBUG_CONF', 1);
$host = A2Billing::instance()->set_def_conf($manager_section, 'host', 'localhost');
$uname = A2Billing::instance()->set_def_conf($manager_section, 'username', 'a2billing');
$password = A2Billing::instance()->set_def_conf($manager_section, 'secret', '');
if ($verbose > 2) {
    echo "Starting manager-eventd.\n";
}
$num_tries = 0;
while ($num_tries < 10) {
    $num_tries++;
    $dbh = A2Billing::DBHandle();
    if (!$dbh) {
        echo "Cannot connect to database, exiting..";
        break;
    }
    $as = new AGI_AsteriskManager();
    if ($verbose < 2) {
        $as->nolog = true;
    } else {
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:manager-eventd.php

示例5: define

    if (!empty($cli_args['verbose']) || !empty($cli_args['v'])) {
        $verbose = 2;
    } else {
        if (!empty($cli_args['silent']) || !empty($cli_args['q'])) {
            $verbose = 0;
        }
    }
}
// print_r ($cli_args);
// echo "verbose = $verbose - startdate=$startdate\n ";
if (!empty($cli_args['config'])) {
    define('DEFAULT_A2BILLING_CONFIG', $cli_args['config']);
}
// Get the periods
$proc_periods = $cli_args['input'];
$A2B = A2Billing::instance();
$dbhandle = $A2B->DBHandle();
$back_days = 15;
$amount_cdr = 100;
$cdr_per_day = intval($amount_cdr / $back_days);
$cardid = 3;
$destination = 'Italy';
$calledstation = '397821933244';
for ($i = 1; $i <= $back_days; $i++) {
    echo "Day : {$i}...\n";
    for ($j = 1; $j <= $cdr_per_day; $j++) {
        $maxhour = sprintf("%02d", rand(0, 23));
        $minhour = sprintf("%02d", rand(0, 23));
        if ($maxhour < $minhour) {
            $temp = $maxhour;
            $maxhour = $minhour;
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:generate-cdr.php

示例6: BoothsDom

function BoothsDom($action, $actb, $agent_clause = 'AND false')
{
    global $FG_DEBUG;
    $dbhandle =& A2Billing::instance()->DBHandle();
    // Prepare the XML DOM structure
    $dom = new DOMDocument("1.0", "utf-8");
    // $_SESSION["pr_login"];
    $dom_root = $dom->createElement("root");
    $dom->appendChild($dom_root);
    $dom_message = $dom->createElement("message");
    $dom_root->appendChild($dom_message);
    if (!empty($agent_clause)) {
        $aclause = ' AND ' . $agent_clause;
    } else {
        $aclause = '';
    }
    $booth_states = array();
    $booth_states[0] = array(_("N/A"), _("Not available, no cards configured."));
    $booth_states[1] = array(_("Empty"), _("No customer attached."));
    $booth_states[2] = array(_("Idle"), _("Customer attached, inactive"));
    $booth_states[3] = array(_("Ready"), _("Waiting for calls"));
    $booth_states[4] = array(_("Active"), _("Calls made, charged"));
    $booth_states[5] = array(_("Disabled"), _("Disabled by the agent"));
    $booth_states[6] = array(_("Stopped"), _("Calls made, charged, stopped"));
    // Perform the SQL query
    $message = '';
    if (!empty($action)) {
        /* Here we handle all actions to the booths!
         */
        $get_booth = -1;
        if (!empty($actb)) {
            $get_booth = (int) $actb;
            switch ($action) {
                case 'disable':
                    $message = _("Booth disabled");
                    break;
                case 'stop':
                    //$DBHandle->debug = true;
                    $res = $dbhandle->Execute("UPDATE cc_booth_v SET state = 2 WHERE id = ? {$aclause};", array($get_booth));
                    if ($res) {
                        $message = _("Booth stopped");
                    } else {
                        $message = _("Action failed:");
                        //if ($FG_DEBUG)
                        $message .= $dbhandle->ErrorMsg();
                    }
                    break;
                case 'start':
                    $res = $dbhandle->Execute("UPDATE cc_booth_v SET state = 3 WHERE id = ? {$aclause};", array($get_booth));
                    if ($res && $dbhandle->Affected_Rows()) {
                        $message = _("Booth started");
                    } else {
                        $message = _("Action failed:");
                        $message = $message . $dbhandle->ErrorMsg();
                        $message_class = "msg_error";
                    }
                    break;
                case 'load_def':
                    $res = $dbhandle->Execute("UPDATE cc_booth SET cur_card_id = def_card_id WHERE id = ? {$aclause};", array($get_booth));
                    if ($res && $dbhandle->Affected_Rows()) {
                        $message = _("Booth started");
                    } else {
                        $message = _("Action failed:");
                        $message = $message . $dbhandle->ErrorMsg();
                        $message_class = "msg_error";
                    }
                    break;
                case 'load_reg':
                    $res = $dbhandle->Execute("UPDATE cc_booth SET cur_card_id = ? WHERE id = ? {$aclause};", array($_GET['card'], $get_booth));
                    if ($res && $dbhandle->Affected_Rows()) {
                        $message = _("Booth started");
                    } else {
                        $message = _("Action failed:");
                        $message .= $dbhandle->ErrorMsg();
                        // $message .= "<br>Query: " . $query;
                        $message_class = "msg_error";
                    }
                    break;
                case 'refill':
                    $rf = (double) $_GET['sum'];
                    if ($rf <= 0.0 || $rf > 50.0) {
                        $message = _("Invalid sum for refill");
                        $message_class = "msg_error";
                    } else {
                        $get_booth = (int) $actb;
                        $query = "INSERT INTO cc_agentrefill(agentid, boothid, credit, pay_type) " . "SELECT agentid, cc_booth.id, conv_currency_from(?,  cc_agent.currency), " . "(SELECT id FROM cc_paytypes WHERE preset = 'prepay') " . "FROM cc_booth, cc_agent WHERE cc_booth.id = ? AND cc_agent.id = cc_booth.agentid {$aclause};";
                        $res = $dbhandle->Execute($query, array($rf, $get_booth));
                        if ($res && $dbhandle->Affected_Rows()) {
                            $message = _("Credit added to booth");
                            $message_class = "msg_success";
                        } else {
                            $message = _("Refill failed: do you have enough credit?");
                            if ($FG_DEBUG) {
                                $message .= "<br>" . $dbhandle->ErrorMsg();
                            }
                            if ($FG_DEBUG > 2) {
                                $message .= " <br>QUERY= " . $query;
                            }
                            $message_class = "msg_error";
                        }
//.........这里部分代码省略.........
开发者ID:sayemk,项目名称:a2billing,代码行数:101,代码来源:BoothsXML.inc.php

示例7: init

 function init($sA2Billing = null, $stdActions = true)
 {
     if (!$this->rights_checked) {
         error_log("Attempt to use FormHandler w/o rights!");
         die;
     }
     if ($sA2Billing) {
         $this->a2billing =& $sA2Billing;
     } else {
         $this->a2billing =& A2Billing::instance();
     }
     if (isset($GLOBALS['FG_DEBUG'])) {
         $this->FG_DEBUG = $GLOBALS['FG_DEBUG'];
     }
     // Fill a local array with dirty versions of data..
     if (!$this->prefix) {
         $this->_dirty_vars = array_merge($_GET, $_POST);
     } else {
         $tmp_arr = array_merge($_GET, $_POST);
         $tlen = strlen($this->prefix);
         $this->_dirty_vars = array();
         // Find vars matching prefix and strip that!
         foreach ($tmp_arr as $key => $data) {
             if (strncmp($this->prefix, $key, $tlen) == 0) {
                 $this->_dirty_vars[substr($key, $tlen)] = $data;
             }
         }
     }
     // set action, for a start:
     $this->action = $this->getpost_single('action');
     if ($this->action == null) {
         $this->action = 'list';
     }
     if ($this->order = $this->getpost_single('order')) {
         $this->addFollowParam('order', $this->order);
     } else {
         $this->order = $this->default_order;
     }
     if ($this->sens = $this->getpost_single('sens')) {
         $this->addFollowParam('sens', $this->sens);
     } else {
         $this->sens = $this->default_sens;
     }
     if ($this->cpage = $this->getpost_single('cpage')) {
         $this->addFollowParam('cpage', $this->cpage);
     }
     if ($this->ndisp = $this->getpost_single('ndisp')) {
         $this->addFollowParam('ndisp', $this->ndisp);
     } else {
         $this->ndisp = 30;
     }
     if ($stdActions) {
         $this->views['idle'] = new IdleView();
         $this->views['list'] = new ListView();
         if (!session_readonly()) {
             $this->views['edit'] = new EditView();
             $this->views['add'] = new AddView();
             $this->views['delete'] = new DeleteView();
             $this->views['object-edit'] = new ObjEditView();
         }
         $this->views['ask-add'] = new AskAddView();
         $this->views['ask-add2'] = new AskAdd2View();
         $this->views['ask-edit2'] = new AskEdit2View();
         $this->views['ask-edit'] = new AskEditView();
         $this->views['ask-del'] = new AskDelView();
         $this->views['details'] = new DetailsView();
         if ($this->FG_DEBUG) {
             $this->views['dump-form'] = new DbgDumpView();
         }
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:71,代码来源:Class.FormHandler.inc.php

示例8: DbgElem

// require_once (DIR_COMMON."Form/Class.SqlRefField.inc.php");
require_once DIR_COMMON . "Form/Class.TimeField.inc.php";
require_once DIR_COMMON . "Form/Class.ClauseField.inc.php";
require_once DIR_COMMON . "Form/Class.ListSumView.inc.php";
require_once DIR_COMMON . "Form/Class.SumMultiView.inc.php";
require_once DIR_COMMON . "Class.SqlActionElem.inc.php";
require_once DIR_COMMON . "SessionInvoice.inc.php";
$menu_section = 'menu_payments';
//HelpElem::DoHelp(gettext("Agents, callshops. <br>List or manipulate agents, which can deliver cards to customers."));
$sess_row = false;
$dbg_elem = new DbgElem();
$dbhandle = A2Billing::DBHandle();
if ($FG_DEBUG > 0) {
    $PAGE_ELEMS[] =& $dbg_elem;
}
$sessqry = "SELECT is_open, sid, booth, card, is_inuse, credit, " . " ( duration >= interval '1 day') AS has_days, " . str_dbparams($dbhandle, " format_currency(credit,%1) AS credit_fmt ", array(A2Billing::instance()->currency)) . " FROM cc_shopsession_status_v " . " WHERE agentid = " . $_SESSION['agent_id'];
if (isset($_GET['booth'])) {
    $sessqry .= str_dbparams($dbhandle, ' AND booth = %#1 ', array($_GET['booth']));
} elseif (isset($_GET['sid'])) {
    $sessqry .= str_dbparams($dbhandle, ' AND sid = %#1 ', array($_GET['sid']));
}
$sessqry .= ' ORDER BY sid DESC LIMIT 1;';
if ($FG_DEBUG > 2) {
    $dbg_elem->content .= "Query: " . $sessqry . "\n";
}
$sess_res = $dbhandle->Execute($sessqry);
if (!$sess_res) {
    $dbg_elem->content .= $dbhandle->ErrorMsg();
    $PAGE_ELEMS[] = new ErrorElem(_("Cannot locate session!"));
} elseif ($sess_res->EOF) {
    $dbg_elem->content .= "No data found!";
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:invoices_cshop.php

示例9: AgentMoney

function AgentMoney($agentid, &$sel_form, $intl, $rights)
{
    global $PAGE_ELEMS;
    global $FG_DEBUG;
    $dbhandle = A2Billing::DBHandle();
    $HD_Form = new FormHandler('cc_agent_money_v', _("Transactions"), _("Transaction"));
    $HD_Form->checkRights($rights);
    $HD_Form->init(null, false);
    $HD_Form->views['list'] = new SumMultiView();
    $HD_Form->views['pay'] = $HD_Form->views['true'] = $HD_Form->views['false'] = new IdleView();
    if ($FG_DEBUG) {
        $HD_Form->views['dump-form'] = new DbgDumpView();
    }
    $clauses = $sel_form->buildClauses();
    // $PAGE_ELEMS[] = new DbgElem(print_r($clauses,true));
    $PAGE_ELEMS[] =& $HD_Form;
    $HD_Form->model[] = new ClauseField('agentid', $agentid);
    if (isset($clauses['date_from'])) {
        $HD_Form->model[] = new FreeClauseField($clauses['date_from']);
    }
    if (isset($clauses['date_to'])) {
        $HD_Form->model[] = new FreeClauseField($clauses['date_to']);
    }
    $HD_Form->model[] = new DateTimeField(_("Date"), 'date');
    $HD_Form->model[] = new TextField(_("Type"), 'pay_type');
    if ($intl) {
        end($HD_Form->model)->fieldexpr = 'gettexti(pay_type,\'' . getenv('LANG') . '\')';
    } else {
        end($HD_Form->model)->fieldexpr = 'gettexti(pay_type,\'C\')';
    }
    $HD_Form->model[] = new TextField(_("Description"), 'descr');
    if ($intl) {
        end($HD_Form->model)->fieldexpr = 'gettext(descr,\'' . getenv('LANG') . '\')';
    }
    $HD_Form->model[] = new MoneyField(_("In"), 'pos_credit');
    $HD_Form->model[] = new MoneyField(_("Out"), 'neg_credit');
    $HD_Form->model[] = new MoneyField(_("Sum"), 'credit');
    $HD_Form->views['list']->sums[] = array('group' => false, 'fns' => array('date' => true, 'pay_type' => true, 'descr' => true, 'pos_credit' => true, 'neg_credit' => true));
    $HD_Form->views['list']->sums[] = array('fns' => array('descr' => array(_("Totals")), 'pos_credit' => 'SUM', 'neg_credit' => 'SUM'));
    $HD_Form->views['list']->sums[] = array('fns' => array('descr' => array(_("Sum Total")), 'credit' => 'SUM'));
    $Totals = new SqlDetailsActionForm();
    $Totals->checkRights($rights);
    $Totals->init();
    $Totals->setAction('true');
    $PAGE_ELEMS[] =& $Totals;
    $Totals->expectRows = false;
    $Totals->listclass = 'total';
    $Totals->headerString = _("Agent Totals");
    $Totals->successString = null;
    $dc2 = '';
    if (isset($clauses['date_from'])) {
        $dc2 .= ' AND ' . str_replace('date ', 'starttime ', $clauses['date_from']);
    }
    if (isset($clauses['date_to'])) {
        $dc2 .= ' AND ' . str_replace('date ', 'starttime ', $clauses['date_to']);
    }
    $cardsqr = "SELECT SUM(CASE WHEN credit > 0.0 THEN credit ELSE NULL END) AS pos_credit,\n\t\t\tSUM(CASE WHEN credit < 0.0 THEN (0.0 - credit) ELSE NULL END) AS neg_credit,\n\t\t\tSUM(creditlimit) AS climit\n\t\t\tFROM cc_card, cc_card_group\n\t\t\tWHERE cc_card.grp = cc_card_group.id AND cc_card_group.agentid IS NOT NULL\n\t\t\tAND agentid = %1";
    $callsqr = "SELECT SUM(sessionbill) AS calls \n\t\t\tFROM cc_call, cc_card, cc_card_group \n\t\t\tWHERE cc_call.cardid = cc_card.id AND cc_card_group.id = cc_card.grp\n\t\t\t\tAND cc_card_group.agentid = %1 " . $dc2;
    $dleftqr = "cc_calc_daysleft(%1,now(), interval '1 month')";
    $Totals->QueryString = str_dbparams($dbhandle, "SELECT format_currency(tc.pos_credit, %2) AS total_ccredit,\n\t\t format_currency(tc.neg_credit, %2) AS total_cdebit, " . "format_currency(tc.climit, %2) AS total_cclimit,\n\t\tformat_currency(sb.calls,%2) AS total_calls, format_currency((sb.calls * cc_agent.commission), %2) AS total_com,\n\t\tformat_currency((sb.calls * (1.0 - cc_agent.commission)), %2) AS total_wh,\n\t\tformat_currency(cc_agent.credit, %2) AS agent_credit, format_currency(cc_agent.climit, %2) AS climit, dleft.days_left\n\t\t  FROM ({$cardsqr}) AS tc, ({$callsqr}) AS sb, cc_agent, {$dleftqr} AS dleft\n\t\t  WHERE cc_agent.id = %1;", array($agentid, A2Billing::instance()->currency));
    $Totals->noRowsString = _("Totals could not be calculated!");
    $Totals->rmodel[] = new MoneyField(_("Total sum credited to customers"), 'total_ccredit');
    $Totals->rmodel[] = new MoneyField(_("Total sum debited from customers"), 'total_cdebit');
    $Totals->rmodel[] = new MoneyField(_("Total potential debit from customers"), 'total_cclimit');
    $Totals->rmodel[] = new IntField(_("Total calls made by customers"), 'total_calls');
    $Totals->rmodel[] = new MoneyField(_("Wholesale price of calls"), 'total_wh');
    $Totals->rmodel[] = new MoneyField(_("Estimated profit from calls"), 'total_com');
    $Totals->rmodel[] = new MoneyField(_("Outstanding balance"), 'agent_credit');
    $Totals->rmodel[] = new MoneyField(_("Credit Limit"), 'climit');
    $Totals->rmodel[] = new IntField(_("Estimated Days left"), 'days_left');
    // if ($vat>0) echo  " (" .gettext("includes VAT"). "$vat %)";
}
开发者ID:sayemk,项目名称:a2billing,代码行数:72,代码来源:AgentMoney.inc.php

示例10: dontList

$HD_Form->model[] = dontList(new MoneyField(_("Amount"), 'amount'));
$HD_Form->model[] = dontList(new MoneyField(_("Tax"), 'tax'));
$HD_Form->model[] = new MoneyField(_("Total"), 'total');
$HD_Form->model[] = new IntFieldN(_("Type"), "invoicetype");
//end($HD_Form->model)->refclause = "lang = 'C'";
$HD_Form->model[] = dontList(new TextFieldN(_("Filename"), "filename"));
//$HD_Form->model[] = new SqlBigRefField(_("Invoice"), "invoice_id","cc_invoices", "id", "orderref");
//end($HD_Form->model)->refclause = "agentid IS NOT NULL";
//$HD_Form->model[] = dontList( new TextAreaField(_("Description"),'descr'));
$ilist = array();
$ilist[] = array("0", _("Unpaid"));
$ilist[] = array('1', _('Sent-unpaid'));
$ilist[] = array('2', _('Sent-paid'));
$ilist[] = array('3', _('Paid'));
$HD_Form->model[] = new RefField(_("Status"), 'payment_status', $ilist);
$HD_Form->model[] = new HiddenField(NULL, 'total_t', 'conv_currency_from(total,\'' . A2Billing::instance()->currency . '\')');
$detBtn = new OtherBtnField();
$detBtn->title = _("View");
$detBtn->url = "invoices_agent.php?";
$detBtn->extra_params = array('id' => 'id');
$obf = new OtherBtnField();
$obf->title = _("Pay");
$obf->url = "A2B_entity_agentpay.php?action=ask-add&";
$obf->extra_params = array('invoice_id' => 'id', 'agentid' => 'agentid', 'credit' => 'total_t');
$HD_Form->model[] = new GroupField(array($detBtn, $obf, new DelBtnField()));
require "PP_page.inc.php";
if (false) {
    ?>
<br>
<script language="javascript">
function go(URL)
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:A2B_entity_agent_invoicev.php

示例11: error_reporting

    error_reporting(E_ALL);
    $verbose_mode = true;
    array_shift($argv);
    $argc--;
}
if ($argc > 1 && $argv[1] == '--test') {
    AGI::verbose_s("Testing mode!", 0);
    define('DEFAULT_CONFIG', "../a2billing.conf");
    array_shift($argv);
    $argc--;
} else {
    define('DEFAULT_CONFIG', '/etc/a2billing.conf');
}
require_once 'Class.A2Billing.inc.php';
// create the objects
$a2b = A2Billing::instance();
if (!$a2b->load_res_dbsettings('/etc/asterisk/res_pgsql.conf')) {
    @syslog(LOG_ERR, "Cannot fetch settings from res_pgsql.conf");
    exit(2);
}
$dynconf = DynConf::instance();
if ($argc > 1 && is_numeric($argv[1]) && $argv[1] >= 0) {
    $idconfig = $argv[1];
} else {
    $idconfig = 1;
}
try {
    $dynconf->init();
    $dynconf->PrefetchGroup('agiconf' . $idconfig);
} catch (Exception $ex) {
    error_log($ex->getMessage());
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:a2billing.php


注:本文中的A2Billing::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。