<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$language.lblAffiliate} : {$language.lblReferrals}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/colorbox.css"/>
<link rel="stylesheet" type="text/css" href="{$view_styles}/create-widget.css"/>
<script type="text/javascript" src="{$view_javascript}/jquery.colorbox.js"></script>
</head><body>
<!-- Outer container starts-->
<div class="outer_container"> 
  <!-- Header Container starts--> 
  {include file='CommonTop.tpl'} 
  <!-- Header Container ends--> 
  <!-- Content Container starts-->
  <div class="content_container2"> 
    <!-- left wrapper starts-->
    <div class="left_wrapper">
      <div class="content_wrapper">
        <h2>{$language.lblReferrals}</h2>
        <!-- Inner Content Container starts-->
        <div id="common_message" ></div>
        {if $referralEnable eq 'Yes'}
        <div class="referal-block">
          <center>
            {$language.lblReferralLink}
          </center>
          <div class="referal-linkblock curve-10"> <span class="border-4 curve-10"><span class="border-3 curve-10"><span class="border-2 curve-10"><span class="border-1 curve-10"> {form->textbox name="affiliateRefLink" value=$referralLink class="referal-link-txt curve-10" autocomplete="off"} </span></span></span></span> </div>
          <div class="share-section">
            <ul class="clearfix">
              {if $settingsEnableFacebook eq 'Yes'}
              <li><a href="javascript:void(0)" class="fb" id="facebookShare" title="{$language.lblShare}" rel="{$referralFacebookMessage}">{$language.lblFacebook}</a> </li>
              {/if} 
              {if $settingsEnableTwitter eq 'Yes'}
              <li><a href="javascript:void(0)" class="tweet" id="twitterShare" title="{$language.lblShare}" rel="{$referralTweetMessage}">{$language.lblTwitter}</a> </li>
              {/if} 
              {if $settingsEnableGooglePlus eq 'Yes'}
              <li><a href="javascript:void(0)" class="google" id="googlePlusShare" title="{$language.lblShare}">{$language.lblGooglePlus}</a> </li>
              {/if} 
              {if $settingsEnablePinterest eq 'Yes'}
              <li><a href="javascript:void(0)" class="print" id="pinitShare" title="{$language.lblShare}" rel="{$referralPinterestMessage}">{$language.lblPinit}</a> </li>
              {/if}
              <li><a class="mail" href="{$siteUrl}/affiliate/referrals/email/"  title="" id="referalEmail">{$language.lblEmail}</a> </li>
            </ul>
          </div>
          <!--End:Share section--> 
        </div>
        {/if}
        <!--End:Referal Block--> 
        {if ($resReferrals)} <a href="export/1/" class=" link-style01 fixing_right">{$language.lblExportToCsv}</a><span   style=" float:right;">&nbsp; | &nbsp;</span> {html->anchor href="referrals/" class="link-style01  fixing_right" caption=$language.lblResetFields}
        <div class="clear"></div>
        <div class="grid01"> {if $sortkey=="asc"}
          {assign var="sortimg" value="sortdesc"} 
          {else}  
          {assign var="sortimg" value="sortasc"}
          {/if}
          {if $sortkey1=="asc"}
          {assign var="sortimg1" value="sortdesc"} 
          {else}  
          {assign var="sortimg1" value="sortasc"}
          {/if}
          {if $sortkey2=="asc"}
          {assign var="sortimg2" value="sortdesc"} 
          {else}  
          {assign var="sortimg2" value="sortasc"}
          {/if}
          {if $sortkey3=="asc"}
          {assign var="sortimg3" value="sortdesc"} 
          {else}  
          {assign var="sortimg3" value="sortasc"}
          {/if}
          {if $sortkey4=="asc"}
          {assign var="sortimg4" value="sortdesc"} 
          {else}  
          {assign var="sortimg4" value="sortasc"}
          {/if}
         
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="grid_table01">
            <thead>
              <tr>
                <th align="left" valign="middle"   {if $sortkey!=""}class={$sortimg}{else}class="sort" {/if} >{html->anchor href="/referrals/sortby/date/orderby/{if $sortkey==''}desc{else}{$sortkey}{/if}/" title=$language.lbldate content=$language.lbldate}</th>
                <th align="left" valign="middle"   {if $sortkey1!=""}class={$sortimg1}{else}class="sort" {/if} >{html->anchor href="/referrals/sortby/subscription/orderby/{if $sortkey1==''}desc{else}{$sortkey1}{/if}/" title=$language.lblSubscriptions content=$language.lblSubscriptions}</th>
              
                
                <th align="left" valign="middle"   {if $sortkey2!=""}class={$sortimg2}{else}class="sort" {/if} >{html->anchor href="/referrals/sortby/registration/orderby/{if $sortkey2==''}desc{else}{$sortkey2}{/if}/" title=$language.lblRegistrations content=$language.lblRegistrations}</th>
               
                <th align="left" valign="middle"   {if $sortkey3!=""}class={$sortimg3}{else}class="sort" {/if} >{html->anchor href="/referrals/sortby/orders/orderby/{if $sortkey3==''}desc{else}{$sortkey3}{/if}/" title=$language.lblOrders content=$language.lblOrders}</th>
                <th align="left" valign="middle"   {if $sortkey4!=""}class={$sortimg4}{else}class="sort" {/if} >{html->anchor href="/referrals/sortby/revenue/orderby/{if $sortkey4==''}desc{else}{$sortkey4}{/if}/" title=$language.lblRevenue content=$language.lblRevenue}</th>
              </tr>
            </thead>
            <tbody>
            {foreach from=$resReferrals item="resReferral" key="key1"}
            <tr>
              <td align="left" valign="middle">{$resReferral.createdDate|date_format:$settingsDateFormat} <br /></td>
              
              <td align="left" valign="middle">{$resReferral.countOfSubscription} </td>
             
              <td align="left" valign="middle">{$resReferral.countOfRegistration}</td>
             
              <td align="left" valign="middle">{$resReferral.countOfOrder} </td>
              <td align="left" valign="middle">{$resReferral.revenue|price}</td>
            </tr>
            {/foreach}
              </tbody>
          </table>
        </div>
        <br />
        <div class="pagination_outer fixing_right">{paginate->layout  key="page" label_record="{$language.lblRecorsFound}" label_pages="{$language.lblPages}"}</div>
        <div class="clear"></div>
        {else}
        <div class="clear"></div>
        <div class="grid01 message_info">{$language.msgNoRecords}</div>
        {/if} 
        <!-- Inner Content Container ends-->
        <div class="clear"></div>
      </div>
    </div>
    <!-- left wrapper ends--> 
    <!-- right side bar starts-->
    <div class="right-sidebar">
      <div class="side_wrapper"> {html->anchor class="create-widjet" href="/widget/create/" content="<span class='plus-v'></span><span class='plus-h'></span><strong>"|cat:$language.lblCreateWidget|cat:"</strong>"} 
        <!-- right side menu starts--> 
        {include file="WidgetManagementSideMenu.tpl"} 
        <!-- right side menu ends--> 
      </div>
    </div>
    <!-- right side bar ends-->
    <div class="clear"></div>
  </div>
  <!-- Content Container ends--> 
  <!-- Footer starts--> 
  {include file='CommonBottom.tpl'} 
  <!-- Footer ends--> 
</div>
<script type="text/javascript" src="{$view_javascript}/message.plugin.js"></script> 
{html->messages_script id="common_message"} 
<script>
var shareUrl = $("#affiliateRefLink").val();
$(document).ready(function(e) {
{literal}	
$("#referalEmail").click(function(){
	$('#referalEmail').colorbox({iframe:true,fastIframe:false,innerWidth:550,innerHeight:450,transition:"none",onComplete:function(){
		var iframe = $("iframe.cboxIframe");
		$.colorbox.resize({innerWidth: iframe.contents().width()+10,innerHeight: iframe.contents().height()+10 })
		}
	});
});
{/literal}
$('.side_menu').find("a[rel='referrals']").addClass('selected').removeBorder();;
$('.main_menu').find("a[rel='manageWidget']").addClass('active');
$(document).on("click","#facebookShare",function(){
var desc = $(this).attr("rel");
var title = '{$language.lblProductsFrom}{$commonSiteName}';	
var imageurl = '{$settingsCompanyLogo}';	
fbShare(shareUrl,title,desc,imageurl);	
});
$(document).on("click","#twitterShare",function(){
var title = $(this).attr("rel");
twitterShare(shareUrl,title);	
});
$(document).on("click","#googlePlusShare",function(){
googlePlusShare(shareUrl);	
});
$(document).on("click","#pinitShare",function(){
var imageurl = '{$settingsPinterestImage}';	
var title = $(this).attr("rel");
title = title + " " + shareUrl;
pinterestShare(shareUrl,imageurl,title);
});
$('#affiliateRefLink').click(function () {
	this.select();
});
});
function fbShare(url,title,desc,imageurl) {	
	var randomVar = Math.floor((Math.random()*99999999)+1);
	var d=document;
	var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=Math.round((C/2)-(A/2));
	var urlshare = encodeURIComponent(url)
	var titleshare = encodeURIComponent(title)
	var descshare = encodeURIComponent(desc)
	var imageshare = encodeURIComponent(imageurl)
	urlshare = urlshare+decodeURIComponent('%26')
	titleshare = titleshare+decodeURIComponent('%26')
	descshare = descshare+decodeURIComponent('%26')
	imageshare = imageshare+decodeURIComponent('%26')	
	var s = encodeURIComponent('100')
	s=s+decodeURIComponent('%26')		
	window.open('http://www.facebook.com/sharer.php?s='+s+'p[title]='+titleshare+'p[summary]='+descshare+'p[url]='+urlshare+'p[images][0]='+imageshare+'?'+randomVar, 'sharer','left='+H+',top='+G+',width='+D+',height='+A+',toolbar=0,status=0,resizable=1')
}
function twitterShare(url,txt){	
	var randomVar = Math.floor((Math.random()*99999999)+1);
	var d=document;
	var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=Math.round((C/2)-(A/2));
	var f='http://twitter.com/share?url='+encodeURIComponent(url)+'&text='+encodeURIComponent(txt);
	window.open(f,'sharer','left='+H+',top='+G+',width='+D+',height='+A+',toolbar=0,status=0,resizable=1');
}
function googlePlusShare(url)
{
	var randomVar = Math.floor((Math.random()*99999999)+1);
	var d=document;
	var D=600,A=500,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=Math.round((C/2)-(A/2));
	var f='https://plus.google.com/share?url='+encodeURIComponent(url);
	window.open(f,'sharer','left='+H+',top='+G+',width='+D+',height='+A+',toolbar=0,status=0,resizable=1');
}
function pinterestShare(url,image,text)
{
	var randomVar = Math.floor((Math.random()*99999999)+1);
	var d=document;
	var D=700,A=500,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=Math.round((C/2)-(A/2));
	var f='http://pinterest.com/pin/create/button/?url='+encodeURIComponent(url)+'&media='+encodeURIComponent(image)+'&description='+encodeURIComponent(text);
	window.open(f,'sharer','left='+H+',top='+G+',width='+D+',height='+A+',toolbar=0,status=0,resizable=1');
}

</script>
</body>
</html>
