{% macro forum_category_listing(forums, title, colour, id) %} {% 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) %}
{% 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 %}
{% endmacro %} {% macro forum_category_tools(info, perms, take, offset) %} {% from 'macros.twig' import pagination %} {% set can_topic = perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_TOPIC')) %} {% set pag = pagination( info.forum_topic_count, take, offset, url_construct('/forum/forum.php', {'f':info.forum_id}), false, null, 5 ) %} {% if can_topic or pag|trim|length > 0 %}
{% if can_topic %} New Topic {% endif %}
{{ pag }}
{% endif %} {% endmacro %} {% macro forum_topic_tools(info, take, offset, can_reply) %} {% from 'macros.twig' import pagination %} {% set pag = pagination( info.topic_post_count, take, offset, url_construct('/forum/topic.php', {'t':info.topic_id}), false, null, 5 ) %} {% if can_reply or pag|trim|length > 0 %}
{% if can_reply %} Reply {% endif %}
{{ pag }}
{% endif %} {% endmacro %} {% macro forum_category_entry(forum, forum_unread, forum_type) %} {% set forum_type = forum_type|default(null) %} {% set forum_unread = forum_unread|default(forum.forum_unread|default(false)) ? 'unread' : 'read' %} {% if forum_type is null %} {% if forum.forum_archived is defined and forum.forum_archived %} {% set forum_type = 'fas fa-archive' %} {% 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_type = 'fas fa-link' %} {% elseif forum.forum_type == constant('MSZ_FORUM_TYPE_CATEGORY') %} {% set forum_type = 'fas fa-folder' %} {% endif %} {% else %} {% set forum_type = 'fas fa-comments' %} {% 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.forum_type != constant('MSZ_FORUM_TYPE_CATEGORY') %}
{{ forum.forum_topic_count|number_format }}
{{ forum.forum_post_count|number_format }}
{% endif %} {% if forum.forum_type == constant('MSZ_FORUM_TYPE_DISCUSSION') 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) %} {% from _self import forum_topic_entry %} {% from 'macros.twig' import container_title %}
{{ container_title(' 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_type, topic_unread) %} {% set topic_type = topic_type|default(null) %} {% set topic_unread = topic_unread|default(topic.topic_unread|default(false)) ? 'unread' : 'read' %} {% if topic_type is null %} {% if topic.topic_deleted is defined and topic.topic_deleted is not null %} {% set topic_type = '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_type = 'fas fa-bullhorn' %} {% elseif topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') %} {% set topic_type = 'fas fa-thumbtack' %} {% endif %} {% elseif topic.topic_locked is defined and topic.topic_locked is not null %} {% set topic_type = 'fas fa-lock' %} {% else %} {% set topic_type = 'fas fa-comment' %} {% endif %} {% endif %}
{{ topic.topic_title }}
{% if topic.author_id is not null %} by {{ topic.author_name }}, {% endif %}
{{ topic.topic_post_count|number_format }}
{{ topic.topic_view_count|number_format }}
{% if topic.respondent_id is not null %} {{ topic.respondent_name }} {% endif %}
{% if topic.respondent_id is not null %} {% endif %}
{% endmacro %} {% macro forum_post_listing(posts, user_id, perms) %} {% from _self import forum_post_entry %} {% for post in posts %} {{ forum_post_entry( post, perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_POST')), perms|perms_check(constant(user_id == post.poster_id ? 'MSZ_FORUM_PERM_EDIT_POST' : 'MSZ_FORUM_PERM_EDIT_ANY_POST')), perms|perms_check(constant(user_id == post.poster_id ? 'MSZ_FORUM_PERM_DELETE_POST' : 'MSZ_FORUM_PERM_DELETE_ANY_POST')) ) }} {% endfor %} {% endmacro %} {% macro forum_post_entry(post, can_post, can_edit, can_delete) %} {% set is_deleted = post.post_deleted is not null %}
#{{ 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 %}
{% endmacro %}