| Current Path : /home/helpink/www/components/com_jbusinessdirectory/include/ |
| Current File : /home/helpink/www/components/com_jbusinessdirectory/include/social_share.php |
<?php
/**
* @package J-BusinessDirectory
*
* @author CMSJunkie http://www.cmsjunkie.com/
* @copyright Copyright (C) 2007 - 2022 CMSJunkie. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0.en.html
*/
defined('_JEXEC') or die('Restricted access');
$itemId = '';
$itemType = '';
$appSettings = JBusinessUtil::getApplicationSettings();
$base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
$url = $base_url . $_SERVER["REQUEST_URI"];
$app = JFactory::getApplication();
$input = $app->input;
$view = $input->get('view');
$langageTab = JBusinessUtil::getLanguageTag();
$langageTab = str_replace("-", "_", $langageTab);
?>
<div id="fb-root"></div>
<div class="jbd-social-container">
<?php if ($appSettings->show_view_count && !isset($disableButton)) { ?>
<div class="view-counter">
<i class="icon eye"></i>
<span>
<?php
switch ($view) {
case "companies":
echo $company->viewCount;
break;
case "event":
echo $event->view_count;
break;
case "offer":
echo $offer->viewCount ;
break;
case "conference":
echo $conference->viewCount ;
break;
case "conferencesession":
echo $conferenceSession->viewCount;
break;
}
?>
</span>
</div>
<?php } ?>
<?php if ($appSettings->enable_socials && !isset($disableButton)) { ?>
<a id="open_socials" href="javascript:void(0)" class="share-icon" >
<i class="icon share-circle"></i>
</a>
<?php }?>
<?php if ($appSettings->enable_socials) { ?>
<!-- Modal -->
<div id="socials" style="display:none;">
<div id="dialog-container" class="jbd-container">
<div class="titleBar">
<span class="dialogTitle" id="dialogTitle"></span>
</div>
<div class="dialogContent">
<div class="row">
<div class="col-md-3">
<div class="item-image text-center">
<?php if ($view == 'company' || $view == 'companies') {
$itemId = $company->id;
$itemType = STATISTIC_ITEM_BUSINESS; ?>
<?php if (!empty($company->logoLocation)) { ?>
<img src="<?php echo BD_PICTURES_PATH.$company->logoLocation ?>" alt="<?php echo htmlspecialchars($company->name)?>" class="img-responsive"/>
<?php } else { ?>
<img src="<?php echo BD_PICTURES_PATH.'/no_image.jpg' ?>" alt="<?php echo htmlspecialchars($company->name)?>" class="img-responsive" />
<?php } ?>
<?php
} ?>
<?php if ($view == 'offer') {
$itemId = $offer->id;
$itemType = STATISTIC_ITEM_OFFER; ?>
<?php if (!empty($offer->pictures[0]->picture_path)) { ?>
<img src="<?php echo BD_PICTURES_PATH.$offer->pictures[0]->picture_path ?>" alt="<?php echo htmlspecialchars($offer->subject)?>" class="img-responsive"/>
<?php } else { ?>
<img src="<?php echo BD_PICTURES_PATH.'/no_image.jpg' ?>" alt="<?php echo htmlspecialchars($offer->subject)?>" class="img-responsive" />
<?php } ?>
<?php
} ?>
<?php if ($view == 'event') {
$itemId = $event->id;
$itemType = STATISTIC_ITEM_EVENT; ?>
<?php if (!empty($event->pictures[0]->picture_path)) { ?>
<img src="<?php echo BD_PICTURES_PATH.$event->pictures[0]->picture_path ?>" alt="<?php echo htmlspecialchars($event->name)?>" class="img-responsive"/>
<?php } else { ?>
<img src="<?php echo BD_PICTURES_PATH.'/no_image.jpg' ?>" alt="<?php echo htmlspecialchars($event->name)?>" class="img-responsive" />
<?php } ?>
<?php
} ?>
<?php if ($view == 'trip') {
$itemId = $trip->id;
?>
<?php if (!empty($trip->pictures[0]->picture_path)) { ?>
<img src="<?php echo BD_PICTURES_PATH.$trip->pictures[0]->picture_path ?>" alt="<?php echo htmlspecialchars($trip->name)?>" class="img-responsive"/>
<?php } else { ?>
<img src="<?php echo BD_PICTURES_PATH.'/no_image.jpg' ?>" alt="<?php echo htmlspecialchars($trip->name)?>" class="img-responsive" />
<?php } ?>
<?php
} ?>
</div>
</div>
<div class="col-md-9">
<div class="row share">
<div class="col-md-12">
<?php if ($view == 'company' || $view == 'companies') { ?>
<h4><?php echo isset($company->name)?$company->name:"" ; ?></h4>
<?php if (!empty($company->slogan)) { ?>
<p><?php echo $company->slogan; ?></p>
<?php } else { ?>
<p><?php echo $company->typeName; ?></p>
<?php } ?>
<?php } ?>
<?php if ($view == 'offer') { ?>
<h4><?php echo isset($offer->subject)?$offer->subject:"" ; ?></h4>
<?php if (!empty($offer->short_description)) { ?>
<p><?php echo $offer->short_description; ?></p>
<?php
} else {
$address = JBusinessUtil::getAddressText($offer);
if (!empty($address)) {?>
<p><i class="icon map-marker"></i> <?php echo $address; ?></p>
<?php }
} ?>
<?php } ?>
<?php if ($view == 'event') { ?>
<h4><?php echo isset($event->name)?$event->name:"" ; ?></h4>
<?php if (!empty($event->short_description)) { ?>
<p><?php echo $event->short_description; ?></p>
<?php } else {
$address = JBusinessUtil::getAddressText($event);
if (!empty($address)) {?>
<p><i class="icon map-marker"></i> <?php echo $address; ?></p>
<?php } ?>
<?php
} ?>
<?php } ?>
<?php if ($view == 'trip') { ?>
<h4><?php echo isset($trip->name)?$trip->name:"" ; ?></h4>
<?php if (!empty($trip->description)) { ?>
<p><?php echo JBusinessUtil::truncate($trip->description, 200, '...') ?></p>
<?php } else {
$address = JBusinessUtil::getAddressText($trip);
if (!empty($address)) {?>
<p><i class="icon map-marker"></i> <?php echo $address; ?></p>
<?php } ?>
<?php
} ?>
<?php } ?>
</div>
<div class="col-md-12">
<ul>
<li>
<!-- Your share button code -->
<div class="fb-share-button"
data-href="<?php echo htmlspecialchars($url, ENT_QUOTES)?>"
data-layout="button">
</div>
</li>
<li>
<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
</li>
<li>
<script type="IN/Share" data-counter="right"></script>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
window.addEventListener('load', function() {
jQuery('#open_socials').click(function() {
<?php if ($view == 'company' || $view == 'companies' || $view == 'offer' || $view == 'event') { ?>
jbdUtils.increaseShareClicks(<?php echo $itemId ?>, <?php echo $itemType ?>);
<?php } ?>
// Facebook
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/<?php echo $langageTab?>/sdk.js#xfbml=1&version=v3.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// Twitter
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js,fjs);}}
(document, 'script', 'twitter-wjs');
// Linkedin
let script = document.createElement('script');
script.src = "https://platform.linkedin.com/in.js";
document.head.appendChild(script);
jQuery('#socials').jbdModal();
});
});
</script>
<?php } ?>
</div>