view = $path["view"] . "frame/catalog_list.php"; $w_name = "1 = 1"; $w_type = "1 = 1"; $w_element = "1 = 1"; $w_min_stars = "1 = 1"; $w_max_stars = "1 = 1"; if (isset($params["name"])){ $w_name = "(name LIKE '%" . $params["name"] . "%' OR name_aw LIKE '%" . $params["name"] . "%')"; } if (isset($params["type"])){ $w_type = "type = '" . $params["type"] . "'"; } if (isset($params["element"])){ $w_element = "element = '" . $params["element"] . "'"; } if (isset($params["minstars"]) && intval($params["minstars"]) > 0 && intval($params["minstars"]) < 7){ $w_min_stars = "stars >= " . $params["minstars"]; } if (isset($params["maxstars"]) && intval($params["maxstars"]) > 0 && intval($params["maxstars"]) < 7){ $w_max_stars = "stars <= " . $params["maxstars"]; } $s = "SELECT id, " . " element, " . " name, " . " img, " . " img_aw, " . " stars, " . " awakeable, " . " ( " . " SELECT count(id) > 0 " . " FROM monster_collection " . " WHERE monster = monster.id " . " ) AS owned " . "FROM monster " . "WHERE " . " $w_name AND " . " $w_type AND " . " $w_element AND " . " $w_min_stars AND " . " $w_max_stars " . "ORDER BY " . " element, " . " stars, " . " awakeable "; $q = $this->db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ $mon = [ "id" => $r["id"], "element" => $r["element"], "name" => $r["name"], "image" => $path["img"]["monster"] . $r["img"], "image_aw" => $path["img"]["monster"] . $r["img_aw"], "stars" => $r["stars"], "awakeable" => $r["awakeable"], "owned" => $r["owned"], ]; array_push($this->entry, $mon); } } } ?>