def setUpTimetables():
    app = ISchoolToolApplication(None)
    TimetableStartUp(app)()
    syc = ISchoolYearContainer(app)
    sy = syc.getActiveSchoolYear()
    timetables = ITimetableContainer(sy)
    timetables[u'rotating'] = tt_rot = Timetable(sy.first,
                                                 sy.last,
                                                 title=u"Rotating")

    tt_rot.periods = CalendarDayTemplates()
    initTemplates(tt_rot.periods)
    tt_rot.time_slots = CalendarDayTemplates()
    initTemplates(tt_rot.time_slots)
    addTimetableDays(tt_rot, [('1', 'Day 1'), ('2', 'Day 2'), ('3', 'Day 3')],
                     ['A', 'B', 'C'])

    timetables[u'weekly'] = tt_week = Timetable(sy.first,
                                                sy.last,
                                                title=u"Weekly")

    tt_week.periods = WeekDayTemplates()
    initTemplates(tt_week.periods)
    tt_week.time_slots = WeekDayTemplates()
    initTemplates(tt_week.time_slots)

    dows = [
        'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
        'Sunday'
    ]
    week_days = [(unicode(n), title) for n, title in enumerate(dows)]

    addTimetableDays(tt_week, week_days, ['A', 'B', 'C'])
Example #2
0
    def export_sections_enrollment(self, wb):
        self.task_progress.force('export_sections_enrollment', active=True)
        ws = wb.add_sheet("SectionEnrollment")

        row = 0
        years = ISchoolYearContainer(self.context)
        total_years = len(years)
        for ny, year in enumerate(sorted(years.values(), key=lambda year: year.first)):
            total_terms = len(year)
            for nt, term in enumerate(sorted(year.values(), key=lambda term: term.first)):
                sections = ISectionContainer(term)
                total_sections = len(sections)
                for ns, section in enumerate(sorted(sections.values(),
                                                    key=lambda section: section.__name__)):
                    row = self.export_section_enrollment(
                        ws, year, term, section, row=row)
                    self.progress(
                        'export_sections_enrollment',
                        normalized_progress(
                            ny, total_years,
                            nt, total_terms,
                            ns, total_sections,
                            ))

        self.finish('export_sections_enrollment')
def setUpTimetables():
    app = ISchoolToolApplication(None)
    TimetableStartUp(app)()
    syc = ISchoolYearContainer(app)
    sy = syc.getActiveSchoolYear()
    timetables = ITimetableContainer(sy)
    timetables[u'rotating'] = tt_rot = Timetable(
        sy.first, sy.last, title=u"Rotating")

    tt_rot.periods = CalendarDayTemplates()
    tt_rot.periods.initTemplates()
    tt_rot.time_slots = CalendarDayTemplates()
    tt_rot.time_slots.initTemplates()
    addTimetableDays(
        tt_rot,
        [('1', 'Day 1'), ('2', 'Day 2'), ('3', 'Day 3')],
        ['A', 'B', 'C'])

    timetables[u'weekly'] = tt_week = Timetable(
        sy.first, sy.last, title=u"Weekly")

    tt_week.periods = WeekDayTemplates()
    tt_week.periods.initTemplates()
    tt_week.time_slots = WeekDayTemplates()
    tt_week.time_slots.initTemplates()

    dows = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
            'Friday', 'Saturday', 'Sunday']
    week_days = [(unicode(n), title)
                 for n, title in enumerate(dows)]

    addTimetableDays(
        tt_week,
        week_days,
        ['A', 'B', 'C'])
Example #4
0
    def export_sections_enrollment(self, wb):
        self.task_progress.force('export_sections_enrollment', active=True)
        ws = wb.add_sheet("SectionEnrollment")

        row = 0
        years = ISchoolYearContainer(self.context)
        total_years = len(years)
        for ny, year in enumerate(
                sorted(years.values(), key=lambda year: year.first)):
            total_terms = len(year)
            for nt, term in enumerate(
                    sorted(year.values(), key=lambda term: term.first)):
                sections = ISectionContainer(term)
                total_sections = len(sections)
                for ns, section in enumerate(
                        sorted(sections.values(),
                               key=lambda section: section.__name__)):
                    row = self.export_section_enrollment(ws,
                                                         year,
                                                         term,
                                                         section,
                                                         row=row)
                    self.progress(
                        'export_sections_enrollment',
                        normalized_progress(
                            ny,
                            total_years,
                            nt,
                            total_terms,
                            ns,
                            total_sections,
                        ))

        self.finish('export_sections_enrollment')
Example #5
0
 def __call__(self):
     app = ISchoolToolApplication(None)
     syc = ISchoolYearContainer(app)
     activeSchoolyear = syc.getActiveSchoolYear()
     if activeSchoolyear is not None:
         self.importDefaultGroups(activeSchoolyear)
     else:
         self.initializeGroupContainer()
Example #6
0
 def schoolyears(self):
     app = ISchoolToolApplication(None)
     schoolyears = ISchoolYearContainer(app)
     active_schoolyear = schoolyears.getActiveSchoolYear()
     return [
         schoolyear for schoolyear in schoolyears.values()
         if schoolyear.first >= active_schoolyear.first
     ]
Example #7
0
def evolve(context):
    linkcatalogs.ensureEvolved(context)
    root = getRootFolder(context)

    old_site = getSite()
    app = root
    setSite(app)
    persons = ISchoolToolApplication(None)['persons']
    manager = persons.super_user
    if manager is not None:
        syc = ISchoolYearContainer(app)
        for sy in syc.values():
            makeManager(app, sy, manager)

    setSite(old_site)
Example #8
0
    def setUp(self):
        layeredTestSetup()
        app = ISchoolToolApplication(None)
        self.person = app['persons']['person'] = Person('person')

        # set up schoolyear
        from schooltool.schoolyear.schoolyear import SchoolYear
        from schooltool.schoolyear.interfaces import ISchoolYearContainer
        ISchoolYearContainer(app)['2004'] = SchoolYear("2004",
                                                       date(2004, 9, 1),
                                                       date(2004, 12, 31))

        # set up the timetable schema
        days = ['A', 'B', 'C']
        schema = self.createSchema(days, ['1', '2', '3', '4'],
                                   ['1', '2', '3', '4'], ['1', '2', '3', '4'])
        schema.timezone = 'Europe/London'
        template = SchooldayTemplate()
        template.add(SchooldaySlot(time(8, 0), timedelta(hours=1)))
        template.add(SchooldaySlot(time(10, 15), timedelta(hours=1)))
        template.add(SchooldaySlot(time(11, 30), timedelta(hours=1)))
        template.add(SchooldaySlot(time(12, 30), timedelta(hours=2)))
        schema.model = SequentialDaysTimetableModel(days, {None: template})

        ITimetableSchemaContainer(app)['default'] = schema

        # set up terms
        from schooltool.term.term import Term
        terms = ITermContainer(app)
        terms['term'] = term = Term("Some term", date(2004, 9, 1),
                                    date(2004, 12, 31))
        term.add(date(2004, 11, 5))
Example #9
0
    def export_sections(self, wb):
        self.task_progress.force('export_sections', active=True)
        ws = wb.add_sheet("Sections")
        headers = [
            "School Year", "Courses", "Term", "Section ID", "Previous ID",
            "Next ID", "Title", "Description", "Resources"
        ]
        for index, header in enumerate(headers):
            self.write_header(ws, 0, index, header)

        sections = []
        for year in ISchoolYearContainer(self.context).values():
            for term in year.values():
                for section in ISectionContainer(term).values():
                    if not list(section.courses):
                        continue
                    courses = ', '.join([c.__name__ for c in section.courses])
                    sections.append((year, courses, term.first, term,
                                     section.__name__, section))

        row = 1
        sections.sort()
        n_sections = len(sections)
        for n, (year, courses, first, term, section_id,
                section) in enumerate(sections):
            self.format_section(year, courses, term, section, ws, row)
            self.progress('export_sections',
                          normalized_progress(n, n_sections))
            row += 1
        self.finish('export_sections')
Example #10
0
 def getTargets(self, keys):
     if not keys:
         return []
     result = []
     sy_groups = {}
     app = ISchoolToolApplication(None)
     schoolyears = ISchoolYearContainer(app)
     for key in keys:
         for sy_name, schoolyear in schoolyears.items():
             if not key.startswith(sy_name+'.'):
                 continue
             if sy_name not in sy_groups:
                 sy_groups[sy_name] = IGroupContainer(schoolyear)
             group = sy_groups[sy_name].get(key[len(sy_name)+1:])
             if group is not None:
                 result.append(group)
     return result
Example #11
0
 def getTargets(self, keys):
     if not keys:
         return []
     result = []
     sy_groups = {}
     app = ISchoolToolApplication(None)
     schoolyears = ISchoolYearContainer(app)
     for key in keys:
         for sy_name, schoolyear in schoolyears.items():
             if not key.startswith(sy_name + '.'):
                 continue
             if sy_name not in sy_groups:
                 sy_groups[sy_name] = IGroupContainer(schoolyear)
             group = sy_groups[sy_name].get(key[len(sy_name) + 1:])
             if group is not None:
                 result.append(group)
     return result
Example #12
0
def evolve(context):
    root = context.connection.root().get(ZopePublication.root_name, None)

    old_site = getSite()
    apps = findObjectsProviding(root, ISchoolToolApplication)
    for app in apps:
        for year in ISchoolYearContainer(app).values():
            fixYear(year, app)
    setSite(old_site)
Example #13
0
def guessMostRecentLevels(app):
    container = app.get(LEVELS_APP_KEY)
    if (container is None
            or not isinstance(container, LevelContainerContainer)):
        return None
    levels = None
    syc = ISchoolYearContainer(app, None)
    int_ids = getUtility(IIntIds)

    years = list(reversed(syc.sorted_schoolyears))
    active_year = syc.getActiveSchoolYear()
    if active_year is not None:
        years = [active_year] + years
    for year in years:
        sy_id = str(int_ids.getId(year))
        levels = container.get(sy_id, None)
        if levels is not None:
            return levels
    return None
Example #14
0
def evolve(context):
    linkcatalogs.ensureEvolved(context)
    root = getRootFolder(context)
    old_site = getSite()

    app = root
    setSite(app)
    syc = ISchoolYearContainer(app)
    if not syc.values():
        setSite(old_site)
        return

    sy = syc.getActiveSchoolYear()
    if sy is None:
        sy = syc.values()[-1]
    for person in app['persons'].values():
        evolvePerson(app, sy, person)

    setSite(old_site)
Example #15
0
def guessMostRecentLevels(app):
    container = app.get(LEVELS_APP_KEY)
    if (container is None or
        not isinstance(container, LevelContainerContainer)):
        return None
    levels = None
    syc = ISchoolYearContainer(app, None)
    int_ids = getUtility(IIntIds)

    years = list(reversed(syc.sorted_schoolyears))
    active_year = syc.getActiveSchoolYear()
    if active_year is not None:
        years = [active_year] + years
    for year in years:
        sy_id = str(int_ids.getId(year))
        levels = container.get(sy_id, None)
        if levels is not None:
            return levels
    return None
Example #16
0
 def format_school_years(self):
     fields = [('ID', Text, attrgetter('__name__')),
               ('Title', Text, attrgetter('title')),
               ('Start', Date, attrgetter('first')),
               ('End', Date, attrgetter('last'))]
     items = ISchoolYearContainer(self.context).values()
     result = self.format_table(fields,
                                items,
                                importer='export_school_years')
     return result
def setUpYear():
    app = ISchoolToolApplication(None)
    syc = ISchoolYearContainer(app)
    syc['2010-2011'] = SchoolYear(u'2010-2011', datetime.date(2010, 9, 1),
                                  datetime.date(2011, 5, 30))
    syc['2010-2011'][u'fall'] = Term(u'Fall', datetime.date(2010, 9, 1),
                                     datetime.date(2010, 11, 30))
    syc['2010-2011'][u'winter'] = Term(u'Winter', datetime.date(2010, 12, 1),
                                       datetime.date(2011, 2, 28))
    syc['2010-2011'][u'spring'] = Term(u'Spring', datetime.date(2011, 3, 1),
                                       datetime.date(2011, 5, 30))
Example #18
0
def setUpSchool(app):
    sy = ISchoolYearContainer(app)['2005'] = SchoolYear(
        '2005', date(2005, 1, 1), date(2005, 1, 30))

    term = sy['spring'] = Term('Spring', date(2005, 1, 1), date(2005, 1, 30))
    term.addWeekdays(0, 1, 2, 3, 4)

    pc = app['persons']
    teacher = pc['teacher'] = BasicPerson("teacher", "Mister", "T")
    s1 = pc['john'] = BasicPerson("john", "John", "Peterson")
    s2 = pc['pete'] = BasicPerson("pete", "Pete", "Johnson")

    contacts = IContactContainer(app)
    contact = Contact()
    contact.__name__ = 'pete_parent'
    contact.prefix = 'Ms.'
    contact.first_name = 'Susan'
    contact.middle_name = 'T.'
    contact.last_name = 'Johnson'
    contact.suffix = 'Jr.'
    contact.address_line_1 = '1 First St.'
    contact.address_line_2 = 'Apt. 1'
    contact.city = 'NY'
    contact.state = 'NY'
    contact.country = 'USA'
    contact.postal_code = '00000'
    contact.email = '*****@*****.**'
    contact.home_phone = '000-0000'
    contact.work_phone = '111-1111'
    contact.mobile_phone = '222-2222'
    contact.language = 'English'
    contacts['pete_parent'] = contact

    IContactable(s2).contacts.relate(contact, ACTIVE + PARENT, 'p')
    IContactable(s2).contacts.relate(IContact(teacher), ACTIVE + PARENT, 'p')

    d1 = IDemographics(s1)
    d1['ID'] = "112323"
    d1['ethnicity'] = u'Asian'
    d1['language'] = "English"
    d1['placeofbirth'] = "Humptington"
    d1['citizenship'] = "US"
    d2 = IDemographics(s2)
    d2['ID'] = "333655"
    d2['ethnicity'] = u'White'
    d2['language'] = "Brittish"
    d2['placeofbirth'] = "Providence"
    d2['citizenship'] = "UK"

    course = ICourseContainer(sy)['c1'] = Course("History")
Example #19
0
    def setUp(self):
        placefulSetUp()
        provideAdapter(getTermContainer, [Interface], ITermContainer)
        provideAdapter(getSchoolYearContainer)
        app = setup.setUpSchoolToolSite()

        schoolyear = SchoolYear("Sample", date(2004, 9, 1), date(2005, 12, 20))
        ISchoolYearContainer(app)['2004-2005'] = schoolyear

        self.term1 = term.Term('Sample', date(2004, 9, 1), date(2004, 12, 20))
        self.term2 = term.Term('Sample', date(2005, 1, 1), date(2005, 6, 1))
        terms = ITermContainer(app)
        terms['2004-fall'] = self.term1
        terms['2005-spring'] = self.term2
        self.app = app
Example #20
0
    def calculate_holidays_and_weekdays(self):

        work_days = 0.0

        days_of_week = {}
        for dow in range(7):
            days_of_week[dow] = [0, 0]

        school_years = ISchoolYearContainer(self.context).values()
        for school_year in school_years:
            terms = ITermContainer(school_year).values()
            for term in terms:
                for date in term:
                    if term.isSchoolday(date):
                        days_of_week[date.weekday()][0] += 1
                        work_days += 1
                    else:
                        days_of_week[date.weekday()][1] += 1

        if work_days == 0:
            return [[], list(range(7)), []]

        coefficients = [
            counts[0] / work_days
            for day, counts in sorted(days_of_week.items())
        ]

        # Weekends
        weekends = []
        for n, k in enumerate(coefficients):
            if k < 0.1:
                weekends.append(n)

        # Weekend exceptions and holidays
        holidays = []
        weekend_exceptions = []
        for school_year in school_years:
            terms = ITermContainer(school_year).values()
            for term in terms:
                for date in term:
                    if term.isSchoolday(date) and date.weekday() in weekends:
                        weekend_exceptions.append(date)
                    elif not term.isSchoolday(date) and date.weekday(
                    ) not in weekends:
                        holidays.append(date)

        holiday_ranges = merge_date_ranges(holidays)
        return [holiday_ranges, weekends, weekend_exceptions]
Example #21
0
    def format_terms(self):
        fields = [('SchoolYear', Text, lambda t: t.__parent__.__name__),
                  ('ID', Text, attrgetter('__name__')),
                  ('Title', Text, attrgetter('title')),
                  ('Start', Date, attrgetter('first')),
                  ('End', Date, attrgetter('last'))]

        school_years = ISchoolYearContainer(self.context).values()
        items = []
        for year in school_years:
            items.extend([term for term in ITermContainer(year).values()])
        terms_table = self.format_table(fields, items, importer='export_terms')
        holidays, weekends, exceptions = self.calculate_holidays_and_weekdays()
        terms_table.extend(self.format_holidays(holidays))
        terms_table.extend(self.format_weekends(weekends))
        terms_table.extend(self.format_weekend_exceptions(exceptions))
        return terms_table
Example #22
0
 def export_groups(self, wb):
     self.task_progress.force('export_groups', active=True)
     ws = wb.add_sheet("Groups")
     school_years = sorted(ISchoolYearContainer(self.context).values(),
                           key=lambda s: s.first)
     row = 0
     for ny, school_year in enumerate(
             sorted(school_years, key=lambda i: i.last)):
         groups = IGroupContainer(school_year)
         for ng, group in enumerate(
                 sorted(groups.values(), key=lambda i: i.__name__)):
             row = self.format_group(group, ws, row) + 1
             self.progress(
                 'export_groups',
                 normalized_progress(ny, len(school_years), ng,
                                     len(groups)))
     self.finish('export_groups')
Example #23
0
 def export_school_timetables(self, wb):
     self.task_progress.force('export_school_timetables', active=True)
     ws = wb.add_sheet("School Timetables")
     school_years = sorted(ISchoolYearContainer(self.context).values(),
                           key=lambda s: s.first)
     row = 0
     for ny, school_year in enumerate(
             sorted(school_years, key=lambda i: i.last)):
         timetables = ITimetableContainer(school_year)
         for nt, timetable in enumerate(
                 sorted(timetables.values(), key=lambda i: i.__name__)):
             row = self.format_school_timetable(timetable, ws, row) + 1
             self.progress(
                 'export_school_timetables',
                 normalized_progress(ny, len(school_years), nt,
                                     len(timetables)))
     self.finish('export_school_timetables')
Example #24
0
    def export_section_timetables(self, wb):
        self.task_progress.force('export_section_timetables', active=True)
        ws = wb.add_sheet("SectionTimetables")

        year_sections = {}
        for year in ISchoolYearContainer(self.context).values():
            sections = year_sections[year] = {}
            for term in year.values():
                for section in ISectionContainer(term).values():
                    if not list(section.courses):
                        continue
                    timetables = []
                    for schedule in IScheduleContainer(section).values():
                        if schedule.timetable.__name__ is None:
                            # LP: #1281335
                            continue
                        parts = [schedule.timetable.__name__]
                        if schedule.consecutive_periods_as_one:
                            parts.append('yes')
                        else:
                            parts.append('no')
                        for period in schedule.periods:
                            day = period.__parent__
                            parts.append(day.title)
                            parts.append(period.title)
                        timetables.append(','.join(parts))
                    if not len(timetables):
                        continue
                    timetables = tuple(timetables)
                    timetable_sections = sections.setdefault(timetables, [])
                    timetable_sections.append(
                        (term.first, term, section.__name__, section))

        row = 0
        for ny, (year, sections) in enumerate(sorted(year_sections.items())):
            for nt, (timetables, timetable_sections) in enumerate(
                    sorted(sections.items())):
                row = self.format_timetable_sections(year, timetable_sections,
                                                     ws, row)
                row = self.format_timetables_block(timetables, ws, row)
                self.progress(
                    'export_section_timetables',
                    normalized_progress(ny, len(year_sections), nt,
                                        len(sections)))
        self.finish('export_section_timetables')
Example #25
0
    def format_courses(self):
        def get_course_level(course):
            return ', '.join([l.__name__ for l in course.levels])

        fields = [('School Year', Text, lambda c: ISchoolYear(c).__name__),
                  ('ID', Text, attrgetter('__name__')),
                  ('Title', Text, attrgetter('title')),
                  ('Description', Text, attrgetter('description')),
                  ('Local ID', Text, attrgetter('course_id')),
                  ('Government ID', Text, attrgetter('government_id')),
                  ('Credits', Text, attrgetter('credits')),
                  ('Grade Level ID', Text, get_course_level)]

        school_years = ISchoolYearContainer(self.context).values()
        items = []
        for year in school_years:
            items.extend([term for term in ICourseContainer(year).values()])
        return self.format_table(fields, items, importer='export_courses')
Example #26
0
    def generate(self, app, seed=None):
        date = datetime.date

        syc = ISchoolYearContainer(app)
        syc['2005-2006'] = SchoolYear("2005-2006",
                                      date(2005, 8, 22),
                                      date(2006, 12, 22))

        fall = term.Term('2005-fall', date(2005, 8, 22), date(2005, 12, 23))
        fall.addWeekdays(0, 1, 2, 3, 4)
        terms = ITermContainer(app)
        terms['2005-fall'] = fall

        spring = term.Term('2006-spring', date(2006, 1, 26), date(2006, 5, 31))
        spring.addWeekdays(0, 1, 2, 3, 4)
        terms['2006-spring'] = spring

        fall = term.Term('2006-fall', date(2006, 8, 21), date(2006, 12, 22))
        fall.addWeekdays(0, 1, 2, 3, 4)
        terms['2006-fall'] = fall
Example #27
0
    def setUp(self):
        layeredTestSetup()
        app = ISchoolToolApplication(None)

        from schooltool.schoolyear.schoolyear import SchoolYear
        from schooltool.schoolyear.interfaces import ISchoolYearContainer
        ISchoolYearContainer(app)['2004-2005'] = SchoolYear(
            "2004-2005", date(2004, 9, 1), date(2005, 8, 1))

        from schooltool.term.term import Term
        self.term1 = Term('Sample', date(2004, 9, 1), date(2004, 12, 20))
        self.term1.schooldays = [
            ('A', time(9, 0), timedelta(minutes=115)),
            ('B', time(11, 0), timedelta(minutes=115)),
            ('C', time(13, 0), timedelta(minutes=115)),
            ('D', time(15, 0), timedelta(minutes=115)),
        ]
        self.term2 = Term('Sample', date(2005, 1, 1), date(2005, 6, 1))
        self.term2.schooldays = []
        terms = ITermContainer(app)
        terms['2004-fall'] = self.term1
        terms['2005-spring'] = self.term2

        class TimetableModelStub:
            def periodsInDay(this, schooldays, ttschema, date):
                if date not in schooldays:
                    raise "This date is not in the current term!"
                if ttschema == self.tt:
                    return schooldays.schooldays
                else:
                    return []

        tt = TimetableSchema([])
        tt.model = TimetableModelStub()
        tt.timezone = 'Europe/London'
        self.tt = tt
        ttschemas = ITimetableSchemaContainer(app)
        ttschemas['default'] = tt
        self.app = app
Example #28
0
def getGroupContainerForApp(app):
    syc = ISchoolYearContainer(app)
    sy = syc.getActiveSchoolYear()
    if sy is None:
        return None
    return IGroupContainer(sy)
Example #29
0
 def schoolyears(self):
     return ISchoolYearContainer(ISchoolToolApplication(None))
Example #30
0
def getTermContainer(context):
    app = ISchoolToolApplication(None)
    syc = ISchoolYearContainer(app)
    return syc.getActiveSchoolYear()
Example #31
0
 def schoolyears(self):
     syc = ISchoolYearContainer(self.context)
     return syc
Example #32
0
 def url(self):
     schoolyears = ISchoolYearContainer(self.context)
     return absoluteURL(schoolyears, self.request) + '/add.html'
Example #33
0
 def activeSchoolYear(self):
     """Return the active school year."""
     return ISchoolYearContainer(
         ISchoolToolApplication(None)).getActiveSchoolYear()
Example #34
0
 def nextSchoolYear(self):
     """Return the next school year."""
     syc = ISchoolYearContainer(ISchoolToolApplication(None))
     if checkPermission("schooltool.edit", syc):
         return syc.getNextSchoolYear()
Example #35
0
def getCourseContainerForApp(app):
    syc = ISchoolYearContainer(app)
    sy = syc.getActiveSchoolYear()
    if sy is not None:
        return ICourseContainer(sy)
Example #36
0
def getTermContainer(context):
    app = ISchoolToolApplication(None)
    syc = ISchoolYearContainer(app)
    return syc.getActiveSchoolYear()
Example #37
0
def get_active_year():
    schoolyears = ISchoolYearContainer(ISchoolToolApplication(None))
    return schoolyears.getActiveSchoolYear()
Example #38
0
 def nextSchoolYear(self):
     """Return the next school year."""
     syc = ISchoolYearContainer(ISchoolToolApplication(None))
     if checkPermission("schooltool.edit", syc):
         return syc.getNextSchoolYear()
Example #39
0
def get_active_year():
    schoolyears = ISchoolYearContainer(ISchoolToolApplication(None))
    return schoolyears.getActiveSchoolYear()
Example #40
0
 def schoolyears(self):
     app = ISchoolToolApplication(None)
     schoolyears = ISchoolYearContainer(app)
     active_schoolyear = schoolyears.getActiveSchoolYear()
     return [schoolyear for schoolyear in schoolyears.values()
             if schoolyear.first >= active_schoolyear.first]
Example #41
0
def getTermContainerForDate(date):
    app = ISchoolToolApplication(None)
    syc = ISchoolYearContainer(app)
    year = syc.getLastSchoolYearForDate(date)
    term_container = ITermContainer(year, None)
    return term_container