{% macro forum_category_listing(forums, title, colour, id, icon) %} {% from _self import forum_category_entry %} {% from 'macros.twig' import container_title %}
0 %}id="{{ id }}"{% endif %}> {{ container_title(' ' ~ title) }} {% if forums|length > 0 %}
{% for forum in forums %} {{ forum_category_entry(forum) }} {% endfor %}
{% else %}
This category is empty.
{% endif %}
{% endmacro %} {% macro forum_header(title, breadcrumbs, omit_last_breadcrumb, title_url, actions) %}
{% if breadcrumbs is iterable and breadcrumbs|length > 0 %}
{% for name, url in breadcrumbs %} {% if url != breadcrumbs|first %}
{% endif %} {% if not (omit_last_breadcrumb|default(false) and url == breadcrumbs|last) %} {{ name }} {% endif %} {% endfor %}
{% endif %} {% if title|length > 0 %} {% if title_url|length > 0 %} {{ title }} {% else %}
{{ title }}
{% endif %} {% endif %} {% if actions is iterable and actions|length > 0 %}
{% for action in actions %} {% if action.display is not defined or action.display %} {{ action.html|raw }} {% endif %} {% endfor %}
{% endif %}
{% endmacro %} {% macro forum_category_tools(info, perms, pagination_info) %} {% from 'macros.twig' import pagination %} {% set is_locked = info.forum_archived != 0 %} {% set can_topic = not is_locked and perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_TOPIC')) %} {% set pag = pagination(pagination_info, url('forum-category'), null, {'f': info.forum_id}) %} {% if can_topic or pag|trim|length > 0 %}
{% if can_topic %} New Topic {% endif %}
{{ pag }}
{% endif %} {% endmacro %} {% macro forum_topic_tools(info, pagination_info, can_reply) %} {% from 'macros.twig' import pagination %} {% set pag = pagination(pagination_info, url('forum-topic'), null, {'t': info.topic_id}, 'page') %} {% if can_reply or pag|trim|length > 0 %}
{% if can_reply %} Reply {% endif %}
{{ pag }}
{% endif %} {% endmacro %} {% macro forum_category_entry(forum, forum_unread, forum_icon) %} {% from 'macros.twig' import avatar %} {% set forum_unread = forum_unread|default(forum.forum_unread|default(false)) ? 'unread' : 'read' %} {% if forum_icon is empty %} {% if forum.forum_icon is defined and forum.forum_icon is not empty %} {% set forum_icon = forum.forum_icon %} {% elseif forum.forum_archived is defined and forum.forum_archived %} {% set forum_icon = 'fas fa-archive fa-fw' %} {% elseif forum.forum_type is defined and forum.forum_type != constant('MSZ_FORUM_TYPE_DISCUSSION') %} {% if forum.forum_type == constant('MSZ_FORUM_TYPE_LINK') %} {% set forum_icon = 'fas fa-link fa-fw' %} {% elseif forum.forum_type == constant('MSZ_FORUM_TYPE_CATEGORY') %} {% set forum_icon = 'fas fa-folder fa-fw' %} {% endif %} {% else %} {% set forum_icon = 'fas fa-comments fa-fw' %} {% endif %} {% endif %}
{{ forum.forum_name }}
{{ forum.forum_description|nl2br }}
{% if forum.forum_subforums is defined and forum.forum_subforums|length > 0 %}
{% for subforum in forum.forum_subforums %} {{ subforum.forum_name }} {% endfor %}
{% endif %}
{% if forum.forum_type == constant('MSZ_FORUM_TYPE_LINK') %} {% if forum.forum_link_clicks is not null %}
{{ forum.forum_link_clicks|number_format }}
{% endif %} {% elseif forum_may_have_children(forum.forum_type) %}
{{ forum.forum_count_topics|number_format }}
{{ forum.forum_count_posts|number_format }}
{% endif %} {% if forum_may_have_topics(forum.forum_type) or forum.forum_link_clicks is not null %} {% endif %}
{% endmacro %} {% macro forum_topic_locked(locked, archived) %} {% if locked is not null or archived %}
{% if archived %} This topic has been archived. {% else %} This topic was locked . {% endif %}
{% endif %} {% endmacro %} {% macro forum_topic_listing(topics, title) %} {% from _self import forum_topic_entry %} {% from 'macros.twig' import container_title %}
{{ container_title(' ' ~ title|default('Topics')) }}
{% if topics|length > 0 %} {% for topic in topics %} {{ forum_topic_entry(topic) }} {% endfor %} {% else %}
There are no topics in this forum.
{% endif %}
{% endmacro %} {% macro forum_topic_entry(topic, topic_icon, topic_unread) %} {% from 'macros.twig' import avatar %} {% set topic_unread = topic_unread|default(topic.topic_unread|default(false)) %} {% set topic_important = topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') or topic.topic_type == constant('MSZ_TOPIC_TYPE_ANNOUNCEMENT') or topic.topic_type == constant('MSZ_TOPIC_TYPE_GLOBAL_ANNOUNCEMENT') %} {% if topic_icon is null %} {% if topic.topic_deleted is defined and topic.topic_deleted is not null %} {% set topic_icon = 'fas fa-trash-alt' %} {% elseif topic.topic_type is defined and topic.topic_type != constant('MSZ_TOPIC_TYPE_DISCUSSION') %} {% if topic.topic_type == constant('MSZ_TOPIC_TYPE_ANNOUNCEMENT') or topic.topic_type == constant('MSZ_TOPIC_TYPE_GLOBAL_ANNOUNCEMENT') %} {% set topic_icon = 'fas fa-bullhorn' %} {% elseif topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') %} {% set topic_icon = 'fas fa-thumbtack' %} {% endif %} {% elseif topic.topic_locked is defined and topic.topic_locked is not null %} {% set topic_icon = 'fas fa-lock' %} {% else %} {% set topic_icon = (topic_unread ? 'fas' : 'far') ~ ' fa-comment' %} {% endif %} {% endif %}
{% if topic.topic_participated %}
{% endif %}
{{ topic.topic_title }}
{% if topic.author_id is not null %} by {{ topic.author_name }}, {% endif %}
{% if topic.topic_pages|default(0) > 1 %}
{% for i in 1..topic.topic_pages|clamp(0, 3) %} {{ i }} {% endfor %} {% if topic.topic_pages > 3 %} {% if topic.topic_pages > 6 %}
{% endif %} {% for i in (topic.topic_pages - 2)|clamp(4, topic.topic_pages)..topic.topic_pages %} {{ i }} {% endfor %} {% endif %}
{% endif %}
{{ topic.topic_count_posts|number_format }}
{{ topic.topic_count_views|number_format }}
{% if topic.respondent_id is not null %} {{ topic.respondent_name }} {% endif %}
{% if topic.respondent_id is not null %} {{ avatar(topic.respondent_id, 30, topic.respondent_name) }} {% endif %}
{% endmacro %} {% macro forum_post_listing(posts, user_id, perms) %} {% from _self import forum_post_entry %} {% for post in posts %} {{ forum_post_entry(post, user_id, perms) }} {% endfor %} {% endmacro %} {% macro forum_post_entry(post, user_id, perms) %} {% from 'macros.twig' import avatar %} {% set is_deleted = post.post_deleted is not null %} {% set can_post = perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_POST')) %} {% set can_edit = perms|perms_check(constant('MSZ_FORUM_PERM_EDIT_ANY_POST')) or ( user_id == post.poster_id and perms|perms_check(constant('MSZ_FORUM_PERM_EDIT_POST')) ) %} {% set can_delete = not post.is_opening_post and ( perms|perms_check(constant('MSZ_FORUM_PERM_DELETE_ANY_POST')) or ( user_id == post.poster_id and perms|perms_check(constant('MSZ_FORUM_PERM_DELETE_POST')) and post.post_created|date('U') > ''|date('U') - constant('MSZ_FORUM_POST_DELETE_LIMIT') ) ) %}
{% set post_link = url(post.is_opening_post ? 'forum-topic' : 'forum-post', {'topic': post.topic_id, 'post': post.post_id, 'post_fragment': 'p%d'|format(post.post_id)}) %}
#{{ post.post_id }}
{{ post.post_text|escape|parse_text(post.post_parse)|raw }}
{% if can_post or can_edit or can_delete %}
{% if is_deleted %} Restore Permanently Delete {% else %} {# if can_post %} Quote {% endif #} {% if can_edit %} Edit {% endif %} {% if can_delete %} Delete {% endif %} {% endif %}
{% endif %} {% if post.post_display_signature and post.poster_signature_content|length > 0 %}
{{ post.poster_signature_content|escape|parse_text(post.poster_signature_parser)|raw }}
{% endif %}
{% endmacro %}