本文整理汇总了PHP中Item::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getAll方法的具体用法?PHP Item::getAll怎么用?PHP Item::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::getAll方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_items
function get_items()
{
global $smarty, $fpdo;
$oItem = new Item($fpdo);
$items_results = $oItem->getAll();
$smarty->assign('items', $items_results);
$smarty->display('showitems.tpl');
}
示例2: test_deleteAll
function test_deleteAll()
{
$name = "Gold Liberty Dollar";
$name2 = "Bronze My Little Pony: Applejack";
$test_Item = new Item(null, $name);
$test_Item->save();
$test_Item2 = new Item(null, $name2);
$test_Item2->save();
Item::deleteAll();
$result = Item::getAll();
$this->assertEquals([], $result);
}
示例3: find
static function find($found_id)
{
$found_item = null;
$items = Item::getAll();
foreach ($items as $item) {
$id = $item->getId();
if ($id == $found_id) {
$found_item = $item;
}
}
return $found_item;
}
示例4: test_deleteAll
function test_deleteAll()
{
//Arrange
$name = "Hello Kitty";
$name2 = "Pokemon";
$test_Item = new Item($name);
$test_Item->save();
$test_Item2 = new Item($name2);
$test_Item2->save();
//Act
Item::deleteAll();
$result = Item::getAll();
//Assert
$this->assertEquals([], $result);
}
示例5: testDeleteAll
function testDeleteAll()
{
//Arrange
$collection_name = "Cool stuff";
$test_collection = new Collection($collection_name);
$test_collection->save();
$test_collection_id = $test_collection->getId();
$name = "Hello Kitty";
$name2 = "Pokemon";
$test_item = new Item($name, $test_collection_id);
$test_item->save();
$test_item2 = new Item($name2, $test_collection_id);
$test_item2->save();
//Act
Item::deleteAll();
$result = Item::getAll();
//Assert
$this->assertEquals([], $result);
}
示例6: PDO
Debug::enable();
$app = new Silex\Application();
// Set Silex debug mode in $app object
$app['debug'] = true;
$server = 'mysql:host=localhost;dbname=inventory';
$username = 'root';
$password = 'root';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get('/', function () use($app) {
return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/collection', function () use($app) {
$collection = new Collection($_POST['name']);
$collection->save();
return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/delete_collections', function () use($app) {
Collection::deleteAll();
return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/item', function () use($app) {
$item = new Item($_POST['name']);
$item->save();
return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/delete_items', function () use($app) {
Item::deleteAll();
return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
return $app;
示例7: foreach
if ($storeid) {
$store->read($storeid);
}
include 'inc/widget/error.php';
?>
<form action="" method="post">
<table class="form">
<tr>
<td class="label">Nombre:</td>
<td>
<?php
if ($itemid) {
echo "<input type='hidden' name='itemid' value='{$itemid}'/><span>{$item->name}, {$item->type}</span>";
} else {
$items = Item::getAll("name", "");
echo "<select name='itemid' id='items'>";
echo "<option value=''>-Seleccione-</option>";
foreach ($items as $item) {
echo "<option value='{$item->id}'>{$item->name}, {$item->type}</option>";
}
echo "</select>";
}
?>
</td>
</tr>
<tr>
<td class="label">Cajas:</td>
<td><input name="box" type="text" onchange="multiplicar()" id="box" value="" size="20"/> <span class="mandatory">*</span> </td>
</tr>
<tr>
示例8: testDelete
function testDelete()
{
//Arrange
$description = "Pliny the Elder";
$cost = 5.0;
$id = null;
$test_item = new Item($description, $cost, $id);
$test_item->save();
$description2 = "Lagunitas IPA";
$cost2 = 7.0;
$test_item2 = new Item($description2, $cost2, $id);
$test_item2->save();
//Act
$test_item->delete();
$result = Item::getAll();
//Assert
$this->assertEquals($test_item2, $result[0]);
}
示例9: testDeleteAssociatedItems
function testDeleteAssociatedItems()
{
$collection_name = "Star Wars Cards";
$test_collection = new Collection($collection_name);
$test_collection->save();
$collection_id = $test_collection->getId();
$item_name = "Boba Fett";
$test_item = new Item($item_name, $collection_id);
$test_item->save();
$item_name2 = "Slave 1";
$test_item2 = new Item($item_name2, $collection_id);
$test_item2->save();
// Act
$test_collection->deleteAssociatedItems();
// Assert
$this->assertEquals([], Item::getAll());
}
示例10: PDO
<?php
require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Item.php";
$app = new Silex\Application();
$server = 'mysql:host=localhost;dbname=inventory';
$username = 'root';
$password = 'root';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
return $app['twig']->render('index.html.twig');
});
$app->post("/delete_items", function () use($app) {
Item::deleteAll();
return $app['twig']->render('index.html.twig');
});
$app->post("/inventory", function () use($app) {
$item = new Item("id", $_POST['name']);
$item->save();
return $app['twig']->render("index.html.twig", array("item" => Item::getAll()));
});
return $app;
示例11: Page
$page = new Page(0, "OrderUp - Reporting");
$tmpl = new Template();
$userid = $_SESSION['userid'];
//set breadcrumb
$report_type = isset($_GET['report']) ? $_GET['report'] : null;
$bc = new Breadcrumb('report', $report_type);
$tmpl->breadcrumb = $bc->path;
$tmpl->report_type = $report_type;
$page->run();
//get all items
$items = array();
$items = Item::getAll();
$tmpl->items = $items;
$item_counts = array();
//get all item counts
foreach($items as $item)
{
$item_counts[$item->itemid] = Order_Item::getOrderCount($item->itemid);
}
$tmpl->item_counts = $item_counts;
$order_times = array();
//push active orders
示例12: PDO
<?php
require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../vendor/autoload.php";
$app = new Silex\Application();
$server = 'mysql:host=localhost;dbname=market';
$username = 'root';
$password = 'root';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Prodiver\TwigServerProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
return $app['twig']->render('inventory.html.twig', array('items' => Item::getAll()));
});