Ejemplo n.º 1
0
                                {
                                  alertMessage += '<?php 
    echo escape_js(mrbs_entity_decode(get_vocab("conflict")));
    ?>
' + ":  \n\n";
                                  var conflictsList = getErrorList(result.conflicts);
                                  alertMessage += conflictsList.text;
                                }
                                if (result.rules_broken.length > 0)
                                {
                                  if (result.conflicts.length > 0)
                                  {
                                    alertMessage += "\n\n";
                                  }
                                  alertMessage += '<?php 
    echo escape_js(mrbs_entity_decode(get_vocab("rules_broken")));
    ?>
' + ":  \n\n";
                                  var rulesList = getErrorList(result.rules_broken);
                                  alertMessage += rulesList.text;
                                }
                                window.alert(alertMessage);
                              }
                              turnOnPageRefresh();
                            },
                           'json');
                  }   <?php 
    // if (rectanglesIdentical(r1, r2))
    ?>
              
                };  <?php 
Ejemplo n.º 2
0
function report_header()
{
    global $output_format, $ajax;
    global $custom_fields, $tbl_entry;
    global $approval_somewhere, $confirmation_somewhere;
    global $field_order_list;
    // Don't do anything if this is an Ajax request: we only want to send the data
    if ($ajax) {
        return;
    }
    // Build an array of values to go into the header row
    $values = array();
    foreach ($field_order_list as $field) {
        // We give some columns an stype data value so that the JavaScript knows how to sort them
        switch ($field) {
            case 'name':
                $values[] = get_vocab("namebooker");
                break;
            case 'area_name':
                $values[] = get_vocab("area");
                break;
            case 'room_name':
                $values[] = get_vocab("room");
                break;
            case 'start_time':
                $values[] = stype_wrap(get_vocab("start_date"), 'title-numeric');
                break;
            case 'end_time':
                $values[] = stype_wrap(get_vocab("end_date"), 'title-numeric');
                $values[] = stype_wrap(get_vocab("duration"), 'title-numeric');
                break;
            case 'description':
                $values[] = get_vocab("fulldescription_short");
                break;
            case 'type':
                $values[] = get_vocab("type");
                break;
            case 'create_by':
                $values[] = get_vocab("createdby");
                break;
            case 'confirmation_enabled':
                if ($confirmation_somewhere) {
                    $values[] = get_vocab("confirmation_status");
                }
                break;
            case 'approval_enabled':
                if ($approval_somewhere) {
                    $values[] = get_vocab("approval_status");
                }
                break;
            case 'last_updated':
                $values[] = stype_wrap(get_vocab("lastupdate"), 'title-numeric');
                break;
            default:
                // the custom fields
                if (array_key_exists($field, $custom_fields)) {
                    $values[] = get_loc_field_name($tbl_entry, $field);
                }
                break;
        }
        // switch
    }
    // foreach
    // Find out what the non-breaking space is in this character set
    $charset = get_charset();
    $nbsp = mrbs_entity_decode('&nbsp;', ENT_NOQUOTES, $charset);
    for ($i = 0; $i < count($values); $i++) {
        if ($output_format != OUTPUT_HTML) {
            // Remove any HTML entities from the values
            $values[$i] = mrbs_entity_decode($values[$i], ENT_NOQUOTES, $charset);
            // Trim non-breaking spaces from the string
            $values[$i] = trim($values[$i], $nbsp);
            // And do an ordinary trim
            $values[$i] = trim($values[$i]);
            // We don't escape HTML output here because the vocab strings are trusted.
            // And some of them contain HTML entities such as &nbsp; on purpose
            $values[$i] = escape($values[$i]);
        }
    }
    $head_rows = array();
    $head_rows[] = $values;
    output_head_rows($head_rows, $output_format);
}
Ejemplo n.º 3
0
function csv_report_header($display)
{
    global $csv_row_sep;
    global $custom_fields, $tbl_entry;
    global $approval_somewhere, $confirmation_somewhere;
    // Build an array of values to go into the header row
    $values = array();
    $values[] = get_vocab("area") . ' - ' . get_vocab("room");
    $values[] = get_vocab("namebooker");
    if ($display == "d") {
        $values[] = get_vocab("start_date") . ' - ' . get_vocab("duration");
    } else {
        $values[] = get_vocab("start_date") . ' - ' . get_vocab("end_date");
    }
    $values[] = get_vocab("fulldescription_short");
    $values[] = get_vocab("type");
    $values[] = get_vocab("createdby");
    if ($confirmation_somewhere) {
        $values[] = get_vocab("confirmation_status");
    }
    if ($approval_somewhere) {
        $values[] = get_vocab("approval_status");
    }
    // Now do the custom fields
    foreach ($custom_fields as $key => $value) {
        $values[] = get_loc_field_name($tbl_entry, $key);
    }
    $values[] = get_vocab("lastupdate");
    // Remove any HTML entities from the values
    $n_values = count($values);
    $charset = get_charset();
    // Find out what the non-breaking space is in this character set
    $nbsp = mrbs_entity_decode('&nbsp;', ENT_NOQUOTES, $charset);
    for ($i = 0; $i < $n_values; $i++) {
        $values[$i] = mrbs_entity_decode($values[$i], ENT_NOQUOTES, $charset);
        // Trim non-breaking spaces from the string
        $values[$i] = trim($values[$i], $nbsp);
        // And do an ordinary trim
        $values[$i] = trim($values[$i]);
    }
    // Now turn the array of values into a CSV row
    $line = "";
    // initialise the row
    foreach ($values as $v) {
        $line = csv_row_add_value($line, $v);
    }
    $line .= $csv_row_sep;
    // terminate the row
    // Output the row
    echo $line;
}