Getting Started with ApPHP Calendar (for version 3.0.0 or above)
- 1. Common Notices
- 1.1 Syntax.
- 1.2 Common notes.
- 2. Getting Started
- 3. Non Documented
- 3.1 Properties.
Common Notices
Syntax.
We use
## for comments
// for lines, that must be uncommented
/// for lines, that may be uncommented (optional)
Common notes.
• Please, use a $debug_mode = true; before you say "Why Nothing Works ?!"
• Starting with version 2.0.0 only PHP5 is supported!
• Do not put ApPHP Calendar code into another HTML Form: <form>...</form>
Getting Started
(for version 2.0.0 or above)
Step 1. 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 ## *** 2 optional parameters: $calendar_type ('small' or 'normal') and $prefix ## *** Ex.: Calendar('normal', 'abc_'); $objCalendar = new Calendar();
Step 2. General Settings.
Submission Settings & Debug Mode
In this section you have to define a method for data submission type (PostBack type). You may write 'get' or 'post' (recommended).
## *** set PostBack method: 'get' or 'post' $objCalendar->SetPostBackMethod('post');
This method defines whether to run Calendar in Debug Mode or not.
## *** show debug info - false|true $objCalendar->Debug(false);
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('param1', 'param2') $objCalendar->SaveHttpRequestVars($http_request_vars);
Cache Settings
Cache gives possibility to improve work of the script and reduce execution time
## *** define caching parameters: ## *** 1st - allow caching or not, 2nd - caching lifetime in minutes ## *** default cache folder: tmp/cache/ $objCalendar->SetCachingParameters(false, 15);
If you want to delete all cache, you may do it by calling following method:
## *** delete all pages in cache $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 (fr) - French ## *** (it) - Italian (pt) - Portuguese (he) - Hebrew (nl) - Netherlands $objCalendar->SetInterfaceLang('en');
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 a start day of the 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 (or some days).
## *** disable certain days of the week: from 1 (Sunday) to 7 (Saturday).
Ex.: 1,2 or 7 $objCalendar->SetDisabledDays(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);
Step 3. Events & Categories Settings.
Events Actions & Operations
Allow multiple occurrences for events in the same time slot
## *** false|true - default $objCalendar->SetEventsMultipleOccurrences(true);
This method defines whether editing of events in the Past is allowed or not.
## *** allow editing events in the past $objCalendar->EditingEventsInPast(false);
This method defines whether deleting of events in the Past is allowed or not.
## *** allow deleting of events in the past $objCalendar->DeletingEventsInPast(false);
Block deleting events before certain period of time
## *** in hours $objCalendar->BlockEventsDeletingBefore(24);
You may allow carrying out events operations: adding, editing or deleting of existing etc.
## *** set (allow) calendar events operations $objCalendar->SetEventsOperations(array( 'add'=>true, 'edit'=>true, 'details'=>true, 'delete'=>true, 'delete_by_range'=>true, 'manage'=>true, ));
Categories Actions & Operations
You may allow operations with categories: adding new category, editing or deleting existing category etc.
## *** set (allow) using categories $objCalendar->AllowCategories(true); ## *** allow only defined categories by ID (parameter must be a numeric value) $objCalendar->SetCategoryID(0); ## *** set (allow) calendar categories operations $objCalendar->SetCategoriesOperations(array( 'add'=>true, 'edit'=>true, 'details'=>true, 'delete'=>true, 'manage'=>true, 'allow_colors'=>true, 'show_filter'=>true ));
Locations Actions & Operations
You may allow operations with locations: adding new location, editing or deleting existing location etc.
## *** set (allow) using locations $objCalendar->AllowLocations(true); ## *** set (allow) calendar locations operations $objCalendar->SetLocationsOperations(array( 'add'=>true, 'edit'=>true, 'details'=>true, 'delete'=>true, 'manage'=>true, 'show_filter'=>true ));
Step 4. Participants Settings.
Participants Settings
This method allows participant to work with his own events. Calendar will show only events for certain participants
## *** set participant ID (the value must be numeric) $participant_id = 0; $objCalendar->SetParticipantID($participant_id);
This method allows creating and assigning participants to events
## *** set (allow) calendar participants operations $objCalendar->AllowParticipants(true);
You may allow operations with participants: add, edit, delete etc.
## *** set (allow) calendar categories operations $objCalendar->SetParticipantsOperations(array( 'add'=>true, 'edit'=>true, 'details'=>true, 'delete'=>true, 'manage'=>true, 'assign_to_events'=>true ));
Step 5. 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();
Time Format & Settings
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: 10 min., 15 min., 30 min., 45 min., 60 min. or 120 min (60 min - default)
## *** define time slot - 10|15|30|45|60 minutes SetTimeSlot('60');
You may define showing of time for some views
## *** set showing times in Daily, Weekly and List views $objCalendar->ShowTime('true');
Step 6. Visual Settings.
Calendar Views
## *** set (allow) calendar Views $objCalendar->SetCalendarViews(array( 'daily'=>true, 'weekly'=>true, 'monthly'=>true, 'monthly_double'=>true, 'yearly'=>true, 'list_view'=>true ));
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' ## *** 'monthly_small'|'monthly_double' $objCalendar->SetDefaultView('monthly');
You may define links for small monthly view
## *** Set action link for monthly small view - file2.php or ../file3.php etc. $objCalendar->SetMonthlySmallLinks('');
Calendar Actions
## *** set (allow) calendar Views ## *** default exporting folder: tmp/export/ $objCalendar->SetCalendarActions(array( 'statistics'=>true, 'exporting'=>true, 'printing'=>true ));
## *** set (allow) calendar export types $objCalendar->SetExportTypes(array( 'csv'=>true, 'xml'=>true, 'ics'=>true ));
Calendar supports embedded CSS styles: 'green', 'brown', 'blue' or your own style. Select appropriate style to suit your needs.
## *** set CSS style: 'green'|'brown'|'blue' - default $objCalendar->SetCssStyle('blue');
Using of WYSIWYG editor.
## *** specify using of WYSIWYG editor $objCalendar->AllowWYSIWYG(true);
Calendar width and height.
## *** set calendar width and height $objCalendar->SetCalendarDimensions('800px', '500px');
Define view type of events for Monthly, Weekly and Daily views. The 'inline' means show all events in calendar cell, 'tooltip' means show them in tooltip.
## *** set type of displaying for events ## *** possible values for daily - 'inline'|'block' ## *** possible values for weekly - 'inline'|'tooltip' ## *** possible values for monthly - 'inline'|'list'|'tooltip' $objCalendar->SetEventsDisplayType(array( 'daily'=>'block', 'weekly'=>'tooltip', 'monthly'=>'tooltip' ));
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());
Step 7. Drawing Calendar.
Now you can draw calendar on the screen.
## *** drawing calendar $objCalendar->Show();
Non Documented
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;
[Private] Defines how to save data with session variables or cookie ('session' or 'cookie').
private $dataSaveType = 'session';
[Private] Used to separate events for GROUP_CONCAT() function in SELECT SQL.
private $separator = '$$';
[Private] Defines a view type of Views Changer ('dropdownlist' or 'tabs').
private $viewChangerType = 'dropdownlist';
[Private] Specifies whether to allow automatically created anchor to the top of calendar (true or false - default).
private $isAnchorAllowed = false;
[Private] Specifies calendar layout direction ('rtl' or 'ltr' - default).
private $direction = 'ltr';
[Private] Used to define calendar date format ('yyyy/mm/dd', 'dd/mm/yyyy' or 'mm/dd/yyyy'(default)).
private $dateFormat = 'dd/mm/yyyy';
[Private] Used to force deletion of category events when category is removing (true or false - default).
private $removeCategoryEvents = false;
[Private] Specifies target for event links: _new, _blank, _parent, _self etc.
private $eventsLinkTarget = '';
[Private] Specifies whether to allow creating events with the same name.
private $allowEventsWithSameName = false;
[Private] Used to highlight selected day.
private $highlightSelectedDay = false;
[Private] Used to show/hide empty time slots.
private $showEmptyTimeSlots = false;
[Private] Used to allow color for Saturday.
private $saturdayColor = false;