PAMP:s60 calendar
From OpenSource
PHP API to handle host phone's calendar.
Example Usage
<?php
$db = s60_calendar_open();
print '<ul>';
foreach( $db->entries() as $e ){
print '<li>'. $e->content() .'@'. $e->location() .'</li>';
}
print '</ul>';
?>
Functions
s60_calendar_open
s60_calendar_open(string filename,string flag) -> s60_calendar_Database object
- s60_calendar_open() - opens the default calendar database file
- s60_calendar_open($filename [, 'e']) - opens file if it exists. Returns false if it doesn't.
- s60_calendar_open($filename , 'c') - opens file, creates if the file does not exist.
- s60_calendar_open($filename , 'n') - creates new empty database file.
Classes
s60_calendar_Database
open
open(string filename,string flag) -> boolean
- open() - opens the default calendar database file
- open($filename [, 'e']) - opens file if it exists. Returns false if it doesn't.
- open($filename , 'c') - opens file, creates if the file does not exist.
- open($filename , 'n') - creates new empty database file.
close
close()
Close calendar database connection.
get_entry
get_entry(integer entry_id) -> s60_calendar_Entry
Get calendar entry corresponding to given id.
add_entry
add_entry(s60_calendar_Entry entry)
Adds calendar entry, but it's not saved before you call commit().
entries
entries(integer id) -> array of s60_calendar_Entry
Returns all entries corresponding to specified id. If id is not provided then all entries are returned.
find_instances_month
find_instances_month(float month,integer flag) -> array of s60_calendar_Instance
Returns instances of the given month, as filtered by "flag". "flag" can be e.g. (S60_CALENDAR_FILTER_MEETING | S60_CALENDAR_FILTER_EVENT). If flag is not set, all instances are included.
find_instances_day
find_instances_day(float day, integer flag) -> array of s60_calendar_Instance
Returns instances of the given day, as filtered by "flag". "flag" can be e.g. (S60_CALENDAR_FILTER_MEETING | S60_CALENDAR_FILTER_EVENT). If flag is not set, all instances are included.
find_instances_range
find_instances_range() -> array of s60_calendar_Instance
Returns instances of the given range, as filtered by "flag" and "search" string. "flag" can be e.g. (S60_CALENDAR_FILTER_MEETING | S60_CALENDAR_FILTER_EVENT). If flag is not set, all instances are included.
s60_calendar_Entry
remove
remove()
Removes calendar entry.
commit
commit()
Commits changes to the entry (saves modifications).
id
id() -> integer or string
Returns entry's unique ID.
type
type() -> integer
Returns entry's type, e.g. S60_CALENDAR_TYPE_MEETING.
last_modified
last_modified() -> float
Returns timestamp of last modification.
content
content() -> string
Returns content of the entry.
set_content
set_content(string content)
Set entry's content.
location
location() -> string
Returns location of the entry.
set_location
set_location(string loc)
Sets location of the entry.
replication
replication() -> integer
Returns replication status, e.g. S60_CALENDAR_REP_OPEN.
set_replication
set_replication(integer repl)
Sets replication status, e.g. S60_CALENDAR_REP_OPEN.
start_time
start_time() -> float
Returns start time of the entry.
end_time
end_time() -> float
Returns ending time of the entry.
set_start_end_time
set_start_end_time(float start,float end)
Sets both start and end time for the entry. For a repeating entry, start and end time should be on the same day.
alarm
alarm() -> float or boolean
Returns alarm time, or False if there's no alarm.
set_alarm
set_alarm(float alarm_time)
Sets the alarm time (or clears the alarm if given 0).
crossed_out
crossed_out()-> float or boolean
Returns time when entry was crossed out, or False if it hasn't been crossed out.
set_crossed_out
set_crossed_out(float cross)
Sets the entry as crossed out at the given time, or if given 0, sets the entry as not crossed out.
todo_list
todo_list() -> s60_calendar_TodoList
Returns the todo list to which this entry belongs.
set_todo_list
set_todo_list(s60_calendar_TodoList list)
Sets this entry's todo list.
priority
priority() -> integer
Priority is a value between 0-255.
set_priority
set_priority(integer priority)
Priority is a value between 0-255.
repeat
repeat() -> array of repeat rules or boolean
Returns entry's repeat rules as a complex associative array, or
False if no repeat has been set.
The array always contains the following key:
"type" => repeat type, see below for the alternatives
Optionally the following keys may be specified:
"start" => repeat start date. This must be specified unless type is
"no_repeat"<br/>
"end" => repeat end date. If unspecified or 0, repeat
will be forever.<br/>
"interval" => repeat interval. Default = 1. If this is<br/>
for example 3 and repeat type is daily repeat, it
means entry is repeated every 3 days.
"rdates" => an array of specific times (unix time) on which
the entry should be repeated. Only on S60 version 3.x.
"exceptions" => an array of specific times (unix time) which are
exceptions to the repeat rule. On S60 version 3.x
the times should be at the same time when some instance
starts, with second precision. On S60 version 2.x it
is sufficient that the times be at the same days as the
instances that should be "removed".
The repeat type may be one of the following:
"no_repeat"
This clears the repeat. However, on S60 version 3.x one can still
have an rdates array to have the entry repeat on specific dates, e.g.
set_repeat(array("type"=>"no_repeat",
"rdates"=>array(time(), time() + $X)));
"daily"
Entry will be repeated daily.
"weekly"
Entry will be repeated weekly.
"monthly_by_dates"
Entry will be repeated monthly. With this type one can specify
for example that the entry is repeated on third and 14th day of every month.
This has the following extra key:
"days" => an array of numbers representing days of month. 0 = first day of month.
"monthly_by_days"
Entry will be repeated monthly. With this type one can specify
for example that the entry is repeated on second tuesday of every month
and last saturday of every month.
This has the following extra key:
"days" => an array of associative arrays with the following keys:
"day" => weekday of repeat, 0 = Monday
"week" => week of repeat, 1 meaning "first monday" if "day" = 0
And -1 meaning "last monday".
"yearly_by_date"
Entry will be repeated yearly on repeat start date.
"yearly_by_day"
Entry will be repeated yearly. With this type one can specify
for example that the entry is repeated on second tuesday of June.
This has the following extra key:
"days" => an associative array with the following keys:
"day" => weekday of repeat, 0 = Monday
"week" => week of repeat, 1 meaning "first monday" if "day" = 0
And -1 meaning "last monday".
"month" => month of repeat, 0 = January
Some examples of repeat rules:
array("type"=>"daily", "start"=>time(), "interval"=>2);
- repeat on every second day, starting today, repeat forever
array("type"=>"monthly_by_days", "start"=>time(), "end"=>time() + 3600*24*30*3
"days"=>array(array("week"=>2, "day"=>4)));
- repeat on every month's second friday, for 3 months.
set_repeat
set_repeat(array or boolean repeat)
Sets entry's repeat rules. Array given should follow the same rules as specified in repeat() documentation. Giving False or no parameters unsets the repeat.
status
status() -> integer
TODO entries may have one of S60_CALENDAR_STATUS_CANCELLED, S60_CALENDAR_STATUS_TODO_*. Other entires may have one of S60_CALENDAR_STATUS_CANCELLED, S60_CALENDAR_STATUS_TENTATIVE, S60_CALENDAR_STATUS_CONFIRMED.
set_status
set_status(integer status)
TODO entries may have one of S60_CALENDAR_STATUS_CANCELLED, S60_CALENDAR_STATUS_TODO_*. Other entires may have one of S60_CALENDAR_STATUS_CANCELLED, S60_CALENDAR_STATUS_TENTATIVE, S60_CALENDAR_STATUS_CONFIRMED.
s60_calendar_TodoList
todos
todos() -> array of s60_calendar_Instance
Returns a list of TODO instances belonging to this todo list.
id
id() -> integer
Returns the unique id of this todo list.
name
name() -> string
Returns name of the entry.
set_name
set_name(string name)
Sets name of the entry.
remove
remove()
Removes the the entry.
s60_calendar_Instance
entry
entry() -> s60_calendar_Entry
Return calendar entry associated with this instance.
date
date() -> float
Timestamp of this instance.
remove
remove(integer flags)
Removes the instance. If the modifier is
- S60_CALENDAR_REMOVE_PAST : also removes past instances
- S60_CALENDAR_REMOVE_FUTURE : also removes future instances
Constants
Entry types
- S60_CALENDAR_TYPE_MEETING
- S60_CALENDAR_TYPE_EVENT
- S60_CALENDAR_TYPE_ANNIV
- S60_CALENDAR_TYPE_TODO
- S60_CALENDAR_TYPE_REMINDER
Filters
- S60_CALENDAR_FILTER_MEETING
- S60_CALENDAR_FILTER_EVENT
- S60_CALENDAR_FILTER_ANNIV
- S60_CALENDAR_FILTER_TODO
- S60_CALENDAR_FILTER_REMINDER
Replication statuses
- S60_CALENDAR_REP_OPEN
- S60_CALENDAR_REP_PRIVATE
- S60_CALENDAR_REP_RESTRICTED
Remove instance modifiers
- S60_CALENDAR_REMOVE_THIS
- S60_CALENDAR_REMOVE_FUTURE
- S60_CALENDAR_REMOVE_PAST
Statuses
- S60_CALENDAR_STATUS_CANCELLED
- S60_CALENDAR_STATUS_TODO_NEED_ACTION
- S60_CALENDAR_STATUS_TODO_COMPLETED
- S60_CALENDAR_STATUS_TODO_IN_PROGRESS
- S60_CALENDAR_STATUS_TENTATIVE
- S60_CALENDAR_STATUS_CONFIRMED
- S60_CALENDAR_STATUS_NULL
