@ -21,7 +21,6 @@
*
* @package chamilo.forum
*/
/* INIT SECTION */
// Language files that need to be included.
$language_file = array('forum', 'group', 'gradebook');
@ -99,10 +98,10 @@ if ($origin == 'group') {
$interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'& gidReq='.$_SESSION['toolgroup'].'& forum='.Security::remove_XSS($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => 'javascript: void (0);', 'name' => get_lang('EditPost'));
} else {
$interbreadcrumb[] = array('url' => 'index.php?gradebook='.$gradebook , 'name' => $nameTools);
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq() , 'name' => $nameTools);
$interbreadcrumb[] = array('url' => 'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'], 'name' => prepare4display($current_forum_category['cat_title']));
$interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'& forum='.Security::remove_XSS($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => 'viewthread.php?gradebook='.$gradebook .'& origin='.$origin.'& forum='.Security::remove_XSS($_GET['forum']).'& thread='.Security::remove_XSS($_GET['thread']), 'name' => prepare4display($current_thread['thread_title']));
$interbreadcrumb[] = array('url' => 'viewthread.php?'.api_get_cidreq() .'& origin='.$origin.'& forum='.Security::remove_XSS($_GET['forum']).'& thread='.Security::remove_XSS($_GET['thread']), 'name' => prepare4display($current_thread['thread_title']));
$interbreadcrumb[] = array('url' => 'javascript: void (0);', 'name' => get_lang('EditPost'));
}
@ -139,14 +138,23 @@ if ($origin == 'learnpath') {
// The only exception is the course manager
// I have split this is several pieces for clarity.
//if (!api_is_allowed_to_edit() AND (($current_forum_category['visibility'] == 0 OR $current_forum['visibility'] == 0) OR ($current_forum_category['locked'] < > 0 OR $current_forum['locked'] < > 0 OR $current_thread['locked'] < > 0))) {
if (!api_is_allowed_to_edit(null, true) AND (($current_forum_category & & $current_forum_category['visibility'] == 0) OR $current_forum['visibility'] == 0)) {
if (!api_is_allowed_to_edit(null, true) AND
(($current_forum_category & & $current_forum_category['visibility'] == 0) OR
$current_forum['visibility'] == 0)
) {
$forum_allow = forum_not_allowed_here();
if ($forum_allow === false) {
exit;
}
}
if (!api_is_allowed_to_edit(null, true) AND (($current_forum_category & & $current_forum_category['locked'] < > 0 ) OR $current_forum['locked'] < > 0 OR $current_thread['locked'] < > 0)) {
if (!api_is_allowed_to_edit(null, true) AND
(
($current_forum_category & & $current_forum_category['locked'] < > 0 ) OR
$current_forum['locked'] < > 0 OR
$current_thread['locked'] < > 0
)
) {
$forum_allow = forum_not_allowed_here();
if ($forum_allow === false) {
exit;
@ -173,9 +181,9 @@ if ($origin != 'learnpath') {
echo '< div class = "actions" > ';
echo '< span style = "float:right;" > '.search_link().'< / span > ';
if ($origin == 'group') {
echo '< a href = "../group/group_space.php?'.api_get_cidreq().'&gidReq='.Security::remove_XSS($_GET['gidReq']).'&gradebook='.$gradebook.'" > '.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('Groups'), '', ICON_SIZE_MEDIUM).'< / a > ';
echo '< a href = "../group/group_space.php?'.api_get_cidreq().'" > '.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('Groups'), '', ICON_SIZE_MEDIUM).'< / a > ';
} else {
echo '< a href = "index.php?gradebook='.$gradebook .'" > '.Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'< / a > ';
echo '< a href = "index.php?'.api_get_cidreq() .'" > '.Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'< / a > ';
}
echo '< a href = "viewforum.php?forum='.Security::remove_XSS($_GET['forum']).'&gidReq='.Security::remove_XSS($_GET['gidReq']).'&origin='.$origin.'" > '.Display::return_icon('forum.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).'< / a > ';
echo '< / div > ';
@ -184,12 +192,12 @@ if ($origin != 'learnpath') {
/* Display Forum Category and the Forum information */
/*New display forum div*/
echo '< div class = "row" > ';
echo '< div class = "span12" > ';
echo '< div class = "forum_title" > ';
echo '< h1 > < a href = "viewforum.php?&origin='.$origin.'&forum='.$current_forum['forum_id'].'" ' . class_visible_invisible ( $ current_forum [ ' visibility ' ] ) . ' > '.prepare4display($current_forum['forum_title']).'< / a > < / h1 > ';
echo '< p class = "forum_description" > '.prepare4display($current_forum['forum_comment']).'< / p > ';
echo '< / div > < / div > < / div > ';
echo '< div class = "row" > ';
echo '< div class = "span12" > ';
echo '< div class = "forum_title" > ';
echo '< h1 > < a href = "viewforum.php?&origin='.$origin.'&forum='.$current_forum['forum_id'].'" ' . class_visible_invisible ( $ current_forum [ ' visibility ' ] ) . ' > '.prepare4display($current_forum['forum_title']).'< / a > < / h1 > ';
echo '< p class = "forum_description" > '.prepare4display($current_forum['forum_comment']).'< / p > ';
echo '< / div > < / div > < / div > ';
/* End new display forum */
// Set forum attachment data into $_SESSION
@ -197,7 +205,13 @@ getAttachedFiles($current_forum['forum_id'], $current_thread['thread_id'], $curr
// The form for the reply
echo '< div class = "row" > ';
echo '< div class = "span12" > ';
$values = show_edit_post_form($forum_setting, $current_post, $current_thread, $current_forum, isset($_SESSION['formelements']) ? $_SESSION['formelements'] : '');
$values = show_edit_post_form(
$forum_setting,
$current_post,
$current_thread,
$current_forum,
isset($_SESSION['formelements']) ? $_SESSION['formelements'] : ''
);
echo '< / div > < / div > ';
if (!empty($values) and isset($_POST['SubmitPost'])) {
@ -214,7 +228,18 @@ if (!empty($values) and isset($_POST['SubmitPost'])) {
$link_info = is_resource_in_course_gradebook(api_get_course_id(), 5, $id, $session_id);
$link_id = $link_info['id'];
if (!$link_info) {
add_resource_to_course_gradebook($values['category_id'], api_get_course_id(), 5, $id, $title_gradebook, $weight_calification, $value_calification, $description, 1, api_get_session_id());
add_resource_to_course_gradebook(
$values['category_id'],
api_get_course_id(),
5,
$id,
$title_gradebook,
$weight_calification,
$value_calification,
$description,
1,
api_get_session_id()
);
} else {
Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');
}
@ -222,7 +247,11 @@ if (!empty($values) and isset($_POST['SubmitPost'])) {
} else {
// Only show Forum attachment ajax form when do not pass form submit
echo '< div class = "row" > < div class = "span12" > ';
$attachmentAjaxForm = getAttachmentAjaxForm($current_forum['forum_id'], $current_thread['thread_id'], $current_post['post_id']);
$attachmentAjaxForm = getAttachmentAjaxForm(
$current_forum['forum_id'],
$current_thread['thread_id'],
$current_post['post_id']
);
echo $attachmentAjaxForm;
echo '< / div > < / div > ';
}
@ -230,4 +259,4 @@ if (!empty($values) and isset($_POST['SubmitPost'])) {
// Footer
if ($origin != 'learnpath') {
Display :: display_footer();
}
}