| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- require_once($path["frame"] . "Frame.php");
- require_once($path["entity"] . "Monster_Collection.php");
- /**
- * Collection page model.
- */
- class Collection_Portrait_Frame extends Frame{
- public $id;
- public $cur_name;
- public $name;
- public $name_aw;
- public $stars;
- public $default_stars;
- public $level;
- public $max_level;
- public $awaken;
- public $cur_img;
- public $img;
- public $img_aw;
- public $img_star;
- public $element;
- public $owned;
- /**
- * Owned {@see Monster_Collection} of owned monsters.
- */
- public $collection;
- /**
- * Constructor.
- *
- * Retrieves the data and initializes the variables.
- *
- * @param MySQL_connection $db Connection to the database.
- * @param Array $params Parameters array, containig at least 'id'.
- */
- public function __construct($db, $params){
- global $path;
- parent::__construct($db);
- $this->view = $path["view"] . "frame/portrait.php";
- $id = $params["id"];
- $s =
- "SELECT id " .
- "FROM monster_collection " .
- "WHERE id = " . $id . "; ";
- $q = mysqli_query($this->db, $s);
- if (mysqli_num_rows($q) > 0){
- $r = mysqli_fetch_array($q);
- $this->collection = new Monster_Collection($this->db, $r["id"]);
- $this->id = $id;
- $this->name = $this->collection->monster->name;
- $this->name_aw = $this->collection->monster->name_aw;
- $this->stars = $this->collection->stars;
- $this->default_stars = $this->collection->monster->stars;
- $this->level = $this->collection->level;
- $this->max_level = 10 + (5 * $this->stars);
- $this->awaken = $this->collection->awaken;
- $this->img = $this->collection->monster->image;
- $this->img_aw = $this->collection->monster->image_aw;
- $this->element = $this->collection->monster->element;
- if ($this->level == 0 || $this->stars == 0){
- $this->owned = false;
- }
- if ($this->awaken == 1){
- $this->cur_name = $this->name_aw;
- $this->cur_img = $this->img_aw;
- $this->img_star = $star_src = $path["img"]["layout"] . "icon/star_aw.png";
- }
- else{
- $this->cur_name = $this->element . " " . $this->name;
- $this->cur_img = $this->img;
- $this->img_star = $star_src = $path["img"]["layout"] . "icon/star.png";
- }
- }
- }
- }
- ?>
|