• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

cms/modules/hospi.lib.php

Go to the documentation of this file.
00001 <?php
00002 if(!defined('__PRAGYAN_CMS'))
00003 { 
00004         header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
00005         echo "<h1>403 Forbidden<h1><h4>You are not authorized to access the page.</h4>";
00006         echo '<hr/>'.$_SERVER['SERVER_SIGNATURE'];
00007         exit(1);
00008 }
00015 /*
00016  * +view=> the hospi person can see all the available actions
00017  * +accomodate => the hospi desk gets to see the status of various rooms and their availability
00018  *      subaction
00019  * +view&mode=hostel            => Hostel wise view(default +accomodate view)
00020  * +view&mode=all                       => All rooms in all hostels.
00021  * check in                                     => Clicks on a room in one of the view formats and then enters the guest mail id
00022  * check out                            => puts in the mail id of the user and then checks him out
00023  * addRoom                                      => adds room to the hostel.+ capacity
00024  * addHostel                            => add hostel
00025  *
00026  * +(Not in hospi module) to get the list of people registered for workshop/prelim selected ppl/ paper presentation etc)
00027 
00028 Hospi charges paid/ how much/caution deposit refundable/
00029 reimbursement.
00030 
00031 
00032 user Id of the person manning the hospi desk.
00033 The user Id of the person refunding the caution/reimbursement.
00034 
00035 Print the details of the user along with the name of the hospi person manning the desk
00036 
00037  */
00038 class hospi implements module {
00039         private $userId;
00040         private $moduleComponentId;
00041 
00042         public function getHtml($gotuid, $gotmoduleComponentId, $gotaction) {
00043                 $this->userId = $gotuid;
00044                 $this->moduleComponentId = $gotmoduleComponentId;
00045                 
00046 
00047                 if ($gotaction == 'view')
00048                         return $this->actionView();
00049                 if ($gotaction == 'accomodate')
00050                         return $this->actionAccomodate();
00051                 if ($gotaction == 'addroom')
00052                         return $this->actionAddroom();
00053 
00054         }
00055         
00056 public function viewall()
00057 {
00058         $hospiview=<<<VIEW
00059         <table>
00060         <a onClick="history.go(-1)">BACK</a><br>
00061 <tr><td>                <a href="./+addRoom"> <div>Add Room</div></a></td></tr>
00062 <tr><td>                <a href="./+addRoom&subaction=addhostel"><div>Add Hostel</div></a></td></tr>
00063 <tr><td>                <a href="./+accomodate&quick"><div>Fast Accomodate</b></div></a></td></tr>
00064 <tr><td>                <a href="./+view&subaction=finduser"><div>Search user</div></a></td></tr>
00065 <tr><td>                <a href="./+view&subaction=findroom"><div>Search room</div></a></td></tr>
00066 <!-- <tr><td>           <a href="./+view&subaction=viewvacantrooms"><div>View vacant rooms</div></a></td></tr>-->
00067 <tr><td>                <a href="./+view&subaction=viewstatus"><div>View All Rooms</div></a></td></tr>
00068                 </table>
00069 
00070 VIEW;
00071         return $hospiview;
00072 }
00073 
00074 
00075 private function getEmailSuggestions($input) {
00076         $emailQuery ="SELECT `form_elementdata` FROM `form_elementdata` WHERE `page_modulecomponentid`=36 AND form_elementid IN (3,13,14,15)  AND form_elementdata LIKE '%$input%' ";
00077         $emailResult = mysql_query($emailQuery);
00078         $suggestions = array($input);
00079         while($emailRow = mysql_fetch_row($emailResult)) {
00080                         $suggestions[] = $emailRow[0];
00081         }
00082         $query ="SELECT  `user_id` FROM `form_regdata` WHERE `page_modulecomponentid`=36 ";
00083         $result = mysql_query($query);
00084         while($temp=mysql_fetch_array($result))
00085         {
00086                 $query1 = 'SELECT `user_email` FROM `' . MYSQL_DATABASE_PREFIX . 'users` WHERE `user_email` LIKE "%'.$input.'%" AND `user_id`='.$temp[0];
00087                 $result1=mysql_query($query1);
00088                 if(mysql_num_rows($result1)){
00089                 $temp1=mysql_fetch_array($result1,MYSQL_NUM);
00090                 $suggestions[] = $temp1[0];
00091                 }
00092         }
00093         return join($suggestions, ',');
00094 }
00095 
00096 
00097 public function getUserDetails($email)
00098 {
00099         $query="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_guest_email`='$email' ORDER BY `hospi_actual_checkin` DESC  LIMIT 0,1";
00100         $result=mysql_query($query) or die (mysql_error()."in function getUserDetails in hospi") ;
00101         $temp=mysql_fetch_array($result,MYSQL_ASSOC);
00102         $query="SELECT `hospi_hostel_name`,`hospi_room_no` FROM `hospi_hostel` WHERE `hospi_room_id`=$temp[hospi_room_id]";
00103         $result=mysql_query($query) or die (mysql_error()."in function getUserDetails in hospi") ;
00104         $temp1=mysql_fetch_array($result,MYSQL_ASSOC);
00105         $userdetail=<<<UD
00106 <table border="1">
00107 <tr><td>Name</td><td>$temp[hospi_guest_name]</td></tr>
00108 <tr><td>Email</td><td>$temp[hospi_guest_email]</td></tr>
00109 <tr><td>Phone</td><td>$temp[hospi_guest_phone]</td></tr>
00110 <tr><td>Hostel</td><td>$temp1[hospi_hostel_name]</td></tr>
00111 <tr><td>Room</td><td>$temp1[hospi_room_no]</td></tr>
00112 </table>
00113 
00114 UD;
00115 return $userdetail;
00116 
00117 }
00118 
00119 
00120 
00121 public function actionAccomodate() {
00122 
00123                         
00124                         if(isset($_GET['displayUserDetails']))
00125 {
00126         return $this->getUserDetails($_GET['displayUserDetails']);
00127 }
00128 
00129 if(isset($_GET['quick'])){
00130 global $sourceFolder,$cmsFolder;
00131                 global $moduleFolder;
00132                 global $urlRequestRoot;
00133                 global $templateFolder;
00134                 $calpath = "$urlRequestRoot/$cmsFolder/$moduleFolder";
00135                 $scriptsFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/scripts";
00136                 $imagesFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/images";
00137 $checkIn=<<<CHECKIN
00138 
00139 <link rel="stylesheet" type="text/css" media="all" href="$calpath/form/calendar/calendar.css" title="Aqua" />
00140                                                  <script type="text/javascript" src="$calpath/form/calendar/calendar.js"></script>
00141 
00142 <form name="hospi_check_in" method="POST" action="+accomodate&quick1">
00143 
00144 
00145 <table>
00146 <tr>
00147 <td>Email:</td><td><input type="text" name="guest_email" id="guest_email" size="20" maxlength="100" />
00148 <div id="suggestionsBox" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div>
00149 </td>
00150 </tr><tr><td><input type="submit" value="Submit"></td></tr></table>
00151 CHECKIN;
00152 return $checkIn.$this->viewall();
00153 }               
00154 
00155 if(isset($_GET['quick1']))
00156 {
00157 global $sourceFolder,$cmsFolder;
00158                 global $moduleFolder;
00159                 global $urlRequestRoot;
00160                 global $templateFolder;
00161                 $calpath = "$urlRequestRoot/$cmsFolder/$moduleFolder";
00162 
00163                 $scriptsFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/scripts";
00164                 $imagesFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/images";
00165 $query1="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_guest_email`='".$_POST['guest_email']."'";
00166 $result1=mysql_query($query1);
00167 if(mysql_num_rows($result1))
00168 {
00169         $row=mysql_fetch_row($result1);
00170         if($row[10]!=0)
00171         {
00172                 displayerror('Already Checked Out. Please Check In using another id');
00173         return $this->viewall();
00174         }
00175         displayerror('Already registered for accomodation');
00176         return $this->viewall();
00177 }
00178 $query = "SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "users` WHERE `user_email`='" . $_POST['guest_email'] . "'";
00179                 $result = mysql_query($query) or displayerror(mysql_error() . "in registration L:115");
00180                 if (mysql_num_rows($result)) {
00181 $profileRow = mysql_fetch_row($result);
00182 $checkIn=<<<CHECKIN
00183 <link rel="stylesheet" type="text/css" media="all" href="$calpath/form/calendar/calendar.css" title="Aqua" />
00184                                                  <script type="text/javascript" src="$calpath/form/calendar/calendar.js"></script>
00185 
00186 <form name="hospi_check_in" method="POST" action="+accomodate&quick1">
00187 
00188 
00189 
00190 <table>
00191 <tr>
00192 <td>
00193 User Id:
00194 </td>
00195 <td>
00196 <input type="text" name="user_id" size="20" maxlength="100" value='$profileRow[0]'   >
00197 </td>
00198 </tr>
00199 <tr>
00200 <td>Guest Name:</td><td><input type="text" name="guest_name" size="20" maxlength="100" value='$profileRow[3]'   ></td>
00201 </tr>
00202 
00203 <tr>
00204 <td>Email:</td><td><input type="text" name="guest_email" id="guest_email" size="20" maxlength="100" value='$profileRow[2]' />
00205 <div id="suggestionsBox" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div>
00206 </td>
00207 </tr><tr>
00208 
00209 <td>Phone No.:</td><td><input type="text" name="guest_phone" size="20" maxlength="100" ></td>
00210 </tr><tr>
00211 <td>College:</td><td><input type="text" name="guest_college" size="20" maxlength="100" ></td>
00212 </tr><tr>
00213 
00214 
00215 <td>Cash Paid?</td><td><input type="checkbox" name="cash_paid"></td>
00216 </tr><tr>
00217 <td>Hostel allotted:</td></tr>
00218 
00219 CHECKIN;
00220 
00221 $query="SELECT DISTINCT `hospi_hostel_name` FROM `hospi_hostel` ";
00222                 $result=mysql_query($query)or die(mysql_error());
00223                 while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
00224                 {
00225                         $hostel=$temp['hospi_hostel_name'];
00226                         $checkIn.='<td><div><tr><td><b>'.$hostel.'</b></td><td>';
00227                         $checkIn.="<select name=\"hostel_$hostel\"><option>Room No.</option>";
00228                         $query1="SELECT `hospi_room_no` FROM `hospi_hostel` WHERE  `hospi_hostel_name`='$hostel' AND `hospi_room_no`<>0";
00229                         $result1=mysql_query($query1);
00230                         while($temp1=mysql_fetch_array($result1,MYSQL_NUM)){
00231                         foreach($temp1 as $room)
00232 
00233                         {
00234 
00235                                 $query3="SELECT * FROM `hospi_hostel` WHERE `hospi_hostel_name`='$hostel' AND `hospi_room_no`=$room";
00236                                 $result3=mysql_query($query3);
00237                                 $temp3=mysql_fetch_array($result3, MYSQL_ASSOC);
00238                                 $query4="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_room_id`=$temp3[hospi_room_id] AND `hospi_actual_checkout` IS NULL";
00239                                 $result4=mysql_query($query4);
00240                                 $num=mysql_num_rows($result4);
00241 
00242                                 if ($num<$temp3['hospi_room_capacity'])
00243                                 $status="VACANT";
00244                                 else $status="FULL";
00245 
00246 
00247 
00248 
00249 
00250 
00251 
00252 
00253 
00254                                 $checkIn.="<option value=\"$room\" id=\"$room\">".$room."  ".$status."  (".$num."/".$temp3['hospi_room_capacity'].")"."</option>";
00255 
00256                         }
00257 
00258 
00259                         }
00260                                 $checkIn.="</select></td></tr></div>";
00261                 }
00262         $checkIn.='</td></tr><tr><td><input type="submit" value="Check In"></td></tr></table>';
00263         $checkIn.=<<<TAG
00264 <script type="text/javascript" language="javascript" src="$scriptsFolder/ajaxsuggestionbox.js">
00265 
00266 </script>
00267 <script language="javascript">
00268         var userBox = new SuggestionBox(document.getElementById('guest_email'), document.getElementById('suggestionsBox'), "./+accomodate&subaction=getsuggestions&forwhat=%pattern%");
00269         userBox.loadingImageUrl = '$imagesFolder/ajaxloading.gif';
00270 </script>
00271 
00272 </form>
00273 TAG;
00274 }
00275 else
00276 {
00277 displayerror("you havent registered.. Please register first");
00278 }
00279 
00280 
00281 if(isset($_POST['guest_name']))
00282 {
00283                 static $room_no,$hostel;
00284                 $query="SELECT DISTINCT `hospi_hostel_name` FROM `hospi_hostel` ";
00285                 $result=mysql_query($query)or die(mysql_error());
00286                 while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
00287                 {
00288                         $hostel_name="hostel_".$temp['hospi_hostel_name'];
00289                         if(is_numeric($_POST[''.$hostel_name.'']))
00290                         {
00291                                 if(is_numeric($room_no))
00292                                 {
00293                                         displayerror("More than one room selected!!");
00294                                         return $this->viewall();
00295 
00296                                 }
00297                                 $room_no=$_POST[''.$hostel_name.''];
00298                                 $hostel=$temp['hospi_hostel_name'];
00299                         }
00300                 }
00301 
00302                 $query="SELECT `hospi_room_id` FROM `hospi_hostel` WHERE `hospi_hostel_name`='$hostel' AND `hospi_room_no`=$room_no";
00303                 $result1=mysql_query($query);
00304                 $temp=mysql_fetch_assoc($result1);
00305                 $room_Id=$temp['hospi_room_id'];
00306                 if($room_Id==0)
00307                 {
00308                         displayerror("No room allotted!!");
00309                         return $this->viewall();
00310                 }
00311 
00312                 if(isset($_POST['cash_paid']))$paid=1;else $paid=0;
00313 
00314         $query="INSERT INTO `hospi_accomodation_status` (`hospi_room_id`,`user_id`,`hospi_actual_checkin`,`hospi_checkedin_by`,`hospi_cash_collected`,`hospi_guest_name`,`hospi_guest_college`,`hospi_guest_phone`,`hospi_guest_email`) VALUES ('$room_Id','$_POST[user_id]',NOW(),'$this->userId','$paid','$_POST[guest_name]','$_POST[guest_college]','$_POST[guest_phone]','$_POST[guest_email]')";
00315         $result=mysql_query($query) or displayerror(mysql_error());
00316 
00317         if(!(mysql_error()))
00318 {
00319         
00320         displayinfo("$_POST[guest_name] checked in successfully");
00321 return $this->viewall();
00322 }
00323         else displayerror("Failed to check in $_POST[guest_name]");
00324 
00325 }
00326 return $checkIn.$this->viewall();
00327 }
00328 $room=<<<ROOM
00329 ROOM;
00330 $room.='<table border="1"><tr>';
00331 
00332 if(isset($_GET['subaction']) && $_GET['subaction'] == 'getsuggestions' && isset($_GET['forwhat'])) {
00333         echo $this->getEmailSuggestions($_GET['forwhat']);
00334         disconnect();
00335         exit();
00336 
00337 }
00338 elseif(!isset($_GET['hostel'])){
00339 $query="SELECT DISTINCT `hospi_hostel_name` FROM `hospi_hostel` ";
00340                 $result=mysql_query($query);
00341                 while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
00342                 {
00343                         $room.='<td > <a href="+accomodate&hostel='.$temp['hospi_hostel_name'].'">'. $temp['hospi_hostel_name'].' </td>';
00344                 }
00345 $room.="</tr></table>";
00346         return $room.$this->viewall();
00347 }
00348 elseif(!isset($_GET['room_id']))
00349 {
00350         $query="SELECT * FROM `hospi_hostel` WHERE `hospi_hostel_name`='$_GET[hostel]' AND `hospi_room_id`!=0";
00351                 $result=mysql_query($query);
00352         $room.='</tr><tr ><td >'.$_GET['hostel'].'</td>';
00353                 while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
00354                 {
00355                         $status="Vacant";
00356                         $query1="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_room_id`=$temp[hospi_room_id] AND `hospi_actual_checkout` IS NULL";
00357                         $result1=mysql_query($query1);
00358                         $temp1=mysql_fetch_array($result1, MYSQL_ASSOC);
00359                         if(mysql_num_rows($result1)<$temp['hospi_room_capacity']);
00360                         else $status="Full";
00361                         $room.='<td > <a href="+accomodate&hostel='.$temp['hospi_hostel_name'].'&room_id='.$temp['hospi_room_id'].'">'.$temp['hospi_room_no'].'              ' ;
00362                         $room.="$status      (".mysql_num_rows($result1)."/".$temp['hospi_room_capacity'].")";
00363                         $room.='</td>';
00364                 }
00365 $room.="</tr></table>";
00366         return $room.$this->viewall();
00367 }
00368 else{
00369 
00370         if(isset($_GET['checkIn']))
00371 {
00372         if(isset($_POST['cash_paid']))$paid=1;else $paid=0;
00373         $userId=getUserIdFromEmail($_POST['txtUserEmail']);
00374         if($userId!=0){
00375         $query1="SELECT * FROM `hospi_accomodation_status` WHERE `user_id`=$userId AND `hospi_actual_checkout` IS NULL ";
00376         $result1=mysql_query($query1);
00377         $room1=mysql_fetch_assoc($result1);
00378         if(!(mysql_num_rows($result1))){
00379                 $name=getUserFullName($userId);
00380                 $email=getUserEmail($userId);
00381 
00382 
00383         $query="INSERT INTO `hospi_accomodation_status` (`hospi_room_id`,`user_id`,`hospi_actual_checkin`,`hospi_checkedin_by`,`hospi_cash_collected`,`hospi_guest_name`,`hospi_guest_email`) VALUES ('$_GET[room_id]','$userId',NOW(),'$this->userId','$paid','$name','$email')";
00384         $result=mysql_query($query) or displayerror(mysql_error());
00385         if(!(mysql_error()))
00386         displayinfo("$_POST[txtUserEmail] checked in successfully");
00387         else displayerror("Failed to check in $_POST[txtUserEmail]");
00388         }
00389         else
00390         {
00391                 $query="SELECT `hospi_hostel_name` FROM `hospi_hostel` WHERE `hospi_room_id`='$room1[hospi_room_id]'";
00392                 $result=mysql_query($query) or die (mysql_error());
00393                 $room2=mysql_fetch_row($result);
00394                 displayerror("User is already checked in <a href=\"+accomodate&hostel=$room2[0]&room_id=$room1[hospi_room_id]\">here</a>");
00395         }
00396 }
00397 }
00398 
00399 
00400 if((isset($_GET['checkOut'])))
00401 {
00402         if(is_numeric($_GET['checkOut']))
00403         $cond='`user_id`='.$_GET['checkOut'].'';
00404         else $cond='`hospi_guest_name`=\''.$_GET['checkOut'].'\' AND `hospi_actual_checkin`=\''.$_GET['checkinTime'].'\' AND `hospi_checkedin_by`='.$_GET['by'].'';
00405         $query="UPDATE `hospi_accomodation_status` SET `hospi_actual_checkout`=NOW(),`hospi_checkedout_by`= '$this->userId' WHERE `hospi_room_id`='$_GET[room_id]' AND $cond AND `hospi_actual_checkout` IS NULL ";
00406         $result=mysql_query($query);
00407         if(mysql_error())displayerror(mysql_error());
00408 
00409 
00410 }
00411         global $urlRequestRoot;
00412         global $sourceFolder,$cmsFolder;
00413         global $templateFolder;
00414         $scriptsFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/scripts";
00415         $imagesFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/images";
00416         $query1="SELECT * FROM `hospi_hostel` WHERE `hospi_room_id`=$_GET[room_id]";
00417         $result1=mysql_query($query1);
00418         $temp1= mysql_fetch_array($result1,MYSQL_ASSOC);
00419         $query="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_room_id`=$_GET[room_id] AND `hospi_actual_checkout` IS NULL ";
00420         $result=mysql_query($query);
00421         $room.='</tr><tr ><td >Hostel:'.$_GET['hostel'].'<br>Room Number:'.$temp1['hospi_room_no'].'</td></tr>';
00422         while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
00423         {
00424                 if($temp['user_id']<>0)
00425                 $room.="<tr><td><a href=\"+accomodate&displayUserDetails=$temp[hospi_guest_email] \">".getUserFullName($temp['user_id'])."</a></td><td><input type=\"submit\" value=\"Check Out\" onclick=\"window.location='./+accomodate&hostel=$_GET[hostel]&room_id=$_GET[room_id]&checkOut=$temp[user_id]'\"></td></tr>";
00426                 else
00427                 $room.="<tr><td><a href=\"+accomodate&displayUserDetails=$temp[hospi_guest_email]\">".$temp['hospi_guest_name']."</td><td><input type=\"submit\" value=\"Check Out\" onclick=\"window.location='./+accomodate&hostel=$_GET[hostel]&room_id=$_GET[room_id]&checkOut=$temp[hospi_guest_name]&checkinTime=$temp[hospi_actual_checkin]&by=$temp[hospi_checkedin_by]'\"></td></tr>";
00428 
00429         }
00430 $room.="</tr></table>";
00431 global $sourceFolder,$cmsFolder;
00432                 global $moduleFolder;
00433                 global $urlRequestRoot;
00434 
00435                 $calpath = "$urlRequestRoot/$cmsFolder/$moduleFolder";
00436 $room.=<<<FORM
00437 <style type="text/css">
00438 <!--
00439         span.suggestion {
00440                 padding: 2px 4px 2px 4px;
00441                 display: block;
00442                 background-color: white;
00443                 cursor: pointer;
00444         }
00445         span.suggestion:hover {
00446                 background-color: #DEDEDE;
00447         }
00448 -->
00449 </style>
00450 <!--
00451 <link rel="stylesheet" type="text/css" media="all" href="$calpath/form/calendar/calendar.css" title="Aqua" />
00452                                                  <script type="text/javascript" src="$calpath/form/calendar/calendar.js"></script>
00453 
00454 <form method="POST" action="./+accomodate&hostel=$_GET[hostel]&room_id=$_GET[room_id]&checkIn=1">
00455 
00456 Guest Name<input type="text" name="txtUserEmail" id="txtUserEmail"  autocomplete="off" style="width: 256px" /><br>
00457 
00458 Expected Check out<input type="text"  name="check_out"  id="check_out" /><input name="calc" type="reset" value="Calendar" onclick="return showCalendar('check_out', '%Y-%m-%d %H:%M:%S', '24', true);" />
00459 
00460 <div id="suggestionsBox" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div>
00461 
00462 <br>Cash Paid?<input type="checkbox" name="cash_paid">
00463 
00464 <br>
00465 <input type="submit" value="Check In" />
00466 
00467 <script type="text/javascript" language="javascript" src="$scriptsFolder/ajaxsuggestionbox.js">
00468 
00469 </script>
00470 <script language="javascript">
00471         var userBox = new SuggestionBox(document.getElementById('txtUserEmail'), document.getElementById('suggestionsBox'), "./+accomodate&subaction=getsuggestions&forwhat=%pattern%");
00472         userBox.loadingImageUrl = '$imagesFolder/ajaxloading.gif';
00473 </script>
00474 
00475 
00476 </form>
00477 -->
00478 FORM;
00479 
00480         return $room.$this->viewall();
00481 
00482 }
00483 }
00484 
00485 
00486 public function actionAddroom() {
00487 
00488 
00489 
00490 
00491         /*
00492          * SELECT DISTINCT hospi_hostel_name FROM hospi_hostel
00493          * display each as an option in a dropdown menu
00494          * add room no. and capacity to the room
00495          * insert into hospi_hostel with hospi_room_id as
00496          *
00497          * $query = 'SELECT MAX(`hospi_room_id`) FROM `' . MYSQL_DATABASE_PREFIX . 'hospi_hostel`';
00498          *              $result = mysql_query($query) or die(mysql_error());
00499          *              $row = mysql_fetch_row($result);
00500          *              $room_id = 1;
00501          *              if(!is_null($row[0])) {
00502          *                      $room_id = $row[0] + 1;
00503          *      }
00504          *
00505          *subaction=addHostel
00506          *
00507          *just a simple text box with add hostel if the hostel added is not already in db
00508          *
00509          *For Shruthi:: The user must be able to jump on to any page from any other page,
00510          *      basically links for each action to be present in every action.
00511          *      You can make this into a function and then call it every where else.
00512          *
00513          * */
00514 
00515 
00516          if(isset($_GET['subaction']))
00517          {
00518 
00519                 $subaction=$_GET['subaction'];
00520                 if($subaction=='submitaddroom')
00521                 {
00522                         if(($_POST['capacity']=='') or ($_POST['floor']==''))
00523                         {
00524                                 displayerror('All fields not entered');
00525                                 return $this->viewall();
00526                         }
00527                         if($_POST['floor']>2 || $_POST['floor']<0)
00528                         {
00529                                 displayerror('Floor value not accepted');
00530                                 return $this->viewall();
00531                         }       
00532                         if($_POST['check1']==1)
00533                         {
00534                                 if($_POST['roomNo1']=='')
00535                                 {
00536                                         displayerror('All fields not entered');                         
00537                                         return $this->viewall();
00538                                         
00539                                 }
00540                                 
00541                         $query="SELECT `hospi_room_no` FROM `hospi_hostel` WHERE `hospi_room_no`='{$_POST['roomNo1']}' AND `hospi_hostel_name`='{$_POST['hostels']}'";
00542                         $result=mysql_query($query);    
00543                         if(mysql_num_rows($result))
00544                         {
00545                                 displayerror('Room no. already exists in the database for the hostel.');
00546                                 return $this->viewall();
00547                         }
00548                         $query = 'SELECT MAX(`hospi_room_id`) FROM `hospi_hostel`';
00549                         $result = mysql_query($query) or die('error');
00550                         $row = mysql_fetch_row($result);
00551 //                      $room_id = 1;
00552                         if(!is_null($row[0])) {
00553                                 $room_id = $row[0] + 1;
00554                         }
00555                         $query="INSERT INTO `hospi_hostel` (`hospi_room_id`,`hospi_hostel_name`,`hospi_room_capacity`,`hospi_room_no`,`hospi_floor`)".
00556                                         "VALUES('$room_id','{$_POST['hostels']}',{$_POST['capacity']},{$_POST['roomNo1']},'{$_POST['floor']}') ";
00557                         $result=mysql_query($query);
00558                         if(!$result)
00559                         {
00560                                 displayerror('Error while adding room data');
00561                                 return $this->viewall();
00562                         }
00563                         return $this->viewall();
00564                         }
00565                         else if($_POST['check1']==2)
00566                         {
00567                                 if(($_POST['roomNo1']=='') or ($_POST['roomNo2']==''))
00568                                 {
00569                                         displayerror('All fields not entered');                         
00570                                         return $this->viewall();
00571                                         
00572                                 }
00573                                 for($room=$_POST['roomNo1'];$room<=$_POST['roomNo2'];$room++)
00574                                 {
00575                         $query="SELECT `hospi_room_no` FROM `hospi_hostel` WHERE `hospi_room_no`='$room ' AND `hospi_hostel_name`='{$_POST['hostels']}'";
00576                         $result=mysql_query($query);    
00577                         if(mysql_num_rows($result))
00578                         {
00579                                 displayerror("Room no.' $room ' already exists in the database for the hostel.");
00580                                 continue;
00581                         }
00582                         $query = 'SELECT MAX(`hospi_room_id`) FROM `hospi_hostel`';
00583                         $result = mysql_query($query) or die('error');
00584                         $row = mysql_fetch_row($result);
00585 //                      $room_id = 1;
00586                         if(!is_null($row[0])) {
00587                                 $room_id = $row[0] + 1;
00588                         }
00589                         $query="INSERT INTO `hospi_hostel` (`hospi_room_id`,`hospi_hostel_name`,`hospi_room_capacity`,`hospi_room_no`,`hospi_floor`)".
00590                                         "VALUES('$room_id','{$_POST['hostels']}',{$_POST['capacity']},'$room','{$_POST['floor']}') ";
00591                         $result=mysql_query($query);
00592                         if(!$result)
00593                         {
00594                                 displayerror('Error while adding room data');
00595                                 return $this->viewall();
00596                         }
00597 
00598                         }
00599                         return $this->viewall();
00600                         }
00601                         else
00602                         {
00603                                 displayerror('check on either single room or range of rooms');
00604                                 return $this->viewall();
00605                                 
00606                         }
00607                 }
00608                 else if(isset($_POST['hostel']))
00609                 {
00610                         if($_POST['hostel']=='')
00611                         {
00612                                 displayerror('Please enter a name for hostel');
00613                                 return $this->viewall();
00614                         }
00615 
00616                         $query = 'SELECT MAX(`hospi_room_id`) FROM `hospi_hostel`';
00617                         $result = mysql_query($query) or die('error');
00618                         $row = mysql_fetch_row($result);
00619 //                      $room_id = 1;
00620                         if(!is_null($row[0])) {
00621                                 $room_id = $row[0] + 1;
00622                         }
00623 
00624                         $query="INSERT INTO `hospi_hostel` (`hospi_hostel_name`,`hospi_room_id`) VALUES ('{$_POST['hostel']}','$room_id')";
00625                         $result=mysql_query($query);
00626                         if(!$result)
00627                         {
00628                                 displayerror(mysql_error());
00629                                 return $this->viewall();
00630                         }
00631                         
00632                 }
00633                 else if($subaction=='addhostel')
00634                 {
00635                         $newhostel=<<<HOSTEL
00636                         <form method="POST" action="./+addroom&subaction=addhostel">
00637                         Hostel:<input type="text" name="hostel" id="hostel"><br>
00638                         <input type="submit" value="Add Hostel"><br>
00639 HOSTEL;
00640                         return $newhostel.$this->viewall();
00641 
00642                 }
00643          }
00644 
00645 
00646 
00647          $query="SELECT DISTINCT `hospi_hostel_name` FROM `hospi_hostel`";
00648          $result=mysql_query($query);
00649          $hostel=<<<ROOM
00650 <form method="POST" action="./+addroom&subaction=submitaddroom">
00651 Hostel : 
00652 <select name="hostels" id="hostels" >
00653 ROOM;
00654          while($temp=mysql_fetch_array($result,MYSQL_NUM))
00655          {
00656                 foreach($temp as $hostelname)
00657                 {
00658                         $hostel.='<option value='.$hostelname.'>'.$hostelname.'</option>';
00659                 }
00660 
00661          }
00662 $hostel.=<<<HOSTEL
00663 </select>
00664 <script language="javascript">
00665 <!-- 
00666 function hello()
00667 {
00668 document.getElementById('hide1').style.display='none';
00669 document.getElementById('hide2').style.display='none';
00670 
00671 }
00672 function hello1()
00673 {
00674 document.getElementById('hide1').style.display='block';
00675 document.getElementById('hide2').style.display='block';
00676 }
00677 -->
00678 </script>
00679 <br>
00680  <input type="radio" name="check1" id="check1" value="1" onclick=hello()>Single room  <input type="radio" name="check1" id="check2" value="2" onclick=hello1()>Range of rooms<br>
00681 Room No:<div id="hide2">From:</div><input type="text" name="roomNo1" id="roomNo1"> <div id="hide1">To:<br><input type="text" name="roomNo2" id="roomNo2"></div>
00682 Capacity:<input type="text" name="capacity" id="capacity"><br>
00683 Floor:<input type="text" name="floor" id="floor"><br>
00684 <input type="submit" value="Add Room"><br>
00685 </form>
00686 <br>
00687 HOSTEL;
00688 
00689          return $hostel.$this->viewall();
00690 }
00691 
00692 public function displayUser()
00693 {
00694                         $search=$_POST['txtUserEmail'];
00695                                 $userid=getUserIdFromEmail($search);
00696                                 //if(is_numeric($userid))
00697                                 //$query="SELECT * FROM `hospi_accomodation_status` WHERE `user_id`=$userid";
00698                                 //else
00699                                 $query="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_guest_name` LIKE '%$search%' OR `hospi_guest_email` LIKE '%$search%' OR `hospi_guest_college` LIKE '%$search%'";
00700                                 $result=mysql_query($query);
00701                                 if(!$result)
00702                                 {
00703 
00704                                         displayerror(mysql_error());
00705                                         return $this->viewall();
00706                                 }
00707                                 if(!mysql_num_rows($result))
00708                                 {
00709                                         displayinfo('The user has not checked into any room');
00710                                         return $this->viewall();
00711                                 }
00712                                 else
00713                                 {
00714                                         $details=<<<USER
00715                                         <b>User Email:{$_POST['txtUserEmail']}</b><br>          
00716 USER;
00717                                         while($row=mysql_fetch_array($result))
00718                                         {
00719                                         $query="SELECT * FROM `hospi_hostel` WHERE `hospi_room_id`={$row['hospi_room_id']}";
00720                                         $result1=mysql_query($query);
00721                                         $row1=mysql_fetch_array($result1);
00722                                         $details.=<<<USER1
00723                                         <br>
00724                                         <table border="1">
00725                                         <tr>
00726                                         <td nowrap="nowrap">Name</td>
00727                                         <td nowrap="nowrap">{$row['hospi_guest_name']}</td>
00728                                         </tr>
00729                                         <tr>
00730                                         <td nowrap="nowrap">Email</td>
00731                                         <td nowrap="nowrap">{$row['hospi_guest_email']}</td>
00732                                         </tr>
00733                                         <tr>
00734                                         <td nowrap="nowrap">College</td>
00735                                         <td nowrap="nowrap">{$row['hospi_guest_college']}</td>
00736                                         </tr>
00737                                         <tr>
00738                                         <td nowrap="nowrap">Phone</td>
00739                                         <td nowrap="nowrap">{$row['hospi_guest_phone']}</td>
00740                                         </tr>
00741                                         <tr>
00742                                         <td nowrap="nowrap">Hostel</td>
00743                                         <td nowrap="nowrap">{$row1['hospi_hostel_name']}</td>
00744                                         </tr>
00745                                         <tr>
00746                                         <td nowrap="nowrap">Room no.</td>
00747                                         <td nowrap="nowrap">{$row1['hospi_room_no']}</td>
00748                                         </tr>
00749                                         <tr>
00750                                         <td nowrap="nowrap">Checked in on</td>
00751                                         <td nowrap="nowrap">{$row['hospi_actual_checkin']}</td>
00752                                         </tr>
00753 
00754 
00755 
00756 USER1;
00757                                         if($row['hospi_actual_checkout'])
00758                                         {
00759                                                 $details.="<tr><th nowrap=\"nowrap\">Checked out on</th><th nowrap=\"nowrap\">{$row['hospi_actual_checkout']}</th></tr>";
00760                                         }
00761                                         if($row['hospi_actual_checkout']==0)
00762                                         {
00763                                         if($row['user_id']<>0)
00764                                                 $details.="<tr><td><input type=\"submit\" value=\"Check Out\" onclick=\"window.location='./+accomodate&hostel=$row1[hospi_hostel_name]&room_id=$row[hospi_room_id]&checkOut=$row[user_id]'\"></td></tr>";
00765                                                 else
00766                 
00767                                                 $details.="<tr><td><input type=\"submit\" value=\"Check Out\" onclick=\"window.location='./+accomodate&hostel=$row1[hospi_hostel_name]&room_id=$row[hospi_room_id]&checkOut=$row[hospi_guest_name]&checkinTime=$row[hospi_actual_checkin]&by=$row[hospi_checkedin_by]'\"></td></tr>";
00768                                                 }
00769                                         $details.='</table>';
00770                                         }
00771                                 return $details.$this->viewall();
00772                                 }
00773 }
00774 
00775 public function actionView() {          
00776 
00777                 if(isset($_GET['subaction']))
00778                 {
00779                          if($_GET['subaction'] == 'getsuggestions' && isset($_GET['forwhat'])) 
00780                          {
00781                                 echo $this->getEmailSuggestions($_GET['forwhat']);
00782                                 exit();
00783                          }
00784                          
00785                         $subaction=$_GET['subaction'];
00786                         if($subaction=='displayuser')
00787                         {
00788                         
00789                 
00790                         }
00791                         if($subaction=='finduser')
00792                         {
00793                                 global $urlRequestRoot,$sourceFolder,$templateFolder,$cmsFolder;
00794 
00795                         $scriptsFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/scripts";
00796                         $imagesFolder = "$urlRequestRoot/$cmsFolder/$templateFolder/common/images";
00797                         $find=<<<USER
00798 
00799 
00800                         <form method="POST" action="./+view&subaction=displayuser">
00801                         Enter user:<input type="text" name="txtUserEmail" id="txtUserEmail"  autocomplete="off" style="width: 256px" />
00802                         <div id="suggestionsBox" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div>
00803                         <input type="submit" Value="Find User"/>
00804                         <script type="text/javascript" language="javascript" src="$scriptsFolder/ajaxsuggestionbox.js">
00805                         </script>
00806                         <script language="javascript">
00807                         var userBox = new SuggestionBox(document.getElementById('txtUserEmail'), document.getElementById('suggestionsBox'), "./+view&subaction=getsuggestions&forwhat=%pattern%");
00808                         userBox.loadingImageUrl = '$imagesFolder/ajaxloading.gif';
00809                         </script>
00810                         </form>
00811 
00812 
00813 
00814 
00815 USER;
00816                         return $find.$this->viewall();
00817                         }
00818 
00819                         if($subaction=="viewstatus")
00820                         {
00821                                         
00822                                         $query="SELECT DISTINCT `hospi_hostel_name` FROM `hospi_hostel` ";
00823                                         $result4=mysql_query($query)or die(mysql_error());
00824                                         $statusall=<<<ROOM
00825                                         
00826 
00827 ROOM;
00828                                         static $i;
00829                                         while($temp4=mysql_fetch_array($result4,MYSQL_ASSOC))
00830                                         {
00831                                                 $statusall.=$temp4['hospi_hostel_name'];
00832                                                 $statusall.='<table border="1">';
00833                                                 for($i=0;$i<3;$i++)
00834                                                 {
00835                                                 $j=0;
00836                                                 $statusall.='<tr>';
00837 
00838                                         
00839                                                 $query="
00840                                                 SELECT *  FROM `hospi_hostel` WHERE `hospi_hostel_name`='$temp4[hospi_hostel_name]' AND `hospi_room_no`<>0  AND `hospi_floor`=$i";
00841                                                 $result=mysql_query($query)or die(mysql_error());
00842                                                 $num=mysql_num_rows($result);
00843                                                 $x=$num/8;
00844                                                 $x++;
00845                                                 $statusall.="<td rowspan=$x>$i</td>";
00846                                                 while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
00847                                                         {
00848                         
00849                                                         //      $statusall.="</tr>";
00850 
00851                                                         $status="<br>Vacant";
00852                                                         $query1="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_room_id`=$temp[hospi_room_id] AND `hospi_actual_checkout` IS NULL";
00853                                                         $result1=mysql_query($query1);
00854 
00855                                                         if(mysql_num_rows($result1)<$temp['hospi_room_capacity']);
00856                                                         else $status="Full";
00857                                         
00858 //                                                      $statusall.='<tr>';
00859                                                         if(mysql_num_rows($result1)>=$temp['hospi_room_capacity'])
00860                                                         {
00861                                                         $statusall.='<td id="asdf">';
00862                                                         }
00863                                                         else
00864                                                         {
00865                                                         $statusall.='<td id="asdf1">';
00866                                                         }
00867                                                         $statusall.='<a href="+accomodate&hostel='.$temp['hospi_hostel_name'].'&room_id='.$temp['hospi_room_id'].'">'.$temp['hospi_room_no'].'              ' ;
00868                                                 
00869                                                         $statusall.="$status      (".mysql_num_rows($result1)."/".$temp['hospi_room_capacity'].")";
00870                                                         
00871                                                         $statusall.=<<<RED
00872                                                         <style type="text/css">
00873                                                         <!--
00874                                                                 #asdf {
00875                                                                         background-color: #FF0000;
00876                                                                 }
00877                                                                 #asdf1
00878                                                                 {
00879                                                                         background-color: #00FF00;
00880                                                                 }
00881                                                         -->
00882                                                         </style>
00883 RED;
00884                                                 
00885                                                 
00886                                                 
00887                                                         $statusall.='</td>';
00888         /*                                      while($temp1=mysql_fetch_array($result1, MYSQL_ASSOC)){
00889                                                 
00890                                                 {
00891                                                         $statusall.="<a href=\"+accomodate&displayUserDetails=$temp1[hospi_guest_email]\" >$temp1[hospi_guest_name]</a>,";
00892 
00893                                                 }
00894                                                 }*/
00895 //                                              $statusall.='</tr>';
00896 
00897 $j++;
00898                                                 if($j==8)
00899                                                 {
00900                                                         $j=0;
00901                                                         $statusall.='</tr><tr>';
00902                                                 }
00903                                                 }
00904                                                 $statusall.='</tr>';                                            
00905                                                 }
00906                                                 $statusall.='</tr>';
00907                                         }
00908                                         $statusall.='</tr></table>';
00909                                         return $statusall.$this->viewall();
00910                         }
00911                         if($subaction=='displayroom')
00912                         {
00913                                 if($_POST['roomno']<>'')$cond="`hospi_room_no`={$_POST['roomno']} AND";
00914                                 $query="SELECT * FROM `hospi_hostel` WHERE $cond `hospi_hostel_name`='{$_POST['hostels']}'";
00915                                 $result=mysql_query($query);
00916                                 if(!mysql_num_rows($result))
00917                                 {
00918                                         displayerror('Room not present');
00919                                         return $this->viewall();
00920                                 }
00921                                 $row=mysql_fetch_array($result);
00922                                 $query="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_room_id`={$row['hospi_room_id']} AND `hospi_actual_checkout` IS NULL";
00923                                 $result1=mysql_query($query);
00924                                 if(!mysql_num_rows($result1))
00925                                 {
00926                                         displayinfo('Room Vacant');
00927                                         return $this->viewall();
00928                                 }
00929 
00930                                 $room=<<<DETAILS
00931                                 <table border="1">
00932                                 <tr>
00933                                 <th nowrap="nowrap">Hostel:</th>
00934                                 <th nowrap="nowrap">{$row['hospi_hostel_name']}</th>
00935                                 </tr>
00936                                 <tr>
00937                                 <th nowrap="nowrap">Room No.:</th>
00938                                 <th nowrap="nowrap">{$row['hospi_room_no']}</th>
00939                                 </tr>
00940 DETAILS;
00941                         
00942                                 $room.="</table><br><br>";
00943 
00944                                 $room.="Guests alloted:<br>";
00945 
00946                                         while($row1=mysql_fetch_assoc($result1))
00947                                         {
00948                                                 $username=$row1['hospi_guest_email'];
00949                                                 $room.=<<<DETAILS
00950                                                 <br>
00951                                                 <table border="1">
00952                                                 <tr>
00953                                                 <th nowrap="nowrap">email:</th>
00954                                                 <th nowrap="nowrap">$username</th>
00955                                                 </tr>
00956                                                 <tr>
00957                                                 <th nowrap="nowrap">Checked in on:</th>
00958                                                 <th nowrap="nowrap">{$row1['hospi_actual_checkin']}</th>
00959                                                 </tr>
00960                                                 <tr>
00961 DETAILS;
00962                                                 if($row1['hospi_actual_checkout'])
00963                                                 {
00964                                                         $room.="<th nowrap=\"nowrap\">Checked out on:</th><th nowrap=\"nowrap\">{$row1['hospi_actual_checkout']}</th></tr></table>";
00965                                                 }
00966                                                 
00967                                                         if($row1['hospi_actual_checkout']==0)
00968                                         {
00969                                         if($row1['user_id']<>0)
00970                                         
00971                 $room.="<tr><td><input type=\"submit\" value=\"Check Out\" onclick=\"window.location='./+accomodate&hostel=$row[hospi_hostel_name]&room_id=$row1[hospi_room_id]&checkOut=$row1[user_id]'\"></td></tr>";
00972                 else
00973                 
00974                 $room.="<tr><td><input type=\"submit\" value=\"Check Out\" onclick=\"window.location='./+accomodate&hostel=$_POST[hostels]&room_id=$row[hospi_room_id]&checkOut=$row[hospi_guest_name]&checkinTime=$row[hospi_actual_checkin]&by=$row[hospi_checkedin_by]'\"></td></tr><br>";
00975                 }
00976                                         }
00977                                                                                 return $room.$this->viewall();
00978                         }
00979                         if($subaction=='findroom')
00980                         {
00981                                 $query="SELECT DISTINCT `hospi_hostel_name` FROM `hospi_hostel`";
00982                                 $result=mysql_query($query);
00983                                 $room=<<<ROOM
00984                                 <form method="POST" action="./+view&subaction=displayroom">
00985                                 Hostels:<select name="hostels" id="hostels" >
00986 ROOM;
00987                                  while($temp=mysql_fetch_array($result,MYSQL_NUM))
00988                                 {
00989                                         foreach($temp as $hostelname)
00990                                         {
00991                                                 $room.='<option value='.$hostelname.'>'.$hostelname.'</option>';
00992                                         }
00993                                 }
00994                                 $room.=<<<ROOM
00995                                 </select><br>
00996                                 Room No.:<input type="text" name="roomno" />
00997                                 <input type="submit" Value="Find Room"/>
00998                                 </form>
00999 ROOM;
01000                                 return $room.$this->viewall();
01001                         }
01002                         if($subaction=='displayvacantrooms')
01003                         {
01004                         $room=<<<ROOM
01005 ROOM;
01006                                 if($_POST['hostels']=="all")
01007                                 {
01008                                         $query="SELECT DISTINCT `hospi_hostel_name` FROM `hospi_hostel`";
01009                                         $res=mysql_query($query);
01010                                         while($row=mysql_fetch_array($res))
01011                                         {
01012                                                 $query="SELECT * FROM `hospi_hostel` WHERE `hospi_hostel_name`='{$row[hospi_hostel_name]}'  ";
01013                                                 $result=mysql_query($query);
01014                                                 $room.='<table border="1"><tr>';
01015                                                 $room.='</tr><tr ><td >'.$row['hospi_hostel_name'].'</td>';
01016                                                 while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
01017                                                 {
01018                                                 $status="Vacant";
01019                                                 $query1="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_room_id`=$temp[hospi_room_id] AND `hospi_actual_checkout` IS NULL";
01020                                                 $result1=mysql_query($query1);
01021                                                 $temp1=mysql_fetch_array($result1, MYSQL_ASSOC);
01022                                                 if(mysql_num_rows($result1)<$temp['hospi_room_capacity'])
01023                                                 {
01024                                                 $room.='<td width="95" height="95"> <a href="+accomodate&hostel='.$temp['hospi_hostel_name'].'&room_id='.$temp['hospi_room_id'].'">'.$temp['hospi_room_no'].'              ' ;
01025                                                 $room.="$status (".mysql_num_rows($result1)."/".$temp['hospi_room_capacity'].")";
01026                                                 $room.='</td>';
01027                                                 }
01028                                                 }
01029                                         $room.="</tr></table>";
01030                                         }
01031                                         return $room.$this->viewall();
01032                                 }
01033                                 else
01034                                 {
01035                                         $query="SELECT * FROM `hospi_hostel` WHERE `hospi_hostel_name`='$_POST[hostels]'  ";
01036                                         $result=mysql_query($query);
01037                                         $room.='<table border="1"><tr>';
01038                                         $room.='</tr><tr ><td >'.$_POST['hostels'].'</td>';
01039                                         while($temp=mysql_fetch_array($result,MYSQL_ASSOC))
01040                                         {
01041                                                 $status="Vacant";
01042                                                 $query1="SELECT * FROM `hospi_accomodation_status` WHERE `hospi_room_id`=$temp[hospi_room_id] AND `hospi_actual_checkout` IS NULL";
01043                                                 $result1=mysql_query($query1);
01044                                                 $temp1=mysql_fetch_array($result1, MYSQL_ASSOC);
01045                                                 if(mysql_num_rows($result1)<$temp['hospi_room_capacity']);
01046                                                 else $status="Full";
01047                                                 if($status!='Full'){
01048                                                 $room.='<td width="95" height="95"> <a href="+accomodate&hostel='.$temp['hospi_hostel_name'].'&room_id='.$temp['hospi_room_id'].'">'.$temp['hospi_room_no'].'              ' ;
01049                                                 $room.="$status (".mysql_num_rows($result1)."/".$temp['hospi_room_capacity'].")";
01050                                                 $room.='</td>';}
01051                                         }
01052                                     $room.="</tr></table>";
01053                                         return $room.$this->viewall();
01054                                 }
01055                         }
01056                 }
01057                 return($this->viewall());
01058         }
01059         public function deleteModule($moduleComponentId) {
01060                 return true;
01061         }
01062         public function createModule($moduleComponentId) {
01063                 // No initialization
01064         }
01065 
01066 
01067         public function copyModule($moduleComponentId, $newId) {
01068                 return true;
01069         }
01070 
01071         }

Generated on Mon Mar 14 2011 05:35:30 for Pragyan CMS by  doxygen 1.7.1