.content {margin-top:-48px;}
";
}
function headerRss() {
global $set, $usr, $cF;
if ($usr['privs'] > 0 and $set['rssFeed']) {
echo ' '."\n";
}
}
function admMenu() {
global $xx, $opt, $usr;
if ($usr['privs'] >= 4) { //manager or admin rights
$optNames = array(90 => 'hdr_settings','hdr_categories','hdr_users','hdr_groups','hdr_database','hdr_import_ics','hdr_export_ics','hdr_import_csv','hdr_styling');
echo "\n{$xx['hdr_admin']} \n";
$selected = array_fill(90,11,'');
$selected[$opt['cP']] = ' selected';
if ($usr['privs'] == 4) { //manager
for ($i=91; $i<=93; $i++) {
echo "{$xx[$optNames[$i]]} \n";
}
} else { //admin
for ($i=90; $i<=97; $i++) {
echo "{$xx[$optNames[$i]]} \n";
}
echo "{$xx['hdr_styling']} \n";
}
echo " \n";
}
}
function topBar() {
global $set, $usr, $today;
if (!isset($set['logoPath'])) { $set['logoPath'] = ''; } //needed for a smooth upgrade
if ($set['logoPath']) {
if ($set['backLinkUrl']) {
$logo = " "; //logo is back link
} else {
$logo = " ";
}
echo "{$logo}\n
\n";
} else {
echo "
\n";
}
echo "
{$set['calendarTitle']} {$usr['name']} ".makeD($today,5)."
\n";
}
function calButton () {
global $xx, $usr;
if ($usr['privs'] > 0) { //view rights
echo "
{$xx['hdr_calendar']} \n";
}
}
function prtButton () {
global $xx;
echo "
{$xx['hdr_button_print']} \n";
}
function cntButton () {
global $xx, $set;
if ($set['contButton']) {
echo "
".($set['navButText'] ? $xx['hdr_button_contact'] : ' ✉ ')." \n";
}
}
function tnlButton () {
global $xx;
echo "
{$xx['hdr_button_tnails']} \n";
}
function toaButton () {
global $xx, $set;
if ($set['navToapList']) {
echo "
".($set['navButText'] ? $xx['hdr_button_toap'] : ' ≤ ')." \n";
}
}
function tdlButton () {
global $xx, $set;
if ($set['navTodoList']) {
echo "
".($set['navButText'] ? $xx['hdr_button_todo'] : ' ≡ ')." \n";
}
}
function upcButton () {
global $xx, $set;
if ($set['navUpcoList']) {
echo "
".($set['navButText'] ? $xx['hdr_button_upco'] : ' ≤ ')." \n";
}
}
function srcButton() {
global $xx, $set;
echo "
".($set['navButText'] ? $xx['hdr_button_search'] : ' Δ ')." \n";
}
function addButton() {
global $xx, $opt, $set, $usr;
if ($usr['privs'] > 1) { //post rights
$cid = (count($opt['cC']) == 1 and $opt['cC'][0] != 0) ? $opt['cC'][0] : 0;
echo "
".($set['navButText'] ? $xx['hdr_button_add'] : ' + ')." \n";
}
unset($cid);
}
function hlpButton($cPage) {
global $xx, $set;
echo "
".($set['navButText'] ? $xx['hdr_button_help'] : ' ? ')." \n";
}
function logButton() {
global $xx, $usr;
if ($usr['ID'] == 1) { //public user
echo "
{$xx['hdr_button_log_in']} \n";
} else { //known user
echo "
{$xx['hdr_button_log_out']} \n";
}
}
function urlButton() {
global $xx, $set;
if ($set['backLinkUrl'] and !$set['logoPath']) { //if no logo, display button
echo "
{$xx['back']} \n";
}
}
function optButton() {
global $options, $xx;
if ($options) { //menus
echo "
{$xx['options']} \n";
}
}
function viewButtons() {
global $xx, $set, $usr;
$viewButtons = $usr['ID'] == 1 ? $set['viewButsPub'] : $set['viewButsLog']; //view buttons to display
if ($viewButtons) {
foreach (explode(',',$viewButtons) as $viewNr) {
$label = $xx["hdr_view_{$viewNr}"];
echo "
{$label} \n";
}
}
unset($viewButtons,$label);
}
function dateForm() {
global $xx, $opt, $lcI;
echo "
\n";
}
function optPanel() { //make options panel
global $options, $xx, $set, $calID, $usr, $opt, $avViews, $dbSel, $lcI;
if (!$options) { return; } //no menus
echo "
{$xx['hdr_options_submit']}
\n
\n";
}
function toapList() { //make list with events to be approved
global $xx, $set, $opt, $usr, $evtList;
if ($set['navToapList']) {
echo "
{$xx['hdr_toap_list']} ❌
\n";
$curD = $opt['cD'];
$curT = mktime(12,0,0,substr($curD,5,2),substr($curD,8,2),substr($curD,0,4)); //current Unix time
$startD = date("Y-m-d", $curT - (7 * 86400)); //current date - 1 week
$endD = date("Y-m-d", $curT + (($set['lookaheadDays']-1) * 86400)); //current date + look ahead nr of days
$filter = '(c.`approve` = 1 AND e.`approved` = 0)'; //events in cat to be approved but not yet approved
retrieve($startD,$endD,'guc',$filter);
echo '
'.IDtoDD($startD).' - '.IDtoDD($endD)." \n";
//display list
echo "
\n";
if ($evtList) {
$evtDone = array();
$lastDate = '';
foreach($evtList as $date => &$events) {
foreach ($events as $evt) {
if (!$evt['mde'] or !in_array($evt['eid'],$evtDone)) { //!mde or mde not processed
$evtDone[] = $evt['eid'];
$evtDate = $evt['mde'] ? makeD($evt['sda'],5)." - ".makeD($evt['eda'],5) : makeD($date,5);
$evtTime = $evt['ald'] ? $xx['vws_all_day'] : ITtoDT($evt['sti']).($evt['eti'] ? ' - '.ITtoDT($evt['eti']) : '');
$onClick = " class='point' onclick=\"editE({$evt['eid']},'{$date}');\"";
if ($set['eventColor']) {
$eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '').($evt['cbg'] ? "background-color:{$evt['cbg']};" : '');
} else {
$eStyle = ($evt['uco'] ? "background-color:{$evt['uco']};" : '');
}
$eStyle = $eStyle ? " style='{$eStyle}'" : '';
echo $lastDate != $evtDate ? "
{$evtDate} \n" : '';
echo "
{$evtTime}
{$evt['tit']}
\n";
$lastDate = $evtDate;
}
}
}
} else {
echo $xx['none']."\n";
}
echo "
\n
\n";
}
}
function todoList() { //make list with todo events
global $xx, $set, $opt, $usr, $evtList;
if ($set['navTodoList']) {
echo "
{$xx['hdr_todo_list']} ❌
\n";
$curD = $opt['cD'];
$curT = mktime(12,0,0,substr($curD,5,2),substr($curD,8,2),substr($curD,0,4)); //current Unix time
$startD = date("Y-m-d", $curT - (30 * 86400)); //current date - 1 month
$endD = date("Y-m-d", $curT + (($set['lookaheadDays']-1) * 86400)); //current date + look ahead nr of days
$filter = '(c.`checkBx` = 1)'; //events in cat with a check mark
retrieve($startD,$endD,'guc',$filter);
echo '
'.IDtoDD($startD).' - '.IDtoDD($endD)." \n";
//display list
echo "
\n";
if ($evtList) {
foreach($evtList as $date => &$events) {
$dShown = 0;
foreach ($events as $evt) {
if (strpos($evt['chd'],$date)) { continue; } //flush completed events
if (!$dShown) {
echo "
".makeD($date,5)." \n";
$dShown = 1;
}
$evtTime = $evt['ald'] ? $xx['vws_all_day'] : ITtoDT($evt['sti']).($evt['eti'] ? ' - '.ITtoDT($evt['eti']) : '');
$mayView = ($set['details4All'] == 1 or ($set['details4All'] == 2 and $usr['ID'] > 1) or $evt['mayE']);
$click = ($evt['mayE'] ? 'editE' : 'showE')."({$evt['eid']},'{$date}')";
$onClick = $mayView ? " class='point' onclick=\"{$click};\"" : " class='arrow'";
if ($set['eventColor']) {
$eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '').($evt['cbg'] ? "background-color:{$evt['cbg']};" : '');
} else {
$eStyle = ($evt['uco'] ? "background-color:{$evt['uco']};" : '');
}
$eStyle = $eStyle ? " style='{$eStyle}'" : '';
$chBox = '';
if ($evt['cbx']) {
$mayCheck = ($usr['privs'] > 3 or ($usr['privs'] > 1 and $evt['uid'] == $usr['ID'])) ? true : false;
$chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '☐';
$cBoxAtt = $mayCheck ? "class='chkBox floatL point' onclick=\"checkE(this,{$evt['eid']},'{$date}');\"" : "class='chkBox floatL arrow'";
$chBox = "
{$chBox} ";
}
echo "
{$evtTime}
\n{$chBox}
{$evt['tit']}
\n";
}
}
} else {
echo $xx['none']."\n";
}
echo "
\n
\n";
}
}
function upcoList() { //make list with upcoming events
global $xx, $set, $opt, $usr, $evtList;
if ($set['navUpcoList']) {
echo "
{$xx['hdr_upco_list']} ❌
\n";
$startD = $opt['cD'];
$eTime = mktime(12,0,0,substr($startD,5,2),substr($startD,8,2),substr($startD,0,4)) + (($set['lookaheadDays']-1) * 86400); //Unix time of end date
$endD = date("Y-m-d", $eTime);
retrieve($startD,$endD,'guc');
echo '
'.IDtoDD($startD).' - '.IDtoDD($endD)." \n";
//display events
echo "
\n";
if ($evtList) {
$evtDone = array();
$lastDate = '';
foreach($evtList as $date => &$events) {
foreach ($events as $evt) {
if (!$evt['mde'] or !in_array($evt['eid'],$evtDone)) { //!mde or mde not processed
$evtDone[] = $evt['eid'];
$evtDate = $evt['mde'] ? makeD($evt['sda'],5)." - ".makeD($evt['eda'],5) : makeD($date,5);
$evtTime = $evt['ald'] ? $xx['vws_all_day'] : ITtoDT($evt['sti']).($evt['eti'] ? ' - '.ITtoDT($evt['eti']) : '');
$mayView = ($set['details4All'] == 1 or ($set['details4All'] == 2 and $usr['ID'] > 1) or $evt['mayE']);
$click = ($evt['mayE'] ? 'editE' : 'showE')."({$evt['eid']},'{$date}')";
$onClick = $mayView ? " class='point' onclick=\"{$click};\"" : " class='arrow'";
if ($set['eventColor']) {
$eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '').($evt['cbg'] ? "background-color:{$evt['cbg']};" : '');
} else {
$eStyle = ($evt['uco'] ? "background-color:{$evt['uco']};" : '');
}
$eStyle = $eStyle ? " style='{$eStyle}'" : '';
echo $lastDate != $evtDate ? "
{$evtDate} \n" : '';
echo "
{$evtTime}
{$evt['tit']}
\n";
$lastDate = $evtDate;
}
}
}
} else {
echo $xx['none']."\n";
}
echo "
\n
\n";
}
}
if (preg_match('/(iPhone|iPad|iPod)/i',$_SERVER['HTTP_USER_AGENT'])) { //iOS - mobile safari bug fix
echo '
';
}
//start of HTML header
$cssX = isset($_SESSION['theme']) ? '?pv='.time() : ''; //?pv: force reload of styles
$version = LCV;
$cid = (count($opt['cC']) == 1 and $opt['cC'][0] != 0) ? $opt['cC'][0] : 0;
$options = (($dbSel and $usr['privs'] == 9) or $set['viewMenu'] or $set['groupMenu'] or $set['userMenu'] or $set['catMenu'] or $set['langMenu']) ? true : false; //menus
echo "
\n";
echo <<
{$set['calendarTitle']}
\n";
unset($version);
switch ($hdrType) { //header types - 0: no, f: full, a: admin, l: login, m: mobile, s: styling, e: event, h: help
case '0': //no header (hdr=0)
headerTop();
echo <<\n
\n
TXT;
if ($pageTitle) echo "
{$pageTitle} \n";
break;
case 'f': //normal pages
headerRss();
echo <<
\n
\n
TXT;
topBar();
if ($usr['privs'] > 0) { //view rights
echo "\n";
// echo "
\n";
// urlButton();
// optButton();
// viewButtons();
// dateForm();
// echo "
\n";
// echo "
\n";
// echo "
\n";
optPanel();
if ($usr['privs'] >= 4) { toapList(); } //manager+ make side bar with events to be approved
todoList(); //make side bar with todo list
upcoList(); //make side bar with upcoming events
} else { //display dummy navbar
echo <<
{$xx['hdr_button_log_in']}
\n
TXT;
}
echo "\n";
if ($pageTitle) echo "
{$pageTitle} \n";
break;
case 'a': //admin pages
echo <<
\n
\n
TXT;
topBar();
echo "\n";
echo "
\n";
calButton();
if (!$isMob) { prtButton(); }
admMenu();
if (!$isMob) { hlpButton($opt['cP']); }
logButton();
echo "
\n";
echo "
\n";
optButton();
echo "
\n";
echo "
\n";
echo "
\n";
optPanel();
echo "\n";
if ($pageTitle) echo "
{$pageTitle} \n";
break;
case 's': //styling window
echo <<
\n
TXT;
echo "
{$pageTitle}
\n";
prtButton();
hlpButton($opt['cP']);
echo "
{$set['calendarTitle']}
\n";
echo "\n";
break;
case 'l': //log in page
echo <<
\n
\n
TXT;
topBar();
echo "\n";
echo "
\n";
calButton();
cntButton();
hlpButton($opt['cP']);
echo "
\n";
echo "
\n";
echo "\n";
if ($pageTitle) echo "
{$pageTitle} \n";
break;
case 'm': //calendar pages - mobile device
echo <<
\n
\n
{$set['calendarTitle']} \n
TXT;
if ($usr['privs'] > 0) { //view rights
echo "\n";
echo "
\n";
addButton();
logButton();
echo "
\n";
urlButton();
optButton();
viewButtons();
dateForm();
echo "
\n";
optPanel();
} else { //display dummy navbar
echo <<
{$xx['hdr_button_log_in']}
\n
TXT;
}
echo "\n";
if ($pageTitle) echo "
{$pageTitle} \n";
break;
case 'e': //event window
echo <<
\n
TXT;
echo "\n";
echo "
\n";
prtButton();
hlpButton($opt['cP']);
echo "
\n";
echo "{$pageTitle}\n";
echo "
\n";
echo "\n";
break;
case 'h': //help window
echo <<
❌
{$pageTitle}
\n
TXT;
}
unset($hdrType);
?>