-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathWatchAnalyticsUserTablePager.php
More file actions
67 lines (53 loc) · 1.69 KB
/
Copy pathWatchAnalyticsUserTablePager.php
File metadata and controls
67 lines (53 loc) · 1.69 KB
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
<?php
class WatchAnalyticsUserTablePager extends WatchAnalyticsTablePager {
protected $isSortable = [
'user_name' => true,
'num_watches' => true,
'num_pending' => true,
'percent_pending' => true,
'max_pending_minutes' => true,
'avg_pending_minutes' => true,
'engagement_score' => true,
];
public function __construct( $page, $conds, $filters = [] ) {
$this->watchQuery = new UserWatchesQuery();
parent::__construct( $page, $conds, $filters );
}
public function getQueryInfo() {
return $this->watchQuery->getQueryInfo();
}
public function formatValue( $fieldName, $value ) {
if ( $fieldName === 'user_name' ) {
$user_name = $value;
$userPage = Title::makeTitle( NS_USER, $user_name );
$name = Linker::link( $userPage, htmlspecialchars( $userPage->getText() ) );
/*
Maybe do a stats page at some point...for now just show that user's pending reviews...
$url = Title::newFromText('Special:WatchAnalytics')->getLocalUrl(
array( 'user' => $user_name )
);
$msg = wfMessage( 'watchanalytics-view-user-stats' );
*/
$url = Title::newFromText( 'Special:PendingReviews' )->getLocalUrl(
[ 'user' => $user_name ]
);
$msg = wfMessage( 'watchanalytics-view-user-pendingreviews' );
$name .= ' (' . Xml::element(
'a',
[ 'href' => $url ],
$msg
) . ')';
return $name;
} elseif ( $fieldName === 'max_pending_minutes' || $fieldName === 'avg_pending_minutes' ) {
return ( $value === null ) ? null : $this->watchQuery->createTimeStringFromMinutes( $value );
} else {
return $value;
}
}
public function getFieldNames() {
return $this->watchQuery->getFieldNames();
}
public function getDefaultSort() {
return 'num_pending';
}
}