|
1
|
|
|
<?php |
|
2
|
|
|
/****************************************************************************** |
|
3
|
|
|
* Wikipedia Account Creation Assistance tool * |
|
4
|
|
|
* * |
|
5
|
|
|
* All code in this file is released into the public domain by the ACC * |
|
6
|
|
|
* Development Team. Please see team.json for a list of contributors. * |
|
7
|
|
|
******************************************************************************/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Waca\Pages; |
|
10
|
|
|
|
|
11
|
|
|
use Waca\DataObjects\Log; |
|
12
|
|
|
use Waca\DataObjects\User; |
|
13
|
|
|
use Waca\Helpers\LogHelper; |
|
14
|
|
|
use Waca\Helpers\SearchHelpers\LogSearchHelper; |
|
15
|
|
|
use Waca\Helpers\SearchHelpers\UserSearchHelper; |
|
16
|
|
|
use Waca\Tasks\PagedInternalPageBase; |
|
17
|
|
|
use Waca\WebRequest; |
|
18
|
|
|
|
|
19
|
|
|
class PageLog extends PagedInternalPageBase |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Main function for this page, when no specific actions are called. |
|
23
|
|
|
*/ |
|
24
|
|
|
protected function main() |
|
25
|
|
|
{ |
|
26
|
|
|
$this->setHtmlTitle('Logs'); |
|
27
|
|
|
|
|
28
|
|
|
$filterUser = WebRequest::getString('filterUser'); |
|
29
|
|
|
$filterAction = WebRequest::getString('filterAction'); |
|
30
|
|
|
$filterObjectType = WebRequest::getString('filterObjectType'); |
|
31
|
|
|
$filterObjectId = WebRequest::getInt('filterObjectId'); |
|
32
|
|
|
|
|
33
|
|
|
$database = $this->getDatabase(); |
|
34
|
|
|
|
|
35
|
|
|
if (!array_key_exists($filterObjectType, LogHelper::getObjectTypes())) { |
|
36
|
|
|
$filterObjectType = null; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
$this->getTypeAheadHelper()->defineTypeAheadSource('username-typeahead', function() use ($database) { |
|
40
|
|
|
return UserSearchHelper::get($database)->fetchColumn('username'); |
|
41
|
|
|
}); |
|
42
|
|
|
|
|
43
|
|
|
$logSearch = LogSearchHelper::get($database); |
|
44
|
|
|
|
|
45
|
|
|
$this->setSearchHelper($logSearch); |
|
46
|
|
|
$this->setupLimits(); |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
/** @var Log[] $logs */ |
|
50
|
|
|
$logs = $logSearch->getRecordCount($count)->fetch(); |
|
51
|
|
|
|
|
52
|
|
|
if ($count === 0) { |
|
53
|
|
|
$this->assign('logs', array()); |
|
54
|
|
|
$this->setTemplate('logs/main.tpl'); |
|
55
|
|
|
|
|
56
|
|
|
return; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
list($users, $logData) = LogHelper::prepareLogsForTemplate($logs, $database, $this->getSiteConfiguration()); |
|
60
|
|
|
|
|
61
|
|
|
$this->setupPageData($count, array('filterUser' => $filterUser, 'filterAction' => $filterAction, 'filterObjectType' => $filterObjectType, 'filterObjectId' => $filterObjectId)); |
|
62
|
|
|
|
|
63
|
|
|
$this->assign("logs", $logData); |
|
64
|
|
|
$this->assign("users", $users); |
|
65
|
|
|
|
|
66
|
|
|
$this->assign('allLogActions', LogHelper::getLogActions($this->getDatabase())); |
|
67
|
|
|
$this->assign('allObjectTypes', LogHelper::getObjectTypes()); |
|
68
|
|
|
|
|
69
|
|
|
$this->setTemplate("logs/main.tpl"); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|