l; 46
+    // this.data = post;
32 47
     let id = this.route.snapshot.paramMap.get('id') || this.id;
33 48
     console.log("fetching ...");
34 49
     this.wpservice.getPlaceDetail(id).subscribe((data) => {
35
-      this.placelist = data;      
50
+      this.placelist = data;
51
+      this.latdynamic = data['acf']['gmap']['lat'];
52
+      this.londynamic = data['acf']['gmap']['lng'];
36 53
       console.log("load Place Detail ...");
54
+      console.log(this.latdynamic);
55
+      console.log("load Lati ...");
56
+      console.log(this.londynamic);
57
+      console.log("load Lon ...");
37 58
       console.log(data);
38 59
     }, error => {
39 60
       console.log("errror ", error);
40 61
     });
41 62
   }
42 63
 
64
+  loadMap() {
65
+    this.geolocation.getCurrentPosition().then((resp) => {
66
+
67
+      this.latitude = resp.coords.latitude;
68
+      this.longitude = resp.coords.longitude;
69
+      // this.latdynamic = resp.coords.latitude;
70
+      // this.londynamic = resp.coords.longitude;
71
+
72
+      let latLng = new google.maps.LatLng(resp.coords.latitude, resp.coords.longitude);
73
+      let mapOptions = {
74
+        center: latLng,
75
+        zoom: 15,
76
+        mapTypeId: google.maps.MapTypeId.ROADMAP
77
+      }
78
+
79
+      this.getAddressFromCoords(resp.coords.latitude, resp.coords.longitude);
80
+
81
+      this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
82
+
83
+      this.map.addListener('dragend', () => {
84
+
85
+        this.latitude = this.map.center.lat();
86
+        this.longitude = this.map.center.lng();
87
+
88
+        this.getAddressFromCoords(this.map.center.lat(), this.map.center.lng())
89
+      });
90
+
91
+    }).catch((error) => {
92
+      console.log('Error getting location', error);
93
+    });
94
+  }
95
+
96
+  getAddressFromCoords(lattitude, longitude) {
97
+    console.log("getAddressFromCoords " + lattitude + " " + longitude);
98
+    let options: NativeGeocoderOptions = {
99
+      useLocale: true,
100
+      maxResults: 5
101
+    };
102
+
103
+    this.nativeGeocoder.reverseGeocode(lattitude, longitude, options)
104
+      .then((result: NativeGeocoderResult[]) => {
105
+        this.address = "";
106
+        let responseAddress = [];
107
+        for (let [key, value] of Object.entries(result[0])) {
108
+          if (value.length > 0)
109
+            responseAddress.push(value);
110
+
111
+        }
112
+        responseAddress.reverse();
113
+        for (let value of responseAddress) {
114
+          this.address += value + ", ";
115
+        }
116
+        this.address = this.address.slice(0, -2);
117
+      })
118
+      .catch((error: any) => {
119
+        this.address = "Address Not Available!";
120
+      });
121
+
122
+  }
123
+
124
+  // getAddressFromCoords2(lattitude, longitude) {
125
+  //   console.log("getAddressFromCoords2 " + lattitude + " " + longitude);
126
+  //   let options: NativeGeocoderOptions = {
127
+  //     useLocale: true,
128
+  //     maxResults: 5
129
+  //   };
130
+  // }
131
+
132
+  // getGeoencoder(latitude, longitude) {
133
+  //   this.nativeGeocoder.reverseGeocode(latitude, longitude, this.geoencoderOptions)
134
+  //     .then((result: NativeGeocoderResult[]) => {
135
+  //       this.address = this.generateAddress(result[0]);
136
+  //     })
137
+  //     .catch((error: any) => {
138
+  //       alert('Error getting location' + JSON.stringify(error));
139
+  //     });
140
+  // }
43 141
 }

+ 8 - 1
src/app/province/province.page.html

@@ -16,6 +16,13 @@
16 16
           <div class="txt-place-title">Province Name</div>
17 17
         </ion-col>
18 18
       </ion-row>
19
+      <ion-row>
20
+        <ion-col>
21
+          <ion-toolbar class="search">
22
+            <ion-searchbar placeholder="ค้นหา"></ion-searchbar>
23
+          </ion-toolbar>
24
+        </ion-col>
25
+      </ion-row>
19 26
       <ion-card *ngFor="let provlist of provicelist">
20 27
         <div *ngIf="$any(provlist).better_featured_image != null">
21 28
           <img src="{{$any(provlist).better_featured_image.source_url}}" alt="">
@@ -24,7 +31,7 @@
24 31
           <img src="/assets/images/temp.png" />
25 32
         </div>
26 33
         <ion-card-header>
27
-          <a [routerLink]="['/tabs/place/', pldata.id]"><ion-card-title [innerHTML]="provlist.title.rendered"></ion-card-title></a>
34
+          <a [routerLink]="['/tabs/place/', provlist.id]"><ion-card-title [innerHTML]="provlist.title.rendered"></ion-card-title></a>
28 35
         </ion-card-header>
29 36
       </ion-card>
30 37
     </ion-grid>

+ 1 - 18
src/app/province/province.page.scss

@@ -1,21 +1,4 @@
1
-// .bg {
2
-//   position: absolute;
3
-//   left: 0px;
4
-//   top: 0px;
5
-//   width: 100vw;
6
-//   height: 100vh;
7
-//   .holidaycard {
8
-//     position: absolute;
9
-//     left: 0px;
10
-//     bottom: 0px;
11
-//     min-height: 60%;
12
-//     width: 100%;
13
-//     padding: 10px;
14
-//     border-radius: 25px;
15
-//     background: white;
16
-//     --background: white;
17
-//   }
18
-// }
1
+
19 2
 .holidaycard {
20 3
   position: absolute;
21 4
   left: 0px;

+ 8 - 0
src/app/tabs/tabs-routing.module.ts

@@ -61,6 +61,14 @@ const routes: Routes = [
61 61
         loadChildren: () => import('../province/province.module').then(m => m.ProvincePageModule)
62 62
       },
63 63
       {
64
+        path: 'gmap',
65
+        loadChildren: () => import('../gmap/gmap.module').then(m => m.GmapPageModule)
66
+      },
67
+      {
68
+        path: 'nearme',
69
+        loadChildren: () => import('../nearme/nearme.module').then( m => m.NearmePageModule)
70
+      },
71
+      {
64 72
         path: '',
65 73
         redirectTo: '/tabs/home',
66 74
         pathMatch: 'full'

+ 5 - 3
src/app/tabs/tabs.page copy.html

@@ -1,8 +1,10 @@
1 1
 <ion-tabs>
2 2
   <ion-fab vertical="bottom" horizontal="center" slot="fixed">
3
-    <ion-fab-button>
4
-      <ion-icon name="add-outline"></ion-icon>
5
-    </ion-fab-button>
3
+    
4
+      <ion-fab-button [routerLink]="['/tabs/nearme/']">
5
+        <ion-icon name="add-outline"></ion-icon>
6
+      </ion-fab-button>
7
+    
6 8
   </ion-fab>
7 9
 
8 10
   <ion-tab-bar slot="bottom">

+ 5 - 6
src/app/tabs/tabs.page.html

@@ -1,17 +1,16 @@
1 1
 <ion-tabs>
2
-  <!-- <ion-fab vertical="bottom" horizontal="center" slot="fixed">
3
-    <ion-fab-button>
4
-      <ion-icon name="add-outline"></ion-icon>
2
+  <ion-fab vertical="bottom" horizontal="center" translucent="true">
3
+    <ion-fab-button routerLink="nearme" routerDirection="forward">
4
+    <ion-icon name="navigate"></ion-icon>
5 5
     </ion-fab-button>
6
-  </ion-fab> -->
7
-
6
+  </ion-fab>
8 7
   <ion-tab-bar slot="bottom">
9 8
     <ion-tab-button tab="home">
10 9
       <ion-icon name="home"></ion-icon>
11 10
       <ion-label>หน้าแรก</ion-label>
12 11
     </ion-tab-button>
13 12
 
14
-    <ion-tab-button tab="tab2">
13
+    <ion-tab-button tab="nearme">
15 14
       <ion-icon name="location"></ion-icon>
16 15
       <ion-label>ใกล้ฉัน</ion-label>
17 16
     </ion-tab-button>

+ 7 - 0
src/app/wp-service.service.ts

@@ -22,6 +22,13 @@ export class WpServiceService {
22 22
     );
23 23
   }
24 24
 
25
+  getNear() {
26
+    return this.http.get(
27
+      "/assets/json/place.json"
28
+      // "http://tamtime.iamarray.xyz/wp-json/wp/v2/place?_embed"
29
+    );
30
+  }
31
+
25 32
   getPlaceDetail(id) {
26 33
     return this.http.get(
27 34
       "http://tamtime.iamarray.xyz/wp-json/wp/v2/place/"+id+"/?_embed"

BIN
src/assets/icon/location-marker.png


+ 5 - 1
src/global.scss

@@ -164,4 +164,8 @@ a {
164 164
  
165 165
 // ion-content {
166 166
 //   --background: url(/assets/images/wnr-bg.jpg) no-repeat center/cover fixed;
167
-// }
167
+// }
168
+.ios ion-fab-button {
169
+  position:absolute;
170
+  bottom: 25px;
171
+}

+ 2 - 0
src/index.html

@@ -17,6 +17,8 @@
17 17
   <!-- add to homescreen for ios -->
18 18
   <meta name="apple-mobile-web-app-capable" content="yes" />
19 19
   <meta name="apple-mobile-web-app-status-bar-style" content="black" />
20
+
21
+  <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDHSbJHYItlRqJeZ737ju4weBHlarJIPGE"></script>
20 22
 </head>
21 23
 
22 24
 <body>

tum/whitesports - Gogs: Simplico Git Service

Bez popisu

publicize.php 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
  2. /**
  3. * Module Name: Publicize
  4. * Module Description: Publicize makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.
  5. * Sort Order: 10
  6. * Recommendation Order: 7
  7. * First Introduced: 2.0
  8. * Requires Connection: Yes
  9. * Requires User Connection: Yes
  10. * Auto Activate: No
  11. * Module Tags: Social, Recommended
  12. * Feature: Engagement
  13. * Additional Search Queries: facebook, jetpack publicize, twitter, tumblr, linkedin, social, tweet, connections, sharing, social media, automated, automated sharing, auto publish, auto tweet and like, auto tweet, facebook auto post, facebook posting
  14. *
  15. * @package automattic/jetpack
  16. */
  17. /**
  18. * Class Jetpack_Publicize
  19. */
  20. class Jetpack_Publicize {
  21. /**
  22. * If Publicize is executing within Jetpack.
  23. *
  24. * @var bool
  25. */
  26. public $in_jetpack = true;
  27. /**
  28. * Jetpack_Publicize constructor.
  29. */
  30. public function __construct() {
  31. global $publicize_ui;
  32. $this->in_jetpack = ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'enable_module_configurable' ) ) ? true : false;
  33. if ( $this->in_jetpack ) {
  34. Jetpack::enable_module_configurable( __FILE__ );
  35. }
  36. require_once __DIR__ . '/publicize/publicize.php';
  37. if ( $this->in_jetpack ) {
  38. require_once __DIR__ . '/publicize/publicize-jetpack.php';
  39. } else {
  40. require_once dirname( __DIR__ ) . '/mu-plugins/keyring/keyring.php';
  41. require_once __DIR__ . '/publicize/publicize-wpcom.php';
  42. }
  43. require_once __DIR__ . '/publicize/ui.php';
  44. $publicize_ui = new Publicize_UI();
  45. $publicize_ui->in_jetpack = $this->in_jetpack;
  46. // Jetpack specific checks / hooks.
  47. if ( $this->in_jetpack ) {
  48. // if sharedaddy isn't active, the sharing menu hasn't been added yet.
  49. $active = Jetpack::get_active_modules();
  50. if ( in_array( 'publicize', $active, true ) && ! in_array( 'sharedaddy', $active, true ) ) {
  51. add_action( 'admin_menu', array( &$publicize_ui, 'sharing_menu' ) );
  52. }
  53. /*
  54. * The Publicize Options array does not currently have UI since it is being added
  55. * for a specific purpose and not part of a broader Publicize sprint.
  56. *
  57. * In order to pass the settings up to WordPress.com, we are updating an option to Sync will pass it up.
  58. * To make it relatively easy for use, we are creating a filter that checks if the option and filter match.
  59. *
  60. * This only runs when a post is saved to avoid it running too much.
  61. */
  62. add_action(
  63. 'save_post',
  64. function () {
  65. $publicize_options = get_option( 'jetpack_publicize_options', array() );
  66. /**
  67. * Filters the options for Publicize.
  68. *
  69. * As of Jetpack 8.5, the array keys could be:
  70. * attach_media bool If Publicize should send the image to the social media platform. Default false.
  71. *
  72. * @module publicize
  73. *
  74. * @since 8.5.0
  75. *
  76. * @param array $options Array of Publicize options.
  77. */
  78. $filtered = (array) apply_filters( 'jetpack_publicize_options', $publicize_options );
  79. if ( $publicize_options !== $filtered ) {
  80. update_option( 'jetpack_publicize_options', $filtered, false );
  81. }
  82. }
  83. );
  84. }
  85. }
  86. }
  87. new Jetpack_Publicize();
  88. if ( ! ( defined( 'IS_WPCOM' ) && IS_WPCOM ) && ! function_exists( 'publicize_init' ) ) {
  89. /**
  90. * Helper for grabbing a Publicize object from the "front-end" (non-admin) of
  91. * a site. Normally Publicize is only loaded in wp-admin, so there's a little
  92. * set up that you might need to do if you want to use it on the front end.
  93. * Just call this function and it returns a Publicize object.
  94. *
  95. * @return Publicize Object
  96. */
  97. function publicize_init() {
  98. global $publicize;
  99. if ( ! class_exists( 'Publicize' ) ) {
  100. require_once __DIR__ . '/publicize/publicize.php';
  101. }
  102. return $publicize;
  103. }
  104. }