Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1082946
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Subscribers
None
View Options
diff --git a/src/Controller/TYPYPMapController.php b/src/Controller/TYPYPMapController.php
new file mode 100644
--- /dev/null
+++ b/src/Controller/TYPYPMapController.php
@@ -0,0 +1,44 @@
+<?php
+namespace Drupal\typ_profile\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+
+class TYPYPMapController extends ControllerBase
+{
+ public function __construct()
+ {
+
+ }
+
+ public function ypmap()
+ {
+ if (isset($_GET["latitude"]) || isset($_POST["latitude"])){
+ $latitude = isset($_GET["latitude"]) ? $_GET["latitude"] : $_POST["latitude"];
+ }
+ if (isset($_GET["longitude"]) || isset($_POST["longitude"])){
+ $longitude = isset($_GET["longitude"]) ? $_GET["longitude"] : $_POST["longitude"];
+ }
+ if (isset($_GET["height"]) || isset($_POST["height"])){
+ $height = isset($_GET["height"]) ? $_GET["height"] : $_POST["height"];
+ }else{
+ $height = "430";
+ }
+ if (isset($_GET["width"]) || isset($_POST["width"])){
+ $width = isset($_GET["width"]) ? $_GET["width"] : $_POST["width"];
+ }else{$width = "500";}//$height -= 30;
+
+ $LandingPage_URL = "http://landingpage.yellowpages.co.th";
+
+ $display[] = array(
+ '#theme' => 'typ_ypmap',
+ '#latitude' => $latitude,
+ '#longitude' => $longitude,
+ '#height' => $height,
+ '#width' => $width,
+ '#bypass' => $_GET['bypass'],
+ '#LandingPage_URL' => $LandingPage_URL
+ );
+
+ return $display;
+ }
+}
\ No newline at end of file
diff --git a/templates/typ-ypmap.html.twig b/templates/typ-ypmap.html.twig
new file mode 100644
--- /dev/null
+++ b/templates/typ-ypmap.html.twig
@@ -0,0 +1,75 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
+ <title>แผนที่</title>
+
+ <!-- Google Map API -->
+ <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
+ <script>var jQuery_1_1_3 = $.noConflict(true);</script>
+
+ <script src="https://maps.googleapis.com/maps/api/js?language=th&key=AIzaSyDC0YkSE1985EKtSMMlczky7zORmSQtn6Y"></script>
+ <style type="text/css">
+ #map-canvas{
+ /*width: "<?=$height?>px"; height: "<?=$width?>"; */
+ width: "{{ width }}px";
+ height: "{{ height }}";
+ }
+ </style>
+
+ <script type="text/javascript">
+ var map;
+ // jQuery_1_1_3(".zoom", window.parent.document).hide();
+
+ function initialize(){
+ // alert("Tab Show Arealdy");
+ google.maps.event.trigger(map, 'resize');
+ var center = new google.maps.LatLng({{latitude}},{{longitude}});
+ map.setCenter(center);
+ //jQuery_1_1_3("#map-canvas").after(btt);<a target='_blank' href='https://www.google.co.th/maps/search/<?=$latitude?>,<?=$longitude?>'>Zoom</a>");
+ }
+
+ function loadMap() {
+ // alert("Load Map");
+ // alert(jQuery_1_1_3('ul#company-tab li').length);
+ jQuery_1_1_3("#mapClick").remove();
+
+ jQuery_1_1_3( "#map-canvas" ).animate(
+ {height: {{height}}}, 200, function() {
+ initialize();
+ }
+ );
+
+ var mapOptions = {
+ zoom: 15,
+ center: new google.maps.LatLng({{latitude}},{{longitude}})
+ };
+
+ map = new google.maps.Map(document.getElementById('map-canvas'),
+ mapOptions);
+
+ var marker = new google.maps.Marker({
+ position: new google.maps.LatLng({{latitude}},{{longitude}}), map: map, icon:"{{ LandingPage_URL }}/images/map_pointer.png"
+ });
+ }
+ </script>
+</head>
+
+<style type="text/css">
+ *{padding:0;margin:0;}
+</style>
+
+{% if latitude||longitude %}
+ <body {% if bypass %} onload='loadMap();' {% endif %} >
+
+ <div id="map-canvas">
+ {%if bypass %}
+ <a id="mapClick" href="#" onclick="loadMap(); return false;">
+ <img class="google_map_mobile"width="100%" src="/modules/typ/typ_profile/digital-map-610x340.jpg">
+ </a>
+ {% endif %}
+ </div>
+ </body>
+ {% endif %}
+</html>
diff --git a/typ_profile.module b/typ_profile.module
--- a/typ_profile.module
+++ b/typ_profile.module
@@ -1,52 +1,62 @@
<?php
/**
* @file
* Module file for tablesort_example.
*/
/**
* @defgroup tablesort_example Example: Tablesort
* @ingroup examples
* @{
* Example of a sortable table display.
* Three columns are sortable (Numbers, Letters and Mixture)
* We are using TableSort Extender
* extend('Drupal\Core\Database\Query\TableSortExtender')
*/
/**
* @} End of "defgroup tablesort_example".
*/
//namespace Drupal\typ\Form;
/*if (class_exists("\TYP\Legacy\Form\TYPLegacyCustomerController")) {
echo 'yes';
} else {
echo 'no';
}
exit;
*/
function typ_profile_theme() {
return array(
'typ_profile' => array(
'variables' => array(
'profile' => NULL,
'prodescription' => NULL,
'catalog' => NULL,
'type' => NULL,
'promotion' => NULL,
'breadcrumbs' => NULL,
'base_path' => NULL,
'facebook_comment' => NULL,
)
),
'typ_promotion' => array(
'variables' => array(
'url' => NULL
)
+ ),
+ 'typ_ypmap' => array(
+ 'variables' => array(
+ 'latitude' => NULL,
+ 'longitude' => NULL,
+ 'height' => NULL,
+ 'width' => NULL,
+ 'bypass' => NULL,
+ 'LandingPage_URL' => NULL
+ )
)
);
}
diff --git a/typ_profile.routing.yml b/typ_profile.routing.yml
--- a/typ_profile.routing.yml
+++ b/typ_profile.routing.yml
@@ -1,31 +1,38 @@
#typ_profile_search:
# path: '/profile/{bizid}'
# defaults:
# _controller: '\Drupal\typ_profile\Controller\TYPProfileController::profilePage'
# _title_callback: '\Drupal\typ_profile\Controller\TYPProfileController::profileTitle'
# requirements:
# _permission: 'access content'
typ_profile.page:
path: '/profile/{bizid}'
defaults:
_controller: '\Drupal\typ_profile\Controller\TYPProfileController::profilePage'
_title_callback: '\Drupal\typ_profile\Controller\TYPProfileController::profileTitle'
requirements:
_permission: 'access content'
+typ_profile.ypmap:
+ path: '/api/ypmap'
+ defaults:
+ _controller: '\Drupal\typ_profile\Controller\TYPYPMapController::ypmap'
+# _title_callback: '\Drupal\typ_profile\Controller\TYPProfileController::profileTitle'
+ requirements:
+ _permission: 'access content'
#typ_profile_promotion:
# path: '/profile/get-promotion'
# defaults:
# _controller: '\Drupal\typ_profile\Controller\TYPProfileController::getPromotion'
# _title_callback: '\Drupal\typ_profile\Controller\TYPProfileController::getTitlePromotion'
# requirements:
# _permission: 'access content'
#typ_profile_redirect:
# path: '/profile'
# defaults:
# _controller: '\Drupal\typ_profile\Controller\TYPProfileController::profileOverview'
# _title: 'Rredirect '
# requirements:
# _permission: 'access content'
\ No newline at end of file
diff --git a/yp_map.php b/yp_map.php
--- a/yp_map.php
+++ b/yp_map.php
@@ -1,114 +1,116 @@
<?php
/**
* Created by PhpStorm.
* User: OBDEV-02
* Date: 25/4/2560
* Time: 18:44
*/
if (isset($_GET["latitude"]) || isset($_POST["latitude"])){
$latitude = isset($_GET["latitude"]) ? $_GET["latitude"] : $_POST["latitude"];
}
if (isset($_GET["longitude"]) || isset($_POST["longitude"])){
$longitude = isset($_GET["longitude"]) ? $_GET["longitude"] : $_POST["longitude"];
}
if (isset($_GET["height"]) || isset($_POST["height"])){
$height = isset($_GET["height"]) ? $_GET["height"] : $_POST["height"];
}else{
$height = "430";
}
if (isset($_GET["width"]) || isset($_POST["width"])){
$width = isset($_GET["width"]) ? $_GET["width"] : $_POST["width"];
}else{$width = "500";}
//$height -= 30;
$LandingPage_URL = "http://landingpage.yellowpages.co.th";
?>
+
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<title>แผนที่</title>
- <? if ($latitude||$longitude) { ?>
+ <?php if ($latitude||$longitude) { ?>
<!-- Google Map API -->
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>var jQuery_1_1_3 = $.noConflict(true);</script>
- <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDC0YkSE1985EKtSMMlczky7zORmSQtn6Y&language=th"></script>
+ <script src="https://maps.googleapis.com/maps/api/js?language=th&key=AIzaSyDC0YkSE1985EKtSMMlczky7zORmSQtn6Y"></script>
<style type="text/css">
#map-canvas{
/*width: "<?=$height?>px";
height: "<?=$width?>"; */
width: "<?=$width?>px";
height: "<?=$height?>";
}
</style>
- <script type="text/javascript">
+ <script type="text/javascript">
var map;
// jQuery_1_1_3(".zoom", window.parent.document).hide();
function initialize(){
// alert("Tab Show Arealdy");
google.maps.event.trigger(map, 'resize');
var center = new google.maps.LatLng(<?=$latitude?>,<?=$longitude?>);
map.setCenter(center);
//jQuery_1_1_3("#map-canvas").after(btt);<a target='_blank' href='https://www.google.co.th/maps/search/<?=$latitude?>,<?=$longitude?>'>Zoom</a>");
}
function loadMap()
{
// alert("Load Map");
// alert(jQuery_1_1_3('ul#company-tab li').length);
jQuery_1_1_3("#mapClick").remove();
jQuery_1_1_3( "#map-canvas" ).animate({
height: <?=$height?>
}, 200, function() {
initialize();
});
var mapOptions = {
zoom: 15,
center: new google.maps.LatLng(<?=$latitude?>,<?=$longitude?>)
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(<?=$latitude?>,<?=$longitude?>),
map: map,
icon:"<?=$LandingPage_URL?>/images/map_pointer.png"
});
}
-
-
-
-
</script>
</head>
<style type="text/css">
*{padding:0;margin:0;}
</style>
-<body <? if ($_GET['bypass']) echo " onload='loadMap();' "; ?>
+<?php
+if ($_GET['bypass']) {
+ echo "<body onload='loadMap();'>";
+} else {
+ echo "<body>";
+}?>
<div id="map-canvas">
- <?
- if (!$_GET['bypass']) { ?>
+ <?php if (!$_GET['bypass']) { ?>
<a id="mapClick" href="#" onclick="loadMap(); return false;">
<img class="google_map_mobile"width="100%" src="/modules/typ/typ_profile/digital-map-610x340.jpg">
</a>
- <? } ?>
+ <?php } ?>
</div>
</body>
</html>
-<? } ?>
+<?php } ?>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Dec 24, 11:00 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
193692
Attached To
rPF typ_profile
Event Timeline
Log In to Comment