Ical/csv And Pdf Calendars

Simple PHP ICAL/CSV and PDF calendar generation

I need a module for my custom CMS to generate ICAL/CSV and PDF calendar files.
Both scripts will take a given multidimensional array of several appointments or events cointaining, date, text, cell color and icon. For example some of those appointment may be:

$myAppointemnts[]=array ( ‘date’ => ‘2010-06-28’, //YYYY-MM-DD
‘text’ => ‘Remember tax declaration’,
‘cellColor’ => ’58D1C3′, //hex format without #
‘icon’ => ‘full/path/to/my/png/file/money.png’ );

$myAppointemnts[]=array ( ‘date’ => ‘2010-08-21’,
‘text’ => ‘Renew passport, remember to take a nice photo!’,
‘cellColor’ => ‘D0DE99’,
‘icon’ => ‘full/path/to/my/png/file/paperwork.png’ );

$myAppointemnts[]=array ( ‘date’ => ‘2010-09-11’,
‘text’ => ‘Moms birthday’,
‘cellColor’ => ‘F5D5ED’,
‘icon’ => ‘full/path/to/my/png/file/gift.png’ );

Please, note that these appointmets or tasks has no starting/ending time: they all are full day events. Icon files and cell colors will be ignored in ICAL/CSV script, they will just be used in PDF generation. Also note that there will not be more than one event on the same date.

The ICAL/CSV script will be able to take these data in the array and generate ICAL and CSV files. Those files must be Google Calendar, Outlook, ICAL and most calendar/email/task software compatible. So our users may be able to import those files into their applications. We will include you script in our CMS and will call your a function something like:

generateDataCalendar(‘ical’, $myAppointments); //for an ical file
generateDataCalendar(‘csv’, $myAppointments); //for an csv file

Please, remember there are several premade scripts to create ical and csv files (I can remember iCalcreator) I don’t mind you to use then but keep it simple and understandable.

The PDF script will work in a similar way, but it with bit more information. The module will generate horizontal DIN A4 (297 mm width x 210 mm height) PDF files with one month per page calendar and many pages as needed to fit appointments into calendar from first to final event; for example 20 appointments: 5 in January, none in February, 10 in March and 5 in April; a 4 page PDF file will be generated. 1 page for January, 1 page for February, 1 page for for March and 1 page for April. Even if February has no events there will be a calendar page for that month.

Our CMS will include the pdf script module and will use it by calling a function something like:

generatePdfCalendar(‘es’, 1, $classicTemplate, $myAppointments)

First parameter (for example ‘es’) is the language used to generate the calendar. So we will have something like:

monthnames[‘en’]=array(‘1’ => ‘January’, ‘2’, ‘February’, … ’12’, ‘December’);
monthnames[‘es’]=array(‘1’ => ‘Enero’, ‘2’, ‘Febrero’, … ’12’, ‘Diciembre’);
/we start month names array index in 1 to keep date php functions values

weekdaynames[‘en’]=array(‘0’ => ‘Sunday’, ‘1’ => ‘Monday’, … ‘6’ => ‘Saturday’);
weekdaynames[‘es’]=array(‘0’ => ‘Domingo’, ‘1’ => ‘Lunes’, … ‘6’ => ‘Sábado’);
/we start weekday names array index in 0 to keep date php functions values

You don’t have to worry about this, we will have add as many languages as needed by creating month and weekday names arrays. You’ll just need to global those arrays to use then into your function.

Please note that some foreign weekday and month names may need UTF8 characters such as accents and so on.

The second parameter of the function (number 1 in the example) will be the week day that will be used as starting week weekday. For example, English and saxon calendar weeks starts on Sunday, while Spanish and Latinamerican ones starts on Monday and other countries or business may need other starting weekday. 0 will be Sunday, 1 will be Monday… and 6 will be Saturday.

The third parameter in the example $classicTemplate will be an array that will contain all the configuration data and variables in relation with PDF design and aspect such as fonts, sizes, strokes, borders, colors. logos, texts, positions… everything that we would need to customize the calendar dessign so based on your templates we can create some more. You are required to create at least 3 PDF templates configuration arrays. I attached a graphic example from expected PDF calendars designs.

On the fly PDF, CSV and ICAL generated files must be prompted with a ‘save as’ force download header.

All code must be clean and very well commented. You must use meaninful variariable and function names so we can understand everything you do.

50% Escrow deposit at project acceptance
50% Escrow deposit at project conclusion after seeing demo in your server.
First deposit release after receiving working code.
Second deposit release after testing in our server and fixing minor bugs or little problems one fully checked.

I edit to add this information:

I’ve been asked if PDFLib is available in out server. It is not. We don’t have PDFLib at this moment in our server. I’d rather to use -only if possible- technologies that may run in shared hosting environments. But if you think that PDFLib is a must or highly recommended for this project let us know in your bid and we will consider about it.

Leave a Reply

Your email address will not be published. Required fields are marked *