function archetypeDropMenu($def) { $archetypes = Deck::getArchetypes(); echo "<select id=\"deck-archetype\" name=\"archetype\">\n"; echo "<option value=\"Unclassified\">- Archetype -</option>\n"; foreach ($archetypes as $name) { $sel = strcmp($name, $def) == 0 ? "selected" : ""; echo "<option value=\"{$name}\" {$sel}>{$name}</option>\n"; } }
function validate() { // Name must exist if ($this->name == NULL || $this->name == "") { $this->errors[] = "Name cannot be blank"; } if ($this->archetype != "Unclassified" && !in_array($this->archetype, Deck::getArchetypes())) { $this->errors[] = "Archetype needs to be in the approved list"; } if (count($this->errors) > 0) { return false; } return true; }