123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- <?php
- $language_file = "tracking";
- include('../inc/global.inc.php');
- $interbreadcrumb[]= array ("url"=>"../auth/profile.php", "name"=> get_lang('ModifyProfile'));
- $nameTools = get_lang('ToolName');
- $htmlHeadXtra[] = "<style type=\"text/css\">
- /*<![CDATA[*/
- .secLine {background-color : #E6E6E6;}
- .content {padding-left : 15px; padding-right : 15px;}
- .specialLink{color : #0000FF;}
- /*]]>*/
- </style>
- <style media='print' type='text/css'>
- /*<![CDATA[*/
- td {border-bottom: thin dashed gray;}
- /*]]>*/
- </style>";
- $view = preg_replace('/[^01]/','',$_REQUEST['view']);
- $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
- $TABLETRACK_ACCESS = $_configuration['statistics_database']."`.`track_e_access";
- $TABLETRACK_LINKS = $_configuration['statistics_database']."`.`track_e_links";
- $TABLETRACK_DOWNLOADS = $_configuration['statistics_database']."`.`track_e_downloads";
- $TABLETRACK_LOGIN = $_configuration['statistics_database']."`.`track_e_login";
- $TABLETRACK_EXERCICES = $_configuration['statistics_database']."`.`track_e_exercices";
- $limitOfDisplayedLogins = 25;
- include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");
- Display::display_header($nameTools,"Tracking");
- api_display_tool_title($nameTools);
- if ( $_configuration['tracking_enabled'] )
- {
-
-
- echo "
- <table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\">
- <tr>
- <td class='minilink'>
- [<a href='".api_get_self()."?view=1111111'>".get_lang('ShowAll')."</a>]
- [<a href='".api_get_self()."?view=0000000'>".get_lang('ShowNone')."</a>]
- </td>
- </tr>
- ";
- if(empty($view)) $view ="0000000";
-
- $tempView = $view;
- if($tempView[0] == '1')
- {
- $tempView[0] = '0';
- echo "
- <tr>
- <td valign='top'>
- <font color='#0000FF'>- </font>
- <b>".get_lang('Logins')."</b>
-
- [<a href='".api_get_self()."?view=".$tempView."'>".get_lang('Close')."</a>]
- </td>
- </tr>";
- $sql = "SELECT `login_date`
- FROM `".$TABLETRACK_LOGIN."`
- WHERE `login_user_id` = '".$_user['user_id']."'
- ORDER BY `login_date` DESC
- LIMIT ".$limitOfDisplayedLogins."";
- echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsExplaination')."<br/>";
- $results = getManyResults1Col($sql);
- echo "
- <table width='100%' cellpadding='2' cellspacing='1' border='0' align='center'>";
- if (is_array($results))
- {
- while ( list($key,$value) = each($results))
- {
- $timestamp = strtotime($value);
-
-
- $beautifulDate = format_locale_date($dateTimeFormatLong,$timestamp);
- 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_date > '".$value."'
- AND access_date < '".$previousDate."'
- GROUP BY access_tool, access_cours_code
- ORDER BY access_cours_code ASC";
- $results2 = getManyResults3Col($sql);
- if (is_array($results2))
- {
- echo "
- <tr>
- <td colspan='2'>
- <table width='50%' cellpadding='0' cellspacing='0' border='0' >";
- $previousCourse = "???";
- for($j = 0 ; $j < count($results2) ; $j++)
- {
-
- if($results2[$j][2] != $previousCourse)
- {
- echo "
- <tr>
- <td colspan='2' width='100%' style='padding-left : 40px;'>
- ".$results2[$j][2]."
- </td>
- </tr>";
- }
-
- if( $results2[$j][1] != 0 )
- {
- echo "<tr>";
- echo "<td width='70%' style='padding-left : 60px;'>".get_lang(ucfirst($results2[$j][0]))."</td>";
- echo "<td width='30%' align='right'>".$results2[$j][1]." ".get_lang('Visits')."</td>";
- echo "</tr>";
- }
- $previousCourse = $results2[$j][2];
- }
- echo "</table>";
- echo "</td></tr>";
- }
- $previousDate = $value;
- }
- }
- else
- {
- echo "<tr>";
- echo "<td colspan='2' bgcolor='#eeeeee' align='center' >".get_lang('NoResult')."</td>";
- echo"</tr>";
- }
- echo "</table>";
- echo "</td></tr>";
- }
- else
- {
- $tempView[0] = '1';
- echo "
- <tr>
- <td valign='top'>
- +<font color='#0000FF'> </font><a href='".api_get_self()."?view=".$tempView."' class='specialLink'>".get_lang('Logins')."</a>
- </td>
- </tr>
- ";
- }
-
-
- echo "\n</table>";
- }
- else
- {
- echo get_lang('TrackingDisabled');
- }
- Display::display_footer();
- ?>
|