Update from 1.11.x #2833
parent
5b6eb88465
commit
1cb62cca5d
@ -1,50 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* @todo move the tool constants to the appropriate place |
||||
* @todo make config settings out of $forum_setting |
||||
* |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* |
||||
* @version february 2006, dokeos 1.8 |
||||
*/ |
||||
|
||||
/* |
||||
Database Variables |
||||
*/ |
||||
$table_categories = Database::get_course_table(TABLE_FORUM_CATEGORY); |
||||
$table_forums = Database::get_course_table(TABLE_FORUM); |
||||
$table_threads = Database::get_course_table(TABLE_FORUM_THREAD); |
||||
$table_posts = Database::get_course_table(TABLE_FORUM_POST); |
||||
$table_mailcue = Database::get_course_table(TABLE_FORUM_MAIL_QUEUE); |
||||
$table_threads_qualify = Database::get_course_table( |
||||
TABLE_FORUM_THREAD_QUALIFY |
||||
); |
||||
$table_threads_qualify_historical = Database::get_course_table( |
||||
TABLE_FORUM_THREAD_QUALIFY_LOG |
||||
); |
||||
|
||||
$forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
||||
$table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
||||
$table_users = Database::get_main_table(TABLE_MAIN_USER); |
||||
|
||||
/* |
||||
Some configuration settings |
||||
(these can go to the dokeos config settings afterwards) |
||||
*/ |
||||
// if this setting is true then an I-frame will be displayed when replying |
||||
$forum_setting['show_thread_iframe_on_reply'] = true; |
||||
// if this setting is true then students and teachers can check a checkbox so |
||||
// that they receive a mail when somebody replies to the thread |
||||
$forum_setting['allow_post_notification'] = true; |
||||
// when this setting is true then the course admin can post threads that |
||||
// are important. These posts remain on top all the time (until made unsticky) |
||||
// these special posts are indicated with a special icon also |
||||
$forum_setting['allow_sticky'] = true; |
||||
// when this setting is true there will be a column that displays the |
||||
// latest post (date and poster) of the given forum. |
||||
// This requires quite some sql statements that might slow down the page with the fora. |
||||
// note: I'm currently investigating how it would be possible to increase |
||||
// the performance of this part. |
||||
$forum_setting['show_last_post'] = false; |
@ -1,187 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* @deprecated? |
||||
* |
||||
* @package chamilo.forum |
||||
*/ |
||||
require_once __DIR__.'/../inc/global.inc.php'; |
||||
|
||||
// The section (tabs). |
||||
$this_section = SECTION_COURSES; |
||||
|
||||
// Notification for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
$nameTools = get_lang('ToolForum'); |
||||
|
||||
// Including necessary files. |
||||
require 'forumconfig.inc.php'; |
||||
require_once 'forumfunction.inc.php'; |
||||
|
||||
$htmlHeadXtra[] = '<script language="javascript"> |
||||
$(document).ready(function(){ $(\'.hide-me\').slideUp() }); |
||||
function hidecontent(content){ |
||||
$(content).slideToggle(\'normal\'); |
||||
} |
||||
</script>'; |
||||
|
||||
// Are we in a lp ? |
||||
$origin = api_get_origin(); |
||||
|
||||
/* MAIN DISPLAY SECTION */ |
||||
|
||||
/* Retrieving forum and forum categorie information */ |
||||
|
||||
// We are getting all the information about the current forum and forum category. |
||||
// Note pcool: I tried to use only one sql statement (and function) for this, |
||||
// but the problem is that the visibility of the forum AND forum category are stored in the item_property table. |
||||
$current_thread = get_thread_information($_GET['forum'], $_GET['thread']); |
||||
$current_forum = get_forum_information($current_thread['forum_id']); |
||||
$current_forum_category = get_forumcategory_information($current_forum['forum_category']); |
||||
$whatsnew_post_info = $_SESSION['whatsnew_post_info']; |
||||
|
||||
if (api_is_in_gradebook()) { |
||||
$interbreadcrumb[] = [ |
||||
'url' => Category::getUrl(), |
||||
'name' => get_lang('ToolGradebook'), |
||||
]; |
||||
} |
||||
|
||||
if ($origin == 'learnpath') { |
||||
Display::display_reduced_header(); |
||||
} else { |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'index.php?'.api_get_cidreq().'&search='.Security::remove_XSS(urlencode($_GET['search'])), |
||||
'name' => $nameTools, |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'].'&search='.Security::remove_XSS(urlencode($_GET['search'])), |
||||
'name' => prepare4display($current_forum_category['cat_title']), |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'viewforum.php?'.api_get_cidreq().'&forum='.intval($_GET['forum']).'&search='.Security::remove_XSS(urlencode($_GET['search'])), |
||||
'name' => prepare4display($current_forum['forum_title']), |
||||
]; |
||||
|
||||
// the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string |
||||
Display :: display_header(''); |
||||
api_display_tool_title($nameTools); |
||||
} |
||||
|
||||
/* Is the user allowed here? */ |
||||
|
||||
// if the user is not a course administrator and the forum is hidden |
||||
// then the user is not allowed here. |
||||
if (!api_is_allowed_to_edit(false, true) && |
||||
($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0) |
||||
) { |
||||
api_not_allowed(false); |
||||
} |
||||
|
||||
/* Actions */ |
||||
|
||||
if ($_GET['action'] == 'delete' && |
||||
isset($_GET['content']) && |
||||
isset($_GET['id']) && api_is_allowed_to_edit(false, true) |
||||
) { |
||||
$message = delete_post($_GET['id']); |
||||
} |
||||
if (($_GET['action'] == 'invisible' || $_GET['action'] == 'visible') && |
||||
isset($_GET['id']) && api_is_allowed_to_edit(false, true) |
||||
) { |
||||
$message = approve_post($_GET['id'], $_GET['action']); |
||||
} |
||||
if ($_GET['action'] == 'move' && isset($_GET['post'])) { |
||||
$message = move_post_form(); |
||||
} |
||||
|
||||
/* Display the action messages */ |
||||
|
||||
if (!empty($message)) { |
||||
echo Display::return_message(get_lang($message), 'confirm'); |
||||
} |
||||
|
||||
// In this case the first and only post of the thread is removed. |
||||
if ($message != 'PostDeletedSpecial') { |
||||
// This increases the number of times the thread has been viewed. |
||||
increase_thread_view($_GET['thread']); |
||||
|
||||
/* Action Links */ |
||||
echo '<div style="float:right;">'; |
||||
$my_url = '<a href="viewthread.php?'.api_get_cidreq().'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&search='.Security::remove_XSS(urlencode($_GET['search'])); |
||||
echo $my_url.'&view=flat">'.get_lang('FlatView').'</a> | '; |
||||
echo $my_url.'&view=threaded">'.get_lang('ThreadedView').'</a> | '; |
||||
echo $my_url.'&view=nested">'.get_lang('NestedView').'</a>'; |
||||
$my_url = null; |
||||
echo '</div>'; |
||||
// The reply to thread link should only appear when the forum_category is |
||||
// not locked AND the forum is not locked AND the thread is not locked. |
||||
// If one of the three levels is locked then the link should not be displayed. |
||||
if (($current_forum_category && $current_forum_category['locked'] == 0) && |
||||
$current_forum['locked'] == 0 && $current_thread['locked'] == 0 || api_is_allowed_to_edit(false, true) |
||||
) { |
||||
// The link should only appear when the user is logged in or when anonymous posts are allowed. |
||||
if ($_user['user_id'] || ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) { |
||||
// reply link |
||||
echo '<a href="reply.php?'.api_get_cidreq().'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&action=replythread">'.get_lang('ReplyToThread').'</a>'; |
||||
|
||||
// new thread link |
||||
if (api_is_allowed_to_edit(false, true) || |
||||
($current_forum['allow_new_threads'] == 1 && isset($_user['user_id'])) || |
||||
($current_forum['allow_new_threads'] == 1 && !isset($_user['user_id']) && $current_forum['allow_anonymous'] == 1) |
||||
) { |
||||
if ($current_forum['locked'] != 1 && $current_forum['locked'] != 1) { |
||||
echo ' '; |
||||
/*echo '<a href="newthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).$origin_string.'">'.Display::return_icon('new_thread.png','','',ICON_SIZE_MEDIUM).'</a>';*/ |
||||
} else { |
||||
echo get_lang('ForumLocked'); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// Note: This is to prevent that some browsers display the links over the table (FF does it but Opera doesn't). |
||||
echo ' '; |
||||
/* Display Forum Category and the Forum information */ |
||||
if (!$_SESSION['view']) { |
||||
$viewmode = $current_forum['default_view']; |
||||
} else { |
||||
$viewmode = $_SESSION['view']; |
||||
} |
||||
|
||||
$viewmode_whitelist = ['flat', 'threaded', 'nested']; |
||||
if (isset($_GET['view']) && in_array($_GET['view'], $viewmode_whitelist)) { |
||||
$viewmode = Database::escape_string($_GET['view']); |
||||
$_SESSION['view'] = $viewmode; |
||||
} |
||||
if (empty($viewmode)) { |
||||
$viewmode = 'flat'; |
||||
} |
||||
|
||||
/* Display Forum Category and the Forum information */ |
||||
|
||||
// we are getting all the information about the current forum and forum category. |
||||
// note pcool: I tried to use only one sql statement (and function) for this |
||||
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table |
||||
echo "<table class=\"data_table\" width=\"100%\">\n"; |
||||
|
||||
// The thread |
||||
echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"6\">"; |
||||
echo '<span class="forum_title">'.prepare4display($current_thread['thread_title']).'</span><br />'; |
||||
|
||||
if ($origin != 'learnpath') { |
||||
echo '<span class="forum_low_description">'.prepare4display($current_forum_category['cat_title']).' - '; |
||||
} |
||||
|
||||
echo prepare4display($current_forum['forum_title']).'<br />'; |
||||
echo "</th>\n"; |
||||
echo "\t</tr>\n"; |
||||
echo '<span>'.prepare4display($current_thread['thread_comment']).'</span>'; |
||||
echo "</table>"; |
||||
|
||||
include_once 'viewpost.inc.php'; |
||||
} |
||||
|
||||
if ($origin != 'learnpath') { |
||||
Display :: display_footer(); |
||||
} |
@ -1,364 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* This script manages the display of forum threads in flat view. |
||||
* |
||||
* @copyright Julio Montoya <gugli100@gmail.com> UI Improvements + lots of bugfixes |
||||
* |
||||
* @package chamilo.forum |
||||
*/ |
||||
|
||||
// Delete attachment file |
||||
if ((isset($_GET['action']) && |
||||
$_GET['action'] == 'delete_attach') && |
||||
isset($_GET['id_attach']) |
||||
) { |
||||
delete_attachment(0, $_GET['id_attach']); |
||||
} |
||||
|
||||
// Are we in a lp ? |
||||
$origin = api_get_origin(); |
||||
$sessionId = api_get_session_id(); |
||||
$_user = api_get_user_info(); |
||||
$userId = api_get_user_id(); |
||||
$groupId = api_get_group_id(); |
||||
|
||||
// Decide whether we show the latest post first |
||||
$sortDirection = isset($_GET['posts_order']) && $_GET['posts_order'] === 'desc' ? 'DESC' : ($origin != 'learnpath' ? 'ASC' : 'DESC'); |
||||
|
||||
if (isset($current_thread['thread_id'])) { |
||||
$rows = getPosts($current_forum, $current_thread['thread_id'], $sortDirection); |
||||
$increment = 0; |
||||
$clean_forum_id = intval($_GET['forum']); |
||||
$clean_thread_id = intval($_GET['thread']); |
||||
$locked = api_resource_is_locked_by_gradebook( |
||||
$clean_thread_id, |
||||
LINK_FORUM_THREAD |
||||
); |
||||
|
||||
$buttonReply = ''; |
||||
$buttonQuote = ''; |
||||
$closedPost = ''; |
||||
|
||||
if (!empty($rows)) { |
||||
$postCount = count($rows); |
||||
foreach ($rows as $row) { |
||||
$posterId = isset($row['user_id']) ? $row['user_id'] : 0; |
||||
$name = ''; |
||||
if (empty($posterId)) { |
||||
$name = prepare4display($row['poster_name']); |
||||
} else { |
||||
if (isset($row['complete_name'])) { |
||||
$name = $row['complete_name']; |
||||
} |
||||
} |
||||
|
||||
$username = ''; |
||||
if (isset($row['username'])) { |
||||
$username = sprintf(get_lang('LoginX'), $row['username']); |
||||
} |
||||
|
||||
if (($current_forum_category && $current_forum_category['locked'] == 0) && |
||||
$current_forum['locked'] == 0 && |
||||
$current_thread['locked'] == 0 || |
||||
api_is_allowed_to_edit(false, true) |
||||
) { |
||||
if ($userId || ($current_forum['allow_anonymous'] == 1 && !$userId)) { |
||||
if ((api_is_anonymous() && $current_forum['allow_anonymous'] == 1) || |
||||
(!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) |
||||
) { |
||||
$buttonReply = Display::toolbarButton( |
||||
get_lang('ReplyToMessage'), |
||||
'reply.php?'.api_get_cidreq().'&'.http_build_query([ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
'post' => $row['post_id'], |
||||
'action' => 'replymessage', |
||||
]), |
||||
'reply', |
||||
'primary', |
||||
['id' => "reply-to-post-{$row['post_id']}"] |
||||
); |
||||
|
||||
$buttonQuote = Display::toolbarButton( |
||||
get_lang('QuoteMessage'), |
||||
'reply.php?'.api_get_cidreq().'&'.http_build_query([ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
'post' => $row['post_id'], |
||||
'action' => 'quote', |
||||
]), |
||||
'quote-left', |
||||
'success', |
||||
['id' => "quote-post-{$row['post_id']}"] |
||||
); |
||||
} |
||||
} |
||||
} else { |
||||
if (($current_forum_category && $current_forum_category['locked'] == 1)) { |
||||
$closedPost = Display::tag( |
||||
'div', |
||||
'<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumcategoryLocked'), |
||||
['class' => 'alert alert-warning post-closed'] |
||||
); |
||||
} |
||||
if ($current_forum['locked'] == 1) { |
||||
$closedPost = Display::tag( |
||||
'div', |
||||
'<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumLocked'), |
||||
['class' => 'alert alert-warning post-closed'] |
||||
); |
||||
} |
||||
if ($current_thread['locked'] == 1) { |
||||
$closedPost = Display::tag( |
||||
'div', |
||||
'<em class="fa fa-exclamation-triangle"></em> '.get_lang('ThreadLocked'), |
||||
['class' => 'alert alert-warning post-closed'] |
||||
); |
||||
} |
||||
} |
||||
|
||||
$html = ''; |
||||
$html .= '<div class="panel panel-default forum-post">'; |
||||
$html .= '<div class="panel-body">'; |
||||
$html .= '<div class="row">'; |
||||
$html .= '<div class="col-md-2">'; |
||||
|
||||
if ($origin != 'learnpath') { |
||||
if (api_get_course_setting('allow_user_image_forum')) { |
||||
$html .= '<div class="thumbnail">'.display_user_image($posterId, $name, $origin).'</div>'; |
||||
} |
||||
$html .= Display::tag( |
||||
'h4', |
||||
display_user_link($posterId, $name), |
||||
['class' => 'title-username'] |
||||
); |
||||
} else { |
||||
if (api_get_course_setting('allow_user_image_forum')) { |
||||
$html .= '<div class="thumbnail">'.display_user_image($posterId, $name, $origin).'</div>'; |
||||
} |
||||
$name = Display::tag('strong', "#".$postCount--, ['class' => 'text-info'])." | $name"; |
||||
$html .= Display::tag( |
||||
'p', |
||||
$name, |
||||
[ |
||||
'title' => api_htmlentities($username, ENT_QUOTES), |
||||
'class' => 'lead', |
||||
] |
||||
); |
||||
} |
||||
|
||||
if ($origin != 'learnpath') { |
||||
$html .= Display::tag( |
||||
'p', |
||||
Display::dateToStringAgoAndLongDate($row['post_date']), |
||||
['class' => 'post-date'] |
||||
); |
||||
} else { |
||||
$html .= Display::tag( |
||||
'p', |
||||
Display::dateToStringAgoAndLongDate($row['post_date']), |
||||
['class' => 'text-muted'] |
||||
); |
||||
} |
||||
|
||||
// get attach id |
||||
$attachment_list = get_attachment($row['post_id']); |
||||
$id_attach = !empty($attachment_list) ? $attachment_list['iid'] : ''; |
||||
$iconEdit = ''; |
||||
$statusIcon = ''; |
||||
// The user who posted it can edit his thread only if the course admin allowed |
||||
// this in the properties of the forum |
||||
// The course admin him/herself can do this off course always |
||||
$groupInfo = GroupManager::get_group_properties($groupId); |
||||
if ((isset($groupInfo['iid']) && GroupManager::is_tutor_of_group($userId, $groupInfo)) || |
||||
($current_forum['allow_edit'] == 1 && $posterId == $userId) || |
||||
( |
||||
api_is_allowed_to_edit(false, true) && |
||||
!(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId) |
||||
) |
||||
) { |
||||
if (api_is_allowed_to_session_edit(false, true)) { |
||||
if ($locked == false && postIsEditableByStudent($current_forum, $row)) { |
||||
$iconEdit .= "<a href=\"editpost.php?".api_get_cidreq()."&forum=".$clean_forum_id |
||||
."&thread=".$clean_thread_id."&post=".$row['post_id'] |
||||
."&edit=edition&id_attach=".$id_attach."\">" |
||||
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL)."</a>"; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if ($origin != 'learnpath') { |
||||
if (GroupManager::is_tutor_of_group($userId, $groupInfo) || |
||||
api_is_allowed_to_edit(false, true) && |
||||
!(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId) |
||||
) { |
||||
if ($locked === false) { |
||||
$deleteUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
'action' => 'delete', |
||||
'content' => 'post', |
||||
'id' => $row['post_id'], |
||||
]); |
||||
$iconEdit .= Display::url( |
||||
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL), |
||||
$deleteUrl, |
||||
[ |
||||
'onclick' => "javascript:if(!confirm('" |
||||
.addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) |
||||
."')) return false;", |
||||
'id' => "delete-post-{$row['post_id']}", |
||||
] |
||||
); |
||||
} |
||||
} |
||||
|
||||
$statusIcon = getPostStatus($current_forum, $row); |
||||
|
||||
if (GroupManager::is_tutor_of_group($userId, $groupInfo) || |
||||
( |
||||
api_is_allowed_to_edit(false, true) && |
||||
!(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId) |
||||
) |
||||
) { |
||||
$iconEdit .= return_visible_invisible_icon( |
||||
'post', |
||||
$row['post_id'], |
||||
$row['visible'], |
||||
[ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
'origin' => $origin, |
||||
] |
||||
); |
||||
|
||||
if ($increment > 0) { |
||||
$iconEdit .= "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".$clean_forum_id |
||||
."&thread=".$clean_thread_id."&action=move&post=".$row['post_id']."\">" |
||||
.Display::return_icon('move.png', get_lang('MovePost'), [], ICON_SIZE_SMALL) |
||||
."</a>"; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$user_status = api_get_status_of_user_in_course($posterId, api_get_course_int_id()); |
||||
$current_qualify_thread = showQualify('1', $row['poster_id'], $_GET['thread']); |
||||
if (($current_thread['thread_peer_qualify'] == 1 || api_is_allowed_to_edit(null, true)) && |
||||
$current_thread['thread_qualify_max'] > 0 && $origin != 'learnpath' |
||||
) { |
||||
$my_forum_id = $clean_forum_id; |
||||
$info_thread = get_thread_information($clean_forum_id, $clean_thread_id); |
||||
$my_forum_id = $info_thread['forum_id']; |
||||
$userCanEdit = $current_thread['thread_peer_qualify'] == 1 && $row['poster_id'] != $userId; |
||||
/*if ($row['poster_id'] != $userId && $current_forum['moderated'] == 1 && $row['status']) { |
||||
}*/ |
||||
if (api_is_allowed_to_edit(null, true)) { |
||||
$userCanEdit = true; |
||||
} |
||||
|
||||
if ($increment > 0 && $locked == false && $userCanEdit) { |
||||
$iconEdit .= "<a href=\"forumqualify.php?".api_get_cidreq()."&forum=".$my_forum_id |
||||
."&thread=".$clean_thread_id."&action=list&post=".$row['post_id'] |
||||
."&user=".$row['poster_id']."&user_id=".$row['poster_id'] |
||||
."&idtextqualify=".$current_qualify_thread."\" >" |
||||
.Display::return_icon('quiz.png', get_lang('Qualify')) |
||||
."</a> "; |
||||
} |
||||
} |
||||
|
||||
if (!empty($iconEdit)) { |
||||
$html .= '<div class="tools-icons">'.$iconEdit.' '.$statusIcon.'</div>'; |
||||
} else { |
||||
if (!empty(strip_tags($statusIcon))) { |
||||
$html .= '<div class="tools-icons">'.$statusIcon.'</div>'; |
||||
} |
||||
} |
||||
$html .= $closedPost; |
||||
$html .= '</div>'; |
||||
$html .= '<div class="col-md-10">'; |
||||
|
||||
$titlePost = Display::tag( |
||||
'h3', |
||||
$row['post_title'], |
||||
['class' => 'forum_post_title'] |
||||
); |
||||
|
||||
$html .= Display::tag( |
||||
'div', |
||||
$titlePost, |
||||
['class' => 'post-header'] |
||||
); |
||||
|
||||
// see comments inside forumfunction.inc.php to lower filtering and allow more visual changes |
||||
$html .= Display::tag( |
||||
'div', |
||||
$row['post_text'], |
||||
['class' => 'post-body'] |
||||
); |
||||
$html .= '</div>'; |
||||
$html .= '</div>'; |
||||
|
||||
$html .= '<div class="row">'; |
||||
$html .= '<div class="col-md-7">'; |
||||
|
||||
// prepare the notification icon |
||||
if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) && |
||||
!empty( |
||||
$whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']] |
||||
) && |
||||
!empty($whatsnew_post_info[$_GET['forum']][$row['thread_id']]) |
||||
) { |
||||
$post_image = Display::return_icon('forumpostnew.gif'); |
||||
} else { |
||||
$post_image = Display::return_icon('forumpost.gif'); |
||||
} |
||||
|
||||
if ($row['post_notification'] == '1' && $row['poster_id'] == $userId) { |
||||
$post_image .= Display::return_icon('forumnotification.gif', get_lang('YouWillBeNotified')); |
||||
} |
||||
// The post title |
||||
// The check if there is an attachment |
||||
$attachment_list = getAllAttachment($row['post_id']); |
||||
if (!empty($attachment_list) && is_array($attachment_list)) { |
||||
foreach ($attachment_list as $attachment) { |
||||
$realname = $attachment['path']; |
||||
$user_filename = $attachment['filename']; |
||||
$html .= Display::return_icon('attachment.gif', get_lang('Attachment')); |
||||
$html .= '<a href="download.php?file='.$realname.'"> '.$user_filename.' </a>'; |
||||
|
||||
if (($current_forum['allow_edit'] == 1 && $posterId == $userId) || |
||||
(api_is_allowed_to_edit(false, true) && |
||||
!(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId)) |
||||
) { |
||||
$html .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_attach&id_attach=' |
||||
.$attachment['iid'].'&forum='.$clean_forum_id.'&thread='.$clean_thread_id |
||||
.'" onclick="javascript:if(!confirm(\'' |
||||
.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) |
||||
.'\')) return false;">' |
||||
.Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL) |
||||
.'</a><br />'; |
||||
} |
||||
$html .= '<span class="forum_attach_comment" >'.$attachment['comment'].'</span>'; |
||||
} |
||||
} |
||||
|
||||
$html .= '</div>'; |
||||
$html .= '<div class="col-md-5 text-right">'; |
||||
$html .= $buttonReply.' '.$buttonQuote; |
||||
$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($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]); |
||||
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']]); |
||||
$increment++; |
||||
$html .= '</div>'; |
||||
$html .= '</div>'; |
||||
echo $html; |
||||
} |
||||
} |
||||
} |
@ -1,366 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
use Chamilo\CourseBundle\Entity\CForumPost; |
||||
|
||||
/** |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @author Julio Montoya <gugli100@gmail.com> UI Improvements + lots of bugfixes |
||||
* @copyright Ghent University |
||||
* |
||||
* @package chamilo.forum |
||||
*/ |
||||
|
||||
// Are we in a lp ? |
||||
$origin = api_get_origin(); |
||||
//delete attachment file |
||||
if (isset($_GET['action']) && |
||||
$_GET['action'] == 'delete_attach' && |
||||
isset($_GET['id_attach']) |
||||
) { |
||||
delete_attachment(0, $_GET['id_attach']); |
||||
} |
||||
|
||||
// Decide whether we show the latest post first |
||||
$sortDirection = isset($_GET['posts_order']) && $_GET['posts_order'] === 'desc' ? 'DESC' : ($origin != 'learnpath' ? 'ASC' : 'DESC'); |
||||
$posts = getPosts($current_forum, $_GET['thread'], $sortDirection, true); |
||||
$count = 0; |
||||
$clean_forum_id = intval($_GET['forum']); |
||||
$clean_thread_id = intval($_GET['thread']); |
||||
$group_id = api_get_group_id(); |
||||
$locked = api_resource_is_locked_by_gradebook($clean_thread_id, LINK_FORUM_THREAD); |
||||
$sessionId = api_get_session_id(); |
||||
$currentThread = get_thread_information($clean_forum_id, $_GET['thread']); |
||||
$userId = api_get_user_id(); |
||||
$groupInfo = GroupManager::get_group_properties($group_id); |
||||
$postCount = 1; |
||||
|
||||
$allowUserImageForum = api_get_course_setting('allow_user_image_forum'); |
||||
|
||||
foreach ($posts as $post) { |
||||
$posterId = isset($post['user_id']) ? $post['user_id'] : 0; |
||||
|
||||
// The style depends on the status of the message: approved or not. |
||||
if ($post['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'; |
||||
} |
||||
|
||||
$indent = $post['indent_cnt']; |
||||
|
||||
$html = ''; |
||||
$html .= '<div class="col-md-offset-'.$indent.'" >'; |
||||
$html .= '<div class="panel panel-default forum-post">'; |
||||
$html .= '<div class="panel-body">'; |
||||
$html .= '<div class="row">'; |
||||
$html .= '<div class="col-md-2">'; |
||||
$username = ''; |
||||
if (isset($post['username'])) { |
||||
$username = sprintf(get_lang('LoginX'), $post['username']); |
||||
} |
||||
if (empty($posterId)) { |
||||
$name = $post['poster_name']; |
||||
} else { |
||||
$name = $post['complete_name']; |
||||
} |
||||
|
||||
if ($origin != 'learnpath') { |
||||
if ($allowUserImageForum) { |
||||
$html .= '<div class="thumbnail">'.display_user_image($posterId, $name, $origin).'</div>'; |
||||
} |
||||
|
||||
$html .= Display::tag( |
||||
'h4', |
||||
display_user_link($posterId, $name, $origin, $username), |
||||
['class' => 'title-username'] |
||||
); |
||||
} else { |
||||
if ($allowUserImageForum) { |
||||
$html .= '<div class="thumbnail">'.display_user_image($posterId, $name, $origin).'</div>'; |
||||
} |
||||
|
||||
$html .= Display::tag( |
||||
'p', |
||||
$name, |
||||
[ |
||||
'title' => api_htmlentities($username, ENT_QUOTES), |
||||
'class' => 'lead', |
||||
] |
||||
); |
||||
} |
||||
|
||||
if ($origin != 'learnpath') { |
||||
$html .= Display::tag( |
||||
'p', |
||||
Display::dateToStringAgoAndLongDate($post['post_date']), |
||||
['class' => 'post-date'] |
||||
); |
||||
} else { |
||||
$html .= Display::tag( |
||||
'p', |
||||
Display::dateToStringAgoAndLongDate($post['post_date']), |
||||
['class' => 'text-muted'] |
||||
); |
||||
} |
||||
|
||||
// get attach id |
||||
$attachment_list = get_attachment($post['post_id']); |
||||
$id_attach = !empty($attachment_list) ? $attachment_list['iid'] : ''; |
||||
|
||||
$iconEdit = ''; |
||||
$editButton = ''; |
||||
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum |
||||
// The course admin him/herself can do this off course always |
||||
|
||||
$tutorGroup = GroupManager::is_tutor_of_group(api_get_user_id(), $groupInfo); |
||||
|
||||
if ((isset($groupInfo['iid']) && $tutorGroup) || |
||||
($current_forum['allow_edit'] == 1 && $posterId == $userId) || |
||||
(api_is_allowed_to_edit(false, true) && |
||||
!(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId)) |
||||
) { |
||||
if ($locked == false && postIsEditableByStudent($current_forum, $post)) { |
||||
$editUrl = api_get_path(WEB_CODE_PATH).'forum/editpost.php?'.api_get_cidreq(); |
||||
$editUrl .= "&forum=$clean_forum_id&thread=$clean_thread_id&post={$post['post_id']}&id_attach=$id_attach"; |
||||
|
||||
$iconEdit .= "<a href='".$editUrl."'>" |
||||
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL) |
||||
."</a>"; |
||||
|
||||
$editButton = Display::toolbarButton( |
||||
get_lang('Edit'), |
||||
$editUrl, |
||||
'pencil', |
||||
'default' |
||||
); |
||||
} |
||||
} |
||||
|
||||
if ((isset($groupInfo['iid']) && $tutorGroup) || |
||||
api_is_allowed_to_edit(false, true) && |
||||
!(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId) |
||||
) { |
||||
if ($locked == false) { |
||||
$deleteUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
'action' => 'delete', |
||||
'content' => 'post', |
||||
'id' => $post['post_id'], |
||||
]); |
||||
$iconEdit .= Display::url( |
||||
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL), |
||||
$deleteUrl, |
||||
[ |
||||
'onclick' => "javascript:if(!confirm('" |
||||
.addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) |
||||
."')) return false;", |
||||
'id' => "delete-post-{$post['post_id']}", |
||||
] |
||||
); |
||||
} |
||||
} |
||||
|
||||
if (api_is_allowed_to_edit(false, true) && |
||||
!( |
||||
api_is_session_general_coach() && |
||||
$current_forum['session_id'] != $sessionId |
||||
) |
||||
) { |
||||
$iconEdit .= return_visible_invisible_icon( |
||||
'post', |
||||
$post['post_id'], |
||||
$post['visible'], |
||||
[ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
] |
||||
); |
||||
|
||||
if ($count > 0) { |
||||
$iconEdit .= "<a href=\"viewthread.php?".api_get_cidreq() |
||||
."&forum=$clean_forum_id&thread=$clean_thread_id&action=move&post={$post['post_id']}" |
||||
."\">".Display::return_icon('move.png', get_lang('MovePost'), [], ICON_SIZE_SMALL)."</a>"; |
||||
} |
||||
} |
||||
|
||||
$userCanQualify = $currentThread['thread_peer_qualify'] == 1 && $post['poster_id'] != $userId; |
||||
if (api_is_allowed_to_edit(null, true)) { |
||||
$userCanQualify = true; |
||||
} |
||||
|
||||
if (empty($currentThread['thread_qualify_max'])) { |
||||
$userCanQualify = false; |
||||
} |
||||
|
||||
if ($userCanQualify) { |
||||
if ($count > 0) { |
||||
$current_qualify_thread = showQualify( |
||||
'1', |
||||
$posterId, |
||||
$_GET['thread'] |
||||
); |
||||
if ($locked == false) { |
||||
$iconEdit .= "<a href=\"forumqualify.php?".api_get_cidreq() |
||||
."&forum=$clean_forum_id&thread=$clean_thread_id&action=list&post={$post['post_id']}" |
||||
."&user={$post['user_id']}&user_id={$post['user_id']}" |
||||
."&idtextqualify=$current_qualify_thread" |
||||
."\" >".Display::return_icon('quiz.png', get_lang('Qualify'))."</a>"; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$statusIcon = getPostStatus($current_forum, $post); |
||||
if (!empty($iconEdit)) { |
||||
$html .= '<div class="tools-icons">'.$iconEdit.' '.$statusIcon.'</div>'; |
||||
} else { |
||||
if (!empty(strip_tags($statusIcon))) { |
||||
$html .= '<div class="tools-icons">'.$statusIcon.'</div>'; |
||||
} |
||||
} |
||||
|
||||
$buttonReply = ''; |
||||
$buttonQuote = ''; |
||||
$waitingValidation = ''; |
||||
|
||||
if (($current_forum_category && $current_forum_category['locked'] == 0) && |
||||
$current_forum['locked'] == 0 && $current_thread['locked'] == 0 || api_is_allowed_to_edit(false, true) |
||||
) { |
||||
if ($userId || ($current_forum['allow_anonymous'] == 1 && !$userId)) { |
||||
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { |
||||
$buttonReply = Display::toolbarButton( |
||||
get_lang('ReplyToMessage'), |
||||
'reply.php?'.api_get_cidreq().'&'.http_build_query([ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
'post' => $post['post_id'], |
||||
'action' => 'replymessage', |
||||
]), |
||||
'reply', |
||||
'primary', |
||||
['id' => "reply-to-post-{$post['post_id']}"] |
||||
); |
||||
|
||||
$buttonQuote = Display::toolbarButton( |
||||
get_lang('QuoteMessage'), |
||||
'reply.php?'.api_get_cidreq().'&'.http_build_query([ |
||||
'forum' => $clean_forum_id, |
||||
'thread' => $clean_thread_id, |
||||
'post' => $post['post_id'], |
||||
'action' => 'quote', |
||||
]), |
||||
'quote-left', |
||||
'success', |
||||
['id' => "quote-post-{$post['post_id']}"] |
||||
); |
||||
|
||||
if ($current_forum['moderated'] && !api_is_allowed_to_edit(false, true)) { |
||||
if (empty($post['status']) || $post['status'] == CForumPost::STATUS_WAITING_MODERATION) { |
||||
$buttonReply = ''; |
||||
$buttonQuote = ''; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} else { |
||||
$closedPost = ''; |
||||
if ($current_forum_category && $current_forum_category['locked'] == 1) { |
||||
$closedPost = Display::tag( |
||||
'div', |
||||
'<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumcategoryLocked'), |
||||
['class' => 'alert alert-warning post-closed'] |
||||
); |
||||
} |
||||
if ($current_forum['locked'] == 1) { |
||||
$closedPost = Display::tag( |
||||
'div', |
||||
'<em class="fa fa-exclamation-triangle"></em> '.get_lang('ForumLocked'), |
||||
['class' => 'alert alert-warning post-closed'] |
||||
); |
||||
} |
||||
if ($current_thread['locked'] == 1) { |
||||
$closedPost = Display::tag( |
||||
'div', |
||||
'<em class="fa fa-exclamation-triangle"></em> '.get_lang('ThreadLocked'), |
||||
['class' => 'alert alert-warning post-closed'] |
||||
); |
||||
} |
||||
|
||||
$html .= $closedPost; |
||||
} |
||||
$html .= '</div>'; |
||||
|
||||
// note: this can be removed here because it will be displayed in the tree |
||||
if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) && |
||||
!empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) && |
||||
!empty($whatsnew_post_info[$_GET['forum']][$post['thread_id']]) |
||||
) { |
||||
$post_image = Display::return_icon('forumpostnew.gif'); |
||||
} else { |
||||
$post_image = Display::return_icon('forumpost.gif'); |
||||
} |
||||
|
||||
if ($post['post_notification'] == '1' && $post['poster_id'] == $userId) { |
||||
$post_image .= Display::return_icon( |
||||
'forumnotification.gif', |
||||
get_lang('YouWillBeNotified') |
||||
); |
||||
} |
||||
|
||||
$html .= '<div class="col-md-10">'; |
||||
// The post title |
||||
|
||||
$titlePost = Display::tag('h3', $post['post_title'], ['class' => 'forum_post_title']); |
||||
$html .= Display::tag('div', $titlePost, ['class' => 'post-header']); |
||||
|
||||
// the post body |
||||
$html .= Display::tag('div', $post['post_text'], ['class' => 'post-body']); |
||||
$html .= '</div>'; |
||||
$html .= '</div>'; |
||||
|
||||
$html .= '<div class="row">'; |
||||
$html .= '<div class="col-md-6">'; |
||||
// The check if there is an attachment |
||||
$attachment_list = getAllAttachment($post['post_id']); |
||||
if (!empty($attachment_list) && is_array($attachment_list)) { |
||||
foreach ($attachment_list as $attachment) { |
||||
$user_filename = $attachment['filename']; |
||||
$html .= Display::return_icon('attachment.gif', get_lang('Attachment')); |
||||
$html .= '<a href="download.php?file='; |
||||
$html .= $attachment['path']; |
||||
$html .= ' "> '.$user_filename.' </a>'; |
||||
$html .= '<span class="forum_attach_comment" >'.$attachment['comment'].'</span>'; |
||||
if (($current_forum['allow_edit'] == 1 && $post['user_id'] == $userId) || |
||||
(api_is_allowed_to_edit(false, true) && !(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId)) |
||||
) { |
||||
$html .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_attach&id_attach=' |
||||
.$attachment['iid'].'&forum='.$clean_forum_id.'&thread='.$clean_thread_id |
||||
.'" onclick="javascript:if(!confirm(\'' |
||||
.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">' |
||||
.Display::return_icon('delete.gif', get_lang('Delete')).'</a><br />'; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$html .= '</div>'; |
||||
$html .= '<div class="col-md-6 text-right">'; |
||||
$html .= "$editButton $buttonReply $buttonQuote $waitingValidation"; |
||||
$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']][$post['post_id']]); |
||||
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]); |
||||
|
||||
$html .= '</div>'; |
||||
$html .= '</div>'; |
||||
$html .= '</div>'; |
||||
|
||||
echo $html; |
||||
$count++; |
||||
} |
@ -1,90 +1,157 @@ |
||||
{% extends "@ChamiloTheme/Layout/layout_one_col.html.twig" %} |
||||
{% import '@ChamiloTheme/Macros/box.html.twig' as macro %} |
||||
{% import '@ChamiloTheme/Macros/box.html.twig' as display %} |
||||
|
||||
{% block content %} |
||||
{% autoescape false %} |
||||
{% if 'translate_html'|api_get_configuration_value %} |
||||
<script> |
||||
$(function () { |
||||
// default |
||||
$('.category-forum ').hide(); |
||||
|
||||
{{ form_content }} |
||||
<div class="accordion forum" id="accordion-forum"> |
||||
{% if data is not empty %} |
||||
{% for item in data %} |
||||
<div class="card"> |
||||
<h5 class="card-header" id="heading-{{ item.id }}"> |
||||
<div class="float-actions"> |
||||
{{ item.tools }} |
||||
</div> |
||||
<a href="#" data-toggle="collapse" class="btn btn-link" data-target="#collapse-{{ item.id }}" aria-expanded="true" aria-controls="collapse-{{ item.id }}"> |
||||
{{ 'forum_blue.png'|img(32) }} |
||||
</a> |
||||
<a href="{{ item.url }}" title="{{ item.title }}">{{ item.title }}{{ item.icon_session }}</a> |
||||
</h5> |
||||
<div id="collapse-{{ item.id }}" class="collapse show" aria-labelledby="heading-{{ item.id }}" data-parent="#accordion-forum"> |
||||
<div class="card-body"> |
||||
{% if default_user_language %} |
||||
$('.{{ default_user_language }}').show(); |
||||
{% endif %} |
||||
|
||||
$('#extra_language').attr('data-width', '200px'); |
||||
$('#extra_language option[value=""]').text('{{ 'Any' | get_lang | escape('js') }}'); |
||||
$('#extra_language').on('change', function() { |
||||
var selectedLanguageArray = $(this).val(); |
||||
$('.category-forum ').hide(); |
||||
$.each(selectedLanguageArray, function(index, selectedLanguage) { |
||||
if (selectedLanguage == '') { |
||||
$('.category-forum ').show(); |
||||
} else { |
||||
$('.'+ selectedLanguage).show(); |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
</script> |
||||
{% endif %} |
||||
|
||||
{{ form_content }} |
||||
{{ search_filter }} |
||||
|
||||
{% set fold_forum_categories = 'forum_fold_categories'|api_get_configuration_value %} |
||||
|
||||
{% if data is not empty %} |
||||
{% for item in data %} |
||||
|
||||
{% set category_language_array = [] %} |
||||
{% set category_language = '' %} |
||||
{% for extra_field in item.extra_fields %} |
||||
{% if extra_field.variable == 'language' %} |
||||
{% set category_language_array = extra_field.value | split(';') %} |
||||
{% set category_language = extra_field.value | replace({';': ' ' }) %} |
||||
{% endif %} |
||||
{% endfor %} |
||||
|
||||
<div class="forum-description"> |
||||
{{ item.description }} |
||||
{% if fold_forum_categories %} |
||||
{% set panel_icon %} |
||||
<a href="{{ item.url }}" title="{{ item.title }}"> |
||||
<span class="open">{{ 'forum_blue.png'|img(32) }}</span> |
||||
</a> |
||||
{% endset %} |
||||
|
||||
{% set panel_title %} |
||||
{{ item.title }}{{ item.icon_session }} |
||||
{% endset %} |
||||
{% else %} |
||||
{% set panel_title %} |
||||
<a href="{{ item.url }}" title="{{ item.title }}"> |
||||
<span class="open">{{ 'forum_blue.png'|img(32) }}</span> |
||||
{{ item.title }}{{ item.icon_session }} |
||||
</a> |
||||
<div class="pull-right"> |
||||
{{ item.tools }} |
||||
</div> |
||||
{% for subitem in item.forums %} |
||||
{% set content %} |
||||
<div class="d-flex flex-row bd-highlight mb-3"> |
||||
<div class="p-2 bd-highlight"> |
||||
<div class="avatar"> |
||||
<img src="{{ subitem.avatar }}" width="32px" class="rounded-circle"> |
||||
</div> |
||||
</div> |
||||
<div class="p-2 bd-highlight"> |
||||
<h4 class="title"> |
||||
<a href="{{ subitem.url }}" title="{{ subitem.title }}" class="{{ subitem.visibility != '1' ? 'text-muted': '' }}">{{ subitem.title }}</a> |
||||
{% if subitem.forum_of_group != 0 %} |
||||
<a class="forum-goto" href="../group/group_space.php?{{ _p.web_cid_query }}&gidReq={{ subitem.forum_of_group }}"> |
||||
{{ "forum.png"|img(22) }} {{ "GoTo"|get_lang }} {{ subitem.forum_group_title }} |
||||
{% endset %} |
||||
{% endif %} |
||||
|
||||
{% set panel_content %} |
||||
<div class="forum-description"> |
||||
{{ item.description }} |
||||
</div> |
||||
{% for subitem in item.forums %} |
||||
<div class="forum_display"> |
||||
<div class="panel panel-default forum"> |
||||
<div class="panel-body"> |
||||
<div class="row"> |
||||
<div class="col-xs-4 col-md-3"> |
||||
<div class="number-post"> |
||||
<a href="{{ forum.url }}" title="{{forum.title}}"> |
||||
{% if subitem.forum_image is not empty %} |
||||
<img src="{{ subitem.forum_image }}" width="48px"> |
||||
{% else %} |
||||
{% if subitem.forum_of_group == 0 %} |
||||
{{ 'forum_group.png'|img(48) }} |
||||
{% else %} |
||||
{{ 'forum.png'|img(48) }} |
||||
{% endif %} |
||||
{% endif %} |
||||
</a> |
||||
{% endif %} |
||||
{{ subitem.icon_session }} |
||||
<div class="float-right"> |
||||
<p>{{ 'ForumThreads'| get_lang }}: {{ subitem.number_threads }} </p> |
||||
</div> |
||||
</div> |
||||
<div class="col-xs-8 col-md-9"> |
||||
<div class="pull-right"> |
||||
<div class="toolbar"> |
||||
{{ subitem.tools }} |
||||
</div> |
||||
</div> |
||||
</h4> |
||||
<ul class="forum-threads"> |
||||
<li class="threads">{{ 'ForumThreads'| get_lang }}: {{ subitem.number_threads }} </li> |
||||
<h3 class="title"> |
||||
{{ 'forum_yellow.png'|img(32) }} |
||||
<a href="{{ subitem.url }}" title="{{ subitem.title }}" class="{{ subitem.visibility != '1' ? 'text-muted': '' }}">{{ subitem.title }}</a> |
||||
{% if subitem.forum_of_group != 0 %} |
||||
<a class="forum-goto" href="../group/group_space.php?{{ _p.web_cid_query }}&gidReq={{ subitem.forum_of_group }}"> |
||||
{{ "forum.png"|img(22) }} {{ "GoTo"|get_lang }} {{ subitem.forum_group_title }} |
||||
</a> |
||||
{% endif %} |
||||
{{ subitem.icon_session }} |
||||
</h3> |
||||
{% if subitem.last_poster_id is not empty %} |
||||
<li class="date"> |
||||
<div class="forum-date"> |
||||
<i class="fa fa-comments" aria-hidden="true"></i> |
||||
{{ subitem.last_poster_date }} |
||||
« {{ subitem.last_post_title }} » |
||||
{{ "By"|get_lang }} |
||||
{{ subitem.last_poster_user }} |
||||
</li> |
||||
</div> |
||||
{% endif %} |
||||
</ul> |
||||
<div class="description"> |
||||
{{ subitem.description }} |
||||
</div> |
||||
|
||||
{{ subitem.last_post_text }} |
||||
|
||||
{{ subitem.alert }} |
||||
{% if subitem.moderation is not empty %} |
||||
<span class="label label-warning"> |
||||
{{ "PostsPendingModeration"|get_lang }}: {{ subitem.moderation }} |
||||
</span> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="description"> |
||||
{{ subitem.description }} |
||||
</div> |
||||
{{ subitem.alert }} |
||||
|
||||
{% if subitem.moderation is not empty %} |
||||
<span class="label label-warning"> |
||||
{{ "PostsPendingModeration"|get_lang }}: {{ subitem.moderation }} |
||||
</span> |
||||
{% endif %} |
||||
{% endset %} |
||||
{% set forum_id = 'forum-'~ subitem.id %} |
||||
<div class="list-forum"> |
||||
{{ macro.panel_box(forum_id,'', content ) }} |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% endset %} |
||||
|
||||
<div class="category-forum {{ category_language }}" id="category_{{ item.id }}"> |
||||
{% if fold_forum_categories %} |
||||
{{ display.collapse('category_' ~ item.id, panel_title, panel_content, false, fold_forum_categories, item.tools, panel_icon ) }} |
||||
{% else %} |
||||
|
||||
{{ display.panel(panel_title, panel_content) }} |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
{% endfor %} |
||||
{% else %} |
||||
<div class="alert alert-warning"> |
||||
{{ 'NoForumInThisCategory'|get_lang }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endautoescape %} |
||||
{% endblock %} |
||||
|
@ -0,0 +1,59 @@ |
||||
{% extends "@ChamiloTheme/Layout/layout_one_col.html.twig" %} |
||||
{% import '@ChamiloTheme/Macros/box.html.twig' as display %} |
||||
|
||||
{% block content %} |
||||
{% autoescape false %} |
||||
{% if origin == 'learnpath' %} |
||||
<div style="height:15px"> </div> |
||||
{% endif %} |
||||
|
||||
{% if forum_actions %} |
||||
<div class="actions"> |
||||
{{ forum_actions }} |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% for post in posts %} |
||||
{% set post_data %} |
||||
<div class="row"> |
||||
<div class="col-md-2"> |
||||
{{ post.user_data }} |
||||
</div> |
||||
{% set highlight = '' %} |
||||
{% if post.current %} |
||||
{% set highlight = 'alert alert-danger' %} |
||||
{% endif %} |
||||
|
||||
{% set highlight_revision = '' %} |
||||
{% if post.is_a_revision %} |
||||
{% set highlight_revision = 'forum_revision' %} |
||||
{% endif %} |
||||
|
||||
<div class="col-md-10 {{ highlight }} "> |
||||
{{ post.post_title }} |
||||
|
||||
{% if post.is_a_revision %} |
||||
{{ 'ProposedRevision' | get_lang }} {{ post.flag_revision }} |
||||
{% endif %} |
||||
|
||||
<div class="{{ highlight_revision }} "> |
||||
{{ post.post_data }} |
||||
</div> |
||||
|
||||
{{ post.post_attachments }} |
||||
</div> |
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-md-4"></div> |
||||
<div class="col-md-8 text-right"> |
||||
{{ post.post_buttons }} |
||||
</div> |
||||
</div> |
||||
{% endset %} |
||||
|
||||
<div class="col-md-offset-{{ post.indent_cnt }} forum-post"> |
||||
{{ display.panel('', post_data ) }} |
||||
</div> |
||||
{% endfor %} |
||||
{% endautoescape %} |
||||
{% endblock %} |
Loading…
Reference in new issue