Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
$borderCollapseVal = $pdfVersion ? "border-collapse: collapse;" : "";
3
 
4
if(!$summaryPage && (!empty($printVersion) || !empty($pdfVersion))) {
5
    $pdfVersion ? showPdfHeader($spTextTools['Website Analytics Summary']) : showPrintHeader($spTextTools['Website Analytics Summary']);
6
    ?>
7
    <table width="80%" class="search">
8
    	<?php if (!empty($websiteId)) {?>
9
    		<tr>
10
    			<th><?php echo $spText['common']['Website']?>:</th>
11
        		<td>
12
        			<?php echo $websiteList[$websiteId]['url']; ?>
13
    			</td>
14
    		</tr>
15
		<?php }?>
16
		<tr>
17
			<th><?php echo $spText['common']['Period']?>:</th>
18
    		<td>
19
    			<?php echo $fromTime?> - <?php echo $toTime?>
20
			</td>
21
		</tr>
22
	</table>
23
    <?php
24
} else {
25
    echo showSectionHead($spTextTools['Website Analytics Summary']);
26
 
27
    // if not summary page show the filters
28
    if(!$summaryPage) {
29
    	$scriptName = "analytics.php";
30
	    ?>
31
		<form id='search_form'>
32
		<?php $submitLink = "scriptDoLoadPost('analytics.php', 'search_form', 'content', '&sec=viewAnalyticsSummary')";?>
33
		<table class="search">
34
			<tr>
35
				<th><?php echo $spText['common']['Name']?>: </th>
36
				<td>
37
					<input type="text" name="search_name" value="<?php echo htmlentities($searchInfo['search_name'], ENT_QUOTES)?>" onblur="<?php echo $submitLink?>">
38
				</td>
39
				<th width="100px"><?php echo $spText['common']['Website']?>: </th>
40
				<td width="160px">
41
					<select name="website_id" id="website_id" style='width:100px;' onchange="<?php echo $submitLink?>">
42
						<option value="">-- <?php echo $spText['common']['Select']?> --</option>
43
						<?php foreach($websiteList as $websiteInfo){?>
44
							<?php if($websiteInfo['id'] == $websiteId){?>
45
								<option value="<?php echo $websiteInfo['id']?>" selected><?php echo $websiteInfo['name']?></option>
46
							<?php }else{?>
47
								<option value="<?php echo $websiteInfo['id']?>"><?php echo $websiteInfo['name']?></option>
48
							<?php }?>
49
						<?php }?>
50
					</select>
51
				</td>
52
				<th width="100px;"><?php echo $spText['common']['Period']?>:</th>
53
	    		<td width="236px">
54
	    			<input type="text" value="<?php echo $fromTime?>" name="from_time"/>
55
	    			<input type="text" value="<?php echo $toTime?>" name="to_time"/>
56
        			<script type="text/javascript">
57
        			$(function() {
58
        				$( "input[name='from_time'], input[name='to_time']").datepicker({dateFormat: "yy-mm-dd"});
59
        			});
60
        		  	</script>
61
	    		</td>
62
				<td><a href="javascript:void(0);" onclick="<?php echo $submitLink?>" class="actionbut"><?php echo $spText['button']['Search']?></a></td>
63
			</tr>
64
		</table>
65
		</form>
66
		<?php
67
    } else {
68
    	$scriptName = "archive.php";
69
    }
70
 
71
	// url parameters
72
	$mainLink = SP_WEBPATH."/$scriptName?sec=viewAnalyticsSummary&website_id=$websiteId&from_time=$fromTime&to_time=$toTime";
73
	$mainLink .= "&search_name=" . $searchInfo['search_name'] . "&report_type=analytics-reports";
74
 
75
	// if not summary page show the filters
76
	if(!$summaryPage) {
77
		$directLink = $mainLink . "&order_col=$orderCol&order_val=$orderVal&pageno=$pageNo";
78
		$pdfLink = "$directLink&doc_type=pdf";
79
		$csvLink = "$directLink&doc_type=export";
80
		$printLink = "$directLink&doc_type=print";
81
		showExportDiv($pdfLink, $csvLink, $printLink);
82
	}
83
 
84
	if (empty($pdfVersion) && empty($cronUserId)) echo $pagingDiv;
85
}
86
 
87
$baseColCount = count($metricColList);
88
$colCount = ($baseColCount * 3) + 2;
89
?>
90
<div id='subcontent' style="margin-top: 0px;">
91
 
92
<table id="cust_tab">
93
	<tr>
94
		<th id="head" rowspan="2"><?php echo $spText['common']['Website']?></th>
95
		<th id="head" rowspan="2"><?php echo $spText['common']['Source']?></th>
96
		<?php
97
		$hrefAttr = $pdfVersion ? "" : "href='javascript:void(0)'";
98
		foreach (array_keys($metricColList) as $i => $colName){
99
 
100
		    $linkClass = "";
101
            if ($colName == $orderCol) {
102
                $oVal = ($orderVal == 'DESC') ? "ASC" : "DESC";
103
                $linkClass .= "sort_".strtolower($orderVal);
104
            } else {
105
                $oVal = 'DESC';
106
            }
107
 
108
            $linkName = "<a id='sortLink' class='$linkClass' $hrefAttr onclick=\"scriptDoLoad('$mainLink&order_col=$colName&order_val=$oVal', 'content')\">$metricColList[$colName]</a>";
109
			?>
110
			<th colspan="3" id="head"><?php echo $linkName; ?></th>
111
			<?php
112
 
113
		}
114
		?>
115
	</tr>
116
	<tr>
117
		<?php
118
		$pTxt = str_replace("-", "/", substr($fromTime, -5));
119
		$cTxt = str_replace("-", "/", substr($toTime, -5));
120
		foreach ($metricColList as $colName => $colVal) {
121
			?>
122
			<th><?php echo $pTxt; ?></th>
123
			<th><?php echo $cTxt; ?></th>
124
			<th>+ / -</th>
125
			<?php
126
		}
127
		?>
128
	</tr>
129
	<?php
130
	if (count($baseReportList) > 0) {
131
		foreach($baseReportList as $listInfo){
132
			$sourceId = $listInfo['id'];
133
			$rangeFromTime = date('Y-m-d', strtotime('-14 days', strtotime($fromTime)));
134
			$scriptLink = "website_id={$listInfo['website_id']}&source_id={$listInfo['id']}&rep=1&from_time=$rangeFromTime&to_time=$toTime";
135
			$trClass = ($listInfo['source_name'] == 'total') ? "table-secondary" : "";
136
			$sourceName = ($listInfo['source_name'] == 'total') ? "<b>".$spText['common']['Total']."</b>" : $listInfo['source_name'];
137
			?>
138
			<tr class="<?php echo $trClass?>">
139
				<td>
140
					<a href="javascript:void(0)"><?php echo $websiteList[$listInfo['website_id']]['url']; ?></a>
141
				</td>
142
				<td><?php echo $sourceName; ?></td>
143
				<?php
144
				foreach ($metricColList as $colName => $colVal) {
145
					$currRank = isset($listInfo[$colName]) ? $listInfo[$colName] : 0;
146
					$prevRank = isset($compareReportList[$listInfo['website_id']][$listInfo['id']][$colName]) ? $compareReportList[$listInfo['website_id']][$listInfo['id']][$colName] : 0;
147
					$rankDiffTxt = "";
148
 
149
					// find rank difefrence
150
					$rankDiff = $currRank - $prevRank;
151
					$rankDiff = round($rankDiff, 2);
152
					if ($colName == 'bounceRate') $rankDiff = $rankDiff * -1;
153
 
154
					if ($rankDiff > 0) {
155
						$rankDiffTxt = "<font class='green'>($rankDiff)</font>";
156
					} else if ($rankDiff < 0) {
157
						$rankDiffTxt = "<font class='red'>($rankDiff)</font>";
158
					} else {
159
						$rankDiffTxt = "";
160
					}
161
 
162
					$prevRankLink = scriptAJAXLinkHrefDialog('analytics.php', 'content', $scriptLink . "&sec=viewAnalyticsReports", $prevRank);
163
					$currRankLink = scriptAJAXLinkHrefDialog('analytics.php', 'content', $scriptLink . "&sec=viewAnalyticsReports", $currRank);
164
					$graphLink = scriptAJAXLinkHrefDialog('analytics.php', 'content', $scriptLink . "&sec=viewAnalyticsGraphReports&attr_type=$colName", '&nbsp;', 'graphicon');
165
 
166
					// if pdf report remove links
167
					if ($pdfVersion) {
168
						$prevRankLink = str_replace("href='javascript:void(0);'", "", $prevRankLink);
169
						$currRankLink = str_replace("href='javascript:void(0);'", "", $currRankLink);
170
						$graphLink = str_replace("href='javascript:void(0);'", "", $graphLink);
171
					}
172
				    ?>
173
					<td><?php echo $prevRankLink; ?></td>
174
					<td><?php echo $currRankLink; ?></td>
175
					<td><?php echo $graphLink . " " . $rankDiffTxt; ?></td>
176
					<?php
177
				}
178
				?>
179
			</tr>
180
		<?php
181
		}
182
	} else {
183
	    ?>
184
	    <tr><td colspan="<?php echo $colCount?>"><b><?php echo $_SESSION['text']['common']['No Records Found']?></b></tr>
185
	    <?php
186
	}
187
	?>
188
</table>
189
</div>
190
<?php
191
if(!$summaryPage && (!empty($printVersion) || !empty($pdfVersion))) {
192
	echo $pdfVersion ? showPdfFooter($spText) : showPrintFooter($spText);
193
}
194
?>