Advertisement
Guest User

antrian

a guest
Dec 21st, 2013
1,838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. <?php
  2.  
  3. $loket="1";
  4. ?>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>Aplikasi Suara Antrian</title>
  10. <link rel="stylesheet" href="syle.css"
  11. <script type="text/javascript" src="jquery-1.7.2.js"></script>
  12. <script type="text/javascript" >
  13. $(document).ready(function(){
  14. $("#play").click(function(){
  15. document.getElementById('suarabel').play();
  16. });
  17.  
  18.  
  19. });
  20. </script>
  21. <style type="text/css">
  22. <!--
  23. .style1 {font-size: large}
  24. -->
  25. </style>
  26. </head>
  27. <body >
  28. <audio id="suarabel" src="Airport_Bell.mp3"></audio>
  29. <audio id="suarabelnomorurut" src="rekaman/nomor-urut.wav" ></audio>
  30. <audio id="suarabelsuarabelloket" src="rekaman/loket.wav" ></audio>
  31.  
  32. <audio id="belas" src="rekaman/belas.wav" ></audio>
  33. <audio id="sebelas" src="rekaman/sebelas.wav" ></audio>
  34. <audio id="puluh" src="rekaman/puluh.wav" ></audio>
  35. <audio id="sepuluh" src="rekaman/sepuluh.wav" ></audio>
  36. <audio id="ratus" src="rekaman/ratus.wav" ></audio>
  37. <audio id="seratus" src="rekaman/seratus.wav" ></audio>
  38. <audio id="suarabelloket1" src="rekaman/<?php echo $loket; ?>.wav" ></audio>
  39. <?php
  40. $location_counter = "data.txt";
  41. $location_date = "date.txt";
  42. $itis = date ("d");
  43.  
  44. // Hari baru?
  45. $aday = join('', file($location_date));
  46. trim($aday);
  47.  
  48. if("$aday"=="$itis"){
  49. //Cari hari ini
  50. $tcounter = join('', file($location_counter));
  51. trim($tcounter);
  52. $tcounter++;
  53.  
  54. $fp = fopen($location_counter,"w");
  55. fputs($fp, $tcounter);
  56. fclose($fp);
  57. }else{
  58. //hari baru
  59. $fp = fopen($location_counter,"w");
  60. fputs($fp, 0);
  61. fclose($fp);
  62. $tcounter = join('', file($location_counter));
  63. trim($tcounter);
  64. $tcounter++;
  65. //tulis hari baru
  66. $fp = fopen($location_counter,"w");
  67. fputs($fp, $tcounter);
  68. fclose($fp);
  69. //tulis di date.txt
  70. $fp = fopen($location_date,"w");
  71. fputs($fp, $itis);
  72. fclose($fp);
  73. }
  74.  
  75. $panjang=strlen($tcounter);
  76. $antrian=$tcounter;
  77.  
  78. for($i=0;$i<$panjang;$i++){
  79. ?>
  80. <audio id="suarabel<?php echo $i; ?>" src="rekaman/<?php echo substr($tcounter,$i,1); ?>.wav" ></audio>
  81. <?php
  82. }
  83. ?>
  84. <div class="kontainer"><a id="konter" href="index.php" ><?php echo $antrian; ?></a></div>
  85. <div class="kontainer2 style1"><input name="play" onclick="mulai();" type="button" value="Panggil" /></div>
  86.  
  87. </body>
  88. </html>
  89. <script type="text/javascript">
  90. function mulai(){
  91. //MAINKAN SUARA BEL PADA SAAT AWAL
  92. document.getElementById('suarabel').pause();
  93. document.getElementById('suarabel').currentTime=0;
  94. document.getElementById('suarabel').play();
  95.  
  96. //SET DELAY UNTUK MEMAINKAN REKAMAN NOMOR URUT
  97. totalwaktu=document.getElementById('suarabel').duration*1000;
  98.  
  99. //MAINKAN SUARA NOMOR URUT
  100. setTimeout(function() {
  101. document.getElementById('suarabelnomorurut').pause();
  102. document.getElementById('suarabelnomorurut').currentTime=0;
  103. document.getElementById('suarabelnomorurut').play();
  104. }, totalwaktu);
  105. totalwaktu=totalwaktu+1000;
  106.  
  107. <?php
  108. //JIKA KURANG DARI 10 MAKA MAIKAN SUARA ANGKA1
  109. if($antrian<10){
  110. ?>
  111.  
  112. setTimeout(function() {
  113. document.getElementById('suarabel0').pause();
  114. document.getElementById('suarabel0').currentTime=0;
  115. document.getElementById('suarabel0').play();
  116. }, totalwaktu);
  117.  
  118. totalwaktu=totalwaktu+1000;
  119. <?php
  120. }elseif($antrian ==10){
  121. //JIKA 10 MAKA MAIKAN SUARA SEPULUH
  122. ?>
  123. setTimeout(function() {
  124. document.getElementById('sepuluh').pause();
  125. document.getElementById('sepuluh').currentTime=0;
  126. document.getElementById('sepuluh').play();
  127. }, totalwaktu);
  128. totalwaktu=totalwaktu+1000;
  129. <?php
  130. }elseif($antrian ==11){
  131. //JIKA 11 MAKA MAIKAN SUARA SEBELAS
  132. ?>
  133. setTimeout(function() {
  134. document.getElementById('sebelas').pause();
  135. document.getElementById('sebelas').currentTime=0;
  136. document.getElementById('sebelas').play();
  137. }, totalwaktu);
  138. totalwaktu=totalwaktu+1000;
  139. <?php
  140. }elseif($antrian < 20){
  141. //JIKA 12-20 MAKA MAIKAN SUARA ANGKA2+"BELAS"
  142. ?>
  143. setTimeout(function() {
  144. document.getElementById('suarabel1').pause();
  145. document.getElementById('suarabel1').currentTime=0;
  146. document.getElementById('suarabel1').play();
  147. }, totalwaktu);
  148. totalwaktu=totalwaktu+1000;
  149. setTimeout(function() {
  150. document.getElementById('belas').pause();
  151. document.getElementById('belas').currentTime=0;
  152. document.getElementById('belas').play();
  153. }, totalwaktu);
  154. totalwaktu=totalwaktu+1000;
  155. <?php
  156. }elseif($antrian < 100){
  157. //JIKA PULUHAN MAKA MAINKAN SUARA ANGKA1+PULUH+AKNGKA2
  158. ?>
  159. setTimeout(function() {
  160. document.getElementById('suarabel0').pause();
  161. document.getElementById('suarabel0').currentTime=0;
  162. document.getElementById('suarabel0').play();
  163. }, totalwaktu);
  164. totalwaktu=totalwaktu+1000;
  165. setTimeout(function() {
  166. document.getElementById('puluh').pause();
  167. document.getElementById('puluh').currentTime=0;
  168. document.getElementById('puluh').play();
  169. }, totalwaktu);
  170. totalwaktu=totalwaktu+1000;
  171. setTimeout(function() {
  172. document.getElementById('suarabel1').pause();
  173. document.getElementById('suarabel1').currentTime=0;
  174. document.getElementById('suarabel1').play();
  175. }, totalwaktu);
  176. totalwaktu=totalwaktu+1000;
  177.  
  178. <?php
  179. }else{
  180. //JIKA LEBIH DARI 100
  181. //Karena aplikasi ini masih sederhana maka logina konversi hanya sampai 100
  182. //Selebihnya akan langsung disebutkan angkanya saja
  183. //tanpa kata "RATUS", "PULUH", maupun "BELAS"
  184. ?>
  185.  
  186. <?php
  187. for($i=0;$i<$panjang;$i++){
  188. ?>
  189.  
  190. totalwaktu=totalwaktu+1000;
  191. setTimeout(function() {
  192. document.getElementById('suarabel<?php echo $i; ?>').pause();
  193. document.getElementById('suarabel<?php echo $i; ?>').currentTime=0;
  194. document.getElementById('suarabel<?php echo $i; ?>').play();
  195. }, totalwaktu);
  196. <?php
  197. }
  198. }
  199. ?>
  200. }
  201. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement