Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  8. <title>Survey Settings</title>
  9.  
  10. <!-- Bootstrap -->
  11. <link href="css/bootstrap.min.css" rel="stylesheet">
  12. <link href=" //maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  13. <link href="https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css" rel="stylesheet">
  14.  
  15.  
  16.  
  17. </head>
  18. <body>
  19. <br/>
  20. <hr/>
  21.  
  22.  
  23. <?php
  24. require_once("/dao/CategoryDAO.php");
  25. require_once("/dao/TopicDAO.php");
  26.  
  27. $category = new CategoryDAO();
  28. $topic = new TopicDAO();
  29. $allCategories_arr = $category->getAllCategories();
  30. $allTopics_arr = $topic->getAllTopicTitles();
  31.  
  32. ?>
  33.  
  34. <?php
  35.  
  36. $catid = 0;
  37. if(isset($_GET['catid']))
  38. $catid = $_GET['catid'];
  39.  
  40.  
  41.  
  42.  
  43. $catinfo = $category->getCategoryByCatID($catid);
  44. $subcategoryname = $_POST['subcategoryname'];
  45.  
  46. if($catid != 0 ) {
  47. $allSubCategories_arr = $category->getSubCategoriesByID($catid);
  48.  
  49. $category->AddSubcategory($catid,$catinfo); // adds the subcategory to the 'category' table
  50.  
  51. ?>
  52. <div class="container">
  53. <div class="row">
  54. <?php echo $catinfo[0]['categoryname'] . "'s Subcategories" ; ?>
  55. </div>
  56. <div class="row">
  57. <form method="POST">
  58. <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
  59. <thead>
  60. <tr>
  61. <th>Subcategory ID</th>
  62. <th>Subcategory Name</th>
  63. <th>Action</th>
  64. </tr>
  65. </thead>
  66. <tbody>
  67. <?php
  68. foreach($allSubCategories_arr as $ar) {
  69.  
  70. echo "<tr>";
  71. echo "<th>" . $ar['category_id'] . "</th>";
  72. echo "<th>" . $ar['categoryname'] . "</th>";
  73. echo "<th><a class='btn btn-default' href='viewtopicsundersubcategory.php?catid=".$catid."&subcatid=".$ar['category_id']."'>More Info<a/><a class='btn btn-info' href='EditSubCategory.php?category_id=".$ar['category_id']."'>Edit</th>";
  74. echo "</tr>";
  75. }
  76. ?>
  77. </tbody>
  78. </table>
  79. <div class="col-sm-2">
  80. <input type="text" name="subcategoryname" class="form-control input-sm" required />
  81. </div>
  82.  
  83. <input type="submit" name="submit" value="Add Subcategory" class="btn btn-danger" />
  84. </div>
  85. </div>
  86. <?php
  87. }
  88. ?>
  89.  
  90.  
  91. <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  92. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  93. <!-- Include all compiled plugins (below), or include individual files as needed -->
  94. <script src="js/bootstrap.min.js"></script>
  95. <script src="//code.jquery.com/jquery-1.12.4.js"></script>
  96. <script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
  97. <script src="https://cdn.datatables.net/1.10.13/js/dataTables.bootstrap.min.js"></script>
  98. <script type="text/javascript">
  99. $(document).ready(function() {
  100. $('#example').DataTable();
  101. } );
  102. </script>
  103.  
  104.  
  105. </body>
  106. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement