Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1083233
TYPProfileShareBlock.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
TYPProfileShareBlock.php
View Options
<?php
namespace
Drupal\typ_profile\Plugin\Block
;
/** * @file * Contains \Drupal\search\Plugin\Block\SearchBlock. */
use
Drupal\Core\Block\BlockBase
;
use
Drupal\Core\Url
;
use
Drupal\typ_legacy\Service\TYPLegacyLandingPageService
;
use
Drupal\typ_profile\Controller\TYPProfileController
;
use
Drupal\typ_search\Service\TYPSearchService
;
use
Drupal\typ_legacy\Service\TYPUtilsService
;
use
Drupal\typ_legacy\Service
;
/** * Provides a 'Search form' block. * * @Block( * id = "typ_profile_share_block", * admin_label = @Translation("Profile Share"), * category = @Translation("TYP") * ) */
class
TYPProfileShareBlock
extends
BlockBase
{
public
function
getCacheMaxAge
()
{
return
0
;
// NOCACHE! } public function formatWorkingHour($s) { foreach( explode(",", $s) as $p) { $ps[] = $p; } return implode(", ", $ps); } protected $data; protected $result; public function build(){ $fullurl = 'http://'.$_SERVER[HTTP_HOST].$_SERVER['REQUEST_URI']; $url = \Drupal::request()->getRequestUri(); $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $s = explode("/",$url); $bid = end($s); $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']; $prodesc = $this->result['address'][$this->data['headingcode']][$this->data['addressid']][$language]['proddesc']; $telno = '';$fax = '';$workinghours = ''; if(!empty($this->result['accounting_status']) || $type == 'FL'){ $type = 'FL'; } if (!empty($this->data['telno'])) { foreach ($this->data['telno'] as $t) { $telno .= TYPUtilsService::formatPhoneNumber($t); } } if (!empty($this->data['fax'])) { foreach ($this->data['fax'] as $t) { $fax .= TYPUtilsService::formatPhoneNumber($t); } } if (!empty($this->data['workinghours'])) { $workinghours .= $this->formatWorkingHour($this->data['workinghours']); } $body_email = strip_tags($this->data['humanname']).'%0A%0A'.strip_tags($prodesc).'%0A%0A'."http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; switch ($type){ case "FL": $email = $body_email; $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.''.$fullurl; $twitter = format_string(strip_tags($this->data['proddesc']), array()).$fullurl; $gplus = 'https://plus.google.com/share?url='.$fullurl; break; default: $email = $body_email; $facebook = 'https://www.facebook.com/sharer/sharer.php?u='.''.$fullurl; $twitter = format_string(strip_tags($this->data['proddesc']), array()).$fullurl; $gplus = 'https://plus.google.com/share?url='.$fullurl; } $base_url_images = '/themes/bootstrap/typ/images/icon-service-profilepage/'.$language; header('Content-Type: text/html; charset=UTF-8'); $build = array(); $build[] = array( '#markup' => format_string('<a href="/update-business-info" target="_blank"> <div class="col-xs-12 col-md-12 col-lg-12 text-left profile_share_title_promotion"> <img src="/themes/bootstrap/typ/images/icon/typ-icon-database.png"><span>'.t('If you own this business contact here').'</span> </div></a> <a href="/promotion-result" target="_blank"> <div class="col-xs-12 col-md-12 col-lg-12 text-left profile_share_title_promotion"> <img src="/themes/bootstrap/typ/images/icon/typ-icon-allpromotion.png"><span>'.t('Total Promotion').'</span> </div></a> <div class="col-xs-12 col-md-12 col-lg-12 text-left profile_share_title"> '.t('Share this business here').' </div> <div class="col-xs-12 col-md-12 col-lg-12 form-inline text-center profile_share" style="padding:10px 10px 10px 6px;"> <div class="col-xs-4 col-md-4 col-lg-4" style="padding: 5px !important;"> <a href="#" data-from="'.$this->data['humanname'].'" data-value="'.$email.'" onclick="sendmail(this); return false" ><img class="profile_email img-responsive" 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="#" onclick="print_content()"><img class="profile_print img-responsive" 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 img-responsive" 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 img-responsive" 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 img-responsive" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'.$base_url_images.'/pf-icon-google+1-'.$language.'.png"></a> </div> </div>', array()), ); $build['#attached']['library'] = array( 'typ_profile/profile_share' ); return $build; } }
?>
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Dec 25, 3:03 AM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
193772
Attached To
rPF typ_profile
Event Timeline
Log In to Comment