Merge pull request #708 from aragonc/forum-chamilo

Forum chamilo css bootstrap #TMI
1.10.x
Yannick Warnier 10 years ago
commit 33a9e9a85e
  1. 27
      app/Resources/public/css/base.css
  2. 61
      main/forum/forumfunction.inc.php
  3. 387
      main/forum/index.php
  4. 254
      main/forum/viewforumcategory.php
  5. BIN
      main/img/icons/128/alert.png
  6. BIN
      main/img/icons/128/forum_group.png
  7. BIN
      main/img/icons/128/notification_mail.png
  8. BIN
      main/img/icons/128/notification_mail_na.png
  9. BIN
      main/img/icons/16/post-item.png
  10. BIN
      main/img/icons/22/alert.png
  11. BIN
      main/img/icons/22/notification_mail.png
  12. BIN
      main/img/icons/22/notification_mail_na.png
  13. BIN
      main/img/icons/22/notification_mail_ok.png
  14. BIN
      main/img/icons/22/post-forum.png
  15. BIN
      main/img/icons/32/forum_blue.png
  16. BIN
      main/img/icons/32/forum_yellow.png
  17. BIN
      main/img/icons/32/notification_mail.png
  18. BIN
      main/img/icons/32/notification_mail_na.png
  19. BIN
      main/img/icons/48/forum_group.png
  20. BIN
      main/img/icons/64/notification_mail.png
  21. BIN
      main/img/icons/64/notification_mail_na.png

@ -6120,7 +6120,32 @@ div#chat-remote-video video {
height: auto;
width: 100%;
}
/* CSS Forum */
.forum {
border-color: #dddddd !important;
}
.forum .number-post{
background-color: #F7F7F9;
border: 1px solid #E1E1E1 ;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
padding: 10px;
text-align: center;
}
.forum .number-post p{
padding: 0;
margin: 0;
}
.forum .title{
margin: 0;
padding: 0;
font-size: 18px;
}
.forum .description{
font-size: 14px;
color: #666666;
}
/* CSS NEW TOP ******************************************************************************/
/* CSS Responsive */
@media (min-width: 1025px) and (max-width: 1200px) {

@ -950,25 +950,37 @@ function check_if_last_post_of_thread($thread_id)
*/
function display_visible_invisible_icon($content, $id, $current_visibility_status, $additional_url_parameters = '')
{
echo return_visible_invisible_icon($content, $id, $current_visibility_status, $additional_url_parameters);
}
/**
* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
* @param $id the id of the content we want to make invisible
* @param $current_visibility_status what is the current status of the visibility (0 = invisible, 1 = visible)
* @return string HTML
*/
function return_visible_invisible_icon($content, $id, $current_visibility_status, $additional_url_parameters = '')
{
$html = '';
$id = Security::remove_XSS($id);
if ($current_visibility_status == '1') {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&';
if (is_array($additional_url_parameters)) {
foreach ($additional_url_parameters as $key => $value) {
echo $key.'='.$value.'&amp;';
$html .= $key . '=' . $value . '&amp;';
}
}
echo 'action=invisible&amp;content='.$content.'&amp;id='.$id.'">'.Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_SMALL).'</a>';
$html.='action=invisible&amp;content='.$content.'&amp;id='.$id.'">'.Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_SMALL).'</a>';
}
if ($current_visibility_status == '0') {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;';
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;';
if (is_array($additional_url_parameters)) {
foreach ($additional_url_parameters as $key => $value) {
echo $key.'='.$value.'&amp;';
$html .= $key . '=' . $value . '&amp;';
}
}
echo 'action=visible&amp;content='.$content.'&amp;id='.$id.'">'.Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL).'</a>';
$html .= 'action=visible&amp;content=' . $content . '&amp;id=' . $id . '">' . Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL) . '</a>';
}
return $html;
}
/**
@ -984,33 +996,39 @@ function display_visible_invisible_icon($content, $id, $current_visibility_statu
*/
function display_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters = '')
{
echo return_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters);
}
function return_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters = '')
{
$html = '';
$id = intval($id);
//check if the forum is blocked due
if ($content == 'thread') {
if (api_resource_is_locked_by_gradebook($id, LINK_FORUM_THREAD)) {
echo Display::return_icon('lock_na.png', get_lang('ResourceLockedByGradebook'), array(), ICON_SIZE_SMALL);
$html .= Display::return_icon('lock_na.png', get_lang('ResourceLockedByGradebook'), array(), ICON_SIZE_SMALL);
return;
return $html;
}
}
if ($current_lock_status == '1') {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;';
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
if (is_array($additional_url_parameters)) {
foreach ($additional_url_parameters as $key => $value) {
echo $key.'='.$value.'&amp;';
$html .= $key . '=' . $value . '&';
}
}
echo 'action=unlock&amp;content='.$content.'&amp;id='.$id.'">'.Display::return_icon('lock.png', get_lang('Unlock'), array(), ICON_SIZE_SMALL).'</a>';
$html.= 'action=unlock&content='.$content.'&id='.$id.'">'.Display::return_icon('lock.png', get_lang('Unlock'), array(), ICON_SIZE_SMALL).'</a>';
}
if ($current_lock_status == '0') {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;';
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
if (is_array($additional_url_parameters)) {
foreach ($additional_url_parameters as $key => $value) {
echo $key.'='.$value.'&amp;';
$html .= $key . '=' . $value . '&';
}
}
echo 'action=lock&amp;content='.$content.'&amp;id='.$id.'">'.Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL).'</a>';
$html .= 'action=lock&content=' . $content . '&id=' . $id . '">' . Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL) . '</a>';
}
return $html;
}
/**
@ -1027,6 +1045,10 @@ function display_lock_unlock_icon($content, $id, $current_lock_status, $addition
* @version february 2006, dokeos 1.8
*/
function display_up_down_icon($content, $id, $list)
{
echo return_up_down_icon($content, $id, $list);
}
function return_up_down_icon($content, $id, $list)
{
$id = strval(intval($id));
$total_items = count($list);
@ -1056,7 +1078,7 @@ function display_up_down_icon($content, $id, $list)
} else {
$return_value .= Display::return_icon('down_na.png', '-', array(), ICON_SIZE_SMALL);
}
echo $return_value;
return $return_value;
}
/**
@ -1272,7 +1294,14 @@ function class_visible_invisible($current_visibility_status)
return 'class="invisible"';
}
}
function return_visible_invisible($current_visibility_status)
{
$current_visibility_status = intval($current_visibility_status);
if ($current_visibility_status == 0) {
$status='invisible';
return $status;
}
}
/**
* Retrieve all the information off the forum categories (or one specific) for the current course.
* The categories are sorted according to their sorting order (cat_order

@ -263,91 +263,105 @@ if (is_array($forumCategories)) {
$forumCategory['cat_title'] = get_lang('WithoutCategory');
}
echo '<table class="forum_table">';
echo '<thead>';
echo '<tr><th class="forum_head" colspan="5">';
echo '<a href="viewforumcategory.php?'.api_get_cidreq(
).'&forumcategory='.intval(
$forumCategory['cat_id']
).'" '.class_visible_invisible($forumCategory['visibility']).'>'.
prepare4display($forumCategory['cat_title']).$session_displayed.
'</a>'.$session_img.'<br />';
if ($forumCategory['cat_comment'] != '' && trim(
$forumCategory['cat_comment']
) != '&nbsp;'
) {
echo '<span class="forum_description">'.prepare4display(
$forumCategory['cat_comment']
).'</span>';
}
echo '</th>';
echo '<th style="vertical-align: top;" align="center" >';
if (!empty($forumCategory['cat_id'])) {
if (api_is_allowed_to_edit(
false,
true
) && !($forumCategory['session_id'] == 0 && intval(
$sessionId
) != 0)
) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq(
).'&action=edit&content=forumcategory&id='.intval(
$forumCategory['cat_id']
).'">'.Display::return_icon(
'edit.png',
get_lang('Edit'),
array(),
ICON_SIZE_SMALL
).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq(
).'&action=delete&content=forumcategory&id='.intval(
$forumCategory['cat_id']
)."\" onclick=\"javascript:if(!confirm('".addslashes(
api_htmlentities(
$html = '';
$iconsEdit = '';
$idCategory = $forumCategory['cat_id'];
$urlCategory = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.intval($idCategory);
$titleCategory = Display::tag(
'a',
$forumCategory['cat_title'],
array(
'href' => $urlCategory,
'class' => return_visible_invisible($forumCategory['visibility'])
)
);
$descriptionCategory = $forumCategory['cat_comment'];
if (!empty($idCategory)){
if (api_is_allowed_to_edit(false, true) && !($forumCategory['session_id'] == 0 && intval($sessionId) != 0)){
$iconsEdit.= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit&content=forumcategory&id='.intval($idCategory).
'">'.Display::return_icon(
'edit.png',
get_lang('Edit'),
array(),
ICON_SIZE_SMALL
).'</a>';
$iconsEdit.='<a href="'.api_get_self().'?'.api_get_cidreq().
'&action=delete&content=forumcategory&id='. intval($idCategory).
"\" onclick=\"javascript:if(!confirm('". addslashes(api_htmlentities(
get_lang('DeleteForumCategory'),
ENT_QUOTES
)
)."')) return false;\">".Display::return_icon(
)).
"')) return false;\">".
Display::return_icon(
'delete.png',
get_lang('Delete'),
array(),
ICON_SIZE_SMALL
).'</a>';
display_visible_invisible_icon(
'forumcategory',
strval(intval($forumCategory['cat_id'])),
strval(intval($forumCategory['visibility']))
);
display_lock_unlock_icon(
'forumcategory',
strval(intval($forumCategory['cat_id'])),
strval(intval($forumCategory['locked']))
);
display_up_down_icon(
'forumcategory',
strval(intval($forumCategory['cat_id'])),
$forumCategories
);
).
'</a>';
$iconsEdit .= return_visible_invisible_icon(
'forumcategory',
strval(intval($idCategory)),
strval(intval($forumCategory['visibility']))
);
$iconsEdit .= return_lock_unlock_icon(
'forumcategory',
strval(intval($$idCategory)),
strval(intval($forumCategory['locked']))
);
$iconsEdit .= return_up_down_icon(
'forumcategory',
strval(intval($idCategory)),
$forumCategories
);
}
}
}
echo '</th>';
echo '</tr>';
echo '</thead>';
$html .= '<div class="category-forum">';
$html .= Display::tag(
'div',
$iconsEdit,
array(
'class' => 'pull-right'
)
);
$icoCategory = Display::return_icon(
'forum_blue.png',
get_lang(
$forumCategory['cat_title']
),
array(),
ICON_SIZE_MEDIUM
);
$html .= '<h3>' . $icoCategory . $titleCategory . '</h3>';
if ($descriptionCategory != '' && trim($descriptionCategory) != '&nbsp;') {
$html .= '<div class="forum-description">'.$descriptionCategory.'</div>';
}
$html .= '</div>';
echo $html;
echo '<div class="forum_display">';
if (!empty($forumsInCategory)) {
// Step 4: The interim headers (for the forum).
echo '<tr class="forum_header">';
/* echo '<tr class="forum_header">';
echo '<td></td>';
echo '<td>'.get_lang('Forum').'</td>';
echo '<td>'.get_lang('Topics').'</td>';
echo '<td>'.get_lang('Posts').'</td>';
echo '<td>'.get_lang('LastPosts').'</td>';
echo '<td>'.get_lang('Actions').'</td>';
echo '</tr>';
echo '</tr>'; */
// Step 5: We display all the forums in this category.
foreach ($forum_list as $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.
@ -368,6 +382,7 @@ if (is_array($forumCategories)) {
// Note: This can be speed up if we transform the $forum_list
// to an array that uses the forum_category as the key.
if (isset($forum['forum_category']) &&
$forum['forum_category'] == $forumCategory['cat_id']
) {
@ -395,67 +410,53 @@ if (is_array($forumCategories)) {
if ($show_forum) {
$form_count++;
$mywhatsnew_post_info = isset($whatsnew_post_info[$forum['forum_id']]) ? $whatsnew_post_info[$forum['forum_id']] : null;
$mywhatsnew_post_info = isset($whatsnew_post_info[$forum['forum_id']]) ?
$whatsnew_post_info[$forum['forum_id']] : null;
$html = '<div class="panel panel-default forum">';
$html .= '<div class="panel-body">';
$forum_image = '';
$imgForum = '';
// Showing the image
if (!empty($forum['forum_image'])) {
$image_path = api_get_path(
WEB_COURSE_PATH
).api_get_course_path(
).'/upload/forum/images/'.$forum['forum_image'];
) . api_get_course_path() . '/upload/forum/images/' . $forum['forum_image'];
$image_size = api_getimagesize($image_path);
$img_attributes = '';
if (!empty($image_size)) {
if ($image_size['width'] > 100 || $image_size['height'] > 100) {
//limit display width and height to 100px
$img_attributes = ' style="width:100px" width="100px" height="100px"';
$td_width = 100;
} else {
$td_width = $image_size['width'];
}
$forum_image = "<img src=\"$image_path\" $img_attributes>";
//limit display width and height to 100px
$img_attributes = ' style="width:80px" height="80px"';
$imgForum = "<img src=\"$image_path\" $img_attributes>";
} else {
$forum_image = '';
$td_width = 20;
$imgForum = '';
}
echo '<td width="'.$td_width.'px">';
echo $forum_image;
$forum_image = $imgForum;
} else {
echo '<td width="20px">';
if ($forum['forum_of_group'] !== '0') {
if (is_array(
$mywhatsnew_post_info
) && !empty($mywhatsnew_post_info)
) {
echo Display::return_icon(
'forumgroupnew.gif'
);
} else {
echo Display::return_icon(
'forumgroup.gif',
get_lang('GroupForum')
);
}
if ($forum['forum_of_group'] == '0') {
$forum_image = Display::return_icon(
'forum_group.png',
get_lang('GroupForum'),
null,
ICON_SIZE_LARGE
);
} else {
if (is_array(
$mywhatsnew_post_info
) && !empty($mywhatsnew_post_info)
) {
echo Display::return_icon(
'forum.gif',
get_lang('Forum')
);
} else {
echo Display::return_icon('forum.gif');
}
$forum_image = Display::return_icon(
'forum.png',
get_lang('Forum'),
null,
ICON_SIZE_LARGE
);
}
}
echo '</td>';
// Validation when belongs to a session
$session_img = api_get_session_image(
$forum['session_id'],
@ -463,8 +464,10 @@ if (is_array($forumCategories)) {
);
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;
$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,
@ -485,29 +488,84 @@ if (is_array($forumCategories)) {
}
$forum['forum_of_group'] == 0 ? $groupid = '' : $groupid = $forum['forum_of_group'];
echo '<td><a href="viewforum.php?'.api_get_cidreq(
).'&gidReq='.intval($groupid).'&forum='.intval(
$forum['forum_id']
).'" '.class_visible_invisible(
strval(intval($forum['visibility']))
).'>';
$number_threads = isset($forum['number_of_threads']) ? $forum['number_of_threads'] : 0;
$number_posts = isset($forum['number_of_posts']) ? $forum['number_of_posts'] : 0;
$html .= '<div class="row">';
$html .= '<div class="col-md-6">';
$html .= '<div class="col-md-3">';
$html .= '<div class="number-post">'.$forum_image .'<p>' . $number_posts . ' ' . get_lang('Posts') . '</p></div>';
$html .= '</div>';
$html .= '<div class="col-md-9">';
$iconForum = Display::return_icon(
'forum_yellow.png',
get_lang($forumCategory['cat_title']),
null,
ICON_SIZE_MEDIUM
);
$linkForum = '';
$linkForum .= Display::tag(
'a',
$forum['forum_title'],
array (
'href'=>'viewforum.php?' . api_get_cidreq().'&gidReq=' . intval($groupid).'&forum=' . intval(
$forum['forum_id']),
'class' => return_visible_invisible( strval( intval($forum['visibility']) ) ) )
);
// Forum title
echo prepare4display(
$forum['forum_title']
).$session_displayed.'</a>'.$forum_title_group_addition.'<br />';
$html .= '<h3 class="title">' . $iconForum . $linkForum . '</h3>';
echo '<span class="forum_description">'.prepare4display(
$forum['forum_comment']
).'</span>';
echo '</td>';
$html .= Display::tag(
'p',
strip_tags($forum['forum_comment']),
array(
'class'=>'description'
)
);
$html .= '</div>';
$html .= '</div>';
// The number of topics and posts.
$number_threads = isset($forum['number_of_threads']) ? $forum['number_of_threads'] : null;
$number_posts = isset($forum['number_of_posts']) ? $forum['number_of_posts'] : null;
if ($forum['forum_of_group'] !== '0') {
$iconEmpty='';
$newPost='';
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
$newPost = ' '.
Display::return_icon(
'alert.png',
get_lang('Forum'),
null,
ICON_SIZE_SMALL
);
} else {
$newPost = $iconEmpty;
}
} else {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
$newPost = ' '.
Display::return_icon(
'alert.png',
get_lang('Forum'),
null,
ICON_SIZE_SMALL
);
} else {
$newPost = $iconEmpty;
}
}
echo '<td>'.$number_threads.'</td>';
echo '<td>'.$number_posts.'</td>';
$html .= '<div class="col-md-6">';
$html .= '<div class="row">';
$html .= '<div class="col-md-2">';
$html .= Display::return_icon(
'post-forum.png',
get_lang('Forum'),
null,
ICON_SIZE_SMALL
);
$html .= ' ' . $number_threads . '<br>'.$newPost.'</div>';
$html .= '<div class="col-md-6">';
// The last post in the forum.
if ($forum['last_poster_name'] != '') {
@ -526,23 +584,27 @@ if (is_array($forumCategories)) {
$userinfo['username']
);
}
echo '<td nowrap="nowrap">';
if (!empty($forum['last_post_id'])) {
echo api_convert_and_format_date(
$forum['last_post_date']
).'<br /> '.get_lang(
'By'
).' '.display_user_link(
$html .= Display::return_icon(
'post-item.png',
null,
null,
ICON_SIZE_TINY
).' '.
api_convert_and_format_date($forum['last_post_date']).
'<br /> ' . get_lang('By').' '.
display_user_link(
$poster_id,
$name,
'',
$username
);
}
echo '</td>';
$html .= '</div>';
$html .= '<div class="col-md-4">';
echo '<td class="td_actions">';
if (api_is_allowed_to_edit(
false,
true
@ -550,15 +612,15 @@ if (is_array($forumCategories)) {
$sessionId
) != 0)
) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq(
).'&action=edit&content=forum&id='.$forum['forum_id'].'">'.
$html .= '<a href="'.api_get_self() . '?' . api_get_cidreq(
).'&action=edit&content=forum&id='.$forum['forum_id'] . '">'.
Display::return_icon(
'edit.png',
get_lang('Edit'),
array(),
ICON_SIZE_SMALL
).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq(
) . '</a>';
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq(
).'&action=delete&content=forum&id='.$forum['forum_id']."\" onclick=\"javascript:if(!confirm('".addslashes(
api_htmlentities(
get_lang('DeleteForum'),
@ -571,56 +633,71 @@ if (is_array($forumCategories)) {
array(),
ICON_SIZE_SMALL
).'</a>';
display_visible_invisible_icon(
$html .= return_visible_invisible_icon(
'forum',
$forum['forum_id'],
$forum['visibility']
);
display_lock_unlock_icon(
$html .= return_lock_unlock_icon(
'forum',
$forum['forum_id'],
$forum['locked']
);
display_up_down_icon(
$html .= return_up_down_icon(
'forum',
$forum['forum_id'],
$forumsInCategory
);
}
$iconnotify = 'send_mail.gif';
$session_forum_notification = isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : false;
$iconnotify = 'notification_mail_na.png';
$session_forum_notification = isset($_SESSION['forum_notification']['forum']) ?
$_SESSION['forum_notification']['forum'] : false;
if (is_array($session_forum_notification)) {
if (in_array(
$forum['forum_id'],
$session_forum_notification
)) {
$iconnotify = 'send_mail_checked.gif';
$iconnotify = 'notification_mail.png';
}
}
if (!api_is_anonymous(
) && api_is_allowed_to_session_edit(false, true)
) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq(
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq(
).'&action=notify&content=forum&id='.$forum['forum_id'].'">'.
Display::return_icon(
$iconnotify,
get_lang('NotifyMe')
).'</a>';
get_lang('NotifyMe'),
null,
ICON_SIZE_SMALL
) . '</a>';
}
echo '</td></tr>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
}
echo $html;
}
}
} else {
echo '<tr><td>'.get_lang(
echo '<div class="alert alert-warning">'.get_lang(
'NoForumInThisCategory'
).'</td>'.(api_is_allowed_to_edit(
).'</div>'.(api_is_allowed_to_edit(
false,
true
) ? '<td colspan="6"></td>' : '<td colspan="6"></td>').'</tr>';
) ? '<div>' : '</div>').'</div>';
}
echo '</table>';
echo '</div>';
}
}
Display:: display_footer();

@ -97,16 +97,18 @@ if (!api_is_allowed_to_edit(false,true) AND ($current_forum_category && $current
}
/* Action Links */
echo '<div class="actions">';
echo '<span style="float:right;">'.search_link().'</span>';
echo '<a href="index.php?gradebook='.$gradebook.'&'.api_get_cidreq().'">'.
$html = '';
$html .= '<div class="actions">';
$html .= '<a href="index.php?gradebook='.$gradebook.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_edit(false,true)) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'].'&amp;action=add&amp;content=forum"> '.Display::return_icon('new_forum.png', get_lang('AddForum'),'',ICON_SIZE_MEDIUM).'</a>';
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'].'&amp;action=add&amp;content=forum"> '.Display::return_icon('new_forum.png', get_lang('AddForum'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
$html .= search_link();
$html .= '</div>';
/* ACTIONS */
echo $html;
$action_forums = isset($_GET['action']) ? $_GET['action'] : '';
if (api_is_allowed_to_edit(false, true)) {
@ -154,7 +156,12 @@ if ($action_forums != 'add') {
/* Display Forum Categories and the Forums in it */
echo '<table class="forum_table" width="100%">';
$html = '';
$html .= '<div class="category-forum">';
$my_session = isset($_SESSION['id_session']) ? $_SESSION['id_session'] : null;
if ((!isset($_SESSION['id_session']) || $_SESSION['id_session'] == 0) && !empty($forum_category['session_name'])) {
@ -163,25 +170,62 @@ if ($action_forums != 'add') {
$session_displayed = '';
}
$forum_categories_list = '';
echo '<thead>';
echo '<tr><th class="forum_head" '.(api_is_allowed_to_edit(null, true) ? 'colspan="5"' : 'colspan="6"').'>';
$forumId = $forum_category['cat_id'];
$forumTitle = $forum_category['cat_title'];
$linkForumCategory = 'viewforumcategory.php?'.api_get_cidreq().'&amp;forumcategory='.strval(intval($forumId));
$descriptionCategory = $forum_category['cat_comment'];
$icoCategory = Display::return_icon('forum_blue.png',
get_lang($forumCategory['cat_title']),
array('class'=>''),
ICON_SIZE_MEDIUM
);
echo '<a href="viewforumcategory.php?'.api_get_cidreq().'&amp;forumcategory='.strval(intval($forum_category['cat_id'])).'" '.class_visible_invisible(strval(intval($forum_category['visibility']))).'>'.prepare4display($forum_category['cat_title']).$session_displayed.'</a>'. $session_img .'<br />';
if (api_is_allowed_to_edit(false, true) && !($forum_category['session_id'] == 0 && intval($my_session) != 0)) {
echo '<span class="forum_description">'.prepare4display($forum_category['cat_comment']).'</span>';
$iconsEdit = '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=edit&amp;content=forumcategory&amp;id='.$forumId.'">'.
Display::return_icon(
'edit.png',
get_lang('Edit'),
array(),
ICON_SIZE_SMALL
).'</a>';
$iconsEdit .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=delete&amp;content=forumcategory&amp;amp;id='.$forumId."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('DeleteForumCategory'), ENT_QUOTES))."')) return false;\">".
Display::return_icon(
'delete.png',
get_lang('Delete'),
array(),
ICON_SIZE_SMALL
).'</a>';
$iconsEdit .= return_visible_invisible_icon('forumcategory', $forum_category['cat_id'], $forum_category['visibility'], array('forumcategory' => $_GET['forumcategory']));
$iconsEdit .= return_lock_unlock_icon('forumcategory', $forum_category['cat_id'], $forum_category['locked'], array('forumcategory' => $_GET['forumcategory']));
$iconsEdit .= return_up_down_icon('forumcategory', $forum_category['cat_id'], $forum_categories_list);
$html .= Display::tag('div',$iconsEdit,array('class'=>'pull-right'));
}
if (api_is_allowed_to_edit(false, true) && !($forum_category['session_id'] == 0 && intval($my_session) != 0)) {
echo '<th style="vertical-align: top;" align="center">';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=edit&amp;content=forumcategory&amp;id='.$forum_category['cat_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=delete&amp;content=forumcategory&amp;amp;id='.$forum_category['cat_id']."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('DeleteForumCategory'), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
display_visible_invisible_icon('forumcategory', $forum_category['cat_id'], $forum_category['visibility'], array('forumcategory' => $_GET['forumcategory']));
display_lock_unlock_icon('forumcategory', $forum_category['cat_id'], $forum_category['locked'], array('forumcategory' => $_GET['forumcategory']));
display_up_down_icon('forumcategory', $forum_category['cat_id'], $forum_categories_list);
echo '</th>';
$html .= Display::tag(
'h3',
$icoCategory.
Display::tag(
'a',
$forumTitle,
array(
'href'=>$linkForumCategory,
'class'=>return_visible_invisible(strval(intval($forum_category['visibility'])))
)
).$session_displayed.$session_img,
null
);
if ($descriptionCategory != '' && trim($descriptionCategory)!= '&nbsp;')
{
$html .= '<div class="forum-description">'.$descriptionCategory.'</div>';
}
echo '</tr>';
/* echo '<tr><th class="forum_head" '.(api_is_allowed_to_edit(null, true) ? 'colspan="5"' : 'colspan="6"').'>'; */
// Step 3: The interim headers (for the forum).
/*
echo '<tr class="forum_header">';
echo '<td colspan="2">'.get_lang('Forum').'</td>';
echo '<td>'.get_lang('ForumThreads').'</td>';
@ -190,7 +234,12 @@ if ($action_forums != 'add') {
echo '<td>'.get_lang('Actions').'</td>';
echo '</tr>';
echo '</thead>';
*/
$html .= '</div>';
echo $html;
echo '<div class="forum_display">';
// The forums in this category.
$forums_in_category = get_forums_in_category($forum_category['cat_id']);
@ -244,23 +293,29 @@ if ($action_forums != 'add') {
$form_count = isset($form_count) ? $form_count : 0;
if ($show_forum === true) {
$form_count++;
echo '<tr class="forum">';
echo '<td width="20">';
$html = '<div class="panel panel-default forum">';
$html .= '<div class="panel-body">';
$my_whatsnew_post_info = isset($whatsnew_post_info[$forum['forum_id']]) ? $whatsnew_post_info[$forum['forum_id']] : null;
if ($forum['forum_of_group'] !== '0') {
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
echo Display::return_icon('forumgroupnew.gif');
} else {
echo Display::return_icon('forumgroup.gif', get_lang('GroupForum'));
}
if ($forum['forum_of_group'] == '0') {
$forum_image = Display::return_icon(
'forum_group.png',
get_lang('GroupForum'),
null,
ICON_SIZE_LARGE
);
} else {
if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
echo Display::return_icon('forum.gif', get_lang('Forum'));
} else {
echo Display::return_icon('forum.gif');
}
$forum_image = Display::return_icon(
'forum.png',
get_lang('Forum'),
null,
ICON_SIZE_LARGE
);
}
echo '</td>';
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;
@ -276,15 +331,92 @@ if ($action_forums != 'add') {
} else {
$session_displayed = '';
}
echo '<td><a href="viewforum.php?'.api_get_cidreq().'&amp;gidReq='.$forum['forum_of_group'].'&amp;forum='.$forum['forum_id'].'&amp;origin='.$origin.'&amp;search='.Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')).'" '.class_visible_invisible($forum['visibility']).'>'.prepare4display($forum['forum_title']).$session_displayed.'</a>'.$forum_title_group_addition.'<br />'.prepare4display($forum['forum_comment']).'</td>';
//$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'] : '';
$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 .= '<div class="row">';
$html .= '<div class="col-md-6">';
$html .= '<div class="col-md-3">';
$html .= '<div class="number-post">'.$forum_image .'<p>' . $my_number_posts . ' ' . get_lang('Posts') . '</p></div>';
$html .= '</div>';
$html .= '<div class="col-md-9">';
$iconForum = Display::return_icon(
'forum_yellow.png',
get_lang($forumCategory['cat_title']),
null,
ICON_SIZE_MEDIUM
);
$linkForum = '';
$linkForum .= Display::tag(
'a',
$forum['forum_title'].$session_displayed,
array(
'href' => 'viewforum.php?'.api_get_cidreq().'&amp;gidReq='.$forum['forum_of_group'].'&amp;forum='.$forum['forum_id'].'&amp;origin='.$origin.'&amp;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 .= '</div>';
$html .= '</div>';
$html .= '<div class="col-md-6">';
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
$iconEmpty='';
$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 .= '<div class="row">';
$html .= '<div class="col-md-2">';
$html .= Display::return_icon(
'post-forum.png',
null,
null,
ICON_SIZE_SMALL
);
$html .= ' ' . $my_number_threads . '<br>'.$newPost.'</div>';
$my_number_posts = isset($forum['number_of_posts']) ? $forum['number_of_posts'] : '';
echo '<td>'.$my_number_threads.'</td>';
echo '<td>'.$my_number_posts.'</td>';
// the last post in the forum
if ($forum['last_poster_name'] != '') {
$name = $forum['last_poster_name'];
@ -293,38 +425,54 @@ if ($action_forums != 'add') {
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id = $forum['last_poster_id'];
}
echo '<td>';
$html .= '<div class="col-md-6">';
if (!empty($forum['last_post_id'])) {
echo $forum['last_post_date'].' '.get_lang('By').' '.display_user_link($poster_id, $name);
$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);
}
echo '</td>';
echo '<td class="td_actions">';
$html .= '</div>';
$html .= '<div class="col-md-4">';
if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval(isset($_SESSION['id_session']) ? $_SESSION['id_session'] : null) != 0)) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=edit&amp;content=forum&amp;id='.$forum['forum_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=delete&amp;content=forum&amp;id='.$forum['forum_id']."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
display_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility'], array('forumcategory' => $_GET['forumcategory']));
display_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked'], array('forumcategory' => $_GET['forumcategory']));
display_up_down_icon('forum', $forum['forum_id'], $forums_in_category);
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=edit&amp;content=forum&amp;id='.$forum['forum_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=delete&amp;content=forum&amp;id='.$forum['forum_id']."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
$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 = 'send_mail.gif';
$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 = 'send_mail_checked.gif';
$iconnotify = 'notification_mail.png';
}
}
if (!api_is_anonymous()) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=notify&amp;content=forum&amp;id='.$forum['forum_id'].'">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).'</a>';
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;forumcategory='.Security::remove_XSS($_GET['forumcategory']).'&amp;action=notify&amp;content=forum&amp;id='.$forum['forum_id'].'">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).'</a>';
}
echo '</td></tr>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div></div>';
}
echo $html;
}
}
if (count($forum_list) == 0) {
echo '<tr><td>'.get_lang('NoForumInThisCategory').'</td></tr>';
echo '<div class="alert alert-warning">'.get_lang('NoForumInThisCategory').'</div>';
}
echo '</table>';
echo '</div>';
}
/* FOOTER */

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Loading…
Cancel
Save