Getting of ApPHP Calendar (version 3.0.0 or above)

[top]

Common Notices

[top]

Syntax.

We use

## for comments
// for lines, that must be uncommented
/// for lines, that may be uncommented (optional)


[top]

Common notes.

Please, use a $debug_mode = true; before you say "Why Nothing Works ?!"

From version 2.0.0 only PHP5 is supported!

Do not put ApPHP Calendar code into another HTML Form: <form>...</form>


[top]

Getting Started

(for version 2.0.0 or above)

[top]

Step 1. Creating & Calling.

+---------------------------------------------------------------------------+
| Creating & Calling:
+---------------------------------------------------------------------------+

Define a relative (virtual) path to ApPHP Calendar folder.
For example: "", "calendar/" or "../calendar/"

// include calendar class and other files
// Ex.: "", "calendar/" or "../calendar/"

define ("CALENDAR_DIR", "");                     
require_once(CALENDAR_DIR."inc/connection.inc.php");
require_once(CALENDAR_DIR."calendar.class.php");        

Now we can create new instance of Calendar object

## *** create calendar object
$objCalendar = new Calendar();        

[top]

Step 2. General Settings.

+---------------------------------------------------------------------------+
| General Settings:
+---------------------------------------------------------------------------+

Operations & Submission Settings

In this section you have to define a method for data submission type (PostBack type). You may write "get" or "post" (recommended).

## *** set form submission type: "get" or "post"
$objCalendar->SetSubmissionType("post");

This method defines whether to run Calendar in Debug Mode or not.

## *** show debug info - false|true
$objCalendar->Debug(false);

Users Settings

If you want Calendar will show only events for certain user, define this user ID. If not, leave this block commented.

$user_id = 0;
$objCalendar->SetUserID($user_id);

Passing Parameters

To save http request parameters between calls of calendar (for ex.: index?page=products&cat=events etc.) you have to pass them as array into SaveHttpRequestVars() method and Calendar will store them.

$http_request_vars = array("");
$objCalendar->SaveHttpRequestVars($http_request_vars);

Cache Settings

Cache gives you possibility to improve work of the script and reduce execution time

## *** define caching parameters:
## *** 1st - allow caching or not, 2nd - caching lifetime in minutes
$objCalendar->SetCachingParameters(false, 15);

If you need to delete all cache, you may do it by calling following method:

## *** define all caching pages
/// $objCalendar->DeleteCache();

Languages

ApPHP Calendar is Multy-Language control, so you can easy switch interface language of your calendar.

## *** set interface language (default - English)
## *** (en) - English  (es) - Spanish  (de) - German
$objCalendar->SetInterfaceLang("es");

Week Settings

This group of methods related to the weeks settings of calendar

You may define whether to use long or short names of week day name.

## *** set week day name length - "short" or "long"
$objCalendar->SetWeekDayNameLength("long");

Next method defines first day of week: from Sunday (default) to Saturday.

## *** set start day of week: from 1 (Sunday) to 7 (Saturday)
$objCalendar->SetWeekStartedDay("1");

If you want to disable certain day of week - uncomment this section and pass into SetDisabledDay() method a number of such week day.

## *** disable certain day of the week: from 1 (Sunday) to 7 (Saturday)
$objCalendar->SetDisabledDay("7");

Show a week number of year: display on not week number at the left side of calendar in Yearly and Monthly View

## *** define showing a week number of year
$objCalendar->ShowWeekNumberOfYear(true);

[top]

Step 3. Events & Categories Settings.

+---------------------------------------------------------------------------+
| Events & Categories Settings:
+---------------------------------------------------------------------------+

Categories Actions & Operations

You may allow operations with categories: adding new category, editing or deleting existing category etc.

##  *** set (allow) calendar categories operations
$cat_operations = array(
        "add"=>true,
        "edit"=>true,
        "details"=>true,
        "delete"=>true,
        "manage"=>true,
        "allow_colors"=>true
    );

$objCalendar->SetCategoriesOperations($cat_operations);

Events Actions & Operations

This method defines whether the editing events in the Past allowed or not.

##  *** allow editing events in past
$objCalendar->EditingEventsInPast(false);

You may allow carrying out operations with ApPHP Calendar: adding new event, editing or deleting of existing, showing events statistics etc.

##  *** set (allow) calendar operations
$operations = array(
    "add"=>true,
    "edit"=>true,
    "details"=>true,
    "delete"=>true,
    "manage"=>true,
    "events_statistics"=>true);

$objCalendar->SetOperations($operations);
[top]

Step 4. Time Settings and Formatting.

+---------------------------------------------------------------------------+
| Time Settings and Formatting:
+---------------------------------------------------------------------------+

TimeZone Settings

Set timezone for your calendar. Full list of supported Timezones can be found here: http://us3.php.net/manual/en/timezones.php)

## *** set timezone
$objCalendar->SetTimeZone("America/Los_Angeles");

This method returns timezone, defined in Calendar

## *** get current timezone
/// echo $objCalendar->GetCurrentTimeZone();

ApPHP Calendar gives you possibility to display time in different formats: 24 hours or AP/PM.

## *** define time format - 24|AM/PM
$objCalendar->SetTimeFormat("24");

You may define certain timeframe by using SetAllowedHours() method.

## *** define allowed hours frame (from, to). Possible values: 0...24
$objCalendar->SetAllowedHours(0, 24);

This method defines a size of time slot. Possible values: 15 min, 30 min. or 60 min. (1 hour - default)

## *** define time block - 15|30|60 minutes
SetTimeBlock("60");
[top]

Step 5. Visual Settings.

+---------------------------------------------------------------------------+
| Visual Settings:
+---------------------------------------------------------------------------+

List of allowed Views for calendar.

## *** set (allow) calendar Views
$views = array("daily"=>true,
                   "weekly"=>true,
                   "monthly"=>true,
                   "yearly"=>true,
                   "list_view"=>true);
$objCalendar->SetCalendarViews($views);

Set default calendar view. Possible values: "daily", "weekly", "monthly", "yearly" or "list_view"; "monthly" is default.

## *** set default calendar view - "daily"|"weekly"|"monthly"|"yearly"|"list_view"
$objCalendar->SetDefaultView("monthly");

Calendar supports embedded CSS styles: "green" and "blue". Select appropriate style to suit your needs.

## *** set CSS style: "green"|"blue" - default
$objCalendar->SetCssStyle("blue");

Defines a type of Add Event form: "floating" or "popup" in Daily and Weekly View. Default value - "popup".

## *** set Add Event form type: "floating"|"popup" - default
$objCalendar->SetAddEventFormType("floating");

Calendar width and height.

## *** set calendar width and height
$objCalendar->SetCalendarDimensions("800px", "500px");

Define view type of events for Monthly and Weekly views. Possible values: "inline" or "tooltip". The "inline" means show all events in calendar' cell, "tooltip" means show them in tooltip.

## *** set type of displaying for events
## *** possible values for weekly  - "inline"|"tooltip"
## *** possible values for monthly - "inline"|"list"|"tooltip"
$events_display_type = array("weekly"=>"inline", "monthly"=>"inline");
$objCalendar->SetEventsDisplayType($events_display_type);

If you want to set special color for Sunday, you can do it with following method.

## *** set Sunday color - true|false
$objCalendar->SetSundayColor(true);

This method allows to display text for calendar caption.

## *** set calendar caption
$objCalendar->SetCaption("ApPHP Calendar v".Calendar::Version());
[top]

Step 6. Drawing Calendar.

+---------------------------------------------------------------------------+
| Drawing Calendar:
+---------------------------------------------------------------------------+

Now you can draw calendar on the screen.

## *** drawing calendar
$objCalendar->Show();        

[top]

Non Documented

[top]

Properties.

[Private] Disable hours before selected time in dropdown box in Add New Event popup.

private $disableEarlierHours = "false";        

[Private] Defines whether to hide (not display) empty slots in Weekly View or not.

private $hideWeekEmptySlots = false;        

[Private] Defines whether to allow working with event parts (slots).

private $isEventPartsAllowed = false;