本文整理汇总了PHP中MiscLib类的典型用法代码示例。如果您正苦于以下问题:PHP MiscLib类的具体用法?PHP MiscLib怎么用?PHP MiscLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MiscLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preprocess
function preprocess()
{
if (isset($_REQUEST['doLookup'])) {
$ref = $_REQUEST['id'];
$local = $_REQUEST['local'];
$mode = $_REQUEST['mode'];
$obj = null;
$resp = array();
foreach (CoreLocal::get('RegisteredPaycardClasses') as $rpc) {
$obj = new $rpc();
if ($obj->myRefNum($ref)) {
break;
} else {
$obj = null;
}
}
if ($obj === null) {
$resp['output'] = DisplayLib::boxMsg('Invalid Transaction ID' . '<br />Local System Error', '', true);
$resp['confirm_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php';
$resp['cancel_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php';
} else {
if ($local == 0 && $mode == 'verify') {
$resp['output'] = DisplayLib::boxMsg('Cannot Verify - Already Complete' . '<br />Local System Error', '', true);
$resp['confirm_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php';
$resp['cancel_dest'] = MiscLib::base_url() . 'gui-modules/pos2.php';
} else {
$resp = $obj->lookupTransaction($ref, $local, $mode);
}
}
echo JsonLib::array_to_json($resp);
return false;
}
return true;
}
示例2: parse
public function parse($str)
{
$ret = $this->default_json();
if (CoreLocal::get('memberID') == '0') {
$ret['output'] = DisplayLib::boxMsg(_("Apply member number first"), _('No member selected'), false, array_merge(array('Member Search [ID]' => 'parseWrapper(\'ID\');'), DisplayLib::standardClearButton()));
return $ret;
}
if ($str == 'ACCESS') {
if (CoreLocal::get('AccessQuickMenu') != '' && class_exists('QuickMenuLauncher')) {
$qm = new QuickMenuLauncher();
return $qm->parse('QM' . CoreLocal::get('AccessQuickMenu'));
} else {
$str = 'ACCESS0';
}
}
if ($str !== 'ACCESS6' && CoreLocal::get('AccessSelection') === '') {
CoreLocal::set('AccessSelection', $str);
$ret['main_frame'] = MiscLib::baseURL() . 'gui-modules/adminlogin.php?class=AccessProgramParser';
return $ret;
} else {
CoreLocal::set('AccessSelection', '');
}
$selection = substr($str, 6);
TransRecord::addRecord(array('upc' => 'ACCESS', 'description' => 'ACCESS SIGNUP', 'quantity' => 1, 'ItemQtty' => 1, 'numflag' => $selection));
$ret['output'] = DisplayLib::lastpage();
$ret['receipt'] = 'accessSignupSlip';
return $ret;
}
示例3: head_content
function head_content()
{
$base = MiscLib::baseURL();
?>
<script type="text/javascript" src="<?php
echo $base;
?>
js/selectSubmit.js"></script>
<script type="text/javascript">
function qmNumberPress()
{
var qm_submitted = false;
$('#ddQKselect').keyup(function(event) {
if (event.which >= 49 && event.which <= 57) {
if (!qm_submitted) {
qm_submitted = true;
$('#qmform').submit();
}
} else if (event.which >= 97 && event.which <= 105) {
if (!qm_submitted) {
qm_submitted = true;
$('#qmform').submit();
}
}
});
}
</script>
<?php
}
示例4: preprocess
public function preprocess()
{
$this->upc = FormLib::get('upc');
if (FormLib::get('reginput', false) !== false) {
$inp = FormLib::get('reginput');
if (strtoupper($inp) == 'CL') {
$this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php');
return false;
}
$dbc = Database::pDataConnect();
$empP = $dbc->prepare('
SELECT emp_no
FROM employees
WHERE EmpActive=1
AND frontendsecurity >= ?
AND (CashierPassword=? OR AdminPassword=?)');
if ($dbc->getValue($empP, array(30, $inp, $inp)) !== false) {
CoreLocal::set('strRemembered', $this->upc);
CoreLocal::set('msgrepeat', 1);
$arr = CoreLocal::get('WicOverride');
if (!is_array($arr)) {
$arr = array();
}
$arr[] = ltrim($this->upc, '0');
CoreLocal::set('WicOverride', $arr);
$this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php');
return false;
} else {
$this->box_color = 'errorColoredArea';
}
}
return true;
}
示例5: handle
public function handle($upc, $json)
{
$my_url = MiscLib::base_url();
switch (ltrim($upc, '0')) {
case '8006':
if (CoreLocal::get("memberID") == 0) {
$json['main_frame'] = $my_url . 'gui-modules/memlist.php';
} else {
if (CoreLocal::get("msgrepeat") == 0) {
CoreLocal::set("boxMsg", "<B>" . $total . " stock payment</B><BR>insert form<BR>press [enter] to endorse<P><FONT size='-1'>[clear] to cancel</FONT>");
$ret["main_frame"] = $my_url . "gui-modules/boxMsg2.php?endorse=stock&endorseAmt=" . $total;
}
}
break;
case '8005':
if (CoreLocal::get("memberID") == 0) {
$json['main_frame'] = $my_url . 'gui-modules/memlist.php';
} elseif (CoreLocal::get("isMember") == 0) {
$json['output'] = DisplayLib::boxMsg(_("member discount not applicable"), '', false, DisplayLib::standardClearButton());
} elseif (CoreLocal::get("percentDiscount") > 0) {
$json['output'] = DisplayLib::boxMsg(CoreLocal::get("percentDiscount") . "% discount already applied", '', false, DisplayLib::standardClearButton());
}
break;
}
// magic plu, but other conditions not matched
if ($json['main_frame'] === false && empty($json['output'])) {
$json['output'] = DisplayLib::boxMsg($upc . "<br />is not a valid item", '', false, DisplayLib::standardClearButton());
}
return $json;
}
示例6: preprocess
function preprocess()
{
// check for posts before drawing anything, so we can redirect
if (isset($_REQUEST['reginput'])) {
$input = strtoupper(trim($_REQUEST['reginput']));
// CL always exits
if ($input == "CL") {
CoreLocal::set("msgrepeat", 0);
CoreLocal::set("toggletax", 0);
CoreLocal::set("togglefoodstamp", 0);
$this->change_page(MiscLib::baseURL() . "gui-modules/pos2.php");
return false;
} elseif ($input == "") {
$this->change_page('BitCoinPaymentPage.php?amount=' . CoreLocal::get('amtdue'));
return false;
} elseif ($input != "" && substr($input, -2) != "CL") {
// any other input is an alternate amount
// convert cents to dollars and make sure it's valid
$this->amt = $input;
if (is_numeric($input)) {
$this->amt = MiscLib::truncate2($this->amt / 100.0);
}
if ($this->validateAmount($this->amt)) {
$this->change_page('BitCoinPaymentPage.php?amount=' . $this->amt);
return false;
}
}
}
// post?
return true;
}
示例7: ajax
protected function ajax()
{
$decision = strtoupper(FormLib::get('input', 'CL'));
$ret = array('dest_page' => MiscLib::base_url() . 'gui-modules/pos2.php', 'endorse' => false, 'cleared' => false);
$repeat_cmd = CoreLocal::get('strEntered');
$requested_cmd = FormLib::get('cmd');
if (!empty($requested_cmd)) {
$repeat_cmd = $requested_cmd;
}
if ($decision == "CL") {
CoreLocal::set("msgrepeat", 0);
CoreLocal::set("lastRepeat", '');
CoreLocal::set("toggletax", 0);
CoreLocal::set("togglefoodstamp", 0);
CoreLocal::set("RepeatAgain", false);
$ret['cleared'] = true;
} elseif (strlen($decision) > 0) {
CoreLocal::set("msgrepeat", 1);
CoreLocal::set("strRemembered", $repeat_cmd);
} else {
CoreLocal::set("msgrepeat", 1);
CoreLocal::set("strRemembered", $repeat_cmd);
}
return $ret;
}
示例8: getHeader
public function getHeader()
{
ob_start();
$my_url = $this->page_url;
?>
<!DOCTYPE html>
<html>
<?php
echo "<head>";
echo "<title>COREPOS</title>";
// 18Aug12 EL Add content/charset.
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}css/pos.css\">";
if (MiscLib::win32()) {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}js/jquery-1.8.3.min.js\"></script>";
} else {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}js/jquery.js\"></script>";
}
$this->paycard_jscript_functions();
$this->head_content();
echo "</head>";
echo '<body class="' . $this->body_class . '">';
echo "<div id=\"boundingBox\">";
$this->input_header($this->action);
return ob_get_clean();
}
示例9: parse
function parse($str)
{
$ret = $this->default_json();
if ($str == "FNTL") {
$ret['main_frame'] = MiscLib::base_url() . 'gui-modules/fsTotalConfirm.php';
} elseif ($str == "TETL") {
$ret['main_frame'] = MiscLib::base_url() . 'gui-modules/requestInfo.php?class=Totals';
} elseif ($str == "FTTL") {
PrehLib::finalttl();
} elseif ($str == "TL") {
CoreLocal::set('End', 0);
$chk = PrehLib::ttl();
if ($chk !== True) {
$ret['main_frame'] = $chk;
}
} elseif ($str == "MTL") {
$chk = PrehLib::omtr_ttl();
if ($chk !== True) {
$ret['main_frame'] = $chk;
}
} elseif ($str == "WICTL") {
$ttl = PrehLib::wicableTotal();
$ret['output'] = DisplayLib::boxMsg(_('WIC Total') . sprintf(': $%.2f', $ttl), '', true, DisplayLib::standardClearButton());
// return early since output has been set
return $ret;
}
if (!$ret['main_frame']) {
$ret['output'] = DisplayLib::lastpage();
$ret['redraw_footer'] = True;
}
return $ret;
}
示例10: addItem
function addItem($row, $quantity, $priceObj)
{
if ($quantity == 0) {
return False;
}
// enforce limit on discounting sale items
$dsi = CoreLocal::get('DiscountableSaleItems');
if ($dsi == 0 && $dsi !== '' && $priceObj->isSale()) {
$row['discount'] = 0;
}
/*
Use "quantity" field in products record as a per-transaction
limit. This is analogous to a similar feature with sale items.
*/
if (!$priceObj->isSale() && $row['quantity'] > 0) {
$db = Database::tDataConnect();
$query = "SELECT SUM(quantity) as qty FROM localtemptrans\n WHERE upc='{$row['upc']}'";
$result = $db->query($query);
if ($db->num_rows($result) > 0) {
$chkRow = $db->fetch_row($result);
if ($chkRow['qty'] + $quantity > $row['quantity']) {
$this->error_msg = _("item only allows ") . $row['quantity'] . _(" per transaction");
return False;
}
}
}
$pricing = $priceObj->priceInfo($row, $quantity);
TransRecord::addRecord(array('upc' => $row['upc'], 'description' => $row['description'], 'trans_type' => 'I', 'trans_subtype' => isset($row['trans_subtype']) ? $row['trans_subtype'] : '', 'department' => $row['department'], 'quantity' => $quantity, 'unitPrice' => $pricing['unitPrice'], 'total' => MiscLib::truncate2($pricing['unitPrice'] * $quantity), 'regPrice' => $pricing['regPrice'], 'scale' => $row['scale'], 'tax' => $row['tax'], 'foodstamp' => $row['foodstamp'], 'discount' => $pricing['discount'], 'memDiscount' => $pricing['memDiscount'], 'discountable' => $row['discount'], 'discounttype' => $row['discounttype'], 'ItemQtty' => $quantity, 'volDiscType' => $row['pricemethod'], 'volume' => $row['quantity'], 'VolSpecial' => $row['groupprice'], 'mixMatch' => $row['mixmatchcode'], 'cost' => isset($row['cost']) ? $row['cost'] * $quantity : 0.0, 'numflag' => isset($row['numflag']) ? $row['numflag'] : 0, 'charflag' => isset($row['charflag']) ? $row['charflag'] : ''));
return true;
}
示例11: preprocess
public function preprocess()
{
$this->box_css_class = 'coloredArea';
$this->msg = _('please enter your password');
$this->body_class = '';
if (isset($_REQUEST['reginput']) || isset($_REQUEST['userPassword'])) {
$passwd = '';
if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) {
$passwd = $_REQUEST['reginput'];
UdpComm::udpSend('goodBeep');
} elseif (isset($_REQUEST['userPassword']) && !empty($_REQUEST['userPassword'])) {
$passwd = $_REQUEST['userPassword'];
}
if (Authenticate::checkPassword($passwd)) {
Database::testremote();
$sd = MiscLib::scaleObject();
if (is_object($sd)) {
$sd->ReadReset();
}
/**
Find a drawer for the cashier
*/
$my_drawer = ReceiptLib::currentDrawer();
if ($my_drawer == 0) {
$available = ReceiptLib::availableDrawers();
if (count($available) > 0) {
ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $available[0]);
$my_drawer = $available[0];
}
} else {
ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $my_drawer);
}
TransRecord::addLogRecord(array('upc' => 'SIGNIN', 'description' => 'Sign In Emp#' . CoreLocal::get('CashierNo')));
/**
Use Kicker object to determine whether the drawer should open
The first line is just a failsafe in case the setting has not
been configured.
*/
if (session_id() != '') {
session_write_close();
}
$kicker_class = CoreLocal::get("kickerModule") == "" ? 'Kicker' : CoreLocal::get('kickerModule');
$kicker_object = new $kicker_class();
if ($kicker_object->kickOnSignIn()) {
ReceiptLib::drawerKick();
}
if ($my_drawer == 0) {
$this->change_page($this->page_url . "gui-modules/drawerPage.php");
} else {
$this->change_page($this->page_url . "gui-modules/pos2.php");
}
return false;
} else {
$this->box_css_class = 'errorColoredArea';
$this->msg = _('password invalid, please re-enter');
}
}
return true;
}
示例12: priceInfo
public function priceInfo($row, $quantity = 1)
{
if (is_array($this->savedInfo)) {
return $this->savedInfo;
}
$ret = array();
$ret["regPrice"] = $row['normal_price'];
$ret["unitPrice"] = $row['special_price'];
/* if not by weight, just use the sticker price
(for scaled items, the UPC parse module
calculates a weight estimate and sets a quantity
so normal_price can be used. This could be done
for all items, but typically the deli doesn't
keep good track of whether their items are
marked scale correctly since it only matters when an
item goes on sale
*/
if (isset($row['stickerprice']) && $row['scale'] == 0) {
$ret['regPrice'] = $row['stickerprice'];
}
$ret['discount'] = ($ret['regPrice'] - $row['special_price']) * $quantity;
$ret['memDiscount'] = 0;
if ($row['line_item_discountable'] == 1 && CoreLocal::get("itemPD") > 0) {
$discount = $row['special_price'] * (CoreLocal::get("itemPD") / 100);
$ret["unitPrice"] = $row['special_price'] - $discount;
$ret["discount"] += $discount * $quantity;
}
// enforce per-transaction limit
if ($row['specialpricemethod'] == 0 && $row['specialquantity'] > 0) {
$tdb = Database::tDataConnect();
$chkQ = "SELECT sum(ItemQtty) FROM\n localtemptrans WHERE upc='{$row['upc']}'";
if (strlen($row['mixmatchcode']) > 0 && $row['mixmatchcode'][0] == 'b') {
$chkQ .= " OR mixMatch='{$row['mixmatchcode']}'";
}
$chkR = $tdb->query($chkQ);
$prevSales = 0;
if ($tdb->num_rows($chkR) > 0) {
$prevSales = array_pop($tdb->fetch_row($chkR));
}
if ($prevSales >= $row['specialquantity']) {
// already sold the limit; use non-sale price
$ret['unitPrice'] = $row['normal_price'];
$ret['discount'] = 0;
} else {
if ($prevSales + $quantity > $row['specialquantity']) {
// this multiple qty ring will pass the limit
// set discount based on appropriate quantity
// and adjust unitPrice so total comes out correctly
$discountQty = $row['specialquantity'] - $prevSales;
$ret['discount'] = ($ret['regPrice'] - $row['special_price']) * $discountQty;
$total = $ret['regPrice'] * $quantity - $ret['discount'];
$ret['unitPrice'] = MiscLib::truncate2($total / $quantity);
}
}
}
$this->savedRow = $row;
$this->savedInfo = $ret;
return $ret;
}
示例13: adminLoginCallback
public static function adminLoginCallback($success)
{
if ($success) {
return MiscLib::base_url() . 'ajax-callbacks/ddd.php';
} else {
return false;
}
}
示例14: apply
public function apply()
{
if (CoreLocal::get('memberID') && in_array(CoreLocal::get('memberID'), CoreLocal::get('InactiveMemList')) && CoreLocal::get('InactiveMemApproval')) {
return MiscLib::baseURL() . 'gui-modules/adminlogin.php?class=InactiveMemTotalAction';
} else {
return true;
}
}
示例15: addItem
function addItem($row, $quantity, $priceObj)
{
if ($quantity == 0) {
return false;
}
$pricing = $priceObj->priceInfo($row, $quantity);
TransRecord::addRecord(array('upc' => $row['upc'], 'description' => $row['description'], 'trans_type' => 'I', 'trans_subtype' => isset($row['trans_subtype']) ? $row['trans_subtype'] : '', 'department' => $row['department'], 'quantity' => $quantity, 'unitPrice' => $pricing['unitPrice'], 'total' => MiscLib::truncate2($pricing['unitPrice'] * $quantity), 'regPrice' => $pricing['regPrice'], 'scale' => $row['scale'], 'tax' => $row['tax'], 'foodstamp' => $row['foodstamp'], 'discount' => $pricing['discount'], 'memDiscount' => $pricing['memDiscount'], 'discountable' => $row['discounttype'] > 0 ? 0 : $row['discount'], 'discounttype' => $row['discounttype'], 'ItemQtty' => $quantity, 'volDiscType' => $row['pricemethod'], 'volume' => $row['quantity'], 'VolSpecial' => $row['groupprice'], 'mixMatch' => $row['mixmatchcode'], 'cost' => isset($row['cost']) ? $row['cost'] * $quantity : 0.0, 'numflag' => isset($row['numflag']) ? $row['numflag'] : 0, 'charflag' => isset($row['charflag']) ? $row['charflag'] : ''));
return True;
}