function showEvents($date) { global $evtList, $privs, $set, $xx; $showDetails = ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1); foreach ($evtList[$date] as $evt) { $time = makeHovT($evt); $chBox = ''; if ($evt['cbx']) { $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '☐'; $chBox = "<span class='chkBox'>{$chBox}</span>"; } if ($set['popBoxYear'] and $set['popBoxFields']) { $popText = "<b>{$chBox} {$time} {$evt['tix']}</b><br>"; if ($showDetails or $evt['mayE']) { $popText .= makeE($evt, $set['popBoxFields'], 'br', '<br>'); } $popText = htmlspecialchars(addslashes($popText)); $popClass = ($evt['pri'] ? 'private' : 'normal') . (($evt['mde'] or $evt['r_t']) ? ' repeat' : ''); $popAttr = " onmouseover=\"pop(this,'{$popText}','{$popClass}')\""; } else { $popAttr = ''; } if ($set['eventColor']) { //use event color $eStyle = $evt['cbg'] ? "background-color:{$evt['cbg']};" : ''; } else { //use user color $eStyle = $evt['uco'] ? "background-color:{$evt['uco']};" : ''; } if ($evt['app'] and !$evt['apd']) { $eStyle .= 'border:1px solid #ff0000;'; } $eStyle = $eStyle ? " style='{$eStyle}'" : ''; echo '<div ' . (($showDetails or $evt['mayE']) ? "class='square point'{$eStyle} onclick=\"editE({$evt['eid']},'{$date}');\"" : "class='square arrow'{$eStyle}") . "{$popAttr}></div>\n"; } }
function showEvents($date) { global $privs, $evtList, $set, $xx; $thsM = $set['dwStartHour'] * 60; //threshold start of day in mins $theM = $set['dwEndHour'] * 60; //threshold end of day in mins $offset = $set['dwStartHour'] ? 2 * $set['dwTimeSlot'] : $set['dwTimeSlot']; //"earlier" row //hereafter: M = in nbr of mins foreach ($evtList[$date] as $eIx => $evt) { if ($evt['mde']) { //multi-day-event if ($evt['mde'] != 1) { $evt['sti'] = '00:00'; } if ($evt['mde'] != 3) { $evt['eti'] = '23:59'; } } if ($evt['sti'] == '' and $evt['eti'] == '' or $evt['ald']) { //all day (takes up 1 slot at the top) $st[] = 0; //start time $et[] = $set['dwTimeSlot']; //end time } else { $stM = substr($evt['sti'], 0, 2) * 60 + intval(substr($evt['sti'], 3, 2)); //start time if ($stM < $thsM) { $st[] = $set['dwTimeSlot']; //start time < threshold start of day in mins } elseif ($stM < $theM) { $st[] = $stM - $thsM + $offset; //start time < threshold end of day in mins } else { $st[] = $theM - $thsM + $offset; //start time >= threshold end of day in mins } if ($evt['eti'] == "" or $evt['eti'] == $evt['sti']) { $et[] = end($st) + $set['dwTimeSlot']; } else { $etM = substr($evt['eti'], 0, 2) * 60 + intval(substr($evt['eti'], 3, 2)); //end time if ($etM <= $thsM) { $et[] = $offset; //end time <= threshold start of day in mins } elseif ($etM <= $theM) { $et[] = $etM - $thsM + $offset; //end time < threshold end of day in mins } else { $et[] = $theM - $thsM + $offset + $set['dwTimeSlot']; //end time > threshold end of day in mins } } } } //for day $date we now have : //$st: array with start time in mins for each event //$et: array with end time in mins for each event //the indexes in these arrays correspond to the indexes in $evtList $sEmpty[0][0] = 0; $eEmpty[0][0] = 1440; //24 x 60 mins $indent = 0; foreach ($st as $i => $stM) { //i: index in $evtList, stM: start time in mins $found = false; foreach ($sEmpty as $k => $v) { foreach ($v as $kk => $sEtM) { if ($stM >= $sEtM and $et[$i] <= $eEmpty[$k][$kk]) { $sEmpty[$k][] = $et[$i]; //end time in mins $eEmpty[$k][] = $eEmpty[$k][$kk]; $eEmpty[$k][$kk] = $stM; //start in mins $sFill[$k][] = $stM; $evIx[$k][] = $i; $found = true; break 2; } } } if (!$found) { $indent++; $sEmpty[$indent][0] = 0; $eEmpty[$indent][0] = $stM; $sEmpty[$indent][1] = $et[$i]; $eEmpty[$indent][1] = 1440; //24 x 60 $sFill[$indent][0] = $stM; $evIx[$indent][0] = $i; } } $cWidth = round(80 / ($indent + 1), 1); //width of smallest column $showDetails = ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1); foreach ($sFill as $k => $v) { //1 min = 1px $eLeft = ($cWidth + 0.2) * $k; //event left side in % $eWidth = $cWidth - 0.5; //event width in % foreach ($v as $kk => $stM) { //event start time in mins $etM = $sEmpty[$k][$kk + 1]; //event end time in mins $eHeight = $etM - $stM; //event height in mins $stM = round($stM * $set['dwTsHeight'] / $set['dwTimeSlot']) - 1; //scale start time in px $eHeight = round($eHeight * $set['dwTsHeight'] / $set['dwTimeSlot']) - 1; //scale height in px $i = $evIx[$k][$kk]; $evt =& $evtList[$date][$i]; $mayCheck = ($privs > 3 or $privs > 1 and $evt['uid'] == $_SESSION['uid']); //boolean $sti = $evt['sti'] ? ITtoDT($evt['sti']) : ''; $stiPrefix = (substr($evt['sti'], 0, 2) < $set['dwStartHour'] or substr($evt['sti'], 0, 2) >= $set['dwEndHour']) ? $sti . ' ' : ''; $time = makeHovT($evt); $chBox = ''; if ($evt['cbx']) { $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '☐'; $attrib = $mayCheck ? "class='chkBox floatL point' onclick=\"checkE({$evt['eid']},'{$date}');\" title=\"{$xx['vws_check_mark']}\"" : "class='chkBox floatL arrow'"; $chBox = "<span {$attrib}>{$chBox}</span>"; } if ($set['popBoxWkDay'] and $set['popBoxFields']) { $popText = "<b>{$time} {$evt['tix']}</b><br>"; if ($showDetails or $evt['mayE']) { $popText .= makeE($evt, $set['popBoxFields'], 'br', '<br>'); } $popText = htmlspecialchars(addslashes($popText)); $popClass = ($evt['pri'] ? 'private' : 'normal') . (($evt['mde'] or $evt['r_t']) ? ' repeat' : ''); $popAttr = " onmouseover=\"pop(this,'{$popText}','{$popClass}')\""; } else { $popAttr = ''; } if ($set['eventColor']) { //use event color $eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '') . ' background-color:' . ($evt['cbg'] ? $evt['cbg'] : '#FFFFFF') . ';'; } else { //use user color $eStyle = ' background-color:' . ($evt['uco'] ? $evt['uco'] : '#FFFFFF') . ';'; } if ($evt['app'] and !$evt['apd']) { $eStyle .= 'border-left:2px solid #ff0000;'; } $class = $eHeight < 21 ? 'dwEventNw' : 'dwEvent'; echo "<div class='evtBox' style='top:{$stM}px; left:{$eLeft}%; height:{$eHeight}px; width:{$eWidth}%;{$eStyle}'>\n"; echo "<div class='{$class}'>{$chBox}" . (($showDetails or $evt['mayE']) ? "<span class='point' onclick=\"editE({$evt['eid']},'{$date}');\"" : "<span class='arrow'") . "{$popAttr}>{$stiPrefix}{$evt['tix']}</span></div></div>\n"; } } }
function showEvents($date) { global $evtList, $privs, $set, $xx, $rxULink, $rxIMGTags; $showDetails = ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1); foreach ($evtList[$date] as $evt) { $time = makeHovT($evt); $dTime = $evt['mde'] ? $time : ITtoDT($evt['sti']); $chBox = ''; if ($evt['cbx']) { $mayCheck = ($privs > 3 or $privs > 1 and $evt['uid'] == $_SESSION['uid']); //boolean $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '☐'; $cBoxAtt = $mayCheck ? "class='chkBox floatL point' onclick=\"checkE({$evt['eid']},'{$date}');\" title=\"{$xx['vws_check_mark']}\"" : 'class="chkBox floatL arrow"'; $chBox = "<span {$cBoxAtt}>{$chBox}</span>"; } if ($set['popBoxMonth'] and $set['popBoxFields']) { $popText = "<b>{$time} {$evt['tix']}</b><br>"; if ($showDetails or $evt['mayE']) { $popText .= makeE($evt, $set['popBoxFields'], 'br', '<br>'); } $popText = htmlspecialchars(addslashes($popText)); $popClass = ($evt['pri'] ? 'private' : 'normal') . (($evt['mde'] or $evt['r_t']) ? ' repeat' : ''); $popAttr = " onmouseover=\"pop(this,'{$popText}','{$popClass}')\""; } else { $popAttr = ''; } if ($set['eventColor']) { //use event color $eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '') . ($evt['cbg'] ? "background-color:{$evt['cbg']};" : ''); } else { //use user color $eStyle = $evt['uco'] ? "background-color:{$evt['uco']};" : ''; } if ($evt['app'] and !$evt['apd']) { $eStyle .= 'border-left:2px solid #ff0000;'; } $eStyle = $eStyle ? ' style="' . $eStyle . '"' : ''; echo "<div class='event'{$eStyle}>\n"; echo "<div>{$chBox}<span " . (($showDetails or $evt['mayE']) ? "class='evtTitle point' onclick=\"editE(" . $evt['eid'] . ",'" . $date . "');\"" : "class='evtTitle arrow'") . $popAttr . ">{$dTime} {$evt['tix']}</span></div>\n"; if ($evt['ven']) { //venue set $_SESSION['venList'][$evt['ven']] = true; //save it as an array key } if ($set['showImageInMV'] and preg_match_all($rxIMGTags, $evt['des'] . $evt['xf1'] . $evt['xf2'], $imgs, PREG_SET_ORDER)) { echo "<div>"; foreach ($imgs as $img) { echo $img[0] . "<br>"; } echo "</div>\n"; } if ($set['showLinkInMV'] and preg_match_all($rxULink, $evt['des'] . $evt['xf1'] . $evt['xf2'], $urls, PREG_SET_ORDER)) { //display URL links echo "<div>"; foreach ($urls as $url) { echo $url[0] . "<br>"; } echo "</div>\n"; } echo "</div>\n"; } }