本文整理汇总了PHP中FormLib类的典型用法代码示例。如果您正苦于以下问题:PHP FormLib类的具体用法?PHP FormLib怎么用?PHP FormLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FormLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preprocess
function preprocess()
{
if (FormLib::get_form_value('start', False) !== False) {
$pdf = new FPDF('P', 'in', 'Letter');
$pdf->SetMargins(0.5, 0.5, 0.5);
$pdf->SetAutoPageBreak(False, 0.5);
$pdf->AddPage();
$start = FormLib::get_form_value('start');
$x = 0.5;
$y = 0.5;
$pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
$pdf->SetFont('Gill', '', 16);
for ($i = 0; $i < 40; $i++) {
$current = $start + $i;
$pdf->SetXY($x, $y);
$pdf->Cell(1.75, 0.5, $current, 0, 0, 'C');
$pdf->Cell(1.75, 0.5, $current, 0, 0, 'C');
if ($i % 2 == 0) {
$x += 1.75 * 2 + 0.5;
} else {
$x = 0.5;
$y += 0.5;
}
}
$pdf->Close();
$pdf->Output("mem stickers {$start}.pdf", "I");
return False;
}
return True;
}
示例2: preprocess
public function preprocess()
{
$acct = FormLib::get('id');
$this->header = 'Loan Schedule' . ' : ' . $acct;
$this->title = 'Loan Schedule' . ' : ' . $acct;
return parent::preprocess();
}
示例3: ajaxCallback
private function ajaxCallback()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$m = FormLib::get('month', 1);
$y = FormLib::get('year', date('Y'));
if (!is_numeric($y)) {
return "Error: Invalid year";
} elseif (!is_numeric($m)) {
return "Error: Invalid month";
}
$ret = "<form action=\"SalePerformanceReport.php\" method=\"get\">\n <p>\n <button type=submit class=\"btn btn-default\">Get Report</button>\n </p>";
$ret .= sprintf("<input type=hidden name=month value=%d />\n <input type=hidden name=year value=%d />", $m, $y);
$ret .= "<table class=\"table\">";
$ret .= "<tr><th> </th><th>Batch</th><th>Start</th><th>End</th></tr>";
$q = $dbc->prepare_statement("SELECT batchID,batchName,startDate,endDate FROM\n batches WHERE discounttype <> 0 AND (\n (year(startDate)=? and month(startDate)=?) OR\n (year(endDate)=? and month(endDate)=?)\n ) ORDER BY startDate,batchType,batchName");
$r = $dbc->exec_statement($q, array($y, $m, $y, $m));
while ($w = $dbc->fetch_row($r)) {
list($start, $time) = explode(' ', $w[2], 2);
list($end, $time) = explode(' ', $w[3], 2);
$ret .= sprintf("<tr>\n <td><input type=checkbox name=ids[] value=%d id=\"batch-checkbox-%d\" /></td>\n <td><label for=\"batch-checkbox-%d\">%s</label></td>\n <td>%s</td><td>%s</td>\n <input type=hidden name=bnames[] value=\"%s\" /></tr>", $w['batchID'], $w['batchID'], $w['batchID'], $w['batchName'], $start, $end, $w['batchName'] . " (" . $start . " " . $end . ")");
}
$ret .= "</table>\n <p>\n <button type=submit class=\"btn btn-default\">Get Report</button>\n </p>\n </form>";
return $ret;
}
示例4: preprocess
function preprocess()
{
global $FANNIE_OP_DB;
if (FormLib::get_form_value('deptStart', False) !== false) {
$start = FormLib::get_form_value('deptStart');
$end = FormLib::get_form_value('deptEnd');
$pageID = FormLib::get_form_value('sID', 0);
$dbc = FannieDB::get($FANNIE_OP_DB);
$prodP = $dbc->prepare_statement("\n SELECT p.upc\n FROM products AS p\n WHERE p.department BETWEEN ? AND ?\n ");
$prodR = $dbc->exec_statement($prodP, array($start, $end));
$tag = new ShelftagsModel($dbc);
$product = new ProductsModel($dbc);
while ($row = $dbc->fetch_row($prodR)) {
$product->upc($row['upc']);
$info = $product->getTagData();
$tag->id($pageID);
$tag->upc($row['upc']);
$tag->setData($info);
$tag->save();
}
$this->msgs = sprintf('<em>Created tags for departments #%d through #%d</em>
<br /><a href="ShelfTagIndex.php">Home</a>', $start, $end);
}
return true;
}
示例5: preprocess
function preprocess()
{
global $FANNIE_OP_DB;
$this->title = _("Fannie") . ' : ' . _("Manufacturer Shelf Tags");
$this->header = _("Manufacturer Shelf Tags");
if (FormLib::get_form_value('manufacturer', False) !== false) {
$manu = FormLib::get_form_value('manufacturer');
$pageID = FormLib::get_form_value('sID', 0);
$cond = "";
if (is_numeric($_REQUEST['manufacturer'])) {
$cond = " p.upc LIKE ? ";
} else {
$cond = " p.brand LIKE ? ";
}
$dbc = FannieDB::get($FANNIE_OP_DB);
$prodP = $dbc->prepare_statement("\n SELECT\n p.upc\n FROM\n products AS p\n WHERE {$cond}\n ");
$prodR = $dbc->exec_statement($prodP, array('%' . $manu . '%'));
$tag = new ShelftagsModel($dbc);
$product = new ProductsModel($dbc);
while ($prodW = $dbc->fetch_row($prodR)) {
$product->upc($prodW['upc']);
$info = $product->getTagData();
$tag->id($pageID);
$tag->upc($prodW['upc']);
$tag->setData($info);
$tag->save();
}
$this->msgs = '<em>Created tags for manufacturer</em>
<br /><a href="ShelfTagIndex.php">Home</a>';
}
return true;
}
示例6: saveFormData
function saveFormData($memNum)
{
/* entry blank. do not save */
$note = FormLib::get_form_value('Notes_text');
if ($note == "") {
return "";
}
/* entry has note changed. this means it's already
in memberNotes as the most recent entry */
$current = FormLib::get_form_value('Notes_current');
if ($note == base64_decode($current)) {
return "";
}
$dbc = $this->db();
$insertNote = $dbc->prepare_statement("INSERT into memberNotes\n (cardno, note, stamp, username)\n VALUES (?, ?, " . $dbc->now() . ", 'Admin')");
// convert newlines back to br tags
// so displayed notes have user's
// paragraph formatting
$note = str_replace("\n", '<br />', $note);
$test1 = $dbc->exec_statement($insertNote, array($memNum, $note));
if ($test1 === False) {
return "Error: problem saving Notes<br />";
} else {
return "";
}
}
示例7: preprocess
function preprocess()
{
global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
$ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
$this->emp_no = FormLib::get_form_value('emp_no', 0);
$this->periodID = FormLib::get_form_value('periodID', 0);
if (!headers_sent() && ($this->emp_no == 0 || $this->periodID == 0 || $this->emp_no < 0)) {
header('Location: TsAdminMain.php');
return False;
}
if ($_GET['function'] == 'edit' && isset($_GET['submitted']) && isset($_GET['emp_no']) && isset($_GET['periodID']) && isset($_GET['id'])) {
$oneP = $ts_db->prepare_statement("UPDATE timesheet\n SET time_in=?, time_out=?, area=?\n WHERE ID=?");
$twoP = $ts_db->prepare_statement("UPDATE timesheet\n SET time_in=?\n WHERE ID=?");
foreach ($_GET['id'] as $key => $id) {
$area = (int) $_GET['area'][$id];
$date = $_GET['date'][$id];
$timein = $this->parseTime($_GET['time_in'][$id], $_GET['inmeridian'][$id]);
$timeout = $this->parseTime($_GET['time_out'][$id], $_GET['outmeridian'][$id]);
$result = False;
if ($area != 0) {
$args = array($date . ' ' . $timein, $date . ' ' . $timeout, $area, $id);
$result = $ts_db->exec_statement($oneP, $args);
} else {
$args = array('2008-01-01 ' . $timein, $id);
$result = $ts_db->exec_statement($twoP, $args);
}
if (!$result) {
$this->errors[] = "<p>Query: {$query}</p>";
$this->errors[] = "<p>MySQL Error: " . $ts_db->error() . "</p>";
}
}
}
return True;
}
示例8: fetch_report_data
public function fetch_report_data()
{
global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
$month = FormLib::get('month', date('n'));
$year = FormLib::get('year', date('Y'));
$end_of_last_month = mktime(0, 0, 0, $month, 0, $year);
$ts = mktime(0, 0, 0, $month, 1, $year);
$end_of_next_month = mktime(0, 0, 0, $month, date('t', $ts), $year);
$end_last_dt = new DateTime(date('Y-m-d', $end_of_last_month));
$end_next_dt = new DateTime(date('Y-m-d', $end_of_next_month));
$loans = new GumLoanAccountsModel($dbc);
$data = array();
foreach ($loans->find('loanDate') as $loan) {
$record = array($loan->accountNumber(), number_format($loan->principal(), 2), number_format($loan->interestRate() * 100, 2) . '%', $loan->termInMonths(), date('Y-m-d', strtotime($loan->loanDate())));
$loanDT = new DateTime(date('Y-m-d', strtotime($loan->loanDate())));
$days1 = $loanDT->diff($end_last_dt)->format('%r%a');
$days2 = $loanDT->diff($end_next_dt)->format('%r%a');
$bal_before = $loan->principal() * pow(1.0 + $loan->interestRate(), $days1 / 365.25);
if ($days1 < 0) {
$bal_before = $loan->principal();
}
$bal_after = $loan->principal() * pow(1.0 + $loan->interestRate(), $days2 / 365.25);
if ($days2 < 0) {
$bal_after = $loan->principal();
}
$record[] = number_format($bal_before, 2);
$record[] = number_format($bal_after, 2);
$record[] = number_format($bal_after - $bal_before, 2);
$data[] = $record;
}
return $data;
}
示例9: fetch_report_data
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$upc = $this->form->upc;
$upc = BarcodeLib::padUPC($upc);
$query = 'SELECT i.sku, i.quantity, i.unitCost, i.caseSize,
i.quantity * i.unitCost * i.caseSize AS ttl,
o.vendorInvoiceID, v.vendorName, o.placedDate
FROM PurchaseOrderItems AS i
LEFT JOIN PurchaseOrder AS o ON i.orderID=o.orderID
LEFT JOIN vendors AS v ON o.vendorID=v.vendorID
WHERE i.internalUPC = ?
AND o.placedDate >= ?
ORDER BY o.placedDate';
$prep = $dbc->prepare($query);
$args = array($upc);
if (FormLib::get('all')) {
$args[] = '1900-01-01 00:00:00';
} else {
$args[] = date('Y-m-d', strtotime('92 days ago'));
}
$result = $dbc->execute($prep, $args);
$data = array();
while ($row = $dbc->fetch_row($result)) {
$record = array($row['placedDate'], $row['vendorName'], $row['vendorInvoiceID'], $row['sku'], $row['quantity'], $row['caseSize'], $row['unitCost'], $row['ttl']);
$data[] = $record;
}
return $data;
}
示例10: form_content
public function form_content()
{
ob_start();
?>
<form method ="get" action="CashierRecordsReport.php">
<div class="col-sm-4">
<div class="form-group">
<label>Date Start</label>
<input type=text id=date1 name=date1 class="form-control date-field" />
</div>
<div class="form-group">
<label>Date End</label>
<input type=text id=date2 name=date2 class="form-control date-field" />
</div>
<p>
<button type=submit name=submit class="btn btn-default btn-core">Submit</button>
<button type=reset name=reset class="btn btn-default btn-reset">Start Over</button>
</p>
</div>
<div class="col-sm-4">
<?php
echo FormLib::date_range_picker();
?>
</div>
</form>
<?php
return ob_get_clean();
}
示例11: saveFormData
function saveFormData($memNum)
{
$dbc = $this->db();
/**
Use primary member for default column values
*/
$account = self::getAccount();
if (!$account) {
return "Error: Problem saving household members<br />";
}
$json = array('cardNo' => $memNum, 'customerTypeID' => $account['customerTypeID'], 'memberStatus' => $account['memberStatus'], 'activeStatus' => $account['activeStatus'], 'customers' => array());
$primary = array('discount' => 0, 'staff' => 0, 'lowIncomeBenefits' => 0, 'chargeAllowed' => 0, 'checksAllowed' => 0);
foreach ($account['customers'] as $c) {
if ($c['accountHolder']) {
$primary = $c;
break;
}
}
$fns = FormLib::get_form_value('HouseholdMembers_fn', array());
$lns = FormLib::get_form_value('HouseholdMembers_ln', array());
$ids = FormLib::get('HouseholdMembers_ID', array());
for ($i = 0; $i < count($lns); $i++) {
$json['customers'][] = array('customerID' => $ids[$i], 'firstName' => $fns[$i], 'lastName' => $lns[$i], 'accountHolder' => 0, 'discount' => $primary['discount'], 'staff' => $primary['staff'], 'lowIncomeBenefits' => $primary['lowIncomeBenefits'], 'chargeAllowed' => $primary['chargeAllowed'], 'checksAllowed' => $primary['checksAllowed']);
}
$resp = \COREPOS\Fannie\API\member\MemberREST::post($memNum, $json);
if ($resp['errors'] > 0) {
return "Error: Problem saving household members<br />";
}
return '';
}
示例12: post_upc_description_department_cost_price_qty_reason_handler
public function post_upc_description_department_cost_price_qty_reason_handler()
{
global $FANNIE_TRANS_DB, $FANNIE_EMP_NO, $FANNIE_REGISTER_NO;
$dbc = FannieDB::get($FANNIE_TRANS_DB);
$record = DTrans::$DEFAULTS;
$record['emp_no'] = $FANNIE_EMP_NO;
$record['register_no'] = $FANNIE_REGISTER_NO;
$record['trans_no'] = DTrans::getTransNo($dbc, $FANNIE_EMP_NO, $FANNIE_REGISTER_NO);
$record['trans_id'] = 1;
$record['upc'] = $this->upc;
$record['description'] = $this->description;
$record['department'] = $this->department;
$record['trans_type'] = 'I';
$record['quantity'] = $this->qty;
$record['ItemQtty'] = $this->qty;
$record['unitPrice'] = $this->price;
$record['regPrice'] = $this->price;
$record['total'] = $this->qty * $this->price;
$record['cost'] = $this->qty * $this->cost;
$record['numflag'] = $this->reason;
$record['charflag'] = strlen(FormLib::get('type')) > 0 ? strtoupper(substr(FormLib::get('type'), 0, 1)) : '';
$record['trans_status'] = 'Z';
$info = DTrans::parameterize($record, 'datetime', $dbc->now());
$query = 'INSERT INTO dtransactions
(' . $info['columnString'] . ')
VALUES
(' . $info['valueString'] . ')';
$prep = $dbc->prepare($query);
$result = $dbc->execute($prep, $info['arguments']);
header('Location: ' . $_SERVER['PHP_SELF'] . '?msg=1');
return false;
}
示例13: form_content
public function form_content()
{
ob_start();
?>
<form method=get class="form-horizontal">
<div class="row">
<div class="col-sm-6">
<p>
<label>Start Date</label>
<input class="form-control date-field" required type=text id=date1 name=date1 />
</p>
<p>
<label>End Date</label>
<input class="form-control date-field" required type=text id=date2 name=date2 />
</p>
</div>
<div class="col-sm-6">
<p>
<?php
echo FormLib::date_range_picker();
?>
</p>
</div>
</div>
<p>
<button type=submit name=submit value="Submit" class="btn btn-default">Submit</button>
<label><input type=checkbox name=excel /> Excel</label>
</p>
</form>
<?php
return ob_get_clean();
}
示例14: post_download_handler
public function post_download_handler()
{
header('Content-Type: application/ms-excel');
header('Content-Disposition: attachment; filename="PDFasCSV.csv"');
echo FormLib::get('download');
return false;
}
示例15: post_handler
public function post_handler()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
$amount = FormLib::get('amount');
$paid = FormLib::get('paid') / 100.0;
$retained = FormLib::get('retained') / 100.0;
$netQ = '
SELECT SUM(p.net_purch) AS ttl
FROM patronage_workingcopy AS p
INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
WHERE c.Type=\'PC\'';
$netR = $dbc->query($netQ);
$netW = $dbc->fetch_row($netR);
$purchases = $netW['ttl'];
$personQ = '
SELECT p.net_purch,
c.cardno
FROM patronage_workingcopy AS p
INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
WHERE c.Type=\'PC\'';
$personR = $dbc->query($personQ);
$this->insertRecords($dbc, $personR, $purchases, $paid, $retained, $amount);
$finishQ = '
INSERT INTO patronage
(cardno, purchase, discounts, rewards, net_purch, tot_pat, cash_pat, equit_pat, FY)
SELECT
p.cardno, purchase, discounts, rewards, net_purch, tot_pat, cash_pat, equit_pat, FY
FROM patronage_workingcopy AS p
INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
WHERE c.Type=\'PC\'';
$dbc->query($finishQ);
return true;
}