Wiki source code of 学校一覧

Version 27.1 by Super Admin on 2026/03/18 03:55

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')
Super Admin 24.1 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"))
Super Admin 23.1 34 #else
Super Admin 24.1 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"))
Super Admin 23.1 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())
Super Admin 25.1 82 ## 特色ある活動の数とタイトルを収集
Super Admin 1.1 83 #set($schoolActivities = $schoolDoc.getObjects('SeitokaiCode.ActivityClass'))
84 #set($featuredCount = 0)
Super Admin 25.1 85 #set($featuredTitles = [])
Super Admin 1.1 86 #if($schoolActivities)
87 #foreach($sa in $schoolActivities)
88 #if($!sa.getValue('featured') == '1')
89 #set($featuredCount = $featuredCount + 1)
Super Admin 25.1 90 #set($discard = $featuredTitles.add($!sa.getValue('title')))
Super Admin 1.1 91 #end
92 #end
93 #end
94
95 ## 都道府県グループヘッダー(都道府県順の場合)
96 #if($sortParam == 'pref' && $sPref != $currentPref)
97 #set($currentPref = $sPref)
Super Admin 11.1 98 <div class="pref-group-header">
99 <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 100 </div>
101 #end
102
Super Admin 23.1 103 #set($sHidden = $!schoolObj.getValue('hidden'))
104 <a href="$schoolDoc.getURL('view')" class="school-card #if($sHidden == 1)school-card-hidden#end">
Super Admin 11.1 105 <div class="school-card-body">
106 <div class="school-card-header-row">
107 <div class="school-card-name">$!escapetool.xml($sName)</div>
Super Admin 23.1 108 #if($sHidden == 1)
109 <span class="badge-hidden">非表示</span>
110 #end
Super Admin 1.1 111 #if($sEst)
Super Admin 11.1 112 <span class="school-card-badge #if($sEst == '公立')public#elseif($sEst == '私立')private#else national#end">$!escapetool.xml($sEst)</span>
Super Admin 1.1 113 #end
114 </div>
Super Admin 11.1 115 <div class="school-card-meta">
Super Admin 5.1 116 $!escapetool.xml($sPref) $!escapetool.xml($sCity)
117 #if($sCoed) ・ $!escapetool.xml($sCoed)#end
Super Admin 22.1 118 #if($sSystem && !$sSystem.isEmpty()) ・ #foreach($__sys in $sSystem)#if($foreach.count > 1)・#end$!escapetool.xml($__sys)#end#end
Super Admin 1.1 119 </div>
120 ## 特色ある活動バッジ
121 #if($featuredCount > 0)
Super Admin 11.1 122 <div class="school-card-featured-wrap">
123 <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 124 </div>
Super Admin 25.1 125 <div class="school-card-featured-titles">
126 #foreach($ft in $featuredTitles)
127 <span class="featured-title-item"><svg class="ico ico-fixed-12" 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> $!escapetool.xml($ft)</span>
128 #end
129 </div>
Super Admin 1.1 130 #end
Super Admin 11.1 131 <div class="school-card-stats">
132 <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>
133 <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>
134 <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 135 </div>
136 </div>
137 </a>
138 #end
139 #end
140 </div>
141 {{/html}}
142
143 #else
144 //まだ学校ページが登録されていません。//
145
146 [[学校ページを作成する>>SeitokaiCode.CreateSchool]]
147 #end
148 {{/velocity}}