Search in sources :

Example 11 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project OpenOLAT by OpenOLAT.

the class StudyLevelStatisticManager method createColumnDescriptor.

@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column == 0) {
        return new DefaultColumnDescriptor("stat.table.header.node", 0, null, ureq.getLocale());
    }
    if (headerId != null) {
        Translator translator = Util.createPackageTranslator(ShibbolethModule.class, ureq.getLocale());
        if (translator != null) {
            String newHeaderId = translator.translate("swissEduPersonStudyLevel." + headerId);
            if (newHeaderId != null && !newHeaderId.startsWith(Translator.NO_TRANSLATION_ERROR_PREFIX)) {
                headerId = newHeaderId;
            }
        }
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(headerId, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : Translator(org.olat.core.gui.translator.Translator) TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 12 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project openolat by klemens.

the class HourOfDayStatisticManager method createColumnDescriptor.

@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column == 0) {
        return new DefaultColumnDescriptor("stat.table.header.node", 0, null, ureq.getLocale());
    }
    String hourOfDayLocaled = headerId;
    try {
        Calendar c = Calendar.getInstance(ureq.getLocale());
        c.setTime(new Date());
        c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(headerId));
        c.set(Calendar.MINUTE, 0);
        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, ureq.getLocale());
        hourOfDayLocaled = df.format(c.getTime());
    } catch (RuntimeException re) {
        re.printStackTrace(System.out);
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(hourOfDayLocaled, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : Calendar(java.util.Calendar) DateFormat(java.text.DateFormat) TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) Date(java.util.Date)

Example 13 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project openolat by klemens.

the class StudyBranch3StatisticManager method createColumnDescriptor.

@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column == 0) {
        return new DefaultColumnDescriptor("stat.table.header.node", 0, null, ureq.getLocale());
    }
    if (headerId != null) {
        Translator translator = Util.createPackageTranslator(ShibbolethModule.class, ureq.getLocale());
        if (translator != null) {
            String newHeaderId = translator.translate("swissEduPersonStudyBranch3." + headerId);
            if (newHeaderId != null && !newHeaderId.startsWith(Translator.NO_TRANSLATION_ERROR_PREFIX)) {
                headerId = newHeaderId;
            }
        }
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(headerId, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : Translator(org.olat.core.gui.translator.Translator) TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 14 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project openolat by klemens.

the class WeeklyStatisticManager method createColumnDescriptor.

@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column == 0) {
        throw new IllegalStateException("column must never be 0 here");
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(headerId, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor)

Aggregations

TotalAwareColumnDescriptor (org.olat.course.statistic.TotalAwareColumnDescriptor)14 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)10 Translator (org.olat.core.gui.translator.Translator)6 DateFormat (java.text.DateFormat)4 Calendar (java.util.Calendar)4 Date (java.util.Date)4 ParseException (java.text.ParseException)2 SimpleDateFormat (java.text.SimpleDateFormat)2