Wiki source code of ユーザープロフィール

Last modified by Super Admin on 2026/03/22 00:39

Hide last authors
Super Admin 1.1 1 {{velocity}}
2 ## ===== ユーザー公開プロフィール =====
3 ## 他ユーザーが閲覧するための公開プロフィールページ。
4 ## 本名・メールアドレス・警告状態は非公開。displayNameのみ表示。
5 ##
6 ## 使い方: SeitokaiCode.UserProfile?user=XWiki.Username でアクセス
7 ## または各投稿の作者名リンクから遷移。
8
9 #set($targetUser = $request.user)
10 #if(!$targetUser || $targetUser == '')
11 {{warning}}ユーザーが指定されていません。{{/warning}}
12 #else
13
14 #set($targetDoc = $xwiki.getDocument($targetUser))
15 #if(!$targetDoc || !$targetDoc.exists())
16 {{error}}指定されたユーザーが見つかりません。{{/error}}
17 #else
18
19 #set($profileDisplayName = $!targetDoc.getValue('displayName'))
20 #if(!$profileDisplayName || $profileDisplayName == '')
21 #set($profileDisplayName = $xwiki.getUserName($targetUser))
22 #end
23 #set($profileAccountType = $!targetDoc.getValue('accountType'))
24 #set($profileUserRole = $!targetDoc.getValue('userRole'))
25 #set($profileUserStatus = $!targetDoc.getValue('userStatus'))
26 #set($profileSchoolCode = $!targetDoc.getValue('schoolCode'))
27 #set($profileSchoolName = $!targetDoc.getValue('schoolName'))
28 #set($profileEnrollmentYear = $!targetDoc.getValue('enrollmentYear'))
29
30 ## --- 学年の動的計算(学校種別対応) ---
31 #set($profileGrade = '')
32 #if($profileEnrollmentYear && $profileEnrollmentYear != '' && $profileUserRole == 'student')
33 #set($now = $datetool.date)
34 #set($currentYear = $datetool.format('yyyy', $now))
35 #set($currentMonth = $datetool.format('MM', $now))
36 #set($currentYearInt = $mathtool.toInteger($currentYear))
37 #set($currentMonthInt = $mathtool.toInteger($currentMonth))
38 #set($enrollYearInt = $mathtool.toInteger($profileEnrollmentYear))
39 #if($currentMonthInt >= 4)
40 #set($schoolYear = $currentYearInt)
41 #else
42 #set($schoolYear = $mathtool.sub($currentYearInt, 1))
43 #end
44 ## 学校種別から在学年数を判定
45 #set($profileMaxYears = 3)
46 #if($profileSchoolCode && $profileSchoolCode.length() >= 2)
47 #set($profileSchoolType = $profileSchoolCode.substring(0, 2))
48 #if($profileSchoolType == 'C2')
49 #set($profileMaxYears = 9)
50 #elseif($profileSchoolType == 'D2')
51 #set($profileMaxYears = 6)
52 #end
53 #end
54 #set($gradeNum = $mathtool.add($mathtool.sub($schoolYear, $enrollYearInt), 1))
55 #if($gradeNum >= 1 && $gradeNum <= $profileMaxYears)
56 #set($profileGrade = "${gradeNum}年生")
57 #elseif($gradeNum > $profileMaxYears)
58 #set($profileGrade = "卒業生")
59 #end
60 #end
61
62 ## --- 自分自身のプロフィールならマイページにリダイレクト ---
63 #if($targetUser == $xcontext.user)
64 $response.sendRedirect($xwiki.getURL("SeitokaiCode.MyPage", "view"))
65 #end
66
Super Admin 5.1 67 = $profileDisplayName =
Super Admin 1.1 68
69 {{html clean="false"}}
70 <div class="seitokai-badge-container">
71 #if($profileAccountType == 'admin')
Super Admin 6.1 72 <span class="badge badge-admin"><svg class="ico" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> 管理者</span>
Super Admin 1.1 73 #elseif($profileAccountType == 'verified')
Super Admin 6.1 74 <span class="badge badge-verified"><svg class="ico" viewBox="0 0 24 24" stroke-width="2.5"><path d="M20 6L9 17l-5-5"/></svg> 承認済み</span>
Super Admin 1.1 75 #elseif($profileAccountType == 'referred')
Super Admin 6.1 76 <span class="badge badge-referred"><svg class="ico" viewBox="0 0 24 24"><path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/></svg> 紹介</span>
Super Admin 1.1 77 #else
78 <span class="badge badge-general">一般</span>
79 #end
80 #if($profileUserRole == 'student')
Super Admin 6.1 81 <span class="badge badge-role-student"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 生徒</span>
XWikiGuest 19.1 82 #set($profileIsOfficer = $!targetDoc.getValue('isOfficer'))
Super Admin 2.1 83 #if($profileIsOfficer == 'true')
Super Admin 6.1 84 <span class="badge badge-role-officer"><svg class="ico" viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg> 役員</span>
Super Admin 2.1 85 #end
Super Admin 1.1 86 #elseif($profileUserRole == 'teacher')
Super Admin 6.1 87 <span class="badge badge-role-teacher"><svg class="ico" viewBox="0 0 24 24"><path d="M4 19.5A2.5 2.5 0 016.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z"/></svg> 教員</span>
Super Admin 1.1 88 #elseif($profileUserRole == 'graduate')
Super Admin 6.1 89 <span class="badge badge-role-graduate"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 卒業生</span>
Super Admin 1.1 90 #end
91 #if($profileUserStatus == 'graduated')
Super Admin 6.1 92 <span class="badge badge-status-graduated"><svg class="ico" viewBox="0 0 24 24"><path d="M22 10l-10-5L2 10l10 5 10-5z"/><path d="M6 12v5c0 1.66 2.69 3 6 3s6-1.34 6-3v-5"/></svg> 卒業済み</span>
Super Admin 1.1 93 #elseif($profileUserStatus == 'on_leave')
Super Admin 6.1 94 <span class="badge badge-status-onleave"><svg class="ico" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg> 休学中</span>
Super Admin 1.1 95 #elseif($profileUserStatus == 'transferred')
Super Admin 6.1 96 <span class="badge badge-status-transferred"><svg class="ico" viewBox="0 0 24 24"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/></svg> 転校済み</span>
Super Admin 1.1 97 #end
98 </div>
99 {{/html}}
100
101 == プロフィール ==
102
103 {{html clean="false"}}
104 <div class="school-info-card">
Super Admin 27.1 105 <h2><span><svg class="ico" viewBox="0 0 24 24"><path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/></svg> 公開情報</span></h2>
Super Admin 1.1 106 <table class="wiki-table school-info-table">
107 <tr><th>表示名</th><td><strong>$profileDisplayName</strong></td></tr>
108 <tr><th>アカウント種別</th><td>
109 #if($profileAccountType == 'admin')管理者
110 #elseif($profileAccountType == 'verified')承認済み
111 #elseif($profileAccountType == 'referred')紹介
112 #else一般#end
113 </td></tr>
114 <tr><th>役割</th><td>
115 #if($profileUserRole == 'student')生徒
116 #elseif($profileUserRole == 'teacher')教員
117 #elseif($profileUserRole == 'graduate')卒業生
118 #else$!profileUserRole#end
119 </td></tr>
Super Admin 33.1 120 ## --- 学校情報を中学・高校・現任校ラベルで表示 ---
Super Admin 31.1 121 #set($profileSecondarySchoolCode = $!targetDoc.getValue('secondarySchoolCode'))
122 #set($profileSecondarySchoolName = $!targetDoc.getValue('secondarySchoolName'))
123 #set($profileAlumniSchoolCode = $!targetDoc.getValue('alumniSchoolCode'))
124 #set($profileAlumniSchoolName = $!targetDoc.getValue('alumniSchoolName'))
Super Admin 33.1 125 #set($pMidCode = '')#set($pMidName = '')
126 #set($pHiCode = '')#set($pHiName = '')
127 #if($profileSchoolCode && $profileSchoolCode.length() >= 2)
128 #set($pst = $profileSchoolCode.substring(0, 2))
129 #if($pst == 'C1' || $pst == 'C2')#set($pMidCode = $profileSchoolCode)#set($pMidName = $profileSchoolName)
130 #elseif($pst == 'D1' || $pst == 'D2')#set($pHiCode = $profileSchoolCode)#set($pHiName = $profileSchoolName)#end
Super Admin 31.1 131 #end
Super Admin 33.1 132 #if($profileSecondarySchoolCode && $profileSecondarySchoolCode.length() >= 2)
133 #set($ps2t = $profileSecondarySchoolCode.substring(0, 2))
134 #if($ps2t == 'C1' || $ps2t == 'C2')#set($pMidCode = $profileSecondarySchoolCode)#set($pMidName = $profileSecondarySchoolName)
135 #elseif($ps2t == 'D1' || $ps2t == 'D2')#set($pHiCode = $profileSecondarySchoolCode)#set($pHiName = $profileSecondarySchoolName)#end
136 #end
137 #set($pIsGrad = ($profileUserRole == 'graduate'))
138 #if($profileUserRole == 'teacher')
139 #if($profileSchoolCode && $profileSchoolCode != '')
140 <tr><th>現任校</th><td><a href="/bin/Schools/${profileSchoolCode}/WebHome">$!profileSchoolName</a></td></tr>
141 #end
142 ## 教員の出身校を alumni から復元
143 #if($profileAlumniSchoolCode && $profileAlumniSchoolCode.length() >= 2)
144 #set($pat = $profileAlumniSchoolCode.substring(0, 2))
145 #if(($pat == 'D1' || $pat == 'D2') && $pHiCode == '')#set($pHiCode = $profileAlumniSchoolCode)#set($pHiName = $profileAlumniSchoolName)#end
146 #if(($pat == 'C1' || $pat == 'C2') && $pMidCode == '')#set($pMidCode = $profileAlumniSchoolCode)#set($pMidName = $profileAlumniSchoolName)#end
147 #end
148 #end
149 #if($pMidCode != '')
150 <tr><th>#if($pIsGrad || $profileUserRole == 'teacher')出身中学#else中学校#end</th><td><a href="/bin/Schools/${pMidCode}/WebHome">$!pMidName</a></td></tr>
151 #end
152 #if($pHiCode != '')
153 <tr><th>#if($pIsGrad || $profileUserRole == 'teacher')出身高校#else高等学校#end</th><td><a href="/bin/Schools/${pHiCode}/WebHome">$!pHiName</a></td></tr>
154 #end
Super Admin 26.1 155 ## 学年はプライバシー保護のため公開プロフィールには表示しない
Super Admin 1.1 156 </table>
157 </div>
158 {{/html}}
159
160 {{html clean="false"}}
Super Admin 11.1 161 <div class="info-note info-note-lg" style="margin-top:24px;text-align:center;">
Super Admin 6.1 162 <svg class="ico" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg> 本名・メールアドレス・警告状態などの個人情報は非公開です
Super Admin 1.1 163 </div>
164 {{/html}}
165
166 #end
167 #end
168 {{/velocity}}