PageRenderTime 27ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/residents.php

http://ltw-axis.googlecode.com/
PHP | 168 lines | 147 code | 13 blank | 8 comment | 29 complexity | fb34e740d1a015570dfa17ac1356ee35 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, LGPL-3.0, GPL-3.0
  1. <?php
  2. include_once('header.php');
  3. #Debugger::debug();
  4. $selected = " selected = 'selected' ";
  5. // $details = array();
  6. // if(isset($_POST['printprofile']) && isset($_POST['profile_id']) && !empty($_POST['profile_id'])){
  7. // $info = PersonalInfo::getPersonalInfo($_POST['profile_id']);
  8. // $report = new Report($info);
  9. // $report->setType("individual");
  10. // $report->generate();
  11. // }
  12. ?>
  13. <div class = "center">
  14. <form name = "optionForm" method = "POST" action = "<?php echo $_SERVER['PHP_SELF']; ?>">
  15. <table class = "content">
  16. <input type = "hidden" name = "profile_id">
  17. <input type = "hidden" name = "id">
  18. <tr>
  19. <td class = "moduleName">
  20. <img src = "image/Home.png">&nbsp;&nbsp;Residents Management
  21. </td>
  22. </tr>
  23. <tr>
  24. <td class = "search">
  25. Buildings
  26. <select onchange = "form.submit(); " style = "width: 150px; " name = "buildings">
  27. <option value = ''>ALL</option>
  28. <?php
  29. $buildings = Building::getBuildings();
  30. foreach($buildings as $building):
  31. ?>
  32. <option value = "<?php echo $building['ID']; ?>" <?php if(isset($_POST['buildings']) && $_POST['buildings'] == $building['ID']) echo $selected; ?>>
  33. <?php echo $building['bldg_name']; ?>
  34. </option>
  35. <?php
  36. endforeach;
  37. ?>
  38. </select>
  39. &nbsp;
  40. &nbsp;
  41. Duration
  42. <select onChange = "form.submit();" style = "width: 100px;" name = "residency_duration">
  43. <option value = ''>ALL</option>
  44. <?php
  45. $durationTypes = ResidencyDuration::getDurationTypes();
  46. foreach($durationTypes as $type):
  47. ?>
  48. <option value = "<?php echo $type['ID']; ?>" <?php if(isset($_POST['residency_duration']) && $_POST['residency_duration'] == $type['ID']) echo $selected; ?>>
  49. <?php echo $type['type']; ?>
  50. </option>
  51. <?php
  52. endforeach;
  53. ?>
  54. </select>
  55. &nbsp;
  56. &nbsp;
  57. Resident type
  58. <select onChange = "form.submit();" style = "width: 120px;" name = "residenttype">
  59. <option value = ''>ALL</option>
  60. <?php
  61. $residentTypes = ResidentType::getTypes();
  62. foreach($residentTypes as $type):
  63. ?>
  64. <option value = "<?php echo $type['ID']; ?>" <?php if(isset($_POST['residenttype']) && $_POST['residenttype'] == $type['ID']) echo $selected; ?>>
  65. <?php echo $type['resident_type']; ?>
  66. </option>
  67. <?php
  68. endforeach;
  69. ?>
  70. </select>
  71. &nbsp;
  72. &nbsp;
  73. <input type = "submit" name = "search" value = "Search">&nbsp;
  74. <input type = "text" name = "findWhat" value = "<?php if(isset($_POST['findWhat'])) echo $_POST['findWhat']; ?>">
  75. <select name = "findIn">
  76. <option value = 'first_name' <?php if(isset($_POST['findIn']) && $_POST['findIn'] == 'first_name') echo $selected; ?>>First name</option>
  77. <option value = 'middle_name' <?php if(isset($_POST['findIn']) && $_POST['findIn'] == 'middle_name') echo $selected; ?>>Middle name</option>
  78. <option value = 'last_name' <?php if(isset($_POST['findIn']) && $_POST['findIn'] == 'last_name') echo $selected; ?>>Last name</option>
  79. </select>
  80. </td>
  81. </tr>
  82. <tr>
  83. <td width = "100%" valign = "top" align = "center">
  84. <table id = "datagridview" align = "center">
  85. <tr>
  86. <th width = "2%">#</th>
  87. <th width = "20%">Last name</th>
  88. <th width = "20%">First name</th>
  89. <th width = "20%">Middle name</th>
  90. <th width = "20%">Building</th>
  91. <th width = "8%" colspan = "2"></th>
  92. </tr>
  93. <?php
  94. $row_number = 1;
  95. $resident_number = 1;
  96. $residents = array();
  97. if(!empty($_POST['buildings']) || !empty($_POST['residency_duration']) || !empty($_POST['residenttype'])){
  98. if(!empty($_POST['findWhat']) && !empty($_POST['findIn'])){
  99. $residents = ResidentInfo::getResidents($_POST['buildings'], $_POST['residency_duration'], $_POST['residenttype'], $_POST['findWhat'], $_POST['findIn']);
  100. } else {
  101. $residents = ResidentInfo::getResidents($_POST['buildings'], $_POST['residency_duration'], $_POST['residenttype']);
  102. }
  103. } else {
  104. if(!empty($_POST['findWhat']) && !empty($_POST['findIn'])){
  105. $residents = ResidentInfo::getResidents(0,0,0,$_POST['findWhat'], $_POST['findIn']);
  106. } else {
  107. $residents = ResidentInfo::getResidents();
  108. }
  109. }
  110. foreach($residents as $resident):
  111. $id = $resident['ID'];
  112. $editUrl = "show_profile.php?id={$id}&mode=edit";
  113. $profileUrl = "show_profile.php?id={$id}";
  114. $tdID = "data{$id}";
  115. ?>
  116. <tr onMouseOver = "select('<?php echo $row_number; ?>');" onMouseOut = "unselect('<?php echo $row_number; ?>');">
  117. <td><?php echo $row_number; ?></td>
  118. <td><?php echo $resident['last_name']; ?></td>
  119. <td><?php echo $resident['first_name']; ?></td>
  120. <td><?php echo $resident['middle_name']; ?></td>
  121. <td><?php echo $resident['bldg_name']; ?></td>
  122. <td><input onClick = "popup('<?php echo $editUrl; ?>', window.self, 400, 500)" type = "button" name = "edit" value = "EDIT"></td>
  123. <td><input onClick = "showDetails('<?php echo $tdID; ?>');" type = "button" name = "showprofile" value = "INFO"></td>
  124. </tr>
  125. <?php
  126. $row_number++;
  127. $residentInfo = ResidentInfo::getResidentInfo($id);
  128. ?>
  129. <div class = "fullInfo" align = "left" id = "<?php echo $tdID; ?>">
  130. <div class = "titlebar">
  131. <input type = "hidden" name = "info" id = "info<?php echo $id; ?>" value = "1">
  132. <input type = "button" id = "previous<?php echo $id; ?>" name = "previous" value = "<<" onClick = "move(<?php echo $id; ?>, 'previous')">
  133. <span id = "title<?php echo $id; ?>">RESIDENTIAL INFORMATION</span> - <?php echo $residentInfo['first_name'] . " " . $residentInfo['last_name']; ?>
  134. <input type = "button" id = "next<?php echo $id; ?>" name = "next" value = ">>" onClick = "move(<?php echo $id; ?>,'next')">
  135. <input onClick = "showDetails('<?php echo $tdID; ?>');" style = "float: right;" type = "button" name = "close" value = "CLOSE">
  136. </div>
  137. <div class = "infoArea" >
  138. <iframe id = "profile<?php echo $id; ?>" src = "show_profile.php?id=<?php echo $id; ?>&info=1" >
  139. </iframe>
  140. </div>
  141. <div class = "imageArea">
  142. <br>
  143. <img src = "">
  144. </div>
  145. </div>
  146. <?php
  147. endforeach;
  148. ?>
  149. </table>
  150. </td>
  151. </tr>
  152. </table>
  153. </form>
  154. </div>
  155. <?php include_once('footer.php');?>