/** * Boostraps and runs the entire danged system! */ function __construct() { $this->Bootstrap(); // Reads query param to pick appropriate Actions $action = isset($_GET['action']) ? Actions::ToEnum($_GET['action']) : Actions::Songbook; $user = $this->DoAuthenticate($action); if (!$user->IsAllowAccess) { return; } $builder = $this->GetBuilder($action, $user); $model = $builder->Build(); // all done, time to render if ($model->IsJson) { $this->RenderJson($model); } else { $model->SiteUser = $user; $this->RenderView($model, $action); } }