Wiki source code of 学校一覧

Version 23.1 by Super Admin on 2026/03/13 21:13

Hide last authors
Super Admin 1.1 1 {{velocity}}
2 ## ===== 学校一覧ページ =====
3 ## ソート: 更新順(デフォルト)/ 都道府県順
4 ## カード形式で表示し、活動数・投稿数・最終更新日を表示
5
Super Admin 23.1 6 ## --- 閲覧者情報(非表示校フィルタ用) ---
7 #set($listViewerUser = $xcontext.user)
8 #set($isListAdmin = false)
9 #if($listViewerUser != 'XWiki.XWikiGuest')
10 #set($listViewerDoc = $xwiki.getDocument($listViewerUser))
11 #set($listViewerAccountType = $!listViewerDoc.getValue('accountType'))
12 #if($listViewerAccountType == 'admin')
13 #set($isListAdmin = true)
14 #end
15 #end
16
Super Admin 1.1 17 #set($sortParam = $!request.sort)
18 #if(!$sortParam || $sortParam == '')
19 #set($sortParam = 'updated')
20 #end
21
Super Admin 23.1 22 ## ソート順に応じたXWQLクエリ(非表示校フィルタ付き)
23 #if($isListAdmin)
24 ## 管理者: 全校表示
25 #if($sortParam == 'pref')
26 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school order by school.prefecture, school.schoolName"))
27 #else
28 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school order by doc.date desc"))
29 #end
Super Admin 1.1 30 #else
Super Admin 23.1 31 ## 一般: 非表示校を除外
32 #if($sortParam == 'pref')
33 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school where (school.hidden != 1 or school.hidden is null) order by school.prefecture, school.schoolName"))
34 #else
35 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school where (school.hidden != 1 or school.hidden is null) order by doc.date desc"))
36 #end
Super Admin 1.1 37 #end
38 #set($results = $query.execute())
39
40 {{html clean="false"}}
Super Admin 11.1 41 <h1 class="home-section-title">登録されている学校</h1>
42 <div class="sort-header">
43 <div class="school-count">
Super Admin 1.1 44 $results.size() 校が登録されています
45 </div>
Super Admin 11.1 46 <div class="sort-toggle-group">
Super Admin 1.1 47 <a href="$doc.getURL('view', 'sort=updated')"
Super Admin 11.1 48 class="sort-toggle #if($sortParam == 'updated')active#end">
Super Admin 6.1 49 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg> 更新順
Super Admin 1.1 50 </a>
51 <a href="$doc.getURL('view', 'sort=pref')"
Super Admin 11.1 52 class="sort-toggle #if($sortParam == 'pref')active#end">
Super Admin 6.1 53 <svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg> 都道府県順
Super Admin 1.1 54 </a>
55 </div>
56 </div>
57 {{/html}}
58
59 #if($results.size() > 0)
60
61 ## 都道府県順の場合、都道府県グループヘッダーを表示
62 #set($currentPref = '')
63
64 {{html clean="false"}}
Super Admin 11.1 65 <div class="school-card-grid">
Super Admin 1.1 66 #foreach($docName in $results)
67 #set($schoolDoc = $xwiki.getDocument($docName))
68 #set($schoolObj = $schoolDoc.getObject('SeitokaiCode.SchoolClass'))
69 #if($schoolObj)
70 #set($sName = $!schoolObj.getValue('schoolName'))
71 #set($sPref = $!schoolObj.getValue('prefecture'))
72 #set($sCity = $!schoolObj.getValue('city'))
73 #set($sType = $!schoolObj.getValue('schoolType'))
74 #set($sEst = $!schoolObj.getValue('establishment'))
75 #set($sCoed = $!schoolObj.getValue('coeducation'))
76 #set($sSystem = $!schoolObj.getValue('schoolSystem'))
77 #set($lastUpdate = $datetool.format('yyyy/MM/dd', $schoolDoc.date))
78 ## 活動数をカウント
79 #set($actCount = $schoolDoc.getObjects('SeitokaiCode.ActivityClass').size())
80 ## 投稿数をカウント(全活動の投稿合計)
81 #set($postCount = $schoolDoc.getObjects('SeitokaiCode.ActivityPostClass').size())
82 ## 特色ある活動の数をカウント
83 #set($schoolActivities = $schoolDoc.getObjects('SeitokaiCode.ActivityClass'))
84 #set($featuredCount = 0)
85 #if($schoolActivities)
86 #foreach($sa in $schoolActivities)
87 #if($!sa.getValue('featured') == '1')
88 #set($featuredCount = $featuredCount + 1)
89 #end
90 #end
91 #end
92
93 ## 都道府県グループヘッダー(都道府県順の場合)
94 #if($sortParam == 'pref' && $sPref != $currentPref)
95 #set($currentPref = $sPref)
Super Admin 11.1 96 <div class="pref-group-header">
97 <span class="pref-group-label"><svg class="ico ico-fixed-16" viewBox="0 0 24 24"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg> $!escapetool.xml($currentPref)</span>
Super Admin 1.1 98 </div>
99 #end
100
Super Admin 23.1 101 #set($sHidden = $!schoolObj.getValue('hidden'))
102 <a href="$schoolDoc.getURL('view')" class="school-card #if($sHidden == 1)school-card-hidden#end">
Super Admin 11.1 103 <div class="school-card-body">
104 <div class="school-card-header-row">
105 <div class="school-card-name">$!escapetool.xml($sName)</div>
Super Admin 23.1 106 #if($sHidden == 1)
107 <span class="badge-hidden">非表示</span>
108 #end
Super Admin 1.1 109 #if($sEst)
Super Admin 11.1 110 <span class="school-card-badge #if($sEst == '公立')public#elseif($sEst == '私立')private#else national#end">$!escapetool.xml($sEst)</span>
Super Admin 1.1 111 #end
112 </div>
Super Admin 11.1 113 <div class="school-card-meta">
Super Admin 5.1 114 $!escapetool.xml($sPref) $!escapetool.xml($sCity)
115 #if($sCoed) ・ $!escapetool.xml($sCoed)#end
Super Admin 22.1 116 #if($sSystem && !$sSystem.isEmpty()) ・ #foreach($__sys in $sSystem)#if($foreach.count > 1)・#end$!escapetool.xml($__sys)#end#end
Super Admin 1.1 117 </div>
118 ## 特色ある活動バッジ
119 #if($featuredCount > 0)
Super Admin 11.1 120 <div class="school-card-featured-wrap">
121 <span class="badge-featured"><svg class="ico ico-fixed-14" viewBox="0 0 24 24" fill="currentColor" stroke="none"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> 特色ある活動 ${featuredCount}件</span>
Super Admin 1.1 122 </div>
123 #end
Super Admin 11.1 124 <div class="school-card-stats">
125 <span><svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg> 活動 <span class="num">$actCount</span>件</span>
126 <span><svg class="ico ico-fixed-14" viewBox="0 0 24 24"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/></svg> 投稿 <span class="num">$postCount</span>件</span>
127 <span><svg class="ico ico-fixed-14" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg> 更新 $lastUpdate</span>
Super Admin 1.1 128 </div>
129 </div>
130 </a>
131 #end
132 #end
133 </div>
134 {{/html}}
135
136 #else
137 //まだ学校ページが登録されていません。//
138
139 [[学校ページを作成する>>SeitokaiCode.CreateSchool]]
140 #end
141 {{/velocity}}