Advertisement
Guest User

Untitled

a guest
May 23rd, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. Uncaught InvalidValueError: initMap is not a function
  2.  
  3. <div id="map"></div>
  4. <br>
  5. <div>
  6. <table id="markers_table" class="table table-striped table-bordered" cellspacing="0" width="100%">
  7. <thead>
  8. <tr>
  9. <th>Fecha</th>
  10. <th>Vendedor</th>
  11. <th>Ubicaci&oacute;n</th>
  12. </tr>
  13. </thead>
  14. <tfoot>
  15. <tr>
  16. <th>Fecha</th>
  17. <th>Vendedor</th>
  18. <th>Ubicaci&oacute;n</th>
  19. </tfoot>
  20. <tbody>
  21.  
  22. <?php $markers = Marker::listMarkers(); ?>
  23. <?php
  24. while (list(, $valor) = each($markers)) {
  25. echo " <tr>";
  26. echo "<td>" . $valor->getFecha(). "</td>";
  27. echo "<td>" . $valor->getVendedor() . "</td>";
  28. echo "<td>" . $valor->getUbicacion() . "</td>";
  29. echo " </tr>";
  30. }
  31. ?>
  32. </tbody>
  33. </table>
  34. </div>
  35. <script type="text/javascript">
  36. function initMap() {
  37. var map = new google.maps.Map(document.getElementById('map'), {
  38. zoom: 14,
  39. center: {lat: -36.8308521, lng: -73.0582368}
  40. });
  41. <?php $markers1 = Marker::listMarkers(); ?>
  42. <?php while (list(, $valor) = each($markers1)) {
  43. echo " var marker = new google.maps.Marker({";
  44. echo "position: {lat:" . $valor->getLat() . ",lng:" . $valor->getLng() . "},";
  45. echo " title: '" . $valor->getUbicacion() . "',";
  46. echo "map: map});";
  47. }
  48. ?>
  49. }
  50. $(document).ready(function() {
  51. $.extend($.fn.dataTable.defaults, {
  52. searching: false,
  53. ordering: false
  54. });
  55. $('#markers_table').DataTable({
  56. ordering: true,
  57. paging: false,
  58. "processing": true
  59. });
  60. });
  61.  
  62. </script>
  63.  
  64. class Marker
  65. {
  66. private $fecha;
  67. private $vendedor;
  68. private $ubicacion;
  69. private $lat;
  70. private $lng;
  71.  
  72. /**
  73. * Marker constructor.
  74. */
  75. public function __construct()
  76. {
  77. }
  78.  
  79.  
  80. /**
  81. * @return array
  82. */
  83. public static function listMarkers()
  84. {
  85. $markerList = array();
  86. try {
  87. $sql = ("select FormularioVenta_fecha as Fecha,
  88. Vendedor_nombre as Vendedor,
  89. ubicacion as Ubicacion,
  90. FormularioVenta.FormularioVenta_gps as latlng
  91. from FormularioVenta
  92. left join Agricultor on FormularioVenta.Agricultor_id = Agricultor.Agricultor_id
  93. left join Vendedor on Vendedor_id=FormularioVenta.FormularioVenta_usuario");
  94. $conn = connectDB();
  95. $result = query($conn,$sql);
  96.  
  97.  
  98. while ($row = mssql_fetch_array($result)) {
  99. $marker = new Marker();
  100. $date = date_format(new DateTime($row['Fecha']), 'd-m-y');
  101. $locations = explode(',', $row['latlng']);
  102. $marker->setFecha($date);
  103. $marker->setVendedor($row['Vendedor']);
  104. $marker->setUbicacion($row['Ubicacion']);
  105. $marker->setLat(trim($locations[0]));
  106. $marker->setLng(trim($locations[1]));
  107. array_push($markerList, $marker);
  108. }
  109.  
  110. return ($markerList);
  111. } catch (Exception $e) {
  112. die(print_r(json_encode(), true));
  113. }
  114. }
  115.  
  116. /**
  117. * @return mixed
  118. */
  119. public function getFecha()
  120. {
  121. return $this->fecha;
  122. }
  123.  
  124. /**
  125. * @param mixed $fecha
  126. */
  127. public function setFecha($fecha)
  128. {
  129. $this->fecha = $fecha;
  130. }
  131.  
  132. /**
  133. * @return mixed
  134. */
  135. public function getVendedor()
  136. {
  137. return $this->vendedor;
  138. }
  139.  
  140. /**
  141. * @param mixed $vendedor
  142. */
  143. public function setVendedor($vendedor)
  144. {
  145. $this->vendedor = $vendedor;
  146. }
  147.  
  148. /**
  149. * @return mixed
  150. */
  151. public function getUbicacion()
  152. {
  153. return $this->ubicacion;
  154. }
  155.  
  156. /**
  157. * @param mixed $ubicacion
  158. */
  159. public function setUbicacion($ubicacion)
  160. {
  161. $this->ubicacion = $ubicacion;
  162. }
  163.  
  164. /**
  165. * @return mixed
  166. */
  167. public function getLat()
  168. {
  169. return $this->lat;
  170. }
  171.  
  172. /**
  173. * @param mixed $lat
  174. */
  175. public function setLat($lat)
  176. {
  177. $this->lat = $lat;
  178. }
  179.  
  180. /**
  181. * @return mixed
  182. */
  183. public function getLng()
  184. {
  185. return $this->lng;
  186. }
  187.  
  188. /**
  189. * @param mixed $lng
  190. */
  191. public function setLng($lng)
  192. {
  193. $this->lng = $lng;
  194. }
  195.  
  196.  
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement