Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. $(".edit_scoala").click(function(){
  2. var id_scoala = $(this).attr("id").substring(12);
  3. //alert(id_scoala);
  4. $.ajax({
  5. type: "POST",
  6. url: "ajax/edit_scoala.php",
  7. data:{
  8. id: id_scoala
  9. },
  10. cache:false,
  11. //dataType: "html"
  12.  
  13. }).done(function(ms){
  14. $("#response").html(ms);
  15. var map = L.map('map').setView([44.9323281,26.0306833], 12,25);
  16.  
  17. L.tileLayer( 'https://api.mapbox.com/styles/v1/mapbox/streets-v10/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWVnYTYzODIiLCJhIjoiY2ozbXpsZHgxMDAzNjJxbndweDQ4am5mZyJ9.uHEjtQhnIuva7f6pAfrdTw', {
  18. maxZoom: 18,
  19. attribution: 'Map data &copy; <a href="http://openstreetmap.org/"> OpenStreetMap </a> contributors, ' +
  20. '<a href="http://creativecommons.org/"> CC-BY-SA </a>, ' +
  21. 'Imagery © <a href="http://mapbox.com"> Mapbox </a>',
  22. id: 'examples.map-i875mjb7'
  23. }).addTo(map);
  24. function putDraggable() {
  25. /* create a draggable marker in the center of the map */
  26. draggableMarker = L.marker([ map.getCenter().lat, map.getCenter().lng], {draggable:true, zIndexOffset:900}).addTo(map);
  27.  
  28. /* collect Lat,Lng values */
  29. draggableMarker.on('dragend', function(e) {
  30. $("#latitudine").val(this.getLatLng().lat);
  31. $("#longitudine").val(this.getLatLng().lng);
  32. });
  33. }
  34. $( document ).ready(function() {
  35. putDraggable();
  36.  
  37. $("#edit_scoala_").change(function() {
  38. for(var i=0;i<arr.length;i++) {
  39. if(arr[i]['id'] == $("#edit_scoala_").val()) {
  40. $('#detalii').val(arr[i]['detalii']);
  41. $('#latitudine').val(arr[i]['latitudine']);
  42. $('#longitudine').val(arr[i]['longitudine']);
  43. $('#telefon').val(arr[i]['telefon']);
  44. $('#cuv_cheie').val(arr[i]['cuv_cheie']);
  45.  
  46. map.panTo([arr[i]['latitudine'], arr[i]['longitudine']]);
  47. draggableMarker.setLatLng([arr[i]['latitudine'], arr[i]['longitudine']]);
  48. break;
  49. }
  50. }
  51.  
  52. });
  53. });
  54.  
  55. });
  56.  
  57. });
  58.  
  59. var arr = JSON.parse( '<?php echo json_encode($arr) ?>' );
  60.  
  61. if (isset($msg))
  62. echo $msg;
  63. $conn= new DBConn();
  64. $arr = $conn->getScoalaList();
  65. ?>
  66. <div class= "tabel_c ">
  67. <div id="response"></div>
  68. <h1 style="color:white;text-shadow: 4px 4px 7px red;">Lista scoli</h1>
  69. <table class="table table-condensed" id="tabel-scoala">
  70. <thead>
  71. <th style="width:130px">Nume</th>
  72. <th style="width:230px">Detalii</th>
  73. <th style="width:150px">Latitudine</th>
  74. <th style="width:130px">Longitudine</th>
  75. <th style="width:230px">Nr. Telefon</th>
  76. <th style="width:150px">Cuvinte cheie</th>
  77. </thead>
  78. <?php
  79. $scoala = $db->DbGetAll("SELECT * FROM scoala");
  80. if(!$scoala){
  81. echo "<p>Nu exista scoli</p>";}
  82. else{
  83.  
  84. foreach ($scoala as $scoli)
  85. {
  86.  
  87. echo '<tr>
  88. <td>'.$scoli["nume"].'</td>
  89. <td>'.$scoli["detalii"].'</td>
  90. <td>'.$scoli["latitudine"].'</td>
  91. <td>'.$scoli["longitudine"].'</td>
  92. <td>'.$scoli["telefon"].'</td>
  93. <td>'.$scoli["cuv_cheie"].'</td>
  94.  
  95.  
  96. <!--<td ><button><img style="height:25px; width:20px "src="../images/icon.png""></button> </button> <img style="height:25px; width:20px " src="../images/delete.png""></td> -->
  97. <td><i class="fa fa-pencil edit_scoala" title="Modifica Scoala" id="edit_scoala_'.$scoli["id"].'" style="cursor: pointer;"></i>&nbsp;
  98. <i class="fa fa-remove remove_scoala" id="remove_scoala_'.$scoli["id"].'" style="cursor: pointer;" title="Sterge Scoala"></i>
  99.  
  100.  
  101.  
  102. </td>
  103. </tr>';
  104.  
  105. }
  106. }
  107. ?>
  108. </table>
  109. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement