| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- require_once($path["frame"] . "Frame.php");
- require_once($path["entity"] . "Monster.php");
- /**
- * Collection's page new monster form frame.
- */
- class Collection_New_Frame extends Frame{
- public $id;
- public $img;
- public $img_aw;
- public $element;
- /**
- * Selected {@see Monster}.
- */
- public $monster;
- /**
- * Constructor.
- *
- * Retrieves the data and initializes the variables.
- *
- * @param MySQL_connection $db Connection to the database.
- * @param Array $params Parameters array, containig at least 'base'
- * and 'element'.
- */
- public function __construct($db, $params){
- global $path;
- parent::__construct($db);
- $this->view = $path["view"] . "frame/new.php";
- $s =
- "SELECT monster.id AS id " .
- "FROM " .
- " monster, " .
- " monster_base " .
- "WHERE " .
- " monster.base = monster_base.id AND " .
- " upper(monster_base.name) = '" . strtoupper($params["base"]) . "' AND " .
- " monster.element = '" . $params["element"] . "'; ";
- $q = mysqli_query($this->db, $s);
- if (mysqli_num_rows($q) > 0){
- $r = mysqli_fetch_array($q);
- $this->monster = new Monster($this->db, $r["id"]);
- $this->id = $r["id"];
- $this->element = $params["element"];
- $this->img = $this->monster->image;
- $this->img_aw = $this->monster->image_aw;
- }
- }
- }
- ?>
|