.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"; } } 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 "\n"; } } function prtButton () { global $xx; echo "\n"; } function cntButton () { global $xx, $set; if ($set['contButton']) { echo "\n"; } } function tnlButton () { global $xx; echo "\n"; } function toaButton () { global $xx, $set; if ($set['navToapList']) { echo "\n"; } } function tdlButton () { global $xx, $set; if ($set['navTodoList']) { echo "\n"; } } function upcButton () { global $xx, $set; if ($set['navUpcoList']) { echo "\n"; } } function srcButton() { global $xx, $set; echo "\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 "\n"; } unset($cid); } function hlpButton($cPage) { global $xx, $set; echo "\n"; } function logButton() { global $xx, $usr; if ($usr['ID'] == 1) { //public user echo "\n"; } else { //known user echo "\n"; } } function urlButton() { global $xx, $set; if ($set['backLinkUrl'] and !$set['logoPath']) { //if no logo, display button echo "\n"; } } function optButton() { global $options, $xx; if ($options) { //menus echo "\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 "\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 "; if ($dbSel and $usr['privs'] == 9) { //get calendar database IDs $calIDs = getCIDs(); //get all calender IDs if (count($calIDs) > 1) { //more than 1 calendar echo "
\n
{$xx['hdr_calendar']}
\n
\n"; foreach ($calIDs as $cal) { $checked = ($calID == $cal) ? " checked" : ''; echo "
\n"; } echo "
\n
\n"; } } if ($set['viewMenu']) { $checkedA = array_fill(1,10,''); $checkedA[$opt['cP']] = " checked"; echo "
\n
{$xx['hdr_view']}
\n
"; for ($i=1; $i<11; $i++) { $v = strval($i); if (strpos($avViews,$v) !== false) { $vLabel = $xx["hdr_view_{$v}"]; echo "
\n"; } } echo "
\n
\n"; } if ($set['groupMenu']) { echo "
\n
{$xx['hdr_groups']}
\n
\n"; $stH = dbQuery("SELECT `ID`,`name`,`color` FROM `groups` WHERE `status` >= 0 ORDER BY `name`"); $checked = in_array(0, $opt['cG']) ? " checked" : ''; echo "
\n"; while (list($xgID,$gName,$color) = $stH->fetch(PDO::FETCH_NUM)) { $checked = in_array($xgID, $opt['cG']) ? " checked" : ''; $groupColor = ($color) ? " style='background-color:{$color};'" : ''; echo "
\n"; } echo "
\n
\n"; } if ($set['userMenu'] and $usr['ID'] > 1) { echo "
\n
{$xx['hdr_users']}
\n
\n"; $stH = dbQuery("SELECT u.`ID`,u.`name`,g.`color` FROM `users` AS u INNER JOIN `groups` AS g ON g.`ID` = u.`groupID` WHERE u.`status` >= 0 ORDER BY u.`name`"); $checked = in_array(0, $opt['cU']) ? " checked" : ''; echo "
\n"; while (list($xuID,$uName,$color) = $stH->fetch(PDO::FETCH_NUM)) { $checked = in_array($xuID, $opt['cU']) ? " checked" : ''; $userColor = ($color) ? " style='background-color:{$color};'" : ''; echo "
\n"; } echo "
\n
\n"; } if ($set['catMenu']) { echo "
\n
{$xx['hdr_categories']}
\n
\n"; $where = ' WHERE `status` >= 0'.($usr['vCats'] != '0' ? " AND `ID` IN ({$usr['vCats']})" : ''); $stH = dbQuery("SELECT `name`,`sequence`,`color`,`bgColor` FROM `categories`".$where." ORDER BY `sequence`"); $checked = in_array(0, $opt['cC']) ? " checked" : ''; echo "
\n"; while (list($cName,$xC,$color,$bgColor) = $stH->fetch(PDO::FETCH_NUM)) { $checked = in_array($xC, $opt['cC']) ? " checked" : ''; $catColor = ($color ? "color:{$color};" : '').($bgColor ? "background-color:{$bgColor};" : ''); echo "
\n"; } echo "
\n
\n"; } if ($set['langMenu']) { echo "
\n
{$xx['hdr_lang']}
\n
\n"; $files = scandir("lang/"); foreach ($files as $file) { if (substr($file, 0, 3) == "ui-") { $lang = strtolower(substr($file,3,-4)); $checked = ($opt['cL'] == $lang) ? " checked" : ''; echo "
\n"; } } echo "
\n
\n"; } echo "
\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"; 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 <<  
\n TXT; } echo "
\n"; if ($pageTitle) echo "

{$pageTitle}

\n"; break; case 'a': //admin pages echo << \n \n TXT; topBar(); 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"; 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"; optPanel(); } else { //display dummy navbar echo <<  
\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); ?>