$sql = "SELECT access_date
                            FROM $TABLETRACK_ACCESS
                            WHERE access_user_id = '$uInfo'
                            AND access_cours_code = '" . $_cid . "'
                            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 "<tr><td>";
            $results = 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];
                    // select all access to tool between displayed date and next displayed date or now() if
示例#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, $course_id, $session_id = 0)
    {
    	// protect data
    	$user_id     = intval($user_id);
    	$course_id     = Database::escape_string($course_id);
    	$session_id = intval($session_id);

    	$downloads_table = Database::get_statistic_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
                        FROM $downloads_table
                        WHERE down_cours_id = '$course_id'
                            AND down_user_id = '$user_id'
                            AND down_session_id = '$session_id'
                        GROUP BY down_doc_path";

    		$results = 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);
    }