PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Views/SEIP_141176/BookTitle/create.php

https://gitlab.com/faisal08/atomic_project_faisal_141176
PHP | 276 lines | 228 code | 46 blank | 2 comment | 33 complexity | b7ff6895d21dca8f68aa2baacee0b260 MD5 | raw file
  1. <?php
  2. require_once("../../../vendor/autoload.php");
  3. use App\Message\Message;
  4. use App\BookTitle\BookTitle;
  5. $serial=1;
  6. $objBOOKtitle=new BookTitle();
  7. $alldata=$objBOOKtitle->index("obj");
  8. $objBOOKtitle->index("obj");
  9. $recordCount= count($alldata);
  10. if(isset($_REQUEST['Page'])) $page = $_REQUEST['Page'];
  11. else if(isset($_SESSION['Page'])) $page = $_SESSION['Page'];
  12. else $page = 1;
  13. $_SESSION['Page']= $page;
  14. if(isset($_REQUEST['ItemsPerPage'])) $itemsPerPage = $_REQUEST['ItemsPerPage'];
  15. else if(isset($_SESSION['ItemsPerPage'])) $itemsPerPage = $_SESSION['ItemsPerPage'];
  16. else $itemsPerPage = 3;
  17. $_SESSION['ItemsPerPage']= $itemsPerPage;
  18. $pages = ceil($recordCount/$itemsPerPage);
  19. $someData = $objBOOKtitle->indexPaginator($page,$itemsPerPage);
  20. $serial = (($page-1) * $itemsPerPage) +1;
  21. ?>
  22. <!DOCTYPE html>
  23. <html lang="en">
  24. <head><title>Atomic Project </title>
  25. <script type="text/javascript">
  26. function load(thediv,thefile) {
  27. if (window.XMLHttpRequest){
  28. xmlhttp=new XMLHttpRequest();
  29. }
  30. else {
  31. xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
  32. }
  33. xmlhttp.onreadystatechange=function () {
  34. if (xmlhttp.readyState==4 && xmlhttp.status==200){
  35. document.getElementById(thediv).innerHTML=xmlhttp.responseText;
  36. }
  37. }
  38. xmlhttp.open('GET',thefile,true);
  39. xmlhttp.send();
  40. xmlhttp.close();
  41. }
  42. </script>
  43. <link href="../../../style/style.css" rel="stylesheet" type="text/css">
  44. <link rel="stylesheet" href="../../../bootstrap/css/bootstrap.min.css">
  45. <link rel="stylesheet" href="../../../bootstrap/js/bootstrap.min.js">
  46. <script src="../../../bootstrap/js/jquery.min.js"></script>
  47. <script src="../../../bootstrap/js/bootstrap.min.js"></script>
  48. <script src="../../../JS/create.js"></script>
  49. <script type="text/javascript" src="../../../bootstrap/js/bootstrapValidator.js"></script>
  50. <link rel="stylesheet" href="../../../bootstrap/css/bootstrapValidator.css"/>
  51. <link rel="stylesheet" href="../../../font-awesome-4.7.0/css/font-awesome.min.css"/>
  52. <script type="text/javascript">
  53. function findmatch() {
  54. if (window.XMLHttpRequest){
  55. xmlhttp=new XMLHttpRequest();
  56. }
  57. else {
  58. xmlhttp=new ActiveXObject('Microsoft XMLHTTP');
  59. }
  60. xmlhttp.onreadystatechange=function () {
  61. if (xmlhttp.readyState==4 && xmlhttp.status==200){
  62. document.getElementById('result').innerHTML=xmlhttp.responseText;
  63. }
  64. }
  65. xmlhttp.open('GET','searching.php?search_text='+document.search.search_text.value,true);
  66. xmlhttp.send();
  67. }
  68. </script>
  69. </head>
  70. <body>
  71. <div class="container" id="contain">
  72. <div class="jumbotron" id="header">
  73. <h2>welcome to book title</h2>
  74. </div>
  75. <form class="navbar-form navbar-right">
  76. <div class="form-group" id="search" name="search">
  77. <input type="text" class="form-control" placeholder="Search" name="search_text" onkeyup="findmatch();">
  78. </div>
  79. <button type="submit" class="btn btn-default">Search</button>
  80. <input type="checkbox" name="byTitle" checked >By Title
  81. <input type="checkbox" name="byAuthor" checked >By Author
  82. </form>
  83. <div id="result">
  84. </div>
  85. <div class="row">
  86. <div class="page-header" id="Mmessage">
  87. <?php echo Message::message(); ?>
  88. </div></div>
  89. <div class="row">
  90. <div class="col-md-3 col-sm-3 col-lg-3" >
  91. <div class="well" id="navbar">
  92. <ul class="nav nav-pills nav-stacked" role="tablist" >
  93. <li class="active"><a href="create.php">Book Title</a></li>
  94. <li><a href="../Birthdate/create.php">Birthday</a></li>
  95. <li><a href="../City/create.php">City</a></li>
  96. <li><a href="../Email/create.php">Email</a></li>
  97. <li><a href="../Gender/create.php">Gender</a></li>
  98. <li><a href="../Hobbies/create.php">Hobbies</a></li>
  99. <li><a href="../Profile_Picture/create.php">Profile Picture</a></li>
  100. <li><a href="../Summary_Of_Organization/create.php">Summary of Organization</a></li>
  101. </ul>
  102. </div>
  103. </div>
  104. <div class="col-md-9 col-lg-9 col-sm-9" >
  105. <div class="panel panel-default">
  106. <div class="panel panel-primary">
  107. <div class="panel-heading">
  108. <button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModalNorm">
  109. <span class="glyphicon glyphicon-plus">create new</span></button>
  110. <a href="trashed.php"> <button type="button" class="btn btn-info" >
  111. <span class="glyphicon glyphicon-trash">Trashed List</span></button></a>
  112. <div class="nav navbar-right">
  113. <label >booklist per page</label>
  114. <select class=" bg-primary" name="ItemsPerPage" id="ItemsPerPage" onchange="javascript:location.href = this.value;" >
  115. <?php
  116. if($itemsPerPage==3 ) echo '<option value="?ItemsPerPage=3" selected >3 </option>';
  117. else echo '<option value="?ItemsPerPage=3"> 3 </option>';
  118. if($itemsPerPage==4 ) echo '<option value="?ItemsPerPage=4" selected >4 </option>';
  119. else echo '<option value="?ItemsPerPage=4"> 4 </option>';
  120. if($itemsPerPage==5 ) echo '<option value="?ItemsPerPage=5" selected > 5 </option>';
  121. else echo '<option value="?ItemsPerPage=5"> 5 </option>';
  122. if($itemsPerPage==6 ) echo '<option value="?ItemsPerPage=6"selected > 6 </option>';
  123. else echo '<option value="?ItemsPerPage=6">6 </option>';
  124. if($itemsPerPage==10 ) echo '<option value="?ItemsPerPage=10"selected > 10 </option>';
  125. else echo '<option value="?ItemsPerPage=10"> 10 </option>';
  126. if($itemsPerPage==15 ) echo '<option value="?ItemsPerPage=15"selected > 15 </option>';
  127. else echo '<option value="?ItemsPerPage=15">15 </option>';
  128. ?>
  129. </select>
  130. </div>
  131. </div>
  132. </div>
  133. <div class="panel-body">
  134. <div class="well" id="navbar">
  135. <table class="table table-responsive">
  136. <thead>
  137. <tr class="bg-primary">
  138. <th style="width:7%">SL.no</th>
  139. <th style="width:7%">ID</th>
  140. <th style="width:20%">BOOK TITLE</th>
  141. <th style="width:30%">AUTHOR NAME</th>
  142. <th style="width:36%">ACTION</th>
  143. </tr>
  144. </thead>
  145. <?php foreach($someData as $onedata){
  146. echo "<tbody>";
  147. echo "<tr>";
  148. echo "<td>".$serial."</td>";
  149. echo "<td>".$onedata->id."</td>";
  150. echo "<td>".$onedata->booktitle."</td>";
  151. echo "<td>".$onedata->author_name."</td>";
  152. echo "<td>";
  153. //echo "<ul class='breadcrumb '>";
  154. echo "<a ><button class='btn btn-info' data-toggle='modal' data-target='#myModalnorm'
  155. onclick=\"load('Mmessage','view.php?id=$onedata->id');\">view</button> </a>";
  156. echo "<a ><button class='btn btn-primary' data-toggle='modal' data-target='#MyModalnorm'
  157. onclick=\"load('Mmessage','editt.php?id=$onedata->id');\">edit</button> </a>";
  158. echo "<a href='trash.php?id=$onedata->id'><button class='btn btn-success'>Trash</button></a> ";
  159. echo "<a href='delete.php?id=$onedata->id'><button class='btn btn-danger'>delete</button> </a>";
  160. echo "</td>";
  161. echo "</tr>";
  162. $serial++;
  163. // echo "</ul>";
  164. echo "</tr>";
  165. echo "</tbody>";
  166. }
  167. ?>
  168. </table>
  169. </div>
  170. <nav aria-label="..." class="nav navbar-right">
  171. <ul class="pagination">
  172. <?php
  173. $pre= $page-1;
  174. $next=$page+1;
  175. if($page==1)
  176. echo "<li><a href=''>". 'Previous' . '</a></li>';
  177. else
  178. echo "<li><a href='?Page=$pre'>". 'Previous' . '</a></li>';
  179. for($i=1;$i<=$pages;$i++)
  180. {
  181. if($i==$page) echo '<li class="active"><a href="">'. $i . '</a></li>';
  182. else echo "<li><a href='?Page=$i'>". $i . '</a></li>';
  183. }
  184. if($page==$pages)
  185. echo "<li><a href=''>". 'Next' . '</a></li>';
  186. else
  187. echo "<li><a href='?Page=$next'>". 'Next' . '</a></li>';
  188. ?>
  189. </ul>
  190. </nav>
  191. </div>
  192. </div>
  193. </div>
  194. <div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog"
  195. aria-labelledby="myModalLabel" aria-hidden="true">
  196. <div class="modal-dialog">
  197. <div class="modal-content">
  198. <!-- Modal Header -->
  199. <div class="modal-header">
  200. <h3>Please enter Book Title and Author Name
  201. <i class="fa fa-book fa-lg " aria-hidden="true"></i>
  202. </h3>
  203. <button type="button" class="close"
  204. data-dismiss="modal">
  205. <span aria-hidden="true">&times;</span>
  206. <span class="sr-only">Close</span>
  207. </button>
  208. </div>
  209. <!-- Modal Body -->
  210. <div class="modal-body">
  211. <form action="store.php" id="bookform" method="post" role="form">
  212. <div class="form-group">
  213. <label for="booktitle">Book Title</label>
  214. <input type="text" class="form-control"name="booktitle"
  215. id="booktitle" placeholder="Enter booktitle"/>
  216. </div>
  217. <div class="form-group">
  218. <label for="author_name">Author Name</label>
  219. <input type="text" class="form-control"name="author_name"
  220. id="author_name" placeholder="Enter author_name"/>
  221. </div>
  222. <button type="submit" class="btn btn-info" ">Submit</button>
  223. </form>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. </body>
  230. </html>