FreeMED. SchedulerHolds methods for dealing with calendar ans scheduling appointments. Most methods from lib/calendar-functions.php that were important should have been migrated here. Summary | Holds methods for dealing with calendar ans scheduling appointments. | | | | Contains the common names of calendar fields, mapped to their SQL names. | | | | Copy the given appointment to a specified date | | | | Addition method for date. | | Determine if a date falls between a beginning and end date. | | Check to see if date is in the past | | Creates AM/PM user-friendly hour display. | | Creates AM/PM user-friendly time display. | | Display calendar event from scheduler. | | Return proper names for special event mappings, as per the group calendar and Travel. | | Look up list of appointments for specified day and provider. | | Given a group id, return the appointments in that group | | Generate a miniature calendar, linking to the given page | | Retrieves an appointment record from its id | | Form a human readable time string from an hour and a minute. | | | | Determine whether an appointment of the specified duration at the specified time will fit in the specified map. | | Creates a blank scheduler map. | | Given an appointment id and data, modify an appointment record. | | Given a group id (for a group of appointments), modify a group of appointment records with the given data. | | Creates 3rd generation multiple scheduling map. | | Get next available slot with appropriate parameters. | | Increment time slot by 5 minutes. | | Create an appointment record with the specified data | | | | Given an appointment (by its id) and a set of dates, replicate the appointment exactly on given dates. | | Scroll a given date back by a month | | Scroll a given date forward by a month | | Internal helper function to convert SQL queries into scheduler appointment arrays (arrays of associative arrays). |
calendar_field_mappingvar $calendar_field_mapping |
Contains the common names of calendar fields, mapped to their SQL names. For copying purposes, it also contains SQL names mapped to themselves.
copy_appointmentfunction copy_appointment ( | $id, | | $date | ) |
|
Copy the given appointment to a specified date Parameters$id | id for the specified appointment | $date | SQL date format (YYYY-MM-DD) specifying the date to copy the appointment |
ReturnsBoolean, whether successful See Alsocopy_group_appointment
copy_group_appointmentfunction copy_group_appointment ( | $group_id, | | $date | ) |
|
Parameters$group_id | id for the group appointments | $date | Target date |
ReturnBoolean, whether successful See Alsocopy_appointment
date_addfunction date_add ( | $starting, | | $interval | ) |
|
Addition method for date. Adds days to starting date. ParametersReturnsDate in SQL date format.
date_in_rangefunction date_in_range ( | $checkdate, | | $dtbegin, | | $dtend | ) |
|
Determine if a date falls between a beginning and end date. Parameters$checkdate | Date to check. Should be in ANSI SQL date format (YYYY-MM-DD). | $dtbegin | Beginning of time span to compare against. | $dtend | Ending of time span to compare against. |
ReturnsBoolean value, whether date falls between specified dates.
date_in_the_pastfunction date_in_the_past ( | $datestamp | ) |
|
Check to see if date is in the past Parameters$date | SQL formatted date string (YYYY-MM-DD) |
ReturnsBoolean, true if date is past, false if date is present or future.
display_hourfunction display_hour ( | $hour | ) |
|
Creates AM/PM user-friendly hour display. Parameters$hour | Hour in 0..24 military format. |
ReturnsAM/PM display of hour
display_timefunction display_time ( | $hour, | | $minute | ) |
|
Creates AM/PM user-friendly time display. Parameters$hour | Hour in 0..24 military format. | $minute | Minute in 0..60 format. |
ReturnsUser-friendly AM/PM display of time.
event_calendar_printfunction event_calendar_print ( | $event, | | | | $short | = | false | ) |
|
Display calendar event from scheduler. Parameters$event | scheduler table event id number. | $short | (optional) boolean, whether to shorten the view for a concise output. Defaults to false. |
ReturnsXHTML formatted calendar event.
event_specialfunction event_special ( | $mapping | ) |
|
Return proper names for special event mappings, as per the group calendar and Travel. Parameters$mapping | Special id mapping. This is usually a number from 0 to 8. |
ReturnsText name of specified mapping.
find_date_appointmentsfunction find_date_appointments ( | $date, | | | | $provider | = | -1 | ) |
|
Look up list of appointments for specified day and provider. Parameters$date | Date in YYYY-MM-DD | $provider | (optional) id for the provider in question. If this is omitted, all providers will be queried. |
ReturnsArray of associative arrays containing appointment information
find_group_appointmentsfunction find_group_appointments ( | $group_id | ) |
|
Given a group id, return the appointments in that group Parameters$group_id | id for the group that is being searched for |
ReturnsArray of associative arrays containing appointment information.
generate_calendar_minifunction generate_calendar_mini ( | $given_date, | | $this_url | ) |
|
Generate a miniature calendar, linking to the given page Parameters$given_date | Date to be selected | $this_url | URL to append the date to in links |
ReturnsHTML code for miniature calendar
get_appointmentfunction get_appointment ( | $id | ) |
|
Retrieves an appointment record from its id Parameters$id | id for the specified appointment |
ReturnsAssociative array containing appointment information
get_time_stringfunction get_time_string ( | $hour, | | $minute | ) |
|
Form a human readable time string from an hour and a minute. Parameters$hour | Hour in 24 hour format (0 to 24). | $minute | Minutes (0 to 60). |
ReturnsFormatted time string.
mapCreates a scheduler map. This is the 2nd generation of the depreciated interference map. ParametersReturns”map” associative multi-dimentional array containing scheduling interference data. See Alsomap_fit map_init
map_fitfunction map_fit ( | $map, | | | | $time, | | | | $duration | = | 5, | | $id | = | -1 | ) |
|
Determine whether an appointment of the specified duration at the specified time will fit in the specified map. Parameters$map | Scheduler “map” as generated by map. | $time | Time string specifying the time of the appointment to check. Should be in format HH:MM. | $duration | (optional) Duration of the appointment in minutes. This is 5 by default. | $id | (optional) If this is specified it shows the pre-existing scheduler id for an appointment, so that if it is being moved, it does not conflict with itself. |
ReturnsBoolean, whether specified appointment fits into the specified map. See Alsomap map_init
map_initCreates a blank scheduler map. ReturnsBlank scheduler map (associative array). See Alsomap map_fit
move_appointmentfunction move_appointment ( | $original, | | | | $data | = | NULL | ) |
|
Given an appointment id and data, modify an appointment record. Parameters$original | Original appointment id | $data | Associative array of data to be changed in the appointment record. See calendar_field_mapping for a list of acceptable keys. |
ReturnsBoolean, whether successful.
move_group_appointmentfunction move_group_appointment ( | $group_id, | | $data | ) |
|
Given a group id (for a group of appointments), modify a group of appointment records with the given data. This follows the same basic format as move_appointment Parameters$group_id | id for the appointment group | $data | Associative array of data to be changed in the appointment record. See calendar_field_mapping for a list of acceptable keys. |
ReturnsBoolean, whether successful. See Alsomove_appointment
multimapfunction multimap ( | $query, | | | | $selected | = | -1 | ) |
|
Creates 3rd generation multiple scheduling map. This is used to automatically create additional columns due to overlapping and overbooking. Parameters$query | SQL query string describing options. | $selected | (optional) Scheduler table id of selected appointment. If this is not specified, no appointment will be selected by default. |
ReturnsMultimap (associative array). See Alsomap
next_availablefunction next_available ( | $_criteria | ) |
|
Get next available slot with appropriate parameters. Parameters$_criteria | Hash containing one or more of the following: |
- after - After a particular hour
- date - Date to start the search from
- days - Number of days to search (defaults to 4)
- duration - In minutes (defaults to 5)
- forceday - Force day to be day of week (1..7 ~ Mon..Sun)
- location - Room location
- provider - With a particular provider
- single - Provide single answer
- weekday - Force weekday (boolean)
Returnsarray ( of array ( date, hour, minute ) ) false if nothing is open
next_time_incrementfunction next_time_increment ( | $time | ) |
|
Increment time slot by 5 minutes. Parameters$time | Time in HH:MM format. |
ReturnsNext time slot in HH:MM format.
set_appointmentfunction set_appointment ( | $data | = | NULL | ) |
|
Create an appointment record with the specified data Parameters$data | Associative array of values to be used when setting the appointment. Uses calendar_field_mapping to determine values from keys. |
Returnsid of created appointment
set_group_appointmentfunction set_group_appointment ( | $patients, | | $data | ) |
|
Parameters$patients | Array of patient identifiers. The first of this array will be the appointment used to generate the group id. | $data | Associative array of data used to populate the appointment data. Same syntax as set_appointment. |
ReturnsGroup key id for new group created. See Alsoset_appointment
set_recurring_appointmentfunction set_recurring_appointment ( | $appointment, | | $ts, | | $desc | ) |
|
Given an appointment (by its id) and a set of dates, replicate the appointment exactly on given dates. All of the appointments can later be accessed through the use of the calrecurid field. This allows for recurring appointments to be modified and deleted. A natural language description of the appointment is placed in recurnote. Parameters$appointment | id of the appointment in question | $ts | Array of timestamps containing the dates for the appointment to repeat | $desc | Description of the recurrance |
scroll_prev_monthfunction scroll_prev_month ( | $given_date | = | "" | ) |
|
Scroll a given date back by a month Parameters$given_date | (optional) Date to scroll back from in SQL date format (YYYY-MM-DD). Defaults to current date. |
ReturnsSQL formatted date string for a date approximately one month previous to the given date.
scroll_next_monthfunction scroll_next_month ( | $given_date | = | "" | ) |
|
Scroll a given date forward by a month Parameters$given_date | (optional) Date to scroll forward from in SQL date format (YYYY-MM-DD). Defaults to current date. |
ReturnsSQL formatted date string for a date approximately one month after the given date.
_query_to_result_arrayfunction _query_to_result_array ( | $query | ) |
|
Internal helper function to convert SQL queries into scheduler appointment arrays (arrays of associative arrays). ParametersReturnsArray of associative arrays containing appointment data.
|