evanhsu / rescuecircle

Geolocation reporting tool for the Interagency Short-haul program
0 stars 0 forks source link

Add Crew type subclasses for Rappellers, Hotshots, etc #2

Open evanhsu opened 8 years ago

evanhsu commented 8 years ago

Extend this site to handle other resource types:

Each resource type will need their own version of the "Status Update" page. Implementation should include a new Class for each resource type, for example:

class RappelCrew extends Crew
{
     public function __construct() {
          $this->type = 'rappel';
          $this->statusEntityClass = 'helicopter';  // The name of the Class to which a Status is attached
          $this->mapIcon = "/images/rappel-map-symbol.png";
     }
}
evanhsu commented 8 years ago

If the 'helicopters' dB table is changed to be more generic then any resource type could be accommodated. Rename the helicopters table to vehicles. Add a vehicles.type column. Rename the tailnumber column to designator. Rename the model column to description. Add a capabilities column.

Then the Helicopter class can be changed to a polymorphic Vehicle class. Add a crews.vehicle_type column.

Vehicle designators would need to stop enforcing uniqueness at the database level. Uniqueness would need to be enforced for designators only within each vehicle_type (and enforce uniqueness only within each crew for Fire Engines, since there's a lot of duplicates nationwide).