function badge_label($badge_type) { $type = BadgeType::cached_find_by_db_name($badge_type); if ($type) { if ($type->label_color) { return '<span class="label label-' . $type->label_color . '">' . $type->name . '</span>'; } else { return ''; } } else { return ""; } }
public function validate() { $age = age_from_birthdate(@$this->params["birthdate"]); $minor = $age && $age < MINOR_AGE; $this->error_if_empty("legal_name"); $this->error_if_empty("badge_name"); if (!empty(@$this->params["badge_number"])) { if (!Attendee::is_unique_badge_number(@$this->params["badge_number"])) { $this->add_error("badge_number", "Number is already assigned."); } } $this->error_if_empty("birthdate"); if (!$this->error_on("birthdate")) { $this->error_if_invalid_date("birthdate"); } $this->error_if_empty("admission_level"); //$this->error_if_empty("payment_method"); if (!$this->error_on("admission_level")) { $this->error_unless_in_list("admission_level", static::valid_admission_levels()); } if (!empty(@$this->params["vendor_id"])) { $this->error_unless_in_list("vendor_id", static::valid_vendor_ids()); } if (!@$this->params["payment_method"]) { $this->error_unless_in_list("payment_method", static::valid_payment_types()); } if (@$this->params["tshirt_size"]) { $this->error_unless_in_list("tshirt_size", static::valid_tshirt_sizes()); } if (@$this->params["badge_type"]) { $this->error_unless_in_list("badge_type", static::valid_badge_types()); if (!$this->error_on("badge_type")) { $badge_type = BadgeType::cached_find_by_db_name(@$this->params["badge_type"]); if (!$badge_type->minor && $minor) { $this->add_error("badge_type", "Attendee is a minor."); } elseif ($badge_type->minor && !$minor) { $this->add_error("badge_type", "Attendee is not a minor."); } } } //$this->error_if_empty("address1"); //$this->error_if_empty("city"); //$this->error_if_empty("state_prov"); //$this->error_if_empty("postal_code"); //$this->error_if_empty("phone_number"); // $this->error_if_empty("email"); // if(!$this->error_on("email")){ // $this->error_unless_regex_match("email", "/@/"); // } // if(!empty($this->params["email"])){ // $this->error_unless_regex_match("email", "/@/"); // } // $age = age_from_birthdate(@$this->params["birthdate"]); // if($age && $age < MINOR_AGE){ // $this->error_if_empty("adult_legal_name"); // $this->error_if_empty("adult_phone_number"); // } // if(!$this->error_on("admission_level")){ // $lvl = RegistrationLevel::find_by_db_name(@$this->params["admission_level"]); // if($lvl && $lvl->includes_tshirt){ // $this->error_if_empty("tshirt_size", "{$lvl->name} includes a T-Shirt."); // }else{ // $this->error_unless_empty("tshirt_size", "Level doesn't include T-Shirt."); // } // } // $this->error_if_empty("payment_method", "Select a payment method."); }
<?php include_once '../_includes/framework.php'; require_login(); $page_title = "Admin"; include "_partials/admin-header.php"; $tab = @$_GET["tab"] ?: "all"; $badge_types = BadgeType::cached_all(); $type = null; switch ($tab) { case "badge": $type = BadgeType::cached_find_by_db_name($_GET["type"]); $query = Attendee::by_badge_type($type->db_name); break; case "under_minor_age": $query = Attendee::minors(); break; case "blacklisted": $query = Attendee::blacklisted(); break; case "canceled": $query = Attendee::canceled(); break; default: $query = Attendee::all(); } ?> <div class="container"> <div class="col-md-12"> <h1>All Attendees</h1>