fix preview in forum qualify page #TMI

1.10.x
aragonc 10 years ago
parent b8c05e3478
commit 3f374bd27a
  1. 85
      main/forum/forumfunction.inc.php
  2. 3
      main/forum/forumqualify.php
  3. 2
      main/forum/viewpost.inc.php

@ -2003,26 +2003,26 @@ function get_thread_users_details($thread_id)
$session_info = api_get_session_info(api_get_session_id());
$user_to_avoid = "'".$session_info['id_coach']."', '".$session_info['session_admin_id']."'";
//not showing coaches
$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, thread_id
FROM $t_posts , $t_users user, $t_session_rel_user session_rel_user_rel_course
WHERE poster_id = user.user_id AND
user.user_id = session_rel_user_rel_course.user_id AND
$sql = "SELECT DISTINCT user.id, user.lastname, user.firstname, thread_id
FROM $t_posts p, $t_users user, $t_session_rel_user session_rel_user_rel_course
WHERE p.poster_id = user.id AND
user.id = session_rel_user_rel_course.user_id AND
session_rel_user_rel_course.status<>'2' AND
session_rel_user_rel_course.user_id NOT IN ($user_to_avoid) AND
thread_id = ".intval($thread_id)." AND
p.thread_id = ".intval($thread_id)." AND
session_id = ".api_get_session_id()." AND
c_id = $course_id AND
session_rel_user_rel_course.c_id = '".$course_id."' $orderby ";
p.c_id = $course_id AND
session_rel_user_rel_course.c_id = ".$course_id." $orderby ";
} else {
$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, thread_id
FROM $t_posts , $t_users user, $t_course_user course_user
WHERE poster_id = user.user_id
AND user.user_id = course_user.user_id
$sql = "SELECT DISTINCT user.id, user.lastname, user.firstname, thread_id
FROM $t_posts p, $t_users user, $t_course_user course_user
WHERE p.poster_id = user.id
AND user.id = course_user.user_id
AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
AND thread_id = ".intval($thread_id)."
AND p.thread_id = ".intval($thread_id)."
AND course_user.status NOT IN('1') AND
c_id = $course_id AND
session_rel_user_rel_course.c_id = '".$course_id."' $orderby";
p.c_id = $course_id AND
course_user.c_id = ".$course_id." $orderby";
}
$result = Database::query($sql);
@ -2034,9 +2034,8 @@ function get_thread_users_details($thread_id)
* @param int Thread ID
* @param string Course DB name (optional)
* @return array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[])
* @author Jhon Hinojosa<jhon.hinojosa@dokeos.com>,
* @author Jhon Hinojosa
* @todo this function need to be improved
* @version octubre 2008, dokeos 1.8
*/
function get_thread_users_qualify($thread_id)
{
@ -2059,33 +2058,33 @@ function get_thread_users_qualify($thread_id)
$session_info = api_get_session_info(api_get_session_id());
$user_to_avoid = "'".$session_info['id_coach']."', '".$session_info['session_admin_id']."'";
//not showing coaches
$sql = "SELECT DISTINCT post.poster_id, user.lastname, user.firstname, post.thread_id,user.user_id,qualify.qualify
FROM $t_posts post , $t_users user, $t_session_rel_user session_rel_user_rel_course, $t_qualify qualify
WHERE poster_id = user.user_id
$sql = "SELECT DISTINCT post.poster_id, user.lastname, user.firstname, post.thread_id,user.id,qualify.qualify
FROM $t_posts post , $t_users user, $t_session_rel_user scu, $t_qualify qualify
WHERE poster_id = user.id
AND post.poster_id = qualify.user_id
AND user.user_id = session_rel_user_rel_course.user_id
AND session_rel_user_rel_course.status<>'2'
AND session_rel_user_rel_course.user_id NOT IN ($user_to_avoid)
AND qualify.thread_id = '".Database::escape_string($thread_id)."'
AND post.thread_id = '".Database::escape_string($thread_id)."'
AND session_id = '".api_get_session_id()."'
AND session_rel_user_rel_course.c_id = '".$course_id."' AND
AND user.id = session_rel_user_rel_course.user_id
AND scu.status<>'2'
AND scu.user_id NOT IN ($user_to_avoid)
AND qualify.thread_id = ".intval($thread_id)."
AND post.thread_id = ".intval($thread_id)."
AND session_id = ".api_get_session_id()."
AND scu.c_id = ".$course_id." AND
qualify.c_id = $course_id AND
post.c_id = $course_id
$orderby ";
} else {
$sql = "SELECT DISTINCT post.poster_id, user.lastname, user.firstname, post.thread_id,user.user_id,qualify.qualify
$sql = "SELECT DISTINCT post.poster_id, user.lastname, user.firstname, post.thread_id,user.id,qualify.qualify
FROM $t_posts post,
$t_qualify qualify,
$t_users user,
$t_course_user course_user
WHERE
post.poster_id = user.user_id
post.poster_id = user.id
AND post.poster_id = qualify.user_id
AND user.user_id = course_user.user_id
AND user.id = course_user.user_id
AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
AND qualify.thread_id = '".Database::escape_string($thread_id)."'
AND post.thread_id = '".Database::escape_string($thread_id)."'
AND qualify.thread_id = ".intval($thread_id)."
AND post.thread_id = ".intval($thread_id)."
AND course_user.status not in('1')
AND course_user.c_id = $course_id
AND qualify.c_id = $course_id
@ -2139,24 +2138,24 @@ function get_thread_users_not_qualify($thread_id)
$session_info = api_get_session_info(api_get_session_id());
$user_to_avoid = "'".$session_info['id_coach']."', '".$session_info['session_admin_id']."'";
//not showing coaches
$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, post.thread_id
$sql = "SELECT DISTINCT user.id, user.lastname, user.firstname, post.thread_id
FROM $t_posts post , $t_users user, $t_session_rel_user session_rel_user_rel_course
WHERE poster_id = user.user_id
AND user.user_id NOT IN (".$cad.")
AND user.user_id = session_rel_user_rel_course.user_id
WHERE poster_id = user.id
AND user.id NOT IN (".$cad.")
AND user.id = session_rel_user_rel_course.user_id
AND session_rel_user_rel_course.status<>'2'
AND session_rel_user_rel_course.user_id NOT IN ($user_to_avoid)
AND post.thread_id = '".Database::escape_string($thread_id)."'
AND session_id = '".api_get_session_id()."'
AND session_rel_user_rel_course.c_id = '".$course_id."' AND post.c_id = $course_id $orderby ";
AND post.thread_id = ".intval($thread_id)."
AND session_id = ".api_get_session_id()."
AND session_rel_user_rel_course.c_id = $course_id AND post.c_id = $course_id $orderby ";
} else {
$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, post.thread_id
$sql = "SELECT DISTINCT user.id, user.lastname, user.firstname, post.thread_id
FROM $t_posts post, $t_users user,$t_course_user course_user
WHERE post.poster_id = user.user_id
AND user.user_id NOT IN (".$cad.")
AND user.user_id = course_user.user_id
WHERE post.poster_id = user.id
AND user.id NOT IN (".$cad.")
AND user.id = course_user.user_id
AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
AND post.thread_id = '".Database::escape_string($thread_id)."'
AND post.thread_id = ".intval($thread_id)."
AND course_user.status not in('1')
AND course_user.c_id = $course_id AND post.c_id = $course_id $orderby";
}

@ -233,6 +233,9 @@ if ($allowToQualify) {
array(get_lang('Qualification'), get_lang('MaxScore').' '.$maxQualify),
$qualify
);
include 'viewpost.inc.php';
$form->addButtonSave(get_lang('QualifyThisThread'));
$form->setDefaults(array('idtextqualify' => $qualify));
$form->display();

@ -119,8 +119,10 @@ $result = get_statistical_information(
api_get_course_int_id()
);
/*
if ($userInfo['status']!='1') {
echo '<div class="forum-qualification-input-box">';
require_once 'forumbody.inc.php';
echo '</div>';
}
*/

Loading…
Cancel
Save