/**
  * (non-PHPdoc)
  * @see WP_List_Table::prepare_items()
  */
 function prepare_items()
 {
     $query_helper = new HA_Query_Helper();
     $query_helper->get_session_filters(array('last_days' => true, 'url' => true, 'page_width' => true, 'browser' => true, 'device' => true, 'os' => true));
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $query_helper->get_http_filters('POST');
     } else {
         $query_helper->get_http_filters('GET');
     }
     $query_helper->set_session_filters();
     // Register the columns
     $columns = $this->get_columns();
     $hidden = array('last_updt_date', 'user_env_id', 'user_id', 'device', 'browser', 'os', 'id', 'record_date', 'description');
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $items_per_page = 25;
     // Ensure paging is reset on filter submit by checking HTTP method as well
     $page_num = !empty($_GET["paged"]) && $_SERVER['REQUEST_METHOD'] != 'POST' ? mysql_real_escape_string($_GET["paged"]) : '';
     if (empty($page_num) || !is_numeric($page_num) || $page_num <= 0) {
         $page_num = 1;
     }
     global $ha_admin_controller;
     $data = $ha_admin_controller->get_data_services()->table_query('heatmaps_table_data', $query_helper->get_filters(), $items_per_page, $page_num);
     $this->set_pagination_args($data['pagination_args']);
     $this->items = $data['items'];
 }
 /**
  * (non-PHPdoc)
  * @see WP_List_Table::prepare_items()
  */
 function prepare_items()
 {
     $query_helper = new HA_Query_Helper();
     $query_helper->get_session_filters(array('ip_address' => true, 'session_id' => true, 'event_type' => true, 'url' => true));
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $query_helper->get_http_filters('POST');
     } else {
         $query_helper->get_http_filters('GET');
     }
     $query_helper->set_session_filters();
     // Register the columns
     $columns = $this->get_columns();
     $hidden = array('user_env_id', 'user_id', 'id');
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $items_per_page = 25;
     // Ensure paging is reset on filter submit by checking HTTP method as well
     $page_num = !empty($_GET["paged"]) && $_SERVER['REQUEST_METHOD'] != 'POST' ? mysql_real_escape_string($_GET["paged"]) : '';
     if (empty($page_num) || !is_numeric($page_num) || $page_num <= 0) {
         $page_num = 1;
     }
     global $ha_admin_controller;
     $data = $ha_admin_controller->get_data_services()->table_query('user_activity_table_data', $query_helper->get_filters(), $items_per_page, $page_num);
     $this->set_pagination_args($data['pagination_args']);
     $this->items = isset($data['items']) ? $data['items'] : array();
     $index = count($this->items) + ($page_num - 1) * $items_per_page;
     foreach ($this->items as &$item) {
         $item['sequence'] = $index--;
     }
 }
 /**
  * (non-PHPdoc)
  * @see WP_List_Table::prepare_items()
  */
 function prepare_items()
 {
     global $wpdb;
     // Register the columns
     $columns = $this->get_columns();
     $hidden = array(HA_Common::ID_COLUMN);
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     // get table data
     $query_helper = new HA_Query_Helper();
     $query_helper->get_session_filters(array('last_days' => true, 'device' => true, 'os' => true, 'browser' => true));
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $query_helper->get_http_filters('POST');
     } else {
         $query_helper->get_http_filters('GET');
     }
     $query_helper->set_session_filters();
     $items_per_page = 25;
     // Ensure paging is reset on filter submit by checking HTTP method as well
     $page_num = !empty($_GET["paged"]) && $_SERVER['REQUEST_METHOD'] != 'POST' ? mysql_real_escape_string($_GET["paged"]) : '';
     if (empty($page_num) || !is_numeric($page_num) || $page_num <= 0) {
         $page_num = 1;
     }
     global $ha_admin_controller;
     $data = $ha_admin_controller->get_data_services()->table_query('event_statistics_table_report_data', $query_helper->get_filters(), $items_per_page, $page_num);
     if (isset($data['pagination_args'])) {
         $this->set_pagination_args($data['pagination_args']);
     }
     if (isset($data['items'])) {
         $this->items = $data['items'];
     }
 }
    public static function show_user_activity_tab()
    {
        ?>
		<form method="post">
			<div class="tablenav top">
				<?php 
        $query_helper = new HA_Query_Helper();
        $filters = array('ip_address' => true, 'session_id' => true, 'event_type' => true, 'url' => true);
        $query_helper->get_session_filters($filters);
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            $query_helper->get_http_filters('POST');
        } else {
            $query_helper->get_http_filters('GET');
        }
        $query_helper->set_session_filters();
        $query_helper->show_filters($filters);
        ?>
			</div>
			<div id="poststuff" class="">
		        <div id="post-body" class="metabox-holder">
	                <?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
	                <?php 
        wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
        ?>
	                <?php 
        add_meta_box("user-activity-summary-metabox", "Summary", array('HA_Report_View', "user_activity_summary_metabox"), HA_Common::REPORTS_PAGE_SLUG, "normal");
        ?>
	                <?php 
        do_meta_boxes(HA_Common::REPORTS_PAGE_SLUG, 'normal', array());
        ?>
	
				</div>
			</div>
			<?php 
        $user_activity_table = new HA_User_Activity_Table();
        $user_activity_table->prepare_items();
        $user_activity_table->display();
        ?>
		</form>
		<?php 
    }
Exemple #5
0
    public static function user_activity_summary_metabox($params)
    {
        $query_helper = new HA_Query_Helper();
        $query_helper->get_session_filters(array('ip_address' => true, 'session_id' => true, 'event_type' => true, 'url' => true));
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            $query_helper->get_http_filters('POST');
        } else {
            $query_helper->get_http_filters('GET');
        }
        $query_helper->set_session_filters();
        global $ha_admin_controller;
        $data = $ha_admin_controller->get_data_services()->simple_query('user_activity_summary_data', $query_helper->get_filters());
        if (isset($data->count_total) && $data->count_total > 0) {
            ?>
			<table class="form-table">
				<tbody>
					<tr valign="top">
						<th scope="row">IP Address</th>
						<td><?php 
            echo $data->ip_address;
            ?>
</td>
						<th scope="row">Session ID</th>
						<td><?php 
            echo $data->session_id;
            ?>
</td>
						<th scope="row">Duration</th>
						<td><?php 
            $latest_record_date = strtotime($data->latest_record_date);
            $oldest_record_date = strtotime($data->oldest_record_date);
            $human_time_diff = HA_Common::human_time_diff($oldest_record_date, $latest_record_date);
            echo $human_time_diff;
            ?>
</td>
					</tr>
					<tr valign="top">
						<th scope="row">Username</th>
						<td><?php 
            echo $data->username;
            ?>
</td>
						<th scope="row">Role</th>
						<td><?php 
            echo $data->role;
            ?>
</td>
						<th scope="row">Browser</th>
						<td><?php 
            echo $data->browser;
            ?>
</td>
					</tr>
					<tr valign="top">
						<th scope="row">Latest Record Date</th>
						<td><?php 
            echo date("F j, Y, g:i a", strtotime($data->latest_record_date));
            ?>
</td>
						<th scope="row">Page Views</th>
						<td><?php 
            echo $data->count_page_views;
            ?>
</td>
						<th scope="row">Device</th>
						<td><?php 
            echo $data->device;
            ?>
</td>
						
					</tr>
					<tr valign="top">
						<th scope="row">Mouse Clicks</th>
						<td><?php 
            echo $data->count_mouse_clicks;
            ?>
</td>
						<th scope="row">Touchscreen Taps</th>
						<td><?php 
            echo $data->count_touchscreen_taps;
            ?>
</td>
						<th scope="row">Operating System</th>
						<td><?php 
            echo $data->os;
            ?>
</td>
					</tr>
					<tr valign="top">
						<th scope="row">AJAX Actions</th>
						<td><?php 
            echo $data->count_ajax_actions;
            ?>
</td>
						<th scope="row">Custom Events</th>
						<td><?php 
            echo $data->count_total - $data->count_mouse_clicks - $data->count_touchscreen_taps - $data->count_page_views - $data->count_ajax_actions;
            ?>
</td>
						<th scope="row">Page Width</th>
						<td><?php 
            echo $data->page_width;
            ?>
px</td>
						</tr>
				</tbody>
			</table>
			<?php 
        } else {
            echo '<p>No summary found.</p>';
        }
    }