if (is_array($results)) { for ($j = 0; $j < sizeof($results); $j++) { $beautifulDateTime = api_convert_and_format_date($results[$j], null, date_default_timezone_get()); echo "<tr>"; echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>"; echo "</tr>"; // $limit is used to select only results between $results[$j] (current login) and next one if ($j == sizeof($results) - 1) { $limit = date("Y-m-d H:i:s", $nextReqDate); } else { $limit = $results[$j + 1]; } // select all access to tool between displayed date and next displayed date or now() if // displayed date is the last login date $sql = "SELECT access_tool, count(access_tool)\n FROM {$TABLETRACK_ACCESS}\n WHERE access_user_id = {$uInfo}\n AND access_tool IS NOT NULL\n AND access_date > '" . $results[$j] . "'\n AND access_date < '" . $limit . "'\n AND c_id = {$courseId}\n GROUP BY access_tool\n ORDER BY access_tool ASC"; $results2 = StatsUtils::getManyResults2Col($sql); if (is_array($results2)) { echo "<tr><td colspan='2'>\n"; echo "<table width='50%' cellpadding='0' cellspacing='0' border='0'>\n"; for ($k = 0; $k < count($results2); $k++) { echo "<tr>\n"; echo "<td width='70%' style='padding-left : 60px;'>" . get_lang($results2[$k][0]) . "</td>\n"; echo "<td width='30%' align='right' style='padding-right : 40px'>" . $results2[$k][1] . " " . get_lang('Visits') . "</td>\n"; echo "</tr>"; } echo "</table>\n"; echo "</td></tr>\n"; } $previousDate = $value; } } else {
/** * Displays the links followed for a specific user in a specific course. * @todo remove globals */ public function display_links_tracking_info($view, $userId, $courseCode) { global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; $courseId = api_get_course_int_id($courseCode); $userId = intval($userId); $line = null; if (substr($view, 3, 1) == '1') { $new_view = substr_replace($view, '0', 3, 1); $title[1] = get_lang('LinksDetails'); $sql = "SELECT cl.title, cl.url\n FROM {$TABLETRACK_LINKS} AS sl, {$TABLECOURSE_LINKS} AS cl\n WHERE sl.links_link_id = cl.id\n AND sl.c_id = {$courseId}\n AND sl.links_user_id = {$userId}\n GROUP BY cl.title, cl.url"; $results = StatsUtils::getManyResults2Col($sql); $title_line = get_lang('LinksTitleLinkColumn') . "\n"; if (is_array($results)) { for ($j = 0; $j < count($results); $j++) { $line .= $results[$j][0] . "\n"; } } else { $line = get_lang('NoResult'); } } else { $new_view = substr_replace($view, '1', 3, 1); } return array($title_line, $line); }