// Chech the id $signupid = $request->getSignupId(); $sort = CommonTools::GET('sort'); if ($signupid == null || !is_int(intval($signupid)) || $signupid < 0) { // Id is not an header("Location: " . $configurations->webRoot); } // Create gadget and get the data from database $signupGadget = new SignupGadget($signupid); $signupGadget->sortAnswers($sort); //Set page title $page->title = $signupGadget->getTitle(); // Prints title and description $page->addContent("<div id=\"signup-info\">"); $page->addContent("<h3 id=\"signup-title\"><span>" . $signupGadget->getTitle() . "</span></h3>"); $page->addContent("<p id=\"signup-description\"><span>" . CommonTools::newlineToBr($signupGadget->getDescription()) . "</span></p>"); // Check the state of signup (open/close/not yet open) if ($signupGadget->isOpen()) { $page->addContent("<p id=\"signup-open\"><span>Ilmoittautuminen on auki</span></p>"); $page->addContent("</div>"); $page->addContent("<form id=\"signup-button-form\" method=\"get\" action=\"" . $configurations->webRoot . "queue/" . $signupid . "\">"); // $page->addContent("<input type=\"hidden\" name=\"signupid\" value=\"$signupid\" />"); $page->addContent("<input id=\"signup-button\" value=\"Ilmoittaudu\" type=\"submit\" />"); $page->addContent("</form>"); $page->addContent("<div id=\"answers-container\">"); $page->addContent(SignupGadgetAnswerFormater::getAnswersInPrintableFormat($signupGadget)); $page->addContent("</div>"); } else { if ($signupGadget->isClosed()) { $page->addContent("<p class=\"signup-close\"><span>Ilmoittautuminen on sulkeutunut</span></p>"); $page->addContent("</div>");
<?php /* Requirements */ require_once "classes/Configurations.php"; require_once "classes/Page.php"; require_once "classes/SignupGadgets.php"; require_once "classes/Debugger.php"; require_once "classes/SignupGadget.php"; require_once "classes/CommonTools.php"; /* Implementations of the most critical classes */ $configurations = new Configurations(); $page = new Page(2); $debugger = new Debugger(); $database = new Database(); /* The code */ $signupId = $request->getSignupId(); $action = $request->getAction(); $signupGadget = new SignupGadget($signupId); if ($action == "delete-confirmed") { $signupGadget->deleteFromDatabase(); header("Location: " . $configurations->webRoot . "admin"); } else { $page->addContent("<h1>Poista ilmomasiina</h1>"); $page->addContent("<p>Haluatko varmasti poistaa seuraavan ilmomasiinan:</p>"); $page->addContent("<p><b>" . $signupGadget->getTitle() . "</b></p>"); $page->addContent("<p>" . $signupGadget->getDescription() . "</p>"); $page->addContent("<p><a href=\"" . $configurations->webRoot . "admin/delete-confirmed/{$signupId}\">Joo</a> <a href=\"" . $configurations->webRoot . "admin\">Ei</a></p>"); $page->printPage(); }
require_once "classes/SignupGadget.php"; require_once "classes/CommonTools.php"; require_once "classes/SignupGadgetAnswerFormater.php"; /* Implementations of the most critical classes */ $configurations = new Configurations(); $page = new Page(2); $debugger = new Debugger(); $database = new Database(); // Create gadget and get the data from database $signupId = $request->getSignupId(); $sort = CommonTools::GET("sort"); $signupGadget = new SignupGadget($signupId); $signupGadget->sortAnswers($sort); // Prints title and description $page->addContent("<h1>" . $signupGadget->getTitle() . "</h1>"); $page->addContent("<i>" . CommonTools::newlineToBr($signupGadget->getDescription()) . "</i>"); // Check the state of signup (open/close/not yet open) if ($signupGadget->isOpen()) { $page->addContent("<p class=\"signupOpen\">Ilmoittautuminen on auki</p>"); $page->addContent(SignupGadgetAnswerFormater::getAnswersInPrintableFormat($signupGadget, true)); $page->addContent("<p class=\"csv-output\"><a href=\"" . $configurations->webRoot . "admin/csvoutput/{$signupId}\">Vastaukset csv-muodossa</a></p>"); } else { if ($signupGadget->isClosed()) { $page->addContent("<p class=\"signupClosed\">Ilmoittautuminen on sulkeutunut</p>"); $page->addContent(SignupGadgetAnswerFormater::getAnswersInPrintableFormat($signupGadget, true)); $page->addContent("<p class=\"csv-output\"><a href=\"" . $configurations->webRoot . "admin/csvoutput/{$signupId}\">Vastaukset csv-muodossa</a></p>"); } else { $page->addContent("<p class=\"signupNotYetOpen\">Ilmoittautuminen on avautuu " . $signupGadget->getReadableOpeningTime() . "</p>"); } } $page->printPage();