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


PHP Inventory類代碼示例

本文整理匯總了PHP中Inventory的典型用法代碼示例。如果您正苦於以下問題:PHP Inventory類的具體用法?PHP Inventory怎麽用?PHP Inventory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: actionAdmin

 public function actionAdmin()
 {
     $model = new Inventory('search');
     $model->unsetAttributes();
     if (isset($_GET['Inventory'])) {
         $model->setAttributes($_GET['Inventory']);
     }
     $this->render('admin', array('model' => $model));
 }
開發者ID:schmunk42,項目名稱:yii-sakila-crud,代碼行數:9,代碼來源:InventoryController.php

示例2: test_find

 function test_find()
 {
     $item = "POGs";
     $item2 = "Pokemon Cards";
     $test_item = new Inventory($item);
     $test_item->save();
     $test_item2 = new Inventory($item2);
     $test_item2->save();
     $search_item = $test_item->getItem();
     $result = Inventory::find($search_item);
     $this->assertEquals($test_item, $result);
 }
開發者ID:CaseyH33,項目名稱:Inventory-MySQL,代碼行數:12,代碼來源:InventoryTest.php

示例3: test_find

 function test_find()
 {
     $description = "Blue candy";
     $description2 = "Light blue candy";
     $test_Inventory = new Inventory($description);
     $test_Inventory->save();
     $test_Inventory2 = new Inventory($description2);
     //Act
     $id = $test_Inventory->getId();
     $result = Inventory::find($id);
     //Assert
     $this->assertEquals($test_Inventory, $result);
 }
開發者ID:kylepratuch,項目名稱:Inventory,代碼行數:13,代碼來源:InventoryTest.php

示例4: game_change

 /**
  * Moving an Item from one spot to the other in a Bag
  */
 function game_change($from_bag_id = null, $from_bag_index = null, $to_bag_id = null, $to_bag_index = null)
 {
     $this->render(false);
     App::import('Model', 'Inventory');
     $Inventory = new Inventory();
     $Inventory->unbindModelAll();
     $fromInventory = $Inventory->find('first', array('conditions' => array('Inventory.character_id' => $this->characterInfo['id'], 'Inventory.bag_id' => $from_bag_id, 'Inventory.index' => $from_bag_index)));
     if (!empty($fromInventory)) {
         // KLijken of het vakje leeg is waar we heen gaan
         $toInventory = $Inventory->find('first', array('conditions' => array('Inventory.character_id' => $this->characterInfo['id'], 'Inventory.bag_id' => $to_bag_id, 'Inventory.index' => $to_bag_index)));
         if (!empty($toInventory)) {
             // Niks aan de hand, wisselen
             // to => from
             $oldIds = $Inventory->find('list', array('conditions' => array('Inventory.character_id' => $this->characterInfo['id'], 'Inventory.bag_id' => $from_bag_id, 'Inventory.index' => $from_bag_index)));
             $Inventory->updateAll(array('Inventory.bag_id' => $fromInventory['Inventory']['bag_id'], 'Inventory.index' => $fromInventory['Inventory']['index']), array('Inventory.bag_id' => $toInventory['Inventory']['bag_id'], 'Inventory.index' => $toInventory['Inventory']['index']));
             // from => to
             $Inventory->updateAll(array('Inventory.bag_id' => $toInventory['Inventory']['bag_id'], 'Inventory.index' => $toInventory['Inventory']['index']), array('Inventory.id' => $oldIds));
         } else {
             // kijken of er in de nieuwe bag slot wel ruimte is
             $this->Bag->recursive = 2;
             $toBag = $this->Bag->find('first', array('conditions' => array('Bag.id' => $to_bag_id, 'Bag.character_id' => $this->characterInfo['id'])));
             if (!empty($toBag)) {
                 // Kijken of de index lager is dan het aantal vrije slots
                 if ($toBag['Item']['StatNamed']['slots'] >= $to_bag_index) {
                     // Mag naar de lege plek
                     $Inventory->updateAll(array('Inventory.bag_id' => $to_bag_id, 'Inventory.index' => $to_bag_index), array('Inventory.bag_id' => $fromInventory['Inventory']['bag_id'], 'Inventory.index' => $fromInventory['Inventory']['index']));
                 }
             }
         }
     }
     $this->redirect('/game/bags/view/' . $to_bag_id);
     exit;
 }
開發者ID:MortalROs,項目名稱:Naxasius-Game-Engine,代碼行數:36,代碼來源:bags_controller.php

示例5: test_find

 function test_find()
 {
     //Arrange
     $item = "Antique Toothpick Holders";
     $item2 = "Ornamental Mouse Traps";
     $test_Inventory = new Inventory($item);
     $test_Inventory->save();
     $test_Inventory2 = new Inventory($item2);
     $test_Inventory2->save();
     //Act
     $id = $test_Inventory->getId();
     $result = Inventory::find($id);
     //Assert
     $this->assertEquals($test_Inventory, $result);
 }
開發者ID:alexdbrown,項目名稱:sql-inventory,代碼行數:15,代碼來源:InventoryTest.php

示例6: proceed

 protected function proceed()
 {
     $srv = new InventoriesService();
     switch ($this->action) {
         case 'save':
             $jsInv = json_decode($this->getParam("inventory"));
             $id = null;
             if (!property_exists($jsInv, 'id')) {
                 $jsInv->id = null;
             }
             $inv = Inventory::__build($jsInv->id, $jsInv->date, $jsInv->locationId);
             foreach ($jsInv->items as $item) {
                 if (!property_exists($item, 'missingQty')) {
                     $item->missingQty = null;
                 }
                 if (!property_exists($item, 'unitValue')) {
                     $item->unitValue = null;
                 }
                 if (!property_exists($item, "attrSetInstId")) {
                     $item->attrSetInstId = null;
                 }
                 $item = new InventoryItem($inv->id, $item->productId, $item->attrSetInstId, $item->qty, $item->lostQty, $item->defectQty, $item->missingQty, $item->unitValue);
                 $inv->addItem($item);
             }
             $inv->fillZero();
             $id = $srv->create($inv);
             if ($id !== false) {
                 $this->succeed($id);
             } else {
                 $this->fail(APIError::$ERR_GENERIC);
             }
             break;
     }
 }
開發者ID:booko,項目名稱:pasteque-server,代碼行數:34,代碼來源:InventoriesAPI.php

示例7: testBuild

 /** @depends testConstruct */
 public function testBuild()
 {
     $inv = Inventory::__build(1, 1000, 1);
     $this->assertEquals(1, $inv->id);
     $this->assertEquals(1000, $inv->date);
     $this->assertEquals(1, $inv->locationId);
 }
開發者ID:booko,項目名稱:pasteque-server,代碼行數:8,代碼來源:InventoryTest.php

示例8: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $collection = Collection::find($id);
     $inventories = $collection->inventory;
     $inventory = Inventory::find($id);
     $this->layout->content = View::make('collections.edit')->with('collection', $collection)->with('inventories', $inventories)->with('inventory', $inventory);
 }
開發者ID:joisak,項目名稱:phorrow,代碼行數:13,代碼來源:CollectionController.php

示例9: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Inventory::create([]);
     }
 }
開發者ID:jonagoldman,項目名稱:channelmanager,代碼行數:7,代碼來源:InventoriesTableSeeder.php

示例10: remove_item

 function remove_item()
 {
     $invoice_id = $this->input->post("invoice_id");
     $inventory_id = $this->input->post("inventory_id");
     $inventoryObject = new Inventory($inventory_id);
     $inventoryObject->invoice_id = NULL;
     $inventoryObject->status = 1;
     // In Stock
     $inventoryObject->save();
     $invoiceObject = new Invoice($invoice_id);
     $invoiceObject->total -= $inventoryObject->sale_price;
     $invoiceObject->save();
     $data["total"] = $invoiceObject->total;
     $data["tbody_html"] = $this->_html($invoiceObject);
     echo json_encode($data);
 }
開發者ID:narendranag,項目名稱:Profectus,代碼行數:16,代碼來源:invoicing.php

示例11: add_item

 public function add_item($item_id, $item_owner, $amount)
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'MAX(item_unique_id) as item_unique_id';
     $last_item_id = Inventory::model()->find($criteria);
     $form = new Inventory();
     $form->scenario = 'buy';
     $form->item_id = $item_id;
     $form->item_owner = $item_owner;
     $form->item_creator = '';
     $form->item_count = $amount;
     $form->item_unique_id = $last_item_id->item_unique_id + 1;
     $form->item_location = 127;
     $form->item_skin = $item_id;
     $form->save(false);
     return $form->item_unique_id;
 }
開發者ID:noiary,項目名稱:Aion-Core-v4.7.5,代碼行數:17,代碼來源:MailController.php

示例12: actionIdelete

 public function actionIdelete($id)
 {
     if (Yii::app()->user->isGuest or Yii::app()->user->access_level < Config::get('access_level_admin')) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $model = Inventory::model()->findByPK($id);
     $model->delete();
     $this->redirect(Yii::app()->homeUrl . 'admin/check/items/');
 }
開發者ID:noiary,項目名稱:Aion-Core-v4.7.5,代碼行數:9,代碼來源:CheckController.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $del = Inventory::find($id)->delete();
     if ($del) {
         echo "Your Item Deleted";
     } else {
         echo "Not Found or Already Deleted";
     }
 }
開發者ID:rana7cse,項目名稱:motoshop,代碼行數:15,代碼來源:InventoryController.php

示例14: makeSell

 function makeSell()
 {
     $date = "{$_POST['date']} 02:02:02";
     db("insert into sell (vendorIndex,vendor,memoNo,rawPrice,extraCost,extraCostDescr,shippingCost,commission,discount,totalPrice,paid,due,date,currDue,sellType) \n\t\t\tvalues ('{$this->clientIndex}','client','{$this->memoNo}','{$this->rawPrice}','{$this->extraCost}','{$this->extraCostDescr}','{$this->shippingCost}','{$this->commission}','{$this->discount}','{$this->totalPrice}','{$this->paid}','{$this->due}','{$date}','{$this->currDue}','clientPurchase')");
     for ($index = 0; $index < $this->productList; $index++) {
         $product = $this->product[$index];
         db("insert into sell_log\n\t\t\t(memoNo,pid,descr,qty,sp,cpDoz,date) values ('{$this->memoNo}','{$product->pid}','{$product->descr}','{$product->qty}','{$product->sp}','{$product->cpDoz}','{$date}')");
         Inventory::remove($product);
     }
 }
開發者ID:n-sakib,項目名稱:juierp,代碼行數:10,代碼來源:sell.php

示例15: find

 static function find($search_id)
 {
     $found_item = null;
     $items = Inventory::getAll();
     foreach ($items as $item) {
         $item_id = $item->getId();
         if ($item_id == $search_id) {
             $found_item = $item;
         }
     }
     return $found_item;
 }
開發者ID:kylepratuch,項目名稱:Inventory,代碼行數:12,代碼來源:Inventory.php


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