本文整理汇总了PHP中addItem函数的典型用法代码示例。如果您正苦于以下问题:PHP addItem函数的具体用法?PHP addItem怎么用?PHP addItem使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showCarrusel
function showCarrusel($titulo, $id, $vods)
{
$idCarousel = "carousel" . $id;
print ' <div class="row">' . "\n";
print ' <div id="titserie">' . $titulo . '</div>' . "\n";
print ' <div class="well">' . "\n";
print '<div id="' . $idCarousel . '" class="carousel slide">' . "\n";
print ' <div class="carousel-inner">' . "\n";
$randVods1 = getNRandomVods($vods, 4);
$randVods2 = getNRandomVods($vods, 4);
$randVods3 = getNRandomVods($vods, 4);
addItem($randVods1, ' active');
addItem($randVods2, '');
addItem($randVods3, '');
// addVideo($randVods1);
// addVideo($randVods2);
// addVideo($randVods3);
print '<div style="display:none;" class="subhtml">' . "\n";
print ' <div class="customHtml">' . "\n";
print ' <h4> Ventana Educativa </h4>' . "\n";
print ' </div>' . "\n";
print '</div>' . "\n";
print '</div> <!-- carousel-inner -->' . "\n";
print '<a class="left carousel-control carouselleft" href="#' . $idCarousel . '" data-slide="prev">' . '<i class="fa fa-chevron-left fa-2x"></i></a>' . "\n";
print '<a class="right carousel-control carouselright" href="#' . $idCarousel . '" data-slide="next">' . '<i class="fa fa-chevron-right fa-2x"></i></a>' . "\n";
print '<ol class="carousel-indicators">' . "\n";
print '<li data-target="#' . $idCarousel . '" data-slide-to="0" class="active"></li>' . "\n";
print '<li data-target="#' . $idCarousel . '" data-slide-to="1"></li>' . "\n";
print '<li data-target="#' . $idCarousel . '" data-slide-to="2"></li>' . "\n";
print '</ol>' . "\n";
print '</div> <!--End Carousel-->' . "\n";
print '</div> <!--End Well-->' . "\n";
print '</div> <!--End row-->' . "\n";
}
示例2: render_give_item
function render_give_item($username, $target, $item)
{
$article = get_indefinite_article($item);
addItem($target, $item, 1);
$give_msg = "You have been given {$article} {$item} by {$username}.";
sendMessage($username, $target, $give_msg);
return "{$target} will receive your {$item}.<br>\n";
}
示例3: addNewBook
function addNewBook($title)
{
$addBook = array('UF_TITLE' => $title);
$result = addItem(2, $addBook);
if ($result->isSuccess()) {
$_SESSION['BookMessage'] = "Книга " . $title . " добавлена!";
} else {
$_SESSION['BookMessage'] = "При добавлении книги произошла ошибка!";
}
return $result->getId();
}
示例4: __construct
/**
* MenuItem constructor.
*/
public function __construct($id)
{
$this->id = $id;
if (is_null(static::$current)) {
static::$current = $this;
$this->level(0);
} else {
static::$current = addItem($this);
$this->level(static::$current->level() + 1);
}
}
示例5: generateColumnsNode
function generateColumnsNode($xml, $columnsName, $pulsestorm_commercebug_log_id, $pageActionsClassName)
{
$columns = simpleXmlAddNodesXpath($xml, "columns[@name={$columnsName}]");
$sectionColumns = $columns->addChild('selectionsColumn');
$sectionColumns->addAttribute('name', 'ids');
$data = addArgument($sectionColumns, 'data', 'array');
$config = addItem($data, 'config', 'array');
addBaseColumnItemNodes($config, '55', $pulsestorm_commercebug_log_id);
addIdColumnToColumns($columns, $data, $pulsestorm_commercebug_log_id);
addActionsColumnToColumns($columns, $pageActionsClassName, $pulsestorm_commercebug_log_id);
return $columns;
}
示例6: addItem
/**
* @param $data
* @param \yii\rbac\ManagerInterface $authManager
* @param null $parent
*/
function addItem($data, $authManager, $parent = null)
{
foreach ($data as $d) {
$item = $authManager->createPermission($d['action']);
$item->description = $d['name'];
$authManager->add($item);
$authManager->addChild($parent, $item);
if (isset($d['children'])) {
addItem($d['children'], $authManager, $item);
}
}
}
示例7: pestle_cli
/**
* Generates a Magento 2.1 ui grid listing and support classes.
*
* @command magento2:generate:ui:add-column-sections
* @argument listing_file Which Listing File? []
* @argument column_name Column Name? [ids]
* @argument index_field Index Field/Primary Key? [entity_id]
*/
function pestle_cli($argv)
{
$xml = simplexml_load_file($argv['listing_file']);
validateAsListing($xml);
$columns = getOrCreateColumnsNode($xml);
$sectionsColumn = $columns->addChild('selectionsColumn');
$sectionsColumn->addAttribute('name', $argv['column_name']);
$argument = addArgument($sectionsColumn, 'data', 'array');
$configItem = addItem($argument, 'config', 'array');
$indexField = addItem($configItem, 'indexField', 'string', $argv['index_field']);
writeStringToFile($argv['listing_file'], formatXmlString($xml->asXml()));
}
示例8: clubCard
function clubCard($intItemNum)
{
$query = "select * from localtemptrans where trans_id = " . $intItemNum;
$connection = tDataConnect();
$result = sql_query($query, $connection);
$row = sql_fetch_array($result);
$num_rows = sql_num_rows($result);
if ($num_rows > 0) {
$strUPC = $row["upc"];
$strDescription = $row["description"];
$dblVolSpecial = $row["VolSpecial"];
$dblquantity = -0.5 * $row["quantity"];
$dblTotal = truncate2(-1 * 0.5 * $row["total"]);
// invoked truncate2 rounding function to fix half-penny errors apbw 3/7/05
$strCardNo = $_SESSION["memberID"];
$dblDiscount = $row["discount"];
$dblmemDiscount = $row["memDiscount"];
$intDiscountable = $row["discountable"];
$dblUnitPrice = $row["unitPrice"];
$intScale = nullwrap($row["scale"]);
if ($row["foodstamp"] != 0) {
$intFoodStamp = 1;
} else {
$intFoodStamp = 0;
}
$intdiscounttype = nullwrap($row["discounttype"]);
if ($row["voided"] == 20) {
boxMsg("Discount already taken");
} elseif ($row["trans_type"] == "T" or $row["trans_status"] == "D" or $row["trans_status"] == "V" or $row["trans_status"] == "C") {
boxMsg("Item cannot be discounted");
} elseif (strncasecmp($strDescription, "Club Card", 9) == 0) {
//----- edited by abpw 2/15/05 -----
boxMsg("Item cannot be discounted");
} elseif ($_SESSION["tenderTotal"] < 0 and $intFoodStamp == 1 and -1 * $dblTotal > $_SESSION["fsEligible"]) {
boxMsg("Item already paid for");
} elseif ($_SESSION["tenderTotal"] < 0 and -1 * $dblTotal > $_SESSION["runningTotal"] - $_SESSION["taxTotal"]) {
boxMsg("Item already paid for");
} else {
// --- added partial item desc to club card description - apbw 2/15/05 ---
addItem($strUPC, "Club Card: " . substr($strDescription, 0, 19), "I", "", "J", $row["department"], $dblquantity, $dblUnitPrice, $dblTotal, 0.5 * $row["regPrice"], $intScale, $row["tax"], $intFoodStamp, $dblDiscount, $dblmemDiscount, $intDiscountable, $intdiscounttype, $dblquantity, $row["volDiscType"], $row["volume"], $dblVolSpecial, 0, 0, 0);
$update = "update localtemptrans set voided = 20 where trans_id = " . $intItemNum;
$connection = tDataConnect();
sql_query($update, $connection);
$_SESSION["TTLflag"] = 0;
$_SESSION["TTLRequested"] = 0;
lastpage();
}
}
}
示例9: main
/**
* The structure of the page.
*
* $title The title of the page
*/
function main($title = "")
{
$db = new DB();
if (isset($_REQUEST['add'])) {
$pid = $_REQUEST['add'];
addItem($db, $pid);
} else {
if (isset($_REQUEST['del'])) {
$pid = $_REQUEST['del'];
deleteItem($db, $pid);
} else {
if (isset($_REQUEST['update'])) {
$pid = $_REQUEST['update'];
updateItem($db, $pid);
}
}
}
$other = getJavaScript();
include "includes/header.php";
showContent($title, $db);
include "includes/footer.php";
}
示例10: createXml
function createXml($elements)
{
// Trie les objets par nom
usort($elements, "sortByName");
// Création du fichier xml
$dom = getDom();
// Ajout de l'élément root
$root = $dom->createElement("Elements");
$dom->appendChild($root);
// Ajoute tous les objets
foreach ($elements as $element) {
addItem($element, $dom);
}
// Sauvegarde le fichier xml en conservant l'indentation
$dom->formatOutput = true;
$dom->save("tanieres/" . removeInvalidChar($elements[0][2]) . ".xml");
}
示例11: upcscanned
//.........这里部分代码省略.........
$volume = nullwrap($row["specialquantity"]);
}
}
if ($volDiscType && $volDiscType >= 1) {
// If item is on volume discount
if (!$row["mixmatchcode"] || $row["mixmatchcode"] == 0) {
$mixMatch = 0;
$queryt = "select sum(ItemQtty - matched) as mmqtty from localtemptrans where " . "upc = '" . $row["upc"] . "' group by upc";
} else {
$mixMatch = $row["mixmatchcode"];
$queryt = "select sum(ItemQtty - matched) as mmqtty, mixMatch from localtemptrans " . "where mixMatch = '" . $mixMatch . "' group by mixMatch";
}
if ($volDiscType == 1) {
$unitPrice = truncate2($VolSpecial / $volume);
}
$voladj = $VolSpecial - ($volume - 1) * $unitPrice;
// one at special price
$newmm = (int) ($quantity / $volume);
// number of complete sets
$dbt = tDataConnect();
$resultt = sql_query($queryt, $dbt);
$num_rowst = sql_num_rows($resultt);
if ($num_rowst > 0) {
$rowt = sql_fetch_array($resultt);
$mmqtty = $rowt["mmqtty"];
// number not in complete sets in localtemptrans
} else {
$mmqtty = 0;
}
$newmmtotal = $mmqtty + $quantity % $volume;
$na = $newmmtotal % $volume;
$quantity = $quantity % $volume;
if ($newmm >= 1) {
addItem($upc, $description, "I", "", "", $department, $cost, $newmm, truncate2($VolSpecial), truncate2($newmm * $VolSpecial), truncate2($VolSpecial), $scale, $tax, $foodstamp, $discount, $memDiscount, $discountable, $discounttype, $volume * $newmm, $volDiscType, $volume, $VolSpecial, $mixMatch, $volume * $newmm, 0, 0, '');
$newmm = 0;
$_SESSION["qttyvalid"] = 0;
}
if ($newmmtotal >= $volume) {
addItem($upc, $description, "I", "", "", $department, $cost, 1, $voladj, $voladj, $voladj, $scale, $tax, $foodstamp, $discount, $memDiscount, $discountable, $discounttype, 1, $volDiscType, $volume, $VolSpecial, $mixMatch, $volume, 0, 0, '');
$quantity = $quantity - 1;
$newmmtotal = 0;
$_SESSION["qttyvalid"] = 0;
}
sql_close($dbt);
}
$total = $unitPrice * $quantity;
if (substr($upc, 0, 3) == "002" and $discounttype != 2) {
$unitPrice = truncate2($scaleprice);
$regPrice = $total;
$total = $unitPrice * $quantity;
}
$total = truncate2($total);
$unitPrice = truncate2($unitPrice);
if ($upc == "0000000008010" && $_SESSION["msgrepeat"] == 0) {
$_SESSION["endorseType"] = "giftcert";
$_SESSION["tenderamt"] = $total;
$_SESSION["boxMsg"] = "<b>" . $total . " gift certificate</b><br />insert document<br />press [enter] to endorse<p><font size='-1'>[clear] to cancel</font></p>";
boxMsgscreen();
} elseif ($upc == "0000000008006" && $_SESSION["msgrepeat"] == 0) {
$_SESSION["endorseType"] = "stock";
$_SESSION["tenderamt"] = $total;
$_SESSION["boxMsg"] = "<B>" . $total . " stock payment</B><br />insert form<br />press [enter] to endorse<P><FONT size='-1'>[clear] to cancel</FONT>";
boxMsgscreen();
} elseif ($upc == "0000000008011" && $_SESSION["msgrepeat"] == 0) {
$_SESSION["endorseType"] = "classreg";
$_SESSION["tenderamt"] = $total;
示例12: dirname
require_once dirname(dirname(dirname(__FILE__))) . '/' . PLUGIN_FOLDER . '/zenpage/admin-functions.php';
}
require_once dirname(__FILE__) . '/menu_manager-admin-functions.php';
admin_securityChecks(NULL, currentRelativeURL());
$page = 'edit';
$result = NULL;
$reports = array();
if (isset($_GET['id'])) {
$result = getItem(sanitize($_GET['id']));
}
if (isset($_GET['save'])) {
XSRFdefender('update_menu');
if ($_POST['update']) {
$result = updateMenuItem($reports);
} else {
$result = addItem($reports);
}
}
if (isset($_GET['del'])) {
XSRFdefender('delete_menu');
deleteItem($reports);
}
printAdminHeader('menu', is_array($result) && $result['id'] ? gettext('edit') : gettext('add'));
?>
<link rel="stylesheet" href="../zenpage/zenpage.css" type="text/css" />
<?php
$menuset = checkChosenMenuset();
?>
</head>
<body>
<?php
示例13: update_cart
update_cart($cart);
}
} else {
deleteItem($itemId);
}
}
function deleteItem($itemId)
{
$item = new Item($itemId);
$cart = get_cart();
$cart->deleteItem($item);
update_cart($cart);
}
if (isset($_REQUEST['action'])) {
if ($_REQUEST['action'] == "add") {
addItem($_REQUEST['itemId']);
} else {
if ($_REQUEST['action'] == "delete") {
deleteItem($_REQUEST['itemId']);
} else {
if ($_REQUEST['action'] == "update" || $_REQUEST['action'] == "update_confirm" || $_REQUEST['action'] == "update_continue") {
//print_r($_REQUEST);
$cart = get_cart();
foreach ($cart->items as $itemId => $item) {
if (isset($_REQUEST[$itemId . "_id"]) && isset($_REQUEST[$itemId . "_quantity"])) {
modifyItem($_REQUEST[$itemId . "_id"], $_REQUEST[$itemId . "_quantity"]);
}
}
if (count($errors) != 0) {
$errorMsg = _("No se pudo actualizar el carrito correctamente.");
}
示例14: voidupc
//.........这里部分代码省略.........
$row = sql_fetch_array($result);
$ItemQtty = $row["ItemQtty"];
$foodstamp = nullwrap($row["foodstamp"]);
$discounttype = nullwrap($row["discounttype"]);
$mixMatch = nullwrap($row["mixMatch"]);
if ($_SESSION["isMember"] != 1 && $row["discounttype"] == 2 || $_SESSION["isStaff"] == 0 && $row["discounttype"] == 4) {
$unitPrice = $row["regPrice"];
} elseif (($_SESSION["isMember"] == 1 && $row["discounttype"] == 2 || $_SESSION["isStaff"] != 0 && $row["discounttype"] == 4) && $row["unitPrice"] == $row["regPrice"]) {
$db_p = pDataConnect();
$query_p = "select * from products where upc = '" . $upc . "'";
$result_p = sql_query($query_p, $db_p);
$row_p = sql_fetch_array($result_p);
$unitPrice = $row_p["special_price"];
sql_close($db_p);
} else {
$unitPrice = $row["unitPrice"];
}
$discount = -1 * $row["discount"];
$memDiscount = -1 * $row["memDiscount"];
$discountable = $row["discountable"];
$cost = 0;
if ($_SESSION["ddNotify"] == 1) {
$discountable = $_SESSION["discountable"];
}
//----------------------mix match---------------------
if ($volDiscType >= 1) {
$db_mm = tDataConnect();
$query_mm = "select sum(ItemQtty) as mmqtty from localtemptrans where mixMatch = " . $mixMatch;
$result_mm = sql_query($query_mm, $db_mm);
$row_mm = sql_fetch_array($result_mm);
$mmqtty = nullwrap($row_mm["mmqtty"]);
sql_close($db_mm);
$db_pq = pDataConnect();
$query_pq = "select * from products where upc = '" . $upc . "'";
$result_pq = sql_query($query_pq, $db_pq);
$row_pq = sql_fetch_array($result_pq);
if ($volDiscType == 1) {
$unitPrice = truncate2($row_pq["groupprice"] / $row_pq["quantity"]);
} elseif ($discounttype == 1) {
$unitPrice = $row_pq["special_price"];
$VolSpecial = nullwrap($row_pq["specialgroupprice"]);
} else {
$unitPrice = $row_pq["normal_price"];
$VolSpecial = nullwrap($row_pq["groupprice"]);
}
if ($row_pq["advertised"] == 0) {
$volume = nullwrap($row_pq["quantity"]);
} else {
$volume = nullwrap($row_pq["specialquantity"]);
}
sql_close($db_pq);
$volmulti = (int) ($quantity / $volume);
$vmremainder = $quantity % $volume;
if ($mixMatch == 0) {
$mm = (int) ($voidable / $volume);
$mmremainder = $voidable % $volume;
} else {
$mm = (int) ($mmqtty / $volume);
$mmremainder = $mmqtty % $volume;
}
if ($volmulti > 0) {
addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, -1 * $volmulti, $VolSpecial, -1 * $volmulti * $VolSpecial, $VolSpecial, 0, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, -1 * $volmulti * $volume, $volDiscType, $volume, $VolSpecial, $mixMatch, -1 * $volume * $volmulti, 1, 0, '');
$quantity = $vmremainder;
}
if ($vmremainder > $mmremainder) {
$voladj = $row["VolSpecial"] - $unitPrice * ($volume - 1);
addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, -1, $voladj, -1 * $voladj, $voladj, 0, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, -1, $volDiscType, $volume, $VolSpecial, $mixMatch, -1 * $volume, 1, 0, '');
$quantity = $quantity - 1;
}
}
$quantity = -1 * $quantity;
$total = truncate2($quantity * $unitPrice);
$CardNo = $_SESSION["memberID"];
$discounttype = nullwrap($row["discounttype"]);
if ($discounttype == 3) {
$quantity = -1 * $ItemQtty;
}
if ($_SESSION["tenderTotal"] < 0 && $foodstamp == 1 && -1 * $total > $_SESSION["fsEligible"]) {
boxMsg("Item already paid for");
$lastpageflag = 0;
} elseif ($_SESSION["tenderTotal"] < 0 && -1 * $total > $_SESSION["runningTotal"] - $_SESSION["taxTotal"]) {
boxMsg("Item already paid for");
$lastpageflag = 0;
} elseif ($quantity != 0) {
addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, $quantity, $unitPrice, $total, $row["regPrice"], $scale, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, $quantity, $volDiscType, $volume, $VolSpecial, $mixMatch, 0, 1, 0, '');
if ($row["trans_type"] != "T") {
$_SESSION["ttlflag"] = 0;
$_SESSION["ttlrequested"] = 0;
$_SESSION["discounttype"] = 0;
}
}
if ($lastpageflag == 1) {
lastpage();
} else {
$lastpageflag = 1;
}
}
}
}
}
示例15: rand
if (!subtractHealth($username, $thief_attack)) {
echo "Thief has slain you!<br>\n";
echo "Go to the <a href=\"shrine.php\">shrine</a> to resurrect.<br>\n";
} else {
$thief_gold = rand(0, 40);
// *** Thief Gold ***
if ($thief_attack > 30) {
echo "Thief escaped and stole {$thief_gold} pieces of your gold!\n";
subtractGold($username, $thief_gold);
} else {
if ($thief_attack < 30) {
echo "The Thief is injured!<br>\n";
echo "Thief does {$thief_attack} points of damage!<br>\n";
echo "You have gained {$thief_gold} gold.<br> You have found a Shuriken on the thief!\n";
addGold($username, $thief_gold);
addItem($username, 'Shuriken', $quantity = 1);
}
}
echo "<br>\n";
echo "Beware the Ninja Thieves, they have entered this world to steal from all!<br>\n";
}
}
}
}
}
}
}
}
}
if (getHealth($username) <= 0) {
sendMessage("SysMsg", $username, "DEATH: You have been killed by a non-player character at {$today}");