} else { $postLister = new postLister($topicId, $start, get_total_posts($topicId, 'topic')); $incrementViewCount = false; } // get post and use pager $postList = $postLister->get_post_list(); $totalPosts = $postLister->sqlPager->get_total_item_count(); $pagerUrl = claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?topic=' . $topicId)); //increment topic view count if required if ($incrementViewCount) { increase_topic_view_count($topicId); $claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $claro_notifier->get_notification_date(claro_get_current_user_id()), claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $forumId . "-" . $topicId); //$claroline->notifier->event( 'forum_read_topic', array( 'data' => array( 'topic_id' => $topicId ) ) ); } if ($is_postAllowed) { $cmdList = get_forum_toolbar_array('viewtopic', $forumSettingList['forum_id'], $forumSettingList['cat_id'], $topicId); if (count($postList) > 2) { $start_last_message = (ceil($totalPosts / get_conf('posts_per_page')) - 1) * get_conf('posts_per_page'); $lastMsgUrl = Url::Contextualize($_SERVER['PHP_SELF'] . '?forum=' . $forumSettingList['forum_id'] . '&topic=' . $topicId . '&start=' . $start_last_message . '#post' . $topicSettingList['topic_last_post_id']); $cmdList[] = array('name' => get_lang('Last message'), 'url' => claro_htmlspecialchars(Url::Contextualize($lastMsgUrl))); if (!$viewall) { $viewallUrl = Url::Contextualize($_SERVER['PHP_SELF'] . '?forum=' . $forumSettingList['forum_id'] . '&topic=' . $topicId . '&viewall=1'); $cmdList[] = array('name' => get_lang('Full review'), 'url' => claro_htmlspecialchars(Url::Contextualize($viewallUrl))); } } } $out .= $postLister->disp_pager_tool_bar($pagerUrl); try { $display = new ModuleTemplate('CLFRM', 'forum_viewtopic.tpl.php'); $display->assign('forum_id', $forumId); $display->assign('topic_id', $topicId);
} elseif ('default' == $forumSettingList['anonymity']) { $display_name .= ' (' . get_lang('anonymous forum') . ')'; } } $viewAllowed = true; } // Javascript confirm pop up declaration for header JavascriptLanguage::getInstance()->addLangVar('Are you sure to delete %name ?'); JavascriptLoader::getInstance()->load('forum'); // Prepare display $out = ''; $nameTools = get_lang('Forums'); $pagetype = 'viewforum'; // Command list if ($forum_post_allowed) { $cmdList = get_forum_toolbar_array($pagetype, $forumId, $forum_cat_id, 0); } else { $cmdList = array(); } $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? get_help_page_url('blockForumsHelp', 'CLFRM') : false, $cmdList); if (!$viewAllowed) { $out .= $dialogBox->render(); } else { $colspan = $is_allowedToEdit ? 9 : 6; $is_allowedToEdit = claro_is_allowed_to_edit() || claro_is_group_tutor() && !claro_is_course_manager(); // ( claro_is_group_tutor() // is added to give admin status to tutor // && !claro_is_course_manager()) // is added to let course admin, tutor of current group, use student mode if (claro_is_allowed_to_edit()) { $out .= '<div style="float: right;">' . "\n" . '<img src="' . get_icon_url('html') . '" alt="" /> <a href="' . claro_htmlspecialchars(Url::Contextualize('export.php?type=HTML&forum=' . $forumId)) . '" target="_blank">' . get_lang('Export to HTML') . '</a>' . "\n" . '<img src="' . get_icon_url('mime/pdf') . '" alt="" /> <a href="' . claro_htmlspecialchars(Url::Contextualize('export.php?type=PDF&forum=' . $forumId)) . '" target="_blank">' . get_lang('Export to PDF') . '</a>' . "\n" . '</div>' . "\n";