From 21b84c8101f320787717f65ec76c77cbabc5be0a Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Tue, 17 Mar 2009 00:30:45 +0100 Subject: [PATCH] [svn r19085] logic changes -Added posibility to order data in gradebook tool - (partial FS#3805) --- main/gradebook/gradebook_showlog_eval.php | 34 +++++++++++++++++++++-- main/gradebook/gradebook_showlog_link.php | 33 +++++++++++++++++++++- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/main/gradebook/gradebook_showlog_eval.php b/main/gradebook/gradebook_showlog_eval.php index 6ea377a6d2..0335b1fbdf 100644 --- a/main/gradebook/gradebook_showlog_eval.php +++ b/main/gradebook/gradebook_showlog_eval.php @@ -7,7 +7,7 @@ Copyright (c) 2006 Dokeos SPRL Copyright (c) 2006 Ghent University (UGent) Copyright (c) various contributors - + Copyright (c) Isaac Flores Paz For a full list of contributors, see "credits.txt". The full license can be read in "license.txt". @@ -36,6 +36,7 @@ $interbreadcrumb[] = array ( 'name' => get_lang('Gradebook' )); Display :: display_header(''); +/* $t_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $t_user= Database :: get_main_table(TABLE_MAIN_USER); $evaledit = Evaluation :: load($_GET['visiblelog']); @@ -67,5 +68,34 @@ $result=api_sql_query($sql); echo ''.$row[6].''; echo ''; } -echo ''; +echo '';*/ + + +$t_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); +$t_user= Database :: get_main_table(TABLE_MAIN_USER); +$visible_log=Security::remove_XSS($_GET['visiblelog']); +$evaledit = Evaluation :: load($visible_log); +$sql="SELECT le.name,le.description,le.date_log,le.weight,le.visible,le.type,us.username from ".$t_linkeval_log." le inner join ".$t_user." us on le.user_id_log=us.user_id where id_linkeval_log=".$evaledit[0]->get_id()." and type='evaluation';"; +$result=api_sql_query($sql); +$list_info=array(); +while ($row=Database::fetch_row($result)) { + $list_info[]=$row; +} + +foreach($list_info as $key => $info_log) { + $list_info[$key][2]=($info_log[2]) ? date('d-m-Y H:i:s',$info_log[2]) : '0000-00-00 00:00:00'; + $list_info[$key][4]=($info_log[4]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); +} + +$parameters=array('visiblelog'=>Security::remove_XSS($_GET['visiblelog']),'selectcat'=>Security::remove_XSS($_GET['selectcat'])); +$table = new SortableTableFromArrayConfig($list_info, 1, count($list_info)); +$table->set_additional_parameters($parameters); +$table->set_header(0, get_lang('GradebookNameLog')); +$table->set_header(1, get_lang('GradebookDescriptionLog')); +$table->set_header(2, get_lang('Date')); +$table->set_header(3, get_lang('Weight')); +$table->set_header(4, get_lang('GradebookVisibilityLog')); +$table->set_header(5, get_lang('ResourceType')); +$table->set_header(6, get_lang('GradebookWhoChangedItLog')); +$table->display(); Display :: display_footer(); \ No newline at end of file diff --git a/main/gradebook/gradebook_showlog_link.php b/main/gradebook/gradebook_showlog_link.php index f91e2c70ee..e3a0bd6f39 100644 --- a/main/gradebook/gradebook_showlog_link.php +++ b/main/gradebook/gradebook_showlog_link.php @@ -7,7 +7,7 @@ Copyright (c) 2006 Dokeos SPRL Copyright (c) 2006 Ghent University (UGent) Copyright (c) various contributors - + Copyright (c) Isaac Flores Paz For a full list of contributors, see "credits.txt". The full license can be read in "license.txt". @@ -37,6 +37,7 @@ $interbreadcrumb[] = array ( )); Display :: display_header(''); +/* $t_user= Database :: get_main_table(TABLE_MAIN_USER); $t_link_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $evaledit = EvalLink :: load($_GET['visiblelink']); @@ -76,4 +77,34 @@ echo ''; echo ''; } echo ''; +*/ + +$t_user = Database :: get_main_table(TABLE_MAIN_USER); +$t_link_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); +$visible_link=Security::remove_XSS($_GET['visiblelink']); +$evaledit = EvalLink :: load($visible_link); +$sql="SELECT lk.name,lk.description,lk.date_log,lk.weight,lk.visible,lk.type,us.username from ".$t_link_log." lk inner join ".$t_user." us on lk.user_id_log=us.user_id where lk.id_linkeval_log=".$evaledit[0]->get_id()." and lk.type='link';"; +$result=api_sql_query($sql); +$list_info=array(); +while ($row=Database::fetch_row($result)) { + $list_info[]=$row; +} + +foreach($list_info as $key => $info_log) { + $list_info[$key][2]=($info_log[2]) ? date('d-m-Y H:i:s',$info_log[2]) : '0000-00-00 00:00:00'; + $list_info[$key][4]=($info_log[4]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); +} + +$parameters=array('visiblelink'=>Security::remove_XSS($_GET['visiblelink']),'selectcat'=>Security::remove_XSS($_GET['selectcat'])); +$table = new SortableTableFromArrayConfig($list_info, 1, count($list_info)); +$table->set_additional_parameters($parameters); +$table->set_header(0, get_lang('GradebookNameLog')); +$table->set_header(1, get_lang('GradebookDescriptionLog')); +$table->set_header(2, get_lang('Date')); +$table->set_header(3, get_lang('Weight')); +$table->set_header(4, get_lang('GradebookVisibilityLog')); +$table->set_header(5, get_lang('ResourceType')); +$table->set_header(6, get_lang('GradebookWhoChangedItLog')); +$table->display(); + Display :: display_footer(); \ No newline at end of file