diff --git a/src/Plugin/Block/TYPProfileDetail.php b/src/Plugin/Block/TYPProfileDetail.php --- a/src/Plugin/Block/TYPProfileDetail.php +++ b/src/Plugin/Block/TYPProfileDetail.php @@ -1,133 +1,137 @@ getRequestUri(); $s = explode("/",$url); $bid = end($s); $data = self::$data = \Drupal::service("typ.search")->getProfile($bid ,AUTO); $temp = array(); if(!empty($data['paymentmethod'])){ $temp['paymentmethod'] = $data['paymentmethod']; } if(!empty($data['atmosphere'])){ $temp['atmosphere'] = $data['atmosphere']; } if(!empty($data['standard'])){ $temp['standard'] = $data['standard']; } if(!empty($data['amentity'])){ $temp['amentity'] = $data['amentity']; } if(!empty($data['rating'])){ $temp['rating'] = $data['rating']; } if(!empty($data['duration'])){ $temp['duration'] = $data['duration']; } if(!empty($data['landmark'])){ $temp['landmark'] = $data['landmark']; } self::$datashow = $temp; if($data['customertype'] != 'FL' && !empty($temp)){ return AccessResult::allowed(); }else{ return AccessResult::forbidden(); } } public function build(){ $result = self::$datashow; $html = ''; $star = ' '; $star_empty = ' '; if(!empty($result['landmark'])){ $html .= '
' . t('Landmark') . ':
' . $result['landmark'] . '
'; } if(!empty($result['paymentmethod'])) { $html .= '' . t('Payment') . ':
' . $result['paymentmethod'] . '
'; } if(!empty($result['rating'])) { $num = intval(substr($result['rating'],0,1)); $rateing = ''; for($i=1;$i<=5;$i++){ if($i<=$num){ $rateing .= $star; }else{ $rateing .= $star_empty; } } $html .= '' . t('Rating') .': '.$rateing.'
'; } if(!empty($result['standard'])){ $html .= ''.t('Standard').':
'.$result['standard'].'
'; } if(!empty($result['atmosphere'])){ $html .= ''.t('Atmosphere').':
'.$result['atmosphere'].'
'; } if(empty($result['duration'])){ if(!empty($result['amentity'])) { $result['duration'] = $result['amentity']; } } if(!empty($result['duration'])){ $html .= ''.t('Facilities').':
'.$result['duration'].'
'; } $data = '";var_export($result);exit;
$build = array();
$build[] = array(
'#markup' => $data,
);
$build['#attached']['library'] = array(
'typ_profile/profile_share'
);
return $build;
}
}
\ No newline at end of file
diff --git a/src/Plugin/Block/TYPProfileFacebook.php b/src/Plugin/Block/TYPProfileFacebook.php
--- a/src/Plugin/Block/TYPProfileFacebook.php
+++ b/src/Plugin/Block/TYPProfileFacebook.php
@@ -1,57 +1,61 @@
getRequestUri();
$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);
$facebook = '';
if($this->data['customertype'] == 'FL' || $this->data['customertype'] == '' || $this->result['accounting_status'] == '1' || $this->data['hide'] == '1' || $this->data['accounting_status'] == '1'){
$facebook = format_string('');
}
$build = array();
$build[] = array(
'#markup' => $facebook,
);
return $build;
}
}
\ No newline at end of file
diff --git a/src/Plugin/Block/TYPProfileShareBlock.php b/src/Plugin/Block/TYPProfileShareBlock.php
--- a/src/Plugin/Block/TYPProfileShareBlock.php
+++ b/src/Plugin/Block/TYPProfileShareBlock.php
@@ -1,1 +1,1 @@
-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 .= TYPProfileController::FormatPhoneNumber($t);
}
}
if (!empty($this->data['fax'])) {
foreach ($this->data['fax'] as $t) {
$fax .= TYPProfileController::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='.format_string($this->data['proddesc']).$fullurl;
$twitter = format_string($this->data['proddesc']).$fullurl;
$gplus = 'https://plus.google.com/share?url='.$fullurl;
break;
default:
$email = $body_email;
$facebook = 'https://www.facebook.com/sharer/sharer.php?u='.format_string($this->data['proddesc']).$fullurl;
$twitter = format_string($this->data['proddesc']).$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('
'.t('If you own this business contact here').'
'.t('Total Promotion').'
'.t('Share this business here').'
'),
);
$build['#attached']['library'] = array(
'typ_profile/profile_share'
);
return $build;
}
}
?>
\ No newline at end of file
+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 .= TYPProfileController::FormatPhoneNumber($t);
}
}
if (!empty($this->data['fax'])) {
foreach ($this->data['fax'] as $t) {
$fax .= TYPProfileController::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='.format_string($this->data['proddesc']).$fullurl;
$twitter = format_string($this->data['proddesc']).$fullurl;
$gplus = 'https://plus.google.com/share?url='.$fullurl;
break;
default:
$email = $body_email;
$facebook = 'https://www.facebook.com/sharer/sharer.php?u='.format_string($this->data['proddesc']).$fullurl;
$twitter = format_string($this->data['proddesc']).$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('
'.t('If you own this business contact here').'
'.t('Total Promotion').'
'.t('Share this business here').'
'),
);
$build['#attached']['library'] = array(
'typ_profile/profile_share'
);
return $build;
}
}
?>
\ No newline at end of file