PHP Classes

Plugin Cal class: Calendar input plugin for a forms generation class

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 40%Total: 1,202 This week: 1All time: 3,152 This week: 560Up
Version License Categories
plugin_cal_class 1.0GNU General Publi...HTML, Time and Date
Description 

Author

This class is a plugin that implements a calendar custom input for the forms generation and validation class by Manuel Lemos.

It is based on the cal_class originally written by Andrea Bersi.

The custom input implements a calendar data selection control that allows navigating between calendar months.

Picture of Alessandro Bianchi
Name: Alessandro Bianchi <contact>
Classes: 2 packages by
Country: Italy Italy
Age: 59
All time rank: 143959 in Italy Italy
Week rank: 411 Up18 in Italy Italy Up

Details

NEW VERSION 2.1 =============== This cass implements a popup calendar in Manuel Lamos' Forms Generation and Validation master class. NEW FEATURES IN THIS VERSION a) PHP5 only (sorry) b) Doesn't need any external javascript file inclusion c) Allows manual input of the date in the filed and/or calendar direct selection d) supports image button for popping out the calendar e) implements the ValidateInput method f) major rewrite to be fully coherent with the master class g) if allowedManual then javascript validation code is automatically generated Here is an implementation example and the parameters the control accepts require_once("classes/cal_class.php"); $form->AddInput(array( "TYPE"=>"custom", "NAME"=>"born", "ID"=>"born", "CustomClass"=>"form_calendar_class", "STARTDATE"=>"2005-2-12", // lowest acceptable value: default no limit "ENDDATE"=>"today", // highest acceptable value default no limit // magic "today" in any date definition // parametr sets the value to today "LABEL"=>"Bith's date", // the control label "VALUE"=>"2005-11-27", // date in SQL format "VALIDDAYS"=>"1,2,3", // means Mon Tue Wen are valid days // 0= Sunday 6=Saturday // default: all week is valid "Accessible"=>0, // 0 = not Accessible - displays the date but // doesn't allow any change 1=editable default 0 "AllowManual"=>true, // allows the user to manually type the date in the field // it also shows the button/icon to display the calendar for // point and click selection "LANG"=>"en", // language for the calendar // valid are "it" (default) for // italian and "en" for english "FORMAT"=>"1", // date format: 1 = MM/DD/YYY // 2 (defaulr) = DD/MM/YYY // when you set LANG it defaults to // the correct diplay "it" (default) for // DD/MM/YYYY display and "en" for // MM/DD/YYYY "SELBG"=>"Green", // today's background color default Green "MONTHBG"=>"Red", // month's name background color "MONTHTX"=>"White", // month's name text color "WEEKBG"=>"Orange", // week's name background color "WEEKTX"=>"Green", // week's name text color "TODAY"=>"Yellow", // today's higlight color "OFFMONTH"=>"AntiqueWhite", // off month days color "WEEKEND"=>"LightGray", // weekend's highlight color "CLASS"=>"theCSSClass", // CSS class for the input field "OPTIONAL"=>1, // is the field optional? 0=no=default - 1 = yes "NotEmptyErrorMessage"=>"Your text", // text for validation failure "NotEmpty"=>1 // 0 = no = default - 1 = yes "InvalidStartMessage"=>"Your custom start error message", "InvalidEndMessage"=>"Your custom end error message", "CalendarIcon"=>"images/icons/b_calendar.png" // complete path to the image to be displayed // instead of button // if not specified a button will be displayed )); You can take off the SQL parameter from the $_POST as _sql___{your-field-name}_calendar p.e. in case the NAME is "birth" the SQL param will be _sql__birth_calendar ^^ Please pay attention to the fact that after _sql there are 2 underscores Any valid forms' class tag for text fields should work If you find any bug or fix any functionality, please let me know. And if you like it, I'd love to hear it. Best Regards Alessandro Bianchi Italy 30-04-2006 HERE FOLLOWS THE ORIGINAL VERSION 1 README FILE - PLEASE READ CAREFYLLY ======================================================================= This is the original Andrea's Bersi release notes for his code: /* This new version of the little toy, at 19 november 2005, let you to set as link not all days of the week NB: THERE IS A LITTLE BUG IN THE CORE JAVASCRIPT: SOMETIME , in the previous month, the days linkable are not active; please report any other bug or problem at andreabersi@gmail.com Ciao Andrea Bersi AOSTA (ITALY) http://abmcr.altervista.org */ /******************************************** ADAPTATION NOTES AND EXAMPLES This is a wonderful piece of software, but I use Manuel Lamos' Form Generation and validation class. I don't feel confortable with the date plugin so when I sow Andrea' work I decided to port it in a plugin fashion. The goal was to have a class that can drive the user to only select the required days and to accept and provide data in SQL format, just to avoid any conversion work. All the merit for the class functionality goes to Andrea Bersi as above. The main changes in the class are as follows: - it accepts SQL formatted date (p.e. 2005-11-19) - in the output is included an hidden field preformatted in SQL ready to use. That required to add a simple function to the javascript file, the field displays the date in the desired formatting - introduced the requested methods to suite to Manuel's form_custom_class Here is an implementation example and the parameters the control accepts require_once("classes/cal_class.php"); echo '<script language="javascript" type="text/javascript" src="classes/calendar.core.js"></script>'; $form->AddInput(array( "TYPE"=>"custom", "NAME"=>"born", "ID"=>"born", "CustomClass"=>"form_calendar_class", "STARTDATE"=>"2005-2-12", // lowest acceptable value: default no limit "ENDDATE"=>"today", // highest acceptable value default no limit // magic "today" in any date definition // parametr sets the value to today "LABEL"=>"Bith's date", // the control label "VALUE"=>"2005-11-27", // date in SQL format "VALIDDAYS"=>"1,2,3", // means Mon Tue Wen are valid days // 0= Sunday 6=Saturday // default: all week is valid "Accessible"=>0, // 0 = non editable 1=editable default 0 "LANG"=>"en", // language for the calendar // valid are "it" (default) for // italian and "en" for english "FORMAT"=>"1", // date format: 1 = MM/DD/YYY // 2 (defaulr) = DD/MM/YYY // when you set LANG it defaults to // the correct diplay "it" (default) for // DD/MM/YYYY display and "en" for // MM/DD/YYYY "SELBG"=>"Green", // today's background color default Green "MONTHBG"=>"Red", // month's name background color "MONTHTX"=>"White", // month's name text color "WEEKBG"=>"Orange", // week's name background color "WEEKTX"=>"Green", // week's name text color "TODAY"=>"Yellow", // today's higlight color "OFFMONTH"=>"AntiqueWhite", // off month days color "WEEKEND"=>"LightGray", // weekend's highlight color "CLASS"=>"theCSSClass", // CSS class for the input field "OPTIONAL"=>1, // is the field optional? 0=no=default - 1 = yes "NotEmptyErrorMessage"=>"Your text", // text for validation failure "NotEmpty"=>1 // 0 = no = default - 1 = yes )); You can take off the SQL parameter from the $_POST as _sql___{your-field-name}_calendar p.e. in case the NAME is "birth" the SQL param will be _sql__birth_calendar ^^ Please pay attention to the fact that after _sql there are 2 underscores Alessandro Bianchi 19-9-2005 alex at skynet-srl.com ***********************************************/ FAQ: Q: I try to run the example but it complains about a form.php file that is not included in the class. How do I get it? A: The forms.php is the master class provided from Forms Validation and Generation Class by Manuel Lemos. You need to install it and place the plugin class at the root level where if finds the forms.php Q: I don't want to use a plugin: How may I use your class as stand alone? A: My class is deeply chained with Manuel Lemos' one. If you need a stand alone calendar class, look at cal_date class. It is the original code I started from, and it works pretty well

Screenshots  
  • example.gif
  Files folder image Files  
File Role Description
Image file b_calendar.png Icon Calendar icon for icon buttons
Plain text file cal_class.php Class The plugin class
Plain text file example.html.php Example Template to display the example
Plain text file example.php Example Example file
Plain text file README Doc. The documentation and FAQ for the class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,202
This week:1
All time:3,152
This week:560Up
User Ratings User Comments (1)
 All time
Utility:50%StarStarStar
Consistency:50%StarStarStar
Documentation:50%StarStarStar
Examples:50%StarStarStar
Tests:-
Videos:-
Overall:40%StarStarStar
Rank:3776
 
Excellent
14 years ago (kishore kumar)
80%StarStarStarStarStar