Esempio n. 1
0
function showGrid(&$events, $date)
{
    global $privs, $hoverBox, $evtDone, $set, $xx, $upcoTxt;
    $lastDate = '';
    $showDetails = ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1);
    foreach ($events as $evt) {
        if (!$evt['mde'] or !in_array($evt['eid'], $evtDone)) {
            //!mde or mde not processed
            $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']) : '');
            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']) {
                $chBox .= !$evt['mde'] ? strpos($evt['chd'], $date) ? $evt['cmk'] : '☐' : '?';
            }
            if ($chBox) {
                $mayCheck = ($privs > 3 or $privs > 1 and $evt['uid'] == $_SESSION['uid']) ? true : false;
                $attrib = ($mayCheck and !$evt['mde']) ? "class='chkBox point' onclick=\"checkE(" . $evt['eid'] . ",'" . $date . "');\" title=\"{$xx['vws_check_mark']}\"" : 'class="chkBox"';
                $chBox = '<span ' . $attrib . ">" . trim($chBox) . '</span>';
            }
            if ($hoverBox) {
                $popText = "<b>{$evtTime}:" . ((!$evt['mde'] and $evt['eti']) ? ' - ' . ITtoDT($evt['eti']) : '') . " {$evt['tit']}</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 = '';
            }
            $eBoxStyle = ($evt['app'] and !$evt['apd']) ? " style='border-left:2px solid #ff0000;'" : '';
            echo $lastDate != $evtDate ? "<br>\n<h6>{$evtDate}</h6>\n" : "<br>\n";
            echo "<table>\n<tr>\n\t\t\t\t<td class='widthCol1'>{$evtTime}</td>\n\t\t\t\t<td class='eBox'{$eBoxStyle}>";
            if ($showDetails or $evt['mayE']) {
                echo "<h6>{$chBox}<span class='point'{$eStyle} onclick=\"editE({$evt['eid']},'{$date}');\"{$popAttr}>{$evt['tit']}</span></h6>\n";
                echo makeE($evt, $set['evtTemplUpc'], 'br', '<br>') . "\n";
            } else {
                echo "<h6>{$chBox}<span{$eStyle}{$popAttr}>{$evt['tit']}</span></h6>\n";
            }
            echo "</td></tr></table>\n";
            $evtDone[] = $evt['eid'];
            //add text version to $upcoTxt
            if ($lastDate != $evtDate) {
                $upcoTxt .= "\n{$evtDate}\n" . str_repeat('-', strlen($evtDate));
            }
            //new or same date
            $upcoTxt .= "\n{$evtTime}\n" . html_entity_decode($evt['tit'], ENT_QUOTES) . "\n";
            if ($showDetails or $evt['mayE']) {
                $upcoTxt .= html_entity_decode(makeE($evt, $set['evtTemplUpc'], 'br', "\n"), ENT_QUOTES) . "\n";
            }
            $lastDate = $evtDate;
        }
    }
}
Esempio n. 2
0
function showEvents(&$events, $date)
{
    global $privs, $wkDays, $set, $xx, $months;
    foreach ($events as $evt) {
        switch ($evt['r_t']) {
            //make repeat text
            case 0:
                $repeat = '';
                break;
            case 1:
                $repeat = $xx['evt_repeat_on'] . ' ' . $evt['r_i'] . ' ' . $xx['evt_period1_' . $evt['r_p']];
                break;
            case 2:
                $repeat = $xx['evt_repeat_on'] . ' ' . $xx['evt_interval2_' . $evt['r_i']] . ' ' . $wkDays[$evt['r_p']] . ' ' . $xx['of'] . ' ' . ($evt['r_m'] ? $months[$evt['r_m'] - 1] : $xx['evt_each_month']);
        }
        if ($evt['r_t'] > 0 and $evt['r_u']) {
            $repeat .= " {$xx['evt_until']} " . IDtoDD($evt['r_u']);
        }
        if ($evt['app'] and !$evt['apd']) {
            $eBoxStyle = 'border-left:2px solid #ff0000;';
        }
        $eBoxStyle = !empty($eBoxStyle) ? " style='{$eBoxStyle}'" : '';
        $evtDateTime = IDtoDD($evt['sda']);
        if ($evt['sti']) {
            $evtDateTime .= " {$xx['at_time']} " . ITtoDT($evt['sti']);
        }
        if ($evt['eda'] or $evt['eti']) {
            $evtDateTime .= ' -';
        }
        if ($evt['eda']) {
            $evtDateTime .= ' ' . IDtoDD($evt['eda']) . ($evt['eti'] ? " {$xx['at_time']}" : '');
        }
        if ($evt['eti']) {
            $evtDateTime .= ' ' . ITtoDT($evt['eti']);
        }
        if ($evt['ald']) {
            $evtDateTime .= ' ' . $xx['vws_all_day'];
        }
        if ($repeat) {
            $evtDateTime .= '. ' . $repeat;
        }
        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 "<table>\n<tr>\n\t\t\t<td class='widthCol1'>" . ($evt['sts'] < 0 ? $xx['chg_deleted'] : ($evt['mdt'] > $evt['adt'] ? $xx['chg_edited'] : $xx['chg_added'])) . "</td>\n";
        echo "<td class='eBox'{$eBoxStyle}>{$evtDateTime}";
        if ($evt['sts'] >= 0 and $evt['mayE']) {
            echo "<h6><span class='point'{$eStyle} onclick=\"editE({$evt['eid']},'{$date}');\">{$evt['tix']}</span></h6>\n";
        } else {
            echo "<h6><span{$eStyle}>{$evt['tix']}</span></h6>\n";
        }
        if ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1 or $evt['mayE']) {
            echo makeE($evt, $set['evtTemplGen'], 'br', "<br>\n", '1234567') . "\n";
        }
        echo "</td>\n</tr>\n</table>\n<br>\n";
    }
}
Esempio n. 3
0
function notify(&$evt, $date, $daysDue)
{
    global $emlStyle, $set, $xx, $ax;
    $todayD = date("Y-m-d", time() + 43200);
    //today 12:00
    //compose email message
    $dateTime = IDtoDD($date) . ' ' . $xx['at_time'] . ' ' . (($evt['sti'] or $evt['eti']) ? ITtoDT($evt['sti']) : $ax['cro_all_day']);
    if ($evt['eti']) {
        $dateTime .= " - " . ITtoDT($evt['eti']);
    }
    $status = '';
    if ($evt['cbx']) {
        $status .= $evt['clb'] . ': ' . (strpos($evt['chd'], $date) ? $evt['cmk'] : '- -');
    }
    $subject = "{$set['calendarTitle']} - " . ($daysDue ? "{$ax['cro_due_in']} {$daysDue} {$ax['cro_days']}" : $ax['cro_due_today']) . ": " . $evt['tit'];
    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}\"" : '';
    $calUrl = $set['calendarUrl'] . (strpos($set['calendarUrl'], '?', 6) ? '&amp;' : '?') . 'cD=' . $date;
    $evtText = makeE($evt, $set['evtTemplGen'], 'td', '', '12345');
    $msgText = "\n<html>\n<head>\n<title>{$set['calendarTitle']} {$ax['cro_mailer']}</title>\n<style type='text/css'>\nbody, p, table {{$emlStyle}}\ntd {vertical-align:top;}\n</style>\n</head>\n<body>\n<p>{$set['calendarTitle']} {$ax['cro_mailer']} " . IDtoDD($todayD) . "</p>\n<p>" . ($daysDue ? "{$ax['cro_event_due_in']} {$daysDue} {$ax['cro_days']}" : $ax['cro_event_due_today']) . ":</p>\n<table>\n\t<tr><td>{$ax['cro_title']}:</td><td><b><span{$eStyle}>{$evt['tit']}</span></b></td></tr>\n\t" . ($evt['cbx'] ? "<tr><td>{$ax['cro_status']}:</td><td>{$status}</td></tr>" : '') . "\n\t<tr><td>{$ax['cro_date_time']}:</td><td>{$dateTime}</td></tr>\n\t{$evtText}\n</table>\n<p><a href='{$calUrl}'>{$ax['cro_open_calendar']}</a></p>\n</body>\n</html>\n";
    //send notification
    $sender = $set['notifSender'] ? $evt['uid'] : 0;
    $sent = sendMail($subject, $msgText, $evt['rml'], $sender);
    $sentTo = $sent ? "{$sent} - {$ax['cro_subject']}: {$subject}" : "Sending mail failed. See logs/luxcal.log for details";
    return $sentTo;
}
Esempio n. 4
0
function showGrid($date)
{
    global $evtList, $privs, $set, $xx;
    if (!array_key_exists($date, $evtList)) {
        return;
    }
    $showDetails = ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1);
    foreach ($evtList[$date] as $evt) {
        switch ($evt['mde']) {
            //multi-day event?
            case 0:
                $time = ITtoDT($evt['sti']) . ($evt['eti'] ? ' - ' . ITtoDT($evt['eti']) : '');
                break;
                //no
            //no
            case 1:
                $time = (($evt['sti'] != '00:00' and $evt['sti'] != '') ? ITtoDT($evt['sti']) : '&bull;') . '&middot;&middot;&middot;';
                break;
                //first
            //first
            case 2:
                $time = '&middot;&middot;&middot;';
                break;
                //in between
            //in between
            case 3:
                $time = '&middot;&middot;&middot;' . (($evt['eti'] < '23:59' and $evt['eti'] != '') ? ITtoDT($evt['eti']) : '&bull;');
                //last
        }
        $chBox = '';
        if ($evt['cbx']) {
            $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '&#x2610;';
            $chBox = "<span class='chkBox'>{$chBox}</span>";
        }
        if ($set['popBoxYear'] and $set['popBoxFields']) {
            $popText = "<b>{$chBox} {$time} {$evt['tit']}</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']) {
            $eStyle = $evt['cbg'] ? "background-color:{$evt['cbg']};" : '';
        } else {
            $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";
    }
}
Esempio n. 5
0
function makeGrid(&$events)
{
    global $set, $xx, $wkDays, $months;
    $changeList = '';
    foreach ($events as $evt) {
        switch ($evt['r_t']) {
            //make repeat text
            case 0:
                $repeat = '';
                break;
            case 1:
                $repeat = $xx['evt_repeat_on'] . ' ' . $evt['r_i'] . ' ' . $xx['evt_period1_' . $evt['r_p']];
                break;
            case 2:
                $repeat = $xx['evt_repeat_on'] . ' ' . $xx['evt_interval2_' . $evt['r_i']] . ' ' . $wkDays[$evt['r_p']] . ' ' . $xx['of'] . ' ' . ($evt['r_m'] ? $months[$evt['r_m'] - 1] : $xx['evt_each_month']);
        }
        if ($evt['r_t'] > 0 and $evt['r_u']) {
            $repeat .= " {$xx['evt_until']} " . IDtoDD($evt['r_u']);
        }
        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}\"" : '';
        $eBoxStyle = ' style="padding-left:5px;' . (($evt['app'] and !$evt['apd']) ? ' border-left:2px solid #ff0000;' : '') . '"';
        $changeList .= "<table><tr><td width='100px'>";
        $changeList .= $evt['sts'] < 0 ? $xx['chg_deleted'] : ($evt['mdt'] > $evt['adt'] ? $xx['chg_edited'] : $xx['chg_added']);
        $changeList .= "&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
        $changeList .= "<td{$eBoxStyle}>";
        $changeList .= "<span{$eStyle}><b>{$evt['tit']}</b></span><br>\n";
        $changeList .= IDtoDD($evt['sda']);
        if ($evt['sti']) {
            $changeList .= " {$xx['at_time']} " . ITtoDT($evt['sti']);
        }
        if ($evt['eda'] or $evt['eti']) {
            $changeList .= ' -';
        }
        if ($evt['eda']) {
            $changeList .= ' ' . IDtoDD($evt['eda']) . ($evt['eti'] ? " {$xx['at_time']}" : '');
        }
        if ($evt['eti']) {
            $changeList .= ' ' . ITtoDT($evt['eti']);
        }
        if ($evt['ald']) {
            $changeList .= " {$xx['vws_all_day']}";
        }
        $changeList .= " {$repeat}<br>";
        $changeList .= makeE($evt, $set['evtTemplGen'], 'br', "<br>\n", '1234567');
        $changeList .= "</td></tr></table><br>\n";
    }
    return $changeList;
}
Esempio n. 6
0
 function displayUE(&$evtList)
 {
     global $evtList, $set, $xx, $sbMaxNbr, $sbCalUrl, $rxULink;
     $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']) : '');
                 if ($set['popFieldsSbar']) {
                     $popText = "<div class='ssb_gen ssb_popUp'><b>{$evtTime} {$evt['tit']}</b>";
                     $popText = makeE($evt, $set['popFieldsSbar'], 'br', "<br>");
                     $popText = htmlspecialchars(addslashes($popText . '</div>'));
                     $popClass = ($evt['mde'] or $evt['r_t']) ? 'ssb_repeat' : 'ssb_normal';
                     $popAttr = " onmouseover=\"pop(this,'{$popText}','{$popClass}',50)\"";
                 } else {
                     $popAttr = '';
                 }
                 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}'" : '';
                 if (empty($sbCalUrl)) {
                     $eTitle = $evt['tit'];
                 } else {
                     $jumpD = (strpos($sbCalUrl, '?') ? '&amp;' : '?') . "cD={$evt['sda']}";
                     $eTitle = "<a href='{$sbCalUrl}{$jumpD}' target='luxcal'>{$evt['tit']}</a>";
                 }
                 if ($lastDate != $evtDate) {
                     echo "<div class='ssb_gen ssb_date'>{$evtDate}</div>\n";
                     $lastDate = $evtDate;
                 }
                 echo "<div class='ssb_gen ssb_event ssb_arrow'{$popAttr}>\n\t\t\t\t\t<div class='ssb_gen ssb_evtTime'>{$evtTime}</div>\n<div class='ssb_gen ssb_evtTitle'{$eStyle}>{$eTitle}</div>\n\t\t\t\t\t</div>\n";
                 if ($set['showLinkInSB'] and preg_match_all($rxULink, $evt['des'], $urls, PREG_SET_ORDER)) {
                     //display URL links
                     echo "<div class='ssb_gen ssb_evtUrl'{$eStyle}>";
                     foreach ($urls as $url) {
                         echo "{$url[0]}<br>";
                     }
                     echo "</div>\n";
                 }
                 if (--$sbMaxNbr < 1) {
                     break 2;
                 }
             }
         }
     }
 }
Esempio n. 7
0
function notifyNow(&$evt, $what)
{
    //notify added/edited/deleted event
    global $xx, $set, $nml, $apd, $app, $tit, $cid, $sda, $eda, $sti, $eti, $r_t, $ald, $chd, $uid, $repTxt;
    $emlStyle = "background:#FFFFDD; color:#000099; font:12px arial, sans-serif;";
    //email body style definition
    //get category data
    $stH = stPrep("SELECT `name`,`color`,`bgColor`,`checkBx`,`checkLb`,`checkMk` FROM `categories` WHERE `ID` = ?");
    stExec($stH, array($cid));
    $row = $stH->fetch(PDO::FETCH_ASSOC);
    $stH = null;
    //compose email message
    $noteText = $what == 'add_exe' ? $xx['evt_event_added'] : ($what == 'upd_exe' ? $xx['evt_event_edited'] : $xx['evt_event_deleted']);
    $dateTime = $sda;
    if ($sti) {
        $dateTime .= ' ' . $xx['at_time'] . ' ' . $sti;
    }
    if ($eda or $eti) {
        $dateTime .= ' -';
    }
    if ($eda) {
        $dateTime .= ' ' . $eda;
    }
    if ($eda and $eti) {
        $dateTime .= ' ' . $xx['at_time'];
    }
    if ($eti) {
        $dateTime .= ' ' . $eti;
    }
    $dateTime .= ($ald == 'all' ? ' ' . $xx['evt_all_day'] : '') . ($r_t ? ' (' . $repTxt . ')' : '');
    $evD = DDtoID($sda);
    $status = '';
    if (!$eda and !$r_t) {
        //no multi-day and not repeating
        if ($row['checkBx']) {
            $status .= $row['checkLb'] . ': ' . (strpos($chd, $evD) ? $row['checkMk'] : '- -');
        }
    }
    $subject = "{$set['calendarTitle']} - {$noteText}: {$tit}";
    $catColor = ($row['color'] ? "color:{$row['color']};" : "") . ($row['bgColor'] ? "background-color:{$row['bgColor']};" : "");
    $eStyle = $catColor ? " style=\"{$catColor}\"" : "";
    $eBoxStyle = ' style="padding-left:5px;' . (($app and !$apd) ? ' border-left:2px solid #ff0000;' : '') . '"';
    $calUrl = $set['calendarUrl'] . (strpos($set['calendarUrl'], '?', 6) ? '&amp;' : '?') . 'cD=' . $evD;
    $evtText = makeE($evt, $set['evtTemplGen'], 'td', '', '12345');
    $msgText = "\n<html>\n<head>\n<title>{$set['calendarTitle']} {$xx['evt_mailer']}</title>\n<style type='text/css'>\nbody, p, table {{$emlStyle}}\ntd {vertical-align:top;}\n</style>\n</head>\n<body>\n<p>{$set['calendarTitle']} {$xx['evt_mailer']} " . IDtoDD(date("Y-m-d")) . "</p>\n<p>{$noteText}:</p>\n<table{$eBoxStyle}>\n\t<tr><td>{$xx['evt_title']}:</td><td><b><span{$eStyle}>{$tit}</span></b></td></tr>\n\t" . ($status ? "<tr><td>{$xx['evt_status']}:</td><td>{$status}</td></tr>" : '') . "\n\t<tr><td>{$xx['evt_date_time']}:</td><td>{$dateTime}</td></tr>\n\t{$evtText}\n</table>\n<p><a href='{$calUrl}'>{$xx['evt_open_calendar']}</a></p>\n</body>\n</html>\n";
    //send notifications
    if ($nml) {
        //email address(es) to notify
        $sender = $set['notifSender'] ? $uid : 0;
        sendMail($subject, $msgText, $nml, $sender);
    }
}
Esempio n. 8
0
function showGrid($date)
{
    global $set, $evtList, $privs, $xx;
    if (!array_key_exists($date, $evtList)) {
        return;
    }
    foreach ($evtList[$date] as &$evt) {
        switch ($evt['mde']) {
            //multi-day event?
            case 0:
                $time = ITtoDT($evt['sti']);
                break;
                //no
            //no
            case 1:
                $time = (($evt['sti'] != '00:00' and $evt['sti'] != '') ? ITtoDT($evt['sti']) : '&bull;') . '&middot;&middot;&middot;';
                break;
                //first
            //first
            case 2:
                $time = '&middot;&middot;&middot;';
                break;
                //in between
            //in between
            case 3:
                $time = '&middot;&middot;&middot;' . (($evt['eti'] < '23:59' and $evt['eti'] != '') ? ITtoDT($evt['eti']) : '&bull;');
                //last
        }
        $chBox = '';
        if ($evt['cbx']) {
            $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '&#x2610;';
        }
        if ($chBox) {
            $chBox = '<span class="chkBox">' . trim($chBox) . '</span>';
        }
        if ($set['popFieldsMcal']) {
            $popText = "<div class=\"fontS\"><b>" . $chBox . $time . ((!$evt['mde'] and $evt['eti']) ? ' - ' . ITtoDT($evt['eti']) . ' ' : ' ') . $evt['tit'] . '</b>';
            $popText .= '<br>' . makeE($evt, $set['popFieldsMcal'], 'br', "<br>");
            $popText = htmlspecialchars(addslashes($popText . '</div>'));
            $popClass = ($evt['mde'] or $evt['r_t']) ? 'normal repeat' : 'normal';
            $popAttr = " onmouseover=\"pop(this,'{$popText}','{$popClass}',30)\"";
            $cursor = ' point';
        } else {
            $popAttr = '';
            $cursor = ' arrow';
        }
        $bgColor = $evt['cbg'] ? " style=\"background-color:{$evt['cbg']};\"" : '';
        $mayEdit = $set['miniCalPost'] ? " onclick=\"x=editE({$evt['eid']},'{$date}');\"" : '';
        echo "<div class='miniSquare{$cursor}'{$bgColor}{$mayEdit}{$popAttr}></div>\n";
    }
}
Esempio n. 9
0
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'] : '&#x2610;';
            $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";
    }
}
Esempio n. 10
0
function showGrid($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
    if (!array_key_exists($date, $evtList)) {
        return;
    }
    //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']) ? true : false;
            $sti = $evt['sti'] ? ITtoDT($evt['sti']) : '';
            $stiPrefix = (substr($evt['sti'], 0, 2) < $set['dwStartHour'] or substr($evt['sti'], 0, 2) >= $set['dwEndHour']) ? $sti . ' ' : '';
            switch ($evt['mde']) {
                //multi-day event?
                case 0:
                    $time = ITtoDT($evt['sti']) . ($evt['eti'] ? ' - ' . ITtoDT($evt['eti']) : '');
                    break;
                    //no
                //no
                case 1:
                    $time = (($evt['sti'] != '00:00' and $evt['sti'] != '') ? ITtoDT($evt['sti']) : '&bull;') . '&middot;&middot;&middot;';
                    break;
                    //first
                //first
                case 2:
                    $time = '&middot;&middot;&middot;';
                    break;
                    //in between
                //in between
                case 3:
                    $time = '&middot;&middot;&middot;' . (($evt['eti'] < '23:59' and $evt['eti'] != '') ? ITtoDT($evt['eti']) : '&bull;');
                    //last
            }
            $chBox = '';
            if ($evt['cbx']) {
                $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '&#x2610;';
                $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['tit']}</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['tit']}</span></div></div>\n";
        }
    }
}
Esempio n. 11
0
function makeFile()
{
    global $ax, $evtList, $set, $fileName, $fileDes, $usrName, $catName, $fromDda, $fromMda, $tillDda, $tillMda;
    $icsHead = "BEGIN:VCALENDAR\r\n";
    $icsHead .= "VERSION:2.0\r\n";
    $icsHead .= "METHOD:PUBLISH\r\n";
    $icsHead .= "PRODID:- // LuxCal " . LCV . " // {$set['calendarTitle']} // EN\r\n";
    $icsHead .= "X-LC-CONTENT:user: "******"all");
    $icsHead .= " // cat: " . ($catName != '*' ? $catName : "all");
    $icsHead .= " // due: " . ($fromDda ? $fromDda : "begin") . " - " . ($tillDda ? $tillDda : "end");
    $icsHead .= " // mod: " . ($fromMda ? $fromMda : "begin") . " - " . ($tillMda ? $tillMda : "end") . "\r\n";
    $icsHead .= "X-WR-CALNAME:" . ($fileDes ? htmlspecialchars_decode($fileDes, ENT_QUOTES) : "Events") . "\r\n";
    $icsHead .= "X-WR-TIMEZONE:" . date_default_timezone_get() . "\r\n";
    $icsHead .= "CALSCALE:GREGORIAN\r\n";
    //set event filter
    $filter = $usrName != '*' ? " AND u.user_name = '{$usrName}'" : '';
    if ($catName != '*') {
        $filter .= " AND c.name = '{$catName}'";
    }
    if ($fromMda) {
        $filter .= " AND SUBSTR(e.m_datetime,1,10) >= '{$fromMda}'";
    }
    if ($tillMda) {
        $filter .= " AND SUBSTR(e.m_datetime,1,10) <= '{$tillMda}'";
    }
    //set event date range
    $sRange = $fromDda ? $fromDda : date('Y-m-d', time() - 31536000);
    //-1 year
    $eRange = $tillDda ? $tillDda : date('Y-m-d', time() + 31536000);
    //+1 year
    retrieve($sRange, $eRange, '', substr($filter, 5));
    //grab events
    if (count($evtList) == 0) {
        return $ax['iex_no_events_found'];
    }
    $icsBody = '';
    $from = array(',', ';', '<br>');
    $to = array('\\,', '\\;', '\\n');
    $eidDone = array();
    //events processed
    foreach ($evtList as $evtListDate) {
        foreach ($evtListDate as $evt) {
            if (!in_array($evt['eid'], $eidDone)) {
                //event not yet processed
                $vDescription = str_replace($from, $to, htmlspecialchars_decode(makeE($evt, $set['evtTemplGen'], 'br', '\\n', '345'), ENT_QUOTES));
                $vDescription = chunk_split_unicode($vDescription, 72, "\r\n ");
                //fold to 72 chars line length
                //compile DTSTART and DTEND values
                $dateS = str_replace('-', '', $evt['sda']);
                $dateE = $evt['eda'][0] != '9' ? str_replace('-', '', $evt['eda']) : $dateS;
                $timeS = str_replace(':', '', $evt['sti']);
                $timeE = str_replace(':', '', $evt['eti']);
                if ($timeS == '' and $timeE == '') {
                    //all day
                    $allDay = true;
                    $dateE = date('Ymd', mktime(12, 0, 0, substr($dateE, 4, 2), substr($dateE, 6, 2) + 1, substr($dateE, 0, 4)));
                    //+1 day
                } else {
                    $allDay = false;
                    $dateS .= 'T' . $timeS . '00';
                    $dateE .= 'T' . ($timeE ? $timeE . '00' : $timeS . '01');
                }
                //compile RRULE property
                $rrule = '';
                if ($evt['r_t'] == 1) {
                    //every 1|2|3|4 d|w|m|y
                    $rrule .= "FREQ=";
                    switch ($evt['r_p']) {
                        case 1:
                            $rrule .= 'DAILY';
                            break;
                        case 2:
                            $rrule .= 'WEEKLY';
                            break;
                        case 3:
                            $rrule .= 'MONTHLY';
                            break;
                        case 4:
                            $rrule .= 'YEARLY';
                    }
                    $rrule .= ";INTERVAL=" . $evt['r_i'];
                }
                if ($evt['r_t'] == 2) {
                    //every 1|2|3|4|5 m|t|w|t|f|s|s of the month
                    $rrule .= $evt['r_m'] ? "FREQ=YEARLY" : "FREQ=MONTHLY";
                    $rrule .= ";BYDAY=" . ($evt['r_i'] != 5 ? $evt['r_i'] : '-1');
                    switch ($evt['r_p']) {
                        case 1:
                            $rrule .= 'MO';
                            break;
                        case 2:
                            $rrule .= 'TU';
                            break;
                        case 3:
                            $rrule .= 'WE';
                            break;
                        case 4:
                            $rrule .= 'TH';
                            break;
                        case 5:
                            $rrule .= 'FR';
                            break;
                        case 6:
                            $rrule .= 'SA';
                            break;
                        case 7:
                            $rrule .= 'SU';
                    }
                    if ($evt['r_m']) {
                        $rrule .= ";BYMONTH=" . $evt['r_m'];
                    }
                }
                if ($evt['r_u'][0] != '9') {
                    $rrule .= ";UNTIL=" . str_replace('-', '', $evt['r_u']) . 'T235900';
                }
                $tStamp = mktime(substr($timeS, 0, 2), substr($timeS, 2, 2), 0, substr($dateS, 4, 2), substr($dateS, 6, 2), substr($dateS, 0, 4));
                $icsBody .= "BEGIN:VEVENT\r\n";
                $icsBody .= "DTSTAMP:" . gmdate('Ymd\\THis\\Z') . "\r\n";
                if ($evt['adt']) {
                    $icsBody .= "CREATED:" . gmdate('Ymd\\THis\\Z', mktime(substr($evt['adt'], 11, 2), substr($evt['adt'], 14, 2), 0, substr($evt['adt'], 5, 2), substr($evt['adt'], 8, 2) + 1, substr($evt['adt'], 0, 4))) . "\r\n";
                }
                if ($evt['mdt']) {
                    $icsBody .= "LAST-MODIFIED:" . gmdate('Ymd\\THis\\Z', mktime(substr($evt['mdt'], 11, 2), substr($evt['mdt'], 14, 2), 0, substr($evt['mdt'], 5, 2), substr($evt['mdt'], 8, 2) + 1, substr($evt['mdt'], 0, 4))) . "\r\n";
                }
                $icsBody .= "UID:" . gmdate("Ymd\\THis\\Z", $tStamp) . trim(substr(iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $evt['tit']), 0, 4)) . "-LuxCal@{$set['calendarUrl']}\r\n";
                $icsBody .= "SUMMARY:" . str_replace(",", "\\,", htmlspecialchars_decode($evt['tit'], ENT_QUOTES)) . "\r\n";
                if ($vDescription) {
                    $icsBody .= "DESCRIPTION:{$vDescription}\r\n";
                }
                $icsBody .= "CATEGORIES:" . str_replace(",", "\\,", $evt['cnm']) . "\r\n";
                if ($evt['ven']) {
                    $icsBody .= "LOCATION:" . str_replace(",", "\\,", htmlspecialchars_decode($evt['ven'], ENT_QUOTES)) . "\r\n";
                }
                if ($rrule) {
                    $icsBody .= "RRULE:{$rrule}\r\n";
                }
                $icsBody .= "DTSTART;" . ($allDay ? "VALUE=DATE" : "TZID=" . date_default_timezone_get()) . ":{$dateS}\r\n";
                $icsBody .= "DTEND;" . ($allDay ? "VALUE=DATE" : "TZID=" . date_default_timezone_get()) . ":{$dateE}\r\n";
                //+1 ?
                $icsBody .= "END:VEVENT\r\n";
                $eidDone[] = $evt['eid'];
                //mark as processed
            }
        }
    }
    $icsTail = "END:VCALENDAR";
    //save to iCal file
    $icalfName = $fileName ? $fileName : $set['calendarTitle'];
    $icalfName = translit($icalfName, true);
    if (file_put_contents("./files/{$icalfName}.ics", $icsHead . $icsBody . $icsTail, LOCK_EX) !== false) {
        $result = $ax['iex_file_created'];
    } else {
        $result = $ax['iex_write error'];
    }
    return $result;
}
Esempio n. 12
0
function cronExpIcal()
{
    global $lcV, $evtList, $set, $fileName;
    //set event date range
    $expIcalHist = 7;
    //-7 days (maybe an admin setting later)
    $sRange = date('Y-m-d', mktime(12, 0, 0) - 86400 * $expIcalHist);
    $eRange = date('Y-m-d', time() + 31536000);
    //+1 year
    $icsHead = "BEGIN:VCALENDAR\nVERSION:2.0\nMETHOD:PUBLISH\nPRODID:- // LuxCal {$lcV} // {$set['calendarTitle']} // EN\nX-LC-CONTENT:user: all // cat: all // due: {$sRange} - {$eRange}\nX-WR-CALNAME:Events\nX-WR-TIMEZONE:" . date_default_timezone_get() . "\nCALSCALE:GREGORIAN\r\n";
    //retrieve events from db
    retrieve($sRange, $eRange);
    $icsBody = '';
    $from = array(',', ';', '<br>');
    $to = array('\\,', '\\;', '\\n');
    $nrExported = 0;
    $eidDone = array();
    //events processed
    foreach ($evtList as $evtListDate) {
        foreach ($evtListDate as $evt) {
            if (!in_array($evt['eid'], $eidDone)) {
                //event not yet processed
                $vDescription = str_replace($from, $to, htmlspecialchars_decode(makeE($evt, $set['evtTemplGen'], 'br', '\\n', '345'), ENT_QUOTES));
                $vDescription = chunk_split_unicode($vDescription, 72, "\r\n ");
                //fold to 72 chars line length
                //compile DTSTART and DTEND values
                $dateS = str_replace('-', '', $evt['sda']);
                $dateE = $evt['eda'][0] != '9' ? str_replace('-', '', $evt['eda']) : $dateS;
                $timeS = str_replace(':', '', $evt['sti']);
                $timeE = str_replace(':', '', $evt['eti']);
                if ($timeS == '' and $timeE == '') {
                    //all day
                    $allDay = true;
                    $dateE = date('Ymd', mktime(12, 0, 0, substr($dateE, 4, 2), substr($dateE, 6, 2) + 1, substr($dateE, 0, 4)));
                    //+1 day
                } else {
                    $allDay = false;
                    $dateS .= 'T' . $timeS . '00';
                    $dateE .= 'T' . ($timeE ? $timeE . '00' : $timeS . '01');
                }
                //compile RRULE property
                $rrule = '';
                if ($evt['r_t'] == 1) {
                    //every 1|2|3|4 d|w|m|y
                    $rrule .= "FREQ=";
                    switch ($evt['r_p']) {
                        case 1:
                            $rrule .= 'DAILY';
                            break;
                        case 2:
                            $rrule .= 'WEEKLY';
                            break;
                        case 3:
                            $rrule .= 'MONTHLY';
                            break;
                        case 4:
                            $rrule .= 'YEARLY';
                    }
                    $rrule .= ";INTERVAL=" . $evt['r_i'];
                }
                if ($evt['r_t'] == 2) {
                    //every 1|2|3|4|5 m|t|w|t|f|s|s of the month
                    $rrule .= $evt['r_m'] ? "FREQ=YEARLY" : "FREQ=MONTHLY";
                    $rrule .= ";BYDAY=" . ($evt['r_i'] != 5 ? $evt['r_i'] : '-1');
                    switch ($evt['r_p']) {
                        case 1:
                            $rrule .= 'MO';
                            break;
                        case 2:
                            $rrule .= 'TU';
                            break;
                        case 3:
                            $rrule .= 'WE';
                            break;
                        case 4:
                            $rrule .= 'TH';
                            break;
                        case 5:
                            $rrule .= 'FR';
                            break;
                        case 6:
                            $rrule .= 'SA';
                            break;
                        case 7:
                            $rrule .= 'SU';
                    }
                    if ($evt['r_m']) {
                        $rrule .= ";BYMONTH=" . $evt['r_m'];
                    }
                }
                if ($evt['r_u'][0] != '9') {
                    $rrule .= ";UNTIL=" . str_replace('-', '', $evt['r_u']) . 'T235900';
                }
                $tStamp = mktime(substr($timeS, 0, 2), substr($timeS, 2, 2), 0, substr($dateS, 4, 2), substr($dateS, 6, 2), substr($dateS, 0, 4));
                $icsBody .= "BEGIN:VEVENT\r\n";
                $icsBody .= "DTSTAMP:" . gmdate('Ymd\\THis\\Z') . "\r\n";
                if ($evt['adt']) {
                    $icsBody .= "CREATED:" . gmdate('Ymd\\THis\\Z', mktime(substr($evt['adt'], 11, 2), substr($evt['adt'], 14, 2), 0, substr($evt['adt'], 5, 2), substr($evt['adt'], 8, 2) + 1, substr($evt['adt'], 0, 4))) . "\r\n";
                }
                if ($evt['mdt']) {
                    $icsBody .= "LAST-MODIFIED:" . gmdate('Ymd\\THis\\Z', mktime(substr($evt['mdt'], 11, 2), substr($evt['mdt'], 14, 2), 0, substr($evt['mdt'], 5, 2), substr($evt['mdt'], 8, 2) + 1, substr($evt['mdt'], 0, 4))) . "\r\n";
                }
                $icsBody .= "UID:" . gmdate("Ymd\\THis\\Z", $tStamp) . trim(substr(iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $evt['tit']), 0, 4)) . "-LuxCal@{$set['calendarUrl']}\r\n";
                $icsBody .= "SUMMARY:" . str_replace(",", "\\,", htmlspecialchars_decode($evt['tit'], ENT_QUOTES)) . "\r\n";
                if ($evt['des']) {
                    $icsBody .= "DESCRIPTION:{$vDescription}\r\n";
                }
                $icsBody .= "CATEGORIES:" . str_replace(",", "\\,", $evt['cnm']) . "\r\n";
                if ($evt['pri']) {
                    $icsBody .= "CLASS:PRIVATE\r\n";
                }
                if ($evt['ven']) {
                    $icsBody .= "LOCATION:" . str_replace(",", "\\,", htmlspecialchars_decode($evt['ven'], ENT_QUOTES)) . "\r\n";
                }
                if ($rrule) {
                    $icsBody .= "RRULE:{$rrule}\r\n";
                }
                $icsBody .= "DTSTART;" . ($allDay ? "VALUE=DATE" : "TZID=" . date_default_timezone_get()) . ":{$dateS}\r\n";
                $icsBody .= "DTEND;" . ($allDay ? "VALUE=DATE" : "TZID=" . date_default_timezone_get()) . ":{$dateE}\r\n";
                //+1 ?
                $icsBody .= "END:VEVENT\r\n";
                $eidDone[] = $evt['eid'];
                //mark as processed
                $nrExported++;
            }
        }
    }
    $icsTail = "END:VCALENDAR";
    //save to iCal file
    $fileName = translit($set['calendarTitle'], true);
    file_put_contents("./files/{$fileName}.ics", $icsHead . $icsBody . $icsTail, LOCK_EX);
    return $nrExported;
}
Esempio n. 13
0
if (!defined('LCC')) {
    exit('not permitted (' . substr(basename(__FILE__), 0, -4) . ')');
}
//launch via script only
if ($app and $apd) {
    //manager or admin
    echo "<div class='apdBar'>{$xx['evt_apd_locked']}</div>\n";
}
$evtArr = array('ven' => $ven, 'cnm' => $cnm, 'des' => $desHtml, 'xf1' => $xf1Html, 'xf2' => $xf2Html);
//Html: with hyperlinks
$eColor = ($col or $bco) ? " style='color:{$col}; background:{$bco};'" : '';
echo "<table class='evtForm'>\n\t<tr><td>{$xx['evt_title']}:</td><td><span{$eColor}>{$tit}</span></td></tr>";
if ($pri) {
    echo "<tr><td colspan='2'>{$xx['evt_private']}</td></tr>\n";
}
echo makeE($evtArr, $set['evtTemplGen'], 'td', "\n", '12345');
echo "<tr><td colspan='2'><hr></td></tr>\n\t<tr><td>{$xx['evt_date_time']}:</td><td>{$sda}";
if ($ald) {
    echo ($eda ? " - {$eda}" : '') . " {$xx['at_time']} {$xx['evt_all_day']}";
} else {
    echo " {$xx['at_time']} {$sti}";
    if ($eda) {
        echo " - {$eda}";
    }
    if ($eti) {
        echo ($eda ? " {$xx['at_time']} " : ' - ') . $eti;
    }
}
echo "</td></tr>\n";
if ($r_t) {
    echo "<tr><td colspan='2'>{$repTxt}<br></td></tr>\n";
Esempio n. 14
0
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'] : '&#x2610;';
            $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";
    }
}
Esempio n. 15
0
$evtDone = array();
if ($evtList) {
    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'];
                $checkBx = strpos($evt['chd'], $date) ? $evt['cmk'] : '';
                $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']) : '');
                $feed = "<item>\n";
                $feed .= "<title>{$evtDate}: {$checkBx}{$evt['tit']}</title>\n";
                $feed .= "<link>{$set['calendarUrl']}{$parSep}cD={$date}</link>\n";
                $feed .= "<description>\n<![CDATA[\n";
                $feed .= "{$evtTime}\n";
                if ($set['details4All'] == 1) {
                    $feed .= '<br>' . makeE($evt, $set['evtTemplGen'], 'br', "<br>\n", '12345');
                }
                $feed .= "]]>\n</description>\n";
                $feed .= "<guid isPermaLink='false'>{$set['calendarUrl']}{$parSep}evt={$evt['eid']}&amp;{$date}</guid>\n";
                $feed .= "</item>\n";
                echo $feed;
            }
        }
    }
} else {
    //no events due
    echo "<item>\n\t\t<description>\n{$xx['vws_none_due_in']} {$set['lookaheadDays']} {$xx['vws_days']}\n</description>\n\t\t<guid isPermaLink='false'>{$set['calendarUrl']}</guid>\n\t\t</item>\n";
}
//feed trailer
echo "</channel>\n</rss>";
Esempio n. 16
0
function showMatches()
{
    global $privs, $set, $xx, $evtList, $schText;
    //display matching events
    echo '<div class="eventBg">' . "\n";
    if ($evtList) {
        $match = '%(' . str_replace(array('_', '&'), array('.', '[^<>]+?'), $schText) . ')(?![^<]*>)%i';
        //convert to regex (?!: neg.look-ahead condition)
        $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']) : '');
                    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']) {
                        $chBox .= !$evt['mde'] ? strpos($evt['chd'], $date) ? $evt['cmk'] : '&#x2610;' : '?';
                    }
                    if ($chBox) {
                        $mayCheck = ($privs > 3 or $privs > 1 and $evt['uid'] == $_SESSION['uid']) ? true : false;
                        $attrib = ($mayCheck and !$evt['mde']) ? " class='chkBox point' onclick=\"checkE({$evt['eid']},'{$date}');\" title=\"{$xx['vws_check_mark']}\"" : 'class="chkBox arrow"';
                        $chBox = "<span{$attrib}>" . trim($chBox) . "</span> ";
                    }
                    if ($evt['app'] and !$evt['apd']) {
                        $eBoxStyle = 'border-left:2px solid #ff0000;';
                    }
                    $eBoxStyle = $eBoxStyle ? " style='{$eBoxStyle}'" : '';
                    echo $lastDate != $evtDate ? "<br><h6><a href='index.php?lc&amp;cP=2&amp;cD={$date}' title=\"{$xx['sch_calendar']}\">{$evtDate}</a></h6>\n" : "<br>\n";
                    echo "<table>\n<tr>\n\t\t\t\t\t\t<td class='widthCol1'>{$evtTime}</td>\n\t\t\t\t\t\t<td class='eBox'{$eBoxStyle}>";
                    if ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1 or $evt['mayE']) {
                        echo "<h6>{$chBox}<span class='point'{$eStyle} onclick=\"editE({$evt['eid']},'{$date}');\">" . preg_replace($match, '<mark>$1</mark>', $evt['tit']) . "</span></h6>\n";
                        echo makeE($evt, $set['evtTemplGen'], 'br', "<br>\n") . "\n";
                    } else {
                        echo "<h6>{$chBox}<span{$eStyle}>" . preg_replace($match, '<mark>$1</mark>', $evt['tit']) . "</span></h6>\n";
                    }
                    echo "</td></tr></table>\n";
                    $lastDate = $evtDate;
                }
            }
        }
    } else {
        echo $xx['sch_no_results'] . "\n";
    }
    echo "</div>\n";
}
Esempio n. 17
0
function showGrid($date)
{
    global $evtList, $privs, $set, $xx, $rxULink;
    if (!array_key_exists($date, $evtList)) {
        return;
    }
    $showDetails = ($set['details4All'] == 1 or $set['details4All'] == 2 and $_SESSION['uid'] > 1);
    foreach ($evtList[$date] as $evt) {
        $mayCheck = ($privs > 3 or $privs > 1 and $evt['uid'] == $_SESSION['uid']) ? true : false;
        switch ($evt['mde']) {
            //multi-day event?
            case 0:
                $time = ITtoDT($evt['sti']);
                break;
                //no
            //no
            case 1:
                $time = (($evt['sti'] != '00:00' and $evt['sti'] != '') ? ITtoDT($evt['sti']) : '&bull;') . '&middot;&middot;&middot;';
                break;
                //first
            //first
            case 2:
                $time = '&middot;&middot;&middot;';
                break;
                //in between
            //in between
            case 3:
                $time = '&middot;&middot;&middot;' . (($evt['eti'] < '23:59' and $evt['eti'] != '') ? ITtoDT($evt['eti']) : '&bull;');
                //last
        }
        $chBox = '';
        if ($evt['cbx']) {
            $chBox .= strpos($evt['chd'], $date) ? $evt['cmk'] : '&#x2610;';
            $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['mde'] and $evt['eti']) ? ' - ' . ITtoDT($evt['eti']) : '') . " {$evt['tit']}</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']) {
            $eStyle = ($evt['cco'] ? "color:{$evt['cco']};" : '') . ($evt['cbg'] ? "background-color:{$evt['cbg']};" : '');
        } else {
            $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 . ">{$time} {$evt['tit']}</span></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";
    }
}