Login   Register  
PHP Classes
elePHPant
Icontem

File: examples_info

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ron Darby  >  Events Calendar  >  examples_info  >  Download  
File: examples_info
Role: Example script
Content type: text/plain
Description: Information and examples of the class usage
Class: Events Calendar
Display calendars marked with special event days
Author: By
Last change:
Date: 3 years ago
Size: 3,244 bytes
 

Contents

Class file image Download

<?php
require('EventsCalendar.class.php');

/* 
$events = array(
    'date'=>'Event Date', //required 4/10/2010, 4-10-2010, 4 October 2010
    'title'=>'Link Title', //optional
    'link'=>'URL of link',   //optional
    'target'=>'Link target');  //optional defaults _blank or linksTarget attribute if set

*/
$events = array();
$events[] = array('title'=>'Uploaded to phpClasses','date'=>'2010-10-4','link'=>'http://www.webdesign-webhost-webmaster.co.za','target'=>'_blank');
$events[] = array('title'=>'Second Test','date'=>'15-10-2010','link'=>'#');
$events[] = array('title'=>'Sec Ant','date'=>'10 May 2011','link'=>'#');
$events[] = array('title'=>'Beastly bob','date'=>'2010/12/15','link'=>'#');
$events[] = array('title'=>'Beastly bob, laugh alot','date'=>'2020-12-15','link'=>'#');

//leave call blank if no events
//$cal = new EventsCalendar();

$cal = new EventsCalendar($events);

/*
//Set the attributes of the table, th, tr and td's of the calendar and change language settings if desired, language defaults to english.
//linksTarget defaults to _blank, attributes defaults are shown below
//'emptyCell'=>'&nbsp' will set, <td>&nbsp;</td>, default blank td cells <td></td>

$attributes = array(
"linksTarget" = "_blank",
"tableAttributes"=>"width='252'",
"thAttributes"=>"valign='middle' align='center'",
"trDaysAttributes"=>"width='36'",
"tdDaysAttributes"=>"",
"tdDayAttributes"=>"",
"tdActiveAttributes"=>"",
"tdEmptyAttributes"=>"",
"emptyCell"=>"",
"Mon"=>"M",
"Tue"=>"D",
"Wed"=>"W",
"Thu"=>"D",
"Fri"=>"V",
"Sat"=>"S",
"Sun"=>"S",
"Jan"=>"Januarie",
"Feb"=>"Februarie",
"Mar"=>"Maart",
"Apr"=>"April",
"Jun"=>"Junie",
"Jul"=>"Julie",
"Aug"=>"Augustus",
"Sep"=>"September",
"Oct"=>"Oktober",
"Nov"=>"November",
"Dec"=>"Desember"
);
*/

?>
<style type="text/css">
#box{width:800px;margin:0 auto;border:solid thin #000;}
.active{font-weight:bold;}
.active a{text-decoration:none;background:#FF0;display:block;}
.days{color:#00F;width:36px;}
.day,.active,.days{text-align:center}
.monthName{color:#390;font-family:Verdana;}
.month{width:252px;;display:inline-table;margin:0 5px;}
</style>
<?php



$attributes 
= array(
"tableAttributes"=>"class='month' cellspacing='2' cellpadding='2' border='1'",
"thAttributes"=>"class='monthName'",
"trDaysAttributes"=>"class='days'",
"tdDayAttributes"=>"class='day'",
"tdActiveAttributes"=>"class='active'",
"Mon"=>"M",
"Tue"=>"D",
"Wed"=>"W",
"Thu"=>"D",
"Fri"=>"V",
"Sat"=>"S",
"Sun"=>"S",
"Jan"=>"Januarie",
"Feb"=>"Februarie",
"Mar"=>"Maart",
"Apr"=>"April",
"Jun"=>"Junie",
"Jul"=>"Julie",
"Aug"=>"Augustus",
"Sep"=>"September",
"Oct"=>"Oktober",
"Nov"=>"November",
"Dec"=>"Desember"
);
$cal->attributes($attributes);


?>
<div id="box">
<?php

//return this months calendar
//echo $cal->month();

//return calendar for month specified $period = array( 'm' , 'Y' )
//$period = array('12','2010');  //returns December 2010
//echo $cal->month($period);

//return this years calendar
//echo $cal->year();

//return 2020 calendar
//echo $cal->year('2020');

//return this current month as start month with 12 month forcast into following year
echo $cal->year('',true);

?></div>