{"id":705,"date":"2026-02-05T22:29:37","date_gmt":"2026-02-05T20:29:37","guid":{"rendered":"https:\/\/blogs.sun.ac.za\/mod\/?page_id=705"},"modified":"2026-03-16T08:50:57","modified_gmt":"2026-03-16T06:50:57","slug":"students","status":"publish","type":"page","link":"https:\/\/blogs.sun.ac.za\/mod\/students\/","title":{"rendered":"Students"},"content":{"rendered":"<div id=\"student-archive-container\">Loading Archive&#8230;<\/div>\n<p><script>\r\ndocument.addEventListener(\"DOMContentLoaded\", function() {\r\n    const containerId = 'student-archive-container';\r\n    const apiUrl = 'https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/research_student?per_page=100&_embed';\r\n\r\n    fetch(apiUrl)\r\n        .then(response => response.json())\r\n        .then(posts => {\r\n            const container = document.getElementById(containerId);\r\n            container.style.cssText = `display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px;`;\r\n\r\n            \/\/ 1. RANDOMIZE AND SORT WITH RULES\r\n            posts.sort((a, b) => {\r\n                const statusA = (a.acf?.student_status || 'Current').toLowerCase();\r\n                const statusB = (b.acf?.student_status || 'Current').toLowerCase();\r\n                const isAlumniA = statusA.includes('alumni');\r\n                const isAlumniB = statusB.includes('alumni');\r\n\r\n                \/\/ Rule 1: Current students always before Alumni\r\n                if (isAlumniA !== isAlumniB) {\r\n                    return isAlumniA ? 1 : -1;\r\n                }\r\n\r\n                const degreeA = (a.acf?.student_degree || 'Masters').toLowerCase();\r\n                const degreeB = (b.acf?.student_degree || 'Masters').toLowerCase();\r\n                const isPhdA = degreeA.includes('phd');\r\n                const isPhdB = degreeB.includes('phd');\r\n\r\n                \/\/ Rule 2: PhDs before Masters\r\n                if (isPhdA !== isPhdB) {\r\n                    return isPhdA ? -1 : 1;\r\n                }\r\n\r\n                \/\/ Rule 3: Randomize within the same category\r\n                return Math.random() - 0.5;\r\n            });\r\n\r\n            let html = '';\r\n            posts.forEach(post => {\r\n                const name = post.title.rendered;\r\n                const degree = post.acf?.student_degree || 'Masters'; \r\n                const summary = post.acf?.layman_summary || 'No summary available.';\r\n                const thesisTitle = post.acf?.thesis_title || 'Untitled Thesis';\r\n                const thesisLink = post.acf?.thesis_link || '';\r\n                \r\n                \/\/ Status Field\r\n                const status = post.acf?.student_status || 'Current';\r\n\r\n                \/\/ --- ARTICLE LIST LOGIC ---\r\n                const rawArticles = post.acf?.article_links || '';\r\n                const articlesArray = rawArticles.split('\\n').filter(link => link.trim() !== '');\r\n                \r\n                let articlesHtml = '';\r\n                if (articlesArray.length > 0) {\r\n                    articlesHtml = '<div style=\"margin-top:10px;\"><strong>Related Articles:<\/strong><ul style=\"padding-left:18px; margin:5px 0; font-size:0.85rem;\">';\r\n                    articlesArray.forEach((link, index) => {\r\n                        articlesHtml += `<li style=\"margin-bottom:3px;\"><a href=\"${link.trim()}\" target=\"_blank\" style=\"color:#3182ce; text-decoration:none;\">View Publication ${index + 1}<\/a><\/li>`;\r\n                    });\r\n                    articlesHtml += '<\/ul><\/div>';\r\n                }\r\n\r\n                \/\/ --- COLOR LOGIC ---\r\n                \/\/ 1. Degree Colors\r\n                const isPhD = degree.toLowerCase().includes('phd');\r\n                const degreeColor = isPhD ? '#805ad5' : '#3182ce'; \/\/ Purple for PhD, Blue for Masters\r\n                \r\n                \/\/ 2. Status Colors\r\n                const isAlumni = status.toLowerCase().includes('alumni');\r\n                const statusColor = isAlumni ? '#718096' : '#d4af37'; \/\/ Grey for Alumni, Green for Current\r\n\r\n                html += `\r\n                <div class=\"student-card\" style=\"background:#fff; border:1px solid #e2e8f0; border-radius:8px; min-height:280px; cursor:pointer; position:relative; box-shadow:0 4px 6px rgba(0,0,0,0.05); overflow:hidden; transition: transform 0.2s;\"\r\n                     onmouseover=\"this.style.transform='translateY(-5px)'\" \r\n                     onmouseout=\"this.style.transform='translateY(0)'\"\r\n                     onclick=\"const f=this.querySelector('.front'); const b=this.querySelector('.back'); if(f.style.display!=='none'){f.style.display='none';b.style.display='block';}else{f.style.display='block';b.style.display='none';}\">\r\n                    \r\n                    <div class=\"front\" style=\"padding:25px; display:flex; flex-direction:column; height:100%;\">\r\n                        \r\n                        <div style=\"margin-bottom:15px;\">\r\n                            <span style=\"background:${degreeColor}; color:white; padding:3px 10px; border-radius:12px; font-size:0.7rem; font-weight:bold; text-transform:uppercase; margin-right: 5px;\">${degree}<\/span>\r\n                            <span style=\"background:${statusColor}; color:white; padding:3px 10px; border-radius:12px; font-size:0.7rem; font-weight:bold; text-transform:uppercase;\">${status}<\/span>\r\n                        <\/div>\r\n\r\n                        <h3 style=\"margin-top:0; margin-bottom:10px; font-size:1.25rem; color:#2d3748;\">${name}<\/h3>\r\n                        <p style=\"font-size:0.95rem; color:#718096; font-style:italic; line-height:1.4;\">${thesisTitle}<\/p>\r\n                        <p style=\"margin-top:auto; font-size:0.75rem; color:#cbd5e0; text-align:center; text-transform:uppercase; letter-spacing:1px;\">Click for Summary & Papers<\/p>\r\n                    <\/div>\r\n\r\n                    <div class=\"back\" style=\"display:none; padding:25px; background:#f7fafc; height:100%; overflow-y:auto;\">\r\n                        <strong style=\"font-size:0.75rem; color:#a0aec0; text-transform:uppercase; letter-spacing:1px;\">Layman's Summary:<\/strong>\r\n                        <p style=\"font-size:0.85rem; color:#2d3748; margin-top:8px; line-height:1.5;\">${summary}<\/p>\r\n                        \r\n                        <div style=\"margin-top:15px; border-top:1px solid #edf2f7; padding-top:10px;\">\r\n                            ${thesisLink ? `<p style=\"margin-bottom:8px;\"><strong>Thesis:<\/strong> <a href=\"${thesisLink}\" target=\"_blank\" style=\"color:#e53e3e; text-decoration:none; font-weight:bold;\">View PDF<\/a><\/p>` : ''}\r\n                            ${articlesHtml}\r\n                        <\/div>\r\n                        \r\n                        <p style=\"margin-top:15px; font-size:0.75rem; color:#cbd5e0; text-align:center; text-transform:uppercase;\">Click to Close<\/p>\r\n                    <\/div>\r\n                <\/div>`;\r\n            });\r\n            container.innerHTML = html;\r\n        });\r\n});\r\n<\/script><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Loading Archive&#8230;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":17903,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-705","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/pages\/705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/users\/17903"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/comments?post=705"}],"version-history":[{"count":2,"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/pages\/705\/revisions"}],"predecessor-version":[{"id":709,"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/pages\/705\/revisions\/709"}],"wp:attachment":[{"href":"https:\/\/blogs.sun.ac.za\/mod\/wp-json\/wp\/v2\/media?parent=705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}