Fix forum tool - refs BT#9892 #TMI

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent d34388a172
commit 2327acd906
  1. 5
      main/forum/index.php
  2. 2
      main/forum/newthread.php
  3. 16
      main/forum/viewforum.php
  4. 22
      main/forum/viewforumcategory.php
  5. 10
      main/forum/viewpost.inc.php
  6. 32
      main/forum/viewthread_flat.inc.php
  7. 17
      main/forum/viewthread_nested.inc.php

@ -310,7 +310,7 @@ if (is_array($forumCategories)) {
);
$iconsEdit .= return_lock_unlock_icon(
'forumcategory',
strval(intval($$idCategory)),
strval(intval($idCategory)),
strval(intval($forumCategory['locked']))
);
$iconsEdit .= return_up_down_icon(
@ -526,9 +526,10 @@ if (is_array($forumCategories)) {
$html .= '</div>';
$html .= '</div>';
$iconEmpty='';
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
$iconEmpty='';
$newPost='';
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
$newPost = ' '.

@ -137,7 +137,7 @@ if (isset($_POST['add_resources']) AND $_POST['add_resources'] == get_lang('Reso
$_SESSION['formelements'] = $_POST;
$_SESSION['origin'] = $_SERVER['REQUEST_URI'];
$_SESSION['breadcrumbs'] = $interbreadcrumb;
header('Location: ../resourcelinker/resourcelinker.php');
Header::location('../resourcelinker/resourcelinker.php');
}
/* Header */

@ -178,7 +178,9 @@ if ($my_action == 'liststd' &&
(api_is_allowed_to_edit(null, true) || $is_group_tutor)
) {
$active = null;
switch ($_GET['list']) {
$listType = isset($_GET['list']) ? $_GET['list'] : null;
switch ($listType) {
case 'qualify':
$student_list = get_thread_users_qualify($_GET['id']);
$nrorow3 = -2;
@ -222,7 +224,7 @@ if ($my_action == 'liststd' &&
$table_list .= '<tr >';
$table_list .= '<th height="24">'.get_lang('NamesAndLastNames').'</th>';
if ($_GET['list'] == 'qualify') {
if ($listType == 'qualify') {
$table_list.= '<th>'.get_lang('Qualification').'</th>';
}
if (api_is_allowed_to_edit(null, true)) {
@ -234,7 +236,7 @@ if ($my_action == 'liststd' &&
if (Database::num_rows($student_list) > 0) {
while ($row_student_list=Database::fetch_array($student_list)) {
$userInfo = api_get_user_info($row_student_list['user_id']);
$userInfo = api_get_user_info($row_student_list['id']);
if ($counter_stdlist % 2 == 0) {
$class_stdlist = 'row_odd';
} else {
@ -244,23 +246,23 @@ if ($my_action == 'liststd' &&
$table_list .= UserManager::getUserProfileLink($userInfo);
$table_list .= '</td>';
if ($_GET['list'] == 'qualify') {
if ($listType == 'qualify') {
$table_list .= '<td>'.$row_student_list['qualify'].'/'.$max_qualify.'</td>';
}
if (api_is_allowed_to_edit(null, true)) {
$current_qualify_thread = showQualify(
'1',
$row_student_list['user_id'],
$row_student_list['id'],
$_GET['id']
);
$table_list .= '<td>
<a href="'.$forumUrl.'forumqualify.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($my_forum).'&thread='.Security::remove_XSS($_GET['id']).'&user='.$row_student_list['user_id'].'&user_id='.$row_student_list['user_id'].'&idtextqualify='.$current_qualify_thread.'&origin='.$origin.'">'.
<a href="'.$forumUrl.'forumqualify.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($my_forum).'&thread='.Security::remove_XSS($_GET['id']).'&user='.$row_student_list['id'].'&user_id='.$row_student_list['id'].'&idtextqualify='.$current_qualify_thread.'&origin='.$origin.'">'.
Display::return_icon($icon_qualify, get_lang('Qualify')).'</a></td></tr>';
}
$counter_stdlist++;
}
} else {
if ($_GET['list'] == 'qualify') {
if ($listType == 'qualify') {
$table_list .= '<tr><td colspan="2">'.get_lang('ThereIsNotQualifiedLearners').'</td></tr>';
} else {
$table_list .= '<tr><td colspan="2">'.get_lang('ThereIsNotUnqualifiedLearners').'</td></tr>';

@ -48,6 +48,13 @@ $nameTools = get_lang('ToolForum');
require 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
// Are we in a lp ?
$origin = '';
if (isset($_GET['origin'])) {
$origin = Security::remove_XSS($_GET['origin']);
}
/* Header and Breadcrumbs */
$gradebook = null;
if (isset($_SESSION['gradebook'])) {
@ -73,12 +80,6 @@ if (!empty($_GET['action']) && !empty($_GET['content'])) {
$interbreadcrumb[] = array('url' => '#','name' => $current_forum_category['cat_title']);
}
// Are we in a lp ?
$origin = '';
if (isset($_GET['origin'])) {
$origin = Security::remove_XSS($_GET['origin']);
}
if ($origin=='learnpath') {
Display::display_reduced_header();
} else {
@ -175,7 +176,7 @@ if ($action_forums != 'add') {
$linkForumCategory = 'viewforumcategory.php?'.api_get_cidreq().'&amp;forumcategory='.strval(intval($forumId));
$descriptionCategory = $forum_category['cat_comment'];
$icoCategory = Display::return_icon('forum_blue.png',
get_lang($forumCategory['cat_title']),
get_lang($forum_category['cat_title']),
array('class'=>''),
ICON_SIZE_MEDIUM
);
@ -202,6 +203,8 @@ if ($action_forums != 'add') {
$html .= Display::tag('div',$iconsEdit,array('class'=>'pull-right'));
}
$session_img = api_get_session_image($forum_category['session_id'], $_user['status']);
$html .= Display::tag(
'h3',
$icoCategory.
@ -347,7 +350,7 @@ if ($action_forums != 'add') {
$html .= '<div class="col-md-9">';
$iconForum = Display::return_icon(
'forum_yellow.png',
get_lang($forumCategory['cat_title']),
get_lang($forum_category['cat_title']),
null,
ICON_SIZE_MEDIUM
);
@ -378,9 +381,10 @@ if ($action_forums != 'add') {
$html .= '</div>';
$html .= '<div class="col-md-6">';
$iconEmpty='';
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
$iconEmpty='';
$newPost='';
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
$newPost = ' '.

@ -39,7 +39,7 @@ if (isset($rows)) {
echo Display::page_subheader($name);
}
echo "<div ".$style."><table class=\"data_table\">";
echo "<div ".$style."><table class=\"table table-stripped table-hover table-bordered\">";
if ($row['visible']=='0') {
$titleclass = 'forum_message_post_title_2_be_approved';
$messageclass = 'forum_message_post_text_2_be_approved';
@ -84,12 +84,12 @@ if (isset($rows)) {
// The post has been displayed => it can be removed from the what's new array
if (isset($whatsnew_post_info)) {
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]);
unset($whatsnew_post_info[$currentForum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
unset($whatsnew_post_info[$currentForum['forum_id']][$current_thread['thread_id']]);
}
if (isset($_SESSION['whatsnew_post_info'])) {
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']]);
unset($_SESSION['whatsnew_post_info'][$currentForum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
unset($_SESSION['whatsnew_post_info'][$currentForum['forum_id']][$current_thread['thread_id']]);
}
echo "</table></div>";
$counter++;

@ -31,8 +31,17 @@ if (isset($current_thread['thread_id'])) {
LINK_FORUM_THREAD
);
$closedPost = null;
if (!empty($rows)) {
foreach ($rows as $row) {
if ($row['user_id']=='0') {
$name = prepare4display($row['poster_name']);
} else {
$name = api_get_person_name($row['firstname'], $row['lastname']);
}
$username = sprintf(get_lang('LoginX'), $row['username']);
if (($current_forum_category && $current_forum_category['locked'] == 0) &&
$current_forum['locked'] == 0 &&
@ -73,7 +82,7 @@ if (isset($current_thread['thread_id'])) {
if (api_get_course_setting('allow_user_image_forum')) {
$html .= '<div class="thumbnail">'.display_user_image($row['user_id'], $name).'</div>';
}
$html .= Display::tag('h4', display_user_link($row['user_id'], $name, '', $username), array('class' => 'title-username'));
$html .= Display::tag('h4', display_user_link($row['user_id'], $name), array('class' => 'title-username'));
} else {
$html .= Display::tag('span', $name, array('title' => api_htmlentities($username, ENT_QUOTES)));
}
@ -186,27 +195,6 @@ if (isset($current_thread['thread_id'])) {
$html .= '</div>';
// the style depends on the status of the message: approved or not
/* if ($row['visible']=='0') {
$titleclass = 'forum_message_post_title_2_be_approved';
$messageclass = 'forum_message_post_text_2_be_approved';
$leftclass = 'forum_message_left_2_be_approved';
} else {
$titleclass = 'forum_message_post_title';
$messageclass = 'forum_message_post_text';
$leftclass = 'forum_message_left';
}
if ($row['user_id']=='0') {
$name = prepare4display($row['poster_name']);
} else {
$name = api_get_person_name($row['firstname'], $row['lastname']);
}
$username = sprintf(get_lang('LoginX'), $row['username']);
*/
$html .= '<div class="row">';
$html .= '<div class="col-md-12">';
$html .= '<div class="pull-right">'.$buttonReply . ' ' . $buttonQuote . '</div>';

@ -82,7 +82,7 @@ foreach ($rows as $post) {
// The course admin him/herself can do this off course always
if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) ||
($current_forum['allow_edit'] == 1 && $row['user_id'] == $userId) ||
($current_forum['allow_edit'] == 1 && $post['user_id'] == $userId) ||
(api_is_allowed_to_edit(false,true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId))
) {
if ($locked == false) {
@ -142,6 +142,10 @@ foreach ($rows as $post) {
}
}
if($iconEdit != ''){
$html .= '<div class="tools-icons">'.$iconEdit.'</div>';
}
if (($current_forum_category && $current_forum_category['locked'] == 0) &&
$current_forum['locked'] == 0 && $current_thread['locked'] == 0 || api_is_allowed_to_edit(false, true )
) {
@ -164,11 +168,10 @@ foreach ($rows as $post) {
if ($current_thread['locked']==1) {
$closedPost = Display::tag('div','<i class="fa fa-exclamation-triangle"></i> '.get_lang('ThreadLocked'),array('class'=>'alert alert-warning post-closed'));
}
$html .= $closedPost;
}
if($iconEdit != ''){
$html .= '<div class="tools-icons">'.$iconEdit.'</div>';
}
$html .= $closedPost;
$html .= '</div>';
@ -229,8 +232,8 @@ foreach ($rows as $post) {
$html .= '</div>';
$html .= '</div>';
// The post has been displayed => it can be removed from the what's new array
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]);
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]);
$html .= '</div>';

Loading…
Cancel
Save