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 access_cours_code = '" . $_cid . "'
                            GROUP BY access_tool
                            ORDER BY access_tool ASC";
                    $results2 = 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;
                }
Example #2
0
 /**
  * Displays the links followed for a specific user in a specific course.
  * @todo remove globals
  */
 public function display_links_tracking_info($view, $user_id, $course_id)
 {
 	global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
     $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
                     FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
                     WHERE sl.links_link_id = cl.id
                         AND sl.links_cours_id = '$course_id'
                         AND sl.links_user_id = '$user_id'
                     GROUP BY cl.title, cl.url";
 		$results = 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);
 }