Your IP : 216.73.216.248


Current Path : /home/digilove/public_html/modules/mod_profile/tmpl/
Upload File :
Current File : /home/digilove/public_html/modules/mod_profile/tmpl/default.php

<?php
/**
 * Marketplace Menus module
 *
 * PHP version 7.0
 *
 * @category   Module
 * @package    Joomla
 * @author     WebKul software private limited <support@webkul.com>
 * @copyright  2010 WebKul software private limited
 * @license    http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @version    GIT:5.2
 * @filesource http://store.webkul.com
 * @link       Technical Support:  webkul.uvdesk.com
 */

// no direct access
defined('_JEXEC') or die();
if (!class_exists('MarketplaceHelper')) {
    include JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.'components'.
    DIRECTORY_SEPARATOR.'com_marketplace'.DIRECTORY_SEPARATOR.'helpers'.
    DIRECTORY_SEPARATOR.'marketplace.php';
}
$jinput=JFactory::getApplication()->input;
$method=$jinput->getMethod();
$seller_id=$jinput->get('seller_id', 0, 'INT');
$user = JFactory::getUser();?>
    <style type="text/css">
        .wk_prof_blk<?php echo $class_sfx;
        ?> * {
            font-size: 15px!important;
        }
    </style>
    <div class="wk_prof_blk<?php echo $class_sfx;?>">
        <h6><?php echo JText::_('SELL_PROF');?></h6>
        <?php
        if (!$seller_id) {
            $seller_id = $user->id;
        }
        $followMenuId = plgSystemMarketplace::getMenuId(
            'index.php?option=com_marketplace&view=follow'
        );
        require_once JPATH_SITE."/components/com_marketplace/models/profilesave.php";
        $model = new MarketplaceModelProfilesave();
        $is_seller = $model->getItem($seller_id, "is_seller");
        if ($is_seller==1) {
            $fields=array(
                'u.name',
                's.screenname',
                's.companylogo',
                's.countrylogo',
                's.gender',
                's.social_mode',
                's.social_id',
                's.companylocality',
                's.shop_location',
                's.address',
                's.zip',
                's.phone',
                's.state_vm'
            );
            $sellInfo = MarketplaceHelper::getSeller($seller_id, $fields);
            $companylogo=$sellInfo->companylogo;
            $gender=$sellInfo->gender;
            $social_mode=$sellInfo->social_mode;
            $social_id=$sellInfo->social_id;
            $companylocality=$sellInfo->companylocality;
            $shop_location=$sellInfo->shop_location;
            $loc=explode('::', $shop_location);
            if (count($loc)==1) {
                $loc[0]='0.0';
                $loc[1]='0.0';
            }
            $screenname=$model->getItem($seller_id, "screenname");
            if (!strlen($screenname)) {
                $screenname=JFactory::getUser($seller_id)->name;
            }
            $doc=JFactory::getDocument();
            $doc->addScript(
                "//cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"
            );
            $doc->addStyleSheet(
                "//cdnjs.cloudflare.com/ajax/libs/swee".
                "talert/1.1.3/sweetalert.min.css"
            );
            $doc->addScript('//www.google.com/jsapi');
            $helper_ins = new ModprofileHelper();
            $seller_address = ucwords($sellInfo->address) ." ". ucwords($companylocality) .
                " ".$helper_ins->getStateNameById($sellInfo->state_vm)." ".
                $sellInfo->zip." " . $helper_ins->getCountryNameByCode2(
                    $sellInfo->countrylogo
                );
            $followers = $helper_ins->getSellerFollowers($seller_id);
            $foll_count=count($followers);
            
            $follow=0;
            if (isset($user->email)) {
                $follow = $helper_ins->checkSellerFollower($seller_id, $user);
            }
            ?>
            <div style="overflow:hidden">
            <?php
            if (strpos($companylogo, '.png')
                || strpos($companylogo, '.jpg')
                || strpos($companylogo, '.gif')
                || strpos($companylogo, '.jpeg')
                || $companylogo==""
            ) :
            ?>
                <div class="wk_seller_image1">
                    <?php if ($companylogo) {?>
                        <img class="wk_prof_img<?php echo $class_sfx ?>" src="<?php
                        echo JUri::root().$companylogo;
                        ?>" />
                    <?php } elseif ($gender=='male') {?>
                            <img class="wk_prof_img<?php echo $class_sfx?>" src="components/com_marketplace/images/genric-male.png" />
                    <?php } elseif ($gender=='female') {?>
                            <img class="wk_prof_img<?php echo $class_sfx ?>" src="components/com_marketplace/images/genric-female.png" />
                    <?php } else { ?>
                            <img class="wk_prof_img<?php echo $class_sfx ?>" src="components/com_marketplace/images/genric-male.png" />
                    <?php } ?>
                </div>
            <?php
            endif;
            ?>
            <div class="wk_sell_prof_info<?php echo $class_sfx;?>">
                    <p style="word-wrap:break-word;">
    <?php
    if ($gender=='male') {
            echo "Mr. ";
    } elseif ($gender=='female') {
            echo"Ms. ";
    } else {
            echo "";
    }
    echo $screenname;?>
    </p>
    <input style="max-width:150px;" type="button" id="follow" name="flw" class="btn btn-primary" value="<?php
    if ($follow==0||$seller_id==$user->id) {
            echo JText::_('FOL_OW');
    } else {
            echo JText::_('UNFOL_OW');
    }?>">
                    </div>
        </div>
        <div class="wk_prof_links_seller">
    <?php
    $follow_url = 'index.php?option=com_marketplace&view=follow&sel_id='.$seller_id.'&Itemid='.$followMenuId;
    ?>
    <a class="wk_fol pa cursor fa fa-user-plus" href="<?php echo
    JRoute::_($follow_url, false);
    ?>">&nbsp;&nbsp;&nbsp;<?php echo JText::_('FOL_RS')?>
    (<span class="wk_foll"><?php echo $foll_count?></span>)</a>
        <a class="wk_con pa cursor fa fa-envelope">&nbsp;&nbsp;&nbsp;<?php echo JText::_('CONTACT_LNK');?></a>
            <div class="wk_prof_sel_products">
                    <div class="wk_prof_seller_d">
                        &nbsp;&nbsp;
                        <a class="wk_prof_cnt wk_phone" rel="phone" title="Phone">
                        <i class="fa fa-phone fa-6"></i>
                        </a>&nbsp;
                        <a class="wk_prof_cnt wk_email" rel="email" title="Email">
                        <i class="fa fa-envelope fa-6"></i>
                        </a>&nbsp;
                        <a class="wk_prof_cnt wk_social" rel="social" title="Social">
                        <i class="fa fa-share-alt fa-6"></i>
                        </a>&nbsp;
    <?php
    $jinput=JFactory::getApplication()->input;
    $view=$jinput->get('view');
    $option=$jinput->get('option');
    JText::script("GET");
    if ($option=='com_marketplace'&&$view!='profile') {
    ?>
            <a class="wk_prof_cnt wk_map" rel="map" title="Location">
                    <i class="fa fa-map-marker fa-6"></i>
    <?php
    }
    ?>
                    </a>
            </div>
                    <div id="wk_phone" class="wk_prof_detail<?php echo $class_sfx;?>">
                        <label><b><?php echo JText::_('PHONE'); ?></b>:</label>
                        <p>
                            <?php echo $sellInfo->phone;?>
                        </p>
                    </div>
                    <div id="wk_email" class="wk_prof_detail<?php echo $class_sfx;?>">
                        <label><b><?php echo JText::_('EMAIL'); ?></b>:</label>
                        <p>
                            <?php echo $user->email;?>
                        </p>
                    </div>
                    <div id="wk_social" class="wk_prof_detail<?php echo $class_sfx;?>">
                    <?php
                    if ($social_mode!='') {
                        $soc_mod=explode(',', $social_mode);
                        $soc_id=explode(',', $social_id);
                        $social_str='';
                        if (isset($soc_id[0]) && strlen(trim($soc_id[0]))) {
                            $social_str.='<span><a class="wk_prof_cnt" href="//www.facebook.com/'.
                            $soc_id[0].
                            '" target="blank"><label><i class="fa fa-facebook fa-6"></i></label></a></span>';
                        }
                        if (isset($soc_id[1])&& strlen(trim($soc_id[1]))) {
                            $social_str.='<span><a class="wk_prof_cnt" href="//twitter.com/'.
                            $soc_id[1].
                            '" target="blank"><label><i class="fa fa-twitter fa-6"></i></label></a></span>';
                        }
                        if (isset($soc_id[2])&& strlen(trim($soc_id[2]))) {
                            $social_str.='<span><a class="wk_prof_cnt" href="//plus.google.com/'.
                            $soc_id[2].
                            '" target="blank"><label><i class="fa fa-google-plus fa-6"></i></label></a></span>';
                        }
                        if (isset($soc_id[3])&& strlen(trim($soc_id[3]))) {
                            $social_str.='<span><a class="wk_prof_cnt" href="//www.linkedin.com/'.
                            $soc_id[3].
                            '" target="blank"><label><i class="fa fa-linkedin fa-6"></i></label></a></span>';
                        }
                        echo $social_str;
                    }
                    ?></div>
                    <div id="wk_map" class="wk_prof_detail<?php echo $class_sfx;?>">
                    <label><b>
                    <?php echo JText::_('LOCATION');?>
                    </b>:&nbsp;&nbsp;&nbsp;&nbsp;</label>
                        <p>
                            <?php echo trim($seller_address);?>
                        </p>
                        <label><b><?php echo JText::_('SHOP_ADDR');?></b></label>
                        <p id="wk_shop_add"></p>
                        <div style="height:200px;width:auto;" id="mapcanvas<?php echo $class_sfx;?>"></div>
                    </div>
                </div>
        </div>
        <script type="text/javascript">
            jQuery(document).ready(function() {
                var i = 0;
                jQuery(".wk_prof_blk<?php echo $class_sfx;?> .wk_con").click(function() {
                    if (jQuery(this).next().find(".wk_prof_seller_d").css("display") == "none")
                        jQuery(this).next().find(".wk_prof_seller_d").show();
                    else {
                        jQuery(this).next().find(".wk_prof_seller_d").hide();
                        jQuery(this).parent().parent().find("#wk_email").hide();
                        jQuery(this).parent().parent().find("#wk_social").hide();
                        jQuery(this).parent().parent().find("#wk_map").hide();
                        jQuery(this).parent().parent().find("#wk_phone").hide();
                    }
                });
                jQuery(".wk_prof_blk<?php echo $class_sfx;?> .wk_phone").click(function() {
                    if (jQuery(this).parent().parent().find("#wk_phone").css("display") == "none") {
                        jQuery(this).parent().parent().find("#wk_phone").show();
                        jQuery(this).parent().parent().find("#wk_email").hide();
                        jQuery(this).parent().parent().find("#wk_social").hide();
                        jQuery(this).parent().parent().find("#wk_map").hide();
                    } else
                        jQuery(this).parent().parent().find("#wk_phone").hide();
                });
                jQuery(".wk_prof_blk<?php echo $class_sfx;?> .wk_email").click(function() {
                    if (jQuery(this).parent().parent().find("#wk_email").css("display") == "none") {
                        jQuery(this).parent().parent().find("#wk_email").show();
                        jQuery(this).parent().parent().find("#wk_social").hide();
                        jQuery(this).parent().parent().find("#wk_map").hide();
                        jQuery(this).parent().parent().find("#wk_phone").hide();
                    } else
                        jQuery(this).parent().parent().find("#wk_email").hide();
                });
                jQuery(".wk_prof_blk<?php echo $class_sfx;?> .wk_social").click(function() {
                    if (jQuery(this).parent().parent().find("#wk_social").css("display") == "none") {
                        jQuery(this).parent().parent().find("#wk_social").show();
                        jQuery(this).parent().parent().find("#wk_email").hide();
                        jQuery(this).parent().parent().find("#wk_map").hide();
                        jQuery(this).parent().parent().find("#wk_phone").hide();
                    } else
                        jQuery(this).parent().parent().find("#wk_social").hide();
                });
                var i <?php echo $class_sfx;?> = "0";
                jQuery(".wk_prof_blk<?php echo $class_sfx;?> .wk_map").click(function() {
                    if (i <?php echo $class_sfx;?> == 0) {
                        wk_initialize <?php echo $class_sfx;?> ();
                        i <?php echo $class_sfx;?> = "1";
                    }
                    i++;
                    if (jQuery(this).parent().parent().find("#wk_map").css("display") == "none") {
                        jQuery(this).parent().parent().find("#wk_map").show();
                        jQuery(this).parent().parent().find("#wk_email").hide();
                        jQuery(this).parent().parent().find("#wk_social").hide();
                        jQuery(this).parent().parent().find("#wk_phone").hide();
                    } else
                        jQuery(this).parent().parent().find("#wk_map").hide();
                });
                jQuery('.wk_prof_blk<?php echo $class_sfx;?> #follow').on('click', function() {
                    var uemail = "<?php echo JFactory::getUser()->id?>";
                    var seller = '<?php echo $seller_id;?>';
                    var buyer_id = '<?php echo $user->id;?>';
                    var count = "<?php echo $follow ?>";

                    if (uemail == 0) {
                        swal({
                            title: "<?php echo JText::_("LOGIN_FIRST");?>",
                            text: "",
                            type: "error",
                            timer: 12000
                        });
                    }
                    else if(buyer_id == seller) {
                        swal({
                            title: "<?php echo JText::_("CANNOT_FOLLOW_HIMSELF");?>",
                            text: "",
                            type: "error",
                            timer: 12000
                        });
                    } else {
                        jQuery.ajax({   
                            url: '<?php echo JRoute::_("index.php?option=com_marketplace&view=follow&task=follow.checkFollower", false) ?>',
                            type: 'POST',
                            data: {
                                seller: seller,
                                buyer_id: <?php echo $user->id?>
                            },
                            success: function(data) {
                                if (data == 1) {
                                    swal({
                                        title: "<?php echo JText::_("SUCCESS_FOLLOW");?>",
                                        text: "",
                                        type: "success",
                                        timer: 12000
                                    });
                                    jQuery(".wk_prof_blk<?php echo $class_sfx;?> #follow").val("<?php echo JText::_('UNFOL_OW')?>");
                                    jQuery('.wk_foll').text(parseInt(jQuery('.wk_foll').text()) + 1);
                                } else {
                                    swal({
                                        title: "<?php echo JText::_("SUCCESS_UNFOLLOW");?>",
                                        text: "",
                                        type: "success",
                                        timer: 12000
                                    });
                                    jQuery(".wk_prof_blk<?php echo $class_sfx;?> #follow").val("<?php echo JText::_('FOL_OW')?>");
                                    jQuery('.wk_foll').text(parseInt(jQuery('.wk_foll').text()) - 1);
                                }
                            }
                        });
                    }
                });
            });
            var wk_geocoder;

            function wk_initialize <?php echo $class_sfx;?> () {
                wk_geocoder = new google.maps.Geocoder();
                var wk_mapProp <?php echo $class_sfx;?> = {
                    center: new google.maps.LatLng("<?php echo $loc[0]; ?>", "<?php echo $loc[1]; ?>"),
                    zoom: 10,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };
                var wk_map <?php echo $class_sfx;?> = new google.maps.Map(
                    document.getElementById("mapcanvas<?php echo $class_sfx;?>"),
                    wk_mapProp <?php echo $class_sfx;?>
                );
                var wk_marker <?php echo $class_sfx;?> = new google.maps.Marker({
                    position: new google.maps.LatLng("<?php echo $loc[0]; ?>", "<?php echo $loc[1]; ?>"),
                    map: wk_map <?php echo $class_sfx;?>,
                    title: '<?php echo $screenname;?>\'s shop location'
                });
                wk_geocodePosition(wk_marker <?php echo $class_sfx;?>.getPosition());
            }

            function wk_geocodePosition(pos) {
                wk_geocoder.geocode({
                    latLng: pos
                }, function(responses) {

                    if (responses && responses.length > 0) {
                        var html_a = '<a target="blank" class="dir_butt" href="https://www.google.com/maps/dir//'+pos+'">';
                        html_a += Joomla.JText._('GET')+'</a>';
                        jQuery(" #wk_shop_add").html(responses[0].formatted_address+html_a);
                    } else {
                        jQuery("#wk_shop_add").html('Cannot determine address at this location.');
                    }
                });
            }
        </script>
        <style type="text/css">
            #wk_social > span {
                float: left;
                width: 24%;
                clear: right;
            }
            .dir_butt {
                display: block;
                padding: 5px 2px;
                color: black;
                margin: 2px;
                border: 1px solid #ccc;
                text-align: center;
                background: #E9E6E0;
                border-radius: 3px;
            }
            .wk_prof_seller_d,
            .wk_prof_detail<?php echo $class_sfx;?> {
                display: none;
            }
            
            #wk_social {
                overflow: hidden;
                text-align: center;
                color: gray;
            }
            
            #map-canvas {
                height: 200px;
            }
            
            .wk_prof_links_seller {
                cursor: pointer;
                width: 100%;
                position: relative;
                display: block;
            }
            
            .wk_prof_links_seller a {
                text-decoration: none;
            }
            
            .wk_fol,
            .wk_con {
                display: block!important;
                font-size: 15px!important;
                margin: 5px;
            }
            
            .wk_phone i,
            .wk_email i,
            .wk_map i,
            .wk_social i {
                font-size: 13px!important;
            }
            
            a label i {
                font-size: 12px!important;
            }
            
            .wk_prof_blk<?php echo $class_sfx;
            ?> {
                border: 1px solid #ccc;
                border-radius: 5px;
                padding: 10px;
            }
            
            .wk_prof_img<?php echo $class_sfx;
            ?> {
                border: 0 none;
                float: left;
                height: inherit;
                max-width: 100%;
                height: 140px;
                vertical-align: middle;
            }
            
            .wk_sell_prof_info<?php echo $class_sfx;
            ?> {
                display: inline-block;
                text-align: left;
                width: 100%;
            }
        </style>
<?php
        } else {
            echo JText::_('NO_SELL');
        }
?>
</div>