Advertisement
Guest User

Untitled

a guest
May 5th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.05 KB | None | 0 0
  1. <?php include('config.php'); ?>
  2. <html>
  3. <head>
  4. <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  5. <script type="text/javascript" src="custom-script.js"></script>
  6. <style>
  7. #container {
  8. border: 1px solid #000;
  9. margin: 2% auto 0;
  10. width: 100%;
  11. clear:both;
  12. }
  13. .heading {
  14. border-bottom: medium none !important;
  15. border-image: none;
  16. border-left: 1px solid #000;
  17. border-right: 1px solid #000;
  18. border-top: 1px solid #000;
  19. float: left;
  20. width: 100%;
  21. }
  22. #container > div:last-child {
  23. border-bottom: medium none !important;
  24. }
  25. .heading {
  26. float: left; width: 100%;
  27. }
  28. .heading > div {
  29. border-right: 1px solid #000;
  30. float: left;
  31. height: 55px;
  32. padding-left: 2%;
  33. padding-right: 2%;
  34. padding-top: 2%;
  35. }
  36. .heading > div:last-child {
  37. border-right: none;
  38. width: 25px;
  39. }
  40.  
  41. #container > div:last-child {
  42. border-bottom: medium none !important;
  43.  
  44. }
  45. .heading > div#head-check {
  46. width: 60px;
  47. }
  48. #content {
  49. float: left; width: 100%; padding-top: 1%; border-bottom: 1px solid rgb(0, 0, 0); padding-bottom: 1%;
  50. }
  51. #checklist {
  52. float: left; width: 10%;
  53. }
  54. #title {
  55. float: left; width: 13%;
  56. }
  57. #pro-image {
  58. float: left;
  59. width: 13%
  60. }
  61. #pro-content {
  62. float: left;
  63. padding-left: 10px;
  64. text-align: justify;
  65. width: 17%;
  66. word-wrap: break-word;
  67. }
  68. #cat-title {
  69. float: left; width: 9%;
  70. }
  71. .thumbnails {
  72. float: left;
  73. width: 28%;
  74. }
  75. .heading > div#head-thumb {
  76. width: 170px;
  77. }
  78. .tit-up {
  79. cursor: pointer;
  80. float: left;
  81. font-size: 24px;
  82. }
  83. .active {
  84. color:red;
  85. }
  86. .nactive {
  87. color:red;
  88. }
  89.  
  90. #content > div#pro_id {
  91. float: left;
  92. width: 50px;
  93. }
  94. </style>
  95. </head>
  96. <title>Products</title>
  97. <body>
  98. <script>
  99. $(document).ready(function() {
  100. $("#tit-up").on("click",function() {
  101. var asc_value = $("#tit-up").attr('value');
  102. if(asc_value == 1) {
  103. $('#tit-up').css('color','red!important');
  104. }
  105. $("#container").empty();
  106. $.ajax({
  107. type:'POST',
  108. url:'asc_result.php',
  109. data:'asc_value='+asc_value,
  110. success:function(data) {
  111. if(data) {
  112. $("#container").append(data);
  113. $('#preview').css("display","none");
  114. $('#tit-up').addClass('nactive');
  115. } else {
  116. $('#preview').css("display","none");
  117. }
  118. }
  119. });
  120. });
  121. });
  122. </script>
  123.  
  124. <script>
  125. $(document).ready(function() {
  126. $("#tit-down").on("click",function() {
  127. var desc_value = $("#tit-down").attr('value');
  128. $("#container").empty();
  129. if(desc_value == 2) {
  130. $('#tit-down').css('color','red!important');
  131. }
  132. $.ajax({
  133. type:'POST',
  134. url:'desc_result.php',
  135. data:'desc_value='+desc_value,
  136. success:function(data) {
  137. if(data) {
  138. $("#container").append(data);
  139. $('#preview').css("display","none");
  140. } else {
  141. $('#preview').css("display","none");
  142. }
  143. }
  144. });
  145. });
  146. });
  147. </script>
  148.  
  149. <div style="margin: 3% auto 20px; width: 800px; float: left;">
  150. <div style="float: left; width: 380px;">
  151. Search Products Here: <input type="text" id="search_val" name="search">
  152. <input class="search" type="Submit" name="submit" value="Search">
  153. </div>
  154. </div>
  155. <div style="clear:both;"></div>
  156.  
  157. <script>
  158. $(document).ready(function(){
  159. $(".search").click(function(){
  160. var search = $("#search_val").val();
  161. $("#preview").html('<img src="loader.gif" alt="Searching...."/>');
  162. if(search == '' || search.trim().length == 0) {
  163. alert("Please Enter Value");
  164. $('#preview').css("display","none");
  165. $('#search_val').focus();
  166. return false;
  167. } else {
  168. $("#container").empty();
  169. $.ajax({
  170. type:'POST',
  171. url:'search_result.php',
  172. data:'search_value='+search,
  173. success:function(data) {
  174. if(data) {
  175. $("#container").append(data);
  176. $('#preview').css("display","none");
  177. } else {
  178. $('#preview').css("display","none");
  179. }
  180. }
  181. });
  182. }
  183. });
  184. });
  185. </script>
  186.  
  187. <script>
  188. $(document).ready(function() {
  189. $('#slick-toggle').click(function() {
  190. $('img', this).attr('src', function(i, oldSrc) {
  191. if(oldSrc == 'up.png') {
  192. var value = 2;
  193. //alert(value);
  194. $("#container").empty();
  195. $.ajax({
  196. type:'POST',
  197. url:'desc_result.php',
  198. data:'desc_value='+value,
  199. success:function(data) {
  200. if(data) {
  201. $("#container").append(data);
  202. $('#preview').css("display","none");
  203. } else {
  204. $('#preview').css("display","none");
  205. }
  206. }
  207. });
  208. } else {
  209.  
  210. var value = 1;
  211. $("#container").empty();
  212. $.ajax({
  213. type:'POST',
  214. url:'asc_result.php',
  215. data:'asc_value='+value,
  216. success:function(data) {
  217. if(data) {
  218. $("#container").append(data);
  219. $('#preview').css("display","none");
  220. } else {
  221. $('#preview').css("display","none");
  222. }
  223. }
  224. });
  225. }
  226. return oldSrc == 'up.png' ? 'down.png' : 'up.png';
  227. });
  228. $('#slickbox').toggle(400);
  229. return false;
  230. });
  231. });
  232. </script>
  233.  
  234. <div id="preview"></div>
  235.  
  236. <div class="heading">
  237. <div id="head-check">Select All <input type="checkbox" class="chkSelectAll" /></div>
  238. <div id="head-id">Id</div>
  239. <div id="head-title">Product title <div class="tit-order" style="text-align: center; width: 60px;">
  240. <a href="#" id="slick-toggle"><img src="up.png"/></a>
  241. </div></div>
  242. <div id="head-image">Product Image</div>
  243. <div id="head-desc">Product Description</div>
  244. <div id="head-cat">Category</div>
  245. <div id="head-thumb">Thumbnails</div>
  246. <div id="head-edit">Edit</div>
  247. </div>
  248. <div id="container" align="center">
  249.  
  250. <div class="custom-main">
  251. <?php
  252. $query = "SELECT * FROM products ORDER BY id";
  253. $result = mysql_query($query);
  254. while($row = mysql_fetch_assoc($result)){
  255. ?>
  256. <div id="content">
  257. <div id="checklist"><input type="checkbox" class="chkNumber" value="<?php echo $row['id']; ?>"></div>
  258. <div id="pro_id"><?php echo $row['id']; ?></div>
  259. <div id="title"><?php echo htmlspecialchars_decode($row['title']); ?></div>
  260. <div id="pro-image"><?php echo "<img src=\"thumbnail/" . $row['filename'] . "\" width='100' height='100'/>"; ?></div>
  261. <div id="pro-content"><?php echo htmlspecialchars_decode($row['prod_content']); ?></div>
  262. <?php $query2 = "SELECT title FROM categories where cat_id = ".$row['category']." ORDER BY title";
  263. $result2 = mysql_query($query2);
  264. $cat_title = mysql_fetch_row($result2); ?>
  265. <div id="cat-title"><?php if(empty($cat_title)) { echo "None"; } else { echo $cat_title[0]; }?></div>
  266. <div class="thumbnails">
  267. <?php $id = $row['id']; ?>
  268. <?php $thumbsql = "SELECT * from thumbnails where prod_id='".$id."'";
  269. $thumbarray = mysql_query($thumbsql);
  270. while($trow = mysql_fetch_assoc($thumbarray)) {
  271. $imagename = $trow['imagename'];
  272. echo "<img src=\"thumbnail/" . $imagename . "\" width='50' height='50' style='margin-left:10px;'/>";
  273. } ?>
  274. </div>
  275. <div id="edit"><a href="edit_product.php?id=<?php echo $row['id']; ?>">Edit</a></div>
  276. </div>
  277. <?php } ?>
  278. <div style="float:left;margin-left:10px;"><span class="btnGetAll" style="float:left;cursor:pointer;">Delete Selected</span></div>
  279. <span style="text-align:center;"><a href="addproduct.php">Add Products</a></span>
  280. </div>
  281. </div>
  282. </body>
  283. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement