function generateHTML()
 {
     $user = UserDao::getUserByUsername(SessionUtil::getUsername());
     $changePasswordRows = "";
     if (Config::login_type == LOGIN_TYPE_DB) {
         $changePasswordRows = "\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td class=\"centeredcellbold\">Change Password</td>\n\t\t\t\t<td class=\"centeredcellbold\">Current Password</td>\n\t\t\t\t<td class=\"centeredcellbold\">New Password</td>\n\t\t\t\t<td class=\"centeredcellbold\">Confirm Password</td>\n\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<form action=\"./index.php?pageid=savepassword\" method=\"POST\"><td class=\"centeredcellbold\"><input type=\"submit\" value=\"Save Password\"></td>\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"password\" name=\"curpass\"></td>\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"password\" name=\"newpass\"></th>\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"password\" name=\"confpass\"></td></form>\n\t\t\t\n\t\t\t\t</tr>";
     }
     return "<center><h3>My Account</h3>" . $this->context->getErrorHTML() . "</center>\n\t\t\t\n\t\t\t<table class=\"myaccount\">\n\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">Edit User Information</td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Username</td>\n\t\t\t\t\t<td colspan=3 class=\"centeredcell\">" . $user->username . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\n\t\t\t\t<tr>\n\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Name</th>\n\t\t\t\t\t<td colspan=3 class=\"centeredcell\">" . $user->name . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\n\t\t\t\t" . $changePasswordRows . "\n\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<form action=\"./index.php?pageid=saveemail\" method=\"POST\">\n\t\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Email</th><td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"email\" size=30 value=\"" . $user->email . "\"><input type=\"submit\" value=\"Save Email\"></td></form>\n\t\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Warnings</th>\n\t\t\t\t\t<td class=\"centeredcellbold\" colspan=3><a href=\"./index.php?pageid=viewMyWarnings\">" . WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) . "(" . WarningDao::getWarningCountForUser($user->id) . ")</a></td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t\t\n\t\t\t</table>";
 }
 public function generateHTML()
 {
     $reservation = ReservationDao::getReservation($_GET['resid']);
     if ($reservation == null) {
         $this->context->addError("Reservation Doesn't Exist.");
         return $this->context->getErrorHTML();
     }
     $user = UserDao::getUserByID($reservation->userId);
     $equip = EquipmentDao::getEquipmentByID($reservation->equipId);
     return "\n\t\t\t<center><h3>Reseravation Info</h3></center>\n\t\t\t<table class=\"viewreservation\">\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">User Information</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Name</th>\n\t\t\t\t\t<td class=\"centeredcell\">" . $user . "</td>\n\t\t\t\t\t<td class=\"centeredcellbold\">Warnings</th>\n\t\t\t\t\t<td class=\"centeredcell\"><a href=\"./index.php?pageid=viewWarnings&userid=" . $user->id['user_id'] . "\">" . WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) . "(" . WarningDao::getWarningCountForUser($user->id) . ")</a></td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">Equipment Information</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=2 class=\"centeredcellbold\">Name</th>\n\t\t\t\t\t<td colspan=2 class=\"centeredcell\">" . $equip . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">Reservation Information</td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Start Date</td>\n\t\t\t\t\t<td class=\"centeredcell\">" . $reservation->startDate . "</td>\n\t\t\t\t\t<td class=\"centeredcellbold\">End Date</td>\n\t\t\t\t\t<td class=\"centeredcell\">" . $reservation->endDate . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=4 class=\"centeredcellbold\">Current Status: " . $reservation->getColoredModStatusString() . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"centeredcellbold\">User Comment</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"topaligncell\">&nbsp;" . $reservation->userComment . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"centeredcellbold\">Admin Comment</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"topaligncell\">&nbsp;" . $reservation->adminComment . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t" . $this->getCheckinRow($reservation) . "\n\t\t\t\n\t\t\t</table>\n\t\t\n\t\t";
 }
 public function generateHTML()
 {
     $user = UserDao::getUserByUsername(SessionUtil::getUsername());
     if (WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) > RES_WARNING_MAX_ACTIVE) {
         $this->context->addError("You have too many Active Warnings (more than " . RES_WARNING_MAX_ACTIVE . ") on your account to place Reservations.");
         return $this->context->getErrorHTML() . $this->context->getMessagesHTML();
     }
     //TODO: do we need this?
     $allEquipment = EquipmentDao::getAllEquipment();
     $equipArray = array();
     //^^^^^^^^^^^^^^^^^^^^^^^^^^
     $page = "";
     $success = false;
     if (isset($_POST['equip_id']) && $_POST['equip_id'] != "") {
         if (count($this->context->getErrors()) == 0) {
             $page = "Successfully Created Reservation.";
             $success = true;
         } else {
             $_GET['equipid'] = $_POST['equip_id'];
         }
     }
     if (!$success && isset($_GET['equipid']) && $_GET['equipid'] != "") {
         $equip = EquipmentDao::getEquipmentByID($_GET['equipid']);
         if ($equip != null) {
             if (SessionUtil::getUserlevel() >= $equip->minUserLevel) {
                 $lengthOptions = "";
                 for ($i = 1; $i <= $equip->maxLength; $i++) {
                     if ($i > 1) {
                         $lengthOptions = $lengthOptions . "<option value=\"" . $i . "\">" . $i . " Days</option>";
                     } else {
                         $lengthOptions = $lengthOptions . "<option value=\"" . $i . "\">" . $i . " Day</option>";
                     }
                 }
                 $page = "\n\n\t\t<form name=\"reservation\" action=\"./index.php?pageid=placeReservation\" method=\"POST\" onsubmit=\"return checkDate();\">\n\t\t<input type=\"hidden\" name=\"action\" value=\"createReservation\">\n\t\t<input type=\"hidden\" name=\"equip_id\" value=\"" . $_GET['equipid'] . "\">\n\t\t<table class=\"reservation\">\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"header\">Reserve the " . $equip->name . "</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td class=\"centeredcellbold\">Date (YYYY-MM-DD)</td>\n\t\t\t\t<td class=\"centeredcell\">\n\t\t\t\t\t<input type=\"text\" readonly name=\"start_date\" id=\"startdate\" class=\"date\" value=\"blah\"/>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"centeredcellbold\">Length</td>\n\t\t\t\t<td class=\"centeredcell\"><select name=\"length\">" . $lengthOptions . "</select></td>\n\t\t\n\t\t\t</tr>\n\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">User Comment</th>\n\t\t\t\t<td class=\"centeredcell\" colspan=3><textarea rows=5 cols=45 name=\"user_comment\"></textarea></td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"centeredcell\"><input type=\"submit\" value=\"Reserve\"></td>\n\t\t\n\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t</table>\n\t\t\t</form></div>";
             } else {
                 $this->context->addError("Cannot reserve equipment (User Level).");
             }
         } else {
             $this->context->addError("No equipment with ID '" . $_GET['equipid'] . "'.");
         }
     } else {
         if (!$success) {
             $this->context->addError("No equipment selected.");
         }
     }
     return "<center><h3>Place Reservation</h3>" . $this->context->getErrorHTML() . "</center>" . $page;
 }
 public function generateHTML()
 {
     $userid;
     if (isset($_GET['userid'])) {
         $userid = $_GET['userid'];
     } else {
         if (isset($_POST['userid'])) {
             $userid = $_POST['userid'];
         }
     }
     if (isset($userid)) {
         $user = UserDao::getUserByID($userid);
         $passwordRows = "";
         if (Config::login_type == LOGIN_TYPE_DB) {
             $passwordRows = $this->generatePasswordRows($user);
         }
         return $this->context->getErrorHTML() . $this->context->getMessagesHTML() . "<table class=\"userinfo\">\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"header\">User Information</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\n\t\t\t\t<td class=\"centeredcellbold\">Username</th>\n\t\t\t\t<td colspan=3 class=\"centeredcell\">" . $user->username . "</td>\n\t\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveName\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t<td class=\"centeredcellbold\">Name</td>\n\t\t\t\t<td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"name\" size=\"25\" value=\"" . $user->name . "\"><input type=\"submit\" value=\"Save Name\"></td>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t" . $passwordRows . "\n\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Email</td>\n\t\t\t\t<form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveEmail\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t<td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"email\" size=30 value=\"" . $user->email . "\"><input type=\"submit\" value=\"Save Email\"></td>\n\t\t\t\t</form>\n\t\t\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Userlevel</td>\n\t\t\t\t<form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<td colspan=3 class=\"centeredcell\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveUserLevel\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t" . $this->generateUserLevelDropdown("level", $user->userlevel) . "<input type=\"submit\" value=\"Save Level\"></td>\n\t\t\t\t</form>\n\t\t\t\t\t\n\t\t\t</tr>\n\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Warnings</td>\n\t\t\t\t<td class=\"centeredcell\" colspan=2><a href=\"./index.php?pageid=viewWarnings&userid=" . $user->id['user_id'] . "\">" . WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) . "(" . WarningDao::getWarningCountForUser($user->id) . ")</a></td>\n\t\t\t\t<td class=\"centeredcell\" colspan=1><a href=\"./index.php?pageid=warnUser&userid=" . $user->id . "\">Warn User</a></td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"centeredcellbold\">User Notes</th>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"centeredcellbold\">\n\t\t\t\t<br><form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveNotes\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t<textarea cols=60 rows=8 name=\"notes\">" . $user->notes . "</textarea>\n\t\t\t\t<br><input type=\"submit\" value=\"Save Notes\"></form></th>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\t\n\t\t</table>";
     } else {
         $this->context->addError("No User Selected");
         return $this->context->getErrorHTML() . $this->context->getMessagesHTML();
     }
 }