Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1287182
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
33 KB
Subscribers
None
View Options
diff --git a/src/Controller/TYPProfileController.php b/src/Controller/TYPProfileController.php
--- a/src/Controller/TYPProfileController.php
+++ b/src/Controller/TYPProfileController.php
@@ -1,408 +1,408 @@
<?php
/**
* @file
* Contains \Drupal\page_example\Controller\TableSortExampleController.
*/
/**/
namespace Drupal\typ_profile\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Database\Query;
use Drupal\Core\Url;
use Drupal\typ_legacy\Service\TYPUtilsService;
/**
* Controller routines for tablesort example routes.
*/
class TYPProfileController extends ControllerBase
{
public function __construct(){
\Drupal::service('page_cache_kill_switch')->trigger();
}
public function formatWorkingHour($s) {
foreach( explode(",", $s) as $p) {
$ps[] = $p;
}
return implode(", ", $ps);
}
protected $data;
protected static function insertVisit($bizid, $customerid){
// DO NOT DO THIS! THIS IS NOT PROPER PLACE.. AND TOO BIG DATA!
// VORAPOAP 1/10/2558
/*db_set_active("typ_data");
$data['businessid'] = trim($bizid);
$data['customerid'] = trim($customerid);
$data['goodsid'] = "";
db_insert('last_visit_product')->fields($data)->execute();
db_set_active();*/
}
public function checkLPRedirect($options = array()){
$data = \Drupal::service('typ.api')->getLandingpage($options);
$customer = array();
if($data){
$info = $data['_info'];
$res = $data['_res'];
$sub = $res['subdomains'][$info['headingcode']];
$datenow = date('Y-m-d');
$status = 0;
if($datenow <= date('Y-m-d', strtotime($sub['enddate']))){
if($datenow >= date('Y-m-d', strtotime($sub['startdate'])) && $datenow <= date('Y-m-d', strtotime($sub['enddate']))){
$status = 1;
}else{
$status = 2;
}
}
$lp = $res['landingpages'][$info['headingcode']];
if(intval($lp['hide']) == '1' || intval($lp['accounting_status']) == 1){
$status = 0;
}
$customer['busid'] = $info['customerid'].$info['headingcode'].$lp['addressid'];
$customer['custid'] = $info['customerid'];
$customer['subdomain'] = $sub['subdomain'];
$customer['headingcode'] = $info['headingcode'];
$customer['URL'] = $sub['url'];
$customer['title'] = $sub['title'];
$customer['keyword'] = $sub['keyword'];
$customer['desc'] = $sub['desc'];
$customer['theme'] = $lp['theme'];
$customer['siteid'] = $sub['siteclick'];
$customer['status'] = $status;
}
return $customer;
}
public function profileTitle($bizid) {
$this->data = \Drupal::service("typ.search")->getProfile($bizid ,AUTO);
if (!$this->data) return '';
else return $this->data['humanname'];
}
public function profilePage($bizid){
// $bizid filler
$input = str_replace(".html","",$bizid);
$input = explode("_", $input);
- $input = end($input);
- list($bizid , $addressId) = explode('-', $input);
+ $bizid = end($input);
+ //list($bizid , $addressId) = explode('-', $input);
//
$this->data = \Drupal::service("typ.search")->getProfile($bizid ,AUTO);
$result = \Drupal::service('typ.unvservice')->loadListing($this->data['customerid']);
$address_id = "";
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();
if(isset($_COOKIE['breadcrumbs'])) {
$breadcrumbs_data = $_COOKIE['breadcrumbs'];
$breadcrumbs_ex= explode(",", $breadcrumbs_data);
$breadcrumbs[$breadcrumbs_ex[0]] = $breadcrumbs_ex[0];
$breadcrumbs['data'] = $breadcrumbs_ex[1];
$breadcrumbs['businessid'] = $breadcrumbs_ex[2];
}
$data = $this->data;
if (!$data) {
throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();
}
if(!empty($data['redirect'])){
$lp = $data['redirect'];
if(strpos($data['redirect'], 'http://') === false){
$lp = 'http://'.$data['redirect'];
}
$chk_lp = array();
if($lp){
$redirect = str_replace(array("http://", "/"), "", $lp);
if(strpos($redirect, \Drupal\typ_legacy\Service\TYP::config('typ.subdomain')) !== false){
//Subdomain
$options['type'] = 'subdomain';
$exp = explode(".", $redirect);
$options['SUBDOMAIN'] = current($exp);
}else{
//Domian
$options['type'] = 'domain';
$options['DOMAIN'] = $redirect;
}
$chk_lp = $this->checkLPRedirect($options);
}
if($chk_lp['status'] == '1'){
header('Location: '.$lp);
exit();
}
}else{
if(!empty($data['landingpage']) && !empty($data['subdomain'])){
$options['customerid'] = $data['customerid'];
$options['headingcode'] = $data['headingcode'];
$onserv = \Drupal::service('typ.subdomain')->getOnServiceSubdomain($options, true);
if($onserv[0] == true){
$lp = $data['landingpage'];
if(strpos($data['landingpage'], 'http://') === false){
$lp = 'http://'.$data['landingpage'];
}
if(!empty($lp)){
header('Location: '.$lp);
exit();
}
}
}
}
if($this->data['onlinepromotion']){
$promotiond_mongo = \Drupal::service("typ.profile")->_getpromotion($bizid);
$promo = iterator_to_array($promotiond_mongo);
$proid = array();
foreach ($promo as $key => $value) {
foreach ($value as $k => $val) {
if($k == 'th'){
$proid['promotion'] += $val;
}if($k == 'en'){
$proid['promotion'] += $val;
}else{
$proid['promotion'][$k] = $val;
}
}
}
// echo "<PRE>";print_r($proid);exit;
$result['address'][$data['headingcode']][$data['addressid']]['promotion'] = $proid['promotion'];
// echo "<PRE>";print_r($result);exit;
}
$address_id = $data['addressid'];
$type = $this->data['customertype'];
if($this->data['accounting_status'] == '1' || $this->data['hide'] == '1'){ // Check Disable Packet and Hide content
$result['customertype'] = 'FL';
$type = 'FL';
}
if( $type== 'FL' || $this->data['customertype'] == ''){
$type = 'FL';
}else{
$result_olc = \Drupal::service('typ.catalog')->getPreparedCatalogItemSet($data['customerid']);
}
if($language == 'en'){
$base_path = '/en/';
}else{
$base_path = '/';
}
/*Prepare Headings*/
if(!empty($data['headings'])){
$lang = $language[0];
$headings = array();
foreach ($data['headings'] as $value) {
$item = array();
$item['headingcode'] = $value['headingcode'];
$item['headingname'] = $value['headingname'.$lang];
$item['subgroupcode'] = $value['subgroupcode'];
$item['subgroupname'] = $value['subgroupname'.$lang];
$item['groupcode'] = $value['groupcode'];
$item['groupname'] = $value['groupname'.$lang];
$headings[$item['headingname']] = $item;
}
$data['headings'] = array_values($headings);
}
if($_GET['debug']){
echo "<pre>";
echo "<br>Service:<b style='color:red;'><u>";if($this->data['accounting_status'] == '1'){ echo "Don't have a Service";}else{ echo "Service"; } echo "</u></b>";
echo "<br>Hide:<b style='color:red;'><u>";if($this->data['hide'] == '1'){ echo "Hide"; }else{ echo "Don't Hide"; } echo "</u></b>";
echo "<br>Type:<b style='color:red;'><u>".$type."</u></b><br><br>";
var_export($this->data);
exit;
}
if($type == 'FL'){
$data['profile'] = strip_tags($data['profile']);
$data['proddesc'] = strip_tags($data['proddesc']);
}
$pos = strpos(html_entity_decode($data['proddesc']),"<p>");
if($pos !== false && $data['proddesc']){
$tempdesc = substr(html_entity_decode($data['proddesc']),3);
}else{
$tempdesc = html_entity_decode(html_entity_decode($data['proddesc'])) ;
//$tempdesc = $data['proddesc'];
}
if(strlen($tempdesc) != 0) {
//$temp = '<p style="color:#333;">';
$tempdesc = $temp . $tempdesc;
}
if($type == "FL") {
$dataproddesct = iconv_substr($tempdesc,0,150,"UTF-8");
if(strlen($dataproddesct) > 150){
$dataproddesct .= '...';
}
}else{
$dataproddesct = $tempdesc;
}
//$dataproddesct = str_replace("<p>","<p style='color:#333;'>",$dataproddesct);
if($type != "FL" && !empty($result_olc)){
$olcdata = $result_olc[0];
}
if(!empty($dataproddesct)){
$data['proddesc'] = $dataproddesct;
}
if (!empty($data['telno'])) {
foreach ($data['telno'] as $t) {
$data['_format']['telno'][] = TYPUtilsService::formatPhoneNumber($t);
}
}
if (!empty($data['fax'])) {
foreach ($data['fax'] as $t) {
$data['_format']['fax'][] = TYPUtilsService::formatPhoneNumber($t);
}
}
if(!empty($data['website'])){
$data['website_show'] = $data['website'];
//$data['website'] = explode(",",$data['website']);
$item = array();
if(!empty($data['website'])){
foreach($data['website'] as $key => $new){
if(strpos($new, 'http://') === FALSE && strpos($new, 'https://') === FALSE){
$item['http://'.$new] = $new;
}else{
$item[$new] = $new;
}
}
$data['website'] = $item;
}
}
/*$thai_month_arr = array('01'=>'ม.ค.','02'=>'ก.พ.','03'=>'มี.ค.','04'=>'เม.ย.','05'=>'พ.ค.','06'=>'มิ.ย.','07'=>'ก.ค.','08'=>'ส.ค.','09'=>'ก.ย.','10'=>'ต.ค.','11'=>'พ.ย.','12'=>'ธ.ค.');
list($year, $month,$day) = explode('-', $result['address'][$data['headingcode']][$data['addressid']]['promotion']['enddate']);
$date_e = $day." ".$thai_month_arr[$month]." ".($year+543);
$end_date_promotion = $result['address'][$data['headingcode']][$data['addressid']]['promotion']['enddate'];
list($year, $month,$day) = explode('-', $result['address'][$data['headingcode']][$data['addressid']]['promotion']['startdate']);
$date_s = $day." ".$thai_month_arr[$month]." ".($year+543);
$result['address'][$data['headingcode']][$data['addressid']]['promotion']['startdate'] = $date_s;
$result['address'][$data['headingcode']][$data['addressid']]['promotion']['enddate'] = $date_e;
$result['address'][$data['headingcode']][$data['addressid']]['promotion']['subject'] = preg_replace('/<p[^>]*?>/','',html_entity_decode($result['address'][$data['headingcode']][$data['addressid']]['promotion']['subject']));*/
/*if(date("Y-m-d") > $end_date_promotion){
$promotion_data = '';
}else{
$promotion_data = $result['address'][$data['headingcode']][$data['addressid']]['promotion'];
}*/
if(!empty($data['profile'])){
$data['profile'] = preg_replace('/<p[^>]*?>/','',html_entity_decode($data['profile']));
}
if (!empty($data['workinghours'])) {
$data['_format']['workinghours'] = $this->formatWorkingHour($data['workinghours']);
$data['customertyp'] = $data['customertype'];
}
if(!empty($data['cityname'])){
$bangkok = array('กรุงเทพ','กรุงเทพฯ','ก.ท.ม.','กรุงเทพมหานคร','กทม','จังหวัดกรุงเทพมหานคร','จังหวัด กรุงเทพมหานคร');
if(!in_array($data['cityname'],$bangkok) && strpos($data['cityname'], "จังหวัด") === false){
$data['cityname'] = t('Province') .' '. $data['cityname'];
}
}
/*Logo*/
if(!empty($data['logof'])){
$data['logo'] = \Drupal::service('typ.search')->_detectImage('logo', $data['logof']);
}
/*Picture*/
if(!empty($data['pictures']['files'])){
$data['pictures'] = \Drupal::service('typ.search')->createImageThumbnail($data, 'large');
}else{
unset($data['pictures']);
}
/*if(!empty($promotion_data['promoimg']) && @file_exists('http://promotion.yellowpages.co.th/media/promotion/'.$promotion_data['promoimg'])){ // images from Old system
$promotion_data['baseurl'] = 'http://promotion.yellowpages.co.th/media/promotion/';
}else{
$promotion_data['baseurl'] = 'http://media.yellowpages.co.th/yellowpages/promotion/';
}
*/
if(empty($data['printads']) && ($data['printadstf'] || $data['printadsef'])){
if($data['lang'] == 'th'){
$exp = explode('.', $data['printadstf']);
}else{
$exp = explode('.', $data['printadsef']);
}
if($exp){
$data['printads'] = $exp[0];
}
}
$link_url = "$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$check_lang = explode("/", $link_url);
if($check_lang[1] == 'en'){
$link_url = str_replace("/en/", "/", $link_url);
}
/*echo "<pre>";
var_export($data); exit();*/
$display[] = array(
'#theme' => 'typ_profile',
'#profile' => $data,
'#prodescription' => $dataproddesct,
'#catalog' => $olcdata,
'#type' => $type,
'#promotion' => $promotion_data,
'#breadcrumbs' => $breadcrumbs,
'#base_path' => $base_path,
'#facebook_comment' => $link_url,
);
if ($type != 'FL')
$display['#attached']['drupalSettings']['disableAds'] = TRUE;
$display['#attached']['library'] = array(
'typ_profile/profile.popup',
'typ_contrib/colorbox',
);
if($type == 'FL'){
$display['#attached']['library'] = array(
'typ_profile/profile.popup',
'typ_contrib/colorbox',
'typ_ads/ads_unit'
);
$display[] = array(
'#markup' => format_string('<div class="container-fuild" id="corner-slider"></div>',array())
);
}else{
$display['#attached']['library'] = array(
'typ_profile/profile.popup',
'typ_contrib/colorbox',
);
}
return $display;
}
public function getTitlePromotion(){
return t('How to get promotion');
}
public function getPromotion(){
$mobileDetector = \Drupal::service('krs.mobile_detect');
if($mobileDetector->isAndroidOS() == 1 ){
header('Location: https://play.google.com/store/apps/details?id=com.initialive.yellowpages.act&hl=th');
exit;
}if($mobileDetector->isIOS() == 1){
header('Location: https://itunes.apple.com/th/app/thailand-yellowpages/id387848017?mt=8');
exit;
}else{
header('Location: http://m.yellowpages.co.th/mobile/typliveplus/user/');
exit;
}
$display[] = array(
'#theme' => 'typ_promotion',
);
$display['#attached']['library'] = array(
'typ_profile/profile.popup',
);
return $display;
}
}
diff --git a/templates/typ-profile.html.twig b/templates/typ-profile.html.twig
--- a/templates/typ-profile.html.twig
+++ b/templates/typ-profile.html.twig
@@ -1,229 +1,229 @@
{% set base_images = 'http://media.yellowpages.co.th/yellowpages' %}
{% set base_promotion = promotion.baseurl %}
<div class="margin-tb-fifteen padding-lr-thity typ-profile-freelist col-md-12 col-sm-12 col-xs-12 ">
<div class="no-gutter col-md-12 col-sm-12 col-xs-12">
{% if profile.logo %}
<div class="typ-medium-img col-md-3 col-sm-3 col-xs-12"> {#logo#}
<img class="img-responsive" src="{{ profile.logo }}"/>
</div>
{% else %}
<div class="typ-medium-img col-md-3 col-sm-3 col-xs-12">
<img class="img-responsive" src="{{ '/themes/contrib/typtheme/images/logo/typ-map-default.jpg' }}"/>
</div> {#end logo#}
{% endif %}
<div class="col-md-7 col-sm-7 col-xs-6">
<h1>{{ profile.humanname|raw }}</h1>
{% if profile.districtname or profile.cityname %}
{{ [profile.districtname,profile.cityname]|join(' ') }}
{% endif %}
{% if profile.headings %}
<p class="typ-txt-bold">
{% trans %}Category{% endtrans %} :
{% for key, heading in profile.headings %}
{% if loop.last %}
<a href="{{ base_path }}heading/{{ heading.headingname }}">{{ heading.headingname|raw }}</a>
{% else %}
<a href="{{ base_path }}heading/{{ heading.headingname }}">{{ heading.headingname|raw }}</a>,
{% endif %}
{% endfor %}
</p>
{% endif %}
</div>
<div class="col-md-2 col-sm-2 col-xs-6">
<p>{% trans %} Views {% endtrans %} : xxxxx </p>
</div>
</div>
{#description#}
<div class="margin-top-thirty col-md-12 col-sm-12 col-xs-12 typ-profile-freelist-desc">
{% if profile.profile %}
<p>{{ profile.profile|raw }}</p>
{% endif %}
{% if profile.proddesc %}
<strong>{% trans %} Product And Service {% endtrans %}</strong>
<p>{{ profile.proddesc|raw }}</p>
{% endif %}
{% if profile.brandname %}
<strong>{% trans %}Brand Name{% endtrans %}</strong>
<p>{{ profile.brandname|replace({"<p>":" ","</p>":" "}) }}</p>
{% endif %}
</div> {#end description#}
{#picture#}
{% if profile.pictures %}
<div class="typ-profile-img margin-top-thirty col-md-12 col-sm-12 col-xs-12">
<ul class="no-gutter">
{% for key, picture in profile.pictures %}
<li>
<img src="{{ picture.file }}" alt="" />
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{#end picture#}
{#contact#}
<div class="typ-address-content margin-top-thirty col-md-12 col-sm-12 col-xs-12">
<h1>{% trans %} Contact Information {% endtrans %}</h1>
{#Business Name.#}
{% if profile.humanname %}
<div class="typ-address-detail col-md-12 col-sm-12 col-xs-12">
<div class="col-md-3 col-sm-3 col-xs-12">
<p class="typ-txt-bold">{% trans %} Business Name {% endtrans %}:</p>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
{{ profile.humanname }}
</div>
</div>
{% endif %}
{#address#}
<div class="typ-address-detail col-md-12 col-sm-12 col-xs-12">
<div class="col-md-3 col-sm-3 col-xs-12">
<p class="typ-txt-bold">{% trans %} Address {% endtrans %}:</p>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
{{ [profile.addr,profile.soi,profile.road,profile.subdistrictname,profile.districtname,profile.cityname,profile.postcode]|join(' ') }}
</div>
</div>
{#tel.#}
{% if profile.telno %}
<div class="typ-address-detail col-md-12 col-sm-12 col-xs-12">
<div class="col-md-3 col-sm-3 col-xs-12">
<p class="typ-txt-bold">{% trans %} Tel {% endtrans %}:</p>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
{% if profile.telno %}
{% for key, tel in profile._format.telno %}
{% if loop.last %}
<a href='tel:{{ tel }}'>{{ tel }}</a>
{% else %}
<a href='tel:{{ tel }}'>{{ tel }}</a>,
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
{#fax#}
{% if profile.fax %}
<div class="typ-address-detail col-md-12 col-sm-12 col-xs-12">
<div class="col-md-3 col-sm-3 col-xs-12">
<p class="typ-txt-bold">{% trans %} Fax {% endtrans %}:</p>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
{% if profile.fax %}
{% for key, fax in profile._format.fax %}
{% if loop.last %}
<a href="tel:{{ fax }}">{{ fax }}</a>
{% else %}
<a href="tel:{{ fax }}">{{ fax }}</a>,
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
{#e-mail#}
{% if profile.email %}
<div class="typ-address-detail col-md-12 col-sm-12 col-xs-12">
<div class="col-md-3 col-sm-3 col-xs-12">
<p class="typ-txt-bold">{% trans %} Email {% endtrans %}:</p>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
{% if profile.email %}
{% for key , mail in profile.email %}
{% if loop.last %}
<a href="mailto:{{ mail }}">{{ mail }}</a>
{% else %}
<a href="mailto:{{ mail }}">{{ mail }}</a>,
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
{#website#}
{% if profile.website %}
<div class="typ-address-detail col-md-12 col-sm-12 col-xs-12">
<div class="col-md-3 col-sm-3 col-xs-12">
<p class="typ-txt-bold">{% trans %} Website {% endtrans %}:</p>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
{% if profile.website %}
{% for key , web in profile.website %}
{% if loop.last %}
<a href="{{key|trim }}" target="_blank">{{web}}</a>
{% else %}
<a href="{{key|trim}}" target="_blank">{{web}}</a>,
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
{#work-time#}
{% if profile.workinghours %}
<div class="typ-address-detail col-md-12 col-sm-12 col-xs-12">
<div class="col-md-3 col-sm-3 col-xs-12">
<p class="typ-txt-bold">{% trans %} Work-Time {% endtrans %}:</p>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
{% if not profile.workinghours %}
{% else %}
{{ profile._format.workinghours }}
{% endif %}
</div>
</div>
{% endif %}
</div> {#end contact#}
{#Map#}
{% if profile.location.lat and profile.location.lon %}
<div class="margin-top-thirty col-md-12 col-sm-12 col-xs-12">
<div class="google-map-size">
- <iframe width="100%" scrolling="no" frameborder="0" src="http://landingpage.yellowpages.co.th/yp_map.php?latitude={{ profile.location.lat }}&longitude={{ profile.location.lon }}&height=420&width=445" allowtransparency="true" marginwidth="0" marginheight="0"></iframe>
+ <iframe width="100%" scrolling="no" frameborder="0" src="/modules/typ/typ_profile/yp_map.php?latitude={{ profile.location.lat }}&longitude={{ profile.location.lon }}&height=420&width=445" allowtransparency="true" marginwidth="0" marginheight="0"></iframe>
<div class="text-center">
- <a class="iframe btn btn-md typ-link-btn" href="http://landingpage.yellowpages.co.th/yp_map.php?bypass=1&latitude={{ profile.location.lat }}&longitude={{ profile.location.lon }}&iframe=true&width=800&height=580">{% trans %}View list on search by map {% endtrans %}</a>
+ <a class="iframe btn btn-md typ-link-btn" href="/modules/typ/typ_profile/yp_map.php?bypass=1&latitude={{ profile.location.lat }}&longitude={{ profile.location.lon }}&iframe=true&width=800&height=580">{% trans %}View list on search by map {% endtrans %}</a>
<a class="btn btn-md typ-link-btn" target="_blank" href="http://maps.google.com/maps?z=10&t=m&q=loc:{{ profile.location.lat }},{{ profile.location.lon }}">{% trans %} Navigation {% endtrans %}</a>
</div>
</div>
</div>
{% endif %}
{#end Map#}
<div class="margin-top-thirty col-md-12 col-sm-12 col-xs-12">
<h3>{% trans %} Comment {% endtrans %}</h3>
<hr/>
</div>
{#facebook#}
<div class="col-md-12 col-sm-12 col-xs-12">
{{ app.request.getRequestUri() }}
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=986936604724797";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-width="100%" data-href="http://{{ facebook_comment }}" data-numposts="5"></div>
</div> {#end facebook#}
</div> {#end typ profile freelist#}
<input type="hidden" class="catname" value="{{ profile.headingname|raw }}">
<input type="hidden" class="lang" value="{{ profile.lang|raw }}">
<input type="hidden" class="cat_address" value="{{ [profile.subdistrictname,profile.districtname,profile.cityname,profile.postcode]|join(' ') }}">
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,31 @@
-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_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: '/biz/{bizid}'
+ 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_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
new file mode 100644
--- /dev/null
+++ b/yp_map.php
@@ -0,0 +1,114 @@
+<?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) { ?>
+
+ <!-- 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>
+ <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>
+<body <? if ($_GET['bypass']) echo " onload='loadMap();' "; ?>
+<div id="map-canvas">
+ <?
+ 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>
+ <? } ?>
+</div>
+</body>
+</html>
+<? } ?>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jul 5, 8:17 AM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
226910
Attached To
rPF typ_profile
Event Timeline
Log In to Comment