forked from xoxco/PeoplePods
/
index.php
205 lines (172 loc) · 8.28 KB
/
index.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?
require_once("../PeoplePods.php");
$POD = new PeoplePod(array('debug'=>0,'lockdown'=>'adminUser','authSecret'=>@$_COOKIE['pp_auth']));
$POD->changeTheme('admin');
if (!$POD->success()) {
error_log($POD->error());
}
if (isset($_GET['flushcache'])) {
$POD->cacheflush();
$message = "Cache Flushed!";
}
$POD->header();
// lets generate some stats!
$today = date("Y-m-d");
/*
$totalMembers = $POD->getPeople(array('memberSince:lte'=>$today));
$membersToday = $POD->getPeople(array('lastVisit:gt'=>$today),'lastVisit desc',10);
$membersJoined = $POD->getPeople(array('memberSince:gt'=>$today));
$docsCreated = $POD->getContents(array('date:gt'=>$today));
$newComments = $POD->getComments(array('date:gt'=>$today),'date desc',5);
$total = $membersJoined->totalCount() + $totalMembers->totalCount();
*/
$this_database_update = 0.9;
$last_version = $POD->libOptions('last_database_update');
if (!$last_version) { $last_version = 0; }
// load each type of thing
// get total, total for today, total for the last week
// members, content, comments, files, groups
$members = $POD->getPeople(array('memberSince:gte'=>date('Y-m-d') . ' 00:00:00'));
$stats['members_today'] = $members->totalCount();
$members = $POD->getPeople(array('memberSince:gte'=>date('Y-m-d',strtotime('-7 days'))));
$stats['members_week'] = $members->totalCount();
$members = $POD->getPeople(array(),'memberSince DESC',10);
$stats['members_total'] = $members->totalCount();
$visitors = $POD->getPeople(array('lastVisit:gte'=>date('Y-m-d') . ' 00:00:00'));
$stats['visits_today'] = $visitors->totalCount();
$visitors = $POD->getPeople(array('lastVisit:gte'=>date('Y-m-d',strtotime('-7 days'))));
$stats['visits_week'] = $visitors->totalCount();
$visitors = $POD->getPeople(array('lastVisit:gte'=>date('Y-m-d',strtotime('-30 days'))),'lastVisit DESC',10);
$stats['visits_total'] = $visitors->totalCount();
$content = $POD->getContents(array('date:gte'=>date('Y-m-d') . ' 00:00:00'));
$stats['content_today'] = $content->totalCount();
$content = $POD->getContents(array('date:gte'=>date('Y-m-d',strtotime('-7 days'))));
$stats['content_week'] = $content->totalCount();
$content = $POD->getContents(array(),'date desc',10);
$stats['content_total'] = $content->totalCount();
$active_content = $POD->getContents(array(),'commentDate DESC',10);
$comments = $POD->getComments(array('date:gte'=>date('Y-m-d') . ' 00:00:00'));
$stats['comments_today'] = $comments->totalCount();
$comments = $POD->getComments(array('date:gte'=>date('Y-m-d',strtotime('-7 days'))));
$stats['comments_week'] = $comments->totalCount();
$comments = $POD->getComments(array(),'date desc',10);
$stats['comments_total'] = $comments->totalCount();
$files = $POD->getFiles(array('date:gte'=>date('Y-m-d') . ' 00:00:00'));
$stats['files_today'] = $files->totalCount();
$files = $POD->getFiles(array('date:gte'=>date('Y-m-d',strtotime('-7 days'))));
$stats['files_week'] = $files->totalCount();
$files = $POD->getFiles(array(),'date desc',10);
$stats['files_total'] = $files->totalCount();
$groups = $POD->getGroups(array('date:gte'=>date('Y-m-d') . ' 00:00:00'));
$stats['groups_today'] = $groups->totalCount();
$groups = $POD->getGroups(array('date:gte'=>date('Y-m-d',strtotime('-7 days'))));
$stats['groups_week'] = $groups->totalCount();
$groups = $POD->getGroups(array(),'date desc',10);
$stats['groups_total'] = $groups->totalCount();
?>
<script type="text/javascript">
function doSearch() {
window.location="<? $POD->podRoot(); ?>/admin/" + $('#search_type').val()+ "/search.php?q=" + escape($('#search_q').val());
return false;
}
</script>
<div id="tools">
<ul>
<li id="section_name">Command Center</li><li><a href="content/" title="Create new content...">Add Content</a></li><li><a href="people/" title="Create a new member...">Add Person</a></li><li><a href="groups/" title="Create a new group...">Add Group</a></li><li class="last">
<form method="get" onsubmit="return doSearch();">
<input name="q" id="search_q" default="Search" class="repairField" size="15" />
<select name="type" id="search_type">
<option value="people">People</option>
<option value="content">Content</option>
</select>
</form>
</li>
</ul>
</div>
<div class="list_panel">
<div id="update_check">
<script type="text/javascript" src="http://peoplepods.net/versioncheck/<? echo $POD->libOptions('peoplepods_api'); ?>?version=<?= $POD->VERSION; ?>"></script>
</div>
<h1 style="margin:0px"><? $POD->siteName(); ?></h1>
</div>
<? if (isset($message)) { ?>
<div class="info"><?= $message; ?></div>
<? } ?>
<? if ($last_version < $this_database_update) { ?>
<div class="info">
Updates to the database schema are required! <a href="options/upgrade.php">Click to upgrade.</a>
</div>
<? } ?>
<div id="options">
<div class="stats option_set">
<div class="stat">
<a href="<? $POD->podRoot(); ?>/admin/people/search.php?mode=newest"><?= $POD->pluralize($stats['members_total'],'<span class="number">@number</span> member','<span class="number">@number</span> members'); ?></a>
<?= $stats['members_today']; ?> joined today<br />
<?= $stats['members_week']; ?> over the last week
</div>
<div class="stat">
<a href="<? $POD->podRoot(); ?>/admin/people/search.php?mode=last" title="Members active during the last 30 days"><?= $POD->pluralize($stats['visits_total'],'<span class="number">@number active</span>','<span class="number">@number active</span>'); ?></a>
<?= $stats['visits_today']; ?> visited today<br />
<?= $stats['visits_week']; ?> over the last week
</div>
<div class="stat">
<a href="<? $POD->podRoot(); ?>/admin/content/search.php"><?= $POD->pluralize($stats['content_total'],'<span class="number">@number</span> post','<span class="number">@number</span> posts'); ?></a>
<?= $stats['content_today']; ?> created today<br />
<?= $stats['content_week']; ?> over the last week
</div>
<div class="stat">
<a href="<? $POD->podRoot(); ?>/admin/comments/"><?= $POD->pluralize($stats['comments_total'],'<span class="number">@number</span> comment','<span class="number">@number</span> comments'); ?></a>
<?= $stats['comments_today']; ?> posted today<br />
<?= $stats['comments_week']; ?> over the last week
</div>
<div class="stat">
<a href="<? $POD->podRoot(); ?>/admin/files/"><?= $POD->pluralize($stats['files_total'],'<span class="number">@number</span> file','<span class="number">@number</span> files'); ?></a>
<?= $stats['files_today']; ?> uploaded today<br />
<?= $stats['files_week']; ?> over the last week
</div>
<div class="stat">
<a href="<? $POD->podRoot(); ?>/admin/groups/search.php"><?= $POD->pluralize($stats['groups_total'],'<span class="number">@number</span> group','<span class="number">@number</span> groups'); ?></a>
<?= $stats['groups_today']; ?> created today<br />
<?= $stats['groups_week']; ?> over the last week
</div>
</div>
<div class="option_set">
<? $POD->cachestatus(); ?>
<a href="?flushcache=now">Flush Cache</a>
</div>
<div class="option_set">
<h3>Documentation</h3>
<ul>
<li><a href="http://peoplepods.net/readme">README</a></li>
<li><a href="http://peoplepods.net/readme/sdk">SDK</a></li>
<li><a href="http://peoplepods.net/readme/themes">Themes</a></li>
<li><a href="http://peoplepods.net/readme/object-definitions">Object Definitions</a></li>
<li><a href="http://peoplepods.net/readme/admin-tools">Admin Tools</a></li>
</ul>
</div>
</div>
<div class="list_panel panel_with_options">
<h1>Recent Activity</h1>
<div class="quick_view" id="quick_people" >
<h2>People</h2>
<h3>New Signups</h3>
<? $members->output('list_item','list_header','list_footer'); ?>
<h3>Recent Visitors</h3>
<? $visitors->output('list_item','list_header','list_footer'); ?>
</div>
<div class="quick_view" id="quick_content">
<h2>Content</h2>
<h3>Recently Added Content</h3>
<? $content->output('list_item','list_header','list_footer'); ?>
<h3>Recently Active Content</h3>
<? $active_content->output('list_item','list_header','list_footer'); ?>
</div>
<div class="quick_view" id="quick_comments">
<h2>Comments</h2>
<? $comments->output('comment.preview'); ?>
</div>
<br clear="left" />
</div>
<?
$POD->footer();
?>