Exemplo n.º 1
0
 echo "\n                </td>\n            </tr>\n        ";
 /*             * ***** END OF MENU ******* */
 switch ($period) {
     case "month":
         $sql = "SELECT access_date\n                        FROM {$TABLETRACK_ACCESS}\n                        WHERE access_user_id = {$uInfo}\n                        AND c_id = {$courseId}\n                        AND MONTH(access_date) = MONTH( FROM_UNIXTIME('{$reqdate}') )\n                        AND YEAR(access_date) = YEAR(FROM_UNIXTIME('{$reqdate}'))\n                        GROUP BY DAYOFMONTH(access_date)\n                        ORDER BY access_date ASC";
         $displayedDate = $MonthsLong[date("n", $reqdate) - 1] . date(" Y", $reqdate);
         break;
     case "week":
         $sql = "SELECT access_date\n                        FROM {$TABLETRACK_ACCESS}\n                        WHERE access_user_id = {$uInfo}\n                        AND c_id = {$courseId}\n                        AND WEEK(access_date) = WEEK( FROM_UNIXTIME('{$reqdate}') )\n                        AND YEAR(access_date) = YEAR(FROM_UNIXTIME('{$reqdate}'))\n                        GROUP BY DAYOFMONTH(access_date)\n                        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 "<tr><td>";
 $results = StatsUtils::getManyResults1Col($sql);
 /*             * * display of the displayed period  ** */
 echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' align=center>";
 echo "<td bgcolor='#E6E6E6'>" . $displayedDate . "</td>";
 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];
         }
Exemplo n.º 2
0
 /**
  * Displays the documents downloaded for a specific user in a specific course.
  * @param     string    kind of view inside tracking info
  * @param    int        User id
  * @param    string    Course code
  * @param    int        Session id (optional, default = 0)
  * @return     void
  */
 public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0)
 {
     // protect data
     $user_id = intval($user_id);
     $courseId = api_get_course_int_id($courseCode);
     $session_id = intval($session_id);
     $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
     if (substr($view, 4, 1) == '1') {
         $new_view = substr_replace($view, '0', 4, 1);
         $title[1] = get_lang('DocumentsDetails');
         $sql = "SELECT down_doc_path\n                        FROM {$downloads_table}\n                        WHERE c_id = {$courseId}\n                            AND down_user_id = {$user_id}\n                            AND down_session_id = {$session_id}\n                        GROUP BY down_doc_path";
         $results = StatsUtils::getManyResults1Col($sql);
         $title_line = get_lang('DocumentsTitleDocumentColumn') . "\n";
         $line = null;
         if (is_array($results)) {
             for ($j = 0; $j < count($results); $j++) {
                 $line .= $results[$j] . "\n";
             }
         } else {
             $line = get_lang('NoResult');
         }
     } else {
         $new_view = substr_replace($view, '1', 4, 1);
     }
     return array($title_line, $line);
 }