<?php
/*
* Armin Randjbar-Daemi <www.omnistream.co.uk>
* armin.randjbar AT gmail.com
*
* GNU General Public License <opensource.org/licenses/gpl-license.html>
* Demo: http://www.omnistream.co.uk/calendar/
* last modified: march 2008 <ver 1.0>
*/
class CalendarEvents {
var $JSoutput;
function CalendarEvents($EventsMatrix) {
if ($EventsMatrix==NULL) return 0;
for ($i = 0; $i < count($EventsMatrix['content']); $i++)
$this->NewLine($i);//Never use nl2br(); here
$this->CreateJS($EventsMatrix);
}
function CreateJS($EventsMatrix) {
$this->JSoutput = "<script type=\"text/javascript\">
function checkfortasks (thedate, e) {
theObject = document.getElementById(\"taskbox\");
theObject.style.visibility = \"visible\";
var posx = 0; var posy = 0;
posx = e.clientX + document.body.scrollLeft;
posy = e.clientY + document.body.scrollTop;
theObject.style.left = posx + \"px\";
theObject.style.top = posy + \"px\";
objID = \"taskbox\";
var obj = document.getElementById(objID);
switch (thedate)
{";
for ($j = 0; $j < count($EventsMatrix['day']); $j++)
$this->JSoutput .= "case \"".$EventsMatrix['day'][$j]."\":
obj.innerHTML =\"<div class='taskchecker'><div class='tcpadding'>".$EventsMatrix['content'][$j]."</div></div>\";
break;
";
$this->JSoutput .= "
}
}
function hidetask (){
tObject = document.getElementById(\"taskbox\");
tObject.style.visibility = \"hidden\";
tObject.style.height = \"0px\";
tObject.style.width = \"0px\";
}
</script>";
}
function NewLine($i) {
$order = array("\r\n", "\n", "\r");
$replace = '<br />';
$EventsMatrix['content'][$i] = str_replace($order, $replace, $EventsMatrix['content'][$i]);
}
}//Class End
?>