Revision history for DanWestCalendar


Revision [23314]

Last edited on 2016-05-20 07:38:47 by DanWest [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[OnegWRNoDefaultCodeClass | NoDefaultCodeClass]]
~- You MUST apply the [[OnegWRNoDefaultCodeClass | NoDefaultCodeClass]] workaround first. This will prevent the //code// class from being applied prior to your formatter being run.
Deletions:
~- [[OnegWRNoDefaultCodeClass NoDefaultCodeClass]]
~- You MUST apply the [[OnegWRNoDefaultCodeClass NoDefaultCodeClass]] workaround first. This will prevent the //code// class from being applied prior to your formatter being run.


Revision [19453]

Edited on 2008-01-28 00:16:02 by DanWest [Modified links pointing to docs server]

No Differences

Revision [17864]

Edited on 2007-12-18 17:48:40 by DanWest [Modified links pointing to docs server]
Additions:
if(preg_match("/^#|^\s*$/",$csv_line)) continue;
if($cal_firstline == 0) {
preg_match("/^([^;]*);*(.*)/",$csv_line,$matches);
$cal_month = '1 ' . $matches[1];
$cal_start = strftime("%w",$cal_date);
$cal_date = strtotime($cal_eom);
$cal_days = strftime("%d",$cal_date);
$cal_firstline=1;
// Fill up cal_day array with full month of data
for($day=1;$day <= $cal_days;$day++) {
$cal_data[$day] = ' ';
continue;
}
$wrk = $csv_line;
while ($m = preg_match('/^([0-9]+);(.*)/',$wrk,$matches)) {
$cal_day = $matches[1];
$wrk = $matches[2];
$cal_data[$cal_day] = $wrk;
}
Deletions:
if(preg_match("/^#|^\s*$/",$csv_line)) continue;
if( $cal_firstline == 0){
preg_match("/^([^;]*);*(.*)/",$csv_line,$matches);
$cal_month = '1 ' . $matches[1];
$cal_start = strftime("%w",$cal_date);
$cal_date = strtotime($cal_eom);
$cal_days = strftime("%d",$cal_date);
$cal_firstline=1;
// Fill up cal_day array with full month of data
for($day=1;$day <= $cal_days;$day++) {
$cal_data[$day] = ' ';
}
continue;
}
$wrk = $csv_line;
while ($m = preg_match('/^([0-9]+);(.*)/',$wrk,$matches)) {
$cal_day = $matches[1];
$wrk = $matches[2];
$cal_data[$cal_day] = $wrk;
}


Revision [17863]

Edited on 2007-12-18 17:43:56 by DanWest [Modified links pointing to docs server]
Additions:
====Calendar Code Formatter==== >>==See Also==
Deletions:
====Calendar Code Formatter========>>==See Also==


Revision [17862]

Edited on 2007-12-18 17:43:24 by DanWest [Modified links pointing to docs server]
Additions:
//Note: The %holiday% will not display but will apply the 'holiday' class to the table cell for Jan 1//
Deletions:
//Note: The __%holiday%__ will not display but will apply the 'holiday' class to the table cell for Jan 1//


Revision [17861]

Edited on 2007-12-18 17:42:56 by DanWest [Modified links pointing to docs server]
Additions:
====Calendar Code Formatter========>>==See Also==
~- [[OnegWRNoDefaultCodeClass NoDefaultCodeClass]]
>>
//Note: The __%holiday%__ will not display but will apply the 'holiday' class to the table cell for Jan 1//
Deletions:
====Calendar Code Formatter====
~ //The %holiday% will not display but will apply the 'holiday' class to the table cell for Jan 1//


Revision [17860]

Edited on 2007-12-18 17:34:24 by DanWest [Modified links pointing to docs server]
Additions:
// formatter - cal.php
// Dan West - Dec 2007
Deletions:
// Build a calendar array


Revision [17859]

Edited on 2007-12-18 17:30:59 by DanWest [Modified links pointing to docs server]
Additions:
1;%holiday% New Years
~ //The %holiday% will not display but will apply the 'holiday' class to the table cell for Jan 1//
Deletions:
1;%holiday% New Years ''Applys the 'holiday' class to the table cell for Jan 1''


Revision [17858]

Edited on 2007-12-18 17:29:52 by DanWest [Modified links pointing to docs server]
Additions:
1;%holiday% New Years ''Applys the 'holiday' class to the table cell for Jan 1''
Deletions:
1;%holiday% New Years //Applys the 'holiday' class to the table cell for Jan 1//


Revision [17857]

Edited on 2007-12-18 17:29:28 by DanWest [Modified links pointing to docs server]
Additions:
1;%holiday% New Years //Applys the 'holiday' class to the table cell for Jan 1//
Deletions:
1;%holiday% New Years


Revision [17856]

Edited on 2007-12-18 17:28:30 by DanWest [Modified links pointing to docs server]
Additions:
====Calendar Code Formatter====
Deletions:
Placeholder for Calendar Code.
====Calendar Code Formatter====>>==See Also==
~- Future See Also Link..
>>


Revision [17855]

Edited on 2007-12-18 17:27:48 by DanWest [Modified links pointing to docs server]
Additions:
It also requires a small addition to your CSS file
/* Calendar Table */
Deletions:
It also requires a small addition to the CSS file (Taken from .code selector)
/* Calendar Table (DW) */
==To Do==
~- Add link to a demo of this formatter.


Revision [17854]

Edited on 2007-12-18 17:26:05 by DanWest [Modified links pointing to docs server]
Additions:
**Example**


Revision [17853]

Edited on 2007-12-18 17:25:09 by DanWest [Modified links pointing to docs server]
Additions:
==Usage==
15;Joes Birthday
~- You only need to enter dates you wish to 'mark' with text (//Appointments, etc//)
~- All lines begin with the day number, a semicolon ';' then the text you want in that date
~- If directly following the ';' you include //%classname%//, that class will be applied to the **<td>** date cell
~- Current 'classes'
~~- holiday - //Marks the day number in red//
~~- green - //Makes the day cell with green background//
~~- red - //Makes the day cell with red background//
~~- blue - //you guessed it..//
~~- high - //Highlight the cell (currently green)//
~- Can combine classes //(ex: 'blue holiday')//
Deletions:
==Example Page==


Revision [17852]

Edited on 2007-12-18 17:18:03 by DanWest [Modified links pointing to docs server]
Additions:
""%%(cal)""
Jan 2008
1;%holiday% New Years
""%%""
Deletions:
%%(code)
%%(cal)
Jan 2008
1;%holiday% New Years
%%
%%""


Revision [17851]

Edited on 2007-12-18 17:17:28 by DanWest [Modified links pointing to docs server]
Additions:
%%(code)
%%(cal)
Jan 2008
1;%holiday% New Years
%%
%%""
Deletions:
""%%(code)""
""%%""


Revision [17850]

Edited on 2007-12-18 17:16:14 by DanWest [Modified links pointing to docs server]
Additions:
====Calendar Code Formatter====>>==See Also==
~- Future See Also Link..
>>
==What==
~- Uses the CODE formatting feature to generate a calendar
~- The 'code' includes date / schedule information
~- Includes formatter and CSS code.
==Installation==
~- You MUST apply the [[OnegWRNoDefaultCodeClass NoDefaultCodeClass]] workaround first. This will prevent the //code// class from being applied prior to your formatter being run.
~- install the following in ##formatters/cal.php##
~- splice in the CSS code
File: **formatters/cal.php**
%%(php)
<?php
// Convert code segment into calendar
// Build a calendar array
$cal_month = '';
$cal_days = 0;
$cal_start = 0;
$cal_info = array();
// 1st line = (month year)
// ex: January 2008 or Jan 2008
$cal_firstline=0;
foreach(split("\n", $text) as $csv_n => $csv_line){
if(preg_match("/^#|^\s*$/",$csv_line)) continue;
if( $cal_firstline == 0){
preg_match("/^([^;]*);*(.*)/",$csv_line,$matches);
// Make it the 1st of the month
$cal_month = '1 ' . $matches[1];
// Get timestamp for 1st of month. Then extract values
$cal_date = strtotime($cal_month); // Convert to 1st of month
$cal_start = strftime("%w",$cal_date);

// Calculate end of month (1st of month +1 month -1 day) = End of month = Number of days in month
$cal_eom = $cal_month . ' +1 month -1 day';
$cal_date = strtotime($cal_eom);
$cal_days = strftime("%d",$cal_date);
$cal_firstline=1;
// Fill up cal_day array with full month of data
for($day=1;$day <= $cal_days;$day++) {
$cal_data[$day] = ' ';
}
continue;
}

$wrk = $csv_line;
while ($m = preg_match('/^([0-9]+);(.*)/',$wrk,$matches)) {
$cal_day = $matches[1];
$wrk = $matches[2];
$cal_data[$cal_day] = $wrk;
}
}
echo "<table class='cal'>";
echo "<tr class='head'><th width=13%>Sun</th><th width=13%>Mon</th><th width=13%>Tue</th>";
echo "<th width=13%>Wed</th><th width=13%>Thu</th><th width=13%>Fri</th><th width=13%>Sat</th></tr>\n";
// Create a COLSPAN until the 1st day of month
if(!$cal_start) {
echo "<tr>";
$dow = 0;
} else {
echo "<tr><td colspan='$cal_start' class='dim'> </td>";
$dow = $cal_start;
}
// Dump out the calendar
foreach($cal_data as $c_day=>$c_data) {
$c_class = '';
if(preg_match('/^%([^%]+)%(.*)/',$c_data,$matches)) {
$c_class = $matches[1];
$c_data = $matches[2];
}
if($dow == 7) {
echo "</tr>\n<tr class='even'>";
$dow=0;
echo "<td class='$c_class'><span class='sun'>" . $c_day . '</span> ';
} else {
echo "<td class='$c_class'><span class='day'>" . $c_day . '</span> ';
}
echo $this->format($c_data);
echo '</td>';
$dow++;
}
// Colspan for rest of week
if($dow<7) {
echo "<td class='dim' colspan='" . (7-$dow) . "'> </td>";
}
echo "</tr></table>\n";
?>
%%
It also requires a small addition to the CSS file (Taken from .code selector)
%%(css)
/* Calendar Table (DW) */
table.cal {
padding: 0 0 0 0;
border: 1px solid #888;
width: 99%;
text-align: left;
color: black;
background-color: #FFF;
border-collapse: collapse;
}
.cal tr.head {
background-color: #FFFFCF;
font: 10pt sans-serif;
color: blue;
border-bottom: 1px dotted #888;
vertical-align: top;
}
.cal tr {
background-color: #F9FFFF;
border-bottom: 1px dotted #888;
vertical-align: top;
}
.cal th {
padding: 4px 0 8px 4px;
border-bottom: 1px solid #000;
text-align: center;
}
.cal td {
font: 9pt sans-serif;
vertical-align: top;
border-bottom: 1px dotted #888;
border-right: 1px dotted #888;
padding: 4px 0 2px 8px;
height: 90px;
}
.cal td.dim {
background-color: #EEE;
}
.cal td.green,.high {
background-color: #ccffcc;
}
.cal td.red {
background-color: #FDE3E3;
}
.cal td.holiday {
xbackground-color: #F8F8F8;
}
.cal td.blue {
background-color: #DFDFFD;
}
.cal td a {
color: blue;
}
.cal td span.day {
font-weight: bold;
}
.cal td.holiday span.day {
font-weight: bold;
color: red;
}
.cal td span.sun {
font-weight: bold;
color: red;
}
%%
==Example Page==
""%%(code)""
""%%""
==To Do==
~- Add link to a demo of this formatter.
----
CategoryUserContributions


Revision [17847]

The oldest known version of this page was created on 2007-12-18 17:05:46 by DanWest [Modified links pointing to docs server]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki