PHP Classes


Recommend this page to a friend!
  Classes of Valerio Granato   CalendarioClass   DOCUMENTATION   Download  
Role: Documentation
Content type: text/plain
Description: English Documentation
Class: CalendarioClass
A class useful to create calendars and organizers
Author: By
Last change:
Date: 20 years ago
Size: 8,201 bytes


Class file image Download
------------ Calendario Class Version 1.0 - Copyright (C) 2003 Valerio Granato (valerio at - Last Modified: 2003-07-02 15:56 CEST The documentation is available both in English and in Italian. Italian version is in the DOCUMENTATION.ITA file. Table of contents 1. Brief description 2. Getting started 3. Configuration 3.1 Parameters 4. Supplied Properties and Methods 4.1 Properties 4.2 Methods 5. License 6. Author 7. Donations 7.1 Why donate? 8. Notes 1. Brief description The idea for this script is from, originally written by William J Sanders and reprogrammed by Jose-Manuel Contardo. This is an (almost) completely new version by Valerio Granato (valerio at to have a configurable calendar to use on various websites. String outputs are based on system's locale (see setlocale()). This script is distributed under LGPL Version 2.1 or later, as you can see on See the COPYING file for more information. If you use this class in your work, or you appreciate my work, please make a link to and/or (at your option) make a donation (see same link). 2. Getting started If you would to start in a second, simply include the class into your script and then add <?php $cal = new Calendario(array(MonthShift => '1')); OR $cal = new Calendario(array(TimeStamp => '1056992797')); echo $cal->TheMonthName(); echo $cal->ShowMonth(); ?> When you initialize the class, the global class time is set according to your 'MonthShift' or 'TimeStamp'. All other shifts you use calling functions are referred to the global class time. If you would to change this time later, you have to use SetMonthShift() or SetTimeStamp() functions. 3. Configuration You could set many parameters at class initialization (or later, except for MonthShift and TimeStamp, for which you have to use the appropriate function). 3.1 Parameters int TableBorder string TableWidth string BGCellColor string BGCellColorToday string BGCellColorBlank string BGCellColorHolidays string FontFace string FontFaceToday string FontFaceBlank string FontFaceHolidays string FontColor string FontColorToday string FontColorBlank string FontColorHolidays string Link int WeekStart int ShowBlanks int HowManyDays string DaysFormat array Days array Holidays int ShowHolidays - int TableBorder (default 0) The table's border width. - string TableWidth (default 300) The table width. - string BGCellColor (default #C0C0C0) - string BGCellColorToday (default #000000) - string BGCellColorBlank (default #FFFFFF) - string BGCellColorHolidays (default #FF0000) - string FontFace (default Verdana, Arial) - string FontFaceToday (default Verdana, Arial) - string FontFaceBlank (default Verdana, Arial) - string FontFaceHolidays (default Verdana, Arial) - string FontColor (default #000000) - string FontColorToday (default #FFFFFF) - string FontColorBlank (default #000000) - string FontColorHolidays (default #FFFFFF) BGCellColor is the cells' background color. FontFace is the font used when printing days. FontColor is the text color. 'Today' refers to today 'Blank' refers to days not belonging to the month. 'Holidays' refers to holidays. - string Link (default null) 'Link' will be printed as a HREF in this way: <A HREF="$Link?timestamp"> where 'timestamp' is the timestamp of the day. - int WeekStart (default 1) The week's starting day, from 0 (sunday) to 7 (sunday, too). - int ShowBlanks (default 1) If 1, in the calendar will be printed previous and next months' days, to fill first and last week. - int HowManyDays (default 7) How many days to show in a week. For example, if WeekStart is 1 and HowManyDays is 5, days from monday to friday will be printed. - string DaysFormat (default %d %B %Y) The format string passed to strftime(). - array Days (default array('Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa', 'Do')) Day names printed on the first row of the calendar. - array Holidays (default array('easter', 'christmas', 'newyear', 'epiphany', 'labourday')) Holidays to display. At the moment the scripts supports: easter - Catholic Easter christmas - Catholic Christmas newyear - January, 1 epiphany - Catholic Epiphany orthodoxnewyear - Orthodox New Year orthodoxepiphany - Orthodox Epiphany nawroz - Kurdish New Year ramanavani - birthday of Rama orthodoxeaster - Orthodox Easter labourday - May, 1 poson - Sri Lanka conversion to Buddhism These are holidays I remember; if you want other ones added to the script drop me a line to valerio at - int ShowHolidays (default 1) If 1 holidays will be shown. 4. Supplied properties and methods The class supply some properties and methods, to help you build your own calendar. 4.1 Properties - int TimeStamp The timestamp of the day's midnight, referring to the class global time. - int MonthShift The month shift between 'now' and the class global time. - int first_week_day_ts - int last_week_day_ts In format UNIX timestamp - string first_week_day - string last_week_day - string today In format DD Month YYYY. 4.2 Methods - int SetMonthShift([int monthshift]); - int SetTimeStamp([int timestamp]); Set the global class time according to input data. - int CalculateMonthShift(int timestamp); Calculates the month shift between 'now' and the input timestamp. - string MonthName([int shift]); Returns the month name, according to the system locale, referring to the global class time + $shift. - int Year([int shift]); Returns the 4-digits year, referring to the global class time + $shift. - string DoubleYear([int shift]); Returns the 4-digits year, referring to the global class time + $shift and, if differs, the 4-digit year of the next month. - int ShowMonth([int shift]); Prints a table with the calendar of this month + $shift, referring to the global class time. Always returns 0. 5. License This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or to Valerio Granato c/o LiveNET S.r.l., Centro Direzionale di Napoli, I-80143 Naples, Italy. 6. Author The author is Valerio Granato <valerio at>. You can download the latest version of the script at 7. Donations If you appreciate my work please make a little donation using PayPal on or directly sending euros to Valerio Granato c/o LiveNET S.r.l. Centro Direzionale di Napoli Is. A7 Sc. C I-80139 Naples (Italy) Read 7.1 about 'why donate'. 7.1 Why donate? I work as a programmer and, when I write a script I think is useful to others, I make it available to everyone for free. Money I receive via donations is used to support people I know need it. Currently I don't give money received via donations to humanitarian associations or similar (I give of mine for them); I simply take banknotes, put them in an envelope and give it to a person I know have money needs. So if you gain money using my work, or think it have a value you would to pay, please donate and you'll help someone. 8. Notes If you modify this script and you would, send me the modified version, so I can publish your version on my site.