-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.php
59 lines (51 loc) · 1.62 KB
/
Card.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require_once('api.gdm.php');
class Card{
public $id;
public $code;
public $name;
public $expansion;
public $mythology;
public $type;
public $artist;
public $image;
public $cost;
public $strength;
public $maxpower;
public $keywords;
public $influences_text;
public $confrontation_text;
public $flavor_text;
public $unique;
public $promo;
function __construct($c){
//Conversión directa del Drupal
$this->id = intval($c->nid);
$this->code = $c->field_id_value;
$this->name = $c->title;
$this->type = $c->field_tipo_value;
$this->artist = array('id' => intval($c->nil_nid), 'name' => $c->nil_title);
//$this->image = $c->images;//file_create_url($c->uri);
$this->cost = intval($c->field_coste_value);
$this->strength = intval($c->field_fuerza_value);
$this->maxpower = intval($c->field_poder_max_value);
$this->influences_text = $c->field_texto_influencias_value;
$this->confrontation_text = $c->field_texto_enfrentamiento_value;
$this->flavor_text = $c->field_texto_flavor_value;
$this->unique = intval($c->field_unico_value) == 1 ? true : false;
$this->promo = intval($c->field_promo_value) == 1 ? true : false;
//Process images
//$fids = explode(',', $c->images);
//foreach($fids as $fid)
// $this->image[] = file_create_url(file_load($fid)->uri);
//Process taxonomies
//$kw = getTaxonomy('claves');
//$ids = explode(',', $c->keywords);
//foreach($ids as $id)
// $this->keywords[] = $kw[$id];
$ex = getTaxonomy('expansiones');
$this->expansion = $ex[$c->field_expansion_tid];
$my = getTaxonomy('mitologias');
$this->mythology = $my[$c->field_mitologia_tid];
}
}