Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
 
3
$borderCollapseVal = $pdfVersion ? "border-collapse: collapse;" : "";
4
 
5
if(!empty($printVersion) || !empty($pdfVersion)) {
6
    $pdfVersion ? showPdfHeader($spTextTools['Keyword Position Summary']) : showPrintHeader($spTextTools['Keyword Position Summary']);
7
    ?>
8
    <table class="search">
9
    	<?php if (!empty($websiteUrl)) {?>
10
    		<tr>
11
    			<th><?php echo $spText['common']['Website']?>:</th>
12
        		<td>
13
        			<?php echo $websiteUrl; ?>
14
    			</td>
15
    		</tr>
16
		<?php }?>
17
		<tr>
18
			<th><?php echo $spText['common']['Period']?>:</th>
19
    		<td>
20
    			<?php echo $fromTime?> - <?php echo $toTime?>
21
			</td>
22
		</tr>
23
	</table>
24
    <?php
25
} else {
26
    echo showSectionHead($spTextTools['Keyword Position Summary']);
27
    ?>
28
	<form id='search_form'>
29
	<?php $submitLink = "scriptDoLoadPost('reports.php', 'search_form', 'content', '&sec=reportsum')";?>
30
	<table class="search">
31
		<tr>
32
			<th><?php echo $spText['common']['Name']?>: </th>
33
			<td>
34
				<input type="text" name="search_name" value="<?php echo htmlentities($searchInfo['search_name'], ENT_QUOTES)?>" onblur="<?php echo $submitLink?>">
35
			</td>
36
			<th><?php echo $spText['common']['Website']?>: </th>
37
			<td>
38
				<select name="website_id" id="website_id" onchange="<?php echo $submitLink?>">
39
					<option value="">-- <?php echo $spText['common']['All']?> --</option>
40
					<?php foreach($websiteList as $websiteInfo){?>
41
						<?php if($websiteInfo['id'] == $websiteId){?>
42
							<option value="<?php echo $websiteInfo['id']?>" selected><?php echo $websiteInfo['name']?></option>
43
						<?php }else{?>
44
							<option value="<?php echo $websiteInfo['id']?>"><?php echo $websiteInfo['name']?></option>
45
						<?php }?>
46
					<?php }?>
47
				</select>
48
			</td>
49
			<th><?php echo $spText['common']['Period']?>:</th>
50
    		<td colspan="3">
51
    			<input type="text" value="<?php echo $fromTime?>" name="from_time" id="from_time"/>
52
    			<input type="text" value="<?php echo $toTime?>" name="to_time" id="to_time"/>
53
				<script>
54
				  $( function() {
55
				    $( "#from_time, #to_time").datepicker({dateFormat: "yy-mm-dd"});
56
				  } );
57
			  	</script>
58
			  	<a href="javascript:void(0);" onclick="<?php echo $submitLink?>" class="actionbut"><?php echo $spText['button']['Search']?></a>
59
			</td>
60
		</tr>
61
 
62
	</table>
63
	</form>
64
	<?php
65
	if(empty($list)){
66
		?>
67
		<p class='note'>
68
			<?php echo $spText['common']['No Keywords Found']?>.
69
			<a href="javascript:void(0);" onclick="scriptDoLoad('keywords.php', 'content', 'sec=new&amp;website_id=')"><?php echo $spText['label']['Click Here']?></a> <?php echo $spTextKeyword['to create new keywords']?>.
70
		</p>
71
		<?php
72
		exit;
73
	}
74
 
75
	// url parameters
76
	$mainLink = SP_WEBPATH."/reports.php?sec=reportsum&website_id=$websiteId&from_time=$fromTime&to_time=$toTime&search_name=" . $searchInfo['search_name'];
77
	$directLink = $mainLink . "&order_col=$orderCol&order_val=$orderVal&pageno=$pageNo";
78
 
79
	// export links
80
	$pdfLink = "$directLink&doc_type=pdf";
81
	$csvLink = "$directLink&doc_type=export";
82
	$printLink = "$directLink&doc_type=print";
83
	showExportDiv($pdfLink, $csvLink, $printLink);
84
	?>
85
	<?php echo $pagingDiv?>
86
<?php }?>
87
 
88
<div id='subcontent' class="table-responsive">
89
 
90
<table id="cust_tab">
91
	<tr>
92
		<?php
93
		$linkClass = "";
94
        if ($orderCol == 'keyword') {
95
            $oVal = ($orderVal == 'DESC') ? "ASC" : "DESC";
96
            $linkClass .= "sort_".strtolower($oVal);
97
        } else {
98
            $oVal = 'ASC';
99
        }
100
 
101
        $hrefAttr = $pdfVersion ? "" : "href='javascript:void(0)'";
102
 
103
		$linkName = "<a id='sortLink' class='$linkClass' $hrefAttr onclick=\"scriptDoLoad('$mainLink&order_col=keyword&order_val=$oVal', 'content')\">{$spText['common']['Keyword']}</a>";
104
		?>
105
		<?php if (empty($websiteId)) {?>
106
			<th id="head" rowspan="2"><?php echo $spText['common']['Website']?></th>
107
			<th id="head" rowspan="2"><?php echo $linkName?></th>
108
		<?php } else { ?>
109
			<th id="head" rowspan="2"><?php echo $linkName?></th>
110
		<?php }?>
111
		<?php
112
		$seCount = count($seList);
113
		foreach ($seList as $i => $seInfo){
114
		    $linkClass = "";
115
            if ($seInfo['id'] == $orderCol) {
116
                $oVal = ($orderVal == 'DESC') ? "ASC" : "DESC";
117
                $linkClass .= "sort_".strtolower($oVal);
118
            } else {
119
                $oVal = 'ASC';
120
            }
121
            $linkName = "<a id='sortLink' class='$linkClass' $hrefAttr onclick=\"scriptDoLoad('$mainLink&order_col={$seInfo['id']}&order_val=$oVal', 'content')\">{$seInfo['domain']}</a>";
122
            ?>
123
			<th id="head" colspan="3"><?php echo $linkName; ?></th>
124
			<?php
125
		}
126
		?>
127
	</tr>
128
	<tr>
129
		<?php
130
		$pTxt = str_replace("-", "/", substr($fromTime, -5));
131
		$cTxt = str_replace("-", "/", substr($toTime, -5));
132
		foreach ($seList as $i => $seInfo) {
133
			?>
134
			<th><?php echo $pTxt; ?></th>
135
			<th><?php echo $cTxt; ?></th>
136
			<th>+ / -</th>
137
			<?php
138
		}
139
		?>
140
	</tr>
141
	<?php
142
	$colCount = empty($websiteId) ? ($seCount * 3) + 2 : ($seCount * 3) + 1;
143
	if (count($list) > 0) {
144
		foreach($indexList as $keywordId => $rankValue){
145
		    $listInfo = $list[$keywordId];
146
			$positionInfo = $listInfo['position_info'];
147
            $rangeFromTime = date('Y-m-d', strtotime('-14 days', strtotime($fromTime)));
148
            $scriptLink = "website_id=$websiteId&keyword_id={$listInfo['id']}&rep=1&from_time=$rangeFromTime&to_time=$toTime";
149
			?>
150
			<tr>
151
				<?php if (empty($websiteId)) {?>
152
					<td><?php echo $listInfo['weburl']; ?></td>
153
					<td><?php echo $listInfo['name'] ?></td>
154
				<?php } else { ?>
155
					<td><?php echo $listInfo['name']; ?></td>
156
				<?php }?>
157
				<?php
158
				foreach ($seList as $index => $seInfo){
159
					$rankInfo = $positionInfo[$seInfo['id']];
160
					$prevRank = isset($rankInfo[$fromTime]) ? $rankInfo[$fromTime] : "";
161
					$currRank = isset($rankInfo[$toTime]) ? $rankInfo[$toTime] : "";
162
					$rankDiffTxt = "";
163
 
164
					// if both ranks are existing
165
					if ($prevRank != '' && $currRank != '') {
166
						$rankDiff = $prevRank - $currRank;
167
 
168
						if ($rankDiff > 0) {
169
							$rankDiffTxt = "<font class='green'>($rankDiff)</font>";
170
						} else if ($rankDiff < 0) {
171
							$rankDiffTxt = "<font class='red'>($rankDiff)</font>";
172
						} else {
173
							$rankDiffTxt = "0";
174
						}
175
					}
176
 
177
					$prevRankLink = scriptAJAXLinkHrefDialog('reports.php', 'content', $scriptLink."&se_id=".$seInfo['id'], $prevRank);
178
					$currRankLink = scriptAJAXLinkHrefDialog('reports.php', 'content', $scriptLink."&se_id=".$seInfo['id'], $currRank);
179
					$graphLink = scriptAJAXLinkHrefDialog('graphical-reports.php', 'content', $scriptLink."&se_id=".$seInfo['id'], '&nbsp;', 'graphicon');
180
 
181
					// if pdf report remove links
182
					if ($pdfVersion) {
183
						$prevRankLink = str_replace("href='javascript:void(0);'", "", $prevRankLink);
184
						$currRankLink = str_replace("href='javascript:void(0);'", "", $currRankLink);
185
						$graphLink = str_replace("href='javascript:void(0);'", "", $graphLink);
186
					}
187
				    ?>
188
					<td><?php echo $prevRankLink; ?></td>
189
					<td><?php echo $currRankLink; ?></td>
190
					<td><?php echo $graphLink . " " . $rankDiffTxt; ?></td>
191
					<?php
192
				}
193
				?>
194
			</tr>
195
			<?php
196
		}
197
	}
198
	?>
199
</table>
200
</div>
201
<?php
202
if(!empty($printVersion) || !empty($pdfVersion)) {
203
	echo $pdfVersion ? showPdfFooter($spText) : showPrintFooter($spText);
204
}
205
?>