Wiki source code of 学校一覧

Version 20.1 by XWikiGuest on 2026/03/10 22:20

Hide last authors
Super Admin 1.1 1 {{velocity}}
2 ## ===== 学校一覧ページ =====
3 ## ソート: 更新順(デフォルト)/ 都道府県順
4 ## カード形式で表示し、活動数・投稿数・最終更新日を表示
5
6 #set($sortParam = $!request.sort)
7 #if(!$sortParam || $sortParam == '')
8 #set($sortParam = 'updated')
9 #end
10
11 ## ソート順に応じたXWQLクエリ
12 #if($sortParam == 'pref')
13 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school order by school.prefecture, school.schoolName"))
14 #else
15 ## 更新順: ドキュメントの最終更新日でソート(降順)
16 #set($query = $services.query.xwql("from doc.object(SeitokaiCode.SchoolClass) as school order by doc.date desc"))
17 #end
18 #set($results = $query.execute())
19
20 {{html clean="false"}}
Super Admin 11.1 21 <h1 class="home-section-title">登録されている学校</h1>
22 <div class="sort-header">
23 <div class="school-count">
Super Admin 1.1 24 $results.size() 校が登録されています
25 </div>
Super Admin 11.1 26 <div class="sort-toggle-group">
Super Admin 1.1 27 <a href="$doc.getURL('view', 'sort=updated')"
Super Admin 11.1 28 class="sort-toggle #if($sortParam == 'updated')active#end">
Super Admin 6.1 29 <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 30 </a>
31 <a href="$doc.getURL('view', 'sort=pref')"
Super Admin 11.1 32 class="sort-toggle #if($sortParam == 'pref')active#end">
Super Admin 6.1 33 <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 34 </a>
35 </div>
36 </div>
37 {{/html}}
38
39 #if($results.size() > 0)
40
41 ## 都道府県順の場合、都道府県グループヘッダーを表示
42 #set($currentPref = '')
43
44 {{html clean="false"}}
Super Admin 11.1 45 <div class="school-card-grid">
Super Admin 1.1 46 #foreach($docName in $results)
47 #set($schoolDoc = $xwiki.getDocument($docName))
48 #set($schoolObj = $schoolDoc.getObject('SeitokaiCode.SchoolClass'))
49 #if($schoolObj)
50 #set($sName = $!schoolObj.getValue('schoolName'))
51 #set($sPref = $!schoolObj.getValue('prefecture'))
52 #set($sCity = $!schoolObj.getValue('city'))
53 #set($sType = $!schoolObj.getValue('schoolType'))
54 #set($sEst = $!schoolObj.getValue('establishment'))
55 #set($sCoed = $!schoolObj.getValue('coeducation'))
56 #set($sSystem = $!schoolObj.getValue('schoolSystem'))
57 #set($lastUpdate = $datetool.format('yyyy/MM/dd', $schoolDoc.date))
58 ## 活動数をカウント
59 #set($actCount = $schoolDoc.getObjects('SeitokaiCode.ActivityClass').size())
60 ## 投稿数をカウント(全活動の投稿合計)
61 #set($postCount = $schoolDoc.getObjects('SeitokaiCode.ActivityPostClass').size())
62 ## 特色ある活動の数をカウント
63 #set($schoolActivities = $schoolDoc.getObjects('SeitokaiCode.ActivityClass'))
64 #set($featuredCount = 0)
65 #if($schoolActivities)
66 #foreach($sa in $schoolActivities)
67 #if($!sa.getValue('featured') == '1')
68 #set($featuredCount = $featuredCount + 1)
69 #end
70 #end
71 #end
72
73 ## 都道府県グループヘッダー(都道府県順の場合)
74 #if($sortParam == 'pref' && $sPref != $currentPref)
75 #set($currentPref = $sPref)
Super Admin 11.1 76 <div class="pref-group-header">
77 <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 78 </div>
79 #end
80
Super Admin 11.1 81 <a href="$schoolDoc.getURL('view')" class="school-card">
82 <div class="school-card-body">
83 <div class="school-card-header-row">
84 <div class="school-card-name">$!escapetool.xml($sName)</div>
Super Admin 1.1 85 #if($sEst)
Super Admin 11.1 86 <span class="school-card-badge #if($sEst == '公立')public#elseif($sEst == '私立')private#else national#end">$!escapetool.xml($sEst)</span>
Super Admin 1.1 87 #end
88 </div>
Super Admin 11.1 89 <div class="school-card-meta">
Super Admin 5.1 90 $!escapetool.xml($sPref) $!escapetool.xml($sCity)
91 #if($sCoed) ・ $!escapetool.xml($sCoed)#end
92 #if($sSystem) ・ $!escapetool.xml($sSystem)#end
Super Admin 1.1 93 </div>
94 ## 特色ある活動バッジ
95 #if($featuredCount > 0)
Super Admin 11.1 96 <div class="school-card-featured-wrap">
97 <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 98 </div>
99 #end
Super Admin 11.1 100 <div class="school-card-stats">
101 <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>
102 <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>
103 <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 104 </div>
105 </div>
106 </a>
107 #end
108 #end
109 </div>
110 {{/html}}
111
112 #else
113 //まだ学校ページが登録されていません。//
114
115 [[学校ページを作成する>>SeitokaiCode.CreateSchool]]
116 #end
117 {{/velocity}}