JavascriptLanguage::getInstance()->addLangVar('Do you really want to sign your contribution ?'); JavascriptLoader::getInstance()->load('forum'); // Prepare display $out = ''; // Command list $cmdList = array(); $nameTools = get_lang('Forums'); $pagetype = !empty($editMode) ? $editMode : 'viewtopic'; // The title is put in the $out var at the end of this script if (claro_is_allowed_to_edit() && $topicId) { $out .= '<div style="float: right;">' . "\n" . '<img src=' . get_icon_url('html') . '" alt="" /> <a href="' . claro_htmlspecialchars(Url::Contextualize('export.php?type=HTML&topic=' . $topicId)) . '" 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&topic=' . $topicId)) . '" target="_blank">' . get_lang('Export to PDF') . '</a>' . "\n" . '</div>'; } if ($topicSettingList) { $out .= disp_forum_breadcrumb($pagetype, $forumSettingList['forum_id'], $forumSettingList['forum_name'], $topicSettingList['topic_id'], $topicSettingList['topic_title']); } else { $out .= disp_forum_breadcrumb($pagetype, $forumSettingList['forum_id'], $forumSettingList['forum_name']); } if ('show' != $cmd) { if ('default' == $anonymityStatus) { $info = '<tr valign="top">' . "\n" . '<td> </td>' . '<td><strong>' . get_lang('Contributions to this forum are anonymous by default!<br/>') . get_lang('If you want to sign your post all the same, uncheck the checkbox above the "OK" button') . '</strong></td>' . '</tr>' . '<tr style="height:1px;"><td colspan="2"> </td></tr>'; } elseif ('allowed' == $anonymityStatus) { $info = '<tr valign="top">' . "\n" . '<td> </td>' . '<td><strong>' . get_lang('This forum allows anonymous contributions!<br/>') . get_lang('If you do not want to sign your post, check the checkbox above the "OK" button') . '</strong></td>' . '</tr>' . '<tr style="height:1px;"><td colspan="2"> </td></tr>'; } if (!empty($info)) { $dialogBox->info($info); } } $out .= $dialogBox->render(); //display edit form if any if (isset($form)) { $formBox = new DialogBox();
$tbl_forums = $tbl_cdb_names['bb_forums']; $sql = "SELECT pt.post_id,\n pt.post_text,\n p.nom AS lastname,\n p.prenom AS firstname,\n p.`poster_id`,\n p.post_time,\n t.topic_id,\n t.topic_title,\n f.forum_id,\n f.forum_name,\n f.group_id\n FROM `" . $tbl_posts_text . "` AS pt,\n `" . $tbl_posts . "` AS p,\n `" . $tbl_topics . "` AS t,\n `" . $tbl_forums . "` AS f\n WHERE ( " . $sqlClauseString . ")\n AND pt.post_id = p.post_id\n AND p.topic_id = t.topic_id\n AND t.forum_id = f.forum_id\n ORDER BY p.post_time DESC, t.topic_id"; $searchResultList = claro_sql_query_fetch_all($sql); $userGroupList = get_user_group_list(claro_get_current_user_id()); $userGroupList = array_keys($userGroupList); $tutorGroupList = get_tutor_group_list(claro_get_current_user_id()); } else { $searchResultList = array(); } $pagetype = 'viewsearch'; ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); CssLoader::getInstance()->load('clfrm', 'screen'); $noPHP_SELF = true; $out = ''; $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? get_help_page_url('blockForumsHelp', 'CLFRM') : false); $out .= claro_html_menu_horizontal(disp_forum_toolbar($pagetype, null)) . disp_forum_breadcrumb($pagetype, null, null, null) . '<h4>' . get_lang('Search result') . ' : ' . (isset($_REQUEST['searchPattern']) ? claro_htmlspecialchars($_REQUEST['searchPattern']) : '') . '</h4>' . "\n"; if (count($searchResultList) < 1) { $out .= '<p>' . get_lang('No result') . '</p>'; } else { foreach ($searchResultList as $thisPost) { // PREVENT USER TO CONSULT POST FROM A GROUP THEY ARE NOT ALLOWED if (!is_null($thisPost['group_id']) && $is_groupPrivate && !(in_array($thisPost['group_id'], $userGroupList) || in_array($thisPost['group_id'], $tutorGroupList) || claro_is_course_manager())) { continue; } else { // notify if is new message $post_time = datetime_to_timestamp($thisPost['post_time']); if ($post_time < $last_visit) { $class = ' class="item"'; } else { $class = ' class="item hot"'; }
Display Section =================================================================*/ ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); $noPHP_SELF = true; $out = ''; // display tool title $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? 'help_forum.php' : false); if (!$allowed) { $out .= $dialogBox->render(); } else { // Display new topic page if (isset($_REQUEST['submit']) && !$error) { // Display success message $out .= disp_confirmation_message(get_lang('Your message has been entered'), $forum_id, $topic_id); } else { if ($error) { // display error message $out .= $dialogBox->render(); } $out .= disp_forum_breadcrumb($pagetype, $forum_id, $forum_name) . claro_html_menu_horizontal(disp_forum_toolbar($pagetype, $forum_id, 0, 0)) . '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . '<input type="hidden" name="forum" value="' . $forum_id . '" />' . "\n" . claro_form_relay_context() . '<table border="0" width="100%">' . "\n" . '<tr valign="top">' . "\n" . '<td align="right"><label for="subject">' . get_lang('Subject') . '</label> : </td>' . '<td><input type="text" name="subject" id="subject" size="50" maxlength="100" value="' . htmlspecialchars($subject) . '" /></td>' . '</tr>' . '<tr valign="top">' . "\n" . '<td align="right"><br />' . get_lang('Message body') . ' :</td>'; if (!empty($message)) { $content = $message; } else { $content = ''; } $out .= '<td>' . claro_html_textarea_editor('message', $content) . '</td>' . '</tr>' . '<tr valign="top"><td> </td>' . '<td><input type="submit" name="submit" value="' . get_lang('Ok') . '" /> ' . ' <input type="submit" name="cancel" value="' . get_lang('Cancel') . '" />' . "\n" . '</td></tr>' . '</table>' . '</form>' . "\n"; } } // end allowed $claroline->display->body->appendContent($out); echo $claroline->display->render();
Display Section =================================================================*/ ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); $noPHP_SELF = true; $out = ''; // Forum Title $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? 'help_forum.php' : false); if (!$allowed || !$is_allowedToEdit) { $out .= $dialogBox->render(); } else { if (isset($_REQUEST['submit']) && !$error) { if (!isset($_REQUEST['delete'])) { $out .= disp_confirmation_message(get_lang('Your message has been entered'), $forum_id, $topic_id); } else { $out .= disp_confirmation_message(get_lang('Your message has been deleted'), $forum_id); } } else { $first_post = is_first_post($topic_id, $post_id); if ($error) { $out .= $dialogBox->render(); } $out .= disp_forum_breadcrumb($pagetype, $forum_id, $forum_name, $topic_id, $subject) . claro_html_menu_horizontal(disp_forum_toolbar($pagetype, $forum_id, $topic_id, 0)) . '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post" >' . "\n" . claro_form_relay_context() . '<input type="hidden" name="post_id" value="' . $post_id . '" />' . "\n" . '<table border="0" width="100%" >' . "\n"; if ($first_post) { $out .= '<tr valign="top">' . "\n" . '<td align="right">' . "\n" . '<label for="subject">' . get_lang('Subject') . '</label> : ' . '</td>' . "\n" . '<td>' . "\n" . '<input type="text" name="subject" id="subject" size="50" maxlength="100" value="' . htmlspecialchars($subject) . '" />' . '</td>' . "\n" . '</tr>' . "\n"; } $out .= '<tr valign="top">' . "\n" . '<td align="right">' . "\n" . '<br />' . get_lang('Message body') . ' : ' . "\n" . '</td>' . "\n" . '<td>' . "\n" . claro_html_textarea_editor('message', $message) . '</td>' . "\n" . '</tr>' . "\n" . '<tr valign="top">' . "\n" . '<td align="right">' . "\n" . '<label for="delete" >' . get_lang('Delete') . '</label>' . "\n" . ' : ' . "\n" . '</td>' . "\n" . '<td>' . "\n" . '<input type="checkbox" name="delete" id="delete" />' . "\n" . '</td>' . "\n" . '</tr>' . "\n" . '<tr>' . '<td> </td>' . "\n" . '<td>' . '<input type="submit" name="submit" value="' . get_lang('Ok') . '" /> ' . '<input type="submit" name="cancel" value="' . get_lang('Cancel') . '" />' . '</td>' . "\n" . '</tr>' . "\n" . '</table>' . "\n" . '</form>' . "\n" . '<br />' . "\n" . '<center>' . '<a href="' . htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $topic_id)) . '" target="_blank">' . get_lang('Topic review') . '</a>' . '</center>' . '<br />' . "\n"; } // end // else if ! isset submit } $claroline->display->body->appendContent($out); echo $claroline->display->render();
} /*================================================================= Display Section =================================================================*/ ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); $noPHP_SELF = true; $out = ''; $pagetype = 'reply'; $is_allowedToEdit = claro_is_allowed_to_edit(); $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? 'help_forum.php' : false); if (!$allowed) { // not allowed $out .= $dialogBox->render(); } else { if (isset($_REQUEST['submit']) && !$error) { // DISPLAY SUCCES MESSAGE $out .= disp_confirmation_message(get_lang('Your message has been entered'), $forum_id, $topic_id); } else { if ($error) { $out .= $dialogBox->render(); } $out .= claro_html_menu_horizontal(disp_forum_toolbar($pagetype, $forum_id, 0, $topic_id)); $out .= disp_forum_breadcrumb($pagetype, $forum_id, $forum_name, $topic_id, $topic_title); $out .= '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="forum" value="' . $forum_id . '" />' . "\n" . '<input type="hidden" name="topic" value="' . $topic_id . '" />' . "\n"; $out .= '<table border="0" width="100%">' . "\n" . '<tr valign="top">' . "\n" . '<td align="right"><br />' . get_lang('Message body') . ' :</td>' . '<td>' . claro_html_textarea_editor('message', $message) . '</td>' . '</tr>' . '<tr valign="top"><td> </td>' . '<td>' . '<input type="submit" name="submit" value="' . get_lang('Ok') . '" /> ' . '<input type="submit" name="cancel" value="' . get_lang('Cancel') . '" />' . '</td>' . '</tr>' . '</table>' . '</form>'; $out .= '<p style="text-align: center;"><a href="' . htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $topic_id . '&forum=' . $forum_id)) . '" target="_blank">' . get_lang('Topic review') . '</a></p>'; } // end else if submit } $claroline->display->body->appendContent($out); echo $claroline->display->render();
$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"; } $out .= disp_forum_breadcrumb($pagetype, $forumId, $forum_name); $out .= $dialogBox->render(); $topicLister = new topicLister($forumId, $start, get_conf('topics_per_page')); $topicList = $topicLister->get_topic_list(); $pagerUrl = claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewforum.php?forum=' . $forumId)); $out .= $topicLister->disp_pager_tool_bar($pagerUrl); try { $display = new ModuleTemplate('CLFRM', 'forum_viewforum.tpl.php'); $display->assign('forumId', $forumId); $display->assign('forumName', $display_name); $display->assign('forumSettings', $forumSettingList); $display->assign('topicList', $topicList); $display->assign('is_allowedToEdit', $is_allowedToEdit); $display->assign('claro_notifier', $claro_notifier); $out .= $display->render(); } catch (Exception $ex) {