Show last authors
1 {{include reference="Courses.MacroSheet"/}}{{include reference="Courses.GlobalVars"/}}{{velocity}}
2 #set( $currentCourseDoc = "" )
3 #### get parameters
4 ## when
5 #set( $yearPar = $context.getRequest().getParameter("year") )
6 #set( $firstYearPar = $context.getRequest().getParameter("from") )
7 #set( $lastYearPar = $context.getRequest().getParameter("to") )
8 ## who
9 #set( $userNamePar = $context.getRequest().getParameter("user") )
10 #set( $professorNamePar = $context.getRequest().getParameter("professor") )
11 #set( $tutorNamePar = $context.getRequest().getParameter("tutor") )
12 #### handle who
13 #if ( $userName )
14 ## from a personal page, "XWiki.UserName" $userName form
15 #set( $userdoc = $xwiki.getDocument($userName) )
16 #set( $userFirstName = $userdoc.display("first_name") )
17 #set( $userLastName = $userdoc.display("last_name") )
18 #elseif ( $userNamePar )
19 ## from the URL, "user=UserName" parameter
20 #set( $userName = "XWiki.$userNamePar" )
21 #set( $userdoc = $xwiki.getDocument($userName) )
22 #set( $userFirstName = $userdoc.display("first_name") )
23 #set( $userLastName = $userdoc.display("last_name") )
24 #else
25 #set( $userName = "" )
26 #set( $userFirstName = "" )
27 #set( $userLastName = "" )
28 #end
29 #if ( $professorName )
30 ## from a personal page, "XWiki.UserName" $professorName form
31 #set( $professordoc = $xwiki.getDocument($professorName) )
32 #set( $professorFirstName = $professordoc.display("first_name") )
33 #set( $professorLastName = $professordoc.display("last_name") )
34 #elseif ( $professorNamePar )
35 ## from the URL, "professor=UserName" parameter
36 #set( $professorName = "XWiki.$professorNamePar" )
37 #set( $professordoc = $xwiki.getDocument($professorName) )
38 #set( $professorFirstName = $professordoc.display("first_name") )
39 #set( $professorLastName = $professordoc.display("last_name") )
40 #else
41 #set( $professorName = "" )
42 #set( $professorFirstName = "" )
43 #set( $professorLastName = "" )
44 #end
45 #if ( $tutorName )
46 ## from a personal page, "XWiki.UserName" $tutorName form
47 #set( $tutordoc = $xwiki.getDocument($tutorName) )
48 #set( $tutorFirstName = $tutordoc.display("first_name") )
49 #set( $tutorLastName = $tutordoc.display("last_name") )
50 #elseif ( $tutorNamePar )
51 ## from the URL, "tutor=UserName" parameter
52 #set( $tutorName = "XWiki.$tutorNamePar" )
53 #set( $tutordoc = $xwiki.getDocument($tutorName) )
54 #set( $tutorFirstName = $tutordoc.display("first_name") )
55 #set( $tutorLastName = $tutordoc.display("last_name") )
56 #else
57 #set( $tutorName = "" )
58 #set( $tutorFirstName = "" )
59 #set( $tutorLastName = "" )
60 #end
61 #if( $userName != "" )#set( $professorName = $userName )#set( $tutorName = $userName )#end
62 ##
63 #if( $firstYearCou )#set( $firstYear = $firstYearCou )#end
64 #if( $lastYearCou )#set( $lastYear = $lastYearCou )#end
65 #set( $firstYear1 = $firstYear + 1 )#set( $firstAYear = $firstYear + "/" + $firstYear1 )
66 #set( $lastYear1 = $lastYear + 1 )#set( $lastAYear = $lastYear + "/" + $lastYear1 )
67 #set( $yearRange = [$lastYear..$firstYear] )
68 #if(!$oneYear)#set( $oneYear = false )#end
69 ##
70 #set( $yearPar = $context.getRequest().getParameter("year") )
71 #set( $firstYearPar = $context.getRequest().getParameter("from") )
72 #set( $lastYearPar = $context.getRequest().getParameter("to") )
73 #if($firstYearPar)
74 #set( $yearFirst = $util.parseInt($firstYearPar) )
75 #if ( $yearRange.contains($yearFirst) )
76 #set( $firstYear = $yearFirst )
77 #set( $yearRange = [$lastYear..$firstYear] )
78 #set( $firstYear1 = $firstYear + 1 )
79 #set( $firstAYear = $firstYear + "/" + $firstYear1 )
80 #end
81 #end
82 #if($lastYearPar)
83 #set( $yearLast = $util.parseInt($lastYearPar) )
84 #if ( $yearRange.contains($yearLast) )
85 #set( $lastYear = $yearLast )
86 #set( $yearRange = [$lastYear..$firstYear] )
87 #set( $lastYear1 = $lastYear + 1 )
88 #set( $lastAYear = $lastYear + "/" + $lastYear1 )
89 #end
90 #end
91 #set($yearList = $yearRange)
92 #if($yearPar)
93 #set($year = $util.parseInt($yearPar))
94 #if ($yearRange.contains($year) )
95 #set($yearList = [$year])
96 #set($oneYear = true)
97 #set($year1 = $year + 1 )
98 #set($aYear = $year + "/" + $year1 )
99 #end
100 #end
101
102 >{{stringEngIta eng = "Courses" ita = "Corsi"/}} / #if( $oneYear )$aYear#else$firstAYear–$lastAYear#end#if( $userName != "" ) / $userFirstName $userLastName#elseif( $professorName != "" ) / $professorFirstName $professorLastName#elseif( $tutorName != "" ) / $tutorFirstName $tutorLastName (tutor)#end
103 {{id name="top"/}}
104
105 #if( !$oneYear )
106 (% style="font-size: smaller" %)(((#foreach ($yearr in $yearList)#set($yearr1 = $yearr + 1)#set($ayearr = "$yearr/$yearr1")#if( $velocityCount > 1 ) | #end[[$ayearr>>$doc||anchor=$ayearr]]#end)))(%%)
107 #end
108 ##
109 #foreach( $yearr in $yearList)#set($yearr1 = $yearr + 1)#set($ayearr = $yearr + "/" + $yearr1 )
110 #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3
111 where
112 obj.name = doc.fullName and
113 obj.className = 'Courses.CourseClass' and
114 obj.name <> 'Courses.CourseClassTemplate' and
115 obj.name <> 'Courses.CourseTemplate' and
116 prop.id.id = obj.id and
117 prop1.id.id = obj.id and
118 prop2.id.id = obj.id and
119 prop3.id.id = obj.id and
120 prop.name = 'aY' and
121 prop1.name = 'professor' and
122 prop2.name = 'otherProfessors' and
123 prop3.name = 'tutors' and
124 prop.value like '%$yearr%' and
125 (prop1.value like '%$professorName%' or
126 prop2.value like '%$professorName%' or
127 prop3.value like '%$tutorName%')
128 order by prop.value desc
129 ")
130 #set( $courseFound = $xwiki.searchDocuments($sql) )
131 #if( $courseFound.size()>0 )#if(!$oneYear)
132 === $ayearr ===
133 {{id name="$ayearr"/}}
134 #end#foreach ($courseDoc in $courseFound)
135 * [[#displayName($courseDoc)>>$courseDoc]]
136 #end
137 (% style='font-style:oblique;font-size:smaller;text-align:right;color:gray;margin-top:-0.5em;margin-bottom:0em' %)((( ($courseFound.size() #if( $courseFound.size() > 1 ){{stringEngIta ita="corsi" eng="courses"/}}#else{{stringEngIta ita="corso" eng="course"/}}#end / $ayearr) [[[top]>>||anchor="top"]] )))(%%)
138 #end#end
139 {{/velocity}}

Partita IVA: 01131710376 - Copyright © 2008-2021 APICe@DISI Research Group - PRIVACY