Esempio n. 1
0
 def legend(self):
     numterms = 1
     legend = {}
     terms = ITermContainer(self.cursor, {})
     for quarter in self.getYear(self.cursor):
         for month in quarter:
             for week in month:
                 for day in week:
                     term = None
                     for term in terms.values():
                         if day.date in term:
                             break
                     if term and not term in legend:
                         legend[term] = self.numterms
                         numterms += 1
     return legend
Esempio n. 2
0
 def legend(self):
     numterms = 1
     legend = {}
     terms = ITermContainer(self.cursor, {})
     for quarter in self.getYear(self.cursor):
         for month in quarter:
             for week in month:
                 for day in week:
                     term = None
                     for term in terms.values():
                         if day.date in term:
                             break
                     if term and not term in legend:
                         legend[term] = self.numterms
                         numterms += 1
     return legend
Esempio n. 3
0
    def renderRow(self, week, month):
        result = []

        terms = ITermContainer(self.cursor, {})

        for day in week:
            term = None
            for term in terms.values():
                if day.date in term:
                    break
            cssClass = "term%d" % self.legend.get(term, 0)
            result.append('<td class="cal_yearly_day">')
            if day.date.month == month:
                if day.today():
                    cssClass += ' today'
                # Let us hope that URLs will not contain < > & or "
                # This is somewhat related to
                # https://bugs.launchpad.net/schooltool/+bug/79781
                result.append('<a href="%s" class="%s">%s</a>' %
                              (self.calURL('daily', day.date), cssClass,
                               day.date.day))
            result.append('</td>')

        return "\n".join(result)
Esempio n. 4
0
    def renderRow(self, week, month):
        result = []

        terms = ITermContainer(self.cursor, {})

        for day in week:
            term = None
            for term in terms.values():
                if day.date in term:
                    break
            cssClass = "term%d" % self.legend.get(term, 0)
            result.append('<td class="cal_yearly_day">')
            if day.date.month == month:
                if day.today():
                    cssClass += ' today'
                # Let us hope that URLs will not contain < > & or "
                # This is somewhat related to
                # https://bugs.launchpad.net/schooltool/+bug/79781
                result.append(
                    '<a href="%s" class="%s">%s</a>' %
                    (self.calURL('daily', day.date), cssClass, day.date.day))
            result.append('</td>')

        return "\n".join(result)
Esempio n. 5
0
 def terms(self):
     terms = ITermContainer(self.schoolyear, None)
     if terms is not None:
         return sorted(terms.values(), key=lambda t:t.first)
 def findTerm(self, title):
     terms = ITermContainer(self.schoolyear)
     for term in terms.values():
         if term.title == title:
             return term
     return None
Esempio n. 7
0
 def findTerm(self, title):
     terms = ITermContainer(self.schoolyear)
     for term in terms.values():
         if term.title == title:
             return term
     return None