Esempio n. 1
0
function dailystatus($id)
{
    global $conn;
    # start with an empty list
    $days = array();
    # figure out what "today" is
    $date = time();
    $tm = getdate($date);
    $date += (12 - $tm["hours"]) * 3600;
    # Roughly noon today
    $sqltoday = date("Y-m-d", $date);
    # fetch the caldaily records
    $result = mysql_query("SELECT * FROM caldaily WHERE id={$id} AND eventdate>=\"{$sqltoday}\" ORDER BY eventdate", $conn);
    if (!$result) {
        return $days;
    }
    # build a $days element for each record
    for ($i = 1; $i <= mysql_num_rows($result); $i++) {
        # get the record
        $record = mysql_fetch_array($result);
        # append it to $days, in a format that resembles the format
        # of the repeatdates() function in repeat.php.
        $days[$i]["timestamp"] = strtotime($record["eventdate"]) + 3601;
        $days[$i]["sqldate"] = $record["eventdate"];
        $days[$i]["suffix"] = date("Mj", $days[$i]["timestamp"]);
        $days[$i]["newsflash"] = $record["newsflash"];
        $days[$i]["status"] = statusname($record["eventstatus"]);
        $days[$i]["exceptionid"] = $record["exceptionid"];
        $days[$i]["olddate"] = "Y";
    }
    # return the list
    return $days;
}
Esempio n. 2
0
     } else {
         $details .= " * Hide-Contact flag turned off\n";
     }
 }
 if ($highlight != $record['highlight'] && ($_REQUEST['highlight'] == '1' || $_REQUEST['highlight'] == '2')) {
     if ($highlight) {
         $details .= " * Highlighted by the calendar crew\n";
     } else {
         $details .= " * Highlight was removed\n";
     }
 }
 # Also add/update the caldaily records
 for ($i = 1; $daylist[$i]; $i++) {
     $status = $_REQUEST['status' . $daylist[$i]['suffix']];
     $newsflash = $_REQUEST['newsflash' . $daylist[$i]['suffix']];
     $sqlstatus = statusname($status);
     $sqldate = $daylist[$i]['sqldate'];
     $changed = $status == $daylist[$i]['status'] && $status != 'Added' ? 'N' : 'Y';
     switch ($status) {
         case 'Added':
         case 'Skipped':
         case 'Canceled':
         case 'As Scheduled':
             if ($daylist[$i]['olddate'] == 'Y') {
                 $sql = 'UPDATE caldaily SET ';
                 $sql .= "eventstatus = \"{$sqlstatus}\", ";
                 $sql .= "newsflash = \"{$newsflash}\" ";
                 $sql .= "WHERE id={$id} AND eventdate = \"{$sqldate}\"";
                 $act = 'Updating';
             } else {
                 $sql = 'INSERT INTO caldaily (';