function error_response($problem) { $error_template = new \Framework\Template(); $error_template->set_template_file(SITE_PATH . "/templates/simple_message.template.php"); $error_template->title = "Oops!"; $error_template->message = $problem; $this->set_page_template($error_template); }
function main($template) { $contents = new \Framework\Template(); $contents->set_template_file(SITE_PATH . "/templates/simple_message.template.php"); $template->set_template_file(SITE_PATH . "/templates/full.template.php"); $template->contents_template = $contents; $contents->title = $this->request->get_page(); return ContentPage::PAGE_OKAY; }
function main($main_template) { if ($_SERVER['REQUEST_METHOD'] === "POST") { // Attempt Login } $landing_template = new \Framework\Template(); $landing_template->set_template_file(SITE_PATH . "/templates/UpDownCode.template.php"); $main_template->set_template_file(SITE_PATH . "/templates/full.template.php"); $main_template->contents_template = $landing_template; return ContentPage::PAGE_OKAY; }
function main($template) { // Get instance of AccountSession $account_session = new AccountSession(null); $contents = new \Framework\Template(); $contents->set_template_file(SITE_PATH . "/templates/simple_message.template.php"); $template->set_template_file(SITE_PATH . "/templates/full.template.php"); $template->contents_template = $contents; $contents->title = "Contents Page"; if ($account_session->check_login()) { $contents->message = "Yes, logged in!"; } else { $contents->message = "No, not logged in!"; } return ContentPage::PAGE_OKAY; }
function main($main_template) { $regis_template = new \Framework\Template(); $regis_template->set_template_file(SITE_PATH . "/templates/register.template.php"); $main_template->set_template_file(SITE_PATH . "/templates/full.template.php"); $main_template->contents_template = $regis_template; if ($_SERVER['REQUEST_METHOD'] === "POST") { // Get instance of UsersDatabase $database = \Application\DatabaseConnection::create_development_connection(); $users_database = new \Application\UsersDatabase($database); // Attempt to register user $status = $users_database->attempt_register($_POST['email'], $_POST['pass'], $_POST['name']); if ($status !== \Application\UsersDatabase::REGISTER_OKAY) { $regis_template->previous_name = htmlspecialchars($_POST['name'], ENT_COMPAT); $regis_template->previous_email = htmlspecialchars($_POST['email'], ENT_COMPAT); } echo "[STATUS CODE:'" . $status . "']"; } return ContentPage::PAGE_OKAY; }