PageRenderTime 52ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/WWW/application/views/specialists/index.php

https://gitlab.com/joshuacurci/healthpredictions
PHP | 187 lines | 170 code | 13 blank | 4 comment | 9 complexity | 9b2fe16613d4aa9fb98a02bf8ba24e8f MD5 | raw file
  1. <h1 class="page-header col-xs-11">Specialists</h1> <i class="fa fa-user-md col-xs-1" aria-hidden="true"></i>
  2. <div style="clear:both"></div>
  3. <?
  4. if (isset($searchresults)) {
  5. echo '<h3>Search Results</h3>';
  6. }
  7. ?>
  8. <div class="col-sm-12 top-buttons">
  9. <a href="<? echo base_url(); ?>index.php/specialists/add/" class="btn btn-success"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add New Individual Specialist</a>
  10. <a href="<? echo base_url(); ?>index.php/specialists/clinic_add/" class="btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add New Specialist Clinic</a>
  11. </div>
  12. <div class="col-sm-12">
  13. <div class="search-box">
  14. <form enctype="multipart/form-data" accept-charset="utf-8" method="post" action="<? echo base_url(); ?>index.php/specialists/search/">
  15. <div class="col-sm-3 search-box-item">
  16. <div class="search-field">
  17. <input type="text" class="form-control" id="inputrecNum1" placeholder="Individual Specialist's Name" name="spec_name" <? if(isset($searchresults)) { echo 'value = "'.$searchresults['spec_name'].'"';} ?> >
  18. </div>
  19. </div>
  20. <div class="col-sm-3 search-box-item">
  21. <div class="search-field">
  22. <input type="text" class="form-control" id="inputrecNum1" placeholder="Search by Specialist's Speciality" name="spec_profession" <? if(isset($searchresults)) { echo 'value = "'.$searchresults['spec_profession'].'"';} ?> >
  23. </div>
  24. </div>
  25. <div class="col-sm-3 search-box-item">
  26. <div class="search-field">
  27. <input type="text" class="form-control" id="inputrecNum1" placeholder="Search By Individual Specialist City" name="spec_city" <? if(isset($searchresults)) { echo 'value = "'.$searchresults['spec_city'].'"';} ?> >
  28. </div>
  29. </div>
  30. <div class="col-sm-2 search-box-item">
  31. <div class="search-field">
  32. <select class="form-control" id="inputorg1" name="spec_state">
  33. <option selected value="">Select Individual Specialists State</option>
  34. <? foreach ($specialistState as $specialistState) { ?>
  35. <option value="<? echo $specialistState['id'] ?>"><? echo $specialistState['state_code'] ?></option>
  36. <? } ?>
  37. </select>
  38. </div>
  39. </div>
  40. <div class="col-sm-1">
  41. <button type="submit" class="btn btn-primary">Search</button>
  42. </div>
  43. <div style="clear:both"></div>
  44. <div class="advanced-search-link"><a href="//<?php echo $_SERVER['SERVER_NAME']; ?>/specialists/search_all">Advanced search</a></div>
  45. </form>
  46. </div>
  47. <div style="clear:both"></div>
  48. <div class="col-sm-12 project-info">
  49. <ul class="nav nav-tabs">
  50. <li class="active"><a data-toggle="tab" href="#specialists">Individual Specialist</a></li>
  51. <li><a data-toggle="tab" href="#clinic">Clinic List</a></li>
  52. </ul>
  53. <div class="col-sm-12 ">
  54. <div class="tab-content">
  55. <!-- List of Specialists -->
  56. <div id="specialists" class="tab-pane fade in active">
  57. <div style="overflow-x:auto;">
  58. <table class="table table-striped table-responsive" id="advisor-data">
  59. <thead>
  60. <tr>
  61. <th>Name</th>
  62. <th>Address</th>
  63. <th>City</th>
  64. <th>State</th>
  65. <th>Phone</th>
  66. <th>Fax</th>
  67. <th>Email</th>
  68. <th></th>
  69. <th></th>
  70. <th></th>
  71. </tr>
  72. </thead>
  73. <tbody id="myTable">
  74. <? foreach ($specialistData as $specialistData) { ?>
  75. <tr>
  76. <td style="width: 150px"><a href="<? echo base_url(); ?>index.php/specialists/view/<? echo $specialistData['specID']; ?>/" ><? echo $specialistData['spec_name']; ?></a></td>
  77. <td><? echo $specialistData['spec_address']; ?></td>
  78. <td><? echo $specialistData['spec_city']; ?></td>
  79. <?
  80. $servername = $this->db->hostname;
  81. $username = $this->db->username;
  82. $password = $this->db->password;
  83. $dbname = $this->db->database;
  84. // Create connection
  85. $conn = new mysqli($servername, $username, $password, $dbname);
  86. // Check connection
  87. if ($conn->connect_error) {
  88. die("Connection failed: " . $conn->connect_error);
  89. }
  90. $sql = "SELECT * FROM tbl_au_states WHERE id = ".$specialistData['spec_state']."";
  91. $result = $conn->query($sql);
  92. $num_rec = $result->num_rows;
  93. if ($result->num_rows > 0) {
  94. while($row = $result->fetch_assoc()) { ?>
  95. <td><? echo $row['state_name']; ?></td>
  96. <? }
  97. } else { ?>
  98. <td>No Assigned State</td>
  99. <? } ?>
  100. <td><? echo $specialistData['spec_phone']; ?></td>
  101. <td><? echo $specialistData['spec_fax']; ?></td>
  102. <td><? echo $specialistData['spec_email']; ?></td>
  103. <td class="tableButtons"><a href="<? echo base_url(); ?>index.php/specialists/view/<? echo $specialistData['specID']; ?>/" class="btn btn-info"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></a></td>
  104. <td class="tableButtons"><a href="<? echo base_url(); ?>index.php/specialists/edit/<? echo $specialistData['specID']; ?>/" class="btn btn-primary"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></td>
  105. <td class="tableButtons"><a href="<? echo base_url(); ?>index.php/specialists/delete/<? echo $specialistData['specID']; ?>/" onclick="return confirm('Are you sure you want to deactivate this item?');" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Deactivate"><span class="glyphicon glyphicon-off" aria-hidden="true"></span></a></td>
  106. </tr>
  107. <? } ?>
  108. </tbody>
  109. </table>
  110. </div>
  111. </div>
  112. <!-- List of Specialists Clinic -->
  113. <div id="clinic" class="tab-pane fade">
  114. <div style="overflow-x:auto;">
  115. <table class="table table-striped table-responsive" id="advisor-data">
  116. <thead>
  117. <tr>
  118. <th>Name</th>
  119. <th>Address</th>
  120. <th>City</th>
  121. <th>State</th>
  122. <th>Phone</th>
  123. <th>Fax</th>
  124. <th>Email</th>
  125. <th></th>
  126. <th></th>
  127. <th></th>
  128. </tr>
  129. </thead>
  130. <tbody id="myTable">
  131. <? foreach ($specialistClinic as $specialistData) { ?>
  132. <tr>
  133. <td style="width: 150px"><a href="<? echo base_url(); ?>index.php/specialists/clinic_view/<? echo $specialistData['clinicID']; ?>/" ><? echo $specialistData['clinic_name']; ?></a></td>
  134. <td><? echo $specialistData['clinic_address']; ?></td>
  135. <td><? echo $specialistData['clinic_city']; ?></td>
  136. <?
  137. $servername = $this->db->hostname;
  138. $username = $this->db->username;
  139. $password = $this->db->password;
  140. $dbname = $this->db->database;
  141. // Create connection
  142. $conn = new mysqli($servername, $username, $password, $dbname);
  143. // Check connection
  144. if ($conn->connect_error) {
  145. die("Connection failed: " . $conn->connect_error);
  146. }
  147. $sql = "SELECT * FROM tbl_au_states WHERE id = ".$specialistData['clinic_state']."";
  148. $result = $conn->query($sql);
  149. $num_rec = $result->num_rows;
  150. if ($result->num_rows > 0) {
  151. while($row = $result->fetch_assoc()) { ?>
  152. <td><? echo $row['state_name']; ?></td>
  153. <? }
  154. } else { ?>
  155. <td>No Assigned State</td>
  156. <? } ?>
  157. <td><? echo $specialistData['clinic_phone']; ?></td>
  158. <td><? echo $specialistData['clinic_fax']; ?></td>
  159. <td><? echo $specialistData['clinic_email']; ?></td>
  160. <td class="tableButtons"><a href="<? echo base_url(); ?>index.php/specialists/clinic_view/<? echo $specialistData['clinicID']; ?>/" class="btn btn-info"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></a></td>
  161. <td class="tableButtons"><a href="<? echo base_url(); ?>index.php/specialists/clinic_edit/<? echo $specialistData['clinicID']; ?>/" class="btn btn-primary"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></td>
  162. <td class="tableButtons"><a href="<? echo base_url(); ?>index.php/specialists/clinic_delete/<? echo $specialistData['clinicID']; ?>/" onclick="return confirm('Are you sure you want to deactivate this item?');" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Deactivate"><span class="glyphicon glyphicon-off" aria-hidden="true"></span></a></td>
  163. </tr>
  164. <? } ?>
  165. </tbody>
  166. </table>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="col-md-12 text-center">
  171. <ul class="pagination pagination-lg" id="myPager"></ul>
  172. </div>
  173. <!-- Last </div> will be in the footer -->