/residents.php
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
- <?php
- include_once('header.php');
- #Debugger::debug();
-
- $selected = " selected = 'selected' ";
- // $details = array();
- // if(isset($_POST['printprofile']) && isset($_POST['profile_id']) && !empty($_POST['profile_id'])){
-
- // $info = PersonalInfo::getPersonalInfo($_POST['profile_id']);
- // $report = new Report($info);
- // $report->setType("individual");
- // $report->generate();
-
- // }
- ?>
- <div class = "center">
- <form name = "optionForm" method = "POST" action = "<?php echo $_SERVER['PHP_SELF']; ?>">
- <table class = "content">
- <input type = "hidden" name = "profile_id">
- <input type = "hidden" name = "id">
- <tr>
- <td class = "moduleName">
- <img src = "image/Home.png"> Residents Management
- </td>
- </tr>
- <tr>
- <td class = "search">
- Buildings
- <select onchange = "form.submit(); " style = "width: 150px; " name = "buildings">
- <option value = ''>ALL</option>
- <?php
-
- $buildings = Building::getBuildings();
- foreach($buildings as $building):
- ?>
- <option value = "<?php echo $building['ID']; ?>" <?php if(isset($_POST['buildings']) && $_POST['buildings'] == $building['ID']) echo $selected; ?>>
- <?php echo $building['bldg_name']; ?>
- </option>
- <?php
- endforeach;
- ?>
- </select>
-
-
- Duration
- <select onChange = "form.submit();" style = "width: 100px;" name = "residency_duration">
- <option value = ''>ALL</option>
- <?php
- $durationTypes = ResidencyDuration::getDurationTypes();
- foreach($durationTypes as $type):
-
- ?>
- <option value = "<?php echo $type['ID']; ?>" <?php if(isset($_POST['residency_duration']) && $_POST['residency_duration'] == $type['ID']) echo $selected; ?>>
- <?php echo $type['type']; ?>
-
- </option>
- <?php
- endforeach;
- ?>
- </select>
-
-
- Resident type
- <select onChange = "form.submit();" style = "width: 120px;" name = "residenttype">
- <option value = ''>ALL</option>
- <?php
- $residentTypes = ResidentType::getTypes();
- foreach($residentTypes as $type):
-
- ?>
- <option value = "<?php echo $type['ID']; ?>" <?php if(isset($_POST['residenttype']) && $_POST['residenttype'] == $type['ID']) echo $selected; ?>>
- <?php echo $type['resident_type']; ?>
- </option>
- <?php
- endforeach;
- ?>
- </select>
-
-
- <input type = "submit" name = "search" value = "Search">
- <input type = "text" name = "findWhat" value = "<?php if(isset($_POST['findWhat'])) echo $_POST['findWhat']; ?>">
- <select name = "findIn">
- <option value = 'first_name' <?php if(isset($_POST['findIn']) && $_POST['findIn'] == 'first_name') echo $selected; ?>>First name</option>
- <option value = 'middle_name' <?php if(isset($_POST['findIn']) && $_POST['findIn'] == 'middle_name') echo $selected; ?>>Middle name</option>
- <option value = 'last_name' <?php if(isset($_POST['findIn']) && $_POST['findIn'] == 'last_name') echo $selected; ?>>Last name</option>
- </select>
- </td>
- </tr>
- <tr>
-
- <td width = "100%" valign = "top" align = "center">
- <table id = "datagridview" align = "center">
- <tr>
-
- <th width = "2%">#</th>
- <th width = "20%">Last name</th>
- <th width = "20%">First name</th>
- <th width = "20%">Middle name</th>
- <th width = "20%">Building</th>
- <th width = "8%" colspan = "2"></th>
-
- </tr>
- <?php
- $row_number = 1;
- $resident_number = 1;
- $residents = array();
- if(!empty($_POST['buildings']) || !empty($_POST['residency_duration']) || !empty($_POST['residenttype'])){
- if(!empty($_POST['findWhat']) && !empty($_POST['findIn'])){
- $residents = ResidentInfo::getResidents($_POST['buildings'], $_POST['residency_duration'], $_POST['residenttype'], $_POST['findWhat'], $_POST['findIn']);
- } else {
- $residents = ResidentInfo::getResidents($_POST['buildings'], $_POST['residency_duration'], $_POST['residenttype']);
- }
- } else {
- if(!empty($_POST['findWhat']) && !empty($_POST['findIn'])){
- $residents = ResidentInfo::getResidents(0,0,0,$_POST['findWhat'], $_POST['findIn']);
- } else {
- $residents = ResidentInfo::getResidents();
- }
- }
-
- foreach($residents as $resident):
- $id = $resident['ID'];
- $editUrl = "show_profile.php?id={$id}&mode=edit";
- $profileUrl = "show_profile.php?id={$id}";
- $tdID = "data{$id}";
-
- ?>
- <tr onMouseOver = "select('<?php echo $row_number; ?>');" onMouseOut = "unselect('<?php echo $row_number; ?>');">
- <td><?php echo $row_number; ?></td>
- <td><?php echo $resident['last_name']; ?></td>
- <td><?php echo $resident['first_name']; ?></td>
- <td><?php echo $resident['middle_name']; ?></td>
- <td><?php echo $resident['bldg_name']; ?></td>
- <td><input onClick = "popup('<?php echo $editUrl; ?>', window.self, 400, 500)" type = "button" name = "edit" value = "EDIT"></td>
- <td><input onClick = "showDetails('<?php echo $tdID; ?>');" type = "button" name = "showprofile" value = "INFO"></td>
- </tr>
- <?php
- $row_number++;
- $residentInfo = ResidentInfo::getResidentInfo($id);
- ?>
- <div class = "fullInfo" align = "left" id = "<?php echo $tdID; ?>">
- <div class = "titlebar">
- <input type = "hidden" name = "info" id = "info<?php echo $id; ?>" value = "1">
- <input type = "button" id = "previous<?php echo $id; ?>" name = "previous" value = "<<" onClick = "move(<?php echo $id; ?>, 'previous')">
- <span id = "title<?php echo $id; ?>">RESIDENTIAL INFORMATION</span> - <?php echo $residentInfo['first_name'] . " " . $residentInfo['last_name']; ?>
- <input type = "button" id = "next<?php echo $id; ?>" name = "next" value = ">>" onClick = "move(<?php echo $id; ?>,'next')">
- <input onClick = "showDetails('<?php echo $tdID; ?>');" style = "float: right;" type = "button" name = "close" value = "CLOSE">
- </div>
- <div class = "infoArea" >
- <iframe id = "profile<?php echo $id; ?>" src = "show_profile.php?id=<?php echo $id; ?>&info=1" >
- </iframe>
- </div>
- <div class = "imageArea">
- <br>
- <img src = "">
- </div>
- </div>
- <?php
- endforeach;
- ?>
- </table>
- </td>
- </tr>
-
- </table>
- </form>
- </div>
- <?php include_once('footer.php');?>