Tutorials

Eine immer größer werdende Tutorialdatenbank.

PHP-Fusion Core

Aktuelle PHP-Fusion Vollversionen und Updates

Addon Downloads

Alle Downloads garantiert Kostenlos

Support 24/7

24 Stunden, 7 Tage die Woche, das ganze Jahr.

Thema ansehen
Panel Code Needed Thema drucken
Benutzeravatar

Jung Mitglied


afoster Geschrieben am 11.04.2019 um 22:19
 #1 Beitrag drucken Top
I have been trying to set up a panel that will pull information from a calendar in another directory and display in a panel. I can't seem to figure out how to enter the code to make this happen. This is what I have been trying to do.


openside('Side block');
?>

<!-- html code goes here -->
require("http://domainname.com/calendar/display03.php");

<?php
closeside();


But it is not working.
Beiträge: 15 
Benutzeravatar

Seiten Administrator


David Geschrieben am 29.04.2019 um 01:56
 #2 Beitrag drucken Top
Hey Afoster,

sorry for the late Answer.

At First, you cannot require files with http:// (extern Server), only files which are on the same Server.
Than, you must use require as PHP-Code.


openside('Side block');
require_once BASEDIR."calendar/display03.php";
closeside();


BASEDIR means, that the Path starts in the Folder, where are the maincore.php
Liebe Grüße, euer David.


Aktiver PHP-Fusion Nutzer seit 3. September 2006
--------------------------------------------------------
PHP-Fusion Österreich Seitenbetreiber.
Beiträge: 434 
http://www.php-fusion.at/ 
Benutzeravatar

Jung Mitglied


afoster Geschrieben am 30.04.2019 um 15:56
 #3 Beitrag drucken Top
Thanks for your response David...so if I understand you correctly if display03.php is in the same domain it would be written as require_once BASEDIR."./luxcal/display03.php"; and would work or does the file have to reside in the same folder as the php-fusion files?
Beiträge: 15 
Benutzeravatar

Seiten Administrator


David Geschrieben am 02.05.2019 um 03:23
 #4 Beitrag drucken Top
Yes Afoster,

the file must be on the same Webspace / Webserver.

require_once Examples:

Same Place as maincore.php

require_once BASEDIR."file.php";


In a Subfolder of PHP-Fusion

require_once BASEDIR."subfolder/file.php";


In a upper Folder than PHP-Fusion (for each upper Folder you must add ../)

require_once BASEDIR."../file.php"; 


In a Subfolder, who is in a upper Folder than PHP-Fusion (for each upper Folder you must add ../)

require_once BASEDIR."../subfolder/file.php";
Liebe Grüße, euer David.


Aktiver PHP-Fusion Nutzer seit 3. September 2006
--------------------------------------------------------
PHP-Fusion Österreich Seitenbetreiber.
Beiträge: 434 
http://www.php-fusion.at/ 
Benutzeravatar

Jung Mitglied


afoster Geschrieben am 02.05.2019 um 16:32
 #5 Beitrag drucken Top
Thanks David...that answers my question. I have been trying to pull the information from another domain with the same webhost.

Zusammengefügt am 02. Mai 2019 um 18:27:13:
David, following your suggested code, I can't seem to get it to work for me. The file I want displayed is in the following tree:

domain.com/luxcal/file.php

pho-fusion is in the following

domain.com/testsite/

Both are in the same webserver. What would be the code based on your suggestion to display file.php using the panels module in php-fusion.
Bearbeitet von afoster am 02.05.2019 um 18:27
Beiträge: 15 
Benutzeravatar

Seiten Administrator


David Geschrieben am 02.05.2019 um 23:01
 #6 Beitrag drucken Top
Hey Afoster,

please try the following require:

require_once BASEDIR."../luxcal/file.php";
Liebe Grüße, euer David.


Aktiver PHP-Fusion Nutzer seit 3. September 2006
--------------------------------------------------------
PHP-Fusion Österreich Seitenbetreiber.
Beiträge: 434 
http://www.php-fusion.at/ 
Benutzeravatar

Jung Mitglied


afoster Geschrieben am 02.05.2019 um 23:56
 #7 Beitrag drucken Top
Using your suggested code


openside('Events');
require_once BASEDIR."../luxcal/display03.php";
closeside();


Displays the following:

Events
No config data!

I am obviously doing something wrong.
Beiträge: 15 
Benutzeravatar

Seiten Administrator


David Geschrieben am 03.05.2019 um 04:48
 #8 Beitrag drucken Top
Please Show me the display03.php File.
Liebe Grüße, euer David.


Aktiver PHP-Fusion Nutzer seit 3. September 2006
--------------------------------------------------------
PHP-Fusion Österreich Seitenbetreiber.
Beiträge: 434 
http://www.php-fusion.at/ 
Benutzeravatar

Jung Mitglied


afoster Geschrieben am 03.05.2019 um 16:27
 #9 Beitrag drucken Top

Zitat

David schrieb:

Please Show me the display03.php File.


Here is a screenshot of what the display3.php file looks like.
Beiträge: 15 
Benutzeravatar

Seiten Administrator


David Geschrieben am 04.05.2019 um 16:15
 #10 Beitrag drucken Top
I mean the Code please Smile
Liebe Grüße, euer David.


Aktiver PHP-Fusion Nutzer seit 3. September 2006
--------------------------------------------------------
PHP-Fusion Österreich Seitenbetreiber.
Beiträge: 434 
http://www.php-fusion.at/ 
Benutzeravatar

Jung Mitglied


afoster Geschrieben am 06.05.2019 um 04:49
 #11 Beitrag drucken Top
Here is the code from display3.php


<?php
/* LuxCal display3 © 2009-2018 LuxSoft www.LuxSoft.eu*/$LDV='2018-12-21';
/*----------------------------- MUST READ --------------------------------
This file is part of the LuxCal Calendar and is distributed WITHOUT ANY
WARRANTY. See the GNU General Public License for details.

This LuxCal display has be designed for narrow width displays.
This display must be run from the calendar's root directory!

----------- The following settings / colors can be edited ------------
------ only edit the part on the right side of the equal sign ------*/

//SET START AND END DATE
//Possible values: A fixed date (yyyy-mm-dd), or one of the keywords DAY, WEEK, MONTH, YEAR, optionally followed by an multiplication factor
//Examples $fromDate: "2018-01-28" | "DAY-2": today - 2 days | "WEEK": start of this week | "MONTH+1": start of next month | "YEAR": start of this year
//Examples $tillDate: "2018-06-14" | "DAY+2": today + 2 days | "MONTH": end of this month | "MONTH+1": end of next month | "YEAR": end of this year
$fromDate = "DAY-1"; //from date
$tillDate = "MONTH+1"; //till date

//GENERAL SETTINGS
$calID = "mycal"; //calendar to use (between the quotes: specify the ID of the calendar. Blank (""): the default calendar)
$sortD = 0; //sorting on dates; 0: ascending, 1: descending
$maxDays = 0; //max. number of days to show; 0: no maximum
$futEvts = 0; //show ongoing and future events only (0: no, 1: yes). Note: This setting overrules the "from date" and sets it to "DAY"
$header = "My Mobile Calendar"; //optional display header. Blank (""): no header
$tt1Line = 1; //Time and Title on the same line (0: no, 1: yes)
$evtBody = '12345678'; //event fields to show (list of numbers: 1: venue, 2: category, 3: description, 4:extra field 1, 5: Extra field 2, 6: email notification data, 7: date/time added/edites +user, 8: attached pdf, images or video files)
$evtWin = 1; //on click open event window (0: no, 1: yes). If the user has post rights, the event add/edit window will open, otherwise the event report window will open
$recOnce = 0; //for recurring events, show only one (the next) occurrence (0: all, 1: next only)
$mulOnce = 0; //for multi-day events, show only one (the next) occurrence (0: all, 1: next only)
$noEvents = "No events"; //message shown when no upcoming events

//FILTERS
$groups = "0"; //events in groups to show (comma separated list of group IDs; 0: all groups)
$users = "0"; //events of users to show (comma separated list of user IDs; 0: all users)
$cats = "0"; //events in categories to show (comma separated list of cat IDs; 0: all categories)
$venue = ""; //case-insensitive text string to be present in venue. Blank (""): no filter

//MARGINS/BORDERS in pixels
$MOUTR = "0"; //container outer margin
$WBORD = "2"; //container border width
$RBORD = "8"; //container border corner radius
$MINNR = "5"; //container inner margin

//DATE FORMAT
$dFormat = "w, M d"; //W: Monday, w: Mon, d: 21, M: January, m: Jan, /: new line

//COLORS
$BBASE = "#111111"; //base background color
$CBORD = "#D01010"; //container border color
$CHEAD = "#FFFFFF"; //header text color
$CDATE = "#FFFFFF"; //calendar date text color
$BDATE = "#404040"; //calendar date background color
$CTIME = "#E0E0E0"; //event time color
$BTIME = "#111111"; //calendar time background color
$CTITL = "#F08080"; //event title color
$BTITL = "#111111"; //event title background color
$CEVNT = "#909000"; //event description color
$BEVNT = "#111111"; //event background color
$CLINK = "#BBFFBB"; //URL link color

//FONT STYLE WEIGHT SIZE/LINE HEIGHT FONT FAMILY
//example "italic bold 1.0em/2.2em verdana,sans-serif"
//style, weight and line height are optional. Example "1.2em arial,sans-serif"
$FBASE = "12px arial,sans-serif"; //base font
$FHEAD = "bold 1.5em arial,sans-serif"; //header font (if header specified)
$FDATE = "bold 1.2em arial,sans-serif"; //date font
$FTIME = "1.0em verdana,sans-serif"; //time font
$FTITL = "1.0em verdana,sans-serif"; //event title font
$FEVNT = "1.0em arial,sans-serif"; //event body font

//VERTICAL SPACE in px
$HHEAD = "28"; //header height (if header specified)
$HBRKS = "4"; //extra space between sections

/*--------------------------------------------------------------------*/

function showEvents($date) {
   global $calID, $evtList, $evtBody, $futEvts, $evtWin, $tt1Line, $xx;

   $now = date('Y-m-dH:i');
   foreach ($evtList[$date] as $evt) {
      if ($futEvts and $evt['eti'] and $date.$evt['eti'] < $now) { continue; } //future events only
      switch ($evt['mde']) { //multi-day event?
         case 0: $evtT = $evt['ald'] ? $xx['vws_all_day'] : ITtoDT($evt['sti']).($evt['eti'] ? ' - '.ITtoDT($evt['eti']) : ''); break; //no
         case 1: $evtT = ($evt['sti'] != '00:00' and $evt['sti'] != '') ? $xx['from']." ".ITtoDT($evt['sti']) : $xx['vws_all_day']; break; //first
         case 2: $evtT = $xx['vws_all_day']; break; //in between
         case 3: $evtT = ($evt['eti'] < '23:59' and $evt['eti'] != '') ? $xx['until']." ".ITtoDT($evt['eti']) : $xx['vws_all_day']; //last
      }
      $chBox = '';
      if ($evt['cbx']) {
         $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '&#x2610;';
         $chBox = "<span title='{$evt['clb']}' class='chkBox'>{$chBox}</span>";
      }
      if ($evtWin) {
         $onClick = " onclick=\"".($evt['mayE'] ? 'editE' : 'showE')."({$evt['eid']},'{$date}','{$calID}');\""; //view or post/edit
         $cursor = ' point';
      } else {
         $onClick = '';
         $cursor = ' arrow';
      }
      if ($tt1Line) {
         echo "<p class='time'>{$evtT} {$chBox}<span class='title{$cursor}'{$onClick}>{$evt['tit']}\n</span></p>\n";
      } else {
         echo "<p class='time'>{$evtT}</p>\n";
         echo "<p>{$chBox}<span class='title{$cursor}'{$onClick}>{$evt['tit']}\n</span></p>\n";
      }
      echo "<div class='event'>".makeE($evt,$evtBody,'br',"<br>")."</div>\n";
   }
}

function makeDate($date) {
   global $months, $months_m, $wkDays, $wkDays_l, $dFormat;

   $y = substr($date, 0, 4);
   $m = ltrim(substr($date, 5, 2),"0");
   $d = ltrim(substr($date, 8, 2),"0");
   $n = date("N", mktime(12,0,0,$m,$d,$y));
   $nDate = '';
   foreach(str_split($dFormat) as $c) {
      switch($c) {
         case 'W': $nDate .= $wkDays[$n]; break;
         case 'w': $nDate .= $wkDays_l[$n]; break;
         case 'M': $nDate .= $months[$m - 1]; break;
         case 'm': $nDate .= $months_m[$m - 1]; break;
         case 'd': $nDate .= $d; break;
         case '/': $nDate .= '<br>'; break;
         default: $nDate .= $c;
      }
   }
   return $nDate;
}

error_reporting(E_ERROR); //errors only
//error_reporting(E_ALL); //errors, warnings and notices - test line

//get config data
if (file_exists('./lcconfig.php')) {
   require './lcconfig.php';
} else {
   exit('No config data!');
}

require './common/toolbox.php'; //load tools
require './common/toolboxd.php'; //database tools
require './common/retrieve.php'; //get retrieve function

if (empty($calID)) { $calID = $dbDef; } //select calendar

$dbH = dbConnect($calID); //connect to database

$set = getSettings(); //get settings from db

date_default_timezone_set($set['timeZone']); //set time zone

header("Cache-control: private"); //proxies: don't cache

require './lang/ui-'.strtolower($set['language']).'.php'; //set language

$stH = dbQuery("SELECT u.`ID`, g.`privs`, g.`vCatIDs` as vCats, g.`eCatIDs` as eCats FROM `users` AS u INNER JOIN `groups` AS g ON g.`ID` = u.`groupID` WHERE u.`ID` = 1");
$usr = $stH->fetch(PDO::FETCH_ASSOC); //user & group data
$stH = null; //release statement handle!

//compute from date
$fromDate = str_replace(' ','',$fromDate);
if (preg_match('~^\d{2,4}[\./-]\d{2}[\./-]\d{2}$~i',$fromDate,$match)) { //fixed from date
   $fStamp = mktime(12,0,0,substr($fromDate,5,2),substr($fromDate,8,2),substr($fromDate,0,4)); //current Unix time
} elseif (preg_match('~^(DAY|WEEK|MONTH|YEAR)([+-]\d{1,4})?$~i',$fromDate,$match)) { //parse from date
   $mult = !empty($match[2]) ? intval($match[2]) : 0;
   switch (strtoupper($match[1])) { //compute from date
   case 'DATE':
      break;
   case 'DAY':
      $fStamp = mktime() + ($mult * 86400); //time first day
      break;
   case 'WEEK':
      $fStamp = mktime() - ((date('w') - $set['weekStart']) * 86400) + ($mult * 604800); //time first day
      break;
   case 'MONTH':
      $fMonth = date('n') + $match[2]; //current month + offset
      $fStamp = mktime(12,0,0,$fMonth,1,date('Y')); //time first day of from month
      break;
   case 'YEAR':
      $fStamp = mktime(12,0,0,1,1,date('Y') + $mult); //time first day of from year
   }
} else {
   echo 'Error in $fromDate'; exit;
}

if ($futEvts) { //future events only
   $fStamp = mktime(); //from date is today
}

//compute till date
$tillDate = str_replace(' ','',$tillDate);
if (preg_match('~^\d{2,4}[\./-]\d{2}[\./-]\d{2}$~i',$tillDate,$match)) { //fixed till date
   $tStamp = mktime(12,0,0,substr($tillDate,5,2),substr($tillDate,8,2),substr($tillDate,0,4)); //current Unix time
} elseif (preg_match('~^(DAY|WEEK|MONTH|YEAR)([+-]\d{1,4})?$~i',$tillDate,$match)) { //parse till date
   $mult = !empty($match[2]) ? intval($match[2]) : 0;
   switch (strtoupper($match[1])) { //compute till date
   case 'DAY':
      $tStamp = mktime() + ($mult * 86400); //time last day
      break;
   case 'WEEK':
      $tStamp = mktime() + ((6 - date('w') + $set['weekStart']) * 86400) + ($mult * 604800); //time first day
      break;
   case 'MONTH':
      $tMonth = date('n') + $match[2]; //current month + offset
      $tStamp = mktime(12,0,0,$tMonth,1,date('Y')) + ((date('t',$tMonth) - 1) * 86400); //time last day of till month
      break;
   case 'YEAR':
      $tStamp = mktime(12,0,0,1,0,date('Y') + $mult + 1); //time last day of till year (next year -1 day)
   }
} else {
   echo 'Error in $tillDate'; exit;
}

//set filter
$usr['vCats'] = empty($cats) ? '0' : $cats; //categories to show
$usr['eCats'] = '0'; //all cat edit rights
$filter = ''; //init
if (!empty($groups)) { $filter .= " AND g.`ID` IN ({$groups})"; }
if (!empty($users)) { $filter .= " AND e.`userID` IN ({$users})"; }
if (!empty($venue)) { $filter .= " AND e.`venue` LIKE '%{$venue}%'"; }
if ($filter) { $filter = substr($filter,5); }

$evtList = array(); //init
retrieve(date('Y-m-d',$fStamp),date('Y-m-d',$tStamp),'',$filter); //retrieve events

if ($sortD) {
   krsort ($evtList);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $set['calendarTitle']; ?></title>
<meta name="description" content="LuxCal web calendar - a LuxSoft product">
<meta name="application-name" content="LuxCal V<?php echo LCV.' Display1 V'.$LDV?>">
<meta name="author" content="Roel Buining">
<meta name="robots" content="nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="<?php echo $set['calendarUrl']; ?>">
<script src="common/toolbox.js"></script>
<style type="text/css">
<?php
$hdrMargins = strval($MOUTR + 4).'px '.strval($MOUTR + $MINNR + $WBORD).'px';
$calTop = $header ? $MOUTR + $HHEAD : $MOUTR;
 echo "* {padding:0; margin:0;}
body {font:{$FBASE}; background:{$BBASE}; overflow:hidden; cursor:default;}
br {display:block; margin-top:{$HBRKS}px;}
a {color:{$CLINK}; text-decoration:none; cursor:pointer;}
a:hover {text-shadow: 0.2em 0.3em 0.2em {$CLINK};}
div.header {font:{$FHEAD}; color:{$CHEAD}; margin:{$hdrMargins};}
div.container {position:absolute; top:{$calTop}px; right:{$MOUTR}px; bottom:{$MOUTR}px; left:{$MOUTR}px; padding:{$MINNR}px; overflow:auto; border:{$WBORD}px {$CBORD}; border-style:solid; border-radius:{$RBORD}px;}
button {padding:0px 2px; font:{$FBASE}px; color:#064070; background:#E0E0E0; border-radius:2px; border:1px solid #666; cursor:pointer;}
.point {cursor:pointer;}
.date {font:{$FDATE}; color:{$CDATE}; background:{$BDATE};}
.time {font:{$FTIME}; color:{$CTIME}; background:{$BTIME};}
.title {font:{$FTITL}; color:{$CTITL}; background:{$BTITL};}
.event {font:{$FEVNT}; color:{$CEVNT}; margin:0 0 4px 0;}
.chkBox {color:{$CTITL}; background:{$BEVNT}; padding-right:2px;}
"
?>
</style>
</head>

<body>
<?php
//display calendar
if ($header) { echo "<div class='header'>{$header}</div>\n"; }
echo "<div class='container'>\n";
$evts1x = array(); //init
if ($evtList) {
   foreach ($evtList as $cDate => &$events) { //loop thru dates
      foreach ($events as $k => $evt) { //loop thru events
         if (($evt['r_t'] and $recOnce) or ($evt['mde'] and $mulOnce)) { //remove recurring and/or multi-day event multiples
            if (in_array($evt['eid'],$evts1x)) {
               unset($events[$k]);
            } else {
               $evts1x[] = $evt['eid'];
            }
         }
      }
      if (empty($events)) { continue; } //no events left for this date
      if ($evtWin and $usr['privs'] > 1) {
         $onclick = " onclick=\"newE('{$cDate}',0);\" title='{$xx['vws_add_event']}'";
         $cursor = ' point';
      } else {
         $onclick = $cursor = '';
      }
      $date = makeDate($cDate); //format date
      echo "<h4 class='date{$cursor}'{$onclick}>{$date}</h4>\n";
      showEvents($cDate); //show events for this date
      if (--$maxDays == 0) { break; }
   }
} else {
   echo "<div class='title'>{$noEvents}</div>\n";
}
echo "</div>\n";
?>
</body>
</html>
[code]
[/code]
Beiträge: 15 
Benutzeravatar

Seiten Administrator


David Geschrieben am 28.05.2019 um 05:43
 #12 Beitrag drucken Top
Sorry for my very late Answer .. :(

Try ".__DIR__." instead of ./

Your Code

<?php
/* LuxCal display3 © 2009-2018 LuxSoft www.LuxSoft.eu*/$LDV='2018-12-21';
/*----------------------------- MUST READ --------------------------------
This file is part of the LuxCal Calendar and is distributed WITHOUT ANY
WARRANTY. See the GNU General Public License for details.

This LuxCal display has be designed for narrow width displays.
This display must be run from the calendar's root directory!

----------- The following settings / colors can be edited ------------
------ only edit the part on the right side of the equal sign ------*/

//SET START AND END DATE
//Possible values: A fixed date (yyyy-mm-dd), or one of the keywords DAY, WEEK, MONTH, YEAR, optionally followed by an multiplication factor
//Examples $fromDate: "2018-01-28" | "DAY-2": today - 2 days | "WEEK": start of this week | "MONTH+1": start of next month | "YEAR": start of this year
//Examples $tillDate: "2018-06-14" | "DAY+2": today + 2 days | "MONTH": end of this month | "MONTH+1": end of next month | "YEAR": end of this year
$fromDate = "DAY-1"; //from date
$tillDate = "MONTH+1"; //till date

//GENERAL SETTINGS
$calID = "mycal"; //calendar to use (between the quotes: specify the ID of the calendar. Blank (""): the default calendar)
$sortD = 0; //sorting on dates; 0: ascending, 1: descending
$maxDays = 0; //max. number of days to show; 0: no maximum
$futEvts = 0; //show ongoing and future events only (0: no, 1: yes). Note: This setting overrules the "from date" and sets it to "DAY"
$header = "My Mobile Calendar"; //optional display header. Blank (""): no header
$tt1Line = 1; //Time and Title on the same line (0: no, 1: yes)
$evtBody = '12345678'; //event fields to show (list of numbers: 1: venue, 2: category, 3: description, 4:extra field 1, 5: Extra field 2, 6: email notification data, 7: date/time added/edites +user, 8: attached pdf, images or video files)
$evtWin = 1; //on click open event window (0: no, 1: yes). If the user has post rights, the event add/edit window will open, otherwise the event report window will open
$recOnce = 0; //for recurring events, show only one (the next) occurrence (0: all, 1: next only)
$mulOnce = 0; //for multi-day events, show only one (the next) occurrence (0: all, 1: next only)
$noEvents = "No events"; //message shown when no upcoming events

//FILTERS
$groups = "0"; //events in groups to show (comma separated list of group IDs; 0: all groups)
$users = "0"; //events of users to show (comma separated list of user IDs; 0: all users)
$cats = "0"; //events in categories to show (comma separated list of cat IDs; 0: all categories)
$venue = ""; //case-insensitive text string to be present in venue. Blank (""): no filter

//MARGINS/BORDERS in pixels
$MOUTR = "0"; //container outer margin
$WBORD = "2"; //container border width
$RBORD = "8"; //container border corner radius
$MINNR = "5"; //container inner margin

//DATE FORMAT
$dFormat = "w, M d"; //W: Monday, w: Mon, d: 21, M: January, m: Jan, /: new line

//COLORS
$BBASE = "#111111"; //base background color
$CBORD = "#D01010"; //container border color
$CHEAD = "#FFFFFF"; //header text color
$CDATE = "#FFFFFF"; //calendar date text color
$BDATE = "#404040"; //calendar date background color
$CTIME = "#E0E0E0"; //event time color
$BTIME = "#111111"; //calendar time background color
$CTITL = "#F08080"; //event title color
$BTITL = "#111111"; //event title background color
$CEVNT = "#909000"; //event description color
$BEVNT = "#111111"; //event background color
$CLINK = "#BBFFBB"; //URL link color

//FONT STYLE WEIGHT SIZE/LINE HEIGHT FONT FAMILY
//example "italic bold 1.0em/2.2em verdana,sans-serif"
//style, weight and line height are optional. Example "1.2em arial,sans-serif"
$FBASE = "12px arial,sans-serif"; //base font
$FHEAD = "bold 1.5em arial,sans-serif"; //header font (if header specified)
$FDATE = "bold 1.2em arial,sans-serif"; //date font
$FTIME = "1.0em verdana,sans-serif"; //time font
$FTITL = "1.0em verdana,sans-serif"; //event title font
$FEVNT = "1.0em arial,sans-serif"; //event body font

//VERTICAL SPACE in px
$HHEAD = "28"; //header height (if header specified)
$HBRKS = "4"; //extra space between sections

/*--------------------------------------------------------------------*/

function showEvents($date) {
   global $calID, $evtList, $evtBody, $futEvts, $evtWin, $tt1Line, $xx;

   $now = date('Y-m-dH:i');
   foreach ($evtList[$date] as $evt) {
      if ($futEvts and $evt['eti'] and $date.$evt['eti'] < $now) { continue; } //future events only
      switch ($evt['mde']) { //multi-day event?
         case 0: $evtT = $evt['ald'] ? $xx['vws_all_day'] : ITtoDT($evt['sti']).($evt['eti'] ? ' - '.ITtoDT($evt['eti']) : ''); break; //no
         case 1: $evtT = ($evt['sti'] != '00:00' and $evt['sti'] != '') ? $xx['from']." ".ITtoDT($evt['sti']) : $xx['vws_all_day']; break; //first
         case 2: $evtT = $xx['vws_all_day']; break; //in between
         case 3: $evtT = ($evt['eti'] < '23:59' and $evt['eti'] != '') ? $xx['until']." ".ITtoDT($evt['eti']) : $xx['vws_all_day']; //last
      }
      $chBox = '';
      if ($evt['cbx']) {
         $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '&#x2610;';
         $chBox = "<span title='{$evt['clb']}' class='chkBox'>{$chBox}</span>";
      }
      if ($evtWin) {
         $onClick = " onclick=\"".($evt['mayE'] ? 'editE' : 'showE')."({$evt['eid']},'{$date}','{$calID}');\""; //view or post/edit
         $cursor = ' point';
      } else {
         $onClick = '';
         $cursor = ' arrow';
      }
      if ($tt1Line) {
         echo "<p class='time'>{$evtT} {$chBox}<span class='title{$cursor}'{$onClick}>{$evt['tit']}\n</span></p>\n";
      } else {
         echo "<p class='time'>{$evtT}</p>\n";
         echo "<p>{$chBox}<span class='title{$cursor}'{$onClick}>{$evt['tit']}\n</span></p>\n";
      }
      echo "<div class='event'>".makeE($evt,$evtBody,'br',"<br>")."</div>\n";
   }
}

function makeDate($date) {
   global $months, $months_m, $wkDays, $wkDays_l, $dFormat;

   $y = substr($date, 0, 4);
   $m = ltrim(substr($date, 5, 2),"0");
   $d = ltrim(substr($date, 8, 2),"0");
   $n = date("N", mktime(12,0,0,$m,$d,$y));
   $nDate = '';
   foreach(str_split($dFormat) as $c) {
      switch($c) {
         case 'W': $nDate .= $wkDays[$n]; break;
         case 'w': $nDate .= $wkDays_l[$n]; break;
         case 'M': $nDate .= $months[$m - 1]; break;
         case 'm': $nDate .= $months_m[$m - 1]; break;
         case 'd': $nDate .= $d; break;
         case '/': $nDate .= '<br>'; break;
         default: $nDate .= $c;
      }
   }
   return $nDate;
}

error_reporting(E_ERROR); //errors only
//error_reporting(E_ALL); //errors, warnings and notices - test line

//get config data
if (file_exists(''.__DIR__.'lcconfig.php')) {
   require ''.__DIR__.'lcconfig.php';
} else {
   exit('No config data!');
}

require ''.__DIR__.'common/toolbox.php'; //load tools
require ''.__DIR__.'common/toolboxd.php'; //database tools
require ''.__DIR__.'common/retrieve.php'; //get retrieve function

if (empty($calID)) { $calID = $dbDef; } //select calendar

$dbH = dbConnect($calID); //connect to database

$set = getSettings(); //get settings from db

date_default_timezone_set($set['timeZone']); //set time zone

header("Cache-control: private"); //proxies: don't cache

require ''.__DIR__.'lang/ui-'.strtolower($set['language']).'.php'; //set language

$stH = dbQuery("SELECT u.`ID`, g.`privs`, g.`vCatIDs` as vCats, g.`eCatIDs` as eCats FROM `users` AS u INNER JOIN `groups` AS g ON g.`ID` = u.`groupID` WHERE u.`ID` = 1");
$usr = $stH->fetch(PDO::FETCH_ASSOC); //user & group data
$stH = null; //release statement handle!

//compute from date
$fromDate = str_replace(' ','',$fromDate);
if (preg_match('~^\d{2,4}[\./-]\d{2}[\./-]\d{2}$~i',$fromDate,$match)) { //fixed from date
   $fStamp = mktime(12,0,0,substr($fromDate,5,2),substr($fromDate,8,2),substr($fromDate,0,4)); //current Unix time
} elseif (preg_match('~^(DAY|WEEK|MONTH|YEAR)([+-]\d{1,4})?$~i',$fromDate,$match)) { //parse from date
   $mult = !empty($match[2]) ? intval($match[2]) : 0;
   switch (strtoupper($match[1])) { //compute from date
   case 'DATE':
      break;
   case 'DAY':
      $fStamp = mktime() + ($mult * 86400); //time first day
      break;
   case 'WEEK':
      $fStamp = mktime() - ((date('w') - $set['weekStart']) * 86400) + ($mult * 604800); //time first day
      break;
   case 'MONTH':
      $fMonth = date('n') + $match[2]; //current month + offset
      $fStamp = mktime(12,0,0,$fMonth,1,date('Y')); //time first day of from month
      break;
   case 'YEAR':
      $fStamp = mktime(12,0,0,1,1,date('Y') + $mult); //time first day of from year
   }
} else {
   echo 'Error in $fromDate'; exit;
}

if ($futEvts) { //future events only
   $fStamp = mktime(); //from date is today
}

//compute till date
$tillDate = str_replace(' ','',$tillDate);
if (preg_match('~^\d{2,4}[\./-]\d{2}[\./-]\d{2}$~i',$tillDate,$match)) { //fixed till date
   $tStamp = mktime(12,0,0,substr($tillDate,5,2),substr($tillDate,8,2),substr($tillDate,0,4)); //current Unix time
} elseif (preg_match('~^(DAY|WEEK|MONTH|YEAR)([+-]\d{1,4})?$~i',$tillDate,$match)) { //parse till date
   $mult = !empty($match[2]) ? intval($match[2]) : 0;
   switch (strtoupper($match[1])) { //compute till date
   case 'DAY':
      $tStamp = mktime() + ($mult * 86400); //time last day
      break;
   case 'WEEK':
      $tStamp = mktime() + ((6 - date('w') + $set['weekStart']) * 86400) + ($mult * 604800); //time first day
      break;
   case 'MONTH':
      $tMonth = date('n') + $match[2]; //current month + offset
      $tStamp = mktime(12,0,0,$tMonth,1,date('Y')) + ((date('t',$tMonth) - 1) * 86400); //time last day of till month
      break;
   case 'YEAR':
      $tStamp = mktime(12,0,0,1,0,date('Y') + $mult + 1); //time last day of till year (next year -1 day)
   }
} else {
   echo 'Error in $tillDate'; exit;
}

//set filter
$usr['vCats'] = empty($cats) ? '0' : $cats; //categories to show
$usr['eCats'] = '0'; //all cat edit rights
$filter = ''; //init
if (!empty($groups)) { $filter .= " AND g.`ID` IN ({$groups})"; }
if (!empty($users)) { $filter .= " AND e.`userID` IN ({$users})"; }
if (!empty($venue)) { $filter .= " AND e.`venue` LIKE '%{$venue}%'"; }
if ($filter) { $filter = substr($filter,5); }

$evtList = array(); //init
retrieve(date('Y-m-d',$fStamp),date('Y-m-d',$tStamp),'',$filter); //retrieve events

if ($sortD) {
   krsort ($evtList);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $set['calendarTitle']; ?></title>
<meta name="description" content="LuxCal web calendar - a LuxSoft product">
<meta name="application-name" content="LuxCal V<?php echo LCV.' Display1 V'.$LDV?>">
<meta name="author" content="Roel Buining">
<meta name="robots" content="nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="<?php echo $set['calendarUrl']; ?>">
<script src="common/toolbox.js"></script>
<style type="text/css">
<?php
$hdrMargins = strval($MOUTR + 4).'px '.strval($MOUTR + $MINNR + $WBORD).'px';
$calTop = $header ? $MOUTR + $HHEAD : $MOUTR;
 echo "* {padding:0; margin:0;}
body {font:{$FBASE}; background:{$BBASE}; overflow:hidden; cursor:default;}
br {display:block; margin-top:{$HBRKS}px;}
a {color:{$CLINK}; text-decoration:none; cursor:pointer;}
a:hover {text-shadow: 0.2em 0.3em 0.2em {$CLINK};}
div.header {font:{$FHEAD}; color:{$CHEAD}; margin:{$hdrMargins};}
div.container {position:absolute; top:{$calTop}px; right:{$MOUTR}px; bottom:{$MOUTR}px; left:{$MOUTR}px; padding:{$MINNR}px; overflow:auto; border:{$WBORD}px {$CBORD}; border-style:solid; border-radius:{$RBORD}px;}
button {padding:0px 2px; font:{$FBASE}px; color:#064070; background:#E0E0E0; border-radius:2px; border:1px solid #666; cursor:pointer;}
.point {cursor:pointer;}
.date {font:{$FDATE}; color:{$CDATE}; background:{$BDATE};}
.time {font:{$FTIME}; color:{$CTIME}; background:{$BTIME};}
.title {font:{$FTITL}; color:{$CTITL}; background:{$BTITL};}
.event {font:{$FEVNT}; color:{$CEVNT}; margin:0 0 4px 0;}
.chkBox {color:{$CTITL}; background:{$BEVNT}; padding-right:2px;}
"
?>
</style>
</head>

<body>
<?php
//display calendar
if ($header) { echo "<div class='header'>{$header}</div>\n"; }
echo "<div class='container'>\n";
$evts1x = array(); //init
if ($evtList) {
   foreach ($evtList as $cDate => &$events) { //loop thru dates
      foreach ($events as $k => $evt) { //loop thru events
         if (($evt['r_t'] and $recOnce) or ($evt['mde'] and $mulOnce)) { //remove recurring and/or multi-day event multiples
            if (in_array($evt['eid'],$evts1x)) {
               unset($events[$k]);
            } else {
               $evts1x[] = $evt['eid'];
            }
         }
      }
      if (empty($events)) { continue; } //no events left for this date
      if ($evtWin and $usr['privs'] > 1) {
         $onclick = " onclick=\"newE('{$cDate}',0);\" title='{$xx['vws_add_event']}'";
         $cursor = ' point';
      } else {
         $onclick = $cursor = '';
      }
      $date = makeDate($cDate); //format date
      echo "<h4 class='date{$cursor}'{$onclick}>{$date}</h4>\n";
      showEvents($cDate); //show events for this date
      if (--$maxDays == 0) { break; }
   }
} else {
   echo "<div class='title'>{$noEvents}</div>\n";
}
echo "</div>\n";
?>
</body>
</html>
Liebe Grüße, euer David.


Aktiver PHP-Fusion Nutzer seit 3. September 2006
--------------------------------------------------------
PHP-Fusion Österreich Seitenbetreiber.
Beiträge: 434 
http://www.php-fusion.at/ 
Springe ins Forum:
Anzeige


Anmelden


Registrieren Passwort vergessen

RSS Feeds

Feeds abonieren

Letzte News
Letzte Threads
Anzeige

© Copyright 2024 PHP-Fusion.at | Alle Rechte vorbehalten.

© 2016 Real Space. All rights reserved | Design by W3layouts | 19,357,283 eindeutige Besuche
Powered by PHP-Fusion copyright © 2002 - 2024 by Nick Jones. Released as free software without warranties under GNU Affero GPL v3.