';
$my_whatsnew_post_info = isset($whatsnew_post_info[$forum['forum_id']]) ? $whatsnew_post_info[$forum['forum_id']] : null;
if ($forum['forum_of_group'] == '0') {
$forum_image = Display::return_icon(
'forum_group.png',
get_lang('GroupForum'),
null,
ICON_SIZE_LARGE
);
} else {
$forum_image = Display::return_icon(
'forum.png',
get_lang('Forum'),
null,
ICON_SIZE_LARGE
);
}
if ($forum['forum_of_group'] != '0') {
$my_all_groups_forum_name = isset($all_groups[$forum['forum_of_group']]['name'])
? $all_groups[$forum['forum_of_group']]['name']
: null;
$my_all_groups_forum_id = isset($all_groups[$forum['forum_of_group']]['id'])
? $all_groups[$forum['forum_of_group']]['id']
: null;
$group_title = api_substr($my_all_groups_forum_name, 0, 30);
$forum_title_group_addition = ' (
'
. get_lang('GoTo') . ' ' . $group_title . ')';
} else {
$forum_title_group_addition = '';
}
if ((!isset($_SESSION['id_session']) || $_SESSION['id_session'] == 0) && !empty($forum['session_name'])) {
$session_displayed = ' ('.$forum['session_name'].')';
} else {
$session_displayed = '';
}
//$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated
// the number of topics and posts
$my_number_threads = isset($forum['number_of_threads']) ? $forum['number_of_threads'] : 0 ;
$my_number_posts = isset($forum['number_of_posts']) ? $forum['number_of_posts'] : 0 ;
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
'.$forum_image .'
' . $my_number_posts . ' ' . get_lang('Posts') . '
';
$html .= '
';
$html .= '
';
$iconForum = Display::return_icon(
'forum_yellow.png',
get_lang($forum_category['cat_title']),
null,
ICON_SIZE_MEDIUM
);
$linkForum = '';
$linkForum .= Display::tag(
'a',
$forum['forum_title'].$session_displayed,
array(
'href' => 'viewforum.php?' . api_get_cidreq()
. "&gidReq={$forum['forum_of_group']}&forum={$forum['forum_id']}&origin=$origin&search="
. Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
'class' => return_visible_invisible($forum['visibility'])
)
);
$html .= Display::tag(
'h3',
$linkForum . ' ' . $forum_title_group_addition,
array(
'class' => 'title'
)
);
$html .= Display::tag(
'p',
strip_tags($forum['forum_comment']),
array(
'class' => 'description'
)
);
$html .= '
';
$html .= '
';
$html .= '
';
$iconEmpty='';
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
$newPost='';
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
$newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
} else {
$newPost = $iconEmpty;
}
} else {
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
$newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
} else {
$newPost = $iconEmpty;
}
}
$html .= '
';
$html .= '
';
$html .= Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL);
$html .= ' ' . $my_number_threads . '
' . $newPost . '
';
// the last post in the forum
if ($forum['last_poster_name'] != '') {
$name = $forum['last_poster_name'];
$poster_id = 0;
} else {
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id = $forum['last_poster_id'];
}
$html .= '
';
if (!empty($forum['last_post_id'])) {
$html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' ';
$html .= api_convert_and_format_date($forum['last_post_date'])
. ' ' . get_lang('By') . ' '
. display_user_link($poster_id, $name);
}
$html .= '
';
$html .= '
';
if (
api_is_allowed_to_edit(false, true) &&
!($forum['session_id'] == 0 &&
intval(isset($_SESSION['id_session']) ? $_SESSION['id_session'] : null) != 0)
) {
$html .= '
'
. Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '';
$html .= '
"
. Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)
. '';
$html .= return_visible_invisible_icon(
'forum',
$forum['forum_id'],
$forum['visibility'],
array('forumcategory' => $_GET['forumcategory'])
);
$html .= return_lock_unlock_icon(
'forum',
$forum['forum_id'],
$forum['locked'],
array('forumcategory' => $_GET['forumcategory'])
);
$html .= return_up_down_icon('forum', $forum['forum_id'], $forums_in_category);
}
$iconnotify = 'notification_mail_na.png';
if (is_array(isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : null)) {
if (in_array($forum['forum_id'],$_SESSION['forum_notification']['forum'])) {
$iconnotify = 'notification_mail.png';
}
}
if (!api_is_anonymous()) {
$html .= '
' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '';
}
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '