function displayAccommodationForm($userId, $mcid, $registeredBy) { if (!isset($_POST['continueToAcco']) || !isset($_GET['userId'])) { return getUserDetailsForHospi(escape($_GET['userId']), $mcid); } if ($_GET['userId'] == 0 || !is_numeric($_GET['userId'])) { return getUserDetailsForHospi(escape($_GET['userId']), $mcid); } global $urlRequestRoot, $sourceFolder, $templateFolder, $cmsFolder, $moduleFolder; require_once "{$sourceFolder}/{$moduleFolder}/prhospi/accommodation.php"; $tableForDisclaimer = <<<TABLE <table border="1"> <tr> <th>Pragyan Id</th> <th>Name</th> <th>Email</th> <th>Hostel</th> <th>Room No</th> <th>DISCLAIMER</th> </tr> TABLE; for ($i = 1; $i <= 5; $i++) { if (!isset($_POST['userid' . $i]) || $_POST['userid' . $i] == "") { continue; } if (!isset($_POST['hostelname' . $i]) || $_POST['hostelname' . $i] == "") { displayinfo("Please Select the hostel name for Pragyan Id:" . $_POST['userid' . $i]); continue; } if (!isset($_POST['roomNo' . $i]) || $_POST['roomNo' . $i] == "") { displayinfo("Please Select the Room for Pragyan Id:" . $_POST['userid' . $i]); continue; } $roomNo = escape($_POST['roomNo' . $i]); $hostelName = escape($_POST['hostelname' . $i]); $uid = escape($_POST['userid' . $i]); if (!is_numeric($uid)) { displayinfo("Not a valid Pragyan Id:" . $uid); continue; } if (!isRoomAvailable($roomNo, $mcid)) { displayinfo("Room Not Available for Pragyan Id : " . $uid . ".Please try again "); continue; } if (!addUserToRoom($uid, $roomNo, $mcid, escape($_GET['userId']), $registeredBy)) { continue; } $name = getUserName($uid); $email = getUserEmail($uid); $room = getRoomNoFromRoomId($roomNo, $mcid); $tableForDisclaimer .= <<<TROW <tr> <td>{$uid}</td> <td>{$name}</td> <td>{$email}</td> <td>{$hostelName}</td> <td>{$room}</td> <td> <form method="POST" target="_blank" action="./+view"> <input type="submit" name="printthis" value="PRINT"/> <input type="hidden" name="printHiddenId" value="printHostelAllotmentBill{$uid}" /> </form> </td> </tr> TROW; } return $tableForDisclaimer . "</table>" . displayRooms($mcid, escape($_GET['userId'])); }
public function actionView() { global $urlRequestRoot, $sourceFolder, $templateFolder, $cmsFolder, $moduleFolder; $moduleComponentId = $this->moduleComponentId; $scriptsFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts"; $imagesFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/images"; require_once "{$sourceFolder}/{$moduleFolder}/prhospi/prhospi_common.php"; require_once "{$sourceFolder}/{$moduleFolder}/prhospi/accommodation.php"; if (isset($_POST['subaction']) && $_POST['subaction'] == 'accoRegUser') { echo ajaxSuggestions($moduleComponentId, 0, $this->userId); exit; } if (isset($_POST['subaction']) && $_POST['subaction'] == 'accoRegUserUpdate') { echo ajaxSuggestions($moduleComponentId, 1); exit; } if (isset($_GET['subaction']) && $_GET['subaction'] == 'getsuggestions' && isset($_GET['forwhat'])) { echo getSuggestionsForIdOrEmail(escape($_GET['forwhat'])); exit; } if (isset($_POST['printthis']) && isset($_POST['printHiddenId'])) { if ($_POST['printHiddenId'] != "") { $pos = strpos($_POST['printHiddenId'], "printHostelAllotmentBill"); if ($pos == 0) { return printDisclaimer($moduleComponentId, substr(escape($_POST['printHiddenId']), 24), "hospihead"); } } } if (isset($_GET['subaction'])) { if ($_GET['subaction'] == 'AddRoom') { if (isset($_POST['addHostels'])) { $displayActions = addHostels($_POST, $moduleComponentId); } return $displayActions = displayAddNewRooms("view", $moduleComponentId); } } $displayTags = <<<TAG <script type="text/javascript" src="{$urlRequestRoot}/{$cmsFolder}/{$moduleFolder}/prhospi/accoregister.js"></script> <h2> Accommodation </h2> \t<table> <tr> <td><a href="./+view&subaction=viewRegisteredUser"> <div>View Registrants</div></a></td> <td><a href="./+view"><div>Add User</div></a></td> </tr> </table> TAG; if (isset($_GET['subaction']) && $_GET['subaction'] == 'viewRegisteredUser') { $excel = "<a href='./+view&subaction=viewRegisteredUser&saveAsExcel'>Save as Excel</a>"; if (isset($_GET['saveAsExcel'])) { require_once "{$sourceFolder}/{$moduleFolder}/qaos1/excel.php"; displayExcelForTable(displayUsersRegisteredToAcco($moduleComponentId)); } return $displayTags . $excel . displayUsersRegisteredToAcco($moduleComponentId); } $inputUser = <<<USER <h2> CHECK IN FORM </h2> <form method="POST" action="./+view"> Enter UserId or Email:<input type="text" name="txtFormUserId" id="txtFormUserId" autocomplete="off" style="width: 256px" /> <div id="suggestionsBox" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> <input type="submit" Value="Find User"/> <!-- <script type="text/javascript" language="javascript" src="{$scriptsFolder}/ajaxsuggestionbox.js"> </script> <script language="javascript"> var userBox = new SuggestionBox(document.getElementById('txtFormUserId'), document.getElementById('suggestionsBox'), "./+view&subaction=getsuggestions&forwhat=%pattern%"); userBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; </script> --> </form> USER; $userDetails = ""; $displayActions = ""; if (isset($_POST['txtFormUserId']) && $_POST['txtFormUserId'] != '') { // $detailsGiven=explode("- ",escape($_POST['txtFormUserId'])); // $userDetails.=getUserDetailsForHospi($detailsGiven[1],$moduleComponentId); $userDetails .= getUserDetailsForHospi(escape($_POST['txtFormUserId']), $moduleComponentId); } if (isset($_POST['txtFormUserId1']) && $_POST['txtFormUserId1'] != '') { if (!isset($_POST['refundAmt'])) { displayerror("Refund Amount Not Defined"); } else { if (!is_numeric($_POST['refundAmt'])) { displayerror("Refund Amount is not a Valid Number"); } else { // $detailsGiven=explode("- ",escape($_POST['txtFormUserId1'])); // checkOut($detailsGiven[1],escape($_POST['refundAmt']),$moduleComponentId); checkOut(escape($_POST['txtFormUserId1']), escape($_POST['refundAmt']), $moduleComponentId); } } } if (isset($_GET['subaction']) && $_GET['subaction'] == 'accommodation' && isset($_GET['userId']) && is_numeric($_GET['userId'])) { $userDetails .= displayAccommodationForm(escape($_GET['userId']), $moduleComponentId, $this->userId); } $amtToCollect = getAmount("hospihead", $moduleComponentId); $checkOutFORM = <<<checkOut <hr/> <h2> CHECK OUT FORM </h2> <form method="POST" action="./+view"> <table border="1"> <tr> <td>Enter UserId or Email:</td> <td><input type="text" name="txtFormUserId1" id="txtFormUserId1" autocomplete="off" style="width: 256px" /> <div id="suggestionsBox1" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div><br/> </td> </tr> <tr> <td>Refund Amount:</td> <td><input type="text" name="refundAmt" value="{$amtToCollect}"/></td> </tr> <tr> <td colspan="2"><input type="submit" Value="Find User"/></td> </tr> </table> <!-- <script type="text/javascript" language="javascript" src="{$scriptsFolder}/ajaxsuggestionbox.js"> </script> <script language="javascript"> var userBox = new SuggestionBox(document.getElementById('txtFormUserId1'), document.getElementById('suggestionsBox1'), "./+view&subaction=getsuggestions&forwhat=%pattern%"); userBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; </script> --> </form> checkOut; return $displayTags . $inputUser . $userDetails . $checkOutFORM; }