Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFCalendar.browser.calendartool.CalendarView Class Reference
Inheritance diagram for CMFCalendar.browser.calendartool.CalendarView:
Inheritance graph
[legend]
Collaboration diagram for CMFCalendar.browser.calendartool.CalendarView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def viewDay
def formattedDate
def previousDayURL
def nextDayURL
def listItemInfos

Private Member Functions

def _getStartAsString
def _getEndAsString

Detailed Description

Helper class for calendar-related templates

Definition at line 25 of file calendartool.py.


Member Function Documentation

def CMFCalendar.browser.calendartool.CalendarView._getEndAsString (   self,
  event_brain 
) [private]
Retrieve formatted end string

Definition at line 44 of file calendartool.py.

00044 
00045     def _getEndAsString(self, event_brain):
00046         """ Retrieve formatted end string
00047         """
00048         day = self.viewDay()
00049         event_end = event_brain.getObject().end()
00050         last_date = DateTime(day.Date()+" 23:59:59")
00051 
00052         if event_end > last_date:
00053             return event_end.aCommon()[:12]
00054         else:
00055             return event_end.TimeMinutes()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCalendar.browser.calendartool.CalendarView._getStartAsString (   self,
  event_brain 
) [private]
Retrieve formatted start string

Definition at line 32 of file calendartool.py.

00032 
00033     def _getStartAsString(self, event_brain):
00034         """ Retrieve formatted start string
00035         """
00036         day = self.viewDay()
00037         event_start = event_brain.getObject().start()
00038         first_date = DateTime(day.Date()+" 00:00:00")
00039 
00040         if event_start < first_date:
00041             return event_start.aCommon()[:12]
00042         else:
00043             return event_start.TimeMinutes()

Here is the call graph for this function:

Here is the caller graph for this function:

Return a simple formatted date string

Definition at line 67 of file calendartool.py.

00067 
00068     def formattedDate(self):
00069         """ Return a simple formatted date string
00070         """
00071         return self.viewDay().aCommon()[:12]

Here is the call graph for this function:

List item infos for all event catalog records for a specific day.

Definition at line 92 of file calendartool.py.

00092 
00093     def listItemInfos(self):
00094         """ List item infos for all event catalog records for a specific day.
00095         """
00096         caltool = self._getTool('portal_calendar')
00097         thisDay = self.viewDay()
00098 
00099         items = [ {'title': item.Title,
00100                    'url': item.getURL(),
00101                    'start': self._getStartAsString(item),
00102                    'stop': self._getEndAsString(item)}
00103                   for item in caltool.getEventsForThisDay(thisDay) ]
00104 
00105         return tuple(items)
00106 

Here is the call graph for this function:

URL to the next day's view

Definition at line 82 of file calendartool.py.

00082 
00083     def nextDayURL(self):
00084         """ URL to the next day's view
00085         """
00086         day = self.viewDay()
00087         view_url = self._getViewURL()
00088 
00089         return '%s?date=%s' % (view_url, (day+1).Date())

Here is the call graph for this function:

URL to the previous day's view

Definition at line 73 of file calendartool.py.

00073 
00074     def previousDayURL(self):
00075         """ URL to the previous day's view
00076         """
00077         day = self.viewDay()
00078         view_url = self._getViewURL()
00079 
00080         return '%s?date=%s' % (view_url, (day-1).Date())

Here is the call graph for this function:

Return a DateTime for a passed-in date or today

Definition at line 57 of file calendartool.py.

00057 
00058     def viewDay(self):
00059         """ Return a DateTime for a passed-in date or today
00060         """
00061         date = self.request.get('date', None) or DateTime().aCommon()[:12]
00062 
00063         return DateTime(date)

Here is the caller graph for this function:


The documentation for this class was generated from the following file: