Home « Server software «
Documentation: dates/dates.php
Class Dates - The database abstraction layer for dates
Dates are an abstraction for time-related information.This script is a reference file of this system.
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com
build_month_calendar() - Produce a nice calendar for the given month
function build_month_calendar($year, $month, $variant='month')
- $year -
- $month -
- $variant='month' -
- returns a string to be put in the web page
delete() - Delete one date in the database and in the file system
function delete($id)
- $id - the id of the date to delete
- returns an error message, if any
Voir aussi:
delete_for_anchor() - Delete all dates for a given anchor
function delete_for_anchor($anchor)
- $anchor - the anchor to check
- returns an error message, if any
Voir aussi:
get() - Get one date by id
function &get($id)
- $id - int the id of the date
- returns the resulting $item array, with at least keys: 'id', 'date_stamp', etc.
Voir aussi:
get_for_anchor() - Get first date for one anchor
function &get_for_anchor($anchor)
- $anchor - string the anchor
- returns the resulting $item array, with at least keys: 'id', 'date_stamp', etc.
get_month_label() - Label for one month
function get_month_label($month, $language=NULL)
- $month -
- $language=NULL -
- returns a string to be used in web page
get_url() - Get the url to view a date
function get_url($id, $action='view')
- $id - int the id of the date to view
- $action='view' - string the expected action ('view', 'edit', 'delete', ...)
- returns an anchor to the viewing script
dates/view.php?id=512'),
which may be not processed correctly by search engines.
If the parameter 'with_friendly_urls' has been set to 'Y' in the configuration panel,
this function will return an URL parsable by search engines (e.g. 'dates/view.php/512').Voir aussi:
- articles/article.php
- codes/codes.php
- dates/check.php
- dates/edit.php
- dates/view.php
- skins/skin_skeleton.php
- users/user.php
list_by_date() - List past events
function &list_by_date($offset=0, $count=10, $variant='full')
- $offset=0 - int the offset from the start of the list; usually, 0 or 1
- $count=10 - int the number of items to display
- $variant='full' - string the list variant, if any
- returns NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $icon)
Voir aussi:
list_by_date_for_anchor() - List newest dates for one anchor
function &list_by_date_for_anchor($anchor, $offset=0, $count=20, $variant=NULL, $capability='?')
- $anchor - string the anchor (e.g., 'article:123')
- $offset=0 - int the offset from the start of the list; usually, 0 or 1
- $count=20 - int the number of items to display
- $variant=NULL - string the list variant, if any
- $capability='?' - string actual surfer capability ('?', 'M', or 'A') -- see articles/edit.php
- returns NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $icon)
list_for_day() - List all dates for one day
function &list_for_day($year, $month, $day, $variant='links', $capability='?')
- $year - int the year
- $month - int the month, from 1 to 12
- $day - int the day, from 1 to 31
- $variant='links' - string the list variant, if any
- $capability='?' - string actual surfer capability ('?', 'M', or 'A') -- see articles/edit.php
- returns NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $type, $icon, $date)
list_for_month() - List all dates for one month
function &list_for_month($year, $month, $variant='links', $capability='?')
- $year - int the year
- $month - int the month, from 1 to 12
- $variant='links' - string the list variant, if any
- $capability='?' - string actual surfer capability ('?', 'M', or 'A') -- see articles/edit.php
- returns NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $type, $icon, $date)
list_future_for_anchor() - List future dates attached to some anchor
function &list_future_for_anchor($anchor, $offset=0, $count=100, $variant='family', $capability='?')
- $anchor - string the anchor (e.g., 'section:123')
- $offset=0 - int the offset from the start of the list; usually, 0 or 1
- $count=100 - int the number of items to display
- $variant='family' - string the list variant, if any
- $capability='?' - string actual surfer capability ('?', 'M', or 'A')
- returns NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $type, $icon, $date)
list_past_for_anchor() - List past dates attached to some anchor
function &list_past_for_anchor($anchor, $offset=0, $count=100, $variant='family', $capability='?')
- $anchor - string the anchor (e.g., 'section:123')
- $offset=0 - int the offset from the start of the list; usually, 0 or 1
- $count=100 - int the number of items to display
- $variant='family' - string the list variant, if any
- $capability='?' - string actual surfer capability ('?', 'M', or 'A')
- returns NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $type, $icon, $date)
list_selected() - List selected dates
function &list_selected(&$result, $layout='compact', $capability='?')
- &$result - resource result of database query
- $layout='compact' - string 'full', etc or object, i.e., an instance of the layout interface
- $capability='?' - string '?' or 'A', to support editors and to impersonate associates, where applicable
- returns NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $type, $icon, $date)
- 'compact' - to build short lists in boxes and sidebars (this is the default)
- 'links' - links to anchored pages
- 'no_anchor' - to build detailed lists in an anchor page
- 'full' - include anchor information
post() - Post a new date or an updated date
function post($fields)
- $fields - array an array of fields
- returns integer the id of the new or updated record, else 0 on error
Voir aussi:
setup() - Create or alter tables for dates
function setup()
Voir aussi:
stat() - Get some statistics
function &stat()
- returns the resulting ($count, $min_date, $max_date) array
Voir aussi:
stat_past_for_anchor() - Get some statistics for one anchor
function &stat_past_for_anchor($anchor)
- $anchor - the selected anchor (e.g., 'article:12')
- returns the resulting ($count, $min_date, $max_date) array