Lightweight, Component-based, and Database-oriented Web Application Framework

About | Overview | Documentation


Documentation > Modules and APIs > Calendar




The core module to generate calendar data inside the standard Webman's application calendar table. Calendar's table name exist in the database in the form of "webman_appname_calendar".



Webman-framework's Core Modules:

  • DB_Utilities (Composition)


1. Instantiation and Basic Parameter Setting

The passed arguments $cgi and $db_conn are other Webman-framework core modules instances. The $cgi is an instance of GMM_CGI module and the $db_conn is an instance of database connection created using DBI module.

my $calendar = new Calendar;


2. Calendar Data Initiation

Initiate and generate basic calendar data (if not exist) inside application's calendar table.


3. Calendar Member Data

Available member variables after calendar data initiation.

my $year = $calendar->{current_year};   ### $year => "yyyy"
my $month = $calendar->{current_month}; ### $month => "Jan", ... , "Dec"
my $date = $calendar->{current_date};   ### $date => 1, ... , 31
my $day = $calendar->{current_day};     ### $day => "Mon", ... , "Sun"

4. Week's Date Information List

The key date ($key_date) is an ISO standard "yyyy-mm-dd" date string that within the range of the week's date. The returned @week_date is an array of hash reference with the keys are consists of 'cal_id', 'year', 'month', 'date', 'day', 'month_abbr', 'day_abbr', and 'iso_ymd'.

my @week_date = $calendar->{calendar}->get_Weekly_Date_Info($key_date);

5. Month's Date Information List

Year and month passed as a separate arguments. The $month_abbr is month string abbreviation: "Jan", ... , "Dec". The returned @month_date has the same structure as the above @week_date array of reference.

my @month_date = $calendar->get_Monthly_Date_Info("yyyy", $month_abbr);

6. Intermediate Date Information List

The arguments $date_start and $date_end are ISO standard "yyyy-mm-dd" date string. The returned @list_date has has the same structure with the above @week_date and @month_date but the date list might accross different weeks, months, or years within the range set via $date_start and $date_end.

my @list_date = $calendar->get_Intermediate_Date_Info($date_start, $date_end);