From 36b9fbbfbc0b98cc3313c8c375ed0817c12e882e Mon Sep 17 00:00:00 2001 From: Cristian Fasanando Date: Fri, 13 Feb 2009 22:57:18 +0100 Subject: [PATCH] [svn r18503] Logic changes - Fixed A teacher (course administrator) couldn't qualify a student in the forum into flat,threaded,nested view thread - see FS#3510 --- main/forum/viewthread_flat.inc.php | 25 +++++++++++-------------- main/forum/viewthread_nested.inc.php | 11 +++-------- main/forum/viewthread_threaded.inc.php | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/main/forum/viewthread_flat.inc.php b/main/forum/viewthread_flat.inc.php index a2471343cd..be160875e8 100644 --- a/main/forum/viewthread_flat.inc.php +++ b/main/forum/viewthread_flat.inc.php @@ -72,21 +72,18 @@ foreach ($rows as $row) { $userinf=api_get_user_info($row['user_id']); $user_status=api_get_status_of_user_in_course($row['user_id'],api_get_course_id()); - if (api_is_course_tutor() && api_is_course_admin()) {// (api_is_course_tutor() && !api_is_course_admin() ) - $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$row['poster_id'],$_GET['thread']); - if( isset($_GET['gradebook'])){ - if ($increment>0 && $user_status!=1 ) { - $info_thread=get_thread_information(Security::remove_XSS($_GET['thread'])); - echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; - } - } else { - if ($increment>0 && $user_status!=1 ) { - echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; - } - } - } + $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$row['poster_id'],$_GET['thread']); + if( isset($_GET['gradebook'])){ + if ($increment>0 && $user_status!=1 ) { + $info_thread=get_thread_information(Security::remove_XSS($_GET['thread'])); + echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; + } + } else { + if ($increment>0 && $user_status!=1 ) { + echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; + } + } echo '

'; - //if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) { if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) { echo ''.get_lang('ReplyToMessage').'
'; diff --git a/main/forum/viewthread_nested.inc.php b/main/forum/viewthread_nested.inc.php index c9acf1468b..f8d486a0f9 100644 --- a/main/forum/viewthread_nested.inc.php +++ b/main/forum/viewthread_nested.inc.php @@ -80,15 +80,10 @@ foreach ($rows as $post) { } $userinf=api_get_user_info($post['user_id']); $user_status=api_get_status_of_user_in_course($post['user_id'],api_get_course_id()); - if(api_is_course_tutor() && api_is_course_admin()) { - if(api_is_allowed_to_edit()) { - if ($count>0 && $user_status!=1) { - $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$post['user_id'],$_GET['thread']); - echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; - } - } + if ($count>0 && $user_status!=1) { + $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$post['user_id'],$_GET['thread']); + echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; } - echo '

'; //if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true)) { diff --git a/main/forum/viewthread_threaded.inc.php b/main/forum/viewthread_threaded.inc.php index 9b6cbe4438..5971a5756c 100644 --- a/main/forum/viewthread_threaded.inc.php +++ b/main/forum/viewthread_threaded.inc.php @@ -252,22 +252,22 @@ if (api_is_allowed_to_edit(false,true) && !(api_is_course_coach() && $current_f sort($id_posts,SORT_NUMERIC); reset($id_posts); //the post minor - $post_minor=$id_posts[0]; - - if (!isset($_GET['id']) && (isset($_GET['post']) && $_GET['post']>$post_minor)) { + $post_minor=(int)$id_posts[0]; + $post_id = isset($_GET['post'])?(int)$_GET['post']:0; + if (!isset($_GET['id']) && $post_id>$post_minor) { echo "".icon('../img/deplacer_fichier.gif',get_lang('MovePost'))."\n"; } } $userinf=api_get_user_info($rows[$display_post_id]['user_id']); $user_status=api_get_status_of_user_in_course($rows[$display_post_id]['user_id'],api_get_course_id()); - if(api_is_course_tutor() && $_GET['post']>$post_minor ) - { - if(api_is_allowed_to_edit() && $user_status!=1) - { - $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$rows[$display_post_id]['user_id'],$_GET['thread']); - echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; - } - } +if($post_id>$post_minor ) +{ + if($user_status!=1) + { + $current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$rows[$display_post_id]['user_id'],$_GET['thread']); + echo "".icon('../img/new_test_small.gif',get_lang('Qualify'))."\n"; + } +} echo '

'; //if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit(false,true))