[svn r18019] logic changes - allow qualify to teacher - (see FS#3545)

skala
Isaac Flores 16 years ago
parent caaee89e74
commit cc34a2daff
  1. 16
      main/forum/viewthread_flat.inc.php
  2. 12
      main/forum/viewthread_nested.inc.php
  3. 5
      main/forum/viewthread_threaded.inc.php
  4. 13
      main/inc/lib/main_api.lib.php

@ -71,16 +71,20 @@ foreach ($rows as $row) {
}
$userinf=api_get_user_info($row['user_id']);
if ($userinf['status']!='1') {
if (api_is_allowed_to_edit()) {
$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'])){
$info_thread=get_thread_information(Security::remove_XSS($_GET['thread']));
echo "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".$info_thread['forum_id']."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=list&amp;post=".$row['post_id']."&amp;user=".$row['poster_id']."&user_id=".$row['poster_id']."&origin=".$origin."&idtextqualify=".$current_qualify_thread."&gradebook=".$_GET['gradebook']."\" >".icon('../img/new_test_small.gif',get_lang('Qualify'))."</a>\n";
echo $increment;
if ($increment>0 && $user_status!=1 ) {
$info_thread=get_thread_information(Security::remove_XSS($_GET['thread']));
echo "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".$info_thread['forum_id']."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=list&amp;post=".$row['post_id']."&amp;user=".$row['poster_id']."&user_id=".$row['poster_id']."&origin=".$origin."&idtextqualify=".$current_qualify_thread."&gradebook=".$_GET['gradebook']."\" >".icon('../img/new_test_small.gif',get_lang('Qualify'))."</a>\n";
}
} else {
echo "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=list&amp;post=".$row['post_id']."&amp;user=".$row['poster_id']."&user_id=".$row['poster_id']."&origin=".$origin."&idtextqualify=".$current_qualify_thread."\" >".icon('../img/new_test_small.gif',get_lang('Qualify'))."</a>\n";
if ($increment>0 && $user_status!=1 ) {
echo "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=list&amp;post=".$row['post_id']."&amp;user=".$row['poster_id']."&user_id=".$row['poster_id']."&origin=".$origin."&idtextqualify=".$current_qualify_thread."\" >".icon('../img/new_test_small.gif',get_lang('Qualify'))."</a>\n";
}
}
}
}
echo '<br /><br />';
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit())

@ -79,12 +79,16 @@ foreach ($rows as $post) {
}
}
$userinf=api_get_user_info($post['user_id']);
if($userinf['status']!='1') {
if(api_is_allowed_to_edit()) {
$current_qualify_thread=show_qualify('1',$_GET['cidReq'],$_GET['forum'],$post['user_id'],$_GET['thread']);
echo "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=list&amp;post=".$post['post_id']."&amp;user=".$post['user_id']."&user_id=".$post['user_id']."&origin=".$origin."&idtextqualify=".$current_qualify_thread."\" >".icon('../img/new_test_small.gif',get_lang('Qualify'))."</a>\n";
$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 "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=list&amp;post=".$post['post_id']."&amp;user=".$post['user_id']."&user_id=".$post['user_id']."&origin=".$origin."&idtextqualify=".$current_qualify_thread."\" >".icon('../img/new_test_small.gif',get_lang('Qualify'))."</a>\n";
}
}
}
echo '<br /><br />';
//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)) {

@ -259,9 +259,10 @@ if (api_is_allowed_to_edit(false,true) && !(api_is_course_coach() && $current_f
}
}
$userinf=api_get_user_info($rows[$display_post_id]['user_id']);
if($userinf['status']!='1')
$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())
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 "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=list&amp;post=".$rows[$display_post_id]['post_id']."&amp;user=".$rows[$display_post_id]['user_id']."&user_id=".$rows[$display_post_id]['user_id']."&origin=".$origin."&idtextqualify=".$current_qualify_thread."\" >".icon('../img/new_test_small.gif',get_lang('Qualify'))."</a>\n";

@ -2987,4 +2987,17 @@ function api_get_current_access_url_id()
} else {
return $access_url_id;
}
}
/**
* @author florespaz@bidsoftperu.com
* @param integer $user_id
* @param string $course_code
* @return integer status
*/
function api_get_status_of_user_in_course ($user_id,$course_code) {
$tbl_rel_course_user=Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql='SELECT status FROM '.$tbl_rel_course_user.' WHERE user_id='.$user_id.' AND course_code="'.$course_code.'";';
$result=api_sql_query($sql,__FILE__,__LINE__);
$row_status=Database::fetch_array($result,'ASSOC');
return $row_status['status'];
}
Loading…
Cancel
Save