Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
<?php

require_once "../source/activecalendar.php";
$myurl = $_SERVER['PHP_SELF'] . "?css=" . @$_GET['css'];
// the links url is this page
$cal = new activeCalendar("2007", "11");
$cal->setEvent("2007", "11", "17", "event");
// create a class="event"
$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>
 /**
  * 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;
 }
Ejemplo n.º 4
0
 /**
  * Loads datepicker
  *      
  * @param object  &$datePicker
  * @param integer $cat
  * 
  * @return null
  */
 function loadDatePicker(&$datePicker, $cat = null)
 {
     global $_CORELANG;
     if ($this->_objTpl->placeholderExists($this->moduleLangVar . '_DATEPICKER')) {
         $timestamp = time();
         $datePickerYear = $_REQUEST["yearID"] ? $_REQUEST["yearID"] : date('Y', $timestamp);
         $datePickerMonth = $_REQUEST["monthID"] ? $_REQUEST["monthID"] : date('m', $timestamp);
         $datePickerDay = $_REQUEST["dayID"] ? $_REQUEST["dayID"] : date('d', $timestamp);
         $datePicker = new \activeCalendar($datePickerYear, $datePickerMonth, $datePickerDay);
         $datePicker->enableMonthNav("?section=Calendar");
         $datePicker->enableDayLinks("?section=Calendar");
         $datePicker->setDayNames(explode(',', $_CORELANG['TXT_DAY_ARRAY']));
         $datePicker->setMonthNames(explode(',', $_CORELANG['TXT_MONTH_ARRAY']));
         $eventManagerAllEvents = new \Cx\Modules\Calendar\Controller\CalendarEventManager(null, null, $cat, null, true, false, true);
         $eventManagerAllEvents->getEventList();
         $events = $eventManagerAllEvents->getEventsWithDate();
         foreach ($events as $event) {
             $datePicker->setEvent($event["year"], $event["month"], $event["day"], " withEvent");
         }
         $datePicker = $datePicker->showMonth();
     }
 }
Ejemplo n.º 5
0
    $out = "<a href=\"" . $suiteurl . "\">Check another function</a>";
    $out .= "<table><tr><td bgcolor=\"#ffff99\" class=\"code\">";
    $out .= "Functions <b>enableYearNav()</b> and <b>showYear()</b> generate the following calendar(s):";
    $out .= "</td></tr></table><br />";
    $cal->enableYearNav($suiteurl);
    $out .= $cal->showYear();
    $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 == 6) {
    $out = "<a href=\"" . $suiteurl . "\">Check another function</a>";
    $out .= "<table><tr><td bgcolor=\"#ffff99\" class=\"code\">";
    $out .= "Functions <b>setEvent(2007,1,23) + setEvent(2007,8,2) + showYear(2007)</b> generate the following calendar:";
    $out .= "</td></tr></table><br />";
    $cal = new activeCalendar(2007);
    $cal->setEvent(2007, 1, 23);
    $cal->setEvent(2007, 8, 2);
    $out .= $cal->showYear();
    $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 == 7) {
    $out = "<a href=\"" . $suiteurl . "\">Check another function</a>";
    $out .= "<table><tr><td bgcolor=\"#ffff99\" class=\"code\">";
    $out .= "Functions <b>setEventContent(2007,1,11,\"some content\") + 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");
    $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;
Ejemplo n.º 6
0
********************************************************************************
*/
$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>
Ejemplo n.º 7
0
<?php 
$monthName = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
// The months will not have a name, just a number
$dayName = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
// The days will be in german language
$cal->monthYearDivider = " / ";
// this creates a different divider between month and year in the month`s title
$cal->setMonthNames($monthName);
$cal->setDayNames($dayName);
$cal->enableYearNav($myurl);
// this enables the year's navigation controls
$cal->enableDatePicker(2003, 2008);
// this enables the date picker (year range 2003 - 2008)
$cal->enableDayLinks($myurl);
// this enables the day links
$cal->setEvent(2005, 5, 7);
// this sets an event on 7 May 2004
$cal->setEvent(2005, 12, 20);
// this sets an event on 20 December 2004
if (!$yearID) {
    $yearID = date("Y");
}
// make sure there is an $yearID (for the following functions)
/*
********************************************************************************
set an event on 11 August every year
********************************************************************************
*/
$cal->setEvent($yearID, 8, 11);
/*
********************************************************************************
Ejemplo n.º 8
0
// unique name for the event content day
$eventContTag = "contents";
// unique name for the event contents
$eventContItemTag = "item";
// unique name for the event contents values
$eventContLinkTag = "contentlink";
// 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'];
Ejemplo n.º 9
0
    $conn = new PDO("mysql:host={$dbhost};dbname={$dbname};charset=utf8", $dbuser, $dbpass);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    echo "Connection failed (check config.php):   " . $e->getMessage();
}
$result = $conn->prepare("SELECT * FROM Event");
$result->execute();
while ($donnees = $result->fetch()) {
    $date = strtotime($donnees['Darte']);
    $y = date('Y', $date);
    $m = date('m', $date);
    $d = date('d', $date);
    $h = date('H', $date);
    $i = date('i', $date);
    $cal->setEvent($y, $m, $d, $donnees['Libelle'], "article.php?id={$donnees['ID']}");
    // create a class="event" and an <a href="this_page.php">
}
?>
 
  <div class="menu_gauche">
     <div class="image1">
    <p class="txt1">Calendrier</p>
         <center><?php 
print $cal->showMonth();
?>
</center>
    </div>
    <div class="txt1">
      <p id="cat1">Cat&eacutegories</p>
        <a href ="event_fun.php"><button id="Gbouton">Fun</button></a>&nbsp;&nbsp;<a href="event_pro.php"><button id="Gbouton">Pro</button></a>
Ejemplo n.º 10
0
<?php

require_once "../source/activecalendar.php";
$myurl = $_SERVER['PHP_SELF'] . "?css=" . @$_GET['css'];
// the links url is this page
$cal = new activeCalendar();
$cal->enableDayLinks($myurl);
// enables day links
$thisYear = $cal->actyear;
// get the current year
$cal->setEvent($thisYear, "1", "17", "event");
// create a class="event" on the 17th Jan each year
for ($x = 10; $x <= 20; $x++) {
    $cal->setEvent($thisYear, "3", $x);
}
// create a class="event" from 10th till 20th on March each year
for ($x = 5; $x <= 12; $x++) {
    $cal->setEvent($thisYear, $x, "24");
}
// create a class="event" on the 23th from May till December each year
?>
 
<?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'];
?>