Ejemplo n.º 1
0
function output_row($row)
{
    global $ajax, $json_data;
    $values = array();
    // booking name
    $html_name = htmlspecialchars($row['name']);
    $values[] = "<a title=\"{$html_name}\" href=\"view_entry.php?id=" . $row['entry_id'] . "\">{$html_name}</a>";
    // created by
    $values[] = htmlspecialchars($row['create_by']);
    // start time and link to day view
    $date = getdate($row['start_time']);
    $link = "<a href=\"day.php?day={$date['mday']}&amp;month={$date['mon']}&amp;year={$date['year']}&amp;area=" . $row['area_id'] . "\">";
    if (empty($row['enable_periods'])) {
        $link_str = time_date_string($row['start_time']);
    } else {
        list(, $link_str) = period_date_string($row['start_time']);
    }
    $link .= "{$link_str}</a>";
    //    add a span with the numeric start time in the title for sorting
    $values[] = "<span title=\"" . $row['start_time'] . "\"></span>" . $link;
    // description
    $values[] = htmlspecialchars($row['description']);
    if ($ajax) {
        $json_data['aaData'][] = $values;
    } else {
        echo "<tr>\n<td>\n";
        echo implode("</td>\n<td>", $values);
        echo "</td>\n</tr>\n";
    }
}
Ejemplo n.º 2
0
function describe_period_span($starts, $ends)
{
    list($start_period, $start_date) = period_date_string($starts);
    #$start_date = utf8_strftime('%A %d %B %Y', $starts);
    list(, $end_date) = period_date_string($ends, -1);
    $duration = $ends - $starts;
    toPeriodString($start_period, $duration, $dur_units);
    return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units;
}
Ejemplo n.º 3
0
function report_row(&$rows, &$data)
{
    global $output_format, $ajax, $ajax_capable;
    global $csv_row_sep, $csv_col_sep;
    global $custom_fields, $field_natures, $field_lengths, $tbl_entry;
    global $approval_somewhere, $confirmation_somewhere;
    global $strftime_format;
    global $select_options;
    global $field_order_list;
    // If we're capable of delivering an Ajax request and this is not Ajax request,
    // then don't do anything.  We're going to save sending the data until we actually
    // get the Ajax request;  we just send the rest of the page at this stage.
    if ($output_format == OUTPUT_HTML && $ajax_capable && !$ajax) {
        return;
    }
    $values = array();
    foreach ($field_order_list as $field) {
        $value = $data[$field];
        // Some fields need some special processing to turn the raw value into something
        // more meaningful
        switch ($field) {
            case 'end_time':
                // Calculate the duration and then fall through to calculating the end date
                // Need the duration in seconds for sorting.  Have to correct it for DST
                // changes so that the user sees what he expects to see
                $duration_seconds = $data['end_time'] - $data['start_time'];
                $duration_seconds -= cross_dst($data['start_time'], $data['end_time']);
                $d = get_duration($data['start_time'], $data['end_time'], $data['enable_periods']);
                $d_string = $d['duration'] . ' ' . $d['dur_units'];
                $d_string = escape($d_string);
            case 'start_time':
                $mod_time = $field == 'start_time' ? 0 : -1;
                if ($data['enable_periods']) {
                    list(, $date) = period_date_string($value, $mod_time);
                } else {
                    $date = time_date_string($value);
                }
                $value = $date;
                break;
            case 'type':
                $value = get_type_vocab($value);
                break;
            case 'confirmation_enabled':
                // Translate the status field bit into meaningful text
                if ($data['confirmation_enabled']) {
                    $value = $data['status'] & STATUS_TENTATIVE ? get_vocab("tentative") : get_vocab("confirmed");
                } else {
                    $value = '';
                }
                break;
            case 'approval_enabled':
                // Translate the status field bit into meaningful text
                if ($data['approval_enabled']) {
                    $value = $data['status'] & STATUS_AWAITING_APPROVAL ? get_vocab("awaiting_approval") : get_vocab("approved");
                } else {
                    $value = '';
                }
                break;
            case 'last_updated':
                $value = time_date_string($value);
                break;
            default:
                // Custom fields
                if (array_key_exists($field, $custom_fields)) {
                    // Output a yes/no if it's a boolean or integer <= 2 bytes (which we will
                    // assume are intended to be booleans)
                    if ($field_natures[$field] == 'boolean' || $field_natures[$field] == 'integer' && isset($field_lengths[$field]) && $field_lengths[$field] <= 2) {
                        $value = empty($value) ? get_vocab("no") : get_vocab("yes");
                    } elseif (isset($value)) {
                        // If the custom field is an associative array then we want
                        // the value rather than the array key (provided the key is not
                        // an empty string)
                        if (isset($select_options["entry.{$field}"]) && is_assoc($select_options["entry.{$field}"]) && array_key_exists($value, $select_options["entry.{$field}"]) && $value !== '') {
                            $value = $select_options["entry.{$field}"][$value];
                        }
                    } else {
                        $value = '';
                    }
                }
                break;
        }
        $value = escape($value);
        // For HTML output we take special action for some fields
        if ($output_format == OUTPUT_HTML) {
            switch ($field) {
                case 'name':
                    // Add a link to the entry and also a data-id value for the Bulk Delete JavaScript
                    $value = "<a href=\"view_entry.php?id=" . $data['id'] . "\"" . " data-id=\"" . $data['id'] . "\"" . " title=\"{$value}\">{$value}</a>";
                    break;
                case 'end_time':
                    // Process the duration and then fall through to the end_time
                    // Include the duration in a seconds as a title in an empty span so
                    // that the column can be sorted and filtered properly
                    $d_string = "<span title=\"{$duration_seconds}\"></span>{$d_string}";
                case 'start_time':
                case 'last_updated':
                    // Include the numeric time as a title in an empty span so
                    // that the column can be sorted and filtered properly
                    $value = "<span title=\"{$data[$field]}\"></span>{$value}";
                    break;
                default:
                    break;
            }
        }
        // Add the value to the array.   We don't bother with some fields if
        // they are going to be irrelevant
        if (($confirmation_somewhere || $field != 'confirmation_enabled') && ($approval_somewhere || $field != 'approval_enabled')) {
            $values[] = $value;
        }
        // Special action for the duration
        if ($field == 'end_time') {
            $values[] = $d_string;
        }
    }
    // foreach
    $rows[] = $values;
}
Ejemplo n.º 4
0
function start_to_end_period($starts, $ends)
{
    list(, $start_date) = period_date_string($starts);
    list(, $end_date) = period_date_string($ends, -1);
    return $start_date . " - " . $end_date;
}
function display_entry_row($row)
{
    echo "<tr>\n";
    echo "<td>&nbsp;</td>\n";
    // reservation name, with a link to the view_entry page
    echo "<td>";
    echo "<a href=\"view_entry.php?id=" . $row['id'] . "\">" . htmlspecialchars($row['name']) . "</a></td>\n";
    // create_by, area and room names
    echo "<td>" . htmlspecialchars($row['create_by']) . "</td>\n";
    echo "<td>" . htmlspecialchars($row['area_name']) . "</td>\n";
    echo "<td>" . htmlspecialchars($row['room_name']) . "</td>\n";
    // start date, with a link to the day.php
    $link = getdate($row['start_time']);
    echo "<td>";
    // <span> for sorting
    echo "<span title=\"" . $row['start_time'] . "\"></span>";
    echo "<a href=\"day.php?day={$link['mday']}&amp;month={$link['mon']}&amp;year={$link['year']}&amp;area=" . $row['area_id'] . "\">";
    if (empty($row['enable_periods'])) {
        $link_str = time_date_string($row['start_time']);
    } else {
        list(, $link_str) = period_date_string($row['start_time']);
    }
    echo "{$link_str}</a></td>";
    // action buttons
    echo "<td>\n";
    display_buttons($row, FALSE);
    echo "</td>\n";
    echo "</tr>\n";
}
Ejemplo n.º 6
0
?>
</TH>
    <TH><?php 
echo get_vocab("description");
?>
</TH>
    <TH><?php 
echo get_vocab("start_date");
?>
</TH>
   </TR>
<?php 
for ($i = 0; $row = sql_row($result, $i); $i++) {
    echo "<TR>";
    echo "<TD><A HREF=\"view_entry.php?id={$row['0']}\">" . get_vocab("view") . "</A></TD>\n";
    echo "<TD>" . htmlspecialchars($row[1]) . "</TD>\n";
    echo "<TD>" . htmlspecialchars($row[2]) . "</TD>\n";
    echo "<TD>" . htmlspecialchars($row[3]) . "</TD>\n";
    // generate a link to the day.php
    $link = getdate($row[4]);
    echo "<TD><A HREF=\"day.php?day={$link['mday']}&amp;month={$link['mon']}&amp;year={$link['year']}&amp;area={$row['5']}\">";
    if (empty($enable_periods)) {
        $link_str = time_date_string($row[4]);
    } else {
        list(, $link_str) = period_date_string($row[4]);
    }
    echo "{$link_str}</A></TD>";
    echo "</TR>\n";
}
echo "</table>\n";
include "trailer.inc";
Ejemplo n.º 7
0
$create_by = htmlspecialchars($row['create_by']);
$room_name = htmlspecialchars($row['room_name']);
$area_name = htmlspecialchars($row['area_name']);
$type = $row['type'];
$room_id = $row['room_id'];
$updated = time_date_string($row['last_updated']);
// need to make DST correct in opposite direction to entry creation
// so that user see what he expects to see
$duration = $row['duration'] - cross_dst($row['start_time'], $row['end_time']);
if ($enable_periods) {
    list($start_period, $start_date) = period_date_string($row['start_time']);
} else {
    $start_date = time_date_string($row['start_time']);
}
if ($enable_periods) {
    list(, $end_date) = period_date_string($row['end_time'], -1);
} else {
    $end_date = time_date_string($row['end_time']);
}
$rep_type = 0;
if ($series == 1) {
    $rep_type = $row['rep_type'];
    $rep_end_date = utf8_strftime('%A %d %B %Y', $row['end_date']);
    $rep_opt = $row['rep_opt'];
    $rep_num_weeks = $row['rep_num_weeks'];
    // I also need to set $id to the value of a single entry as it is a
    // single entry from a series that is used by del_entry.php and
    // edit_entry.php
    // So I will look for the first entry in the series where the entry is
    // as per the original series settings
    $sql = "SELECT id\n          FROM {$tbl_entry}\n          WHERE repeat_id=\"{$id}\" AND entry_type=\"1\"\n          ORDER BY start_time\n          LIMIT 1";
Ejemplo n.º 8
0
function describe_period_span($starts, $ends)
{
    global $enable_periods, $periods_name, $vocab, $duration;
    list($start_period, $start_date) = period_date_string($starts);
    list(, $end_date) = period_date_string($ends, -1);
    $duration = $ends - $starts;
    toPeriodString($start_period, $duration, $dur_units);
    if ($duration > 1) {
        list(, $start_date) = period_date_string($starts);
        list(, $end_date) = period_date_string($ends, -1);
        $temp = $start_date . " ==> " . $end_date;
    } else {
        $temp = $start_date . " - " . $duration . " " . $dur_units;
    }
    return $temp;
}
Ejemplo n.º 9
0
     $opt .= get_vocab('jour_cycle') . ' ' . $jours_c;
 }
 if ($opt) {
     $tplArrayEditEntry['pasPeriode']['opt'] = $opt;
     $tplArrayEditEntry['pasPeriode']['nb'] = $nb;
     /*if ($nb == 1) {
     
                     echo '<tr><td class="E"><b>'.get_vocab('rep_rep_day').'</b> '.$opt.'</td></tr>'."\n";
                 } else {
                     echo '<tr><td class="E"><b>'.get_vocab('rep_rep_days').'</b> '.$opt.'</td></tr>'."\n";
                 }*/
 } else {
     $tplArrayEditEntry['pasPeriode']['opt'] = false;
 }
 if ($enable_periods == 'y') {
     list($start_period, $start_date) = period_date_string($start_time);
 } else {
     $start_date = time_date_string($start_time, $dformat);
 }
 $duration = $end_time - $start_time;
 if ($enable_periods == 'y') {
     toPeriodString($start_period, $duration, $dur_units);
 } else {
     toTimeString($duration, $dur_units, true);
 }
 $tplArrayEditEntry['pasPeriode']['startDate'] = $start_date;
 $tplArrayEditEntry['pasPeriode']['duration'] = $duration;
 $tplArrayEditEntry['pasPeriode']['durUnits'] = $dur_units;
 $tplArrayEditEntry['pasPeriode']['repEndDate'] = $rep_end_date;
 /*echo '<tr><td class="E"><b>'.get_vocab('date').get_vocab('deux_points').'</b> '.$start_date.'</td></tr>'."\n";
   echo '<tr><td class="E"><b>'.get_vocab('duration').'</b> '.$duration.' '.$dur_units.'</td></tr>'."\n";
Ejemplo n.º 10
0
$create_by = htmlspecialchars($row[2]);
$room_name = htmlspecialchars($row[3]);
$area_name = htmlspecialchars($row[4]);
$type = $row[5];
$room_id = $row[6];
$updated = time_date_string(MDB_Date::mdbstamp2Unix($row[7]));
# need to make DST correct in opposite direction to entry creation
# so that user see what he expects to see
$duration = $row[8] - cross_dst($row[9], $row[10]);
if ($enable_periods) {
    list($start_period, $start_date) = period_date_string($row[9]);
} else {
    $start_date = time_date_string($row[9]);
}
if ($enable_periods) {
    list(, $end_date) = period_date_string($row[10], -1);
} else {
    $end_date = time_date_string($row[10]);
}
$rep_type = 0;
if ($series == 1) {
    $rep_type = $row[11];
    $rep_end_date = utf8_strftime('%A %d %B %Y', $row[12]);
    $rep_opt = $row[13];
    $rep_num_weeks = $row[14];
    # I also need to set $id to the value of a single entry as it is a
    # single entry from a series that is used by del_entry.php and
    # edit_entry.php
    # So I will look for the first entry in the series where the entry is
    # as per the original series settings
    $types = array('integer');
Ejemplo n.º 11
0
function display_entry_row($row)
{
    echo "<tr>\n";
    echo "<td class=\"control\">&nbsp;</td>\n";
    // reservation name, with a link to the view_entry page
    echo "<td>";
    echo "<a href=\"view_entry/id:" . $row['id'] . "\">" . htmlspecialchars($row['name']) . "</a></td>\n";
    // create_by, area and room names
    echo "<td>" . htmlspecialchars($row['create_by']) . "</td>\n";
    echo "<td>" . htmlspecialchars($row['area_name']) . "</td>\n";
    echo "<td>" . htmlspecialchars($row['room_name']) . "</td>\n";
    // start date, with a link to the day.php
    $link = getdate($row['start_time']);
    echo "<td>";
    $url = formatURLFull($link[year], $link[mon], $link[mday], $row['area_id'], NULL);
    echo "<a href=\"day/{$url}\">";
    if (empty($row['enable_periods'])) {
        $link_str = time_date_string($row['start_time']);
    } else {
        list(, $link_str) = period_date_string($row['start_time']);
    }
    echo "{$link_str}</a></td>";
    // action buttons
    echo "<td>\n";
    display_buttons($row, FALSE);
    echo "</td>\n";
    echo "</tr>\n";
}
Ejemplo n.º 12
0
?>
</th>
        <th><?php 
echo get_vocab("start_date");
?>
</th>
      </tr>
    </thead>
    
    <tbody>
<?php 
for ($i = 0; $row = sql_row_keyed($result, $i); $i++) {
    echo "<tr>\n";
    echo "<td><a href=\"view_entry.php?id=" . $row['entry_id'] . "\">" . get_vocab("view") . "</a></td>\n";
    echo "<td>" . htmlspecialchars($row['create_by']) . "</td>\n";
    echo "<td>" . htmlspecialchars($row['name']) . "</td>\n";
    echo "<td>" . htmlspecialchars($row['description']) . "</td>\n";
    // generate a link to the day.php
    $link = getdate($row['start_time']);
    echo "<td><a href=\"day.php?day={$link['mday']}&amp;month={$link['mon']}&amp;year={$link['year']}&amp;area=" . $row['area_id'] . "\">";
    if (empty($enable_periods)) {
        $link_str = time_date_string($row['start_time']);
    } else {
        list(, $link_str) = period_date_string($row['start_time']);
    }
    echo "{$link_str}</a></td>";
    echo "</tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
require_once "trailer.inc";
Ejemplo n.º 13
0
                    $opt .= day_name($wday);
                    $nb++;
                 }
            }
        }
        if ($rep_type == 6) {
            $nb = 1;
            //Affiche le jour cycle.
      			$opt .= get_vocab('jour_cycle').' '.$jours_c;
        }
        if($opt)
            if ($nb == 1)
                echo '<tr><td class="E"><b>'.get_vocab('rep_rep_day').'</b> '.$opt.'</td></tr>'."\n";
            else
                echo '<tr><td class="E"><b>'.get_vocab('rep_rep_days').'</b> '.$opt.'</td></tr>'."\n";
        if($enable_periods=='y') list( $start_period, $start_date) =  period_date_string($start_time);
        else $start_date = time_date_string($start_time,$dformat);
        $duration = $end_time - $start_time;
        if ($enable_periods=='y') toPeriodString($start_period, $duration, $dur_units);
        else toTimeString($duration, $dur_units, true);

        echo '<tr><td class="E"><b>'.get_vocab("date").get_vocab("deux_points").'</b> '.$start_date.'</td></tr>'."\n";
        echo '<tr><td class="E"><b>'.get_vocab("duration").'</b> '.$duration .' '. $dur_units.'</td></tr>'."\n";

        echo '<tr><td class="E"><b>'.get_vocab('rep_end_date').'</b> '.$rep_end_date.'</td></tr>'."\n";
    }
}
// Fin du tableau de la colonne de droite
echo "\n</table>\n";
// Fin de la colonne de droite et fin du tableau
echo "</td></tr></table>\n";