Subversion Repositories cheapmusic

Rev

Rev 103 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
 
3
/***************************************************************************
4
 *   Copyright (C) 2009-2011 by Geo Varghese(www.seopanel.in)  	           *
5
 *   sendtogeo@gmail.com   												   *
6
 *                                                                         *
7
 *   This program is free software; you can redistribute it and/or modify  *
8
 *   it under the terms of the GNU General Public License as published by  *
9
 *   the Free Software Foundation; either version 2 of the License, or     *
10
 *   (at your option) any later version.                                   *
11
 *                                                                         *
12
 *   This program is distributed in the hope that it will be useful,       *
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
 *   GNU General Public License for more details.                          *
16
 *                                                                         *
17
 *   You should have received a copy of the GNU General Public License     *
18
 *   along with this program; if not, write to the                         *
19
 *   Free Software Foundation, Inc.,                                       *
20
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21
 ***************************************************************************/
22
 
23
/* class defines all overview controller functions */
24
class OverviewController extends Controller {
25
    var $baseUrl = "overview.php";
26
 
27
	function showOverView($searchInfo = '') {
28
	    $userId = isLoggedIn();
29
	    $websiteCtrler = New WebsiteController();
30
	    $websiteList = $websiteCtrler->__getAllWebsites($userId, true);
31
 
32
	    if (empty($websiteList)) {
33
	        showErrorMsg($_SESSION['text']['common']['nowebsites']);
34
	    }
35
 
36
	    $this->set('siteList', $websiteList);
37
	    $websiteId = isset($searchInfo['website_id']) ? intval($searchInfo['website_id']) : $websiteList[0]['id'];
38
	    $this->set('websiteId', $websiteId);
39
 
155 - 40
	    $fromTime = !empty($searchInfo['from_time']) ? addslashes($searchInfo['from_time']) : date('Y-m-d', strtotime('-14 days'));
41
	    $toTime = !empty($searchInfo['to_time']) ? addslashes($searchInfo['to_time']) : date('Y-m-d');
103 - 42
	    $this->set('fromTime', $fromTime);
43
	    $this->set('toTime', $toTime);
44
 
45
		$this->set("custSubMenu", "overview");
46
		$this->render('user/userhome');
47
	}
48
 
49
	function showPageOverview($websiteId, $fromDate, $toDate) {
50
	    $keywordController = new KeywordController();
51
	    $seLIst = $keywordController->getUserKeywordSearchEngineList("", $websiteId);
52
 
53
	    if (empty($seLIst)) {
54
	        showErrorMsg($_SESSION['text']['common']['No Records Found']);
55
	    }
56
 
57
	    $this->set("seList", $seLIst);
58
	    $pageOVUrl = SP_WEBPATH . "/$this->baseUrl?sec=page-overview-data&website_id=$websiteId&from_time=$fromDate&to_time=$toDate";
59
	    $this->set("pageOVUrl", $pageOVUrl);
60
	    $this->render('report/page_overview');
61
	}
62
 
63
	function showPageOverviewData($seachInfo) {
64
	    $websiteId = intval($seachInfo['website_id']);
65
	    $seId = intval($seachInfo['se_id']);
66
 
67
	    $conditions = !empty($seachInfo['from_time']) ? " and sr.result_date>='".addslashes($seachInfo['from_time'])."'" : "";
68
	    $conditions .= !empty($seachInfo['to_time']) ? " and sr.result_date<='".addslashes($seachInfo['to_time'])."'" : "";
69
 
155 - 70
	    $sql = "select distinct srd.url, sr.`rank`,sr.result_date, sr.keyword_id, k.name as keyword
71
	                    from searchresults sr, searchresultdetails srd, keywords k
72
	                    where sr.id=srd.searchresult_id and sr.keyword_id=k.id and k.website_id=$websiteId and sr.searchengine_id=$seId $conditions
73
	                    order by `rank` asc, result_date DESC limit 0, 1000";
103 - 74
 
155 - 75
		$rList = $this->db->select($sql);
76
		$pageResultList = [];
77
		foreach ($rList as $rInfo) {
78
			if (!isset($pageResultList[$rInfo['url']])) {
79
				$pageResultList[$rInfo['url']] = $rInfo;
80
				if(count($pageResultList) > SP_PAGINGNO) {
81
					break;
82
				}
83
			}
84
		}
85
 
103 - 86
		$this->set("pageResultList", $pageResultList);
87
		$this->render('report/page_overview_data');
88
	}
89
 
90
	function showKeywordOverview($websiteId, $fromDate, $toDate) {
91
	    $keywordController = new KeywordController();
92
	    $seLIst = $keywordController->getUserKeywordSearchEngineList("", $websiteId);
93
 
94
	    if (empty($seLIst)) {
95
	        showErrorMsg($_SESSION['text']['common']['No Records Found']);
96
	    }
97
 
98
	    $this->set("seList", $seLIst);
99
	    $keywordOVUrl = SP_WEBPATH . "/$this->baseUrl?sec=keyword-overview-data&website_id=$websiteId&from_time=$fromDate&to_time=$toDate";
100
	    $this->set("keywordOVUrl", $keywordOVUrl);
101
	    $this->render('report/keyword_overview');
102
	}
103
 
104
	function showKeywordOverviewData($seachInfo) {
105
	    $websiteId = intval($seachInfo['website_id']);
106
	    $seId = intval($seachInfo['se_id']);
107
 
108
	    $conditions = !empty($seachInfo['from_time']) ? " and sr.result_date>='".addslashes($seachInfo['from_time'])."'" : "";
109
	    $conditions .= !empty($seachInfo['to_time']) ? " and sr.result_date<='".addslashes($seachInfo['to_time'])."'" : "";
110
 
155 - 111
	    $sql = "select distinct sr.keyword_id, srd.url, sr.`rank`,sr.result_date, k.name as keyword
103 - 112
                    from searchresults sr, searchresultdetails srd, keywords k
113
                    where sr.id=srd.searchresult_id and sr.keyword_id=k.id and k.website_id=$websiteId and sr.searchengine_id=$seId $conditions
155 - 114
                    order by `rank` asc, result_date DESC limit 0, 1000";
115
 
116
        $rList = $this->db->select($sql);
117
		$keywordResultList = [];
118
		foreach ($rList as $rInfo) {
119
			if (!isset($keywordResultList[$rInfo['keyword']])) {
120
				$keywordResultList[$rInfo['keyword']] = $rInfo;
121
				if(count($keywordResultList) > SP_PAGINGNO) {
122
					break;
123
				}
124
			}
125
		}
103 - 126
 
127
	    $this->set("keywordResultList", $keywordResultList);
128
	    $this->render('report/keyword_overview_data');
129
	}
130
 
131
}
132
?>