* @param course
* @param locale
* @return String
*/
public static String createCourseResultsOverviewTable(List identities, List myNodes, ICourse course, Locale locale) {
Translator t = new PackageTranslator(PACKAGE, locale);
StringBuilder tableHeader1 = new StringBuilder();
StringBuilder tableHeader2 = new StringBuilder();
StringBuilder tableContent = new StringBuilder();
StringBuilder table = new StringBuilder();
String sequentialNumber = t.translate("column.header.seqnum");
String login = t.translate("column.header.login");
// user properties are dynamic
String sc = t.translate("column.header.score");
String pa = t.translate("column.header.passed");
String co = t.translate("column.header.comment");
String cco = t.translate("column.header.coachcomment");
String at = t.translate("column.header.attempts");
String na = t.translate("column.field.notavailable");
String mi = t.translate("column.field.missing");
String yes = t.translate("column.field.yes");
String no = t.translate("column.field.no");
tableHeader1.append(sequentialNumber);
tableHeader1.append("\t");
tableHeader2.append("\t");
tableHeader1.append(login);
tableHeader1.append("\t");
tableHeader2.append("\t");
// get user property handlers for this export, translate using the fallback
// translator configured in the property handler
List<UserPropertyHandler> userPropertyHandlers = UserManager.getInstance().getUserPropertyHandlersFor(
ScoreAccountingHelper.class.getCanonicalName(), true);
t = UserManager.getInstance().getPropertyHandlerTranslator(t);
for (UserPropertyHandler propertyHandler : userPropertyHandlers) {
tableHeader1.append(t.translate(propertyHandler.i18nColumnDescriptorLabelKey()));
tableHeader1.append("\t");
tableHeader2.append("\t");
}
// preload user properties cache
course.getCourseEnvironment().getAssessmentManager().preloadCache();
boolean firstIteration = true;
int rowNumber = 1;
Iterator iterIdentities = identities.iterator();
while (iterIdentities.hasNext()) {
Identity identity = (Identity) iterIdentities.next();
String uname = identity.getName();
tableContent.append(rowNumber);
tableContent.append("\t");
tableContent.append(uname);
tableContent.append("\t");
// add dynamic user properties
for (UserPropertyHandler propertyHandler : userPropertyHandlers) {
String value = propertyHandler.getUserProperty(identity.getUser(), t.getLocale());
tableContent.append((StringHelper.containsNonWhitespace(value) ? value : na));
tableContent.append("\t");
}
// create a identenv with no roles, no attributes, no locale