dokeos-tracking
[ class tree: dokeos-tracking ] [ index: dokeos-tracking ] [ all elements ]

Source for file personnalLog.php

Documentation is available at personnalLog.php

  1. <?php
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.  
  6.     Copyright (c) 2004 Dokeos S.A.
  7.     Copyright (c) 2003 Ghent University (UGent)
  8.     Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9.  
  10.     For a full list of contributors, see "credits.txt".
  11.     The full license can be read in "license.txt".
  12.  
  13.     This program is free software; you can redistribute it and/or
  14.     modify it under the terms of the GNU General Public License
  15.     as published by the Free Software Foundation; either version 2
  16.     of the License, or (at your option) any later version.
  17.  
  18.     See the GNU General Public License for more details.
  19.  
  20.     Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  21.     Mail: info@dokeos.com
  22. ==============================================================================
  23. */
  24. /**
  25. ==============================================================================
  26. *    @author Thomas Depraetere
  27. *    @author Hugues Peeters
  28. *    @author Christophe Gesche
  29. *    @author Sebastien Piraux
  30. *
  31. *    @package dokeos.tracking
  32. ==============================================================================
  33. */
  34.  
  35. /*
  36. ==============================================================================
  37.         INIT SECTION
  38. ==============================================================================
  39. */
  40.  
  41. // name of the language file that needs to be included
  42. $language_file "tracking";
  43. include('../inc/global.inc.php');
  44.  
  45. $interbreadcrumb[]array ("url"=>"../auth/profile.php""name"=> get_lang('ModifyProfile'));
  46. $nameTools get_lang('ToolName');
  47.  
  48. $htmlHeadXtra["<style type=\"text/css\">
  49. /*<![CDATA[*/
  50. .secLine {background-color : #E6E6E6;}
  51. .content {padding-left : 15px; padding-right : 15px;}
  52. .specialLink{color : #0000FF;}
  53. /*]]>*/
  54. </style>
  55. <style media='print' type='text/css'>
  56. /*<![CDATA[*/
  57. td {border-bottom: thin dashed gray;}
  58. /*]]>*/
  59. </style>";
  60.  
  61. /*
  62. -----------------------------------------------------------
  63.     Constants and variables
  64. -----------------------------------------------------------
  65. */
  66. //Remove all characters different than 0 and 1 from $view parameter
  67. $view preg_replace('/[^01]/','',$_REQUEST['view']);
  68.  
  69. $TABLECOURSUSER            Database::get_main_table(TABLE_MAIN_COURSE_USER);
  70. $TABLETRACK_ACCESS         $_configuration['statistics_database']."`.`track_e_access";
  71. $TABLETRACK_LINKS         $_configuration['statistics_database']."`.`track_e_links";
  72. $TABLETRACK_DOWNLOADS     $_configuration['statistics_database']."`.`track_e_downloads";
  73. $TABLETRACK_LOGIN         $_configuration['statistics_database']."`.`track_e_login";
  74. $TABLETRACK_EXERCICES   $_configuration['statistics_database']."`.`track_e_exercices";
  75.  
  76.  
  77. $limitOfDisplayedLogins 25// number of logins to display
  78. include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");
  79.  
  80. ////////////// OUTPUT //////////////////////
  81. Display::display_header($nameTools,"Tracking");
  82.  
  83. /*
  84. ==============================================================================
  85.         MAIN SECTION
  86. ==============================================================================
  87. */
  88. if $_configuration['tracking_enabled')
  89. {
  90.         // show all : view must be equal to the sum of all view values (1024+512+...+64)
  91.         // show none : 0
  92.  
  93.         echo "
  94. <table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\">
  95.     <tr>
  96.         <td class='minilink'>
  97.                 [<a href='".api_get_self()."?view=1111111'>".get_lang('ShowAll')."</a>]
  98.                 [<a href='".api_get_self()."?view=0000000'>".get_lang('ShowNone')."</a>]
  99.             </td>
  100.         </tr>
  101.         ";
  102.     if(empty($view)) $view ="0000000";
  103.  
  104.     /***************************************************************************
  105.      *
  106.      *        Logins
  107.      *
  108.      ***************************************************************************/
  109.     $tempView $view;
  110.     if($tempView[0== '1')
  111.     {
  112.         $tempView[0'0';
  113.         echo "
  114.     <tr>
  115.         <td valign='top'>
  116.             <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font>
  117.             <b>".get_lang('Logins')."</b>
  118.             &nbsp;&nbsp;&nbsp;
  119.                 [<a href='".api_get_self()."?view=".$tempView."'>".get_lang('Close')."</a>]
  120.         </td>
  121.     </tr>";
  122.         $sql "SELECT `login_date`
  123.                     FROM `".$TABLETRACK_LOGIN."`
  124.                     WHERE `login_user_id` = '".$_user['user_id']."'
  125.                     ORDER BY `login_date` DESC
  126.                     LIMIT ".$limitOfDisplayedLogins."";
  127.         echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsExplaination')."<br/>";
  128.         $results getManyResults1Col($sql);
  129.         echo "
  130. <table width='100%' cellpadding='2' cellspacing='1' border='0' align='center'>";
  131.         if (is_array($results))
  132.         {
  133.  
  134.             while list($key,$valueeach($results))
  135.             {
  136.                 $timestamp strtotime($value);
  137.                 //$beautifulDate = $langDay_of_weekNames['long'][date("w" , $timestamp)].date(" d " , $timestamp).$langMonthNames['long'][date("n", $timestamp)-1].date(" Y" , $timestamp);
  138.                 //$beautifulHour = date("H : i" , $timestamp);
  139.                 $beautifulDate format_locale_date($dateTimeFormatLong,$timestamp);
  140.                 echo "
  141.     <tr>
  142.         <td class='secLine'>
  143.             ".$beautifulDate."
  144.         </td>
  145.     </tr>";
  146.  
  147.                 if(!isset($previousDate))
  148.                 {
  149.                     $sql "SELECT NOW()";
  150.                     $previousDate getOneResult($sql);
  151.                 }
  152.  
  153.  
  154.  
  155.                 $sql "SELECT `access_tool`, count(access_tool), `access_cours_code`
  156.                             FROM `".$TABLETRACK_ACCESS."`
  157.                             WHERE `access_user_id` = '".$_user['user_id']."'".
  158.                                 //AND access_tool IS NOT NULL
  159.                                 "AND access_date > '".$value."'
  160.                                 AND access_date < '".$previousDate."'
  161.                             GROUP BY access_tool, access_cours_code
  162.                             ORDER BY access_cours_code ASC";
  163.  
  164.                 $results2 getManyResults3Col($sql);
  165.  
  166.                 if (is_array($results2))
  167.                 {
  168.                     echo "
  169.     <tr>
  170.         <td colspan='2'>
  171.             <table width='50%' cellpadding='0' cellspacing='0' border='0' >";
  172.  
  173.                     $previousCourse "???";
  174.                     for($j $j count($results2$j++)
  175.                     {
  176.                         // if course is different, write the name of the course
  177.                         if($results2[$j][2!= $previousCourse)
  178.                         {
  179.                             echo "
  180.                 <tr>
  181.                     <td colspan='2' width='100%' style='padding-left : 40px;'>
  182.                             ".$results2[$j][2]."
  183.                     </td>
  184.                 </tr>";
  185.                         }
  186.                         // if count != de 0 then display toolname et number of visits, else its a course visit
  187.                         if$results2[$j][1!= )
  188.                         {
  189.                             echo "<tr>";
  190.                             echo "<td width='70%' style='padding-left : 60px;'>".get_lang(ucfirst($results2[$j][0]))."</td>";
  191.                             echo "<td width='30%' align='right'>".$results2[$j][1]." ".get_lang('Visits')."</td>";
  192.                             echo "</tr>";
  193.                         }
  194.                         $previousCourse $results2[$j][2];
  195.                     }
  196.                     echo "</table>";
  197.                     echo "</td></tr>";
  198.                 }
  199.                 $previousDate $value;
  200.             }
  201.  
  202.         }
  203.         else
  204.         {
  205.             echo "<tr>";
  206.             echo "<td colspan='2' bgcolor='#eeeeee' align='center' >".get_lang('NoResult')."</td>";
  207.             echo"</tr>";
  208.         }
  209.         echo "</table>";
  210.         echo "</td></tr>";
  211.     }
  212.     else
  213.     {
  214.         $tempView[0'1';
  215.         echo "
  216.             <tr>
  217.                     <td valign='top'>
  218.                     +<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?view=".$tempView."' class='specialLink'>".get_lang('Logins')."</a>
  219.                     </td>
  220.             </tr>
  221.         ";
  222.     }
  223.  
  224.  
  225.     /***************************************************************************
  226.      *
  227.      *        Exercices
  228.      *
  229.      ***************************************************************************/
  230.     /*
  231.     $tempView = $view;
  232.     if($view[1] == '1')
  233.     {
  234.         $tempView[1] = '0';
  235.         echo "
  236.             <tr>
  237.                     <td valign='top'>
  238.                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('ExercicesResults')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?view=".$tempView."'>".get_lang('Close')."</a>]
  239.                     </td>
  240.             </tr>
  241.         ";
  242.         echo " Ceci est amen  etre dplac vers la page de garde des exercices ";
  243.         $sql = "SELECT `ce`.`title`, `te`.`exe_result` , `te`.`exe_weighting`, `te`.`exe_date`
  244.                     FROM `$TABLECOURSE_EXERCICES` AS ce , `$TABLETRACK_EXERCICES` AS te
  245.                     WHERE `te`.`exe_user_id` = '".$_user['user_id']."'
  246.                         AND `te`.`exe_exo_id` = `ce`.`id`
  247.                     ORDER BY `te`.`exe_cours_id` ASC, `ce`.`title` ASC, `te`.`exe_date`ASC";
  248.  
  249.         echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
  250.         $results = getManyResultsXCol($sql,4);
  251.         echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>";
  252.         echo "<tr>
  253.                 <td class='secLine' width='60%'>
  254.                 ".get_lang('ExercicesTitleExerciceColumn')."
  255.                 </td>
  256.                 <td class='secLine' width='20%'>
  257.                 ".get_lang('Date')."
  258.                 </td>
  259.                 <td class='secLine' width='20%'>
  260.                 ".get_lang('ExercicesTitleScoreColumn')."
  261.                 </td>
  262.             </tr>";
  263.         if (is_array($results))
  264.         {
  265.             for($i = 0; $i < sizeof($results); $i++)
  266.             {
  267.                 if( $results[$i][1] < ($results[$i][2]/2) )
  268.                     $scoreColor = "red";
  269.                 elseif( $results[$i][1] > ($results[$i][2]/100*60) )
  270.                     $scoreColor = "green";
  271.                 else
  272.                     $scoreColor = "#FF8C00";
  273.                 echo "<tr>";
  274.                 echo "<td class='content'>".$results[$i][0]."</td>";
  275.                 echo "<td class='content'>".$results[$i][3]."</td>";
  276.                 echo "<td valign='top' align='right' class='content'><font color=$scoreColor>".$results[$i][1]." / ".$results[$i][2]."</font></td>";
  277.                 echo"</tr>";
  278.             }
  279.  
  280.         }
  281.         else
  282.         {
  283.             echo "<tr>";
  284.             echo "<td colspan='2' align='center'>".get_lang('NoResult')."</td>";
  285.             echo"</tr>";
  286.         }
  287.         echo "</table>";
  288.         echo "</td></tr>";
  289.  
  290.     }
  291.     else
  292.     {
  293.         $tempView[1] = '1';
  294.         echo "
  295.             <tr>
  296.                     <td valign='top'>
  297.                     <font color='#0000FF'>+&nbsp;&nbsp;</font><a href='".api_get_self()."?view=".$tempView."' class='specialLink'>".get_lang('ExercicesResults')."</a>
  298.                     </td>
  299.             </tr>
  300.         ";
  301.     }
  302.     */
  303.     echo "\n</table>";
  304. }
  305. else
  306. {
  307.     echo get_lang('TrackingDisabled');
  308. }
  309.  
  310. ?>

Documentation generated on Thu, 12 Jun 2008 14:12:18 -0500 by phpDocumentor 1.4.1