Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1198031
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
26 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,41 +1,82 @@
<?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;
/**
* Controller routines for tablesort example routes.
*/
class TYPProfileController extends ControllerBase
{
/*public function profile_redirect(){
return $this->redirect("<front>");
}*/
public function profilePage($bizid){
+ $address_id = "";
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();
$data = \Drupal::service("typ.search")->getProfile($bizid ,AUTO);
if (!$data) {
return $this->redirect("<front>");
}
+ /*if($data['landingpage'] == ""){
+ $address_id = $data['addressid'];
+ }
+ if(is_numeric($address_id)){
+ $result = \Drupal::service('typ.unvservice')->loadListing($data['customerid']);
+ $rs_details = (!empty($result['address'][$data['headingcod']][$address_id]['frontviews']))?$result['address'][$headingcode][$data['headingcod']]['frontviews']:array();
+ } else {
+ $result = \Drupal::service('typ.unvservice')->loadService($data['customerid']);
+ }*/
+ $address_id = $data['addressid'];
+ $result = \Drupal::service('typ.unvservice')->loadService($data['customerid']);
+ $rs_detail = (!empty($result['landingpages'][$data['headingcod']]))?$result['landingpages'][$data['headingcod']]:array();
+ $type = '';
+ if(empty($rs_detail)){
+ $type = 'FL';
+ }else{
+ $result_olc = \Drupal::service('typ.catalog')->listData($data['customerid']);
+ }
+ unset($rs_detail);
- $dataproddesct = html_entity_decode($data['proddesc']);
+
+ $pos = strpos(html_entity_decode($data['proddesc']),"<p>");
+ if($pos !== false){
+ $tempdesc = substr(html_entity_decode($data['proddesc']),3);
+ }else{
+ $tempdesc = html_entity_decode($data['proddesc']);
+ }
+ $temp = '<p style="color:#000;">';
+ $tempdesc = $temp.$tempdesc;
+ $type = $data['customertyp'];
+
+ if($type == "FL") {
+ $dataproddesct = iconv_substr($tempdesc,0,123,"UTF-8");
+ $dataproddesct .= '...';
+ }else{
+ $dataproddesct = $tempdesc;
+ }
+ if($type != "FL" && !empty($result_olc)){
+ $olcdata = $result_olc[0];
+ }
// echo "<pre>";
// var_export($data);
// exit;
$display[] = array(
'#theme' => 'typ_profile',
'#profile' => $data,
'#prodescription' => $dataproddesct,
- );
+ '#catalog' => $olcdata,
+ '#type' => $type
+ );
return $display;
}
}
\ No newline at end of file
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,170 +1,252 @@
{% set base_images = 'http://media.yellowpages.co.th/yellowpages'%}
<div class="container-fluid">
<div class="col-xs-12 col-md-8 col-lg-8" >
<div class="row">
<div class="col-xs-12 col-md-12 col-lg-12">
<div class="col-xs-12 col-md-5 col-lg-5">
<img class="img-responsive" src="{% if not profile.logo %} {{ nopic }}
{% else %} {{ [base_images,"/logo/",profile.logo]|join }} {% endif %}"/>
</div>
<div class="col-xs-12 col-md-7 col-lg-7">
<h4>{{ profile.custname|raw }}</h4>
หมวดหมู่ : <a href="/heading/{{ profile.ypheadingname }}">{{ profile.headingname|raw }}</a><br>
ไม่สามารถคะแนนได้
</div>
</div>
</div>
<div class="row">
<br>
<div class="col-xs-12 col-sm-12 col-lg-12">
- {% trans %} Address {% endtrans %} [ <a href="http://map.yellowpages.co.th/?bizid={{ profile.businessid|raw }}/">
+ {% trans %} Address {% endtrans %} [ <a href="/ypsearch?qm=#{{ profile.humanname|raw }}/">
{% trans %}View map{% endtrans %}{{ profile.custname|raw }}</a> ] <br>
{{ [profile.addr,profile.soi,profile.road,profile.subdistrictname,
profile.districtname,profile.cityname,profile.postcode]|join(' ') }}
<br><br>
<div class="row">
- <div class="col-xs-4 col-sm-2 col-lg-2 ">
+ <div class="col-xs-4 col-sm-3 col-lg-3 ">
{% if not profile.telno %}{% else %}{% trans %} Tel {% endtrans %}<br>{% endif %}
{% if not profile.fax %}{% else %}{% trans %} Fax {% endtrans %}<br>{% endif %}
{% if not profile.email %}{% else %}{% trans %} Email {% endtrans %} <br>{% endif %}
{% if not profile.website %}{% else %}{% trans %} Website {% endtrans %} <br>{% endif %}
{% if not profile.workinghours %}{% else %}{% trans %} Work-Time {% endtrans %}{% endif %}
</div>
- <div class="col-xs-8 col-sm-10 col-lg-10">
+ <div class="col-xs-8 col-sm-9 col-lg-9">
{% if not profile.telno %}
{% else %}
- {% for key, tel in profile.telno %}
- {% if loop.last != key+1 %}<a href="tel:{{ tel }}">{{ tel }}</a>{{ " ," }}
- {% else %}<a href="tel:{{ tel }}">{{ tel }}</a>{% endif %}
- {% endfor %}<br>
+ {% if type == 'FL' %}
+ <span>{{ profile.telno.0 }}</span><br>
+ {% else %}
+ {% for key, tel in profile.telno %}
+ {% if loop.last != key+1 %}<a href="tel:{{ tel }}">{{ tel }}</a>{{ " ," }}
+ {% else %}<a href="tel:{{ tel }}">{{ tel }}</a>{% endif %}
+ {% endfor %}<br>
+ {% endif %}
{% endif %}
{% if not profile.fax %}
+ {% else %}
+ {% if type == 'FL' %}
+ <span>{{ profile.telno.0 }}</span><br>
{% else %}
- {% for key, tel in profile.fax %}
- {% if loop.last != key+1 %}<a href="tel:{{ tel }}">{{ tel }}</a>{{ " ," }}
- {% else %}<a href="tel:{{ tel }}">{{ tel }}</a>{% endif %}
- {% endfor %}<br>
+ {% for key, tel in profile.telno %}
+ {% if loop.last != key+1 %}<a href="tel:{{ tel }}">{{ tel }}</a>{{ " ," }}
+ {% else %}<a href="tel:{{ tel }}">{{ tel }}</a>{% endif %}
+ {% endfor %}<br>
+ {% endif %}
{% endif %}
{% if not profile.email %}
+ {% else %}
+ {% if type == 'FL' %}
+ <span>{{ profile.email }}</span><br>
{% else %}
- <a href="mailto:{{ profile.email }}"> {{ profile.email }}</a><br>
+ <a href="mailto:">{{ profile.email }}</a><br>
+
+ {% endif %}
{% endif %}
{% if not profile.website %}
{% else %}
- <a href="{{ profile.website }}">{{ profile.website }}</a><br>
+ <a href="{{ profile.website }}" target="_blank">{{ profile.website }}</a><br>
{% endif %}
{% if not profile.workinghours %}
{% else %}
{{ profile.workinghours }}<br>
{% endif %}
</div>
<div class="row" style="margin-left: 0px;">
<div class="col-xs-12 col-md-12 col-lg-12">
{% if not prodescription %}
{% else %}
<br>{% trans %} Product And Service {% endtrans %}<br><br>
- {{ prodescription|replace({"<p>":" ","</p>":" "}) }}<br>
+ {{ prodescription|raw }}<br>
{% endif %}
{% if not profile.brandname %}
{% else %}<br>{% trans %} Branner {% endtrans %} : {{ profile.brandname|replace({"<p>":" ","</p>":" "}) }}
{% endif %}
<br><br><br>
{# TAB #}
+ {% if type == 'FL' %}{% else %}
<div class="mobile">
<ul class="nav nav-tabs">
- <li class="active"><a data-toggle="tab" href="#home">{% trans %} Picture {% endtrans %}</a></li>
- <li><a data-toggle="tab" href="#menu1">{% trans %} Map {% endtrans %}</a></li>
- <li><a data-toggle="tab" href="#menu2">{% trans %} Advertise {% endtrans %}</a></li>
- <li><a data-toggle="tab" href="#menu3">Menu 3</a></li>
+ {% if not profile.picturet1 %}{% else %}<li class="active"><a data-toggle="tab" href="#home">{% trans %} Picture {% endtrans %}</a></li>{% endif %}
+ {% if not profile.promotion %}{% else %}<li {% if not profile.picturet1 %}{{ " class='active'" }}{% endif %}><a data-toggle="tab" href="#menu3">{% trans %} Promotion {% endtrans %}</a></li>{% endif %}
+ {% if not profile.map %}{% else %}<li><a data-toggle="tab" href="#menu4">{% trans %} Map Picture {% endtrans %}</a></li>{% endif %}
+ {% if not profile.location.lat %}{% else %}<li><a data-toggle="tab" href="#menu1">{% trans %} Digital Map {% endtrans %}</a></li>{% endif %}
+ {% if not profile.location.lat %}{% else %}<li><a data-toggle="tab" href="#menu5">{% trans %} Front View {% endtrans %}</a></li>{% endif %}
+ {% if not profile.location.lat %}{% else %}<li><a data-toggle="tab" href="#menu6">{% trans %} VDO {% endtrans %}</a></li>{% endif %}
+ {% if not profile.location.lat %}{% else %}<li><a data-toggle="tab" href="#menu7">{% trans %} Voice {% endtrans %}</a></li>{% endif %}
+ {% if not profile.printads %}{% else %}<li><a data-toggle="tab" href="#menu2">{% trans %} Advertisement {% endtrans %}</a></li>{% endif %}
</ul>
<div class="tab-content">
+ {% if not profile.picturet1 %}
+ {% else %}
<div id="home" class="tab-pane fade in active">
<br>
<div class="row">
<div class="col-xs-4 col-sm-4 col-lg-4">
<a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet1]|join}}" class="colorbox">
<img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet1]|join}}"/>
</a>
</div>
<div class="col-xs-4 col-sm-4 col-lg-4">
<a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet2]|join}}" class="colorbox">
<img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet2]|join}}"/>
</a>
</div>
<div class="col-xs-4 col-sm-4 col-lg-4">
<a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet3]|join}}" class="colorbox">
<img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet3]|join}}"/>
</a>
</div>
+ <div class="col-xs-4 col-sm-4 col-lg-4">
+ <a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet4]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet4]|join}}"/>
+ </a>
+ </div>
+ <div class="col-xs-4 col-sm-4 col-lg-4">
+ <a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet5]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet5]|join}}"/>
+ </a>
+ </div>
+ <div class="col-xs-4 col-sm-4 col-lg-4">
+ <a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet6]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet6]|join}}"/>
+ </a>
+ </div>
+ <div class="col-xs-4 col-sm-4 col-lg-4">
+ <a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet7]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet7]|join}}"/>
+ </a>
+ </div>
+ <div class="col-xs-4 col-sm-4 col-lg-4">
+ <a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet8]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet8]|join}}"/>
+ </a>
+ </div>
+ <div class="col-xs-4 col-sm-4 col-lg-4">
+ <a href="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet9]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/products/th/",profile.customerid,"/",profile.picturet9]|join}}"/>
+ </a>
+ </div>
</div>
</div>
- <div id="menu1" class="tab-pane fade">
- <h3>MAP</h3>
- <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
+ {% endif %}
+
+ {% if not profile.location.lat %}{% else %}
+ <div id="menu1" {% if profile.picturet1 %}{{ ' class="tab-pane fade"' }}{% else %}{{ ' class="tab-pane fade in active"' }}{% endif %}>
+ <br>
+ <iframe width="100%" height="240" scrolling="no" frameborder="0" src="http://landingpage.yellowpages.co.th/yp_map.php?latitude={{ profile.location.lat }}&longitude={{ profile.location.lon }}&height=240&width=445" allowtransparency="true" marginwidth="0" marginheight="0"></iframe>
+ </div>
+ {% endif %}
+
+ {% if not profile.printads %}{% else %}
+ <div id="menu2" class="tab-pane fade in">
+ <div class="row">
+ <div class="col-xs-12 col-sm-12 col-lg-12">
+ <br>
+ <a href="{{[base_images,"/printads/th/",profile.printads,".jpg"]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/printads/th/",profile.printads,".jpg"]|join}}"/>
+ </a>
+ </div>
+ </div>
</div>
- <div id="menu2" class="tab-pane fade">
- <h3>Menu 2</h3>
- <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</p>
+ {% endif %}
+
+ {% if not profile.promotion %}
+ {% else %}
+ <div id="menu3" class="tab-pane fade">
+ <br>
+ <p class="text-center" style="color:#000">{{ profile.promotion }}</p>
</div>
- <div id="menu3" class="tab-pane fade">
- <h3>Menu 3</h3>
- <p>Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</p>
- </div>
+ {% endif %}
+
+ {% if not profile.map %}
+ {% else %}
+ <div id="menu4" class="tab-pane fade">
+ <div class="row">
+ <div class="col-xs-12 col-sm-12 col-lg-12">
+ <br>
+ <a href="{{[base_images,"/printads/th/",profile.printads,".jpg"]|join}}" class="colorbox">
+ <img class="img-responsive" src="{{[base_images,"/map/th/",profile.map,".jpg"]|join}}"/>
+ </a>
+ </div>
+ </div>
+ </div>
+ {% endif %}
</div>
</div>
+ {% endif %}
- <br><br><br>
- {% if not profile.custname %}
- {% else %}
- {{ profile.custname|raw }} : แสดงความคิดเห็น
- {% endif %}
- <br><br>
+ {#<br><br><br>#}
+ {#{% if not profile.custname %}#}
+ {#{% else %}#}
+ {#{{ profile.custname|raw }} : แสดงความคิดเห็น#}
+ {#{% endif %}#}
+ {#<br><br>#}
{# TAB #}
- <div class="mobile">
- <ul class="nav nav-tabs">
- <li class="active"><a data-toggle="tab" href="#menu4">{% trans %} Picture {% endtrans %}</a></li>
- <li><a data-toggle="tab" href="#menu5">{% trans %} Map {% endtrans %}</a></li>
- <li><a data-toggle="tab" href="#menu6">{% trans %} Advertise {% endtrans %}</a></li>
- </ul>
+ {#<div class="mobile">#}
+ {#<ul class="nav nav-tabs">#}
+ {#<li class="active"><a data-toggle="tab" href="#menu">{% trans %} Comment {% endtrans %}</a></li>#}
+ {#<li><a data-toggle="tab" href="#menu">{% trans %} Picture Concerned {% endtrans %}</a></li>#}
+ {#{#<li><a data-toggle="tab" href="#menu6">{% trans %} Advertise {% endtrans %}</a></li>#}#}
+ {#</ul>#}
- <div class="tab-content">
- <div id="menu4" class="tab-pane fade in active">
- <h3>HOME</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
- </div>
- <div id="menu5" class="tab-pane fade">
- <h3>Menu 1</h3>
- <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
- </div>
- <div id="menu6" class="tab-pane fade">
- <h3>Menu 2</h3>
- <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</p>
- </div>
- </div>
- </div>
+ {#<div class="tab-content">#}
+ {#<div id="menu4" class="tab-pane fade in active">#}
+ {#<h3>HOME</h3>#}
+ {#<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>#}
+ {#</div>#}
+ {#<div id="menu5" class="tab-pane fade">#}
+ {#<h3>Menu 1</h3>#}
+ {#<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>#}
+ {#</div>#}
+ {#{#<div id="menu6" class="tab-pane fade">#}#}
+ {#{#<h3>Menu 2</h3>#}#}
+ {#{#<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</p>#}#}
+ {#{#</div>#}#}
+ {#</div>#}
+ {#</div>#}
{# END TAB #}
<br><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-4 col-lg-4">
<div class="col-xs-12 col-md-12 col-lg-12">
- ADS
+
</div>
</div>
</div>
diff --git a/typ_profile.module b/typ_profile.module
--- a/typ_profile.module
+++ b/typ_profile.module
@@ -1,41 +1,43 @@
<?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;
//include "legacy/TYPLegacyIncludeAll.php";
/*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
+ 'prodescription' => NULL,
+ 'catalog' => NULL,
+ 'type' => NULL
)
)
);
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Apr 30, 5:19 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
213947
Attached To
rPF typ_profile
Event Timeline
Log In to Comment