{"id":586,"date":"2025-03-14T23:58:05","date_gmt":"2025-03-14T23:58:05","guid":{"rendered":"https:\/\/abrilpopular.ese.ipp.pt\/?page_id=586"},"modified":"2025-12-19T16:01:10","modified_gmt":"2025-12-19T16:01:10","slug":"upp-documentos","status":"publish","type":"page","link":"https:\/\/abrilpopular.ese.ipp.pt\/?page_id=586","title":{"rendered":"Arquivo"},"content":{"rendered":"\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-2498d185 wp-block-group-is-layout-flex\"><div class=\"wp-block-site-logo\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/\" class=\"custom-logo-link\" rel=\"home\"><img loading=\"lazy\" decoding=\"async\" width=\"36\" height=\"36\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores.png\" class=\"custom-logo\" alt=\"Associa\u00e7\u00f5es Populares de Abril no Porto\" srcset=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores.png 512w, https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores-300x300.png 300w, https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores-150x150.png 150w, https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores-270x270.png 270w, https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores-192x192.png 192w, https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores-180x180.png 180w, https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/02\/cropped-Abril_cores-32x32.png 32w\" sizes=\"auto, (max-width: 36px) 100vw, 36px\" \/><\/a><\/div>\n\n\n<h2 class=\"wp-block-heading has-x-large-font-size\"><strong>Universidade Popular do Porto<\/strong><\/h2>\n<\/div>\n\n\n\n    <div class=\"organization-archive\" data-org=\"universidade-popular-do-porto\">\n\n        <!-- Filter Controls Container -->\n        <div class=\"archive-filters\" style=\"margin-bottom: 2rem;\">\n\n            <div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\" style=\"gap: 8px; margin-bottom: 1rem;\">\n\n                <!-- Category Filter Buttons -->\n                <div class=\"wp-block-button\" style=\"margin: 0;\">\n                    <a class=\"wp-block-button__link wp-element-button filter-btn active\" data-category=\"all\" style=\"cursor: pointer; padding: 6px 12px; font-size: 14px; line-height: 1.2;\">Todos<\/a>\n                <\/div>\n                <div class=\"wp-block-button\" style=\"margin: 0;\"><a class=\"wp-block-button__link wp-element-button filter-btn\" data-category=\"boletim-upp\" style=\"cursor: pointer; padding: 6px 12px; font-size: 14px; line-height: 1.2;\">Boletim Informativo<\/a><\/div><div class=\"wp-block-button\" style=\"margin: 0;\"><a class=\"wp-block-button__link wp-element-button filter-btn\" data-category=\"cdc-upp\" style=\"cursor: pointer; padding: 6px 12px; font-size: 14px; line-height: 1.2;\">Confer\u00eancias, debates e conv\u00edvios<\/a><\/div><div class=\"wp-block-button\" style=\"margin: 0;\"><a class=\"wp-block-button__link wp-element-button filter-btn\" data-category=\"cursos-upp\" style=\"cursor: pointer; padding: 6px 12px; font-size: 14px; line-height: 1.2;\">Cursos<\/a><\/div>                \n                <!-- Year Filter Dropdown - FIXED -->\n                <div class=\"wp-block-button\" style=\"margin: 0; position: relative;\">\n                    <button class=\"wp-block-button__link wp-element-button year-filter-btn\" style=\"cursor: pointer; padding: 6px 32px 6px 12px; font-size: 14px; line-height: 1.2; position: relative;\">\n                        <span class=\"year-filter-text\">\ud83d\udcc5 Todos os anos<\/span>\n                        <span style=\"position: absolute; right: 10px; top: 50%; transform: translateY(-50%);\">\u25bc<\/span>\n                    <\/button>\n                    <select id=\"year-filter\" style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2;\">\n                        <option value=\"all\">\ud83d\udcc5 Todos os anos<\/option>\n                    <\/select>\n                <\/div>\n\n            <\/div>\n\n        <\/div>\n\n        <!-- Results Area -->\n        <div class=\"archive-results\">\n            <ul class=\"wp-block-latest-posts has-dates wp-block-latest-posts__list wp-block-latest-posts__list is-grid columns-3\"><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1096\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2023.-Convivio-de-verao_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1096\">Conv\u00edvio de ver\u00e3o no Jardim da UPP<\/a><time datetime=\"2023-07-08T16:58:51+00:00\" class=\"wp-block-latest-posts__post-date\">8 de Julho, 2023<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1329\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/12\/2023-24-Cursos_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1329\">Cursos<\/a><time datetime=\"2023-05-01T10:25:56+00:00\" class=\"wp-block-latest-posts__post-date\">1 de Maio, 2023<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1093\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2022.-Homenagem-Jose-Saramago_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1093\">Homenagem Jos\u00e9 Saramago<\/a><time datetime=\"2022-11-14T16:58:04+00:00\" class=\"wp-block-latest-posts__post-date\">14 de Novembro, 2022<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1265\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/12\/boletim-informativo-novembro-2002_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1265\">Boletim informativo<\/a><time datetime=\"2022-11-01T14:49:24+00:00\" class=\"wp-block-latest-posts__post-date\">1 de Novembro, 2022<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1090\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2022.-Conferencia-A-corrida-aos-armamentos_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1090\">Confer\u00eancia &#8220;A corrida aos armamentos&#8221;<\/a><time datetime=\"2022-02-24T16:57:07+00:00\" class=\"wp-block-latest-posts__post-date\">24 de Fevereiro, 2022<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1087\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2021.-reuniao-de-alunos_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1087\">Reuni\u00e3o de alunos<\/a><time datetime=\"2021-11-10T16:55:10+00:00\" class=\"wp-block-latest-posts__post-date\">10 de Novembro, 2021<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1084\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2018.-visita-de-estudo_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1084\">Visita de estudo<\/a><time datetime=\"2018-01-27T16:54:20+00:00\" class=\"wp-block-latest-posts__post-date\">27 de Janeiro, 2018<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1081\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2017.-Sessao-evocativa-oscar-Lopes_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1081\">Sess\u00e3o evocativa \u00d3scar Lopes<\/a><time datetime=\"2017-12-14T16:53:34+00:00\" class=\"wp-block-latest-posts__post-date\">14 de Dezembro, 2017<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1075\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2017.-Conferrencia-O-sec.-sovietico_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1075\">Confer\u00eancia &#8220;O s\u00e9culo sovi\u00e9tico&#8221;<\/a><time datetime=\"2017-11-25T16:51:22+00:00\" class=\"wp-block-latest-posts__post-date\">25 de Novembro, 2017<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1078\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2017.-debate-cidadania-cultura-e-envelhecimento_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1078\">Debate &#8220;Cidadania, cultura e envelhecimento&#8221;<\/a><time datetime=\"2017-01-24T16:52:31+00:00\" class=\"wp-block-latest-posts__post-date\">24 de Janeiro, 2017<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1072\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2016.-teatro_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1072\">Teatro &#8220;42 anos depois, e o qu\u00ea?&#8221;<\/a><time datetime=\"2016-06-17T16:50:34+00:00\" class=\"wp-block-latest-posts__post-date\">17 de Junho, 2016<\/time><\/li><li><div class=\"wp-block-latest-posts__featured-image aligncenter\"><a href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1069\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/abrilpopular.ese.ipp.pt\/wp-content\/uploads\/2025\/11\/2015.-Exposicao-curso-de-Desenho-e-Pintura_ma-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail wp-post-image wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\" \/><\/a><\/div><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?p=1069\">Exposi\u00e7\u00e3o coletiva do curso de Desenho e Pintura<\/a><time datetime=\"2015-07-01T16:49:30+00:00\" class=\"wp-block-latest-posts__post-date\">1 de Julho, 2015<\/time><\/li><\/ul><div class=\"archive-pagination\"><span class=\"wp-block-button__link wp-element-button active-page\">1<\/span><a href=\"\/index.php?rest_route=%2Fwp%2Fv2%2Fpages%2F586&page=2\" class=\"wp-block-button__link wp-element-button is-style-outline\">2<\/a><a href=\"\/index.php?rest_route=%2Fwp%2Fv2%2Fpages%2F586&page=3\" class=\"wp-block-button__link wp-element-button is-style-outline\">3<\/a><a href=\"\/index.php?rest_route=%2Fwp%2Fv2%2Fpages%2F586&page=2\" class=\"wp-block-button__link wp-element-button\">Pr\u00f3xima \u2192<\/a><\/div>        <\/div>\n    <\/div>\n\n    <style>\n        .archive-pagination {\n            text-align: center;\n            margin-top: 2rem;\n            padding: 1rem;\n        }\n\n        .archive-pagination .wp-block-button__link {\n            margin: 0 4px;\n            padding: 6px 12px;\n            text-decoration: none;\n        }\n\n        \/* Not selected buttons - black background with white text *\/\n        .filter-btn,\n        .pagination-btn.wp-block-button__link {\n            background-color: black !important;\n            color: white !important;\n            border: 2px solid black !important;\n        }\n\n        \/* Selected buttons - white background, accent border, black text *\/\n        .filter-btn.active,\n        .archive-pagination .wp-block-button__link.active-page {\n            background-color: white !important;\n            color: black !important;\n            border: 2px solid var(--wp--preset--color--contrast) !important;\n        }\n\n        \/* Outline style for inactive filter buttons *\/\n        .filter-btn.is-style-outline {\n            background-color: black !important;\n            color: white !important;\n            border: 2px solid black !important;\n        }\n\n        \/* Remove the default outline styling since we're handling it manually *\/\n        .is-style-outline {\n            background-color: black !important;\n            color: white !important;\n            border: 2px solid black !important;\n        }\n\n        \/* Try to improve select dropdown styling *\/\n        #year-filter option {\n            font-family: inherit;\n            font-size: 14px;\n            padding: 8px;\n            background-color: white;\n            color: black;\n        }\n\n        \/* For browsers that support styling select dropdowns *\/\n        #year-filter::-ms-expand {\n            display: none;\n        }\n\n        #year-filter {\n            font-family: inherit;\n        }\n\n        .year-filter-btn {\n            background-color: black !important;\n            color: white !important;\n            border: 2px solid black !important;\n            border-radius: 9999px !important;\n        }\n        \/* Year filter button active state *\/\n        .year-filter-btn.active {\n            background-color: white !important;\n            color: black !important;\n            border: 2px solid var(--wp--preset--color--contrast) !important;\n        }\n\n        \/* Arrow color for active state *\/\n        .year-filter-btn.active span {\n            color: black !important;\n        }\n    <\/style>\n\n    <script>    jQuery(document).ready(function($) {\n    \/\/ Category mapping\n    var categoryMap = {};\n    categoryMap['universidade-popular-do-porto'] = 9;\ncategoryMap['associacao-de-moradores-da-lomba'] = 10;\ncategoryMap['associacao-nacional-dos-deficientes-sinistrados-no-trabalho'] = 11;\ncategoryMap['cursos-upp'] = 13;\ncategoryMap['cdc-upp'] = 14;\ncategoryMap['boletim-upp'] = 15;\ncategoryMap['jornal-amlomba'] = 16;\ncategoryMap['fotos-amlomba'] = 17;\ncategoryMap['com-amlomba'] = 18;\ncategoryMap['recortes-amlomba'] = 19;\ncategoryMap['cartazes-amlomba'] = 20;\ncategoryMap['atas-andst'] = 21;\ncategoryMap['recortes-andst'] = 22;\ncategoryMap['org-andst'] = 23;\ncategoryMap['legis-andst'] = 27;\ncategoryMap['com-andst'] = 25;\ncategoryMap['accao-andst'] = 26;\n\n    \/\/ Current state tracking\n    var currentPage = 1;\n    var currentCategory = 'all';\n    var currentYear = 'all';\n    var currentOrg = $('.organization-archive').data('org');\n\n    \/\/ Organization subcategories\n    var orgSubcategories = {};\n    orgSubcategories['universidade-popular-do-porto'] = [15,14,13];\norgSubcategories['associacao-de-moradores-da-lomba'] = [20,18,17,16,19];\norgSubcategories['associacao-nacional-dos-deficientes-sinistrados-no-trabalho'] = [26,21,23,25,27,22];\n\n    \/\/ Get available years for current category\n    function getAvailableYears(category) {\n        var restUrl = 'https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/posts';\n        var params = {\n            per_page: 100, \/\/ Get enough posts to find years\n            _fields: 'date'\n        };\n\n        if (category !== 'all') {\n            var categoryId = categoryMap[category];\n            if (categoryId) {\n                params.categories = categoryId;\n            }\n        } else {\n            var subcategoryIds = orgSubcategories[currentOrg] || [];\n            if (subcategoryIds.length > 0) {\n                params.categories = subcategoryIds.join(',');\n            }\n        }\n\n        return $.get(restUrl, params).then(function(posts) {\n            var years = new Set();\n            var has1970 = false; \/\/ Track if there are posts from 1970\n            \n            if (posts && posts.length > 0) {\n                posts.forEach(function(post) {\n                    var year = new Date(post.date).getFullYear();\n                    if (year === 1970) {\n                        has1970 = true;\n                    } else if (year > 1970) {\n                        years.add(year);\n                    }\n                });\n            }\n            \n            \/\/ Convert to array and sort\n            var sortedYears = Array.from(years).sort(function(a, b) { \n                return b - a; \n            });\n            \n            return {\n                years: sortedYears,\n                has1970: has1970\n            };\n        });\n    }\n\n    \/\/ Update year filter button text\n    function updateYearButtonText(year) {\n        var displayText = year === 'all' ? '\ud83d\udcc5 Todos os anos' : (year === '1970' ? 'sem data' : year);\n        $('.year-filter-text').text(displayText);\n        \n        \/\/ Update active state\n        if (year === 'all') {\n            $('.year-filter-btn').removeClass('active');\n        } else {\n            $('.year-filter-btn').addClass('active');\n        }\n    }\n\n    \/\/ Update year dropdown\n    function updateYearDropdown(data) {\n        var $yearFilter = $('#year-filter');\n        var currentValue = $yearFilter.val();\n        var years = data.years || [];\n        var has1970 = data.has1970 || false;\n\n        $yearFilter.empty().append('<option value=\"all\">\ud83d\udcc5 Todos os anos<\/option>');\n\n        if (years && years.length > 0) {\n            years.forEach(function(year) {\n                $yearFilter.append('<option value=\"' + year + '\">' + year + '<\/option>');\n            });\n        }\n        \n        \/\/ Add \"sem data\" option if there are posts from 1970\n        if (has1970) {\n            $yearFilter.append('<option value=\"1970\">sem data<\/option>');\n        }\n\n        if (currentValue !== 'all' && \n            (years.includes(parseInt(currentValue)) || currentValue === '1970')) {\n            $yearFilter.val(currentValue);\n            \/\/ Update button text\n            updateYearButtonText(currentValue);\n        } else {\n            $yearFilter.val('all');\n            currentYear = 'all';\n            updateYearButtonText('all');\n        }\n    }\n\n    \/\/ Filter function\n    function filterPosts(category, year, page) {\n        if (typeof year === 'undefined') year = 'all';\n        if (typeof page === 'undefined') page = 1;\n\n        currentPage = page;\n        currentCategory = category;\n        currentYear = year;\n\n        \/\/ Update button text\n        updateYearButtonText(year);\n\n        $('.filter-btn').removeClass('active').addClass('is-style-outline');\n        $('.filter-btn[data-category=\"' + category + '\"]').addClass('active').removeClass('is-style-outline');\n\n        $('.archive-results').html('<p style=\"text-align: center; padding: 2rem;\">A carregar documentos...<\/p>');\n\n        var restUrl = 'https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/posts';\n        var params = {\n            per_page: 12,\n            page: page,\n            orderby: 'date',\n            order: 'desc',\n            _embed: true\n        };\n\n        if (category !== 'all') {\n            var categoryId = categoryMap[category];\n            if (categoryId) {\n                params.categories = categoryId;\n            }\n        } else {\n            var subcategoryIds = orgSubcategories[currentOrg] || [];\n            if (subcategoryIds.length > 0) {\n                params.categories = subcategoryIds.join(',');\n            }\n        }\n\n        if (year !== 'all') {\n            params.after = year + '-01-01T00:00:00';\n            params.before = (parseInt(year) + 1) + '-01-01T00:00:00';\n        }\n\n        $.ajax({\n            url: restUrl,\n            type: 'GET',\n            data: params,\n            success: function(posts, status, xhr) {\n                var totalPages = parseInt(xhr.getResponseHeader('X-WP-TotalPages')) || 1;\n                displayPosts(posts, totalPages, page);\n            },\n            error: function() {\n                $('.archive-results').html('<p style=\"text-align: center; padding: 2rem;\">Erro ao carregar documentos.<\/p>');\n            }\n        });\n    }\n\n    \/\/ Format date - show \"sem data\" for year 1970\n    function formatPostDate(dateString) {\n        var date = new Date(dateString);\n        var year = date.getFullYear();\n        \n        if (year === 1970) {\n            return 'sem data';\n        }\n\n        return date.toLocaleDateString('pt-PT', {\n            day: 'numeric',\n            month: 'long',\n            year: 'numeric'\n        });\n    }\n\n    \/\/ Display posts with pagination\n    function displayPosts(posts, totalPages, currentPage) {\n        if (posts) {\n            if (posts.length > 0) {\n                var html = '<ul class=\"wp-block-latest-posts has-dates wp-block-latest-posts__list wp-block-latest-posts__list is-grid columns-3\">';\n\n                posts.forEach(function(post) {\n                    html += '<li>';\n\n                    if (post.featured_media && post._embedded && post._embedded['wp:featuredmedia']) {\n                        var featuredImage = post._embedded['wp:featuredmedia'][0];\n                        html += '<div class=\"wp-block-latest-posts__featured-image aligncenter\">';\n                        html += '<a href=\"' + post.link + '\">';\n                        html += '<img decoding=\"async\" src=\"' + featuredImage.source_url + '\" class=\"attachment-thumbnail size-thumbnail wp-post-image\" alt=\"\" style=\"max-width: 150px; max-height: 150px;\">';\n                        html += '<\/a><\/div>';\n                    }\n\n                    html += '<a class=\"wp-block-latest-posts__post-title\" href=\"' + post.link + '\">' + post.title.rendered + '<\/a>';\n\n                    var formattedDate = formatPostDate(post.date);\n                    html += '<time datetime=\"' + post.date + '\" class=\"wp-block-latest-posts__post-date\">' + formattedDate + '<\/time>';\n\n                    html += '<\/li>';\n                });\n\n                html += '<\/ul>';\n\n                if (totalPages > 1) {\n                    html += generatePagination(totalPages, currentPage);\n                }\n\n                $('.archive-results').html(html);\n                attachPaginationHandlers();\n\n            } else {\n                $('.archive-results').html('<p style=\"text-align: center; padding: 2rem;\">Nenhum documento encontrado nesta categoria.<\/p>');\n            }\n        } else {\n            $('.archive-results').html('<p style=\"text-align: center; padding: 2rem;\">Nenhum documento encontrado nesta categoria.<\/p>');\n        }\n    }\n\n    \/\/ Generate pagination HTML\n    function generatePagination(totalPages, currentPage) {\n        var html = '<div class=\"archive-pagination\">';\n\n        if (currentPage > 1) {\n            html += '<a href=\"#\" class=\"pagination-btn wp-block-button__link wp-element-button\" data-page=\"' + (currentPage - 1) + '\">\u2190 Anterior<\/a>';\n        }\n\n        var startPage = Math.max(1, currentPage - 2);\n        var endPage = Math.min(totalPages, currentPage + 2);\n\n        for (var i = startPage; i <= endPage; i++) {\n            if (i === currentPage) {\n                html += '<span class=\"wp-block-button__link wp-element-button active-page\">' + i + '<\/span>';\n            } else {\n                html += '<a href=\"#\" class=\"pagination-btn wp-block-button__link wp-element-button is-style-outline\" data-page=\"' + i + '\">' + i + '<\/a>';\n            }\n        }\n\n        if (currentPage < totalPages) {\n            html += '<a href=\"#\" class=\"pagination-btn wp-block-button__link wp-element-button\" data-page=\"' + (currentPage + 1) + '\">Pr\u00f3xima \u2192<\/a>';\n        }\n\n        html += '<\/div>';\n        return html;\n    }\n\n    \/\/ Attach pagination handlers\n    function attachPaginationHandlers() {\n        $('.pagination-btn').on('click', function(e) {\n            e.preventDefault();\n            var page = $(this).data('page');\n            filterPosts(currentCategory, currentYear, page);\n\n            $('html, body').animate({\n                scrollTop: $('.archive-results').offset().top - 100\n            }, 300);\n        });\n    }\n\n    \/\/ Category filter click\n    $('.filter-btn').on('click', function(e) {\n        e.preventDefault();\n        var category = $(this).data('category');\n        \n        \/\/ Store the current year before updating\n        var previousYear = currentYear;\n\n        getAvailableYears(category).then(function(data) {\n            updateYearDropdown(data);\n            \n            \/\/ Check if the previous year is still valid for the new category\n            var yearToUse = 'all';\n            if (previousYear === '1970' && data.has1970) {\n                yearToUse = '1970';\n            } else if (previousYear !== 'all' && previousYear !== '1970') {\n                var yearNum = parseInt(previousYear);\n                if (data.years && data.years.includes(yearNum)) {\n                    yearToUse = previousYear;\n                }\n            }\n            \n            filterPosts(category, yearToUse, 1);\n        });\n    });\n\n    \/\/ Year filter change\n    $('#year-filter').on('change', function() {\n        var year = $(this).val();\n        updateYearButtonText(year);\n        filterPosts(currentCategory, year, 1);\n    });\n\n    $(document).on('click', '.archive-pagination a[href*=\"page\"]', function(e) {\n        e.preventDefault();\n        var href = $(this).attr('href');\n        var pageMatch = href.match(\/[?&]page=(\\d+)\/);\n        if (pageMatch) {\n            var page = parseInt(pageMatch[1]);\n            filterPosts(currentCategory, currentYear, page);\n        }\n    });\n\n    \/\/ Initialize available years for current organization\n    getAvailableYears('all').then(function(data) {\n        updateYearDropdown(data);\n    });\n});\n<\/script>\n\n    \n\n\n\n<div class=\"wp-block-buttons has-custom-font-size has-vollkorn-font-family has-medium-font-size is-content-justification-right is-nowrap is-layout-flex wp-container-core-buttons-is-layout-44fe7b19 wp-block-buttons-is-layout-flex\" style=\"border-style:none;border-width:0px;margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20);padding-top:var(--wp--preset--spacing--30);padding-right:0;padding-bottom:var(--wp--preset--spacing--30);padding-left:0\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-25\"><a class=\"wp-block-button__link has-vollkorn-font-family wp-element-button\" href=\"https:\/\/abrilpopular.ese.ipp.pt\/?page_id=36\" style=\"padding-top:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--20);padding-left:var(--wp--preset--spacing--30)\">Voltar<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Universidade Popular do Porto<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":36,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-586","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/pages\/586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=586"}],"version-history":[{"count":20,"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/pages\/586\/revisions"}],"predecessor-version":[{"id":1117,"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/pages\/586\/revisions\/1117"}],"up":[{"embeddable":true,"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=\/wp\/v2\/pages\/36"}],"wp:attachment":[{"href":"https:\/\/abrilpopular.ese.ipp.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}