NAME

Calendar::Model - Simple class modelling Calendars

VERSION

Version 0.04

SYNOPSIS

    use Calendar::Model;

    my $cal = Calendar::Model->new();

    my $columns = $cal->columns;

    my $rows = $cal->rows;

    my $dates = $cal->as_list;

    my $start_date = $cal->start_date;

    my $selected_date = $cal->selected_date

    my $month = $cal->month; # 3

    my $year  = $cal->year; # 1992

    my $next_month = $cal->next_month; # 4

    my $prev_month = $cal->previous_month; # 2

    my $month_name = $cal->month_name; # March

    my $next_month_name = $cal->month_name('next'); # April

    my $day = $cal->get_day($dt);

    my $events = $schema->resultset('events')->search( date => { between => [$cal->start_date->dmy,$cal->last_entry_day->dmy] });

DESCRIPTION

A simple Model layer providing Classes representing A Calendar containing rows and days

ATTRIBUTES

columns
rows
month
LANG
next_month
previous_month
year
next_year
previous_year
seleted_date
days_of_week
months_of_year

METHODS

new

Class constructor method, returns a Calendar::Model object based on the arguments :

selected_date - optional, defaults to current local/system date, otherwise provide a DateTime object
window - optional, defaults to current month + next/previous days to complete calendar rows, otherwise provide number of days before selected date to show at start.

BUILD

Std Moose initialisation hook called by constructor method

weeks

Object method (lazily) builds and returns rows of Calendar::Model::Day objects, 1 for each week.

as_list

Object method returns all Calendar::Model::Day objects for calendar

month_name

Object method, returns name of current/selected month or takes a string indicating whether to show 'next' or 'previous' month.

    my $month_name = $cal->month_name; # March

    my $next_month_name = $cal->month_name('next'); # April

last_entry_day

Get last day in calendar as a DateTime object

get_day

Get given day from Calendar, takes a DateTime object, returns a Calendar::Modal::Day object

AUTHOR

Aaron Trevena, <teejay at cpan.org>

BUGS

Please report any bugs or feature requests to bug-calendar-model at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Calendar-Model. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Calendar::Model

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Aaron Trevena.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.