當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Factory::createItem方法代碼示例

本文整理匯總了PHP中Factory::createItem方法的典型用法代碼示例。如果您正苦於以下問題:PHP Factory::createItem方法的具體用法?PHP Factory::createItem怎麽用?PHP Factory::createItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Factory的用法示例。


在下文中一共展示了Factory::createItem方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generateTypeOptions

function generateTypeOptions($type, $empty, $value = '')
{
    $return = $empty == true ? '<option value=""></option>' : '';
    $factoryItem = Factory::createItem($type);
    $optArr = $factoryItem->generateTypeOptions($type);
    foreach ($optArr as $opt) {
        $selected = $opt[0] == $value ? ' selected' : '';
        $return .= '<option value="' . $opt[0] . '"' . $selected . '>' . htmlspecialchars($opt[1], ENT_QUOTES | ENT_HTML5, 'UTF-8') . '</option>';
    }
    return $return;
}
開發者ID:audemium,項目名稱:erp,代碼行數:11,代碼來源:helpers.php

示例2: addChange

	Outputs: 
*/
if ($_POST['action'] == 'deleteAttachment') {
    $return = ['status' => 'fail'];
    if (unlink('attachments/' . $_POST['subID'])) {
        $sth = $dbh->prepare('SELECT type, id, name, extension FROM attachments
				WHERE attachmentID = :attachmentID');
        $sth->execute([':attachmentID' => $_POST['subID']]);
        $row = $sth->fetch();
        $sth = $dbh->prepare('DELETE FROM attachments
				WHERE attachmentID = :attachmentID');
        $sth->execute([':attachmentID' => $_POST['subID']]);
        $return = ['status' => 'success'];
        addChange($row['type'], $row['id'], $_SESSION['employeeID'], 'D', json_encode(['subType' => 'attachment', 'name' => $row['name'], 'extension' => $row['extension']]));
    }
    echo json_encode($return);
}
/*
	Function: customAjax
	Inputs: 
	Outputs: 
*/
if ($_POST['action'] == 'customAjax') {
    $data = $_POST;
    unset($data['action']);
    unset($data['type']);
    unset($data['id']);
    $factoryItem = Factory::createItem($_POST['type']);
    $return = $factoryItem->customAjax($_POST['id'], $data);
    echo json_encode($return);
}
開發者ID:jewelhuq,項目名稱:erp,代碼行數:31,代碼來源:ajax.php

示例3: while

}
//recurring expenseOthers
$sth = $dbh->prepare('SELECT expenseID, name, unitPrice, quantity, recurringID, dayOfMonth
		FROM expenseOthers
		WHERE recurringID IS NOT NULL AND startDate <= :today AND endDate >= :today');
$sth->execute([':today' => $today]);
while ($row = $sth->fetch()) {
    $day = date('j', $today);
    if ($day == $row['dayOfMonth']) {
        $sth2 = $dbh->prepare('INSERT INTO expenseOthers (expenseID, name, date, unitPrice, quantity, parentRecurringID)
				VALUES(:expenseID, :name, :date, :unitPrice, :quantity, :parentRecurringID)');
        $sth2->execute([':expenseID' => $row['expenseID'], ':name' => $row['name'], ':date' => $today, ':unitPrice' => $row['unitPrice'], ':quantity' => $row['quantity'], ':parentRecurringID' => $row['recurringID']]);
        $expenseItem->updateAmountDue($row['expenseID']);
    }
}
$orderItem = Factory::createItem('order');
//recurring orders_products
$sth = $dbh->prepare('SELECT orderProductID, orderID, productID, unitPrice, quantity, recurringID, dayOfMonth
		FROM orders_products
		WHERE recurringID IS NOT NULL AND startDate <= :today AND endDate >= :today');
$sth->execute([':today' => $today]);
while ($row = $sth->fetch()) {
    $day = date('j', $today);
    if ($day == $row['dayOfMonth']) {
        $sth2 = $dbh->prepare('INSERT INTO orders_products (orderID, productID, date, unitPrice, quantity, parentRecurringID)
				VALUES(:orderID, :productID, :date, :unitPrice, :quantity, :parentRecurringID)');
        $sth2->execute([':orderID' => $row['orderID'], ':productID' => $row['productID'], ':date' => $today, ':unitPrice' => $row['unitPrice'], ':quantity' => $row['quantity'], ':parentRecurringID' => $row['recurringID']]);
        $id = $dbh->lastInsertId();
        //check for discounts on the item
        $sth2 = $dbh->prepare('SELECT discountID, discountType, discountAmount
				FROM orders_discounts
開發者ID:audemium,項目名稱:erp,代碼行數:31,代碼來源:cron.php


注:本文中的Factory::createItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。