|
|
1 |
{{velocity}} |
|
|
2 |
{{html clean="false" wiki="true"}} |
|
|
3 |
#template('apice_macros.vm') |
|
|
4 |
#nodoclang() |
|
|
5 |
#nolangpar() |
|
|
6 |
#setobjectspace("Courses") |
|
|
7 |
#template('apice_course_macros.vm') |
|
|
8 |
#template('apice_user_param.vm') |
|
|
9 |
## years / personal |
|
|
10 |
#if( $isUserSpace ) |
|
|
11 |
#set( $query = ", BaseObject as objPersonalCourse, LargeStringProperty as propUser |
|
|
12 |
where objPersonalCourse.name = doc.fullName and objPersonalCourse.className = '${mainSpace}.Personal.Class' and propUser.id.id = objPersonalCourse.id and propUser.name = 'user' and propUser.value = '$userName' " ) |
|
|
13 |
#set( $personalCourseDocs = $xwiki.searchDocuments($query) ) |
|
|
14 |
#if( $personalCourseDocs.size() > 0 ) |
|
|
15 |
#set( $personalCourseDoc = $xwiki.getDocument($personalCourseDocs[0]) ) |
|
|
16 |
#else |
|
|
17 |
#stop |
|
|
18 |
#end |
|
|
19 |
#if( $personalCourseDoc.maxYears && $personalCourseDoc.maxYears != "" ) |
|
|
20 |
#set( $maxCourseYears = $numbertool.toNumber($personalCourseDoc.display('maxYears','view')) ) |
|
|
21 |
#end |
|
|
22 |
#if( $personalCourseDoc.firstYear && $personalCourseDoc.firstYear != "" ) |
|
|
23 |
#set( $firstYearCourse = $numbertool.toNumber($personalCourseDoc.display('firstYear','view')) ) |
|
|
24 |
#end |
|
|
25 |
#if( $personalCourseDoc.lastYear && $personalCourseDoc.lastYear != "" ) |
|
|
26 |
#set( $lastYearCourse = $numbertool.toNumber($personalCourseDoc.display('lastYear','view')) ) |
|
|
27 |
#end |
|
|
28 |
#end |
|
|
29 |
## years / parameters takes precedence |
|
|
30 |
#set( $firstYear = $numbertool.toNumber($firstYearCourse) ) |
|
|
31 |
#set( $lastYear = $numbertool.toNumber($lastYearCourse) ) |
|
|
32 |
#template('apice_year_param.vm') |
|
|
33 |
## |
|
|
34 |
## DATA STRUCTURES / START |
|
|
35 |
#set( $itemMap = {} ) |
|
|
36 |
#set( $itemNo = 0 ) |
|
|
37 |
## cycle over years |
|
|
38 |
#foreach( $year in $yearList ) |
|
|
39 |
#set( $year1 = $year + 1 ) |
|
|
40 |
#set( $ayear = $year + "/" + $year1 ) |
|
|
41 |
#set( $query = ", BaseObject as objCourse, StringProperty as propName, StringProperty as propYear, LargeStringProperty as propProfessor, LargeStringProperty as propOtherprofessors, LargeStringProperty as propTutors |
|
|
42 |
where objCourse.name = doc.fullName and objCourse.className = '${mainSpace}.Class' and objCourse.name <> '${objectPool}.Template' and propName.id.id = objCourse.id and propYear.id.id = objCourse.id and propProfessor.id.id = objCourse.id and propOtherprofessors.id.id = objCourse.id and propTutors.id.id = objCourse.id and propName.name = #if( $services.localization.currentLocale == 'it' )'ita'#{else}'eng'#end and propYear.name = 'ay' and propProfessor.name = 'professor' and propOtherprofessors.name = 'otherProfessors' and propTutors.name = 'tutors' and propYear.value = '$ayear' #if( $oneUser )and ( propProfessor.value like '%$userName%' or propOtherprofessors.value like '%$userName%' or propTutors.value like '%$userName%' )#end order by propName.value asc") |
|
|
43 |
## execute query |
|
|
44 |
#set( $itemFound = $xwiki.searchDocuments($query) ) |
|
|
45 |
## set counters |
|
|
46 |
#set( $itemYearNo = $itemFound.size() ) |
|
|
47 |
#if( $itemYearNo > 0 ) |
|
|
48 |
#set( $itemMap[$year] = $itemFound ) |
|
|
49 |
#set( $itemNo = $itemNo + $itemYearNo ) |
|
|
50 |
#end |
|
|
51 |
#end |
|
|
52 |
## DATA STRUCTURES / END |
|
|
53 |
## |
|
|
54 |
## DISPLAY / START |
|
|
55 |
## page subtitle |
|
|
56 |
<div class="mainheader"> |
|
|
57 |
$itemNo |
|
|
58 |
#if( $itemNo == 1 ) |
|
|
59 |
$services.localization.render('course').toLowerCase() |
|
|
60 |
#else |
|
|
61 |
$services.localization.render('courses').toLowerCase() |
|
|
62 |
#end |
|
|
63 |
<span class="textsecondary"> / </span> |
|
|
64 |
#if( $oneYear ) |
|
|
65 |
#set( $year1 = $year + 1 ) |
|
|
66 |
#set( $ayear = $year + "/" + $year1 ) |
|
|
67 |
$ayear |
|
|
68 |
#else |
|
|
69 |
#set( $firstYear1 = $firstYear + 1 ) |
|
|
70 |
#set( $lastYear1 = $lastYear + 1 ) |
|
|
71 |
#set( $aFirstYear = $firstYear + "/" + $firstYear1 ) |
|
|
72 |
#set( $aLastYear = $lastYear + "/" + $lastYear1 ) |
|
|
73 |
$aFirstYear<span class="textsecondary"> — </span>$aLastYear |
|
|
74 |
#end |
|
|
75 |
#if( $oneUser ) |
|
|
76 |
<span class="textsecondary"> / </span> |
|
|
77 |
$userFirstName $userLastName |
|
|
78 |
#end |
|
|
79 |
</div> |
|
|
80 |
## stop if no courses are found |
|
|
81 |
#if( $itemNo == 0 || $itemMap.keySet().size() == 0 ) |
|
|
82 |
## redundant double check |
|
|
83 |
#stop |
|
|
84 |
#end |
|
|
85 |
## some courses found |
|
|
86 |
## page index |
|
|
87 |
#if( $itemMap.keySet().size() > 1 ) |
|
|
88 |
## found more than one year |
|
|
89 |
<div class="mainselectbar" id="index"> |
|
|
90 |
#foreach( $year in $itemMap.keySet() ) |
|
|
91 |
#set( $year1 = $year + 1 ) |
|
|
92 |
#set( $ayear = $year + "/" + $year1 ) |
|
|
93 |
#if( !$foreach.first ) |
|
|
94 |
 •  |
|
|
95 |
#end |
|
|
96 |
[[$ayear>>||anchor="$ayear"]] |
|
|
97 |
#end |
|
|
98 |
</div> |
|
|
99 |
#end |
|
|
100 |
## courses displayed per year |
|
|
101 |
#foreach( $year in $itemMap.keySet() ) |
|
|
102 |
#set( $year1 = $year + 1 ) |
|
|
103 |
#set( $ayear = $year + "/" + $year1 ) |
|
|
104 |
## year top / start |
|
|
105 |
<div class="mainselectseparator"> |
|
|
106 |
<a class="mainselectseparatorlink" id="$ayear" href=$xwiki.getURL($doc,"view","year=$year#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")> |
|
|
107 |
$ayear |
|
|
108 |
</a> |
|
|
109 |
</div> |
|
|
110 |
## year top / end |
|
|
111 |
## |
|
|
112 |
## year display / start |
|
|
113 |
<div class='menumainbody' style='margin-top: .25em'> |
|
|
114 |
#foreach( $item in $itemMap[$year] ) |
|
|
115 |
#if( $oneUser) |
|
|
116 |
#courseicon() #coursename($item) (#coursecycle($item))<br/> |
|
|
117 |
#else |
|
|
118 |
#courseicon() #coursename($item) <span class='textsecondary'>(#coursecycle($item)) — </span>#courseprofessor($item)<br/> |
|
|
119 |
#end |
|
|
120 |
## #if( !$foreach.last ) |
|
|
121 |
##  •  |
|
|
122 |
## #end |
|
|
123 |
#end |
|
|
124 |
</div> |
|
|
125 |
## year display / end |
|
|
126 |
## |
|
|
127 |
## year bottom / start |
|
|
128 |
<div #if( $foreach.last )id="bottom"#end class="mainselectbottom"> |
|
|
129 |
#set( $itemYearNo = $itemMap[$year].size() ) |
|
|
130 |
$itemYearNo |
|
|
131 |
#if( $itemYearNo == 1 ) |
|
|
132 |
$services.localization.render('course').toLowerCase() |
|
|
133 |
#else |
|
|
134 |
$services.localization.render('courses').toLowerCase() |
|
|
135 |
#end |
|
|
136 |
<span class="textsecondary"> / </span> |
|
|
137 |
$year |
|
|
138 |
 •  |
|
|
139 |
#anchorlinks() |
|
|
140 |
</div> |
|
|
141 |
## year bottom / end |
|
|
142 |
#end |
|
|
143 |
## DISPLAY / END |
|
|
144 |
{{/html}} |
|
|
145 |
{{/velocity}}{{pageDisplay sort="objectservice"/}} |