Пример #1
0
 /**
  * Returns the source-code for a calendar in the "month"-view.
  *
  * @param   integer     $intYear: This year will be selected. If empty it will be used the current year.
  * @param   integer     $intMonth: This month will be selected. If empty it will be used the current month.
  * @param   integer     $intDay: This day will be selected. If empty it will be used the current day.
  * @return  strign      html-source for the calendar.
  */
 function getCalendar($intYear = 0, $intMonth = 0, $intDay = 0)
 {
     global $_ARRAYLANG;
     $intYear = intval($intYear);
     $intMonth = intval($intMonth);
     $intDay = intval($intDay);
     $objCalendar = new \activeCalendar($intYear, $intMonth, $intDay);
     $objCalendar->setMonthNames(explode(',', $_ARRAYLANG['TXT_BLOG_LIB_CALENDAR_MONTHS']));
     $objCalendar->setDayNames(explode(',', $_ARRAYLANG['TXT_BLOG_LIB_CALENDAR_WEEKDAYS']));
     $objCalendar->setFirstWeekDay(1);
     $objCalendar->enableMonthNav('index.php?section=Blog&cmd=search&mode=date');
     $arrEntriesInPeriod = $this->getEntriesInPeriod(mktime(0, 0, 0, $intMonth, 1, $intYear), mktime(0, 0, 0, $intMonth, 31, $intYear));
     if (count($arrEntriesInPeriod) > 0) {
         foreach ($arrEntriesInPeriod as $intTimeStamp) {
             $objCalendar->setEvent($intYear, $intMonth, date('d', $intTimeStamp), null, 'index.php?section=Blog&cmd=search&mode=date&yearID=' . $intYear . '&monthID=' . $intMonth . '&dayID=' . date('d', $intTimeStamp));
         }
     }
     return $objCalendar->showMonth();
 }
Пример #2
0
$yearID = false;
// GET variable for the year (set in Active Calendar Class), init false to display current year
$monthID = false;
// GET variable for the month (set in Active Calendar Class), init false to display current month
$dayID = false;
// GET variable for the day (set in Active Calendar Class), init false to display current day
extract($_GET);
$cal = new activeCalendar($yearID, $monthID, $dayID);
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 Month View Example</title>
<link rel="stylesheet" type="text/css" href="activecalendar.css" />
</head>
<body>
<center>
<?php 
$cal->enableMonthNav();
// this enables the month's navigation controls
$cal->enableDatePicker(2002, 2006, $myurl);
// this enables the date picker controls
$cal->enableDayLinks($myurl);
// this enables the day links
echo $cal->showMonth();
// this displays the month's view
?>
</center>
</body>
</html>
 /**
  * Returns the calendar boxes
  *      
  * @param  integer $boxes  Number of boxes
  * @param  year    $year   Year
  * @param  integer $month  month
  * @param  integer $day    day
  * @param  integer $catid  category id
  * 
  * @return string  calendar boxes
  */
 function getBoxes($boxes, $year, $month = 0, $day = 0, $catid = 0)
 {
     global $_ARRAYLANG, $objInit;
     if ($catid != 0 && !empty($catid)) {
         $url_cat = "&amp;catid={$catid}";
     } else {
         $url_cat = "";
     }
     $url = htmlentities($this->calendarBoxUrl, ENT_QUOTES, CONTREXX_CHARSET) . $url_cat;
     $firstblock = true;
     $month = intval($month);
     $year = intval($year);
     $day = intval($day);
     $monthnames = explode(",", $_ARRAYLANG['TXT_CALENDAR_MONTH_ARRAY']);
     $daynames = explode(',', $_ARRAYLANG['TXT_CALENDAR_DAY_ARRAY']);
     $calenderBoxes = '';
     for ($i = 0; $i < $boxes; $i++) {
         $cal = new \activeCalendar($year, $month, $day);
         $cal->setMonthNames($monthnames);
         $cal->setDayNames($daynames);
         if ($firstblock) {
             $cal->enableMonthNav($url);
         } else {
             // This is necessary for the modification of the linkname
             // The modification makes a link on the monthname
             $cal->urlNav = $url;
         }
         // for seperate variable for the month links
         if (!empty($this->calendarBoxMonthNavUrl)) {
             $cal->urlMonthNav = htmlentities($this->calendarBoxMonthNavUrl, ENT_QUOTES, CONTREXX_CHARSET);
         }
         //load events
         foreach ($this->eventList as $objEvent) {
             if ($objEvent->access && $objInit->mode == 'frontend' && !\Permission::checkAccess(116, 'static', true)) {
                 continue;
             }
             $startdate = $objEvent->startDate;
             $enddate = $objEvent->endDate;
             $eventYear = date("Y", $startdate);
             $eventMonth = date("m", $startdate);
             $eventDay = date("d", $startdate);
             $eventEndDay = date("d", $enddate);
             $eventEndMonth = date("m", $enddate);
             // do only something when the event is in the current month
             if ($eventMonth <= $month && $eventEndMonth >= $month) {
                 // if the event is longer than one day but every day is in the same month
                 if ($eventEndDay > $eventDay && $eventMonth == $eventEndMonth) {
                     $curday = $eventDay;
                     while ($curday <= $eventEndDay) {
                         $eventurl = $url . "&amp;yearID={$eventYear}&amp;monthID={$month}&amp;dayID={$curday}" . $url_cat;
                         $cal->setEvent("{$eventYear}", "{$eventMonth}", "{$curday}", false, $eventurl);
                         $curday++;
                     }
                 } elseif ($eventEndMonth > $eventMonth) {
                     if ($eventMonth == $month) {
                         // Show the part of the event in the starting month
                         $curday = $eventDay;
                         while ($curday <= 31) {
                             $eventurl = $url . "&amp;yearID={$eventYear}&amp;monthID={$month}&amp;dayID={$curday}" . $url_cat;
                             $cal->setEvent("{$eventYear}", "{$eventMonth}", "{$curday}", false, $eventurl);
                             $curday++;
                         }
                     } elseif ($eventEndMonth == $month) {
                         // show the part of the event in the ending month
                         $curday = $eventEndDay;
                         while ($curday > 0) {
                             $eventurl = $url . "&amp;yearID={$eventYear}&amp;monthID={$month}&amp;dayID={$curday}" . $url_cat;
                             $cal->setEvent("{$eventYear}", "{$eventEndMonth}", "{$curday}", false, $eventurl);
                             $curday--;
                         }
                     } elseif ($eventMonth < $month && $eventEndMonth > $month) {
                         foreach (range(0, 31, 1) as $curday) {
                             $eventurl = $url . "&amp;yearID={$eventYear}&amp;monthID={$month}&amp;dayID={$curday}" . $url_cat;
                             $cal->setEvent("{$eventYear}", "{$month}", "{$curday}", false, $eventurl);
                         }
                     }
                 } else {
                     $eventurl = $url . "&amp;yearID={$eventYear}&amp;monthID={$month}&amp;dayID={$eventDay}" . $url_cat;
                     $cal->setEvent("{$eventYear}", "{$eventMonth}", "{$eventDay}", false, $eventurl);
                 }
             }
         }
         $calenderBoxes .= $cal->showMonth(false, true);
         if ($month == 12) {
             $year++;
             $month = 1;
         } else {
             $month++;
         }
         $day = 0;
         $firstblock = false;
     }
     return $calenderBoxes;
 }
Пример #4
0
$cal->setEvent("2007", "11", "7");
// create a class="event" (defaul)
$cal->setEvent("2007", "11", "20", "event", $myurl);
// create a class="event" and an <a href="this_page.php">
for ($x = 27; $x <= 30; $x++) {
    $cal->setEvent("2007", "11", $x);
}
// create a class="event" from 27th till 30th
?>
 
<?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>
</center>
</body>
</html>
Пример #5
0
    $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">
&copy; Giorgos Tsiledakis, Greece Crete
</td>
Пример #6
0
require_once "../source/activecalendar.php";
$cal = new activeCalendar();
$cal->enableWeekNum("Week");
// enables week number column
$cal->setFirstWeekDay(0);
// '0' -> Sunday , '1' -> Monday
?>
 
<?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(true);
// 'true' to display no current month days as well
?>
<br />
<a href="../examples.php">Back to examples.php</a>
</center>
</body>
</html>
Пример #7
0
include "activecalendar.php";
$yearID = false;
$monthID = false;
$dayID = false;
$weekID = false;
$showcal = false;
extract($_GET);
$cal = new activeCalendar($weekID, $yearID, $monthID, $dayID);
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"activecalendar.css\"></link>\n";
?>
<style type="text/css">
<!--
.code {font-family: "Courier New", Courier, Arial, mono; font-size: 12px; font-weight: bold; color: #000099; text-align: right}
.explain {font-family: Tahoma, Arial, mono; font-size: 12px; font-weight: bold; color: #000000; text-align: left}
.explain2 {font-family: "Courier New", Courier, Arial, mono; font-size: 12px; font-weight: bold; color: #000099; text-align: left}
.mtable {border-width: 2px; border-style:outset; border-color: #eeeeee;}
.small { font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 10px}
-->
</style>
</head>
<body>
<center>
<h2>Calendario</h2>
<?php 
$cal->enableDatePicker(2000, 2010);
$cal->enableDayLinks();
$cal->enableWeekLinks();
$cal->enableDatePicker();
$out = $cal->showMonth();
echo $out;