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


PHP FormHandler::init方法代码示例

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


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

示例1: strtoupper

	$display_currency = strtoupper($_SESSION['currency']);
	if (strtoupper($_SESSION['currency']) != strtoupper(BASE_CURRENCY))
		$two_currency = true;
}

$HD_Form = new FormHandler("cc_payment_methods", "payment_method");

getpost_ifset(array (
	'item_id',
	'item_type',
	'payment_error'
));

$DBHandle = DbConnect();
$HD_Form->setDBHandler($DBHandle);
$HD_Form->init();

// #### HEADER SECTION

$static_amount = false;
$amount = 0;
if ($item_type = "invoice" && is_numeric($item_id)) {
	$table_invoice = new Table("cc_invoice", "status,paid_status");
	$clause_invoice = "id = " . $item_id;
	$result = $table_invoice->Get_list($DBHandle, $clause_invoice);
	if (is_array($result) && $result[0]['status'] == 1 && $result[0]['paid_status'] == 0) {
		$table_invoice_item = new Table("cc_invoice_item", "COALESCE(SUM(price*(1+(vat/100))),0)");
		$clause_invoice_item = "id_invoice = " . $item_id;
		$result = $table_invoice_item->Get_list($DBHandle, $clause_invoice_item);
		$amount = $result[0][0];
开发者ID:nixonch,项目名称:a2billing,代码行数:30,代码来源:checkout_payment.php

示例2: FreeClauseField

$tmp->Form->model[] = new FreeClauseField("sessiontime > 0");
$tmp->Form->model[] = new DateTimeField(_("Time"), 'starttime');
$tmp->Form->model[] = new TextField(_("Number"), 'calledstation');
$tmp->Form->model[] = new TextField(_("Destination"), 'destination');
$tmp->Form->model[] = new SecondsField(_("Duration"), 'sessiontime');
end($tmp->Form->model)->fieldacr = _("Dur");
//$tmp->Form->model[] = new PKeyFieldTxt(_("ID"),'id');
$tmp->Form->model[] = new MoneyField(_("Bill"), 'sessionbill');
//one non-summed group
$tmp->Form->views['list']->sums[] = array('fns' => array('starttime' => true, 'calledstation' => true, 'destination' => true, 'sessiontime' => true, 'sessionbill' => true), 'order' => 'starttime');
//Per day/destination
$tmp->Form->views['list']->sums[] = array('title' => _("Sum per destination"), 'fns' => array('starttime' => false, 'destination' => true, 'sessiontime' => 'SUM', 'sessionbill' => 'SUM'), 'order' => 'sessiontime', 'sens' => 'DESC');
$tmp->Form->views['list']->sums[] = array('title' => _("Total"), 'fns' => array('calledstation' => 'COUNT', 'sessiontime' => 'SUM', 'sessionbill' => 'SUM'));
$hform = new FormHandler('cc_card');
$hform->checkRights(ACX_INVOICING);
$hform->init(null, false);
$hform->setAction('details');
$hform->views['details'] = new DetailsView();
$hform->model[] = new FreeClauseField(str_dbparams(A2Billing::DBHandle(), 'id = (SELECT cardid FROM cc_invoices WHERE id = %#1)', array($dform->getpost_dirty('id'))));
//$hform->model[] = new PKeyField(_("ID"),'id');
$hform->model[] = new TextField(_("Local number"), 'useralias');
$hform->model[] = new TextFieldN(_("First name"), 'firstname');
$hform->model[] = new TextFieldN(_("Last name"), 'lastname');
$hform->model[] = new TextAreaField(_("Address"), 'address');
$hform->model[] = new TextFieldN(_("City"), 'city');
$hform->model[] = new TextFieldN(_("State"), 'state');
$hform->model[] = new TextFieldN(_("Country"), 'country');
$hform->model[] = new TextFieldN(_("Zipcode"), 'zipcode');
//$hform->model[] = new TextFieldN(_("Phone"),'phone');
$hform->model[] = new TextFieldN(_("Fax"), 'fax');
$PAGE_ELEMS[] =& $hform;
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:invoices_card.php

示例3: FormHandler

<?php

require_once "./lib/defines.php";
require_once "./lib/module.access.php";
require_once DIR_COMMON . "Form.inc.php";
require_once DIR_COMMON . "Class.HelpElem.inc.php";
require_once DIR_COMMON . "Form/Class.SqlRefField.inc.php";
require_once DIR_COMMON . "Form/Class.VolField.inc.php";
require_once DIR_COMMON . "Form/Class.ClauseField.inc.php";
$menu_section = 'menu_booths';
HelpElem::DoHelp(_("Booths are the physical phones where a customer can enter and make calls."));
$HD_Form = new FormHandler('cc_booth_v', _("Booths"), _("Booth"));
$HD_Form->checkRights(ACX_ACCESS);
$HD_Form->init(null, false);
$HD_Form->views['list'] = new ListView();
$HD_Form->views['details'] = new DetailsView();
$PAGE_ELEMS[] =& $HD_Form;
$HD_Form->model[] = new PKeyField(_("ID"), 'id');
$HD_Form->model[] = new FreeClauseField('agentid = \'' . $_SESSION['agent_id'] . '\'');
$HD_Form->model[] = new TextField(_("Name"), 'name');
$HD_Form->model[] = new TextAreaField(_("Location"), 'location');
$cs_list = array();
$cs_list[] = array('0', _("N/A"));
$cs_list[] = array('1', _("Empty"));
$cs_list[] = array('2', _("Idle"));
$cs_list[] = array('3', _("Ready"));
$cs_list[] = array('4', _("Active"));
$cs_list[] = array('5', _("Disabled"));
$cs_list[] = array('6', _("Stopped"));
$HD_Form->model[] = dontEdit(new RefField(_("State"), 'state', $cs_list));
$HD_Form->model[] = dontEdit(new MoneyField(_("Credit"), 'credit', _("Money now in the card inside the booth.")));
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:A2B_entity_booths.php

示例4: FormHandler

<?php

require "lib/defines.php";
require "lib/module.access.php";
require_once DIR_COMMON . "Form.inc.php";
//require_once (DIR_COMMON."Form/Class.SqlActionForm.inc.php");
require_once DIR_COMMON . "Form/Class.TimeField.inc.php";
require_once DIR_COMMON . "Form/Class.ClauseField.inc.php";
$User_Form = new FormHandler("cc_card");
$User_Form->checkRights(ACX_ACCESS);
$User_Form->init(null, false);
$User_Form->views['list'] = new DetailsView();
// $User_Form->views['list']->table_class="user-info";
$User_Form->model[] = new ClauseField("id", $_SESSION['card_id']);
$User_Form->model[] = new TextField(_('First name'), 'firstname');
$User_Form->model[] = new TextField(_('Last name'), 'lastname');
$User_Form->model[] = new MoneyField(_('Credit'), 'credit');
$User_Form->model[] = new DateField(_('Last used'), 'lastuse');
$User_Form->submitString = _("Calculate!");
$User_Form->edit_no_records = _("Database error: your details cannot be found!");
$PAGE_ELEMS[] =& $User_Form;
require "PP_page.inc.php";
if (false) {
    //require (LANGUAGE_DIR.FILENAME_USERINFO);
    $QUERY = "SELECT  username, credit, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, lastuse, activated, status FROM cc_card WHERE username = '" . $_SESSION["pr_login"] . "' AND uipass = '" . $_SESSION["pr_password"] . "'";
    $DBHandle_max = DbConnect();
    $numrow = 0;
    $resmax = $DBHandle_max->Execute($QUERY);
    if ($resmax) {
        $numrow = $resmax->RecordCount();
    } else {
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:userinfo.php

示例5: 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

示例6: AgentSessionInvoice

/** One function that sets up page elems for an agent-session invoice */
function AgentSessionInvoice($sess_row, $rights, $booth_page)
{
    global $PAGE_ELEMS;
    global $FG_DEBUG;
    $dbhandle = A2Billing::DBHandle();
    $HD_Form = new FormHandler('cc_session_invoice', _("Transactions"), _("Transaction"));
    $HD_Form->checkRights($rights);
    $HD_Form->init(null, false);
    $HD_Form->views['list'] = new ListSumView();
    $HD_Form->views['pay'] = $HD_Form->views['true'] = $HD_Form->views['false'] = new IdleView();
    if ($FG_DEBUG) {
        $HD_Form->views['dump-form'] = new DbgDumpView();
    }
    $PAGE_ELEMS[] =& $HD_Form;
    $HD_Form->model[] = new ClauseField('sid', $sess_row['sid']);
    $HD_Form->model[] = new DateTimeField(_("Date"), 'starttime');
    $HD_Form->model[] = new TextField(_("Description"), 'descr');
    end($HD_Form->model)->fieldacr = _("Descr");
    $HD_Form->model[] = new TextField("", 'f2');
    $HD_Form->model[] = new TextField(_("Called Number"), 'cnum');
    end($HD_Form->model)->fieldacr = _("C. Num");
    //end($HD_Form->model)->fieldname ='agent';
    $HD_Form->model[] = new SecondsField(_("Duration"), "duration");
    end($HD_Form->model)->fieldacr = _("Dur");
    $HD_Form->model[] = new MoneyField(_("Credit"), "pos_charge");
    $HD_Form->model[] = new MoneyField(_("Charge"), "neg_charge");
    $HD_Form->views['list']->sum_fns = array('duration' => 'SUM', 'pos_charge' => 'SUM', 'neg_charge' => 'SUM');
    // Per date calls..
    $Sum_Form = new FormHandler('cc_session_calls', _("Per-date calls"));
    $Sum_Form->checkRights($rights);
    $Sum_Form->init(null, false);
    $Sum_Form->views['list'] = new SumMultiView();
    $Sum_Form->views['pay'] = $Sum_Form->views['true'] = $Sum_Form->views['false'] = new IdleView();
    if ($FG_DEBUG) {
        $Sum_Form->views['dump-form'] = new DbgDumpView();
    }
    $PAGE_ELEMS[] =& $Sum_Form;
    $Sum_Form->model[] = new ClauseField('sid', $sess_row['sid']);
    $Sum_Form->model[] = new DateField(_("Date"), 'starttime');
    end($Sum_Form->model)->fieldexpr = 'date_trunc(\'day\', starttime)';
    $Sum_Form->model[] = new IntField(_("Calls"), 'cnum');
    $Sum_Form->model[] = new SecondsField(_("Duration"), "duration");
    //$Sum_Form->model[] = new FloatField(_("Credit"), "pos_charge");
    $Sum_Form->model[] = new MoneyField(_("Charge"), "neg_charge");
    if ($sess_row['has_days'] == 't') {
        $Sum_Form->views['list']->sums[] = array('title' => _("Per day calls"), 'fns' => array('starttime' => true, 'cnum' => 'COUNT', 'duration' => 'SUM', 'neg_charge' => 'SUM'));
    }
    $Sum_Form->views['list']->sums[] = array('title' => _("Total"), 'fns' => array('cnum' => 'COUNT', 'duration' => 'SUM', 'neg_charge' => 'SUM'));
    if ($sess_row['is_open'] != 't') {
        $PAGE_ELEMS[] = new StringElem(_("Session is closed"));
    } elseif ($sess_row['is_inuse'] == 't') {
        $PAGE_ELEMS[] = new StringElem(_("Card is in use, cannot close session now."));
    } else {
        $pay_form = new SqlActionElem();
        $pay_form->action_do = 'pay';
        $pay_form->action_ask = 'list';
        $pay_form->init();
        $PAGE_ELEMS[] =& $pay_form;
        if ($sess_row['credit'] > 0) {
            $pay_form->ButtonStr = str_params(_("Pay back %1"), array($sess_row['credit_fmt']), 1);
            $pay_form->elem_success = new StringElem(_("Sesion paid back!"));
        } else {
            $pay_form->ButtonStr = str_params(_("Pay %1"), array($sess_row['credit_fmt']), 1);
            $pay_form->elem_success = new StringElem(_("Sesion paid!"));
        }
        $pay_form->follow_params['sum'] = $sess_row['credit'];
        $pay_form->follow_params['sid'] = $sess_row['sid'];
        $pay_form->QueryString = str_dbparams($dbhandle, 'SELECT pay_session(%1, %2, true) AS money;', array($sess_row['sid'], $_GET['sum']));
        $pay_form->elem_fail = new StringElem(_("Session could not be paid!"));
        $pay_form->elem_success->content .= "\n<br><a href=\"{$booth_page}\">" . _("Back to booths") . "</a>";
    }
}
开发者ID:sayemk,项目名称:a2billing,代码行数:73,代码来源:SessionInvoice.inc.php


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