Page MenuHomePhabricator

No OneTemporary

diff --git a/css/profile_freelist.css b/css/profile_freelist.css
new file mode 100644
--- /dev/null
+++ b/css/profile_freelist.css
@@ -0,0 +1,4 @@
+.profile_share img{
+ width: 75px;
+ height: 28px;
+}
\ No newline at end of file
diff --git a/js/profile.js b/js/profile.js
--- a/js/profile.js
+++ b/js/profile.js
@@ -1,12 +1,22 @@
var url= '';
(function ($, Drupal, drupalSettings) {
})(jQuery, Drupal, drupalSettings);
function print_content(){
var printContents = jQuery("#block-bootstrap-content").html();
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
+}
+function hover_share(data){
+ var src = data.getAttribute('src');
+ var hover = src.replace("1","2");
+ data.setAttribute('src',hover);
+}
+function out_share(data){
+ var src = data.getAttribute('src');
+ var hover = src.replace("2","1");
+ data.setAttribute('src',hover);
}
\ No newline at end of file
diff --git a/src/Plugin/Block/TYPProfileShareBlock.php b/src/Plugin/Block/TYPProfileShareBlock.php
new file mode 100644
--- /dev/null
+++ b/src/Plugin/Block/TYPProfileShareBlock.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\search\Plugin\Block\SearchBlock.
+ */
+namespace Drupal\typ_profile\Plugin\Block;
+
+use Drupal\Core\Block\BlockBase;
+use Drupal\Core\Url;
+use Drupal\typ_legacy\Service\TYPLegacyLandingPageService;
+use Drupal\typ_search\Service\TYPSearchService;
+use Drupal\typ_legacy\Serivee;
+
+/**
+ * Provides a 'Search form' block.
+ *
+ * @Block(
+ * id = "typ_profile_share_block",
+ * admin_label = @Translation("Profile Share"),
+ * category = @Translation("TYP")
+ * )
+ */
+
+class TYPProfileShareBlock extends BlockBase
+{
+ protected $data;
+ protected $result;
+ public function build(){
+
+ $fullurl = 'http://'.$_SERVER[HTTP_HOST].$_SERVER['REQUEST_URI'];
+ $url = \Drupal::request()->getRequestUri();
+ $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
+ $bid = end(explode("/",$url));
+ $this->data = \Drupal::service("typ.search")->getProfile($bid ,AUTO);
+ $this->result = \Drupal::service('typ.unvservice')->loadListing($this->data['customerid'],NULL);
+ $type = $this->result['address'][$this->data['headingcode']][$this->data['addressid']]['customertype'];
+
+ switch ($type){
+ case "FL":
+ $email = 'mailto:email@address.com?subject='.format_string($this->data['humanname']).'&body=Link:'.format_string($fullurl).format_string($this->data['proddesc']);
+ $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.$fullurl;
+ $twitter = $fullurl;
+ $gplus = 'https://plus.google.com/share?url='.$fullurl;
+ break;
+ default:
+ $email = 'mailto:email@address.com?subject='.format_string($this->data['humanname']).'&body=Link:'.format_string($fullurl).format_string($this->data['proddesc']);
+ $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.$fullurl;
+ $twitter = $fullurl;
+ $gplus = 'https://plus.google.com/share?url='.$fullurl;
+ }
+
+ $base_url_images = '/themes/bootstrap/typ/images/icon-service-profilepage/'.$language;
+
+ $build = array();
+
+ $build[] = array(
+ '#markup' => format_string('<div class="col-xs-12 col-md-12 col-lg-12 form-inline text-center profile_share">
+ <div class="col-xs-4 col-md-4 col-lg-4" style="padding: 5px !important;">
+ <a href="'.$email.'"><img class="profile_email" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'.$base_url_images.'/pf-icon-email1-'.$language.'.png"></a>
+ </div>
+ <div class="col-xs-4 col-md-4 col-lg-4" style="padding: 5px !important;">
+ <a href="http://promotion.yellowpages.co.th/" TARGET="_blank" ><img class="profile_promotion" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'.$base_url_images.'/pf-icon-promation1-'.$language.'.png"></a>
+ </div>
+ <div class="col-xs-4 col-md-4 col-lg-4" style="padding: 5px !important;">
+ <a href="#" onclick="print_content()"><img class="profile_print" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'.$base_url_images.'/pf-icon-print1-'.$language.'.png"></a>
+ </div>
+ <div class="col-xs-4 col-md-4 col-lg-4" style="padding: 5px !important;">
+ <a href="#" onclick="window.open(\''.$facebook.'\',\'name\',\'width=600,height=400\')" ><img class="profile_facebook" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'.$base_url_images.'/pf-icon-facebook1-'.$language.'.png"></a>
+ </div>
+ <div class="col-xs-4 col-md-4 col-lg-4" style="padding: 5px !important;">
+ <a href="#" data-url="'.$twitter.'" data-text="'.$this->data['humanname'].'" onclick="window.open(\'https://twitter.com/share\',\'name\',\'width=600,height=400\')" ><img class="profile_twitter" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'.$base_url_images.'/pf-icon-twitter+1-'.$language.'.png"></a>
+ </div>
+ <div class="col-xs-4 col-md-4 col-lg-4" style="padding: 5px !important;">
+ <a href="" onclick="window.open(\''.$gplus.'\',\'name\',\'width=600,height=400\')" ><img class="profile_google" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'.$base_url_images.'/pf-icon-google+1-'.$language.'.png"></a>
+ </div>
+ </div>'),
+ );
+
+ $build['#attached']['library'] = array(
+ 'typ_profile/profile_share'
+ );
+ return $build;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/typ_profile.libraries.yml b/typ_profile.libraries.yml
--- a/typ_profile.libraries.yml
+++ b/typ_profile.libraries.yml
@@ -1,3 +1,8 @@
profile.popup:
js:
- js/profile.js: {}
\ No newline at end of file
+ js/profile.js: {}
+
+profile_share:
+ css:
+ theme:
+ css/profile_freelist.css: {}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Mar 13, 3:57 PM (23 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
205361

Event Timeline