diff --git a/main/forum/index.php b/main/forum/index.php
index e8ca5e8d59..4995f229a2 100755
--- a/main/forum/index.php
+++ b/main/forum/index.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 .= '';
$html .= '';
+ $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 = ' '.
diff --git a/main/forum/newthread.php b/main/forum/newthread.php
index 71d17e8747..71285efc85 100755
--- a/main/forum/newthread.php
+++ b/main/forum/newthread.php
@@ -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 */
diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php
index 6aaae1368c..e3a224144c 100755
--- a/main/forum/viewforum.php
+++ b/main/forum/viewforum.php
@@ -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 .= '
';
$table_list .= ''.get_lang('NamesAndLastNames').' | ';
- if ($_GET['list'] == 'qualify') {
+ if ($listType == 'qualify') {
$table_list.= ''.get_lang('Qualification').' | ';
}
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 .= '';
- if ($_GET['list'] == 'qualify') {
+ if ($listType == 'qualify') {
$table_list .= ''.$row_student_list['qualify'].'/'.$max_qualify.' | ';
}
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 .= '
- '.
+ '.
Display::return_icon($icon_qualify, get_lang('Qualify')).' |
';
}
$counter_stdlist++;
}
} else {
- if ($_GET['list'] == 'qualify') {
+ if ($listType == 'qualify') {
$table_list .= ''.get_lang('ThereIsNotQualifiedLearners').' |
';
} else {
$table_list .= ''.get_lang('ThereIsNotUnqualifiedLearners').' |
';
diff --git a/main/forum/viewforumcategory.php b/main/forum/viewforumcategory.php
index 51a3883d68..b5c6289b42 100755
--- a/main/forum/viewforumcategory.php
+++ b/main/forum/viewforumcategory.php
@@ -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().'&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 .= '';
$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 .= '
';
$html .= '';
+ $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 = ' '.
diff --git a/main/forum/viewpost.inc.php b/main/forum/viewpost.inc.php
index 47779f8bcb..f8489fa29e 100755
--- a/main/forum/viewpost.inc.php
+++ b/main/forum/viewpost.inc.php
@@ -39,7 +39,7 @@ if (isset($rows)) {
echo Display::page_subheader($name);
}
- echo "
";
+ echo "";
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 "
";
$counter++;
diff --git a/main/forum/viewthread_flat.inc.php b/main/forum/viewthread_flat.inc.php
index ea07610eac..3d63b4bfea 100755
--- a/main/forum/viewthread_flat.inc.php
+++ b/main/forum/viewthread_flat.inc.php
@@ -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 .= ''.display_user_image($row['user_id'], $name).'
';
}
- $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 .= '';
- // 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 .= '';
$html .= '
';
$html .= '
'.$buttonReply . ' ' . $buttonQuote . '
';
diff --git a/main/forum/viewthread_nested.inc.php b/main/forum/viewthread_nested.inc.php
index 70766d54e0..7ebf36272a 100755
--- a/main/forum/viewthread_nested.inc.php
+++ b/main/forum/viewthread_nested.inc.php
@@ -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 .= '
'.$iconEdit.'
';
+ }
+
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','
'.get_lang('ThreadLocked'),array('class'=>'alert alert-warning post-closed'));
}
+
+ $html .= $closedPost;
}
- if($iconEdit != ''){
- $html .= '
'.$iconEdit.'
';
- }
- $html .= $closedPost;
+
$html .= '
';
@@ -229,8 +232,8 @@ foreach ($rows as $post) {
$html .= '
';
$html .= '';
// 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 .= '';