Student Assignment History — Counsel

Overview

This custom report can be used with the Meeting Editor and displays the history for each student in the Publisher Database. It is very easy to see which counsel points the student has not worked on yet.

I welcome your feedback about this custom report!

Sample

Sample Student Info

Script

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:msa="https://www.publictalksoftware.co.uk/msa">
	<xsl:output method="html" indent="yes" version="4.01"
	  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
	  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
	<xsl:param name="CSSFile1"></xsl:param>

	<xsl:variable name="HistDB" select="document('AssignHistory.XML')"/>
	<xsl:variable name="PubDB" select="document('MSA_PublisherDatabase.XML')"/>

	<xsl:template match="/">
		<html>
			<head>
				<meta http-equiv="X-UA-Compatible" content="IE=edge" />
				<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
				<title>Student Assignments History</title>
			</head>
			<!-- CSS Stylesheet -->
			<style>
				* { font-family: Tahoma; }
				div.container {
					margin: 2mm; 
					padding: 2mm; 
					width: 100mm; 
					border: solid 1px black;
					float:left;
					position: relative;
				}
				table.counsel {
					border: solid 1px black; 
					width:100mm; 
					border-collapse: collapse; 
				}
				th.counsel {
					border: solid 1px black; 
					padding: 2mm; 
					text-align: center; 
					background-color: darkgrey; 
				}
				td.counsel { 
					border: solid 1px black; 
					padding: 2mm; 
					text-align: center; 
				}
				tr:nth-child(even) { 
					background-color: lightgrey; 
				}
				p.not-assigned { 
					border-top: solid 1px black; 
					padding:2mm; 
				}
				@media print { 
					.container { 
						display: block; 
					}
					div { 
						page-break-inside: avoid; 
					}
				}
			</style>
			<body>
				<h1>Student Assignment History — Counsel</h1>
				<xsl:for-each select="$PubDB/msa:PublisherDatabase/msa:Publishers/msa:Publisher/msa:Name">
					<!-- Keep each students information in it's own container. This prevents splitting over page breaks when printing.-->
					<div class="container">
						<h2>
							<xsl:value-of select="."/>
						</h2>
						<h3>
							<xsl:text>History</xsl:text>
						</h3>
						<xsl:variable name="strName" select="."/>
						<xsl:choose>
							<!-- Only display a table if the student has history data -->
							<xsl:when test="count($HistDB//AssignmentHistory/*/StudentItems/Item/Name[@Counsel and .=$strName]) != 0">
								<table class="counsel">
									<colgroup>
										<col width="50%"/>
										<col width="50%"/>
									</colgroup>
									<!-- Column Headings-->
									<thead>
										<th class="counsel">Counsel</th>
										<th class="counsel">Week</th>
									</thead>

									<!-- Test for the Counsel attribute so that we exclude Assistant items -->
									<!-- Limit counsel data to the student -->
									<xsl:for-each select="$HistDB//AssignmentHistory/*/StudentItems/Item/Name[@Counsel and .=$strName]">
										<!-- Sort by counsel number (ascending) -->
										<xsl:sort select="@Counsel" data-type="number"/>

										<!-- Then sort by date (ascending) -->
										<xsl:sort select="local-name(../../..)"/>

										<tr>
											<!-- Counsel -->
											<td class="counsel">
												<xsl:value-of select="@Counsel"/>
											</td>
											<!-- Date DD/MM/YYYY -->
											<td class="counsel">
												<xsl:variable name="strWeek" select="local-name(../../..)"/>
												<xsl:value-of select="substring($strWeek, 8, 2)"/>
												<xsl:text>/</xsl:text>
												<xsl:value-of select="substring($strWeek, 5, 2)"/>
												<xsl:text>/</xsl:text>
												<xsl:value-of select="substring($strWeek, 2, 4)"/>
											</td>
										</tr>

									</xsl:for-each>
								</table>
								
								<!-- Indicate which lessons the students has not been assigned -->
								<xsl:variable name="missing-items">
									<xsl:call-template name="list-missing-items">
										<xsl:with-param name="items" select ="$HistDB//AssignmentHistory/*/StudentItems/Item/Name[@Counsel and .=$strName]"/>
									</xsl:call-template>
								</xsl:variable>
								<p class="not-assigned">
									<xsl:text>Not assigned: </xsl:text>
									<br/>
									<xsl:value-of select="translate(normalize-space($missing-items), ' ', ',')" />
								</p>
							</xsl:when>
							<xsl:otherwise>
								<p>
									<xsl:text>No student history found.</xsl:text>
								</p>
							</xsl:otherwise>
						</xsl:choose>
					</div>
				</xsl:for-each>
			</body>
		</html>
	</xsl:template>

	<xsl:template name="list-missing-items">
		<xsl:param name="items"/>
		<xsl:param name="max" select="20"/>
		<xsl:if test="$max > 1">
			<xsl:call-template name="list-missing-items">
				<xsl:with-param name="items" select="$items"/>
				<xsl:with-param name="max" select="$max - 1"/>
			</xsl:call-template>
		</xsl:if>
		<xsl:if test="not ($max=$items/@Counsel)">
			<xsl:value-of select="$max" />
			<xsl:text> </xsl:text>
		</xsl:if>
	</xsl:template>

</xsl:stylesheet>

Translations

Some of the headings are in English and you will need to modify the script as required.

See these line numbers (highlighted):

  • 62
  • 83
  • 84
  • 122
  • 129

Download

Please download the ZIP archive and install from within the Meeting Editor. Make sure you have selected the Custom tab.

Student Assignment History — Counsel
Student Assignment History — Counsel
Size: 2 KB
Version: 1.0
Published: 14/07/2023

Feedback

Please consider providing feedback about this custom template:

0.0
0.0 out of 5 stars (based on 0 reviews)
Excellent0%
Very good0%
Average0%
Poor0%
Terrible0%

There are no reviews yet. Be the first one to write one.