<div class="content_title"><a href="/master/domains">Domeny</a> > statystyki odsłon stron</div>
<div>
    <div style="float:left;"><?php $this->load->view('admin/switch_domain');?></div>
    <?php $domain_id = (int)$this->uri->segment(3); ?>
    <div style="float:right;">
        <a title="pozycje w google" href="/master/domain_positions/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="pozycje w google" src="/files/opcja1.gif">
        </a>&nbsp;
        <a title="wykresy pozycji w google" href="/master/domain_positions_charts/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="wykresy pozycji w google" src="/files/opcja2.gif">
        </a>
        <a title="statystyki odsłon strony" href="/master/domain_visits_charts/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="statystyki odsłon strony" src="/files/opcja3.gif">
        </a>
        <a title="szczegółowe statystyki odsłon strony" href="/master/domain_visits/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="szczegółowe statystyki odsłon strony" src="/files/opcja4.gif">
        </a>
    </div>
</div>
<br class="clear"/>
<?php

	$kategoriaId = (int)$this->uri->segment('4');
	if($kategoriaId == 0)
		$kategoriaId = 1;
	
?>

<div class="mediumButton"><a class="gray_link" <?php if($kategoriaId==1) echo 'style="color:#ec2323"'; ?> href="/master/domain_visits_charts/<?php echo $domain_id; ?>/1">dzienne</a></div>
<div class="mediumButton"><a class="gray_link" <?php if($kategoriaId==2) echo 'style="color:#ec2323"'; ?> href="/master/domain_visits_charts/<?php echo $domain_id; ?>/2">tygodniowe</a></div>
<div class="mediumButton"><a class="gray_link" <?php if($kategoriaId==3) echo 'style="color:#ec2323"'; ?> href="/master/domain_visits_charts/<?php echo $domain_id; ?>/3">miesięczne</a></div>
<div class="mediumButton"><a class="gray_link" <?php if($kategoriaId==4) echo 'style="color:#ec2323"'; ?> href="/master/domain_visits_charts/<?php echo $domain_id; ?>/4">roczne</a></div>
<br /><br />


<!-- KALENDARZ -->
<?php
	switch($type)
					{
					    case 1: {
					    			// "Dzienne"; 
										$year = date("Y");
										$month = date("m");
										$day = date("d");
										
										if($this->uri->segment(5) != null)
										{
											$year = $this->uri->segment(5);
										}
										
										if($this->uri->segment(6) != null)
										{
											$month = $this->uri->segment(6);
										}
										if($this->uri->segment(7) != null)
										{
											$day = $this->uri->segment(7);
										}
											
										for($i=1;$i<32;$i++)
										{
											$j=$i;
											if($i<10) $j='0'.$i;
											$data[$i] = '/master/domain_visits_charts/'.$domain_id.'/'.$type.'/'.$year.'/'.$month.'/'.$j.'';
										}
										
										echo $this->calendar->generate($year, $month,$data);
										
										echo br(2);
									   ///echo '<img src="/charts/chart_stat/'.$domain_id.'/'.$type.'/'.$year.'/'.$month.'/'.$day.'" />';
									   	echo '<div id="my_chart1">charts/flash_chart_stat/'.$domain_id.'/'.$type.'/'.$year.'/'.$month.'/'.$day.'</div><br/>';
										//echo '<img src="/charts/chart_stat_uniq/'.$domain_id.'/'.$type.'/'.$year.'/'.$month.'/'.$day.'" />';
										echo '<div id="my_chart2">charts/flash_chart_stat_uniq/'.$domain_id.'/'.$type.'/'.$year.'/'.$month.'/'.$day.'</div><br/>';
										echo br();
										//echo '<img src="/charts/chart_stat_returning/'.$domain_id.'/'.$type.'/'.$year.'/'.$month.'/'.$day.'" />';
										echo '<div id="my_chart3">charts/flash_chart_stat_returning/'.$domain_id.'/'.$type.'/'.$year.'/'.$month.'/'.$day.'</div>';
										
									
									break;
								}
					    case 2: {
					    			// "Tygodniowe"; 
																	
									if(@$_POST['year']!=null)
									{
										$this->session->set_userdata('rok', $_POST['year']);
										$rok = $this->session->userdata['rok'];
									}
									else 
									{
										if (!isset($this->session->userdata['rok']))
										{
											$actual_year = date("Y");
											$this->session->set_userdata('rok', $actual_year);
											$rok = $this->session->userdata['rok'];
										} $rok = $this->session->userdata['rok'];
									}
								 	
									echo '<br /><b>Ustaw rok</b><br />';
									echo '<form action="/master/domain_visits_charts/'.$domain_id.'/2" method="post">';
									echo '<table cellspacing="6">';
									echo '<tr><td>';
									echo '<select name="year">';
										  $cur_year = date("Y");
										  $roz = $cur_year - 2007;
										  for($i=$roz; $i>=0;$i--)
										  {								  	
											echo '<option value="'.$cur_year.'"'; 
											if ($rok==$cur_year) echo 'selected="selected"'; 
											echo '>'.$cur_year.'</option>';
											$cur_year--;
										  } 
									echo '</select>';
									echo '</td><td>';
									echo '<input type="submit" class="grey_button round_corners" value="wybierz" />';
									echo '</td></tr></table>';	 
									echo '</form>';
									echo '<br/>Wybierz tydzień z roku: <b>'.$rok.'</b>';
									echo br();
									
									if($this->uri->segment(5) != null)
									{
										$week = $this->uri->segment(5);
									}else  $week = date("W",time()); 
																			 				
									$weeks_in_year = strftime("%W",strtotime("12/31/".$rok));

                                    echo '<p>';
                                        for($i=1;$i<=$weeks_in_year;$i++)
                                        {
                                            echo '<a class="week_link" href="/master/domain_visits_charts/'.$domain_id.'/2/'.$i.'/'.$rok.'"/>'.$i.'</a>&nbsp;';
                                            if(($i%10==0)) echo '<br class="spacer"/>';
                                        }
									echo '</p>';
									echo br(2);
									    //echo '<img src="/charts/chart_stat_weekly/'.$domain_id.'/2/'.$week.'/'.$rok.'" />';
										echo '<div id="my_chart1">charts/flash_chart_stat_weekly/'.$domain_id.'/2/'.$week.'/'.$rok.'</div><br/>';
										//echo '<img src="/charts/chart_stat_uniq_weekly/'.$domain_id.'/2/'.$week.'/'.$rok.'" />';
										echo '<div id="my_chart2">charts/flash_chart_stat_uniq_weekly/'.$domain_id.'/2/'.$week.'/'.$rok.'</div><br/>';
										echo br();
										//echo '<img src="/charts/chart_stat_returning_weekly/'.$domain_id.'/2/'.$week.'/'.$rok.'" />';
										echo '<div id="my_chart3">charts/flash_chart_stat_returning_weekly/'.$domain_id.'/2/'.$week.'/'.$rok.'</div>';
										
										
												//echo '<img src="/charts/chart_stat_all_returning_weekly/'.$domain_id.'/2/'.$week.'/'.$rok.'" />';
									break;
								}
					    case 3: {
					    			// "Miesieczne";
									if(@$_POST['year']!=null)
									{
										$this->session->set_userdata('rok', $_POST['year']);
										$rok = $this->session->userdata['rok'];
									}
									else 
									{
										if (!isset($this->session->userdata['rok']))
										{
											$actual_year = date("Y");
											$this->session->set_userdata('rok', $actual_year);
											$rok = $this->session->userdata['rok'];
										} $rok = $this->session->userdata['rok'];
									}
									
									echo '<br/><b>Ustaw rok</b><br />';
									echo '<form action="/master/domain_visits_charts/'.$domain_id.'/3" method="post">';
									echo '<table cellspacing="6">';
									echo '<tr><td>';									
									echo '<select name="year">';
											$cur_year = date("Y");
											  $roz = $cur_year - 2007;
											  for($i=$roz; $i>=0;$i--)
											  {								  	
												echo '<option value="'.$cur_year.'"'; 
												if ($rok==$cur_year) echo 'selected="selected"'; 
												echo '>'.$cur_year.'</option>';
												$cur_year--;
											  } 
									echo '</select>';
									echo '</td><td>';										 
									echo '<input type="submit" class="grey_button round_corners" value="wybierz" />';
									echo '</td></tr></table>';	 
									echo '</form>';									
									echo '</form>';
									echo '<br/>Wybierz miesiąc: ';
									echo br();
									
									$months = array('styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec','sierpień','wrzesień','październik','listopad','grudzień');
									//date('F',mktime(0,0,0,$i))
									//echo '<select id="month" name="month">';
    								for ($i = 1; $i <= 12; $i++)
									{
      									echo '<a class="month_link" href="/master/domain_visits_charts/'.$domain_id.'/3/';
										if ($i<10) echo '0';
                                            echo $i.'/'.$rok.'"/>'.$months[$i-1].'</a>&nbsp;';

                                        if(($i%6==0))
                                            echo '<br class="spacer"/>';
									//echo '</select>';
									}
									
									if($this->uri->segment(5) != null)
									{
										$week = $this->uri->segment(5);
									}else  $week = date("m",time()); 
																			 				
									//$weeks_in_year = strftime("%W",strtotime("12/31/".$rok));
									
									echo br(2);
								    //echo '<img src="/charts/chart_stat_monthly/'.$domain_id.'/3/'.$week.'/'.$rok.'" />';
									echo '<div id="my_chart1">charts/flash_chart_stat_monthly/'.$domain_id.'/3/'.$week.'/'.$rok.'</div><br/>';
									//echo '<img src="/charts/chart_stat_monthly_uniq/'.$domain_id.'/3/'.$week.'/'.$rok.'" />';
									echo '<div id="my_chart2">charts/flash_chart_stat_monthly_uniq/'.$domain_id.'/3/'.$week.'/'.$rok.'</div>';
									echo br();
									break;
								}
					    case 4: {
					    			// "Roczne";
									
									$rok = date("Y");
									
									
									echo br(2);
								    //echo '<img src="/charts/chart_stat_yearly/'.$domain_id.'/4/'.$rok.'" />';
									echo '<div id="my_chart1">charts/flash_chart_stat_yearly/'.$domain_id.'/4/'.$rok.'</div><br/>';
									//echo '<img src="/charts/chart_stat_yearly_uniq/'.$domain_id.'/4/'.$rok.'" />';
									echo '<div id="my_chart2">charts/flash_chart_stat_yearly_uniq/'.$domain_id.'/4/'.$rok.'</div><br/>';
									echo br();
									break;
								}
					}

?>
<!-- END OF KALENDARZ-->

<br /><br />
Kod licznika odwiedzin dla tej domeny
<br /><br />
<textarea cols="70" rows="10"><!-- stats networds -->
<script type="text/javascript">
	<!--
	var project=<?php echo $domain_id; ?>;
	document.write('<SCR' + 'IPT LANGUAGE="JavaScript" SRC="http://stat.networds.datatask.net/stats.js"><\/SCR' + 'IPT>');
	//-->
</script>
	<!-- stats networds -->
</textarea>
<br style="clear:both"/>
<br/>
<div class="formHr">&nbsp;</div>
<div class="form_buttons_v1">
    <input type="button" name="wstecz" value="Wstecz" class="formButton" onClick="document.location.href='<?php echo base_url();?>master/domains';"/>
</div>

<script type="text/javascript">
	function ofc_ready()
	{
	   // alert('ofc_ready');
	}
	var data = null;
	
	function open_flash_chart_data()
	{
	    //alert( 'reading data' );
	    return JSON.stringify(data);
	}
	
	function findSWF(movieName) {
	  if (navigator.appName.indexOf("Microsoft")!= -1) {
	    return window[movieName];
	  } else {
	    return document[movieName];
	  }
	}
		
      $(document).ready(function() {
	  	getChart1();
		
		function getChart1(){
            var querystring = $("#my_chart1").text();
            if(querystring.length > 0)
            {
                var url = "<?php echo base_url(); ?>" + $("#my_chart1").text();
                $.getJSON(url, function(param){
                    data = param;
                    swfobject.embedSWF("/files/open-flash-chart.swf", "my_chart1", "595", "350", "9.0.0");
                    getChart2();
                });
            }
		}
		
		function getChart2(){
            var querystring = $("#my_chart2").text();
            if(querystring.length > 0)
            {
                var url2 = "<?php echo base_url(); ?>" + $("#my_chart2").text();
                $.getJSON(url2, function(param){
                    data = param;
                    swfobject.embedSWF("/files/open-flash-chart.swf", "my_chart2", "595", "350", "9.0.0");
                    getChart3();
                });
            }
		}
		
		function getChart3(){

            var querystring = $("#my_chart3").text();
            if(querystring.length > 0)
                {
                var url3 = "<?php echo base_url(); ?>" +$("#my_chart3").text();
                $.getJSON(url3,
                        function(param){
                           data = param;
                           swfobject.embedSWF("/files/open-flash-chart.swf", "my_chart3", "595", "350", "9.0.0");
                        });
                }
		}					
		        		
      });
</script>