$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; $column = array(); //array with column numbers of each event 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; $column[$i] = $k; $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; $column[$i] = $indent; } } $cWidth = round(90 / ($indent+1),1); //width of smallest column foreach ($sFill as $k => $v) { //1 min = 1px $eLeft = ($cWidth + 0.5) * $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]; $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']) { $mayCheck = ($usr['privs'] > 3 or ($usr['privs'] > 1 and $evt['uid'] == $usr['ID'])); //boolean $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}"; } if ($set['evtTemplPop']) { $popText = "{$time} {$evt['tix']}
"; if ($eDetails or $evt['mayE']) { $popText .= makeE($evt,$set['evtTemplPop'],'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').';'; } $toAppr = ($evt['app'] and !$evt['apd']) ? ' toApprove' : ''; $class = $eHeight < 21 ? 'dwEventNw' : 'dwEvent'; // enlarge box if possible // 1. find next column of overlapping event starting before $ovlColumn = $indent+1; for ($iTest=0;$iTest<$i;$iTest++) { $evtBefore = &$evtList[$date][$iTest]; if ($evtBefore['eti'] > $evt['sti'] && $column[$iTest] > $column[$i] && $column[$iTest] < $ovlColumn) { $ovlColumn = $column[$iTest]; } } // 2. find next column of overlapping event starting later for ($iTest=$i+1;$iTest $column[$i] && $column[$iTest] < $ovlColumn) { $ovlColumn = $column[$iTest]; } } $eWidthAdjusted = ($ovlColumn-$k) * $cWidth - 0.5; echo "
\n"; if (!$isMob) { $click = ($evt['mayE'] ? 'editE' : 'showE')."({$evt['eid']},'{$date}')"; $onClick = ($eDetails or $evt['mayE']) ? "{$chBox}{$onClick}{$popAttr}>{$stiPrefix}{$evt['tix']}
\n"; } else { echo "
{$chBox}".(($eDetails or $evt['mayE']) ? "{$stiPrefix}{$evt['tix']}
\n"; } } } } function showHours() { global $set, $xx; //build day $tsHeight = $set['dwTsHeight'] -1; echo "
\n"; echo "
{$xx['vws_all_day']}
\n"; $i = $set['dwStartHour']; $j = 0; if ($set['dwStartHour']) { echo "
{$xx['vws_earlier']}
\n"; } while ($i < $set['dwEndHour']) { echo "
".ITtoDT(str_pad($i,2,"0",STR_PAD_LEFT).":".str_pad($j,2,"0",STR_PAD_LEFT))."
\n"; if (($j += $set['dwTimeSlot']) >= 60) { $i++; $j -= 60; } } if ($set['dwEndHour'] < 24) { echo "
{$xx['vws_later']}
\n"; } echo "
\n"; } function showDay($cDate,$caption="") { global $set, $evtList; //build day $tsHeight = $set['dwTsHeight'] -1; echo "
\n"; echo "\n"; $i = $set['dwStartHour']; $j = 0; if ($set['dwStartHour']) { echo "\n"; } while ($i < $set['dwEndHour']) { echo "\n"; if (($j += $set['dwTimeSlot']) >= 60) { $i++; $j -= 60; } } if ($set['dwEndHour'] < 24) { echo "\n"; } echo "
\n"; if (!empty($evtList[$cDate])) { showEvents($cDate); } echo "
"; echo "
\n"; } if ($usr['privs'] > 1) { ?>