"../user/user.php", "name" => get_lang('Users')); $nameTools = get_lang('ToolName'); $htmlHeadXtra[] = " "; $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER); $TABLEUSER = Database::get_main_table(TABLE_MAIN_USER); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); Display::display_header($nameTools, "Tracking"); $courseId = api_get_course_int_id(); // the variables for the days and the months // Defining the shorts for the days $DaysShort = api_get_week_days_short(); // Defining the days of the week to allow translation of the days $DaysLong = api_get_week_days_long(); // Defining the months of the year to allow translation of the months $MonthsLong = api_get_months_long(); // Defining the months of the year to allow translation of the months $MonthsShort = api_get_months_short(); $is_allowedToTrack = $is_groupTutor; // allowed to track only user of one group $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all student in course ?>

" . COURSE_RELATION_TYPE_RRHH . " AND cu.c_id = '$courseId' AND u.user_id = '$uInfo'"; } else { $sql = "SELECT u.firstname,u.lastname, u.email FROM $TABLECOURSE_GROUPSUSER gu , $TABLEUSER u WHERE gu.user_id = u.user_id AND gu.group_id = '$_gid' AND u.user_id = '$uInfo'"; } $query = Database::query($sql); $res = @Database::fetch_array($query); if (is_array($res)) { $res[2] == "" ? $res2 = get_lang('NoEmail') : $res2 = Display::encrypted_mailto_link($res[2]); echo ""; /* * ***** MENU ******* */ echo " "; /* * ***** END OF MENU ******* */ switch ($period) { case "month" : $sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = $uInfo AND c_id = $courseId AND MONTH(access_date) = MONTH( FROM_UNIXTIME('$reqdate') ) AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate')) GROUP BY DAYOFMONTH(access_date) ORDER BY access_date ASC"; $displayedDate = $MonthsLong[date("n", $reqdate) - 1] . date(" Y", $reqdate); break; case "week" : $sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = $uInfo AND c_id = $courseId AND WEEK(access_date) = WEEK( FROM_UNIXTIME('$reqdate') ) AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate')) GROUP BY DAYOFMONTH(access_date) ORDER BY access_date ASC"; $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate))); $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)) )); $displayedDate = get_lang('From') . " " . date("d ", $weeklowreqdate) . $MonthsLong[date("n", $weeklowreqdate) - 1] . date(" Y", $weeklowreqdate) . " " . get_lang('To') . " " . date("d ", $weekhighreqdate) . $MonthsLong[date("n", $weekhighreqdate) - 1] . date(" Y", $weekhighreqdate); break; } echo ""; } else { echo get_lang('ErrorUserNotInGroup'); } } else { // not allowed api_not_allowed(); } ?>
"; echo $informationsAbout . " :
"; echo "
    \n" . "
  • " . get_lang('FirstName') . " : " . $res[0] . "
  • \n" . "
  • " . get_lang('LastName') . " : " . $res[1] . "
  • \n" . "
  • " . get_lang('Email') . " : " . $res2 . "
  • \n" . "
"; echo "
[" . get_lang('Back') . "] "; echo "    ||    [" . get_lang('PeriodWeek') . "] [" . get_lang('PeriodMonth') . "]    ||    "; switch ($period) { case "week" : // previous and next date must be evaluated $previousReqDate = $reqdate - 7 * 86400; $nextReqDate = $reqdate + 7 * 86400; echo " [" . get_lang('PreviousWeek') . "] [" . get_lang('NextWeek') . "] "; break; default : $period = "month"; case "month" : // previous and next date must be evaluated // 30 days should be a good approximation $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate)); $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate)); echo " [" . get_lang('PreviousMonth') . "] [" . get_lang('NextMonth') . "] "; break; } echo "
"; $results = StatsUtils::getManyResults1Col($sql); /* * * display of the displayed period ** */ echo ""; echo ""; 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 ""; echo ""; echo""; // $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) FROM $TABLETRACK_ACCESS WHERE access_user_id = $uInfo AND access_tool IS NOT NULL AND access_date > '" . $results[$j] . "' AND access_date < '" . $limit . "' AND c_id = $courseId GROUP BY access_tool ORDER BY access_tool ASC"; $results2 = StatsUtils::getManyResults2Col($sql); if (is_array($results2)) { echo "\n"; } $previousDate = $value; } } else { echo ""; echo ""; echo ""; } echo "
" . $displayedDate . "
" . $beautifulDateTime . "
\n"; echo "\n"; for ($k = 0; $k < count($results2); $k++) { echo "\n"; echo "\n"; echo "\n"; echo ""; } echo "
" . get_lang($results2[$k][0]) . "" . $results2[$k][1] . " " . get_lang('Visits') . "
\n"; echo "
" . get_lang('NoResult') . "
"; echo "