PAMP:s60 calendar

From OpenSource

Jump to: navigation, search

PHP API to handle host phone's calendar.

Contents

[edit] Example Usage

<?php
        $db = s60_calendar_open();
        print '<ul>';
        foreach( $db->entries() as $e ){

                print '<li>'. $e->content() .'@'. $e->location() .'</li>';

                }
        print '</ul>';


?>

[edit] Functions

[edit] 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.

[edit] Classes

[edit] s60_calendar_Database

[edit] 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.

[edit] close

 close()
Close calendar database connection.

[edit] get_entry

 get_entry(integer entry_id) -> s60_calendar_Entry
Get calendar entry corresponding to given id.

[edit] add_entry

 add_entry(s60_calendar_Entry entry)
Adds calendar entry, but it's not saved before you call commit().

[edit] 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.

[edit] 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.

[edit] 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.

[edit] 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.

[edit] s60_calendar_Entry

[edit] remove

 remove()
Removes calendar entry.

[edit] commit

 commit()
Commits changes to the entry (saves modifications).

[edit] id

 id() -> integer or string
Returns entry's unique ID.


[edit] type

 type() -> integer
Returns entry's type, e.g. S60_CALENDAR_TYPE_MEETING.

[edit] last_modified

 last_modified() -> float
Returns timestamp of last modification.

[edit] content

 content() -> string
Returns content of the entry.

[edit] set_content

 set_content(string content) 
Set entry's content.

[edit] location

 location() -> string
Returns location of the entry.

[edit] set_location

 set_location(string loc) 
Sets location of the entry.

[edit] replication

 replication() -> integer
Returns replication status, e.g. S60_CALENDAR_REP_OPEN.

[edit] set_replication

 set_replication(integer repl)
Sets replication status, e.g. S60_CALENDAR_REP_OPEN.

[edit] start_time

 start_time() -> float
Returns start time of the entry.

[edit] end_time

 end_time() -> float
Returns ending time of the entry.

[edit] 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.

[edit] alarm

 alarm() -> float or boolean
Returns alarm time, or False if there's no alarm.

[edit] set_alarm

 set_alarm(float alarm_time)
Sets the alarm time (or clears the alarm if given 0).

[edit] crossed_out

 crossed_out()-> float or boolean
Returns time when entry was crossed out, or False if it hasn't been crossed out.

[edit] 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.

[edit] todo_list

 todo_list() -> s60_calendar_TodoList
Returns the todo list to which this entry belongs.

[edit] set_todo_list

 set_todo_list(s60_calendar_TodoList list)
Sets this entry's todo list.

[edit] priority

 priority() -> integer
Priority is a value between 0-255.

[edit] set_priority

 set_priority(integer priority)
Priority is a value between 0-255.

[edit] 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.

[edit] 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.

[edit] 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.

[edit] 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.

[edit] s60_calendar_TodoList

[edit] todos

 todos() -> array of s60_calendar_Instance
Returns a list of TODO instances belonging to this todo list.

[edit] id

 id() -> integer
Returns the unique id of this todo list.

[edit] name

 name() -> string
Returns name of the entry.

[edit] set_name

 set_name(string name)
Sets name of the entry.

[edit] remove

 remove()
Removes the the entry.

[edit] s60_calendar_Instance

[edit] entry

 entry() -> s60_calendar_Entry
Return calendar entry associated with this instance.

[edit] date

 date() -> float
Timestamp of this instance.

[edit] 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

[edit] Constants

[edit] Entry types

  • S60_CALENDAR_TYPE_MEETING
  • S60_CALENDAR_TYPE_EVENT
  • S60_CALENDAR_TYPE_ANNIV
  • S60_CALENDAR_TYPE_TODO
  • S60_CALENDAR_TYPE_REMINDER

[edit] Filters

  • S60_CALENDAR_FILTER_MEETING
  • S60_CALENDAR_FILTER_EVENT
  • S60_CALENDAR_FILTER_ANNIV
  • S60_CALENDAR_FILTER_TODO
  • S60_CALENDAR_FILTER_REMINDER

[edit] Replication statuses

  • S60_CALENDAR_REP_OPEN
  • S60_CALENDAR_REP_PRIVATE
  • S60_CALENDAR_REP_RESTRICTED

[edit] Remove instance modifiers

  • S60_CALENDAR_REMOVE_THIS
  • S60_CALENDAR_REMOVE_FUTURE
  • S60_CALENDAR_REMOVE_PAST

[edit] 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
Personal tools
MediaWiki Resources