ApPHP Calendar v.3.0.3 - Example of code

[View LIVE DEMO]     [Back to Site]
   

    ## +---------------------------------------------------------------------------+
    ## | 1. Creating & Calling:                                                    | 
    ## +---------------------------------------------------------------------------+
    // include calendar class and other files
    require_once("inc/connection.inc.php");
    require_once("calendar.class.php");
    
    ## *** create calendar object
    $objCalendar = new Calendar();
    
    ## +---------------------------------------------------------------------------+
    ## | 2. General Settings:                                                      | 
    ## +---------------------------------------------------------------------------+
    ## +-- Operations & Submission Settings ---------------------------------------+
    ## *** set form submission type: "get" or "post"
    /// $objCalendar->SetSubmissionType("post");
    ## *** show debug info - false|true
    $objCalendar->Debug(false);    
    ##  *** allow editing events in past
    /// $objCalendar->EditingEventsInPast(false);    
    ##  *** set (allow) calendar operations
    $operations = array("add"=>true,
                        "edit"=>true,
                        "details"=>true,
                        "delete"=>true,
                        "manage_events"=>true,
                        "events_statistics"=>true);
    $objCalendar->SetOperations($operations);    
    
    ## +-- Cache Settings ---------------------------------------------------------+
    ## *** define caching parameters:
    ## *** 1st - allow caching or not, 2nd - caching lifetime in minutes
    $objCalendar->SetCachingParameters(true, 15);
    ## *** define all caching pages
    /// $objCalendar->DeleteCache();    
    
    ## +-- Languages --------------------------------------------------------------+
    ##  *** set interface language (default - English)
    ##  *** (en) - English  (es) - Spanish
    $objCalendar->SetInterfaceLang("es");

    ## +-- TimeZone Settings ------------------------------------------------------+
    ## *** set timezone
    ## *** (list of supported Timezones - http://us3.php.net/manual/en/timezones.php)
    $objCalendar->SetTimeZone("America/Los_Angeles");    
    ## *** get current timezone
    /// echo $objCalendar->GetCurrentTimeZone();

    ## +-- Week Settings ----------------------------------------------------------+
    ## *** set week day name length - "short" or "long"
    $objCalendar->SetWeekDayNameLength("long");
    ## *** set start day of week: from 1 (Sanday) to 7 (Saturday)
    $objCalendar->SetWeekStartedDay("1");
    ## *** define showing a week number of year
    $objCalendar->ShowWeekNumberOfYear(true);


    ## +---------------------------------------------------------------------------+
    ## | 3. Visual Settings:                                                       |
    ## +---------------------------------------------------------------------------+
    ## *** set CSS style: "green"|"blue" - default
    $objCalendar->SetCssStyle("blue");
    ## *** set Add Event form type: "popup"|"floating" - default
    $objCalendar->SetAddEventFormType("floating");
    ## *** set calendar width and height
    $objCalendar->SetCalendarDimensions("800px", "500px");
    ## *** set default calendar view - "daily"|"weekly"|"monthly"|"yearly"
    $objCalendar->SetDefaultView("monthly");
    ## *** set displaying type of events in monthly view - "inline"|"tooltip"
    $events_display_type = array("monthly"=>"inline", "weekly"=>"inline");
    $objCalendar->SetEventsDisplayType($events_display_type);
    ## *** set Sunday color - true|false
    $objCalendar->SetSundayColor(true);    
    ## *** define time format - 24|AM/PM
    $objCalendar->SetTimeFormat("24");        
    ## *** define time block - 15|30|60 minutes
    $objCalendar->SetTimeBlock("60");    
    ## *** set calendar caption
    $objCalendar->SetCaption("ApPHP Calendar v".Calendar::Version());


    ## +---------------------------------------------------------------------------+
    ## | 4. Draw Calendar:                                                         | 
    ## +---------------------------------------------------------------------------+
    $objCalendar->Show();