/** * Get Calendar month box for event detail view * * @param \Cx\Modules\Calendar\Controller\CalendarEvent $event */ public function getDetailMonthBox(CalendarEvent $event) { global $_ARRAYLANG; $monthnames = explode(",", $_ARRAYLANG['TXT_CALENDAR_MONTH_ARRAY']); $daynames = explode(',', $_ARRAYLANG['TXT_CALENDAR_DAY_ARRAY']); $year = !empty($_GET['yearID']) ? contrexx_input2int($_GET['yearID']) : 0; $month = !empty($_GET['monthID']) ? contrexx_input2int($_GET['monthID']) : 0; if (empty($year) && empty($month)) { $startdate = $this->getUserDateTimeFromIntern($event->startDate); $year = $startdate->format('Y'); $month = $startdate->format('m'); } $eventList = array($event); // If event series is enabled refresh the eventlist if ($event->seriesStatus == 1) { $endDate = new \DateTime('1-' . $month . '-' . $year); $endDate->modify('+1 month'); $eventManager = new static(null, $endDate); $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent(intval($event->id)); if ($eventManager->_addToEventList($objEvent)) { $eventManager->eventList[] = $objEvent; } $eventManager->_setNextSeriesElement($objEvent); $eventList = $eventManager->eventList; } $url = \Cx\Core\Core\Controller\Cx::instanciate()->getRequest()->getUrl(); $cal = new \activeCalendar($year, $month); $cal->setMonthNames($monthnames); $cal->setDayNames($daynames); $cal->enableMonthNav($url->toString(false)); $currentTime = time(); $isNotIndependentSerieEventStarted = array(); foreach ($eventList as $objEvent) { $eventDate = $this->getUserDateTimeFromIntern($objEvent->startDate); $eventYear = $eventDate->format('Y'); $eventMonth = $eventDate->format('m'); if ($eventYear != $year && $eventMonth != $month) { continue; } $eventDay = $eventDate->format('d'); $isSeriesByNotIndependent = $objEvent->seriesStatus && !$objEvent->independentSeries; $isEventStarted = $currentTime >= $objEvent->startDate->getTimestamp(); // check if non-independent-serie-event did already start if ($isSeriesByNotIndependent) { // the first date of a non-independent-serie-event does determine if // the event did already start if (!isset($isNotIndependentSerieEventStarted[$objEvent->getId()])) { $isNotIndependentSerieEventStarted[$objEvent->getId()] = $isEventStarted; } // overwrite the started info from the serie data $isEventStarted = $isNotIndependentSerieEventStarted[$objEvent->getId()]; } $freePlaces = $isEventStarted || in_array($objEvent->registration, array(CalendarEvent::EVENT_REGISTRATION_NONE, CalendarEvent::EVENT_REGISTRATION_EXTERNAL)) || $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL && empty($objEvent->numSubscriber) || $isSeriesByNotIndependent ? 0 : $objEvent->getFreePlaces(); $eventClass = ' event_full'; $eventurl = false; if (!$isEventStarted && ($objEvent->registration == CalendarEvent::EVENT_REGISTRATION_NONE || $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL && !$objEvent->registrationExternalFullyBooked || $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL && (empty($objEvent->numSubscriber) || !\FWValidator::isEmpty($objEvent->getFreePlaces())))) { $eventClass = ' event_open'; $eventurl = $this->_getDetailLink($objEvent); } $seatsLeft = empty($freePlaces) ? ' ' : $freePlaces . ' ' . $_ARRAYLANG['TXT_CALENDAR_EVENT_FREE']; $cal->setEvent($eventYear, $eventMonth, $eventDay, $eventClass, $eventurl); $cal->setEventContent($eventYear, $eventMonth, $eventDay, $seatsLeft, $eventurl, 'free_places'); } return $cal->showMonth(false, true); }
$out .= "Functions <b>setEventContent(2007,1,11,\"some content\",\"" . $suiteurl . "\") + showMonth(2007,1)</b> generate the following calendar:"; $out .= "</td></tr></table><br />"; $cal = new activeCalendar(2007, 1); $cal->setEventContent(2007, 1, 11, "some content", $suiteurl); $out .= $cal->showMonth(); $out .= "<br /><a href=\"http://validator.w3.org/check?uri=referer\" target=\"_blank\">Validate this XHTML <span class=\"small\">(results in a new window)</span></a>"; echo $out; } if ($showcal == 9) { $out = "<a href=\"" . $suiteurl . "\">Check another function</a>"; $out .= "<table><tr><td bgcolor=\"#ffff99\" class=\"explain2\">"; $out .= "\$eventContent=array(\"content1\",\"content2\",\"content3\"); <br />Functions <b>setEventContent(2007,1,11,\$eventContent) + showMonth(2007,1)</b> generate the following calendar:"; $out .= "</td></tr></table><br />"; $cal = new activeCalendar(2007, 1); $eventContent = array("content1", "content2", "content3"); $cal->setEventContent(2007, 1, 11, $eventContent); $out .= $cal->showMonth(); $out .= "<br /><a href=\"http://validator.w3.org/check?uri=referer\" target=\"_blank\">Validate this XHTML <span class=\"small\">(results in a new window)</span></a>"; echo $out; } ?> <hr></hr> <table width="100%" border="0" bgcolor="#ffffff"> <tr> <td class="small" align="center"> <a href="http://freshmeat.net/redir/activecalendar/53267/url_demo/index.html" class="small">Active Calendar Class Online (documentation, demo, contact, downloads)</a> </td> </tr> <tr> <td class="small" align="center"> © Giorgos Tsiledakis, Greece Crete
$eventID = "event"; // sets the name of the generated HTML class on the event day (css layout) while ($data = @mysql_fetch_array($sqlID, MYSQL_BOTH)) { $mysqlDay = date("j", $data[$tblDateName]); // makes a day out of the database date $mysqlMonth = date("n", $data[$tblDateName]); // makes a month out of the database date $mysqlYear = date("Y", $data[$tblDateName]); // makes a year out of the database date $mysqlContent = $data[$tblContent]; // gets the event content $mysqlLink = $data[$tblLink]; // gets the event link $cal->setEvent($mysqlYear, $mysqlMonth, $mysqlDay, $eventID); // set the event, if you want the whole day to be an event $cal->setEventContent($mysqlYear, $mysqlMonth, $mysqlDay, $mysqlContent, $mysqlLink); // set the event content and link } echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head><title>Active Calendar Class with MySQL Events</title> <link rel="stylesheet" type="text/css" href="<?php print @$_GET['css']; ?> " /> </head> <body> <center> <?php
/* ******************************************************************************** set an event from 14 June till 18 June every year ******************************************************************************** */ for ($x = 14; $x <= 18; $x++) { $cal->setEvent($yearID, 6, $x); } /* ******************************************************************************** set an event content from 5 July till 8 July every year (in this case Google with link) ******************************************************************************** */ for ($x = 5; $x <= 8; $x++) { $cal->setEventContent($yearID, 7, $x, "Google", "http://www.google.com"); } /* ******************************************************************************** set an event content on 15 March every year the method setEventContent() accepts also an array as content parameter (4th) if you pass an array a content table with multiple (as many as the array length) tr tags will be generated ******************************************************************************** */ $multipleLinesEvent = array("Title:News", "Time:16.00", "Status:ok"); $cal->setEventContent($yearID, 3, 15, $multipleLinesEvent); /* ******************************************************************************** create the year view ******************************************************************************** */
/* ******************************************************************************** Read the event file and set the events ******************************************************************************** */ $filePath = "flatevents.txt"; // the path of the events flat file $divideStr = "~"; // the divider between events in the events flat file $eventID = "event"; // sets the name of the generated HTML class on the event day (css layout) $evts = eventsFromFile($filePath, $divideStr); if ($evts) { for ($x = 0; $x < count($evts); $x++) { //$cal->setEvent(@$evts[$x][0],@$evts[$x][1],@$evts[$x][2],$eventID); $cal->setEventContent(@$evts[$x][0], @$evts[$x][1], @$evts[$x][2], @$evts[$x][3], @$evts[$x][4]); } } echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head><title>Active Calendar Class with Flat File Events</title> <link rel="stylesheet" type="text/css" href="<?php print @$_GET['css']; ?> " /> </head> <body> <center> <?php
// unique name for the event content link /* ******************************************************************************** Call the 'parser' functions of this script and set the events ******************************************************************************** */ $evts = getXMLEvents($filePath, $eventYearTag, $eventMonthTag, $eventDayTag, $eventStyleTag, $eventLinkTag); if ($evts) { for ($x = 0; $x < count($evts[$eventYearTag]); $x++) { $cal->setEvent($evts[$eventYearTag][$x], $evts[$eventMonthTag][$x], $evts[$eventDayTag][$x], $evts[$eventStyleTag][$x], $evts[$eventLinkTag][$x]); } } $evts = getXMLEventContents($filePath, $eventContYearTag, $eventContMonthTag, $eventContDayTag, $eventContTag, $eventContItemTag, $eventContLinkTag); if ($evts) { for ($x = 0; $x < count($evts[$eventContYearTag]); $x++) { $cal->setEventContent($evts[$eventContYearTag][$x], $evts[$eventContMonthTag][$x], $evts[$eventContDayTag][$x], $evts[$eventContTag][$x], $evts[$eventContLinkTag][$x]); } } echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head><title>Active Calendar Class with XML Events</title> <link rel="stylesheet" type="text/css" href="<?php print @$_GET['css']; ?> " /> </head> <body> <center> <?php
<?php require_once "../source/activecalendar.php"; $cal = new activeCalendar("2007", "11"); $cal->setEventContent("2007", "11", "2", "Google", "http://www.google.com"); $cal->setEventContent("2007", "11", "12", "<img src=\"img/pager.png\" border=\"0\" alt=\"\" /> meeting"); $cal->setEventContent("2007", "11", "24", "<img src=\"img/ok.png\" border=\"0\" alt=\"\" /> birthday"); $multipleLinesEvent = array("Title: News", "Time: 16.00", "Status: ok"); for ($x = 6; $x <= 10; $x++) { $cal->setEventContent("2007", "11", $x, $multipleLinesEvent); } ?> <?php print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head><title>Active Calendar Class :: Example</title> <link rel="stylesheet" type="text/css" href="<?php print @$_GET['css']; ?> " /> </head> <body> <center> <?php print $cal->showMonth(); ?> <br /> <a href="../examples.php">Back to examples.php</a>