Example #1
0
<?php 
// check if uid is tutor of this group
if ($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse) {
    if (!$uInfo && !isset($uInfo)) {
        /*
         *		Display list of user of this group
         */
        echo "<h4>" . get_lang('ListStudents') . "</h4>";
        if ($is_allowedToTrackEverybodyInCourse) {
            // if user can track everybody : list user of course
            $sql = "SELECT count(user_id)\n                    FROM {$TABLECOURSUSER}\n                    WHERE course_code = '" . Database::escape_string($_cid) . "' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . "";
        } else {
            // if user can only track one group : list users of this group
            $sql = "SELECT count(user)\n                    FROM {$TABLECOURSE_GROUPSUSER}\n                    WHERE group_id = '" . Database::escape_string($_gid) . "'";
        }
        $userGroupNb = getOneResult($sql);
        $step = 25;
        // number of student per page
        if ($userGroupNb > $step) {
            if (!isset($offset)) {
                $offset = 0;
            }
            $next = $offset + $step;
            $previous = $offset - $step;
            $navLink = "<table width='100%' border='0'>\n" . "<tr>\n" . "<td align='left'>";
            if ($previous >= 0) {
                $navLink .= "<a href='" . api_get_self() . "?offset={$previous}'>&lt;&lt; " . get_lang('PreviousPage') . "</a>";
            }
            $navLink .= "</td>\n" . "<td align='right'>";
            if ($next < $userGroupNb) {
                $navLink .= "<a href='" . api_get_self() . "?offset={$next}'>" . get_lang('NextPage') . " &gt;&gt;</a>";
     $line = '';
     //Total
     $sql = "SELECT count(*)\n                    FROM {$TABLETRACK_ACCESS}\n                    WHERE access_cours_code = '" . $_cid . "'\n                        AND access_tool IS NULL";
     $count = getOneResult($sql);
     $line .= get_lang('CountToolAccess') . " ; " . $count . "\n";
     // last 31 days
     $sql = "SELECT count(*)\n                    FROM {$TABLETRACK_ACCESS}\n                    WHERE c_id = '{$course_id}'\n                        AND (access_date > DATE_ADD(CURDATE(), INTERVAL -31 DAY))\n                        AND access_tool IS NULL";
     $count = getOneResult($sql);
     $line .= get_lang('Last31days') . " ; " . $count . "\n";
     // last 7 days
     $sql = "SELECT count(*)\n                    FROM {$TABLETRACK_ACCESS}\n                    WHERE c_id = '{$course_id}'\n                        AND (access_date > DATE_ADD(CURDATE(), INTERVAL -7 DAY))\n                        AND access_tool IS NULL";
     $count = getOneResult($sql);
     $line .= get_lang('Last7days') . " ; " . $count . "\n";
     // today
     $sql = "SELECT count(*)\n                    FROM {$TABLETRACK_ACCESS}\n                    WHERE access_cours_code = '{$_cid}'\n                        AND ( access_date > CURDATE() )\n                        AND access_tool IS NULL";
     $count = getOneResult($sql);
     $line .= get_lang('Thisday') . " ; " . $count . "\n";
 }
 /* 	Tools */
 $tempView = $view;
 if ($view[2] == '1') {
     $tempView[2] = '0';
     $title[1] = $nameTools;
     $line = '';
     $title_line = get_lang('ToolTitleToolnameColumn') . ";" . get_lang('ToolTitleUsersColumn') . ";" . get_lang('ToolTitleCountColumn') . "\n";
     $sql = "SELECT access_tool, COUNT(DISTINCT access_user_id),count( access_tool )\n                FROM {$TABLETRACK_ACCESS}\n                WHERE access_tool IS NOT NULL AND c_id = '{$course_id}'\n                GROUP BY access_tool";
     $results = getManyResults3Col($sql);
     if (is_array($results)) {
         for ($j = 0; $j < count($results); $j++) {
             $line .= $results[$j][0] . "/" . get_lang($results[$j][0]) . ";" . $results[$j][1] . ";" . $results[$j][2] . "\n";
         }
Example #3
0
        {

            while ( list($key,$value) = each($results))
            {
                $beautifulDate = api_convert_and_format_date($value, null, date_default_timezone_get());
                echo "
    <tr>
        <td class='secLine'>
            ".$beautifulDate."
        </td>
    </tr>";

                if(!isset($previousDate))
                {
                    $sql = "SELECT NOW()";
                    $previousDate = getOneResult($sql);
                }



                $sql = "SELECT access_tool, count(access_tool), access_cours_code
                            FROM $TABLETRACK_ACCESS
                            WHERE access_user_id = '".$_user['user_id']."'".
                                //AND access_tool IS NOT NULL
                                "AND access_date > '".$value."'
                                AND access_date < '".$previousDate."'
                            GROUP BY access_tool, access_cours_code
                            ORDER BY access_cours_code ASC";

                $results2 = getManyResults3Col($sql);