当前位置: 首页>>代码示例>>PHP>>正文


PHP Item::find方法代码示例

本文整理汇总了PHP中Item::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::find方法的具体用法?PHP Item::find怎么用?PHP Item::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 public static function store()
 {
     self::check_logged_in();
     // POST-pyynnön muuttujat sijaitsevat $_POST nimisessä assosiaatiolistassa
     $params = $_POST;
     //array of item_ids (string)
     //View::make('notimplemented.html');
     $user_id = $_SESSION['user'];
     if (!$params) {
         //Redirect::to('/outfits/' . $user_id . 'new/', array('message' => 'Please select items!'));
     }
     $items_in_outfit = array();
     foreach ($params as $key => $value) {
         if (strlen($key) == 1) {
             $items_in_outfit[] = Item::find($value);
         } else {
             if ($key == 'rating') {
                 $rating = $value;
             } else {
                 if ($key == 'comment') {
                     $comment = $value;
                 }
             }
         }
     }
     $outfit_object = new Outfit(array('outfit_id' => null, 'items' => $items_in_outfit, 'rating' => $rating, 'comment' => $comment));
     $outfit_object->save_to_db($user_id);
     Redirect::to('/outfits/' . $user_id, array('message' => 'Outfit created!'));
 }
开发者ID:juhapekkamoilanen,项目名称:Tsoha-Bootstrap,代码行数:29,代码来源:outfit_controller.php

示例2: output

 function output($message = null, $allowHtml = false, $addslashes = false)
 {
     $message = preg_replace('/\\%name\\%/', $this->Session->read('Game.Character.name'), $message);
     $message = preg_replace('/\\%class\\%/', $this->Session->read('Game.Type.name'), $message);
     $message = preg_replace('/\\%hisher\\%/', 'his', $message);
     if ($allowHtml != true) {
         $message = htmlspecialchars($message);
     }
     /* Items */
     preg_match_all('/\\[item\\](.*?)\\[\\/item\\]/', $message, $items);
     if (isset($items[1]) && !empty($items[1])) {
         // Laat de makers het niet zien...
         App::import('Model', 'Item');
         $Item = new Item();
         $Item->contain();
         $items = $Item->find('all', array('fields' => array('Item.id', 'Item.name', 'Item.quality'), 'conditions' => array('Item.name' => $items[1])));
         foreach ($items as $item) {
             $message = str_replace('[item]' . $item['Item']['name'] . '[/item]', '<span class="item_' . $item['Item']['quality'] . '" onmouseover="showMouseInfo(url + \'items/view/' . addslashes($item['Item']['name']) . '\');" onmouseout="hideMouseInfo();">[' . addslashes($item['Item']['name']) . ']</span>', $message);
         }
     }
     // Quests
     preg_match_all('/\\[quest\\](.*?)\\[\\/quest\\]/', $message, $quests);
     if (isset($quests[1]) && !empty($quests[1])) {
         foreach ($quests[1] as $quest) {
             $message = str_replace('[quest]' . $quest . '[/quest]', '<span class="quest" onmouseover="showMouseInfo(url + \'quests/view/' . $quest . '\');" onmouseout="hideMouseInfo();">' . htmlspecialchars($quest) . '</span>', $message);
         }
     }
     if ($addslashes === true) {
         $message = addslashes($message);
     }
     return $message;
 }
开发者ID:MortalROs,项目名称:Naxasius-Game-Engine,代码行数:32,代码来源:ubb.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $item = Item::find($id);
     if (!$item) {
         return false;
     }
     $item->delete();
 }
开发者ID:KariLe,项目名称:Jamk_kodailut,代码行数:14,代码来源:ShoppingController.php

示例4: testShouldDeleteAllCorrectly

 public function testShouldDeleteAllCorrectly()
 {
     $this->Item->deleteAll(['Item.id' => [1, 3]]);
     $this->assertEmpty($this->Item->find('all'));
     $this->Item->includeDeletedRecords();
     $item = $this->Item->read(null, 1);
     $this->assertEqual($item['Item']['description'], ItemFixture::DESCR_DELETED);
 }
开发者ID:zunderbolt,项目名称:cakephp-softdelete-trait,代码行数:8,代码来源:ItemTest.php

示例5: postUpdate

 public function postUpdate()
 {
     $newname = Input::get('name');
     $id = Input::get('id');
     $ini = Item::find($id);
     $ini->name = $newname;
     $ini->save();
     return Redirect::route('home');
 }
开发者ID:allapo,项目名称:to-do-list,代码行数:9,代码来源:HomeController.php

示例6: mostrarInfoProducto

 public function mostrarInfoProducto($url)
 {
     $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first();
     $item_lang = Item::join('item_lang', 'item_lang.item_id', '=', 'item.id')->where('item_lang.lang_id', $lang->id)->where('item_lang.url', $url)->first();
     //Me quedo con el item, buscando por url
     //$item = Item::where('url', $url)->first();
     $item = Item::find($item_lang->item_id);
     $this->array_view['item'] = $item;
     return View::make($this->folder_name . '.' . $this->project_name . '-ver', $this->array_view);
 }
开发者ID:tatu-carreta,项目名称:mariasanti_v2,代码行数:10,代码来源:ProductoController.php

示例7: delete_items

 function delete_items($id = FALSE)
 {
     $item = Item::find($id);
     $item->inactive = 1;
     $item->save();
     if (!$item) {
         $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_delete_item_error'));
     } else {
         $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_delete_item_success'));
     }
     redirect('items');
 }
开发者ID:anteknik,项目名称:tomanage,代码行数:12,代码来源:items.php

示例8: vistaEditar

 public function vistaEditar($id)
 {
     //Me quedo con el item, buscando por id
     $item = Item::find($id);
     if ($item) {
         $this->array_view['item'] = $item;
         return View::make($this->folder_name . '.editar-item', $this->array_view);
     } else {
         $this->array_view['texto'] = Lang::get('controllers.error_carga_pagina');
         return View::make($this->project_name . '-error', $this->array_view);
     }
 }
开发者ID:tatu-carreta,项目名称:mariasanti_v2,代码行数:12,代码来源:ItemController.php

示例9: ordenar

 public function ordenar()
 {
     foreach (Input::get('orden') as $key => $imagen_id) {
         if ($key == 0) {
             $destacado = 'A';
         } else {
             $destacado = NULL;
         }
         $respuesta = Imagen::ordenarImagenItem($imagen_id, $key, Input::get('item_id'), $destacado);
     }
     $item = Item::find(Input::get('item_id'));
     $menu = $item->seccionItem()->menuSeccion()->modulo()->nombre;
     return Redirect::to('/' . $menu . '/' . $item->lang()->url)->with('mensaje', $respuesta['mensaje'])->with('ok', true);
 }
开发者ID:tatu-carreta,项目名称:mariasanti_v2,代码行数:14,代码来源:ImagenController.php

示例10: test_find

 function test_find()
 {
     //Arrange
     $name = "Hello Kitty";
     $name2 = "Pokemon";
     $test_Item = new Item($name);
     $test_Item->save();
     $test_Item2 = new Item($name2);
     $test_Item2->save();
     //Act
     $result = Item::find($test_Item2->getId());
     //Assert
     $this->assertEquals($test_Item2, $result);
 }
开发者ID:Camolot,项目名称:inventory-PHP-databases,代码行数:14,代码来源:itemTest.php

示例11: run

 public function run()
 {
     $items = Item::all();
     foreach ($items as $item) {
         $i = Item::find($item->id);
         if ($item->participant) {
             $i->event_id = $item->participant->event_id;
             $i->save();
         }
         if ($item->member) {
             $i->team_id = $item->member->team_id;
             $i->save();
         }
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:15,代码来源:PaymentItemsTableSeeder.php

示例12: update

 public static function update($id)
 {
     self::check_logged_in();
     $params = $_POST;
     $attributes = array('id' => $id, 'itemtype_id' => Item::find($id)->itemtype_id, 'description' => $params['description']);
     $item = new Item($attributes);
     $errors = $item->errors();
     if (count($errors) > 0) {
         $item = Item::find($id);
         $itemtype = ItemType::find($item->itemtype_id);
         View::make('item/edit.html', array('errors' => $errors, 'given_description' => $params['description'], 'item' => $item, 'itemtype' => $itemtype));
     } else {
         $item->update();
         Redirect::to('/item/' . $item->id, array('message' => 'The item has been modified successfully!'));
     }
 }
开发者ID:jackrl,项目名称:Tsoha-Bootstrap,代码行数:16,代码来源:items_controller.php

示例13: loot

 /**
  * Looting an Item from an Obstacle in the game map
  *
  * @param int the id of the character
  * @param int the id of the areas_obstacles_item
  */
 function loot($characterInfo = null, $areas_obstacles_item_id = null)
 {
     if ($this->canLoot($areas_obstacles_item_id, $characterInfo['id'], $characterInfo['area_id'])) {
         // Opslaan die handel
         App::import('Model', 'AreasObstaclesItem');
         $AreasObstaclesItem = new AreasObstaclesItem();
         $drop = $AreasObstaclesItem->find('first', array('conditions' => array('AreasObstaclesItem.id' => $areas_obstacles_item_id)));
         $data['Drop']['areas_obstacle_item_id'] = $drop['AreasObstaclesItem']['id'];
         $data['Drop']['item_id'] = $drop['AreasObstaclesItem']['item_id'];
         $data['Drop']['character_id'] = $characterInfo['id'];
         $dataInventory['Inventory']['item_id'] = $drop['AreasObstaclesItem']['item_id'];
         $dataInventory['Inventory']['character_id'] = $characterInfo['id'];
         if ($this->save($data)) {
             // Item opvragen, en eventueel de character_id invullen als deze character de eerste is...
             App::import('Model', 'Item');
             $Item = new Item();
             $Item->unbindModelAll();
             $thisItem = $Item->find('first', array('conditions' => array('Item.id' => $drop['AreasObstaclesItem']['item_id'])));
             if (isset($thisItem['Item']['character_id']) && $thisItem['Item']['character_id'] == 0) {
                 $thisItem['Item']['character_id'] = $characterInfo['id'];
                 $thisItem['Item']['discovered'] = date('Y-m-d H:i:s');
                 $Item->save($thisItem);
             }
             App::import('Model', 'Inventory');
             $Inventory = new Inventory();
             // Bagid en index opvragen
             $bagIndex = $this->hasFreeSpace($characterInfo['id'], $drop['AreasObstaclesItem']['item_id'], true);
             $dataInventory['Inventory']['index'] = $bagIndex['index'];
             $dataInventory['Inventory']['bag_id'] = $bagIndex['bag_id'];
             // Save to inventory
             if ($Inventory->save($dataInventory)) {
                 App::import('Model', 'Quest');
                 $Quest = new Quest();
                 $Quest->update(null, $characterInfo['id']);
                 // Item is nu in de inventory... We kunnen eventueel questen updaten nu
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:MortalROs,项目名称:Naxasius-Game-Engine,代码行数:52,代码来源:drop.php

示例14: vistaEditar

 public function vistaEditar($id, $next, $seccion_next)
 {
     //Me quedo con el item, buscando por id
     $item = Item::find($id);
     $portfolio = Portfolio::find($item->portfolio()->id);
     $secciones = parent::seccionesDinamicas();
     if ($portfolio) {
         $this->array_view['item'] = $portfolio->item();
         $this->array_view['portfolio'] = $portfolio;
         $this->array_view['secciones'] = $secciones;
         $this->array_view['continue'] = $next;
         $this->array_view['seccion_next'] = $seccion_next;
         return View::make($this->folder_name . '.editar', $this->array_view);
     } else {
         $this->array_view['texto'] = Lang::get('controllers.error_carga_pagina');
         return View::make($this->project_name . '-error', $this->array_view);
     }
 }
开发者ID:tatu-carreta,项目名称:mariasanti_v2,代码行数:18,代码来源:PortfolioController.php

示例15: SupplierAndItemInfo

 public function SupplierAndItemInfo()
 {
     App::uses("Supplier", "Inventory.Model");
     App::import("Model", "Inventory.Item");
     $supplierModel = new Supplier();
     $itemModel = new Item();
     $supplierModel->recursive = 0;
     $suppliers = $supplierModel->find("all");
     $tmp_suplliers = array();
     foreach ($suppliers as $key => $supplier) {
         $tmp_suplliers[$supplier['Supplier']['id']]['name'] = $supplier['Supplier']['name'];
         $tmp_suplliers[$supplier['Supplier']['id']]['email'] = $supplier['Supplier']['email'];
         $tmp_suplliers[$supplier['Supplier']['id']]['gst'] = $supplier['Supplier']['gst_rate'];
         $tmp_suplliers[$supplier['Supplier']['id']]['pst'] = $supplier['Supplier']['pst_rate'];
         $tmp_suplliers[$supplier['Supplier']['id']]['item'] = $itemModel->find("list", array("fields" => array("id_plus_item"), 'conditions' => array('supplier_id' => $supplier['Supplier']['id'])));
         $tmp_suplliers[$supplier['Supplier']['id']]['address'] = $this->address_format($supplier['Supplier']['address'], $supplier['Supplier']['city'], $supplier['Supplier']['province'], $supplier['Supplier']['country'], $supplier['Supplier']['postal_code']);
         $tmp_suplliers[$supplier['Supplier']['id']]['phone'] = $this->phone_format($supplier['Supplier']['phone'], $supplier['Supplier']['phone_ext'], $supplier['Supplier']['cell'], $supplier['Supplier']['fax_number']);
     }
     return $tmp_suplliers;
 }
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:20,代码来源:QuoteItemComponent.php


注:本文中的Item::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。