Subversion Repositories cheapmusic

Rev

Go to most recent revision | Details | 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
 
40
	    $fromTime = !empty($searchInfo['from_time']) ? addslashes($searchInfo['from_time']) : date('Y-m-d', strtotime('-2 days'));
41
	    $toTime = !empty($searchInfo['to_time']) ? addslashes($searchInfo['to_time']) : date('Y-m-d', strtotime('-1 days'));
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
 
70
		$sql = "select * from (
71
                    select distinct srd.url, sr.rank,sr.result_date, sr.keyword_id, k.name as keyword
72
                    from searchresults sr, searchresultdetails srd, keywords k
73
                    where sr.id=srd.searchresult_id and sr.keyword_id=k.id and k.website_id=$websiteId and sr.searchengine_id=$seId $conditions
74
                    order by rank asc, result_date DESC
75
                ) as p group by p.url limit " . SP_PAGINGNO;
76
 
77
		$pageResultList = $this->db->select($sql);
78
		$this->set("pageResultList", $pageResultList);
79
		$this->render('report/page_overview_data');
80
	}
81
 
82
	function showKeywordOverview($websiteId, $fromDate, $toDate) {
83
	    $keywordController = new KeywordController();
84
	    $seLIst = $keywordController->getUserKeywordSearchEngineList("", $websiteId);
85
 
86
	    if (empty($seLIst)) {
87
	        showErrorMsg($_SESSION['text']['common']['No Records Found']);
88
	    }
89
 
90
	    $this->set("seList", $seLIst);
91
	    $keywordOVUrl = SP_WEBPATH . "/$this->baseUrl?sec=keyword-overview-data&website_id=$websiteId&from_time=$fromDate&to_time=$toDate";
92
	    $this->set("keywordOVUrl", $keywordOVUrl);
93
	    $this->render('report/keyword_overview');
94
	}
95
 
96
	function showKeywordOverviewData($seachInfo) {
97
	    $websiteId = intval($seachInfo['website_id']);
98
	    $seId = intval($seachInfo['se_id']);
99
 
100
	    $conditions = !empty($seachInfo['from_time']) ? " and sr.result_date>='".addslashes($seachInfo['from_time'])."'" : "";
101
	    $conditions .= !empty($seachInfo['to_time']) ? " and sr.result_date<='".addslashes($seachInfo['to_time'])."'" : "";
102
 
103
	    $sql = "select * from (
104
                    select distinct sr.keyword_id, srd.url, sr.rank,sr.result_date, k.name as keyword
105
                    from searchresults sr, searchresultdetails srd, keywords k
106
                    where sr.id=srd.searchresult_id and sr.keyword_id=k.id and k.website_id=$websiteId and sr.searchengine_id=$seId $conditions
107
                    order by rank asc, result_date DESC
108
                ) as p group by p.keyword_id limit " . SP_PAGINGNO;
109
 
110
	    $keywordResultList = $this->db->select($sql);
111
	    $this->set("keywordResultList", $keywordResultList);
112
	    $this->render('report/keyword_overview_data');
113
	}
114
 
115
}
116
?>