Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1198095
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Subscribers
None
View Options
diff --git a/src/Controller/TYPProfileController.php b/src/Controller/TYPProfileController.php
new file mode 100644
--- /dev/null
+++ b/src/Controller/TYPProfileController.php
@@ -0,0 +1,41 @@
+<?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){
+ $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
+ $data = \Drupal::service("typ.search")->getProfile($bizid ,AUTO);
+ if (!$data) {
+ return $this->redirect("<front>");
+ }
+
+ $dataproddesct = html_entity_decode($data['proddesc']);
+// echo "<pre>";
+// var_export($data);
+// exit;
+ $display[] = array(
+ '#theme' => 'typ_profile',
+ '#profile' => $data,
+ '#prodescription' => $dataproddesct,
+ );
+ return $display;
+ }
+}
\ No newline at end of file
diff --git a/templates/typ-profile.html.twig b/templates/typ-profile.html.twig
new file mode 100644
--- /dev/null
+++ b/templates/typ-profile.html.twig
@@ -0,0 +1,170 @@
+{% 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 %}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 ">
+ {% 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">
+ {% 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>
+ {% endif %}
+
+ {% if not profile.fax %}
+ {% 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>
+ {% endif %}
+
+ {% if not profile.email %}
+ {% else %}
+ <a href="mailto:{{ profile.email }}"> {{ profile.email }}</a><br>
+ {% endif %}
+
+ {% if not profile.website %}
+ {% else %}
+ <a href="{{ profile.website }}">{{ 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>
+ {% endif %}
+
+ {% if not profile.brandname %}
+ {% else %}<br>{% trans %} Branner {% endtrans %} : {{ profile.brandname|replace({"<p>":" ","</p>":" "}) }}
+ {% endif %}
+ <br><br><br>
+ {# TAB #}
+ <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>
+ </ul>
+
+ <div class="tab-content">
+ <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>
+ </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>
+ </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>
+ </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>
+ </div>
+ </div>
+
+
+ <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="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.info.yml b/typ_profile.info.yml
new file mode 100644
--- /dev/null
+++ b/typ_profile.info.yml
@@ -0,0 +1,11 @@
+name: TYP Profile
+type: module
+description: 'TYP Profile'
+package: TYP
+# core: 8.x
+# Information added by Drupal.org packaging script on 2015-02-17
+version: '8.x-1.x-dev'
+core: '8.x'
+project: 'typ_profile'
+dependencies:
+ - typ_search
diff --git a/typ_profile.module b/typ_profile.module
new file mode 100644
--- /dev/null
+++ b/typ_profile.module
@@ -0,0 +1,41 @@
+<?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
+ )
+ )
+ );
+}
diff --git a/typ_profile.routing.yml b/typ_profile.routing.yml
new file mode 100644
--- /dev/null
+++ b/typ_profile.routing.yml
@@ -0,0 +1,15 @@
+typ_profile_search:
+ path: '/profile/{bizid}'
+ defaults:
+ _controller: '\Drupal\typ_profile\Controller\TYPProfileController::profilePage'
+ _title: 'View Profile'
+ 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
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Apr 30, 5:20 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
213978
Attached To
rPF typ_profile
Event Timeline
Log In to Comment