diff --git a/main/tracking/courseLog.php b/main/tracking/courseLog.php index 3eb4c39599..76bbaac79c 100644 --- a/main/tracking/courseLog.php +++ b/main/tracking/courseLog.php @@ -192,151 +192,6 @@ echo '
'; if($_GET['studentlist'] == 'false') { echo'

'; - - - /********************** - * TOOLS - **********************/ - - echo "
-

-  ".get_lang('ToolsMostUsed')." -

- "; - - $sql = "SELECT `access_tool`, COUNT(DISTINCT `access_user_id`),count( `access_tool` ) as count_access_tool - FROM $TABLETRACK_ACCESS - WHERE `access_tool` IS NOT NULL - AND `access_cours_code` = '$_cid' - GROUP BY `access_tool` - ORDER BY count_access_tool DESC - LIMIT 0, 3"; - $rs = api_sql_query($sql, __FILE__, __LINE__); - - if($export_csv){ - $temp=array(get_lang('ToolsMostUsed'),''); - $csv_content[] = $temp; - } - - while ($row = mysql_fetch_array($rs)) - { - echo ' - - - '; - if($export_csv){ - $temp=array(get_lang(ucfirst($row['access_tool'])),$row['count_access_tool'].' '.get_lang('Clicks')); - $csv_content[] = $temp; - } - } - - echo '
'.get_lang(ucfirst($row['access_tool'])).''.$row['count_access_tool'].' '.get_lang('Clicks').'
'; - - echo '
'; - - /*************************** - * LINKS - ***************************/ - - echo "
-

-  ".get_lang('LinksMostClicked')." -

- "; - - $sql = "SELECT `cl`.`title`, `cl`.`url`,count(DISTINCT `sl`.`links_user_id`), count(`cl`.`title`) as count_visits - FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl - WHERE `sl`.`links_link_id` = `cl`.`id` - AND `sl`.`links_cours_id` = '$_cid' - GROUP BY `cl`.`title`, `cl`.`url` - ORDER BY count_visits DESC - LIMIT 0, 3"; - $rs = api_sql_query($sql, __FILE__, __LINE__); - - if($export_csv){ - $temp=array(get_lang('LinksMostClicked'),''); - $csv_content[] = array('',''); - $csv_content[] = $temp; - } - - if(mysql_num_rows($rs)>0) - { - while($row = mysql_fetch_array($rs)) - { - echo ' - - - '; - if($export_csv){ - $temp=array($row['title'],$row['count_visits'].' '.get_lang('Clicks')); - $csv_content[] = $temp; - } - } - } - else - { - echo ''; - if($export_csv){ - $temp=array(get_lang('NoLinkVisited'),''); - $csv_content[] = $temp; - } - } - echo '
'.$row['title'].''.$row['count_visits'].' '.get_lang('Clicks').'
'.get_lang('NoLinkVisited').'
'; - - - echo '
'; - - - /*************************** - * DOCUMENTS - ***************************/ - - echo "
-

-  ".get_lang('DocumentsMostDownloaded')." -

- "; - - $sql = "SELECT `down_doc_path`, COUNT(DISTINCT `down_user_id`), COUNT(`down_doc_path`) as count_down - FROM $TABLETRACK_DOWNLOADS - WHERE `down_cours_id` = '$_cid' - GROUP BY `down_doc_path` - ORDER BY count_down DESC - LIMIT 0, 3"; - $rs = api_sql_query($sql, __FILE__, __LINE__); - - if($export_csv){ - $temp=array(get_lang('DocumentsMostDownloaded'),''); - $csv_content[] = array('',''); - $csv_content[] = $temp; - } - - if(mysql_num_rows($rs)>0) - { - while($row = mysql_fetch_array($rs)) - { - echo ' - - - '; - - if($export_csv){ - $temp=array($row['down_doc_path'],$row['count_down'].' '.get_lang('Clicks')); - $csv_content[] = $temp; - } - } - } - else - { - echo ''; - if($export_csv){ - $temp=array(get_lang('NoDocumentDownloaded'),''); - $csv_content[] = $temp; - } - } - echo '
'.$row['down_doc_path'].''.$row['count_down'].' '.get_lang('Clicks').'
'.get_lang('NoDocumentDownloaded').'
'; - - echo '
'; /*************************** @@ -456,6 +311,153 @@ if($_GET['studentlist'] == 'false') } echo ''; + echo '
'; + + + /********************** + * TOOLS + **********************/ + + echo "
+

+  ".get_lang('ToolsMostUsed')." +

+ "; + + $sql = "SELECT `access_tool`, COUNT(DISTINCT `access_user_id`),count( `access_tool` ) as count_access_tool + FROM $TABLETRACK_ACCESS + WHERE `access_tool` IS NOT NULL + AND `access_cours_code` = '$_cid' + GROUP BY `access_tool` + ORDER BY count_access_tool DESC + LIMIT 0, 3"; + $rs = api_sql_query($sql, __FILE__, __LINE__); + + if($export_csv){ + $temp=array(get_lang('ToolsMostUsed'),''); + $csv_content[] = $temp; + } + + while ($row = mysql_fetch_array($rs)) + { + echo ' + + + '; + if($export_csv){ + $temp=array(get_lang(ucfirst($row['access_tool'])),$row['count_access_tool'].' '.get_lang('Clicks')); + $csv_content[] = $temp; + } + } + + echo '
'.get_lang(ucfirst($row['access_tool'])).''.$row['count_access_tool'].' '.get_lang('Clicks').'
'; + + echo '
'; + + + /*************************** + * DOCUMENTS + ***************************/ + + echo "
+

+  ".get_lang('DocumentsMostDownloaded')." +

+ "; + + $sql = "SELECT `down_doc_path`, COUNT(DISTINCT `down_user_id`), COUNT(`down_doc_path`) as count_down + FROM $TABLETRACK_DOWNLOADS + WHERE `down_cours_id` = '$_cid' + GROUP BY `down_doc_path` + ORDER BY count_down DESC + LIMIT 0, 3"; + $rs = api_sql_query($sql, __FILE__, __LINE__); + + if($export_csv){ + $temp=array(get_lang('DocumentsMostDownloaded'),''); + $csv_content[] = array('',''); + $csv_content[] = $temp; + } + + if(mysql_num_rows($rs)>0) + { + while($row = mysql_fetch_array($rs)) + { + echo ' + + + '; + + if($export_csv){ + $temp=array($row['down_doc_path'],$row['count_down'].' '.get_lang('Clicks')); + $csv_content[] = $temp; + } + } + } + else + { + echo ''; + if($export_csv){ + $temp=array(get_lang('NoDocumentDownloaded'),''); + $csv_content[] = $temp; + } + } + echo '
'.$row['down_doc_path'].''.$row['count_down'].' '.get_lang('Clicks').'
'.get_lang('NoDocumentDownloaded').'
'; + + echo '
'; + + + /*************************** + * LINKS + ***************************/ + + echo "
+

+  ".get_lang('LinksMostClicked')." +

+ "; + + $sql = "SELECT `cl`.`title`, `cl`.`url`,count(DISTINCT `sl`.`links_user_id`), count(`cl`.`title`) as count_visits + FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl + WHERE `sl`.`links_link_id` = `cl`.`id` + AND `sl`.`links_cours_id` = '$_cid' + GROUP BY `cl`.`title`, `cl`.`url` + ORDER BY count_visits DESC + LIMIT 0, 3"; + $rs = api_sql_query($sql, __FILE__, __LINE__); + + if($export_csv){ + $temp=array(get_lang('LinksMostClicked'),''); + $csv_content[] = array('',''); + $csv_content[] = $temp; + } + + if(mysql_num_rows($rs)>0) + { + while($row = mysql_fetch_array($rs)) + { + echo ' + + + '; + if($export_csv){ + $temp=array($row['title'],$row['count_visits'].' '.get_lang('Clicks')); + $csv_content[] = $temp; + } + } + } + else + { + echo ''; + if($export_csv){ + $temp=array(get_lang('NoLinkVisited'),''); + $csv_content[] = $temp; + } + } + echo '
'.$row['title'].''.$row['count_visits'].' '.get_lang('Clicks').'
'.get_lang('NoLinkVisited').'
'; + + + echo '
'; // send the csv file if asked if($export_csv)