示例#1
0
 /**
  * Displays the number of logins every month for a specific user in a specific course.
  * @param $view
  * @param int $user_id
  * @param int $course_id
  * @param int $session_id
  * @return array
  */
 public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0)
 {
     $MonthsLong = $GLOBALS['MonthsLong'];
     $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
     // protected data
     $user_id = intval($user_id);
     $session_id = intval($session_id);
     $course_id = intval($course_id);
     $tempView = $view;
     if (substr($view, 0, 1) == '1') {
         $new_view = substr_replace($view, '0', 0, 1);
         $title[1] = get_lang('LoginsAndAccessTools') . get_lang('LoginsDetails');
         $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)\n                    FROM {$track_access_table}\n                    WHERE access_user_id = {$user_id}\n                    AND c_id = {$course_id}\n                    AND access_session_id = {$session_id}\n                    GROUP BY YEAR(access_date),MONTH(access_date)\n                    ORDER BY YEAR(access_date),MONTH(access_date) ASC";
         //$results = getManyResults2Col($sql);
         $results = getManyResults3Col($sql);
         $title_line = get_lang('LoginsTitleMonthColumn') . ';' . get_lang('LoginsTitleCountColumn') . "\n";
         $line = '';
         $total = 0;
         if (is_array($results)) {
             for ($j = 0; $j < count($results); $j++) {
                 $line .= $results[$j][0] . ';' . $results[$j][1] . "\n";
                 $total = $total + $results[$j][1];
             }
             $line .= get_lang('Total') . ";" . $total . "\n";
         } else {
             $line = get_lang('NoResult') . "</center></td>";
         }
     } else {
         $new_view = substr_replace($view, '1', 0, 1);
     }
     return array($title_line, $line);
 }
示例#2
0
     $line = '';
     $title_line = get_lang('LinksTitleLinkColumn') . ";" . get_lang('LinksTitleUsersColumn') . ";" . get_lang('LinksTitleCountColumn') . "\n";
     if (is_array($results)) {
         for ($j = 0; $j < count($results); $j++) {
             $line .= $results[$j][1] . "'>" . $results[$j][0] . ";" . $results[$j][2] . ";" . $results[$j][3] . "\n";
         }
     } else {
         $line = get_lang('NoResult') . "\n";
     }
 }
 /* 	Documents */
 $tempView = $view;
 if ($view[4] == '1') {
     $tempView[4] = '0';
     $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path)\n                    FROM {$TABLETRACK_DOWNLOADS}\n                    WHERE c_id = {$courseId}\n                    GROUP BY down_doc_path";
     $results = getManyResults3Col($sql);
     $title[1] = $nameTools;
     $line = '';
     $title_line = get_lang('DocumentsTitleDocumentColumn') . ";" . get_lang('DocumentsTitleUsersColumn') . ";" . get_lang('DocumentsTitleCountColumn') . "\n";
     if (is_array($results)) {
         for ($j = 0; $j < count($results); $j++) {
             $line .= $results[$j][0] . ";" . $results[$j][1] . ";" . $results[$j][2] . "\n";
         }
     } else {
         $line = get_lang('NoResult') . "\n";
     }
 }
 /* 	Scorm contents and Learning Path */
 $tempView = $view;
 if ($view[5] == '1') {
     $tempView[5] = '0';
示例#3
0
     } else {
         $offset = 0;
     }
     echo $navLink;
     if (!settype($offset, 'integer') || !settype($step, 'integer')) {
         die('Offset or step variables are not integers.');
     }
     //sanity check of integer vars
     if ($is_allowedToTrackEverybodyInCourse) {
         // list of users in this course
         $sql = "SELECT u.user_id, u.firstname,u.lastname\n                FROM {$TABLECOURSUSER} cu , {$TABLEUSER} u\n                WHERE cu.user_id = u.user_id AND cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . "\n                AND cu.c_id = '{$courseId}'\n                LIMIT {$offset},{$step}";
     } else {
         // list of users of this group
         $sql = "SELECT u.user_id, u.firstname,u.lastname\n                FROM {$TABLECOURSE_GROUPSUSER} gu , {$TABLEUSER} u\n                WHERE gu.user_id = u.user_id\n                AND gu.group_id = '{$_gid}'\n                LIMIT {$offset},{$step}";
     }
     $list_users = getManyResults3Col($sql);
     for ($i = 0; $i < sizeof($list_users); $i++) {
         // just sum $i up
     }
 } else {
     // if uInfo is set
     /*
      * Informations about student uInfo
      */
     // these checks exists for security reasons, neither a prof nor a tutor can see statistics of a user from
     // another course, or group
     if ($is_allowedToTrackEverybodyInCourse) {
         // check if user is in this course
         $tracking_is_accepted = $is_course_member;
         $tracked_user_info = api_get_user_info($uInfo);
         $title[0] = $tracked_user_info[1] . '_' . $tracked_user_info[2];