Dcal

Summary: a calendar recipe
Version:2008-12-30
Prerequisites: pmwiki 2.1.27
Status:alpha
Maintainer:CarlosAB
Discussion: Dcal-Talk?

Description

A calendar that uses two markups, one to create entries and other to render the calendar. You can have multiple instances in the same page, you can change the month and year dynamically for each one, you can use pagelist to select entries and extract information out of wikipages and use it inside the calendar.

Installation

Download the dcal.php file, place it inside cookbook/ folder and do a include_once("cookbook/dcal.php"); inside your local/config.php and play with it.

DOWNLOAD:dcal.gzΔ

Syntax

dcalin is a markup expression that fills an array with information that will be displayed afterwards by dcal.

dcalin is done as a markup expression so it can be written to a page independent of dcal position, so dcalin entries written before and after the dcal markup will be showed by dcal.

 {(dcalin
    id="alpha num"  defaults to to "dcal" and defines to which calendar this entry belongs

    ut or utime="num" give dcalin unixtime an it will do the rest, defaults to empty

    y or year="num" defaults to current year with 4 digits 1970 ... 2038
    m or month="num" defaults to current month with 1 to 2 digits. 1 ... 12
    d or day="num" defaults to current day with one to two digits. 1 ... 31
    h or hour="num" defaults to current hour from 0 to 23
    mn or minute="num" defaults to current minute from 0 to 59

    ln or link="alpha num char" defaults to nothing
    tt or title="alpaha num char" defaults to a translatable empty string
    tx or text="alpaha num char" defaults to a translatable empty string

    dr or duration="num" defaults to the value in $DcalinDefaultDuration
    pr or periodicity="hourly,daily,weekly,monthly,yearly" defaults to normal

    fmt or format="alpha num char" includes the format that will be used to format dcalin
                                   items inside dcal. It can be a entry in $DcalItemFmt or
                                   sections in any page.
 )}

 dcal makes the table with headers, prev and next links, caption with current month,
 creates links or just display text related to each dcalin entry.

 (:dcal
    id="alpha num" defaults to to "dcal" sets the calendar id <div id="dcal" class="wrapper">
          helps defining dynamic month and year for each calendar and selection of dcalin entries

    y or year="num" defaults to current year 
    m or month="num" defaults to current month

    ws or weekstart="num" default to sunday=0 defines the day in which weeknames will start
    wl or weekdaylength="num" defines the number of letters week names will have

    tt or title ="alpha num char" defaults to monthname
    tu or titleurl="alpha num char" defaults to nothing, a link to other place inside 
                                    or outside the wiki

    pmu or prevmonthurl="alpha num char" defaults to (month - 1)
    nmu or nextmonthurl="alpha num char" defaults to (month + 1)
    pmd or prevmonthdecor="alpha num char" defaults to html entitie &lsaquo
    nmd or nextmonthdecor="alpha num char" defaults to html entitie &rsaquo

    pyu or prevyearhurl="alpha num char" defaults to (year - 1)
    nyu or nextyearurl="alpha num char" defaults to (year + 1)
    pyd or prevyeardecor="alpha num char" defaults to html entitie &laquo
    nyd or nextyeardecor="alpha num char" defaults to html entitie &raquo

    w or width="num + (%|px|em|ex)" defines width for the whole calendar

    dn or dynamic="num" make dcal accept parameters sent trough the GET and POST,
                  store it in cookies (if >1) 
    tp or type="alpha" [calendar|list] render a calendar or a list of days
    hd or header="num" defaults to 0 showing a caption with month and year,
                       1 shows a caption with month and year or linked title with provided
                         titleurl  (options above)
                       2 shows a caption with month and year plus links for previous 
                         and next month and year with or without provided links
                       3 shows a caption with a select form for month and year as the title

    sw or showeek="num" shows week number defaults to 0 (no show)
    sd or showday="num" shows day nymber defaults to 1 (show)
    swd or showeekday="num" shows week day names defaults to 1 (show)

    fmt or format="alpha num char" includes the format that will override dcalin format
                         can be an entry in $DcalItemFmt or any page section

 :)

Release Notes

  • 2011-10-22 : fourth version
  • 2011-10-20 : Third version
  • 2011-10-16 : Second version
  • 2008-12-30 : First version

Known Issues

There are probably some issues, but if you find any mistakes or have ideas, please tell me.

If you are using/testing it, please let me know.

See Also

Contributors

CarlosAB December 30, 2008, at 04:21 AM

Comments

Any comments and changes are welcome. See discussion at Dcal-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.