当前位置: 首页>>代码示例>>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;未经允许,请勿转载。