$viewportWidth[] = $vpw; $viewportHeight[] = $vph; $cX = array_map('intval', explode(",", $log['coords_x'])); $cY = array_map('intval', explode(",", $log['coords_y'])); $cl = array_map('intval', explode(",", $log['clicks'])); $weights[] = count($cX); $coordsX[] = $cX; // we'll need'em later $coordsY[] = $cY; // $clicks[] = $cl; // $fps[] = (int) $log['fps']; $hovered .= $log['hovered']; $clicked .= $log['clicked']; $timestamp = mask_client($log['client_id']) . '\\n' . date("h:i A", strtotime($log['sess_date'])); $hn = new Hypernote($_GET['pid'], $_SESSION['login']); $hypernotes = $hn->getData(false); // build JavaScript object $JSON[] = '{' . '"id": ' . $log['id'] . ', ' . '"xcoords": [' . $log['coords_x'] . '], ' . '"ycoords": [' . $log['coords_y'] . '], ' . '"clicks": [' . $log['clicks'] . '], ' . '"timestamp": "' . $timestamp . '", ' . '"hypernotes": ' . json_encode($hypernotes) . ', ' . '"wprev": ' . $vpw . ', ' . '"hprev": ' . $vph . ', ' . '"time": ' . $log['sess_time'] . '' . '}'; } // set a common frame rate for all tracks $fps = ceil(array_avg($fps)); $viewportWidth = ceil(array_avg($viewportWidth)); $viewportHeight = ceil(array_avg($viewportHeight)); // compute the average user path, if need be --------------------------------- if (db_option(TBL_PREFIX . TBL_CMS, "displayAvgTrack")) { // preprocess: pad all mouse vectors $maxWeight = max($weights); foreach ($weights as $i => $w) { $items = count($coordsX[$i]);
function select_client() { $s = '<label for="client">User</label> '; $s .= '<select id="client" name="client_id" class="mr">'; $s .= '<option value="">---</option>'; $rows = db_select_all(TBL_PREFIX . TBL_RECORDS, "DISTINCT client_id", "1"); foreach ($rows as $row) { $select = isset($_SESSION['client_id']) && $row['client_id'] == $_SESSION['client_id'] ? 'selected="selected"' : null; $s .= '<option ' . $select . ' value="' . $row['client_id'] . '">' . mask_client($row['client_id']) . '</option>'; } $s .= '</select>'; return $s; }
// display a start on first time visitors $ftu = $r['ftu'] ? ' class="ftu"' : null; $abbrDate = date('Y/m/d', strtotime($r['sess_date'])); // use pretty date? $displayDate = $usePrettyDate ? '<abbr title="' . prettyDate::getStringResolved($r['sess_date']) . '">' . $abbrDate . '</abbr>' : $abbrDate; $browsingTime = $r['sess_time']; //$locationId = mask_client(md5($r['ip'])); $lang = $browser->getLanguage(); if ($lang != $browser::LANGUAGE_UNKNOWN) { $locationId = '<img src="styles/blank.gif" class="flag flag-' . $lang . '" alt="' . $lang . '" title="' . $lang . '" />'; } else { $locationId = "?"; } $displayId = 'id=' . $r['id']; $pageId = $r['cache_id']; $clientId = mask_client($r['client_id']); $interactionTime = round(count(explode(",", $r['coords_x'])) / $r['fps'], 2); $numClicks = count_clicks($r['clicks']); $notes = db_select(TBL_PREFIX . TBL_HYPERNOTES, "count(*) as num", "record_id='" . $r['id'] . "'"); $numNotes = $notes['num'] > 0 ? '<a href="./hypernotes/list.php?id=' . $r['id'] . '">' . $notes['num'] . '</a>' : $notes['num']; } $cache = db_select(TBL_PREFIX . TBL_CACHE, "url", "id='" . $pageId . "'"); $domain = url_get_domain($cache['url']); $replayUrl = TRACKING_SERVER . "admin/ext/logs/track.php?" . $displayId; $deleteUrl = TRACKING_SERVER . "admin/ext/logs/delete.php?" . $displayId; $item = ["ftu" => $ftu, "clientId" => $clientId, "locationId" => $locationId, "pageId" => $pageId, "domain" => $domain, "domain_id" => $r['domain_id'], "cache" => $cache, "recordData" => $r, "displayDate" => $displayDate, "interactionTime" => $interactionTime, "numClicks" => $numClicks, "numNotes" => $numNotes, "replayUrl" => $replayUrl, "deleteUrl" => $deleteUrl]; $items[] = $item; } } header('Content-Type: application/json'); echo json_encode(array('rows' => $items));