CMS  Version 3.9
activity_user_report.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("activity_tracker");
3 Fakoli::usingFeature("data_view", "filter_form");
4 
5 $user_id = checkNumeric($_GET["user_id"]);
6 
7 if (!$user_id) redirect("activity_report");
8 
9 $menu_item = "Activity Report";
10 
11 $constraint = "WHERE user_id={$user_id}";
12 
13 $sessions = IteratedQuery::create(UserActivitySession, "$constraint ORDER BY session_start DESC")->execute();
14 
15 $table = new DataListView($sessions, "session");
16 $table->column("User", "<a href='/admin/session_details?session_id={session_id}'>{User.first_name} {User.last_name}</a>", true, "width: 25%")
17  ->column("Session #", "<a href='/admin/session_details?session_id={session_id}'>{session_id}</a>", true, "text-align: right; width: 5%")
18  ->column("Start", "{session_start}", true)
19  ->column("End", "{session_end}", true)
20  ->column("Page Views", "{page_views}", true, "text-align: right")
21  ->column("Feedback", "{feedback_count}", true, "text-align: right")
22  ->column("Browser", "{ActivityTracker::getBrowser}", true, "width: 20%");
23 
24 $table->sortable = true;
25 $table->pageSize = 20;
26 $table->filter = true;
27 $table->excelFile = "activity_report.xls";
28 
29 $script .= $table->writeScript();
30 
31 $table->drawView();
32 
33 $count = Query::create(UserActivity, "")->executeValue("COUNT(1)");
34 
35 if ($count > 0)
36 {
37 ?>
38 <br/>
39 <a class='button' href='#' onclick='new BackgroundProcess("Migrating User Activity", "/action/activity_tracker/migrate_data"); return false;'>Migrate User Activity Logs</a>
40 <?
41 }
42 ?>
static usingFeature()
Uses the specified framework feature(s).
Definition: core.inc:388
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116