2006-06-15 21:34:10 +02:00
|
|
|
|
2007-07-12 17:59:31 +02:00
|
|
|
#import <NGExtensions/NSCalendarDate+misc.h>
|
|
|
|
|
|
|
|
#import <SOGoUI/SOGoAptFormatter.h>
|
|
|
|
|
|
|
|
#import "UIxCalMonthOverview.h"
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
@implementation UIxCalMonthOverview
|
|
|
|
|
|
|
|
- (void)dealloc {
|
2008-03-10 16:04:01 +01:00
|
|
|
[currentWeekStart release];
|
2006-06-15 21:34:10 +02:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)configureFormatters {
|
|
|
|
[super configureFormatters];
|
|
|
|
|
2008-03-10 16:04:01 +01:00
|
|
|
[aptFormatter setShortTitleOnly];
|
|
|
|
[privateAptFormatter setPrivateTitleOnly];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setDayIndex:(int)_idx {
|
2008-03-10 16:04:01 +01:00
|
|
|
dayIndex = _idx;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int)dayIndex {
|
2008-03-10 16:04:01 +01:00
|
|
|
return dayIndex;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setDayOfWeek:(int)_day {
|
2008-03-10 16:04:01 +01:00
|
|
|
dayOfWeek = _day;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int)dayOfWeek {
|
2008-03-10 16:04:01 +01:00
|
|
|
return dayOfWeek;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setCurrentWeekStartDate:(NSCalendarDate *)_date {
|
2008-03-10 16:04:01 +01:00
|
|
|
ASSIGN(currentWeekStart, _date);
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSCalendarDate *)currentWeekStartDate {
|
2008-03-10 16:04:01 +01:00
|
|
|
return currentWeekStart;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setWeekOfYear:(int)_week {
|
2008-03-10 16:04:01 +01:00
|
|
|
NSCalendarDate *date;
|
2006-06-15 21:34:10 +02:00
|
|
|
|
2008-03-10 16:04:01 +01:00
|
|
|
weekOfYear = _week;
|
|
|
|
if(_week == 52 || _week == 53)
|
|
|
|
date = [[self startOfMonth] mondayOfWeek];
|
|
|
|
else
|
|
|
|
date = [self startOfMonth];
|
|
|
|
date = [date mondayOfWeek:_week];
|
|
|
|
[self setCurrentWeekStartDate:date];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int)weekOfYear {
|
2008-03-10 16:04:01 +01:00
|
|
|
return weekOfYear;
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int)year {
|
2008-03-10 16:04:01 +01:00
|
|
|
return [[self startOfMonth] yearOfCommonEra];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int)month {
|
2008-03-10 16:04:01 +01:00
|
|
|
return [[self startOfMonth] monthOfYear];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)localizedDayOfWeekName {
|
2008-03-10 16:04:01 +01:00
|
|
|
return [self localizedNameForDayOfWeek:dayOfWeek];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSDictionary *)currentWeekQueryParameters {
|
2008-03-10 16:04:01 +01:00
|
|
|
return [self queryParametersBySettingSelectedDate:currentWeekStart];
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* style sheet */
|
|
|
|
|
|
|
|
|
|
|
|
- (NSString *)weekStyle {
|
2008-03-10 16:04:01 +01:00
|
|
|
if([currentWeekStart isDateInSameWeek:[NSCalendarDate date]])
|
|
|
|
return @"monthoverview_week_hilite";
|
|
|
|
return @"monthoverview_week";
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *)contentStyle {
|
2008-03-10 16:04:01 +01:00
|
|
|
if([currentDay isToday])
|
|
|
|
return @"monthoverview_content_hilite";
|
|
|
|
else if([currentDay monthOfYear] != [[self startOfMonth] monthOfYear])
|
|
|
|
return @"monthoverview_content_dimmed";
|
|
|
|
return @"monthoverview_content";
|
2006-06-15 21:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* appointments */
|
|
|
|
|
|
|
|
|
2007-07-12 17:59:31 +02:00
|
|
|
// - (NSArray *)appointments {
|
|
|
|
// return [self fetchCoreAppointmentsInfos];
|
|
|
|
// }
|
2006-06-15 21:34:10 +02:00
|
|
|
|
|
|
|
@end /* UIxCalMonthOverview */
|