Browse Source

Process assets not just items

master
Chris Smith 13 years ago
parent
commit
6b2d1728dd
4 changed files with 34 additions and 3 deletions
  1. 2
    2
      db/evedb.class.php
  2. 14
    0
      model/asset.php
  3. 5
    0
      model/ship.php
  4. 13
    1
      www/test.php

+ 2
- 2
db/evedb.class.php View File

@@ -1,5 +1,7 @@
1 1
 <?PHP
2 2
 
3
+require_once(dirname(dirname(__FILE__)) . '/model/ship.php');
4
+
3 5
 class EveDB {
4 6
 
5 7
  private $pdo;
@@ -52,6 +54,4 @@ class ItemsTableHandler extends BaseHandler {
52 54
 
53 55
 }
54 56
 
55
-class Ship {}
56
-
57 57
 ?>

+ 14
- 0
model/asset.php View File

@@ -0,0 +1,14 @@
1
+<?PHP
2
+
3
+ class Asset {
4
+
5
+  public $id;
6
+  public $item;
7
+  public $location;
8
+  public $quantity;
9
+  public $flag;
10
+  public $singleton;
11
+
12
+ }
13
+
14
+?>

+ 5
- 0
model/ship.php View File

@@ -0,0 +1,5 @@
1
+<?PHP
2
+
3
+ class Ship {}
4
+
5
+?>

+ 13
- 1
www/test.php View File

@@ -2,6 +2,7 @@
2 2
 
3 3
  require('../api/common.php');
4 4
  require('../db/evedb.class.php');
5
+ require('../model/asset.php');
5 6
 
6 7
  header('Content-type: text/plain');
7 8
 
@@ -11,7 +12,18 @@
11 12
  function getAsset($asset) {
12 13
   global $db;
13 14
 
14
-  $res = $db->items->getById($asset->typeID);
15
+  $res = new Asset();
16
+
17
+  $res->id = $asset->itemID;
18
+
19
+  if (isset($asset->locationID)) {
20
+   $res->location = $asset->locationID;
21
+  }
22
+
23
+  $res->quantity = $asset->quantity;
24
+  $res->flag = $asset->flag;
25
+  $res->singleton = $asset->singleton;
26
+  $res->item = $db->items->getById($asset->typeID);
15 27
   
16 28
   if (isset($asset->contents)) {
17 29
    $res->contents = array();

Loading…
Cancel
Save