-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathController.php
101 lines (88 loc) · 2.9 KB
/
Controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* Latest Referrers Plugin
* Controller
*
* Author: Timo Besenreuther
* EZdesign.de
* Created: 2010-09-01
* Modified: 2010-09-01
*/
class Piwik_LatestReferrers_Controller extends Piwik_Controller {
/** Latest links method */
public function links() {
$view = new Piwik_View('LatestReferrers/templates/links.tpl');
$view->latestLinks = $this->latestLinks(true);
$view->latestNewLinks = $this->latestNewLinks(true);
echo $view->render();
}
/** Latest searches method */
public function searches() {
$view = new Piwik_View('LatestReferrers/templates/searches.tpl');
$view->latestSearches = $this->latestSearches(true);
$view->latestNewSearches = $this->latestNewSearches(true);
echo $view->render();
}
/** Get latest new links */
public function latestNewLinks($return=false) {
$view = new Piwik_ViewDataTable_HtmlTable();
$view->init($this->pluginName, __FUNCTION__, 'LatestReferrers.getLatestNewLinks');
$cols = array(
Piwik_LatestReferrers::REFERRER,
Piwik_LatestReferrers::REFERRER_URL,
Piwik_LatestReferrers::ENTRY_URL,
Piwik_LatestReferrers::TIME
);
return $this->latestLinks($return, $view, $cols);
}
/** Get latest links */
public function latestLinks($return=false, $view=null, $cols=null) {
if (!$cols) {
$cols = array(
Piwik_LatestReferrers::REFERRER,
Piwik_LatestReferrers::REFERRER_URL,
Piwik_LatestReferrers::ENTRY_URL,
Piwik_LatestReferrers::TIME,
Piwik_LatestReferrers::OCCURRENCES
);
}
if (!$view) {
$view = new Piwik_ViewDataTable_HtmlTable();
$view->init($this->pluginName, __FUNCTION__, 'LatestReferrers.getLatestLinks');
}
Piwik_LatestReferrers::displayColumns($view, $cols);
$view->setTemplate('LatestReferrers/templates/datatable.tpl');
$view->setSortedColumn(Piwik_LatestReferrers::TIME, 'desc');
$view->disableFooterIcons();
$view->disableSearchBox();
$view->setLimit(5);
$result = $this->renderView($view, true);
if ($return) return $result;
echo $result;
}
/** Get latest new searches */
public function latestNewSearches($return=false) {
$view = new Piwik_ViewDataTable_HtmlTable();
$view->init($this->pluginName, __FUNCTION__, 'LatestReferrers.getLatestNewSearches');
$cols = array(
Piwik_LatestReferrers::REFERRER,
Piwik_LatestReferrers::REFERRER_KEYWORD,
Piwik_LatestReferrers::ENTRY_URL,
Piwik_LatestReferrers::TIME
);
return $this->latestLinks($return, $view, $cols);
}
/** Get latest searches */
public function latestSearches($return=false) {
$view = new Piwik_ViewDataTable_HtmlTable();
$view->init($this->pluginName, __FUNCTION__, 'LatestReferrers.getLatestSearches');
$cols = array(
Piwik_LatestReferrers::REFERRER,
Piwik_LatestReferrers::REFERRER_KEYWORD,
Piwik_LatestReferrers::ENTRY_URL,
Piwik_LatestReferrers::TIME,
Piwik_LatestReferrers::OCCURRENCES
);
return $this->latestLinks($return, $view, $cols);
}
}