|
@@ -85,7 +85,19 @@ if(!api_is_allowed_to_edit()) $fck_attribute['Config']['UserStatus'] = 'student'
|
|
|
Header
|
|
|
-----------------------------------------------------------
|
|
|
*/
|
|
|
-Display :: display_header($nameTools);
|
|
|
+$interbreadcrumb[]=array("url" => "index.php","name" => $nameTools);
|
|
|
+
|
|
|
+if ($_GET['action']=='add' ) {
|
|
|
+
|
|
|
+ switch ($_GET['content']){
|
|
|
+ case 'forum': $interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&action=add&content=forum', 'name' => get_lang('AddForum')); break;
|
|
|
+ case 'forumcategory':$interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&action=add&content=forumcategory', 'name' => get_lang('AddForumCategory'));break;
|
|
|
+ default: break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+Display :: display_header(null);
|
|
|
+
|
|
|
api_display_tool_title($nameTools);
|
|
|
//echo '<link href="forumstyles.css" rel="stylesheet" type="text/css" />';
|
|
|
|
|
@@ -102,277 +114,289 @@ if (api_is_allowed_to_edit())
|
|
|
$fck_attribute['ToolbarSet'] = 'ForumLight';
|
|
|
handle_forum_and_forumcategories();
|
|
|
}
|
|
|
-get_whats_new();
|
|
|
-$whatsnew_post_info = array();
|
|
|
-$whatsnew_post_info = $_SESSION['whatsnew_post_info'];
|
|
|
-
|
|
|
-/*
|
|
|
------------------------------------------------------------
|
|
|
- TRACKING
|
|
|
------------------------------------------------------------
|
|
|
-*/
|
|
|
-include(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
|
|
|
-event_access_tool(TOOL_FORUM);
|
|
|
-
|
|
|
-
|
|
|
-/*
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
- RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
-note: we do this here just after het handling of the actions to be sure that we already incorporate the
|
|
|
-latest changes
|
|
|
-*/
|
|
|
-// Step 1: We store all the forum categories in an array $forum_categories
|
|
|
-$forum_categories=array();
|
|
|
-$forum_categories_list=get_forum_categories();
|
|
|
-
|
|
|
-// step 2: we find all the forums (only the visible ones if it is a student)
|
|
|
-$forum_list=array();
|
|
|
-$forum_list=get_forums();
|
|
|
-
|
|
|
-/*
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
- RETRIEVING ALL GROUPS AND THOSE OF THE USER
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
-*/
|
|
|
-// the groups of the user
|
|
|
-$groups_of_user=array();
|
|
|
-$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
|
|
|
-// all groups in the course (and sorting them as the id of the group = the key of the array
|
|
|
-$all_groups=GroupManager::get_group_list();
|
|
|
-if(is_array($all_groups))
|
|
|
-{
|
|
|
- foreach ($all_groups as $group)
|
|
|
- {
|
|
|
- $all_groups[$group['id']]=$group;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/*
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
- ACTION LINKS
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
-*/
|
|
|
-//if (api_is_allowed_to_edit() and !$_GET['action'])
|
|
|
-echo '<span style="float:right;"><a href="forumsearch.php?'.api_get_cidreq().'&action=search"> '.Display::return_icon('search.gif').' '.get_lang('Search').'</a></span>';
|
|
|
-if (api_is_allowed_to_edit())
|
|
|
-{
|
|
|
- echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add&content=forumcategory"> '.Display::return_icon('forum_category_new.gif').' '.get_lang('AddForumCategory').'</a> ';
|
|
|
- if (is_array($forum_categories_list))
|
|
|
- {
|
|
|
- echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add&content=forum"> '.Display::return_icon('forum_new.gif').' '.get_lang('AddForum').'</a>';
|
|
|
- }
|
|
|
- //echo ' | <a href="forum_migration.php">'.get_lang('MigrateForum').'</a>';
|
|
|
-}
|
|
|
|
|
|
-/*
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
- Display Forum Categories and the Forums in it
|
|
|
-------------------------------------------------------------------------------------------------------
|
|
|
-*/
|
|
|
-echo '<table class="data_table" width="100%">'."\n";
|
|
|
-// Step 3: we display the forum_categories first
|
|
|
-if(is_array($forum_categories_list))
|
|
|
+if ($_GET['action']!='add' && $_GET['action']!='edit' )
|
|
|
{
|
|
|
- foreach ($forum_categories_list as $forum_category_key => $forum_category)
|
|
|
+ get_whats_new();
|
|
|
+ $whatsnew_post_info = array();
|
|
|
+ $whatsnew_post_info = $_SESSION['whatsnew_post_info'];
|
|
|
+
|
|
|
+ /*
|
|
|
+ -----------------------------------------------------------
|
|
|
+ TRACKING
|
|
|
+ -----------------------------------------------------------
|
|
|
+ */
|
|
|
+
|
|
|
+ include(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
|
|
|
+ event_access_tool(TOOL_FORUM);
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ note: we do this here just after het handling of the actions to be sure that we already incorporate the
|
|
|
+ latest changes
|
|
|
+ */
|
|
|
+ // Step 1: We store all the forum categories in an array $forum_categories
|
|
|
+ $forum_categories=array();
|
|
|
+ $forum_categories_list=get_forum_categories();
|
|
|
+
|
|
|
+ // step 2: we find all the forums (only the visible ones if it is a student)
|
|
|
+ $forum_list=array();
|
|
|
+ $forum_list=get_forums();
|
|
|
+
|
|
|
+ /*
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ RETRIEVING ALL GROUPS AND THOSE OF THE USER
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ */
|
|
|
+ // the groups of the user
|
|
|
+ $groups_of_user=array();
|
|
|
+ $groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
|
|
|
+ // all groups in the course (and sorting them as the id of the group = the key of the array
|
|
|
+ $all_groups=GroupManager::get_group_list();
|
|
|
+ if(is_array($all_groups))
|
|
|
{
|
|
|
- echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"5\">";
|
|
|
- echo '<a href="viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.prepare4display($forum_category['cat_id']).'" '.class_visible_invisible(prepare4display($forum_category['visibility'])).'>'.prepare4display($forum_category['cat_title']).'</a><br />';
|
|
|
- if ($forum_category['cat_comment']<>'' AND trim($forum_category['cat_comment'])<>' ')
|
|
|
- {
|
|
|
- echo '<span>'.prepare4display($forum_category['cat_comment']).'</span>';
|
|
|
- }
|
|
|
- echo "</th>\n";
|
|
|
- if (api_is_allowed_to_edit())
|
|
|
+ foreach ($all_groups as $group)
|
|
|
{
|
|
|
- echo "\t\t<th>";
|
|
|
- echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=edit&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>";
|
|
|
- echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeleteForumCategory"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>";
|
|
|
- display_visible_invisible_icon('forumcategory', prepare4display($forum_category['cat_id']), prepare4display($forum_category['visibility']));
|
|
|
- display_lock_unlock_icon('forumcategory',prepare4display($forum_category['cat_id']), prepare4display($forum_category['locked']));
|
|
|
- display_up_down_icon('forumcategory',prepare4display($forum_category['cat_id']), $forum_categories_list);
|
|
|
- echo "</th>\n";
|
|
|
+ $all_groups[$group['id']]=$group;
|
|
|
}
|
|
|
- echo "\t</tr>\n";
|
|
|
+ }
|
|
|
|
|
|
- // step 4: the interim headers (for the forum)
|
|
|
- echo "\t<tr class=\"forum_header\">\n";
|
|
|
- echo "\t\t<td colspan='2'>".get_lang('Forum')."</td>\n";
|
|
|
- echo "\t\t<td>".get_lang('Topics')."</td>\n";
|
|
|
- echo "\t\t<td>".get_lang('Posts')."</td>\n";
|
|
|
- echo "\t\t<td>".get_lang('LastPosts')."</td>\n";
|
|
|
- if (api_is_allowed_to_edit())
|
|
|
+ /*
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ ACTION LINKS
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ */
|
|
|
+ //if (api_is_allowed_to_edit() and !$_GET['action'])
|
|
|
+ echo '<span style="float:right;"><a href="forumsearch.php?'.api_get_cidreq().'&action=search"> '.Display::return_icon('search.gif').' '.get_lang('Search').'</a></span>';
|
|
|
+ if (api_is_allowed_to_edit())
|
|
|
+ {
|
|
|
+ echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add&content=forumcategory"> '.Display::return_icon('forum_category_new.gif').' '.get_lang('AddForumCategory').'</a> ';
|
|
|
+ if (is_array($forum_categories_list))
|
|
|
{
|
|
|
- echo "\t\t<td>".get_lang('Actions')."</td>\n";
|
|
|
+ echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add&content=forum"> '.Display::return_icon('forum_new.gif').' '.get_lang('AddForum').'</a>';
|
|
|
}
|
|
|
- echo "\t</tr>\n";
|
|
|
-
|
|
|
- // the forums in this category
|
|
|
- $forums_in_category=get_forums_in_category($forum_category['cat_id']);
|
|
|
+ //echo ' | <a href="forum_migration.php">'.get_lang('MigrateForum').'</a>';
|
|
|
+ }
|
|
|
|
|
|
- // step 5: we display all the forums in this category.
|
|
|
- $forum_count=0;
|
|
|
- foreach ($forum_list as $key=>$forum)
|
|
|
+ /*
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ Display Forum Categories and the Forums in it
|
|
|
+ ------------------------------------------------------------------------------------------------------
|
|
|
+ */
|
|
|
+ echo '<table class="data_table" width="100%">'."\n";
|
|
|
+ // Step 3: we display the forum_categories first
|
|
|
+ if(is_array($forum_categories_list))
|
|
|
+ {
|
|
|
+ foreach ($forum_categories_list as $forum_category_key => $forum_category)
|
|
|
{
|
|
|
- // Here we clean the whatnew_post_info array a little bit because to display the icon we
|
|
|
- // test if $whatsnew_post_info[$forum['forum_id']] is empty or not.
|
|
|
- if(is_array($whatsnew_post_info[$forum['forum_id']]))
|
|
|
+ echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"5\">";
|
|
|
+ echo '<a href="viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.prepare4display($forum_category['cat_id']).'" '.class_visible_invisible(prepare4display($forum_category['visibility'])).'>'.prepare4display($forum_category['cat_title']).'</a><br />';
|
|
|
+
|
|
|
+ if ($forum_category['cat_comment']<>'' AND trim($forum_category['cat_comment'])<>' ')
|
|
|
+ {
|
|
|
+ echo '<span class="forum_description">'.prepare4display($forum_category['cat_comment']).'</span>';
|
|
|
+ }
|
|
|
+ echo "</th>\n";
|
|
|
+
|
|
|
+ if (api_is_allowed_to_edit())
|
|
|
{
|
|
|
- foreach ($whatsnew_post_info[$forum['forum_id']] as $key_thread_id => $new_post_array)
|
|
|
- {
|
|
|
- if (empty($whatsnew_post_info[$forum['forum_id']][$key_thread_id]))
|
|
|
- {
|
|
|
- unset($whatsnew_post_info[$forum['forum_id']][$key_thread_id]);
|
|
|
- unset($_SESSION['whatsnew_post_info'][$forum['forum_id']][$key_thread_id]);
|
|
|
- }
|
|
|
- }
|
|
|
+ echo '<th style="padding: 5px; vertical-align: top;" align="center" >';
|
|
|
+ echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=edit&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>";
|
|
|
+ echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete&content=forumcategory&id=".prepare4display($forum_category['cat_id'])."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeleteForumCategory"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>";
|
|
|
+ display_visible_invisible_icon('forumcategory', prepare4display($forum_category['cat_id']), prepare4display($forum_category['visibility']));
|
|
|
+ display_lock_unlock_icon('forumcategory',prepare4display($forum_category['cat_id']), prepare4display($forum_category['locked']));
|
|
|
+ display_up_down_icon('forumcategory',prepare4display($forum_category['cat_id']), $forum_categories_list);
|
|
|
+ echo '</th>';
|
|
|
}
|
|
|
- // note: this can be speeded up if we transform the $forum_list to an array that uses the forum_category as the key.
|
|
|
- if (prepare4display($forum['forum_category'])==prepare4display($forum_category['cat_id']))
|
|
|
+ echo "\t</tr>\n";
|
|
|
+
|
|
|
+ // step 4: the interim headers (for the forum)
|
|
|
+ echo "\t<tr class=\"forum_header\">\n";
|
|
|
+ echo "\t\t<td colspan='2'>".get_lang('Forum')."</td>\n";
|
|
|
+ echo "\t\t<td>".get_lang('Topics')."</td>\n";
|
|
|
+ echo "\t\t<td>".get_lang('Posts')."</td>\n";
|
|
|
+ echo "\t\t<td>".get_lang('LastPosts')."</td>\n";
|
|
|
+ if (api_is_allowed_to_edit())
|
|
|
{
|
|
|
- // the forum has to be showed if
|
|
|
- // 1.v it is a not a group forum (teacher and student)
|
|
|
- // 2.v it is a group forum and it is public (teacher and student)
|
|
|
- // 3. it is a group forum and it is private (always for teachers only if the user is member of the forum
|
|
|
- // if the forum is private and it is a group forum and the user is not a member of the group forum then it cannot be displayed
|
|
|
- //if (!($forum['forum_group_public_private']=='private' AND !is_null($forum['forum_of_group']) AND !in_array($forum['forum_of_group'], $groups_of_user)))
|
|
|
- //{
|
|
|
- $show_forum=false;
|
|
|
-
|
|
|
- // SHOULD WE SHOW THIS PARTICULAR FORUM
|
|
|
- // you are teacher => show forum
|
|
|
-
|
|
|
- if (api_is_allowed_to_edit())
|
|
|
+ echo "\t\t<td>".get_lang('Actions')."</td>\n";
|
|
|
+ }
|
|
|
+ echo "\t</tr>\n";
|
|
|
+
|
|
|
+ // the forums in this category
|
|
|
+ $forums_in_category=get_forums_in_category($forum_category['cat_id']);
|
|
|
+
|
|
|
+ // step 5: we display all the forums in this category.
|
|
|
+ $forum_count=0;
|
|
|
+
|
|
|
+ foreach ($forum_list as $key=>$forum)
|
|
|
+ {
|
|
|
+ // Here we clean the whatnew_post_info array a little bit because to display the icon we
|
|
|
+ // test if $whatsnew_post_info[$forum['forum_id']] is empty or not.
|
|
|
+ if(is_array($whatsnew_post_info[$forum['forum_id']]))
|
|
|
{
|
|
|
- //echo 'teacher';
|
|
|
- $show_forum=true;
|
|
|
+ foreach ($whatsnew_post_info[$forum['forum_id']] as $key_thread_id => $new_post_array)
|
|
|
+ {
|
|
|
+ if (empty($whatsnew_post_info[$forum['forum_id']][$key_thread_id]))
|
|
|
+ {
|
|
|
+ unset($whatsnew_post_info[$forum['forum_id']][$key_thread_id]);
|
|
|
+ unset($_SESSION['whatsnew_post_info'][$forum['forum_id']][$key_thread_id]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- // you are not a teacher
|
|
|
- else
|
|
|
- {
|
|
|
- //echo 'student';
|
|
|
- // it is not a group forum => show forum (invisible forums are already left out see get_forums function)
|
|
|
- if ($forum['forum_of_group']=='0')
|
|
|
+
|
|
|
+ // note: this can be speeded up if we transform the $forum_list to an array that uses the forum_category as the key.
|
|
|
+ if (prepare4display($forum['forum_category'])==prepare4display($forum_category['cat_id']))
|
|
|
+ {
|
|
|
+ // the forum has to be showed if
|
|
|
+ // 1.v it is a not a group forum (teacher and student)
|
|
|
+ // 2.v it is a group forum and it is public (teacher and student)
|
|
|
+ // 3. it is a group forum and it is private (always for teachers only if the user is member of the forum
|
|
|
+ // if the forum is private and it is a group forum and the user is not a member of the group forum then it cannot be displayed
|
|
|
+ //if (!($forum['forum_group_public_private']=='private' AND !is_null($forum['forum_of_group']) AND !in_array($forum['forum_of_group'], $groups_of_user)))
|
|
|
+ //{
|
|
|
+ $show_forum=false;
|
|
|
+
|
|
|
+ // SHOULD WE SHOW THIS PARTICULAR FORUM
|
|
|
+ // you are teacher => show forum
|
|
|
+
|
|
|
+ if (api_is_allowed_to_edit())
|
|
|
{
|
|
|
- //echo '-gewoon forum';
|
|
|
+ //echo 'teacher';
|
|
|
$show_forum=true;
|
|
|
}
|
|
|
- // it is a group forum
|
|
|
+ // you are not a teacher
|
|
|
else
|
|
|
{
|
|
|
- //echo '-groepsforum';
|
|
|
- // it is a group forum but it is public => show
|
|
|
- if ($forum['forum_group_public_private']=='public')
|
|
|
+ //echo 'student';
|
|
|
+ // it is not a group forum => show forum (invisible forums are already left out see get_forums function)
|
|
|
+ if ($forum['forum_of_group']=='0')
|
|
|
{
|
|
|
+ //echo '-gewoon forum';
|
|
|
$show_forum=true;
|
|
|
- //echo '-publiek';
|
|
|
}
|
|
|
- // it is a group forum and it is private
|
|
|
+ // it is a group forum
|
|
|
else
|
|
|
{
|
|
|
- //echo '-prive';
|
|
|
- // it is a group forum and it is private but the user is member of the group
|
|
|
- if (in_array($forum['forum_of_group'],$groups_of_user))
|
|
|
+ //echo '-groepsforum';
|
|
|
+ // it is a group forum but it is public => show
|
|
|
+ if ($forum['forum_group_public_private']=='public')
|
|
|
{
|
|
|
- //echo '-is lid';
|
|
|
$show_forum=true;
|
|
|
+ //echo '-publiek';
|
|
|
}
|
|
|
+ // it is a group forum and it is private
|
|
|
else
|
|
|
{
|
|
|
- //echo '-is GEEN lid';
|
|
|
- $show_forum=false;
|
|
|
+ //echo '-prive';
|
|
|
+ // it is a group forum and it is private but the user is member of the group
|
|
|
+ if (in_array($forum['forum_of_group'],$groups_of_user))
|
|
|
+ {
|
|
|
+ //echo '-is lid';
|
|
|
+ $show_forum=true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //echo '-is GEEN lid';
|
|
|
+ $show_forum=false;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- }
|
|
|
- //echo '<hr>';
|
|
|
-
|
|
|
- if ($show_forum)
|
|
|
- {
|
|
|
- $form_count++;
|
|
|
- echo "\t<tr class=\"forum\">\n";
|
|
|
- echo "\t\t<td width=\"20\">";
|
|
|
- if ($forum['forum_of_group']!=='0')
|
|
|
+
|
|
|
+
|
|
|
+ //echo '<hr>';
|
|
|
+
|
|
|
+ if ($show_forum)
|
|
|
{
|
|
|
- if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']]))
|
|
|
+ $form_count++;
|
|
|
+ echo "\t<tr class=\"forum\">\n";
|
|
|
+ echo "\t\t<td width=\"20\">";
|
|
|
+ if ($forum['forum_of_group']!=='0')
|
|
|
{
|
|
|
- echo icon('../img/forumgroupnew.gif');
|
|
|
+ if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']]))
|
|
|
+ {
|
|
|
+ echo icon('../img/forumgroupnew.gif');
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ echo icon('../img/forumgroup.gif');
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- echo icon('../img/forumgroup.gif');
|
|
|
+ if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']]))
|
|
|
+ {
|
|
|
+ echo icon('../img/forum.gif');
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ echo icon('../img/forum.gif');
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']]))
|
|
|
+ echo "</td>\n";
|
|
|
+ if ($forum['forum_of_group']<>'0')
|
|
|
{
|
|
|
- echo icon('../img/forum.gif');
|
|
|
+ $group_title=substr($all_groups[$forum['forum_of_group']]['name'],0,30);
|
|
|
+ $forum_title_group_addition=' (<a href="../group/group_space.php?'.api_get_cidreq().'&gidReq='.$all_groups[$forum['forum_of_group']]['id'].'" class="forum_group_link">'.$group_title.'</a>)';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- echo icon('../img/forum.gif');
|
|
|
+ $forum_title_group_addition='';
|
|
|
+ }
|
|
|
+
|
|
|
+ echo "\t\t<td><a href=\"viewforum.php?".api_get_cidreq()."&forum=".prepare4display($forum['forum_id'])."\" ".class_visible_invisible(prepare4display($forum['visibility'])).">".prepare4display($forum['forum_title']).'</a>'.$forum_title_group_addition.'<br />'.prepare4display($forum['forum_comment'])."</td>\n";
|
|
|
+ //$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated
|
|
|
+ // the number of topics and posts
|
|
|
+ echo "\t\t<td>".$forum['number_of_threads']."</td>\n";
|
|
|
+ echo "\t\t<td>".$forum['number_of_posts']."</td>\n";
|
|
|
+ // the last post in the forum
|
|
|
+ if ($forum['last_poster_name']<>'')
|
|
|
+ {
|
|
|
+ $name=$forum['last_poster_name'];
|
|
|
+ $poster_id=0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname'];
|
|
|
+ $poster_id=$forum['last_poster_id'];
|
|
|
+ }
|
|
|
+ echo "\t\t<td NOWRAP>";
|
|
|
+
|
|
|
+ if (!empty($forum['last_post_id']))
|
|
|
+ {
|
|
|
+ echo $forum['last_post_date']."<br /> ".get_lang('By').' '.display_user_link($poster_id, $name);
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- echo "</td>\n";
|
|
|
- if ($forum['forum_of_group']<>'0')
|
|
|
- {
|
|
|
- $group_title=substr($all_groups[$forum['forum_of_group']]['name'],0,30);
|
|
|
- $forum_title_group_addition=' (<a href="../group/group_space.php?'.api_get_cidreq().'&gidReq='.$all_groups[$forum['forum_of_group']]['id'].'" class="forum_group_link">'.$group_title.'</a>)';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $forum_title_group_addition='';
|
|
|
- }
|
|
|
-
|
|
|
- echo "\t\t<td><a href=\"viewforum.php?".api_get_cidreq()."&forum=".prepare4display($forum['forum_id'])."\" ".class_visible_invisible(prepare4display($forum['visibility'])).">".prepare4display($forum['forum_title']).'</a>'.$forum_title_group_addition.'<br />'.prepare4display($forum['forum_comment'])."</td>\n";
|
|
|
- //$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated
|
|
|
- // the number of topics and posts
|
|
|
- echo "\t\t<td>".$forum['number_of_threads']."</td>\n";
|
|
|
- echo "\t\t<td>".$forum['number_of_posts']."</td>\n";
|
|
|
- // the last post in the forum
|
|
|
- if ($forum['last_poster_name']<>'')
|
|
|
- {
|
|
|
- $name=$forum['last_poster_name'];
|
|
|
- $poster_id=0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname'];
|
|
|
- $poster_id=$forum['last_poster_id'];
|
|
|
- }
|
|
|
- echo "\t\t<td NOWRAP>";
|
|
|
- if (!empty($forum['last_post_id']))
|
|
|
- {
|
|
|
- echo $forum['last_post_date']."<br /> ".get_lang('By').' '.display_user_link($poster_id, $name);
|
|
|
- }
|
|
|
- echo "</td>\n";
|
|
|
-
|
|
|
-
|
|
|
- if (api_is_allowed_to_edit())
|
|
|
- {
|
|
|
- echo "\t\t<td NOWRAP align='center'>";
|
|
|
- echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=edit&content=forum&id=".$forum['forum_id']."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>";
|
|
|
- echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete&content=forum&id=".$forum['forum_id']."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeleteForum"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>";
|
|
|
- display_visible_invisible_icon('forum',$forum['forum_id'], $forum['visibility']);
|
|
|
- display_lock_unlock_icon('forum',$forum['forum_id'], $forum['locked']);
|
|
|
- display_up_down_icon('forum',$forum['forum_id'], $forums_in_category);
|
|
|
echo "</td>\n";
|
|
|
+
|
|
|
+
|
|
|
+ if (api_is_allowed_to_edit())
|
|
|
+ {
|
|
|
+ echo "\t\t<td NOWRAP align='center'>";
|
|
|
+ echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=edit&content=forum&id=".$forum['forum_id']."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>";
|
|
|
+ echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete&content=forum&id=".$forum['forum_id']."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeleteForum"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>";
|
|
|
+ display_visible_invisible_icon('forum',$forum['forum_id'], $forum['visibility']);
|
|
|
+ display_lock_unlock_icon('forum',$forum['forum_id'], $forum['locked']);
|
|
|
+ display_up_down_icon('forum',$forum['forum_id'], $forums_in_category);
|
|
|
+ echo "</td>\n";
|
|
|
+ }
|
|
|
+ echo "\t</tr>";
|
|
|
}
|
|
|
- echo "\t</tr>";
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (count($forum_list)==0)
|
|
|
+ {
|
|
|
+ echo "\t<tr><td>".get_lang('NoForumInThisCategory')."</td>".(api_is_allowed_to_edit()?'<td colspan="5"></td>':'<td colspan="4"></td>')."</tr>\n";
|
|
|
}
|
|
|
- }
|
|
|
- if (count($forum_list)==0)
|
|
|
- {
|
|
|
- echo "\t<tr><td>".get_lang('NoForumInThisCategory')."</td>".(api_is_allowed_to_edit()?'<td colspan="5"></td>':'<td colspan="4"></td>')."</tr>\n";
|
|
|
}
|
|
|
}
|
|
|
+ echo "</table>\n";
|
|
|
}
|
|
|
-echo "</table>\n";
|
|
|
-
|
|
|
/*
|
|
|
==============================================================================
|
|
|
FOOTER
|